at86rf2xx_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Alaeddine Weslati <alaeddine.weslati@inria.fr>
3  * Copyright (C) 2015 Freie Universität Berlin
4  * 2017 HAW Hamburg
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser General
7  * Public License v2.1. See the file LICENSE in the top level directory for more
8  * details.
9  */
10 
24 #ifndef AT86RF2XX_INTERNAL_H
25 #define AT86RF2XX_INTERNAL_H
26 
27 #include <stdint.h>
28 
29 #include "at86rf2xx.h"
30 
31 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
32 #include <string.h>
33 #include "at86rf2xx_registers.h"
34 #endif
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 #ifdef MODULE_AT86RF212B
45 #define AT86RF2XX_TXPOWER_MAX (36)
46 #elif MODULE_AT86RF233
47 #define AT86RF2XX_TXPOWER_MAX (21)
48 #else
49 #define AT86RF2XX_TXPOWER_MAX (20)
50 #endif
51 
55 #ifdef MODULE_AT86RF212B
56 #define AT86RF2XX_TXPOWER_OFF (25)
57 #else
58 #define AT86RF2XX_TXPOWER_OFF (17)
59 #endif
60 
65 #define AT86RF2XX_WAKEUP_DELAY (306U)
66 
71 #define AT86RF2XX_RESET_PULSE_WIDTH (62U)
72 
79 #define AT86RF2XX_RESET_DELAY (62U)
80 
89 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
90 static inline uint8_t at86rf2xx_reg_read(const at86rf2xx_t *dev, volatile uint8_t *addr) {
91  (void) dev;
92  return *addr;
93 }
94 #else
95 uint8_t at86rf2xx_reg_read(const at86rf2xx_t *dev, uint8_t addr);
96 #endif
97 
105 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
106 static inline void at86rf2xx_reg_write(const at86rf2xx_t *dev, volatile uint8_t *addr,
107  const uint8_t value) {
108  (void) dev;
109  *addr = value;
110 }
111 #else
112 void at86rf2xx_reg_write(const at86rf2xx_t *dev, uint8_t addr, uint8_t value);
113 #endif
114 
123 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
124 static inline void at86rf2xx_sram_read(const at86rf2xx_t *dev, uint8_t offset,
125  uint8_t *data, size_t len) {
126  (void)dev;
127  memcpy(data, (void*)(AT86RF2XX_REG__TRXFBST + offset), len);
128 }
129 #else
130 void at86rf2xx_sram_read(const at86rf2xx_t *dev, uint8_t offset,
131  uint8_t *data, size_t len);
132 #endif
133 
141 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
142 static inline void at86rf2xx_sram_write(const at86rf2xx_t *dev, uint8_t offset,
143  const uint8_t *data, size_t len) {
144  (void)dev;
145  memcpy((void*)(AT86RF2XX_REG__TRXFBST + offset), data, len);
146 }
147 #else
148 void at86rf2xx_sram_write(const at86rf2xx_t *dev, uint8_t offset,
149  const uint8_t *data, size_t len);
150 #endif
151 
159 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
160 static inline void at86rf2xx_fb_start(const at86rf2xx_t *dev) {
161  (void) dev;
162 }
163 #else
164 void at86rf2xx_fb_start(const at86rf2xx_t *dev);
165 #endif
166 
175 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
176 static inline void at86rf2xx_fb_read(const at86rf2xx_t *dev, uint8_t *data, size_t len) {
177  (void)dev;
178  memcpy(data, (void*)AT86RF2XX_REG__TRXFBST, len);
179 }
180 #else
181 void at86rf2xx_fb_read(const at86rf2xx_t *dev, uint8_t *data, size_t len);
182 #endif
183 
190 #if defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
191 static inline void at86rf2xx_fb_stop(const at86rf2xx_t *dev) {
192  (void) dev;
193 }
194 #else
195 void at86rf2xx_fb_stop(const at86rf2xx_t *dev);
196 #endif
197 
204 uint8_t at86rf2xx_get_status(const at86rf2xx_t *dev);
205 
212 
219 
220 
227 
228 #if AT86RF2XX_RANDOM_NUMBER_GENERATOR || defined(DOXYGEN)
229 
244 void at86rf2xx_get_random(const at86rf2xx_t *dev, uint8_t *data, size_t len);
245 #endif
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
251 #endif /* AT86RF2XX_INTERNAL_H */
252 
at86rf2xx_reg_write
void at86rf2xx_reg_write(const at86rf2xx_t *dev, uint8_t addr, uint8_t value)
Write to a register at address addr from device dev.
at86rf2xx_fb_stop
void at86rf2xx_fb_stop(const at86rf2xx_t *dev)
Stop a read transcation internal frame buffer of the given device.
at86rf2xx_reg_read
uint8_t at86rf2xx_reg_read(const at86rf2xx_t *dev, uint8_t addr)
Read from a register at address addr from device dev.
at86rf2xx_configure_phy
void at86rf2xx_configure_phy(at86rf2xx_t *dev)
Set PHY parameters based on channel and page number.
at86rf2xx_get_status
uint8_t at86rf2xx_get_status(const at86rf2xx_t *dev)
Convenience function for reading the status of the given device.
at86rf2xx_fb_read
void at86rf2xx_fb_read(const at86rf2xx_t *dev, uint8_t *data, size_t len)
Read the internal frame buffer of the given device.
at86rf2xx_registers.h
Register and command definitions for AT86RF2xx devices.
at86rf2xx.h
Interface definition for AT86RF2xx based drivers.
at86rf2xx_sram_read
void at86rf2xx_sram_read(const at86rf2xx_t *dev, uint8_t offset, uint8_t *data, size_t len)
Read a chunk of data from the SRAM of the given device.
at86rf2xx_assert_awake
void at86rf2xx_assert_awake(at86rf2xx_t *dev)
Make sure that device is not sleeping.
at86rf2xx_get_random
void at86rf2xx_get_random(const at86rf2xx_t *dev, uint8_t *data, size_t len)
Read random data from the RNG.
at86rf2xx_sram_write
void at86rf2xx_sram_write(const at86rf2xx_t *dev, uint8_t offset, const uint8_t *data, size_t len)
Write a chunk of data into the SRAM of the given device.
at86rf2xx_fb_start
void at86rf2xx_fb_start(const at86rf2xx_t *dev)
Start a read transcation internal frame buffer of the given device.
at86rf2xx_hardware_reset
void at86rf2xx_hardware_reset(at86rf2xx_t *dev)
Trigger a hardware reset.
at86rf2xx_t
Device descriptor for AT86RF2XX radio devices.
Definition: at86rf2xx.h:246