Microchip® Advanced Software Framework

csma.c File Reference

    A Carrier Sense Multiple Access (CSMA) MAC layer
Author
Adam Dunkels adam@.nosp@m.sics.nosp@m..se
#include "net/mac/csma.h"
#include "net/packetbuf.h"
#include "net/queuebuf.h"
#include "sys/ctimer.h"
#include "sys/contiki-clock.h"
#include "lib/random.h"
#include "net/netstack.h"
#include "lib/list.h"
#include "lib/memb.h"
#include <string.h>
#include <stdio.h>

Data Structures

struct  neighbor_queue
 
struct  qbuf_metadata
 

Macros

#define _DEBUG_   0
 
#define CSMA_MAX_BACKOFF_EXPONENT   3
 
#define CSMA_MAX_MAC_TRANSMISSIONS   3
 
#define CSMA_MAX_NEIGHBOR_QUEUES   4
 
#define MAX_QUEUED_PACKETS   QUEUEBUF_NUM
 
#define PRINTF(...)
 

Functions

static unsigned short channel_check_interval (void)
 
static clock_time_t default_timebase (void)
 
static void free_packet (struct neighbor_queue *n, struct rdc_buf_list *p)
 
static void init (void)
 
static void input_packet (void)
 
 LIST (neighbor_list)
 
 MEMB (neighbor_memb, struct neighbor_queue, CSMA_MAX_NEIGHBOR_QUEUES)
 
 MEMB (packet_memb, struct rdc_buf_list, MAX_QUEUED_PACKETS)
 
 MEMB (metadata_memb, struct qbuf_metadata, MAX_QUEUED_PACKETS)
 
static struct neighbor_queueneighbor_queue_from_addr (const linkaddr_t *addr)
 
static int off (int keep_radio_on)
 
static int on (void)
 
static void packet_sent (void *ptr, int status, int num_transmissions)
 
static void send_packet (mac_callback_t sent, void *ptr)
 
static void transmit_packet_list (void *ptr)
 

Variables

struct mac_driver csma_driver
 

#define _DEBUG_   0
#define CSMA_MAX_BACKOFF_EXPONENT   3

Referenced by packet_sent().

#define CSMA_MAX_MAC_TRANSMISSIONS   3

Referenced by send_packet().

#define CSMA_MAX_NEIGHBOR_QUEUES   4
#define MAX_QUEUED_PACKETS   QUEUEBUF_NUM
#define PRINTF (   ...)

static unsigned short channel_check_interval ( void  )
static
static clock_time_t default_timebase ( void  )
static
static void init ( void  )
static

References memb_init().

static void input_packet ( void  )
static
LIST ( neighbor_list  )
MEMB ( neighbor_memb  ,
struct neighbor_queue  ,
CSMA_MAX_NEIGHBOR_QUEUES   
)
MEMB ( packet_memb  ,
struct rdc_buf_list  ,
MAX_QUEUED_PACKETS   
)
MEMB ( metadata_memb  ,
struct qbuf_metadata  ,
MAX_QUEUED_PACKETS   
)
static struct neighbor_queue* neighbor_queue_from_addr ( const linkaddr_t addr)
static
static int off ( int  keep_radio_on)
static

References NETSTACK_RDC, and rdc_driver::off.

static int on ( void  )
static

References NETSTACK_RDC, and rdc_driver::on.

static void transmit_packet_list ( void *  ptr)
static

struct mac_driver csma_driver
Initial value:
= {
"CSMA",
on,
off,
}
static unsigned short channel_check_interval(void)
Definition: csma.c:423
static void input_packet(void)
Definition: csma.c:405
goto init
Definition: dhcpc.c:392
static int off(int keep_radio_on)
Definition: csma.c:417
static int on(void)
Definition: csma.c:411
static void send_packet(mac_callback_t sent, void *ptr)
Definition: csma.c:314