See Quickstart guide for SAM FREQM driver.
Driver for the Frequency Meter. This driver provides access to the main features of the FREQM controller.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the Frequency Meter (FREQM). | |
Quick Start Guide(s) | |
In this section you can find a list of all Quick Start guides related to the Frequency Meter (FREQM). | |
Data Structures | |
struct | freqm_config |
Frequency Meter configuration structure. More... | |
struct | freqm_dev_inst |
Frequency Meter driver software instance structure. More... | |
Macros | |
#define | FREQM_DURATION_DEFAULT 128 |
The default duration value of a measurement, given in number of reference clock cycles. More... | |
#define | FREQM_NUM_OF_ATTEMPTS 1000000 |
Time out value (number of attempts) More... | |
Typedefs | |
typedef void(* | freqm_callback_t )(void) |
typedef enum freqm_interrupt_source | freqm_interrupt_source_t |
FREQM interrupt source type. More... | |
Enumerations | |
enum | freqm_interrupt_source { FREQM_INTERRUPT_MEASURMENT_READY = FREQM_IER_DONE, FREQM_INTERRUPT_REFERENCE_CLOCK_READY = FREQM_IER_RCLKRDY, FREQM_INTERRUPT_SOURCE_N } |
FREQM interrupt source type. More... | |
Functions | |
static void | freqm_clear_interrupt_status (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source) |
Clear FREQM interrupt status. More... | |
enum status_code | freqm_disable (struct freqm_dev_inst *const dev_inst) |
Disable FREQM. More... | |
static void | freqm_disable_interrupt (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source) |
Disable FREQM interrupt. More... | |
static void | freqm_disable_refclk (struct freqm_dev_inst *const dev_inst) |
Disable refclk. More... | |
void | freqm_enable (struct freqm_dev_inst *const dev_inst) |
Enable FEQM. More... | |
static void | freqm_enable_interrupt (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source) |
Enable FREQM interrupt. More... | |
static void | freqm_enable_refclk (struct freqm_dev_inst *const dev_inst) |
Enable refclk. More... | |
void | freqm_get_config_defaults (struct freqm_config *const cfg) |
Initializes Frequency Meter configuration structure to defaults. More... | |
static uint32_t | freqm_get_interrupt_mask (struct freqm_dev_inst *const dev_inst) |
Get FREQM interrupt mask. More... | |
static uint32_t | freqm_get_interrupt_status (struct freqm_dev_inst *const dev_inst) |
Get FREQM interrupt status. More... | |
enum status_code | freqm_get_result_blocking (struct freqm_dev_inst *const dev_inst, uint32_t *p_result) |
Get measurement result. More... | |
static uint32_t | freqm_get_result_value (struct freqm_dev_inst *const dev_inst) |
Get FREQM result value. More... | |
static uint32_t | freqm_get_status (struct freqm_dev_inst *const dev_inst) |
Get FREQM status. More... | |
enum status_code | freqm_init (struct freqm_dev_inst *const dev_inst, Freqm *const freqm, struct freqm_config *const cfg) |
Configure FREQM with specified value. More... | |
void | freqm_set_callback (struct freqm_dev_inst *const dev_inst, freqm_interrupt_source_t source, freqm_callback_t callback, uint8_t irq_level) |
Set callback for FREQM interrupt handler. More... | |
static void | freqm_start_measure (struct freqm_dev_inst *const dev_inst) |
Start a measurement. More... | |
#define FREQM_DURATION_DEFAULT 128 |
The default duration value of a measurement, given in number of reference clock cycles.
Referenced by freqm_get_config_defaults(), and main().
#define FREQM_NUM_OF_ATTEMPTS 1000000 |
Time out value (number of attempts)
Referenced by freqm_disable(), freqm_get_result_blocking(), and freqm_init().
typedef void(* freqm_callback_t)(void) |
typedef enum freqm_interrupt_source freqm_interrupt_source_t |
FREQM interrupt source type.
|
inlinestatic |
Clear FREQM interrupt status.
dev_inst | Device structure pointer. |
source | Interrupt source. |
References freqm_dev_inst::hw_dev.
enum status_code freqm_disable | ( | struct freqm_dev_inst *const | dev_inst | ) |
Disable FREQM.
dev_inst | Device structure pointer. |
References ERR_TIMEOUT, freqm_get_status(), FREQM_NUM_OF_ATTEMPTS, freqm_dev_inst::hw_dev, SLEEPMGR_SLEEP_1, sleepmgr_unlock_mode(), STATUS_OK, and sysclk_disable_peripheral_clock().
|
inlinestatic |
Disable FREQM interrupt.
dev_inst | Device structure pointer |
source | Interrupt source |
References freqm_dev_inst::hw_dev.
Referenced by set_int_flag().
|
inlinestatic |
Disable refclk.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
Referenced by freqm_init().
void freqm_enable | ( | struct freqm_dev_inst *const | dev_inst | ) |
Enable FEQM.
dev_inst | Device structure pointer. |
References freqm_dev_inst::hw_dev, sleepmgr_lock_mode(), SLEEPMGR_SLEEP_1, and sysclk_enable_peripheral_clock().
Referenced by main().
|
inlinestatic |
Enable FREQM interrupt.
dev_inst | Device structure pointer |
source | Interrupt source |
References freqm_dev_inst::hw_dev.
Referenced by freqm_set_callback().
|
inlinestatic |
Enable refclk.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
Referenced by freqm_init().
void freqm_get_config_defaults | ( | struct freqm_config *const | cfg | ) |
Initializes Frequency Meter configuration structure to defaults.
cfg | Configuration structure to initialize to default values. |
References Assert, freqm_config::duration, FREQM_DURATION_DEFAULT, freqm_config::msr_clk, and freqm_config::ref_clk.
Referenced by main(), and run_freqm_test().
|
inlinestatic |
Get FREQM interrupt mask.
dev_inst | Device structure pointer. |
References freqm_dev_inst::hw_dev.
Referenced by FREQM_Handler().
|
inlinestatic |
Get FREQM interrupt status.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
Referenced by FREQM_Handler(), and set_int_flag().
enum status_code freqm_get_result_blocking | ( | struct freqm_dev_inst *const | dev_inst, |
uint32_t * | p_result | ||
) |
Get measurement result.
dev_inst | Device structure pointer. |
p_result | Pointer to measurement result value. |
References ERR_TIMEOUT, freqm_get_status(), FREQM_NUM_OF_ATTEMPTS, freqm_dev_inst::hw_dev, and STATUS_OK.
Referenced by main().
|
inlinestatic |
Get FREQM result value.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
|
inlinestatic |
Get FREQM status.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
Referenced by freqm_disable(), freqm_get_result_blocking(), and freqm_init().
enum status_code freqm_init | ( | struct freqm_dev_inst *const | dev_inst, |
Freqm *const | freqm, | ||
struct freqm_config *const | cfg | ||
) |
Configure FREQM with specified value.
dev_inst | Device structure pointer. |
freqm | Base address of the FREQM instance. |
cfg | Pointer to FREQM configuration |
References Assert, dev_inst, freqm_config::duration, ERR_TIMEOUT, freqm_dev_inst::freqm_cfg, freqm_disable_refclk(), freqm_enable_refclk(), freqm_get_status(), FREQM_NUM_OF_ATTEMPTS, freqm_dev_inst::hw_dev, freqm_config::msr_clk, freqm_config::ref_clk, STATUS_OK, and sysclk_enable_peripheral_clock().
Referenced by main(), and run_freqm_test().
void freqm_set_callback | ( | struct freqm_dev_inst *const | dev_inst, |
freqm_interrupt_source_t | source, | ||
freqm_callback_t | callback, | ||
uint8_t | irq_level | ||
) |
Set callback for FREQM interrupt handler.
dev_inst | Device structure pointer. |
source | Interrupt source. |
callback | callback function pointer. |
irq_level | interrupt level. |
References callback, freqm_enable_interrupt(), and irq_register_handler.
Referenced by run_freqm_test().
|
inlinestatic |
Start a measurement.
dev_inst | Device structure pointer |
References freqm_dev_inst::hw_dev.
Referenced by main(), and run_freqm_test().