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


Detailed Description

Defines general structs and variables.

Author:
Martin Hinz <btnode@hinz.ch>
Date:
02/08/2004
Author:
Mathias Payer <payerm@student.ethz.ch>
Date:
2004/04/14 21:37:09
Author:
Matthias Ringwald <mringwal@inf.ethz.ch>

#include <sys/types.h>

Data Structures

struct  bt_hci_connection
struct  bt_hci_pkt_acl
struct  bt_hci_pkt_cmd
struct  bt_hci_pkt_evt
struct  bt_hci_pkt_sco

Defines

#define BD_ADDR_CMP(A, B)   (((A)[0]==(B)[0])&&((A)[1]==(B)[1])&&((A)[2]==(B)[2])&&((A)[3]==(B)[3])&&((A)[4]==(B)[4])&&((A)[5]==(B)[5]))
#define BD_ADDR_LEN   6
 Length of a bluetooth device address.
#define BD_SADDR_CMP(A, B)   (((A)[0]==(B)[0])&&((A)[1]==(B)[1]))
#define BT_HCI_AUTH_ESTABLISHED   0x07
#define BT_HCI_AUTH_GOTKEYREQ   0x02
#define BT_HCI_AUTH_GOTPINREQ   0x05
#define BT_HCI_AUTH_NONE   0x00
#define BT_HCI_AUTH_SENTKEYRESP   0x03
#define BT_HCI_AUTH_SENTPINRESP   0x06
#define BT_HCI_AUTH_SENTREQ   0x01
#define BT_HCI_CONN_INVALID   0x00
#define BT_HCI_CONN_MODE_ACTIVE   0x00
#define BT_HCI_CONN_MODE_HOLD   0x01
#define BT_HCI_CONN_MODE_PARK   0x03
#define BT_HCI_CONN_MODE_SNIFF   0x02
#define BT_HCI_CONN_STATE_ACK   0x02
#define BT_HCI_CONN_STATE_OPEN   0x05
#define BT_HCI_CONN_STATE_WAITACK   0x03
#define BT_HCI_CONN_STATE_WAITPAS   0x04
#define BT_HCI_CONN_UNINITIALIZED   0x01
#define BT_HCI_GET_OCF(addr)   (((*((addr)+1)<<8) | *(addr)) & 0x3FF)
 Get the 10-bit ocf value from a u_short address.
#define BT_HCI_GET_OGF(addr)   ((*((addr)+1)>>2) & 0x3F)
 Get the 6-bit ogf value from a u_short address .
#define BT_HCI_HANDLE_INVALID   0xFFFF
#define BT_HCI_MAX_NUM_CON   BT_HCI_MAX_NUM_SLAVE_CON + BT_HCI_MAX_NUM_MASTER_CON
#define BT_HCI_MAX_NUM_MASTER_CON   3
#define BT_HCI_MAX_NUM_SLAVE_CON   7
#define BT_HCI_PACKET_TYPE_DH1   0x0010
#define BT_HCI_PACKET_TYPE_DH3   0x0800
#define BT_HCI_PACKET_TYPE_DH5   0x8000
#define BT_HCI_PACKET_TYPE_DM1   0x0008
#define BT_HCI_PACKET_TYPE_DM3   0x0400
#define BT_HCI_PACKET_TYPE_DM5   0x4000
#define BT_HCI_VALID_CLOCK_OFFSET   1<<15
#define CHANGE_CONNECTION_PACKET_TYPE   0x0F
#define DEFAULT_CON_ACCEPT_TIMEOUT   125*256
 The default connection accept timeout set by the stack x 0.625ms.
#define DEFAULT_PAGE_TIMEOUT   128*256
 The default page timeout set by the stack x 0.625 ms.
#define FLUSH_OCF   0x08
#define HCI_ACL_DATA_PACKET   0x02
#define HCI_ACL_DATA_PKT_HDR   0x04
#define HCI_BC_ACTIVE   1
 ACL Broadcast Flags.
#define HCI_BC_PICONET   2
 ACL Broadcast Flags.
#define HCI_BC_UNICAST   0
 ACL Broadcast Flags.
