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


Detailed Description

Defines some functions to "alloc" pkts and dispatch them to the hci-controller.

Author:
Mathias Payer <payerm@student.ethz.ch>
Date:
2004/04/17 18:15:09
See also:
bt_hci_dispatch.c for implementation details and descriptions

#include <bt/bt_hci_defs.h>
#include <bt/bt_defs.h>

Functions

bt_hci_cmd_response_bt_hci_cmd_get_response (struct btstack *stack, u_short ogcocf, u_short cmd_handle)
void _bt_hci_dumpWaitQueue (struct btstack *stack)
bt_hci_con_handle_t _bt_hci_get_app_con_handle (struct btstack *stack, _bt_hci_module_con_handle_t module_con_handle)
short _bt_hci_get_free_con_entry_index (struct btstack *stack)
_bt_hci_module_con_handle_t _bt_hci_get_module_con_handle (struct btstack *stack, bt_hci_con_handle_t app_con_handle)
bt_hci_cmd_response_bt_hci_intro_cmd (struct btstack *stack, struct bt_hci_cmd_response *wcmd, struct bt_hci_cmd_response *response, struct bt_hci_pkt_cmd *cmd, u_char ogf, u_short ocf)
long _bt_hci_outro_cmd (struct btstack *stack, struct bt_hci_cmd_response *wcmdpointer, struct bt_hci_cmd_response *response, u_short ogfocf, u_short cmd_handle)
void _bt_hci_pkts_init (struct btstack *stack)
int _bt_hci_setWaitQueue (struct btstack *stack, struct bt_hci_cmd_response *resp)
int _bt_hci_wakeup (struct btstack *stack, u_short ogcocf, u_short cmd_handle, long response)
void _bt_hci_wakeup_index (struct btstack *stack, u_char index, long response)
void _bt_hci_wakeup_latest (struct btstack *stack, long response)
void _bt_hci_wakeup_unset (struct btstack *stack)


Function Documentation

struct bt_hci_cmd_response* _bt_hci_cmd_get_response ( struct btstack stack,
u_short  ogcocf,
u_short  cmd_handle 
)

Saves a bt_hci_cmd_response in the bt-internal layout. The calle can wait with his bt_hci_cmd_response for the event to come back!

Parameters:
stack The bt-stack to use.
ogcocf Which ocf/ogf event will be woken up
cmd_handle The cmd handle (BT_HCI_HANDLE_INVALID if unused)
Returns:
0 on error, or the bt_hci_cmd_response struct otherwise

void _bt_hci_dumpWaitQueue ( struct btstack stack  ) 

dumps the bt hci cmd waitqueue to stdout

Parameters:
stack The bt-stack to use.

bt_hci_con_handle_t _bt_hci_get_app_con_handle ( struct btstack stack,
_bt_hci_module_con_handle_t  module_con_handle 
)

Translates a module con handle into the app (unique) con handle

Parameters:
stack The bt-stack to use.
module_con_handle The module con_handle
Returns:
BT_HCI_HANDLE_INVALID on error, the app_con_handle on success

short _bt_hci_get_free_con_entry_index ( struct btstack stack  ) 

Gets an index of a free connection entry from the stack

Parameters:
stack The bt-stack to use.
Returns:
-1 on error, or the index otherwise

_bt_hci_module_con_handle_t _bt_hci_get_module_con_handle ( struct btstack stack,
bt_hci_con_handle_t  app_con_handle 
)

Translates a app (unique) con handle into the module con handle

Parameters:
stack The bt-stack to use.
app_con_handle The module con_handle
Returns:
BT_HCI_HANDLE_INVALID on error, the module_con_handle on success

struct bt_hci_cmd_response* _bt_hci_intro_cmd ( struct btstack stack,
struct bt_hci_cmd_response wcmd,
struct bt_hci_cmd_response response,
struct bt_hci_pkt_cmd cmd,
u_char  ogf,
u_short  ocf 
)

Gets called by all hci cmds. Waits until the controller accepts more pkts and the cmd-buffer is empty Then it checks, if the call is sync or async.

Parameters:
stack The bt-stack to use.
wcmd The local cmd_response, if the call is sync
response Pointer to the response.
ogf OGF
ocf OCF
Returns:
Pointer to the actual (local or remote) bt_hci_cmd_response that is used

long _bt_hci_outro_cmd ( struct btstack stack,
struct bt_hci_cmd_response wcmdpointer,
struct bt_hci_cmd_response response,
u_short  ogfocf,
u_short  cmd_handle 
)

Gets called by all hci cmds. If necessary, setup wcmdpointer struct with ocgfocf + connection handle, then register the wcmdpointer in the stack's waitqueue. Sends the pkt. to the transport If call is synchronous (response == BT_HCI_SYNC), wait for cmd completion

Parameters:
stack The bt-stack to use.
wcmdpointer Pointer to the used bt_hci_cmd_response
response Pointer to the response.
ogfocf OGF/OCF of this call
cmd_handle Handle of this call (app con handle used!!, BT_HCI_HANDLE_INVALID if unused)
Returns:
Pointer to the actual (local or remote) bt_hci_cmd_response that is used

void _bt_hci_pkts_init ( struct btstack stack  ) 

Initializes all the packets of a stack.

Parameters:
stack The bt-stack to use.

int _bt_hci_setWaitQueue ( struct btstack stack,
struct bt_hci_cmd_response resp 
)

Saves a bt_hci_cmd_response in the bt-internal layout. The calle can wait with his bt_hci_cmd_response for the event to come back!

Parameters:
stack The bt-stack to use.
resp the pointer to bt_hci_cmd_response, that will be entered in the btstack-queue
Returns:
0 if there was a free slot, -1 on error

int _bt_hci_wakeup ( struct btstack stack,
u_short  ogcocf,
u_short  cmd_handle,
long  response 
)

Wake all threads that wait on ogcocf & con_handle combination and stores the response in all waiting bt_hci_cmd_response structs The call can wait with his bt_hci_cmd_response for the event to come back!

Parameters:
stack The bt-stack to use.
ogcocf Which ocf/ogf event will be woken up
cmd_handle the cmd handle (BT_HCI_HANDLE_INVALID if unused)
response The response that the woken-up-thread gets back
Returns:
0 if an entry was fuond, -1 on error

void _bt_hci_wakeup_index ( struct btstack stack,
u_char  index,
long  response 
)

Wakes one thread of waitque and stores the response in all waiting bt_hci_cmd_response structs The call can wait with his bt_hci_cmd_response for the event to come back!

Parameters:
stack The bt-stack to use.
index The index of bt_hci_cmd_response to use.
response The response that the woken-up-thread gets back
Returns:
0 if an entry was fuond, -1 on error

void _bt_hci_wakeup_latest ( struct btstack stack,
long  response 
)

Wakes thread that is waiting for Command Status Event and stores the response in all waiting bt_hci_cmd_response structs The call can wait with his bt_hci_cmd_response for the event to come back!

Parameters:
stack The bt-stack to use.
response The response that the woken-up-thread gets back

void _bt_hci_wakeup_unset ( struct btstack stack  )  [inline]

Sets latest wait queue command entry to NONE


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 !!!