Communications Interface


Modules

 Radio Interface
 Serial Interfaces
 Linux COM Functions
 Loopback Interface
 Generic COM Functions
 COM Helper Functions

Data Structures

struct  comBuf_t
 The standard comBuf data structure is designed to be used across multiple different communication devices. A comBuf contains an array of bytes, the number of bytes, and possibly some other fields, depending on the specific platform. More...

Available Interfaces

Each of the following can be used with the com_send(), com_recv(), com_mode(), and com_ioctl() functions.

#define IFACE_SERIAL   0
 the UART0 serial interface.
#define IFACE_SERIAL2   1
 the UART1 serial interface.
#define IFACE_RADIO   2
 the CC2420 or CC1000 radio interface.
#define IFACE_LOOPBACK   3
 the loopback interface.
#define MAX_IFS   7

COM Error Messages

These values can be returned from com layer functions when an error occurs.

#define SELECT_IFACE_BUSY   150
 The requested interface is busy.
#define IFACE_NOT_REGISTERED   160
 The requested interface does not exist.

COM Select

com_select can be used to check if there is data available to be read from a specified interface. This function is similar to the berkley socket select() function.

#define IF_SET(iface, set)   (*set |= 1 << iface)
 Add the specified interface to the IF_SET pointed to by set.
#define IF_CLEAR(iface, set)   (*set &= ~(1 << iface))
 Remove the specified interface from the IF_SET pointed to by set.
#define IF_ZERO(set)   (*set = 0)
 Remove all interfaces from the IF_SET pointed to by set.
#define IF_ISSET(iface, set)   (*set & (1 << iface))
 Returns non-zero if the specified interface is set in the IF_SET pointed to by set.
#define COM_BLOCK   -1
 pass to com_select() to block until an interface becomes readable
#define COM_NOBLOCK   0
 pass to com_select() to return immediately
typedef uint8_t IF_SET
 represents a set of interfaces
uint8_t com_select (IF_SET *iset, uint32_t msec)
 Check a set of interfaces for valid data.

COM Modes

These values can be passed to the com_mode() function for each com interface. Note that not all interfaces support every mode.

enum  {
  IF_OFF = 0,
  IF_STANDBY,
  IF_IDLE,
  IF_LISTEN
}
 The possible mode settings for interface devices. More...

Defines

#define PREAMBLE   0x53
#define PREAMBLE_SIZE   2
#define ELFPKT_BYTE0   65
#define ELFPKT_BYTE1   75
#define ELFPKT_BYTE2   85
#define ELFPKT_BYTE3   95

Typedefs

typedef comBuf_t comBuf
 The standard comBuf data structure is designed to be used across multiple different communication devices. A comBuf contains an array of bytes, the number of bytes, and possibly some other fields, depending on the specific platform.

Functions

void cc2420_init (void)
uint16_t cc2420_get_last_rssi ()
 get the RSSI value of the last received packet from the CC2420 Radio.
void cc2420_wait_for_osc (void)
void cc2420_set_channel (uint8_t chan)
 Changes the channel which the CC2420 transmits and receives on.
uint8_t com_init ()
void com_swap_bufs (uint8_t iface, comBuf *buf, comBuf **ret)
 This is called by a driver when it has a full recv buffer. Also called by a driver to just get another buffer, in which case buf is null.
char is_elf_packet (comBuf *buf)

Variables

uint8_t comBuf_t::data [COM_DATA_SIZE]
 An array of bytes representing the contents of the comBuf. The maximum number of bytes that may be placed in a comBuf is represented by COM_DATA_SIZE.
uint16_t comBuf_t::signal
 For a comBuf received from the radio driver, The RSSI value (signal strength indicator). This member is only available of GET_RSSI has been defined in com.h.
uint8_t comBuf_t::size
 The number of data bytes located in the data array of this comBuf.
uint16_t comBuf_t::source
mos_mutex_t if_send_mutexes [MAX_IFS]

Detailed Description

This group contains functions associated with communications devices, Such as the radio and UART.

Define Documentation

#define ELFPKT_BYTE0   65
 

For internal use only.

used for ELF propogation

Definition at line 511 of file com.h.

#define ELFPKT_BYTE1   75
 

For internal use only.

used for ELF propogation

Definition at line 513 of file com.h.

#define ELFPKT_BYTE2   85
 

For internal use only.

used for ELF propogation

Definition at line 515 of file com.h.

#define ELFPKT_BYTE3   95
 

For internal use only.

used for ELF propogation

Definition at line 517 of file com.h.

#define MAX_IFS   7
 

For internal use only.

The maximum number of interfaces.

Definition at line 168 of file com.h.


Enumeration Type Documentation

anonymous enum
 

Enumerator:
IF_OFF  Interface is off.
IF_STANDBY  Interface is in low power mode with wakeup.
IF_IDLE  Interface is on, but not listening.
IF_LISTEN  Interface is on and listening for data.

Definition at line 310 of file com.h.

00310      {
00312    IF_OFF = 0, 
00314    IF_STANDBY,
00316    IF_IDLE,
00318    IF_LISTEN,
00319 #ifdef RADIO_USE_FEC
00320 
00321    IF_FEC_ENABLE,
00323    IF_FEC_DISABLE 
00324 #endif
00325 };


Function Documentation

uint16_t cc2420_get_last_rssi  ) 
 

Returns:
an RSSI value.

void cc2420_init void   ) 
 

For internal use only.

Initialization routine for CC2420

void cc2420_set_channel uint8_t  chan  ) 
 

Parameters:
chan the new channel.

void cc2420_wait_for_osc void   ) 
 

For internal use only.

wait for the oscillator.

uint8_t com_init  ) 
 

For internal use only.

Init com layer. Must be called before any ifaces try to register.

Returns:
Always returns 0

uint8_t com_select IF_SET iset,
uint32_t  msec
 

Parameters:
iset Interface set to check. After the function returns, iset contains only interfaces with data available. Use IF_ISSET() to determine which interfaces are set.
msec the number of milliseconds to wait for data before returning.
Returns:
The number of interfaces that are set in iset, or a COM Error Code.

void com_swap_bufs uint8_t  iface,
comBuf buf,
comBuf **  ret
 

For internal use only.

Swaps full receive buffer with a fresh buffer.

Drivers must register before they call swap_bufs!

Parameters:
iface Interface to use
buf Buffer to use
Returns:
New buffer

char is_elf_packet comBuf buf  ) 
 

For internal use only.

used for ELF propogation


Variable Documentation

mos_mutex_t if_send_mutexes[MAX_IFS]
 

For internal use only.

Used by the com layer to synchronize access to devices when transmiting data.


Generated on Mon Nov 23 06:26:00 2009 for MANTIS by  doxygen 1.4.6