AVR MEGARF MAC Symbol Counter Driver Definitions.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | CONCAT(a, b) a ## b |
String concatenation by preprocessor used to create proper register names. More... | |
#define | MACSC_ABSOLUTE_CMP 0 |
#define | MACSC_READ32(reg) |
Creates proper subregister names and reads the corresponding values. More... | |
#define | MACSC_RELATIVE_CMP 1 |
#define | MACSC_WRITE32(reg, val) |
Typedefs | |
typedef void(* | macsc_callback_t )(void) |
Interrupt event callback function type. More... | |
Enumerations | |
enum | macsc_cc_channel { MACSC_CC1 = 1, MACSC_CC2 = 2, MACSC_CC3 = 3 } |
enum | macsc_xtal { MACSC_16MHz = 0, MACSC_32KHz = 1 } |
MAC SC clock source select. More... | |
Functions | |
bool | is_macsc_backoff_enable (void) |
Check if back-off slot counter is enabled. More... | |
bool | is_macsc_enable (void) |
Check if MACSC is enabled. More... | |
static void | macsc_backoff_slot_cnt_disable (void) |
Disable back-off slot counter. More... | |
static bool | macsc_backoff_slot_cnt_enable (void) |
enable back-off slot counter More... | |
static void | macsc_clear_cmp_interrupt_flag (enum macsc_cc_channel channel) |
Clears Compare interrupt. More... | |
static void | macsc_clear_overflow_flag (void) |
Clears the Overflow flag. More... | |
static void | macsc_clear_slot_cntr_interrupt_flag (void) |
Clears the Backoff Slot cntr interrupt flag. More... | |
void | macsc_disable (void) |
Disable MAC SC. More... | |
void | macsc_enable (void) |
Enable MAC SC. More... | |
static void | macsc_enable_auto_ts (void) |
Enable the Auto SFD and Beacon Timestamping feature If this bit is zero,only manual beacon timestamping can be used. More... | |
void | macsc_enable_cmp_int (enum macsc_cc_channel channel) |
Enables compare interrupts of the MACSC. More... | |
static void | macsc_enable_manual_bts (void) |
Write the Beacon Timestamp register of the MAC Symbol counter The manual beacon timestamping can be used in conjunction with the relative compare mode of the three compare units to generate compare match interrupts without having a beacon frame received. More... | |
static void | macsc_enable_overflow_interrupt (void) |
Enable the MACSC Overflow interrupt. More... | |
static bool | macsc_is_cmp_interrupt_flag_set (enum macsc_cc_channel channel) |
Reports if Compare interrupt has occurred. More... | |
static bool | macsc_is_overflow_flag_set (void) |
Tests if the Overflow flag is set. More... | |
static bool | macsc_is_slot_cntr_interrupt_flag_set (void) |
Tests if the Backoff slot cntr interrupt flag is set. More... | |
static uint32_t | macsc_read32 (volatile uint8_t *hh, volatile uint8_t *hl, volatile uint8_t *lh, volatile uint8_t *ll) |
Reads the 32-bit timer register in the required order of bytes. More... | |
static uint32_t | macsc_read_bts (void) |
Reads the Beacon Timestamp register. More... | |
static enum macsc_xtal | macsc_read_clock_source (void) |
Read MAC SC Clock Source. More... | |
static uint32_t | macsc_read_count (void) |
Reads the Counter value of the MAC Symbol counter. More... | |
static bool | macsc_read_status (void) |
Read the MACSC status register This bit is set if a write operation to the symbol counter register is pending. More... | |
static uint32_t | macsc_read_ts (void) |
Reads the SFD Timestamp register. More... | |
void | macsc_set_backoff_slot_cntr_int_cb (macsc_callback_t callback) |
Set MACSC backoff slot counter interrupt callback function. More... | |
void | macsc_set_cmp1_int_cb (macsc_callback_t callback) |
Set MACSC Compare Channel 1 interrupt callback function. More... | |
void | macsc_set_cmp2_int_cb (macsc_callback_t callback) |
Set MACSC Compare Channel 2 interrupt callback function. More... | |
void | macsc_set_cmp3_int_cb (macsc_callback_t callback) |
Set MACSC Compare Channel 3 interrupt callback function. More... | |
void | macsc_set_ovf_int_cb (macsc_callback_t callback) |
Set MACSC overflow interrupt callback function. More... | |
static void | macsc_sleep_clk_disable (void) |
Disable 32.768KHz clk using timer 2 async register. More... | |
static void | macsc_sleep_clk_enable (void) |
Enable 32.768KHz clk using timer 2 async register. More... | |
static bool | macsc_sync (void) |
Symbol Counter sync. More... | |
void | macsc_use_cmp (bool abs_rel, uint32_t cmp, enum macsc_cc_channel channel) |
Usage of Absolute compare mode of the MACSC. More... | |
static void | macsc_write_clock_source (enum macsc_xtal source) |
Configure MAC Symbol Counter Clock Source. More... | |
static void | macsc_write_count (uint32_t cnt_value) |
Write the Counter value of the MAC Symbol counter. More... | |
|
inlinestatic |
Disable back-off slot counter.
none |
Referenced by test_macsc_backoff().
|
inlinestatic |
enable back-off slot counter
none |
Referenced by main(), and test_macsc_backoff().
|
inlinestatic |
|
inlinestatic |
Clears the Overflow flag.
|
inlinestatic |
Clears the Backoff Slot cntr interrupt flag.
|
inlinestatic |
Enable the Auto SFD and Beacon Timestamping feature If this bit is zero,only manual beacon timestamping can be used.
|
inlinestatic |
Write the Beacon Timestamp register of the MAC Symbol counter The manual beacon timestamping can be used in conjunction with the relative compare mode of the three compare units to generate compare match interrupts without having a beacon frame received.
If set to 1, the current symbol counter value is stored into the beacon timestamp register. The bit is cleared afterwards.
Referenced by example_cmp3_int_cb(), main(), and sm_sleep().
|
inlinestatic |
Enable the MACSC Overflow interrupt.
Referenced by main().
|
inlinestatic |
|
inlinestatic |
Tests if the Overflow flag is set.
|
inlinestatic |
Tests if the Backoff slot cntr interrupt flag is set.
|
inlinestatic |
Reads the Beacon Timestamp register.
References MACSC_READ32.
|
inlinestatic |
Read MAC SC Clock Source.
none |
|
inlinestatic |
Reads the Counter value of the MAC Symbol counter.
References MACSC_READ32.
Referenced by example_cmp1_int_cb(), example_cmp2_int_cb(), and example_cmp3_int_cb().
|
inlinestatic |
Read the MACSC status register This bit is set if a write operation to the symbol counter register is pending.
This bit is set after writing the counter low byte (SCCNTLL) until the symbol counter is updated with the new value. This update process can take up to 16 µs and during this time, no read or write access to the 32 bit counter register should occur.
|
inlinestatic |
Reads the SFD Timestamp register.
References MACSC_READ32.
|
inlinestatic |
Symbol Counter sync.
|
inlinestatic |
Configure MAC Symbol Counter Clock Source.
macsc | macsc clk src |
References MACSC_16MHz, and MACSC_32KHz.
|
inlinestatic |
Write the Counter value of the MAC Symbol counter.
cnt_value | Counter value |
References MACSC_WRITE32.
Referenced by example_cmp1_int_cb(), example_cmp2_int_cb(), and example_cmp3_int_cb().