btnut/btnode/include/bt/bt_acl_defs.h File Reference


Detailed Description

API for using the ACL layer.

Author:
Kevin Martin <kevmarti@tik.ee.ethz.ch>
Date:
2006/03/23
Contains:

#include <sys/types.h>
#include <bt/bt_defs.h>
#include <bt/bt_hci_api.h>

Defines

ACL Payload Sizes
These are the defines of the different ACL payload sizes

#define BT_ACL_HCI_PKT_HDR_LEN   5
#define BT_ACL_PAYLOAD_SIZE_DH1   26
#define BT_ACL_PAYLOAD_SIZE_DH3   183
#define BT_ACL_PAYLOAD_SIZE_DH5   339
#define BT_ACL_PAYLOAD_SIZE_DM1   16
#define BT_ACL_PAYLOAD_SIZE_DM3   121
#define BT_ACL_PAYLOAD_SIZE_DM5   224

Functions

u_short bt_acl_get_max_pkt_len (struct btstack *stack)
 Returns the maximal ACL payload size.
u_short bt_acl_get_pkt_types (struct btstack *stack)
 Returns current setting of ACL packet types to use.
Sending ACL Data
The following functions define the API provided to send ACL data.

long bt_acl_acquire_write_lock (struct btstack *stack, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short length)
 Acquires a given baseband connection to send ACL data.
long bt_acl_lowlevel_write (struct btstack *stack, u_char *data, u_short len)
 Writes ACL data to the previousely acquired baseband connection.
long bt_acl_send_packet (struct btstack *stack, bt_hci_con_handle_t con_hdl, u_char pb_flag, u_char bc_flag, u_char *data, u_short len)
 Sends an ACL data packet.
void bt_acl_write_lock_release (struct btstack *stack)
 Releases a given baseband connection.
ACL Packet Accessors
API functions for accessing the header fileds of received ACL packets.

u_char bt_acl_get_bc_flag (struct bt_hci_pkt_acl *pkt)
 Returns the broadcast flag of the ACL packet passed.
bt_hci_con_handle_t bt_acl_get_con_handle (struct bt_hci_pkt_acl *pkt)
 Returns the con handle the ACL packet passed was received on.
u_charbt_acl_get_data_pointer (struct bt_hci_pkt_acl *pkt)
 Returns a pointer to the payload of an ACL packet.
u_char bt_acl_get_pb_flag (struct bt_hci_pkt_acl *pkt)
 Returns the fragmentation flag of the ACL packet passed.
Initialization
u_short bt_acl_init (struct btstack *stack, u_short pkt_types)
 Initializes the ACL layer.


Define Documentation

#define BT_ACL_HCI_PKT_HDR_LEN   5

Size of the HCI packet header that gets attached to each acl packet

Note: includes the hci-type field.

#define BT_ACL_PAYLOAD_SIZE_DH1   26

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH1.

#define BT_ACL_PAYLOAD_SIZE_DH3   183

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH3.

#define BT_ACL_PAYLOAD_SIZE_DH5   339

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DH5.

#define BT_ACL_PAYLOAD_SIZE_DM1   16

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM1.

#define BT_ACL_PAYLOAD_SIZE_DM3   121

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM3.

#define BT_ACL_PAYLOAD_SIZE_DM5   224

Maximal amount of user data (in bytes) that can be sent over an ACL in a single packet using packets of type DM5.


Function Documentation

long bt_acl_acquire_write_lock ( struct btstack stack,
bt_hci_con_handle_t  con_handle,
u_char  pb_flag,
u_char  bc_flag,
u_short  length 
)

Acquires a given baseband connection to send ACL data.

Basically, this function provides unique access to the bt uart and writes the information needed by the hci layer to send acl data over a given baseband communication link to the bt controller.

Parameters:
stack The bt-stack to use
con_handle Connection handle of the desired baseband connection
pb_flag Packet Boundary Flag HCI_PB_FIRST_FRAGMENT or HCI_PB_CONTD_FRAGMENT
bc_flag Broadcast Flag HCI_BC_UNICAST, HCI_BC_ACTIVE or HCI_BC_PICONET
length Amount of ACL data to send
Returns:
0 or possible errors:
Note: ACL data can be sent to the con handle BT_HCI_CON_HANDLE_OWN, i.e. to the sending device itself.