#define HCI_CMD_DATA_PKT_HDR   0x03
#define HCI_COMMAND_DATA_PACKET   0x01
#define HCI_EVENT_PACKET   0x04
#define HCI_EVENT_PKT_HDR   0x02
#define HCI_OCF_HC_DELETE_STORED_LINK_KEY   0x12
#define HCI_OCF_HC_HOST_BUFFER_SIZE   0x33
#define HCI_OCF_HC_HOST_NUM_OF_COMPLETED_PACKETS_OCF   0x35
#define HCI_OCF_HC_READ_AUTHENTICATION_ENABLE   0x1f
#define HCI_OCF_HC_READ_COD   0x23
#define HCI_OCF_HC_READ_CONNECTION_ACCEPT_TIMEOUT   0x15
#define HCI_OCF_HC_READ_INQUIRY_MODE   0x44
#define HCI_OCF_HC_READ_INQUIRY_SCAN_TYPE   0x42
#define HCI_OCF_HC_READ_LINK_SUPERVISION_TIMEOUT   0x36
#define HCI_OCF_HC_READ_LOCAL_NAME   0x14
#define HCI_OCF_HC_READ_PAGE_TIMEOUT   0x17
#define HCI_OCF_HC_READ_PIN_TYPE   0x09
#define HCI_OCF_HC_READ_SCAN_ENABLE   0x19
#define HCI_OCF_HC_RESET   0x03
#define HCI_OCF_HC_SET_EVENT_FILTER   0x05
#define HCI_OCF_HC_SET_EVENT_MASK   0x01
#define HCI_OCF_HC_SET_HOST_CTRL_TO_HOST_FLOW_CONTROL   0x31
#define HCI_OCF_HC_WRITE_AUTHENTICATION_ENABLE   0x20
#define HCI_OCF_HC_WRITE_COD   0x24
#define HCI_OCF_HC_WRITE_CONNECTION_ACCEPT_TIMEOUT   0x16
#define HCI_OCF_HC_WRITE_ENCRYPTION_MODE   0x22
#define HCI_OCF_HC_WRITE_INQUIRY_MODE   0x45
#define HCI_OCF_HC_WRITE_INQUIRY_SCAN_TYPE   0x43
#define HCI_OCF_HC_WRITE_LINK_SUPERVISION_TIMEOUT   0x37
#define HCI_OCF_HC_WRITE_LOCAL_NAME   0x13
#define HCI_OCF_HC_WRITE_PAGE_TIMEOUT   0x18
#define HCI_OCF_HC_WRITE_PIN_TYPE   0x0A
#define HCI_OCF_HC_WRITE_SCAN_ENABLE   0x1A
#define HCI_OCF_HC_WRITE_STORED_LINK_KEY   0x11
#define HCI_OCF_IP_READ_BD_ADDR   0x09
#define HCI_OCF_IP_READ_BUFFER_SIZE   0x05
#define HCI_OCF_IP_READ_LOCAL_EXTENDED_FEATURES   0x04
#define HCI_OCF_IP_READ_LOCAL_SUPPORTED_COMMANDS   0x02
#define HCI_OCF_IP_READ_LOCAL_SUPPORTED_FEATURES   0x03
#define HCI_OCF_IP_READ_LOCAL_VERSION_INFORMATION   0x01
#define HCI_OCF_LC_ACCEPT_CONNECTION_REQUEST   0x09
#define HCI_OCF_LC_AUTHENTICATION_REQUESTED   0x11
#define HCI_OCF_LC_CREATE_CONNECTION   0x05
#define HCI_OCF_LC_CREATE_CONNECTION_CANCEL   0x08
#define HCI_OCF_LC_DISCONNECT   0x06
#define HCI_OCF_LC_INQUIRY   0x01
#define HCI_OCF_LC_INQUIRY_CANCEL   0x02
#define HCI_OCF_LC_LINK_KEY_REQUEST_NEGATIVE_REPLY   0x0C
#define HCI_OCF_LC_LINK_KEY_REQUEST_REPLY   0x0B
#define HCI_OCF_LC_PIN_CODE_REQUEST_REPLY   0x0D
#define HCI_OCF_LC_READ_CLOCK_OFFSET   0x1F
#define HCI_OCF_LC_REJECT_CONNECTION_REQUEST   0x0A
#define HCI_OCF_LC_REMOTE_NAME_REQUEST   0x19
#define HCI_OCF_LP_EXIT_PARK_STATE   0x06
#define HCI_OCF_LP_EXIT_SNIFF_MODE   0x04
#define HCI_OCF_LP_HOLD_MODE   0x01
#define HCI_OCF_LP_PARK_STATE   0x05
#define HCI_OCF_LP_READ_DEFAULT_LINK_POLICY_SETTINGS   0x0E
#define HCI_OCF_LP_READ_LINK_POLICY_SETTINGS   0x0C
#define HCI_OCF_LP_ROLE_CHANGE   0x0B
#define HCI_OCF_LP_ROLE_DISCOVERY   0x09
#define HCI_OCF_LP_SNIFF_MODE   0x03
#define HCI_OCF_LP_WRITE_DEFAULT_LINK_POLICY_SETTINGS   0x0F
#define HCI_OCF_LP_WRITE_LINK_POLICY_SETTINGS   0x0D
#define HCI_OCF_NOP   0x00
 NOP OCF for the NOP command.
