If you want to write your own transport-layer you have to implement the three functions in this file, everything else is your choice.
In the btstack, the transport pointer is for the transport-layer specific data.
You can save there anything you want?
#include <bt/bt_defs.h>
#include <sys/device.h>
#include <stdio.h>
#include <arch/btn-hardware.h>
Functions | |
void | _bt_hci_aquire_write_lock (struct btstack *stack) |
u_char * | _bt_hci_get_pkt (struct btstack *stack, u_short *len, u_long *t_arrive) |
Gets a pkt from the uart. This function has to be polled! Here a thread blocks until a pkt is read from the uart. | |
int | _bt_hci_initdev (struct btstack *stack) |
Initializes the given uart. | |
int | _bt_hci_lowlevel_set_baudrate (int uart, u_long baud) |
Sets the baudrate of the host. | |
int | _bt_hci_lowlevel_write (struct btstack *stack, u_char *buffer, u_short len) |
void | _bt_hci_relase_write_lock (struct btstack *stack) |
int | _bt_hci_send_pkt (struct btstack *stack, u_char *pktptr) |
Sends a packet to the uart. |
void _bt_hci_aquire_write_lock | ( | struct btstack * | stack | ) |
low-level functions for bt_acl
To construct an hci packet on the fly, call aquire_lock, send parts with lowlevel_write and release_lock
Gets a pkt from the uart. This function has to be polled! Here a thread blocks until a pkt is read from the uart.
stack | the BT-stack to use | |
len | Pointer to the variable where the size of the data read stored | |
t_arrive | Pointer to the variable where the arrival time of the packet is stored |
int _bt_hci_initdev | ( | struct btstack * | stack | ) |
Initializes the given uart.
Initializes the uart, given by uart_dev and sets the baudrate initially to BT_UART_INITIAL_SPEED (->bt_defs.h).
int _bt_hci_lowlevel_set_baudrate | ( | int | uart, | |
u_long | baud | |||
) |
Sets the baudrate of the host.
Sets the baudrate of the uart (not the bt controller!) to the given value.
This function should only be called by internal functions like bt_hci_set_baudrate() !
uart | The uart to change. | |
baud | New baudrate |
Sends a packet to the uart.
Sends a packet to the uart, the sender has to check if the bt-controller ist still able to receive packets, else the sender has to block (wait)
stack | the BT-stack to use | |
*pktptr | Pointer to a hci packet |