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


Detailed Description

UART specific function This file defines the get_pkt and send_pkt functions for the uart-layer See hci_transport_usb.h for the usb packet-sending.
.

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?

Author:
Mathias Payer <payerm@student.ethz.ch>
Date:
2004/04/14 19:44:09

#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.


Function Documentation

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

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.

Parameters:
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
Returns:
Pointer to the pkt or O on error.

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).

Returns:
O, or <0 on (not recoverable) error.
See also:
bt_hci_lowelevel_get_baudrate(), bt_hci_lowlevel_set_baudrate()

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

Parameters:
uart The uart to change.
baud New baudrate
Returns:
O, or -1 on error.
See also:
bt_hci_set_baudrate()

int _bt_hci_send_pkt ( struct btstack stack,
u_char pktptr 
)

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)

Parameters:
stack the BT-stack to use
*pktptr Pointer to a hci packet
Returns:
O, or -1 on error.


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