#define HCI_OCF_SP_GET_LINK_QUALITY   0x03
 OCF for status commands.
#define HCI_OCF_SP_READ_CLOCK   0x07
#define HCI_OCF_SP_READ_RSSI   0x05
#define HCI_OCF_VC_ERICSSON_SET_UART_BAUD_RATE   0x09
 OCF for vendor specific commands.
#define HCI_OCF_VC_ZEEVO_CHANGE_BAUD_RATE   0x0F
 OCF for vendor specific commands.
#define HCI_OCF_VC_ZEEVO_READ_ABSOLUTE_RSSI   0x12
 OCF for vendor specific commands.
#define HCI_OGF_HOST_CONTROL   0x03
 OGF for host controller und baseband commands.
#define HCI_OGF_INFORMATIONAL_PARAMS   0x04
 OGF for informational parameters.
#define HCI_OGF_LINK_CONTROL   0x01
 OGF for link control commands.
#define HCI_OGF_LINK_POLICY   0x02
 OGF for link policy commands.
#define HCI_OGF_NOP   0x00
 NOP OGF for the NOP command.
#define HCI_OGF_STATUS_PARAMS   0x05
 OGF for status parameters.
#define HCI_OGF_TEST_COMMANDS   0x06
 OGF for test commands.
#define HCI_OGF_VENDOR_COMMANDS   0x3f
 OGF for vendor specific commands.
#define HCI_PB_CONTD_FRAGMENT   1
 ACL Packet Boundary Flags: fragmentation continue.
#define HCI_PB_FIRST_FRAGMENT   2
 ACL Packet Boundary Flags: first fragmentation.
#define HCI_SCO_DATA_PACKET   0x03
#define HCI_SCO_DATA_PKT_HDR   0x03
#define LINK_KEY_LEN   16
 The link key type.
#define LINK_KEY_REQUEST_NEG_REPLY_OCF   0x0c
#define READ_COUNTRY_CODE   0x07
#define READ_REMOTE_SUPPORTED_FEATURES   0x1b
#define READ_REMOTE_VERSION_INFORMATION   0x1d
#define READ_TRANSMIT_POWER_LEVEL   0x2d
#define WRITE_AUTOMATIC_FLUSH_TIMEOUT_OCF   0x28

Typedefs

typedef u_short _bt_hci_module_con_handle_t
typedef u_char bt_addr_t [BD_ADDR_LEN]
 The type bluetooth device address.
typedef u_short bt_hci_con_handle_t
typedef u_char link_key_t [LINK_KEY_LEN]

Variables

bt_addr_t bt_addr_null
bt_hci_con_handle_t bt_hci_app_con_handle_counter


Define Documentation

#define BD_ADDR_CMP ( A,
 )     (((A)[0]==(B)[0])&&((A)[1]==(B)[1])&&((A)[2]==(B)[2])&&((A)[3]==(B)[3])&&((A)[4]==(B)[4])&&((A)[5]==(B)[5]))

to compare two bluetooth addr

#define BT_HCI_AUTH_GOTKEYREQ   0x02

Get Link key request and sent either link key or negative reply

#define BT_HCI_AUTH_GOTPINREQ   0x05

Got PIN request and sent PIN response

#define BT_HCI_AUTH_NONE   0x00

Authentication request send

#define BT_HCI_AUTH_SENTKEYRESP   0x03

Got PIN request

#define BT_HCI_AUTH_SENTPINRESP   0x06

Connection authentication sucessully established

#define BT_HCI_AUTH_SENTREQ   0x01

Got Link key request

#define BT_HCI_CONN_INVALID   0x00

Con. is not yet initialized (but soon will be)

#define BT_HCI_CONN_MODE_ACTIVE   0x00

Connection in hold mode

#define BT_HCI_CONN_MODE_HOLD   0x01

Connection in sniff mode

#define BT_HCI_CONN_MODE_PARK   0x03

