1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include/transceiver.h
Oliver Hahm d378ee1930 * added getter and setter for the channel to transceiver
* receiving now seems to work...
2010-11-24 21:45:38 +01:00

82 lines
2.3 KiB
C

#ifndef TRANSCEIVER_H
#define TRANSCEIVER_H
#include <radio/types.h>
/* Packets to buffer */
#define TRANSCEIVER_BUFFER_SIZE (10)
/* Stack size for transceiver thread */
#define TRANSCEIVER_STACK_SIZE (4096)
/* The maximum of threads to register */
#define TRANSCEIVER_MAX_REGISTERED (10)
/**
* @brief Message types for transceiver interface
*/
enum transceiver_msg_type_t {
/* Packet types for driver <-> transceiver communication */
RCV_PKT_CC1020, ///< packet was received by CC1020 transceiver
RCV_PKT_CC1100, ///< packet was received by CC1100 transceiver
/* Packet types for transceiver <-> upper layer communication */
PKT_PENDING, ///< packet pending in transceiver buffer
SND_PKT, ///< request for sending a packet
SND_ACK, ///< request for sending an acknowledgement
SWITCH_RX, ///< switch transceiver to RX sate
POWERDOWN, ///< power down transceiver
GET_CHANNEL, ///< Get current channel
SET_CHANNEL, ///< Set a new channel
/* Error messages */
ENOBUFFER,
};
/**
* @brief All supported transceivers
*/
typedef enum {
TRANSCEIVER_NONE, ///< Invalid
TRANSCEIVER_CC1100, ///< CC110X transceivers
TRANSCEIVER_CC1020 ///< CC1020 transceivers
} transceiver_type_t;
/**
* @brief Manage registered threads per transceiver
*/
typedef struct {
transceiver_type_t transceivers; ///< the tranceivers the thread is registered for
int pid; ///< the thread's pid
} registered_t;
typedef struct {
transceiver_type_t transceivers;
void *data;
} transceiver_command_t;;
extern void *transceiver_rx_buffer;
/**
* @brief Initializes the transceiver module for certain transceiver types
*
* @param transceivers Specifies all transceivers to init
**/
void transceiver_init(transceiver_type_t transceivers);
/**
* @brief Runs the transceiver thread
*/
int transceiver_start(void);
/**
* @brief register a thread for events from certain transceivers
*
* @param transceivers The transceiver types to register for
* @param pid The pid of the thread to register
*
* return 1 on success, 0 otherwise
*/
uint8_t transceiver_register(transceiver_type_t transceivers, int pid);
#endif /* TRANSCEIVER_H */