A common structure for radio drivers. Used by MAC protocols.

This commit is contained in:
adamdunkels 2007-05-15 07:51:57 +00:00
parent 8437d95d82
commit 177e07992d

View file

@ -42,7 +42,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: radio.h,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $
* $Id: radio.h,v 1.2 2007/05/15 07:51:57 adamdunkels Exp $
*/
/**
@ -55,6 +55,26 @@
#ifndef __RADIO_H__
#define __RADIO_H__
/**
* The structure of a device driver for a radio in Contiki.
*/
struct radio_driver {
/** Send a packet */
int (* send)(const u8_t *buf, u16_t len);
/** Read a received packet. */
u16_t (* read)(u8_t *buf, u16_t bufsize);
/** Set a function to be called when a packet has been received. */
void (* set_receive_function)(void (*f)(const struct radio_driver *d));
/** Turn the radio on. */
int (* on)(void);
/** Turn the radio off. */
int (* off)(void);
};
/**
* \brief Turn radio on.