Connection not authenticated

#define BT_HCI_CONN_MODE_SNIFF   0x02

Connection in park state

#define BT_HCI_CONN_STATE_ACK   0x02

Create conn has been sent, waiting for ack

#define BT_HCI_CONN_STATE_OPEN   0x05

Connection in active mode

#define BT_HCI_CONN_STATE_WAITACK   0x03

Accept conn has been sent, waiting for ack

#define BT_HCI_CONN_STATE_WAITPAS   0x04

Conn. is open and we can send data

#define BT_HCI_CONN_UNINITIALIZED   0x01

Conn. is before conn. accept request

#define BT_HCI_GET_OCF ( addr   )     (((*((addr)+1)<<8) | *(addr)) & 0x3FF)

Get the 10-bit ocf value from a u_short address.

little endian (as the controller expects it): we use the principle: the caller makes it right (adjusts it for the controller)

 0        10    16               24
 +---------+-----+----------------+--------------
 |   OCF   | OGF | PARAMETER LEN  | PARAMETER ...
 +---------+-----+----------------+--------------

#define BT_HCI_GET_OGF ( addr   )     ((*((addr)+1)>>2) & 0x3F)

Get the 6-bit ogf value from a u_short address .

little endian (as the controller expects it): we use the principle: the caller makes it right (adjusts it for the controller)

 0        10    16               24
 +---------+-----+----------------+--------------
 |   OCF   | OGF | PARAMETER LEN  | PARAMETER ...
 +---------+-----+----------------+--------------
luckily our OGF values are only 6-bit wide, so we just shift ogf left by 2!

#define BT_HCI_HANDLE_INVALID   0xFFFF

indicates an invalid connection handle

#define BT_HCI_MAX_NUM_SLAVE_CON   7

Here is specified, how many open conns. the bt-stack can handle.

The number of connections the bt-controller can handle is determined at startup of the stack.

#define BT_HCI_PACKET_TYPE_DH1   0x0010

Connection packet types DM1:
pkt size 0-27 bytes using 1 slot

Examples:
bt-lego/bt-lego.c.

#define BT_HCI_PACKET_TYPE_DH3   0x0800

Connection packet types DM1:
pkt size 0-183 bytes using 3 slots

Examples:
btstreamer/streamer/btstreamer.c.

#define BT_HCI_PACKET_TYPE_DH5   0x8000

Connection packet types DM1:
pkt size 0-339 bytes using 5 slots

#define BT_HCI_PACKET_TYPE_DM1   0x0008

Connection packet types DM1:
pkt size 0-17 bytes using 1 slot

Examples:
bt-lego/bt-lego.c.

#define BT_HCI_PACKET_TYPE_DM3   0x0400

Connection packet types DM1:
pkt size 0-121 bytes using 3 slots

Examples:
bt-lego/bt-lego.c, and mhop_blink/mhop_blink.c.

#define BT_HCI_PACKET_TYPE_DM5   0x4000

Connection packet types DM1:
pkt size 0-224 bytes using 5 slots

#define BT_HCI_VALID_CLOCK_OFFSET   1<<15

indicates that the closck offset is valid if this bit is set Bit 15 is set (started from 0)

#define HCI_ACL_DATA_PACKET   0x02

Indicates (first byte) that this pkt is a acl pkt. Will be sent to and from the module.

#define HCI_COMMAND_DATA_PACKET   0x01

Indicates (first byte) that this pkt to the bluetooth module is a command pkt. The module will send a HCI_EVENT_PACKET for response.

#define HCI_EVENT_PACKET   0x04

Indicates (first byte) that this pkt is an event pkt. Only sent by the bluetooth module.

#define HCI_SCO_DATA_PACKET   0x03

Indicates (first byte) that this pkt is a sco pkt. Will be sent to and from the module.


Typedef Documentation

typedef u_short _bt_hci_module_con_handle_t

this is the connection handle to communicate with the bt module (not unique) and for internal use only

typedef u_short bt_hci_con_handle_t

unique app connection handle to access open baseband connections ( this is different to the module connection handle internally used to communicate with the bt module )

Examples:
bt-lego/bt-lego.c, btstreamer/receiver/btreceiver.c, and btstreamer/streamer/btstreamer.c.


Variable Documentation

bt_hci_con_handle_t bt_hci_app_con_handle_counter

Global counter for the unique application connection handle


Generated on Wed Apr 29 11:12:28 2009 for BTnut System Software by doxygen 1.5.1