btnode/include/cc/bmac.h File Reference


Detailed Description

B-MAC implementation for the CC1000 radio based on [Polastre et al., Versatile Low Power Media Access for Wireless Sensor Networks] and [Polastre, Sensor Network Media Access Design].

Author:
Mario Strasser <mast@gmx.net>

#include <sys/types.h>
#include <cc/mac.h>

Defines

#define BMAC_DEBUG(str,)   {}

Functions

void bmac_cmds_register_cmds (void)
void bmac_disable_timer_interrupt (int disable_timer)
void bmac_enable_led (int enable_led)
u_char bmac_get_ack (void)
u_short bmac_get_address (void)
u_short bmac_get_mtu (void)
int bmac_init (u_short address)
int bmac_receive (u_short *src, u_short *dst, u_char *data, u_short *data_length, u_long ms)
int bmac_send (u_short dst, u_char *data, u_short data_len)
void bmac_set_ack (u_char enable_ack)
void bmac_set_congestion_backoff (u_char max_duration)
void bmac_set_initial_backoff (u_char max_duration)
void bmac_set_lpl_interval (u_short interval)
void bmac_use_interrupt_to_send (int use_irq)

Variables

u_long bmac_failed_count
mac_interface_t bmac_interface
u_long bmac_recv_count


Define Documentation

#define BMAC_DEBUG ( str   )     {}

define this if debug output should be printed


Function Documentation

void bmac_cmds_register_cmds ( void   ) 

Registers some B-MAC related btnode terminal-commands.

void bmac_disable_timer_interrupt ( int  disable_timer  ) 

Enables/disables the deactivation of the timer interrupt while sending.

Parameters:
disable_timer [in] true (1) to enable or false (0) to disable the deactivation mechanism

void bmac_enable_led ( int  enable_led  ) 

Enables/disables led feedback.

Parameters:
enable_led [in] true (1) to enable or false (0) to disable led feedback
Examples:
ccc-cmd/ccc-cmd.c.

u_char bmac_get_ack ( void   ) 

Queries the status pf the automatic acknowledgments of unicast packets.

Returns:
true (1) if automatic acknowledgments are enabled, alse (0) if automatic acknowledgments are disabled

u_short bmac_get_address ( void   ) 

Returns the configured mac address.

Returns:
configured mac address.

u_short bmac_get_mtu ( void   ) 

Returns the maximal payload size of a B-MAC packet.

Returns:
maximal payload size of a B-MAC packet.

int bmac_init ( u_short  address  ) 

Initialises the B-MAC library.

Parameters:
address [in] mac address of the node
Returns:
0 on success, -1 otherwise.
Examples:
ccc-cmd/ccc-cmd.c.

int bmac_receive ( u_short src,
u_short dst,
u_char data,
u_short data_length,
u_long  ms 
)

Receives a B-MAC packet.

Parameters:
src [out] source address
dst [out] destination address
data [out] payload of the packet
data_length [in] maximal size of the payload [out] actual size of the payload
ms [in] maximal duration (in ms) to wait for a packet
Returns:
0 on success, -1 on timeout.

int bmac_send ( u_short  dst,
u_char data,
u_short  data_len 
)

Sends a B-MAC packet.

Parameters:
dst [in] destination address
data [in] payload of the packet
data_len [in] payload size
Returns:
0 on success, -1 otherwise.

void bmac_set_ack ( u_char  enable_ack  ) 

Enables/disables the automatic acknowledgment of unicast packets.

Parameters:
enable_ack [in] true (1) to enable or false (0) to disable automatic acknowledgments

void bmac_set_congestion_backoff ( u_char  max_duration  ) 

Sets the maximal duration of the congestion backoff.

Parameters:
max_duration [in] maximal congestion backoff-time

void bmac_set_initial_backoff ( u_char  max_duration  ) 

Sets the maximal duration of the initial backoff.

Parameters:
max_duration [in] maximal initial backoff-time

void bmac_set_lpl_interval ( u_short  interval  ) 

Sets the duration of a LPL interval. If the interval is set to zero, LPL is disabled and the radio is permanently on.

Parameters:
interval [in] duration of the interval in ms

void bmac_use_interrupt_to_send ( int  use_irq  ) 

Enables/disables the usage of the SPI interrupt for sending.

Parameters:
use_irq [in] true (1) to enable the usage of the SPI interrupt or false (0) to use busy-waiting


Variable Documentation

mac_interface_t bmac_interface

MAC-Interface

Examples:
ccc-cmd/ccc-cmd.c.


Generated on Tue Jan 23 21:12:24 2007 for BTnut System Software by doxygen 1.4.7