From 177e07992d0c484078c46aac290f890c4ee93617 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Tue, 15 May 2007 07:51:57 +0000 Subject: [PATCH] A common structure for radio drivers. Used by MAC protocols. --- core/dev/radio.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/core/dev/radio.h b/core/dev/radio.h index 4bd828266..5b9144286 100644 --- a/core/dev/radio.h +++ b/core/dev/radio.h @@ -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.