btnut/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)
void bmac_enable_promiscuous_mode (int enable_promisuous_mode)
u_char bmac_get_ack (void)
u_short bmac_get_address (void)
u_short bmac_get_mtu (void)
int bmac_init (u_short address)
void bmac_lpl_start (void)
void bmac_lpl_stop (void)
int bmac_receive (u_short *src, u_short *dst, u_char *type, u_char *flags, u_char *data, u_short *data_length, u_long *send_timestamp, u_long *recv_timestamp, u_long ms)
void bmac_receive_interrupt (void)
int bmac_send (u_short dst, u_char type, u_char timestamp, 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_frequency (u_long newFreqHz)
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.

void bmac_enable_promiscuous_mode ( int  enable_promisuous_mode  ) 

Enable promiscuous mode

Parameters:
enable_promisuous_mode [in] true (1) to enable or false (0) to receive all packets

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.

void bmac_lpl_start ( void   ) 

Turns on the low power listening, useful to re-turn on the radio

void bmac_lpl_stop ( void   ) 

Turns off the low power listening, useful to turn off the radio

int bmac_receive ( u_short src,
u_short dst,
u_char type,
u_char flags,
u_char data,
u_short data_length,
u_long send_timestamp,
u_long recv_timestamp,
u_long  ms 
)

Receives a B-MAC packet.

Deprecated:
use the ccc api instead

void bmac_receive_interrupt ( void   ) 

Unblocks the bmac_receive call.

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

Sends a B-MAC packet.

Deprecated:
use the ccc api instead

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_frequency ( u_long  newFreqHz  ) 

Set the radio to a specific frequency

Note:
if using BMAC with LPL, this function has to be used instead of cc1000_set_frequency
Parameters:
new frequency in hertz

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 Wed Apr 29 11:12:29 2009 for BTnut System Software by doxygen 1.5.1