See also:
bt_acl_lowlevel_write
bt_acl_write_lock_release

u_char bt_acl_get_bc_flag ( struct bt_hci_pkt_acl pkt  )  [inline]

Returns the broadcast flag of the ACL packet passed.

Parameters:
pkt Pointer to the received ACL packet

bt_hci_con_handle_t bt_acl_get_con_handle ( struct bt_hci_pkt_acl pkt  )  [inline]

Returns the con handle the ACL packet passed was received on.

Parameters:
pkt Pointer to the received ACL packet

u_char* bt_acl_get_data_pointer ( struct bt_hci_pkt_acl pkt  )  [inline]

Returns a pointer to the payload of an ACL packet.

Parameters:
pkt Pointer to the received ACL packet

u_short bt_acl_get_max_pkt_len ( struct btstack stack  )  [inline]

Returns the maximal ACL payload size.

Note: Maximal ACL payload size depends on the ACL packet types to use. This has to be defined during initialization.

Parameters:
stack Pointer to the bt-stack in use
Returns:
maximal ACL payload size
See also:
bt_acl_init
bt_hci_defs.h

u_char bt_acl_get_pb_flag ( struct bt_hci_pkt_acl pkt  )  [inline]

Returns the fragmentation flag of the ACL packet passed.

Parameters:
pkt Pointer to the received ACL packet

u_short bt_acl_get_pkt_types ( struct btstack stack  )  [inline]

Returns current setting of ACL packet types to use.

Note: The ACL packet types to use has to be defined during initialization.

Parameters:
stack Pointer to the bt-stack in use
Returns:
packet types in use (see
See also:
bt_acl_init
bt_hci_defs.h

u_short bt_acl_init ( struct btstack stack,
u_short  pkt_types 
)

Initializes the ACL layer.

Sets the ACL packet type(s) to use and creates the first ACL buffer.

Note: When dealing with ACL data packets, this function should be called immediately after the bt-stack has been initialized! The reason for this is that setting the ACL packet types to use determines the size of the ACL buffers to be used on the receiving side.

Note: ACL packet type definition can be found in bt_hci_defs.h

Parameters:
stack The bt-stack to use
pkt_types ACL packet type(s) to use
Returns:
Maximal ACL pkt payload size, corresponding to the packet types chosen.
See also:
bt_hci_defs.h
Examples:
bt-lego/bt-lego.c, and mhop_blink/mhop_blink.c.

long bt_acl_lowlevel_write ( struct btstack stack,
u_char data,
u_short  len 
) [inline]

Writes ACL data to the previousely acquired baseband connection.

Use bt_acl_acquire_write_lock to get access to a desired baseband connection. Write your data, and release the connection using bt_acl_write_lock_release.

Parameters:
stack Pointer to the bt-stack in use
data Pointer to the data to be written
len Number of bytes to be written
See also:
bt_acl_acquire_write_lock
bt_acl_write_lock_release

long bt_acl_send_packet ( struct btstack stack,
bt_hci_con_handle_t  con_hdl,
u_char  pb_flag,
u_char  bc_flag,
u_char data,
u_short  len 
)

Sends an ACL data packet.

Parameters:
stack Pointer to the bt-stack to use
con_hdl Connection handle of the desired baseband connection
pb_flag Packet Boundary Flag HCI_PB_FIRST_FRAGMENT or HCI_PB_CONTD_FRAGMENT
bc_flag Broadcast Flag HCI_BC_UNICAST, HCI_BC_ACTIVE or HCI_BC_PICONET
length Amount of ACL data to send
Returns:
0 or possible errors:

void bt_acl_write_lock_release ( struct btstack stack  )  [inline]

Releases a given baseband connection.

Call this function after you've written your data to the bt-controller using bt_acl_lowlevel_write.

Parameters:
stack Pointer to the bt-stack in use
See also:
bt_acl_acquire_write_lock
bt_acl_lowlevel_write


Generated on Wed Apr 29 11:12:28 2009 for BTnut System Software by doxygen 1.5.1
!!! Dieses Dokument stammt aus dem ETH Web-Archiv und wird nicht mehr gepflegt !!!
!!! This document is stored in the ETH Web archive and is no longer maintained !!!