36 typedef int64_t osal_time_t;
38 #define ms2us(ms) ((osal_time_t) (((osal_time_t) (ms))*((osal_time_t) 1000))) 39 #define us2ms(us) ((osal_time_t) (((osal_time_t) (us))/((osal_time_t) 1000))) 40 #define us2ms_round(us) ((osal_time_t) (((osal_time_t) (us) + ((osal_time_t) 500))/((osal_time_t) 1000))) 42 #define OSAL_TIME_MAX ((osal_time_t) 0x7FFFFFFFFFFFFFFFLL) 105 enum osal_crc_ok_t crc_ok;
115 typedef struct osal_job {
116 void (*cb)(
struct osal_job *);
220 void osal_memcpy(
void *dst,
const void *src, uint16_t size);
239 void osal_memset(
void *dst, uint8_t byte, uint16_t size);
420 __attribute__ ((format (printf, 1, 2)))
uint8_t osal_get_radio_buffer_length(void)
Retrieves the length of the data inside the radio buffer.
Definition: osal.c:547
Start the reception of one packet.
Definition: osal.h:111
void osal_write32_be(uint8_t *buf, uint32_t v)
Writes data as big-endian word.
Definition: osal.c:681
void osal_memcpy(void *dst, const void *src, uint16_t size)
Copies a memory area.
Definition: osal.c:193
int8_t ih
Implicit header size.
Definition: osal.h:84
void osal_get_radio_status(osal_radio_status_t *status)
Retrieves the radio status related to the last reception or transmission.
Definition: osal.c:504
void osal_aes_setkey(const uint8_t *key)
Sets the AES key to use for encryption and decryption.
Definition: osal.c:252
Start the reception.
Definition: osal.h:112
void osal_write_radio_buffer(uint8_t *src, uint8_t length)
Fills the radio buffer with data to transmit.
Definition: osal.c:560
void osal_set_radio_callback(void(*cb)(void))
Sets a radio callback that will be called once the radio has received or transmitted a buffer...
Definition: osal.c:477
int8_t osal_get_antenna_gain(void)
Returns the antenna gain in dBi.
Definition: osal.c:319
int8_t osal_get_min_power(void)
Returns the minimum available power.
Definition: osal.c:309
uint16_t preamble_len
Length of the preamble.
Definition: osal.h:87
uint16_t osal_rand16(void)
Returns a random half-word.
Definition: osal.c:237
void osal_set_radio_params(osal_radio_params_t *params)
Sets the radio parameters.
Definition: osal.c:381
void osal_post_job(osal_job_t *job, void(*cb)(osal_job_t *))
Queue a job for immediate execution (but after any other job already in the queue).
Definition: osal.c:118
uint8_t osal_rand8(void)
Returns a random byte.
Definition: osal.c:228
uint8_t * osal_get_radio_buffer(void)
Retrieves the pointer to the radio buffer.
Definition: osal.c:537
int8_t osal_is_freq_calibration_enabled(void)
Tells if frequency calibration should be used.
Definition: osal.c:364
void osal_printf(const char *fmt,...)
Formats and prints data.
Definition: osal.c:611
uint32_t freq
Frequency in Hz.
Definition: osal.h:79
int8_t osal_radio_SF_supported(enum osal_sf_t sf)
Checks if a given SF is supported.
Definition: osal.c:329
void osal_lowpower_sleep_unlock(void)
Allows the device to go to lowpower and/or sleep mode (if the device supports a lowpower and/or a sle...
Definition: osal.c:180
void osal_radio(enum osal_radio_state_t state)
Sets the new state of the radio.
Definition: osal.c:582
osal_time_t osal_get_time(void)
Returns the elapsed time since the device has been powered-up.
Definition: osal.c:67
osal_radio_state_t
Definition: osal.h:108
uint8_t sync_word
Sync word.
Definition: osal.h:89
void osal_clear_radio_callback(void)
Clears the radio callback.
Definition: osal.c:490
int16_t rssi
RSSI.
Definition: osal.h:101
int8_t ppm_offset
Offset in ppm to apply.
Definition: osal.h:91
void osal_aes_decrypt(const uint8_t *in, uint8_t *out, uint32_t len)
Decrypts a buffer using the AES algorithm (ECB mode).
Definition: osal.c:286
int32_t freq_delta
Estimated frequency error during the reception of the frame.
Definition: osal.h:104
int8_t osal_get_max_power(void)
Returns the maximum available power.
Definition: osal.c:298
uint32_t osal_read32_le(const uint8_t *buf)
Reads data as little-endian word.
Definition: osal.c:638
uint16_t rxsyms
RX timeout in symbols.
Definition: osal.h:85
uint16_t osal_read16_le(const uint8_t *buf)
Reads data as little-endian half-word.
Definition: osal.c:628
void osal_memcpy_reverse(void *dst, const void *src, uint16_t size)
Copies a memory area in reverse order (last byte of the source area copied to the first byte of the d...
Definition: osal.c:206
Start the transmission.
Definition: osal.h:110
int8_t txpow
TX power in dBm.
Definition: osal.h:86
void osal_memset(void *dst, uint8_t byte, uint16_t size)
Fills a memory area with a constant value.
Definition: osal.c:218
void osal_post_delayed_job(osal_job_t *job, osal_time_t time, void(*cb)(osal_job_t *))
Queue a job for scheduled execution.
Definition: osal.c:139
void osal_aes_encrypt(const uint8_t *in, uint8_t *out, uint32_t len)
Encrypts a buffer using the AES algorithm (ECB mode).
Definition: osal.c:269
osal_time_t rxtime
Exact timestamp when the receiving will start.
Definition: osal.h:92
osal_time_t osal_get_additional_cpu_wakeup_latency(void)
Returns an offset that will be removed to the deadlines of timing critical tasks in case the OS sched...
Definition: osal.c:92
void osal_write32_le(uint8_t *buf, uint32_t v)
Writes data as little-endian word.
Definition: osal.c:670
osal_time_t txend
Time at which the radio finished transmitting the frame.
Definition: osal.h:103
void osal_write16_le(uint8_t *buf, uint16_t v)
Writes data as little-endian half-word.
Definition: osal.c:659
uint32_t osal_read32_be(const uint8_t *buf)
Reads data as big-endian word.
Definition: osal.c:648
void osal_cancel_job(osal_job_t *job)
Cancel a queued job.
Definition: osal.c:155
osal_time_t osal_get_radio_wakeup_latency(void)
Returns the maximum time the radio can take before being actually receiving (usually sleep to RX tran...
Definition: osal.c:78
void osal_lowpower_sleep_lock(void)
Prevents the device from going to lowpower and/or sleep mode (if the device supports a lowpower and/o...
Definition: osal.c:168
uint8_t payload_length
Length of the payload to receive.
Definition: osal.h:88
int8_t snr
SNR.
Definition: osal.h:102
int16_t osal_read_radio_rssi(void)
Returns the RSSI currently perceived by the radio.
Definition: osal.c:571
Stop the radio.
Definition: osal.h:109