wpan.h File Reference

Wireless Personal Area Network routines. More...

#include "pic_utils.h"
#include "config.h"
#include "mrf24j40.h"
#include "spi_hw.h"
Include dependency graph for wpan.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  wpan_address

Defines

#define FRAME_TYPE_ACK   0b010
#define FRAME_TYPE_BEACON   0b000
#define FRAME_TYPE_DATA   0b001
#define FRAME_TYPE_MAC_COMMAND   0b011
#define MAC_CMD_ASSOC_REQ   0x01
#define MAC_CMD_ASSOC_RES   0x02
#define MAC_CMD_BEACON_REQ   0x07
#define MAC_CMD_COORD_REALIGN   0x08
#define MAC_CMD_DATA_REQ   0x04
#define MAC_CMD_DISASSOC   0x03
#define MAC_CMD_GTS_REQ   0x09
#define MAC_CMD_ORPHAN   0x06
#define MAC_CMD_PAN_ID_CONFLICT   0x05
#define WPAN_ADDR_TYPE_EXTENDED   0b00000011
#define WPAN_ADDR_TYPE_NONE   0b00000000
#define WPAN_ADDR_TYPE_SHORT   0b00000010

Functions

void wpan_data_received_callback (wpan_address *addr, uns8 *data, uns8 data_size, uns8 lqi, uns8 rssi)
 Callback for data received.
void wpan_data_transmitted_callback (uns8 status, uns8 retries, uns8 channel_busy)
 Callback for data transmitted.
void wpan_handle_receive ()
 Handle reception of packet.
void wpan_init ()
 Initialise this and lower layers ready for use.
void wpan_print_address (wpan_address *addr)
 Print the address of the packet.
void wpan_print_frame_type (uns8 frame_type)
 Print information about the WPAN frame type.
void wpan_print_mac_command (uns8 *data)
 Debug routine that prints out the mac command type.
void wpan_process ()
 Process WPAN layer.
void wpan_setup_io ()
 Setup IO as requred.

Variables

uns8 pkt_received

Detailed Description

Put this in your config.h

// ------------------------
// WPAN (802.15.4) wireless
// ------------------------

#define WPAN_USE_MRF24J50
// ------------------------

Definition in file wpan.h.


Define Documentation

#define FRAME_TYPE_ACK   0b010

Definition at line 79 of file wpan.h.

Referenced by wpan_print_frame_type().

#define FRAME_TYPE_BEACON   0b000

Definition at line 77 of file wpan.h.

Referenced by wpan_handle_receive(), and wpan_print_frame_type().

#define FRAME_TYPE_DATA   0b001
#define FRAME_TYPE_MAC_COMMAND   0b011

Definition at line 80 of file wpan.h.

Referenced by wpan_handle_receive(), and wpan_print_frame_type().

#define MAC_CMD_ASSOC_REQ   0x01

Definition at line 67 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_ASSOC_RES   0x02

Definition at line 68 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_BEACON_REQ   0x07

Definition at line 73 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_COORD_REALIGN   0x08

Definition at line 74 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_DATA_REQ   0x04

Definition at line 70 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_DISASSOC   0x03

Definition at line 69 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_GTS_REQ   0x09

Definition at line 75 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_ORPHAN   0x06

Definition at line 72 of file wpan.h.

Referenced by wpan_print_mac_command().

#define MAC_CMD_PAN_ID_CONFLICT   0x05

Definition at line 71 of file wpan.h.

Referenced by wpan_print_mac_command().

#define WPAN_ADDR_TYPE_EXTENDED   0b00000011

Definition at line 63 of file wpan.h.

Referenced by wpan_handle_receive(), and wpan_print_address().

#define WPAN_ADDR_TYPE_NONE   0b00000000

Definition at line 65 of file wpan.h.

Referenced by wpan_handle_receive().

#define WPAN_ADDR_TYPE_SHORT   0b00000010

Definition at line 64 of file wpan.h.

Referenced by wpan_handle_receive(), and wpan_print_address().


Function Documentation

void wpan_data_received_callback ( wpan_address addr,
uns8 *  data,
uns8  data_size,
uns8  lqi,
uns8  rssi 
)

After the packet has been processed and the address extracted, it is delivered to the callback function.

void wpan_data_transmitted_callback ( uns8  status,
uns8  retries,
uns8  channel_busy 
)

Once the lower layers have attempted to transmit the packet, the results will be presented to the callback.

Parameters:
status Set to 0 for success or 1 for failure
retries Set to the number of retries
channel_busy Set to 1 if failure was due to the channel being busy.

Definition at line 804 of file its_mode2.c.

References its2_transmitting.

Referenced by mrf24j40_transmit_callback().

Here is the caller graph for this function:

void wpan_handle_receive (  ) 
void wpan_init (  ) 

Initialise underlying hardware (typically mrf24j40)

Definition at line 336 of file wpan.c.

References mrf24j40_init().

Referenced by its1_controller_init(), its1_device_init(), its2_device_init(), and its_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void wpan_print_address ( wpan_address addr  ) 
void wpan_print_frame_type ( uns8  frame_type  ) 

Definition at line 148 of file wpan.c.

References FRAME_TYPE_ACK, FRAME_TYPE_BEACON, FRAME_TYPE_DATA, FRAME_TYPE_MAC_COMMAND, and serial_print_str().

Referenced by wpan_data_received_callback().

Here is the call graph for this function:

Here is the caller graph for this function:

void wpan_print_mac_command ( uns8 *  data  ) 

Print the MAC layer command details

Definition at line 166 of file wpan.c.

References MAC_CMD_ASSOC_REQ, MAC_CMD_ASSOC_RES, MAC_CMD_BEACON_REQ, MAC_CMD_COORD_REALIGN, MAC_CMD_DATA_REQ, MAC_CMD_DISASSOC, MAC_CMD_GTS_REQ, MAC_CMD_ORPHAN, MAC_CMD_PAN_ID_CONFLICT, serial_print_int_hex(), serial_print_str(), serial_putc(), and uns8.

Here is the call graph for this function:

void wpan_process (  ) 

Call wpan_process() regularly to handle events at the WPAN layer. Typically this includes handling any received packets, processing them, and handing up to a higher layer.

Definition at line 214 of file wpan.c.

References pkt_received, and wpan_handle_receive().

Here is the call graph for this function:

void wpan_setup_io (  ) 

Set up ports and pins for WPAN use

Definition at line 332 of file wpan.c.

References mrf24j40_setup_io().

Referenced by its1_setup_io(), and its2_setup_io().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 53 of file wpan.c.

Referenced by mrf24j40_receive_callback(), wpan_handle_receive(), and wpan_process().


Generated on Wed Dec 8 13:47:56 2010 for Pic Pack by  doxygen 1.6.1