Driver for the AST (Asynchronous Timer).
Provides functions for configuring and operating the AST in the calendar or timer/counter modes.
Modules | |
Related Project(s) | |
In this section you can find all the projects related to the AST - Asynchronous Timer. | |
Data Structures | |
struct | ast_calendar_t |
Input when initializing AST in calendar mode. More... | |
Macros | |
#define | AST_POLL_TIMEOUT 1000 |
Timeout to prevent code hang in clock initialization. More... | |
#define | ROUNDUP_DIV(x, y) ((x % y) ? ((x / y) + 1) : (x / y)) |
Roundup operation for Digital Tuner in AST. More... | |
Typedefs | |
typedef struct ast_calendar_t | ast_calendar_t |
Input when initializing AST in calendar mode. More... | |
Functions | |
bool | ast_change_clk_source (volatile avr32_ast_t *ast, uint8_t osc_type, uint8_t psel) |
This function will change the clock source of the AST module. More... | |
void | ast_clear_alarm_status_flag (volatile avr32_ast_t *ast, uint32_t alarm_channel) |
This function clears the AST Alarm status flags. More... | |
void | ast_clear_all_status_flags (volatile avr32_ast_t *ast) |
This function clears all the AST status flags. More... | |
void | ast_clear_clkrdy_status_flag (volatile avr32_ast_t *ast) |
This function clears the AST Clock Ready status flags. More... | |
void | ast_clear_ovf_status_flag (volatile avr32_ast_t *ast) |
This function clears the AST Overflow status flags. More... | |
void | ast_clear_periodic_status_flag (volatile avr32_ast_t *ast, uint32_t periodic_channel) |
This function clears the AST Periodic event status flags. More... | |
void | ast_clear_prescalar (volatile avr32_ast_t *ast) |
This function clears the AST periodic prescalar counter to zero. More... | |
void | ast_clear_ready_status_flag (volatile avr32_ast_t *ast) |
This function clears the AST Ready status flags. More... | |
void | ast_clear_status_flag (volatile avr32_ast_t *ast, uint32_t status_mask) |
This function clears the AST status flags. More... | |
bool | ast_configure_digital_tuner (volatile avr32_ast_t *ast, uint32_t input_freq, uint32_t tuned_freq) |
Function to tune the AST prescalar frequency to the desired frequency. More... | |
void | ast_disable (volatile avr32_ast_t *ast) |
Disable the AST. More... | |
void | ast_disable_alarm0 (volatile avr32_ast_t *ast) |
This function Disable the AST alarm0. More... | |
void | ast_disable_alarm1 (volatile avr32_ast_t *ast) |
This function Disable the AST alarm1 event. More... | |
void | ast_disable_alarm_async_wakeup (volatile avr32_ast_t *ast, uint8_t alarm_channel) |
This function disables the AST Alarm Asynchronous wake-up. More... | |
void | ast_disable_alarm_interrupt (volatile avr32_ast_t *ast, uint8_t alarm_channel) |
This function disables the AST Alarm interrupt. More... | |
void | ast_disable_all_interrupts (volatile avr32_ast_t *ast) |
This function disables all the AST interrupts. More... | |
void | ast_disable_async_wakeup (volatile avr32_ast_t *ast, uint32_t wakeup_mask) |
This function disables the AST Asynchronous wake-up. More... | |
void | ast_disable_clkrdy_interrupt (volatile avr32_ast_t *ast) |
This function disables the AST Ready interrupt. More... | |
void | ast_disable_digital_tuner (volatile avr32_ast_t *ast) |
This function will disable the digital tuner of AST module. More... | |
void | ast_disable_interrupt (volatile avr32_ast_t *ast, uint32_t interrupt_mask) |
This function disables the AST interrupts. More... | |
void | ast_disable_ovf_async_wakeup (volatile avr32_ast_t *ast) |
This function disables the AST Overflow Asynchronous wake-up. More... | |
void | ast_disable_ovf_interrupt (volatile avr32_ast_t *ast) |
This function disables the AST Overflow interrupt. More... | |
void | ast_disable_periodic0 (volatile avr32_ast_t *ast) |
This function Disable the AST periodic0 event. More... | |
void | ast_disable_periodic1 (volatile avr32_ast_t *ast) |
This function Disable the AST periodic1 event. More... | |
void | ast_disable_periodic_async_wakeup (volatile avr32_ast_t *ast, uint8_t periodic_channel) |
This function disables the AST Periodic Asynchronous wake-up. More... | |
void | ast_disable_periodic_interrupt (volatile avr32_ast_t *ast, uint8_t periodic_channel) |
This function disables the AST Periodic interrupt. More... | |
void | ast_disable_ready_interrupt (volatile avr32_ast_t *ast) |
This function enables the AST Ready interrupt. More... | |
void | ast_enable (volatile avr32_ast_t *ast) |
Enable the AST. More... | |
void | ast_enable_alarm0 (volatile avr32_ast_t *ast) |
This function Enable the AST alarm0 event. More... | |
void | ast_enable_alarm1 (volatile avr32_ast_t *ast) |
This function Enable the AST alarm1. More... | |
void | ast_enable_alarm_async_wakeup (volatile avr32_ast_t *ast, uint8_t alarm_channel) |
This function enables the AST Alarm Asynchronous wake-up. More... | |
void | ast_enable_alarm_interrupt (volatile avr32_ast_t *ast, uint8_t alarm_channel) |
This function enables the AST Alarm interrupt. More... | |
void | ast_enable_async_wakeup (volatile avr32_ast_t *ast, uint32_t wakeup_mask) |
This function enables the AST Asynchronous wake-up. More... | |
void | ast_enable_clkrdy_interrupt (volatile avr32_ast_t *ast) |
This function enables the AST Ready interrupt. More... | |
void | ast_enable_counter_clear_on_alarm (volatile avr32_ast_t *ast, uint8_t alarm_channel) |
This function enables the option to clear the counter on AST alarm. More... | |
void | ast_enable_interrupt (volatile avr32_ast_t *ast, uint32_t interrupt_mask) |
This function enables the AST interrupt. More... | |
void | ast_enable_ovf_async_wakeup (volatile avr32_ast_t *ast) |
This function enables the AST Overflow Asynchronous wake-up. More... | |
void | ast_enable_ovf_interrupt (volatile avr32_ast_t *ast) |
This function enables the AST Overflow interrupt. More... | |
void | ast_enable_periodic0 (volatile avr32_ast_t *ast) |
This function Enable the AST periodic0 event. More... | |
void | ast_enable_periodic1 (volatile avr32_ast_t *ast) |
This function Enable the AST periodic1 event. More... | |
void | ast_enable_periodic_async_wakeup (volatile avr32_ast_t *ast, uint8_t periodic_channel) |
This function enables the AST Periodic Asynchronous wake-up. More... | |
void | ast_enable_periodic_interrupt (volatile avr32_ast_t *ast, uint8_t periodic_channel) |
This function enables the AST Periodic interrupt. More... | |
void | ast_enable_ready_interrupt (volatile avr32_ast_t *ast) |
This function enables the AST Ready interrupt. More... | |
ast_calendar_t | ast_get_calendar_value (volatile avr32_ast_t *ast) |
This function returns the AST current calendar value. More... | |
uint32_t | ast_get_counter_value (volatile avr32_ast_t *ast) |
This function returns the AST current counter value. More... | |
bool | ast_init_calendar (volatile avr32_ast_t *ast, uint8_t osc_type, uint8_t psel, ast_calendar_t ast_calendar) |
This function will initialize the AST module in calendar Mode. More... | |
bool | ast_init_counter (volatile avr32_ast_t *ast, uint8_t osc_type, uint8_t psel, uint32_t ast_counter) |
This function will initialize the AST module in counter Mode. More... | |
void | ast_init_digital_tuner (volatile avr32_ast_t *ast, bool add, uint8_t value, uint8_t exp) |
This function will initialize the digital tuner of AST module. More... | |
void | ast_set_alarm0_value (volatile avr32_ast_t *ast, uint32_t alarm_value) |
This function Set the AST alarm0 value. More... | |
void | ast_set_alarm1_value (volatile avr32_ast_t *ast, uint32_t alarm_value) |
This function Set the AST alarm1 value. More... | |
void | ast_set_calendar_value (volatile avr32_ast_t *ast, ast_calendar_t ast_calendar) |
This function sets the AST current calendar value. More... | |
void | ast_set_counter_value (volatile avr32_ast_t *ast, uint32_t ast_counter) |
This function sets the AST current counter value. More... | |
void | ast_set_periodic0_value (volatile avr32_ast_t *ast, avr32_ast_pir0_t pir) |
This function Set the AST periodic0 value. More... | |
void | ast_set_periodic1_value (volatile avr32_ast_t *ast, avr32_ast_pir1_t pir) |
This function Set the AST periodic1 value. More... | |
Oscillator Types | |
#define | AST_OSC_1KHZ 4 |
1KHz clock from 32KHz oscillator (CLK_1K) More... | |
#define | AST_OSC_GCLK 3 |
Generic clock (GCLK) More... | |
#define | AST_OSC_PB 2 |
Peripheral Bus Clock. More... | |
#define | AST_OSC_32KHZ 1 |
32KHz oscillator (OSC32K) More... | |
#define | AST_OSC_RC 0 |
System RC oscillator (RCSYS) More... | |
Predefined PSEL Values | |
#define | AST_PSEL_32KHZ_1HZ 14 |
The PSEL value to set the AST source clock (after the prescaler) to 1 Hz, when using an external 32-kHz crystal. More... | |
#define | AST_PSEL_RC_1_76HZ 15 |
The PSEL value to set the AST source clock (after the prescaler) to 1.76 Hz when using the internal RC oscillator (~ 115 kHz) More... | |
AST Mode | |
#define | AST_MODE_COUNTER 0 |
AST in Counter Mode. More... | |
#define | AST_MODE_CALENDAR 1 |
AST in Calendar Mode. More... | |
#define AST_MODE_CALENDAR 1 |
AST in Calendar Mode.
Referenced by ast_init_calendar().
#define AST_MODE_COUNTER 0 |
AST in Counter Mode.
Referenced by ast_init_counter().
#define AST_OSC_1KHZ 4 |
1KHz clock from 32KHz oscillator (CLK_1K)
#define AST_OSC_32KHZ 1 |
32KHz oscillator (OSC32K)
Referenced by init_ast(), and main().
#define AST_OSC_GCLK 3 |
Generic clock (GCLK)
#define AST_OSC_PB 2 |
Peripheral Bus Clock.
#define AST_OSC_RC 0 |
System RC oscillator (RCSYS)
Referenced by main().
#define AST_POLL_TIMEOUT 1000 |
Timeout to prevent code hang in clock initialization.
Referenced by ast_change_clk_source(), ast_init_calendar(), and ast_init_counter().
#define AST_PSEL_32KHZ_1HZ 14 |
The PSEL value to set the AST source clock (after the prescaler) to 1 Hz, when using an external 32-kHz crystal.
Referenced by init_ast(), and main().
#define AST_PSEL_RC_1_76HZ 15 |
The PSEL value to set the AST source clock (after the prescaler) to 1.76 Hz when using the internal RC oscillator (~ 115 kHz)
Referenced by main().
#define ROUNDUP_DIV | ( | x, | |
y | |||
) | ((x % y) ? ((x / y) + 1) : (x / y)) |
Roundup operation for Digital Tuner in AST.
Referenced by ast_configure_digital_tuner().
typedef struct ast_calendar_t ast_calendar_t |
Input when initializing AST in calendar mode.
bool ast_change_clk_source | ( | volatile avr32_ast_t * | ast, |
uint8_t | osc_type, | ||
uint8_t | psel | ||
) |
This function will change the clock source of the AST module.
ast | Base address of the AST (i.e. &AVR32_AST). |
osc_type | The oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ). |
psel | The preselector value for the corresponding oscillator (4-bits). To obtain this value, you can use this formula: psel = log(Fosc/Fast)/log(2)-1, where Fosc is the frequency of the oscillator you are using (32 KHz or 115 KHz) and Fast the frequency desired. |
References ast_is_busy(), ast_is_clkbusy(), and AST_POLL_TIMEOUT.
void ast_clear_alarm_status_flag | ( | volatile avr32_ast_t * | ast, |
uint32_t | alarm_channel | ||
) |
This function clears the AST Alarm status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST wake-up flag to be cleared. |
References ast_clear_status_flag().
Referenced by main().
void ast_clear_all_status_flags | ( | volatile avr32_ast_t * | ast | ) |
This function clears all the AST status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_clear_clkrdy_status_flag | ( | volatile avr32_ast_t * | ast | ) |
This function clears the AST Clock Ready status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_clear_status_flag().
void ast_clear_ovf_status_flag | ( | volatile avr32_ast_t * | ast | ) |
This function clears the AST Overflow status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_clear_status_flag().
void ast_clear_periodic_status_flag | ( | volatile avr32_ast_t * | ast, |
uint32_t | periodic_channel | ||
) |
This function clears the AST Periodic event status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
periodic_channel | AST wake-up flag to be cleared. |
References ast_clear_status_flag().
void ast_clear_prescalar | ( | volatile avr32_ast_t * | ast | ) |
This function clears the AST periodic prescalar counter to zero.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_clear_ready_status_flag | ( | volatile avr32_ast_t * | ast | ) |
This function clears the AST Ready status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_clear_status_flag().
void ast_clear_status_flag | ( | volatile avr32_ast_t * | ast, |
uint32_t | status_mask | ||
) |
This function clears the AST status flags.
ast | Base address of the AST (i.e. &AVR32_AST). |
status_mask | AST status flag to be cleared |
References ast_is_busy().
Referenced by ast_clear_alarm_status_flag(), ast_clear_clkrdy_status_flag(), ast_clear_ovf_status_flag(), ast_clear_periodic_status_flag(), and ast_clear_ready_status_flag().
bool ast_configure_digital_tuner | ( | volatile avr32_ast_t * | ast, |
uint32_t | input_freq, | ||
uint32_t | tuned_freq | ||
) |
Function to tune the AST prescalar frequency to the desired frequency.
ast | Base address of the AST (i.e. &AVR32_AST). |
input_freq | Prescaled AST Clock Frequency |
tuned_freq | Desired AST frequency |
false | If invalid frequency is passed |
true | If configuration succeeds |
Frequency Limits
(1/((roundup(256/value) * (2^exp)) + 1)) should be min to get the lowest possible output from Digital Tuner.
(1/((roundup(256/value) * (2^exp)) - 1)) should be min to get the highest possible output from Digital Tuner.
For that, roundup(256/value) & (2^exp) should be minimum
min (EXP) = 1 (Note: EXP > 0)
min (roundup(256/value)) = 2
max (Ft) = (4*fi)/3
min (Ft) = (4*fi)/5
Using the above details, X & Y that will closely satisfy the equation is found in this function.
References ast_init_digital_tuner(), and ROUNDUP_DIV.
void ast_disable | ( | volatile avr32_ast_t * | ast | ) |
void ast_disable_alarm0 | ( | volatile avr32_ast_t * | ast | ) |
This function Disable the AST alarm0.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
Referenced by main().
void ast_disable_alarm1 | ( | volatile avr32_ast_t * | ast | ) |
This function Disable the AST alarm1 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_disable_alarm_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint8_t | alarm_channel | ||
) |
This function disables the AST Alarm Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST Alarm Channel |
References ast_disable_async_wakeup().
void ast_disable_alarm_interrupt | ( | volatile avr32_ast_t * | ast, |
uint8_t | alarm_channel | ||
) |
This function disables the AST Alarm interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST Alarm Channel |
References ast_disable_interrupt().
void ast_disable_all_interrupts | ( | volatile avr32_ast_t * | ast | ) |
This function disables all the AST interrupts.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_disable_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint32_t | wakeup_mask | ||
) |
This function disables the AST Asynchronous wake-up.
8
ast | Base address of the AST (i.e. &AVR32_AST). |
wakeup_mask | AST wake-up flag to be disabled. |
References ast_is_busy().
Referenced by ast_disable_alarm_async_wakeup(), ast_disable_ovf_async_wakeup(), and ast_disable_periodic_async_wakeup().
void ast_disable_clkrdy_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function disables the AST Ready interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_disable_interrupt().
void ast_disable_digital_tuner | ( | volatile avr32_ast_t * | ast | ) |
This function will disable the digital tuner of AST module.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_disable_interrupt | ( | volatile avr32_ast_t * | ast, |
uint32_t | interrupt_mask | ||
) |
This function disables the AST interrupts.
ast | Base address of the AST (i.e. &AVR32_AST). |
interrupt_mask | AST Interrupts to be disabled |
References ast_is_busy().
Referenced by ast_disable_alarm_interrupt(), ast_disable_clkrdy_interrupt(), ast_disable_ovf_interrupt(), ast_disable_periodic_interrupt(), and ast_disable_ready_interrupt().
void ast_disable_ovf_async_wakeup | ( | volatile avr32_ast_t * | ast | ) |
This function disables the AST Overflow Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_disable_async_wakeup().
void ast_disable_ovf_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function disables the AST Overflow interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_disable_interrupt().
void ast_disable_periodic0 | ( | volatile avr32_ast_t * | ast | ) |
This function Disable the AST periodic0 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_disable_periodic1 | ( | volatile avr32_ast_t * | ast | ) |
This function Disable the AST periodic1 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_disable_periodic_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint8_t | periodic_channel | ||
) |
This function disables the AST Periodic Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
periodic_channel | AST Periodic Channel |
References ast_disable_async_wakeup().
void ast_disable_periodic_interrupt | ( | volatile avr32_ast_t * | ast, |
uint8_t | periodic_channel | ||
) |
This function disables the AST Periodic interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
periodic_channel | AST Periodic Channel |
References ast_disable_interrupt().
void ast_disable_ready_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function enables the AST Ready interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_disable_interrupt().
void ast_enable | ( | volatile avr32_ast_t * | ast | ) |
Enable the AST.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
Referenced by init_ast(), and main().
void ast_enable_alarm0 | ( | volatile avr32_ast_t * | ast | ) |
This function Enable the AST alarm0 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
Referenced by main().
void ast_enable_alarm1 | ( | volatile avr32_ast_t * | ast | ) |
This function Enable the AST alarm1.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_enable_alarm_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint8_t | alarm_channel | ||
) |
This function enables the AST Alarm Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST Alarm Channel |
References ast_enable_async_wakeup().
Referenced by main().
void ast_enable_alarm_interrupt | ( | volatile avr32_ast_t * | ast, |
uint8_t | alarm_channel | ||
) |
This function enables the AST Alarm interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST Alarm Channel |
References ast_enable_interrupt().
void ast_enable_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint32_t | wakeup_mask | ||
) |
This function enables the AST Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
wakeup_mask | AST wake-up flag to be enabled. |
References ast_is_busy().
Referenced by ast_enable_alarm_async_wakeup(), ast_enable_ovf_async_wakeup(), and ast_enable_periodic_async_wakeup().
void ast_enable_clkrdy_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function enables the AST Ready interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_enable_interrupt().
void ast_enable_counter_clear_on_alarm | ( | volatile avr32_ast_t * | ast, |
uint8_t | alarm_channel | ||
) |
This function enables the option to clear the counter on AST alarm.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_channel | AST Alarm Channel. |
References ast_is_busy().
void ast_enable_interrupt | ( | volatile avr32_ast_t * | ast, |
uint32_t | interrupt_mask | ||
) |
This function enables the AST interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
interrupt_mask | AST Interrupts to be enabled |
References ast_is_busy().
Referenced by ast_enable_alarm_interrupt(), ast_enable_clkrdy_interrupt(), ast_enable_ovf_interrupt(), ast_enable_periodic_interrupt(), and ast_enable_ready_interrupt().
void ast_enable_ovf_async_wakeup | ( | volatile avr32_ast_t * | ast | ) |
This function enables the AST Overflow Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_enable_async_wakeup().
void ast_enable_ovf_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function enables the AST Overflow interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_enable_interrupt().
void ast_enable_periodic0 | ( | volatile avr32_ast_t * | ast | ) |
This function Enable the AST periodic0 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
Referenced by init_ast().
void ast_enable_periodic1 | ( | volatile avr32_ast_t * | ast | ) |
This function Enable the AST periodic1 event.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_is_busy().
void ast_enable_periodic_async_wakeup | ( | volatile avr32_ast_t * | ast, |
uint8_t | periodic_channel | ||
) |
This function enables the AST Periodic Asynchronous wake-up.
ast | Base address of the AST (i.e. &AVR32_AST). |
periodic_channel | AST Periodic Channel |
References ast_enable_async_wakeup().
void ast_enable_periodic_interrupt | ( | volatile avr32_ast_t * | ast, |
uint8_t | periodic_channel | ||
) |
This function enables the AST Periodic interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
periodic_channel | AST Periodic Channel |
References ast_enable_interrupt().
void ast_enable_ready_interrupt | ( | volatile avr32_ast_t * | ast | ) |
This function enables the AST Ready interrupt.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_enable_interrupt().
ast_calendar_t ast_get_calendar_value | ( | volatile avr32_ast_t * | ast | ) |
This function returns the AST current calendar value.
ast | Base address of the AST (i.e. &AVR32_AST). |
References ast_calendar_t::field.
Referenced by main().
uint32_t ast_get_counter_value | ( | volatile avr32_ast_t * | ast | ) |
This function returns the AST current counter value.
ast | Base address of the AST (i.e. &AVR32_AST). |
Referenced by main().
bool ast_init_calendar | ( | volatile avr32_ast_t * | ast, |
uint8_t | osc_type, | ||
uint8_t | psel, | ||
ast_calendar_t | ast_calendar | ||
) |
This function will initialize the AST module in calendar Mode.
ast | Base address of the AST (i.e. &AVR32_AST). |
osc_type | The oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ). |
psel | The preselector value for the corresponding oscillator (4-bits). To obtain this value, you can use this formula: psel = log(Fosc/Fast)/log(2)-1, where Fosc is the frequency of the oscillator you are using (32 KHz or 115 KHz) and Fast the frequency desired. |
ast_calendar | Startup date |
References ast_is_busy(), ast_is_clkbusy(), AST_MODE_CALENDAR, AST_POLL_TIMEOUT, and ast_set_calendar_value().
Referenced by init_ast(), and main().
bool ast_init_counter | ( | volatile avr32_ast_t * | ast, |
uint8_t | osc_type, | ||
uint8_t | psel, | ||
uint32_t | ast_counter | ||
) |
This function will initialize the AST module in counter Mode.
ast | Base address of the AST (i.e. &AVR32_AST). |
osc_type | The oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ). |
psel | The preselector value for the corresponding oscillator (4-bits). To obtain this value, you can use this formula: psel = log(Fosc/Fast)/log(2)-1, where Fosc is the frequency of the oscillator you are using (32 KHz or 115 KHz) and Fast the frequency desired. |
ast_counter | Startup counter value |
References ast_is_busy(), ast_is_clkbusy(), AST_MODE_COUNTER, AST_POLL_TIMEOUT, and ast_set_counter_value().
Referenced by main().
void ast_init_digital_tuner | ( | volatile avr32_ast_t * | ast, |
bool | add, | ||
uint8_t | value, | ||
uint8_t | exp | ||
) |
This function will initialize the digital tuner of AST module.
ast | Base address of the AST (i.e. &AVR32_AST). |
add | set to true if frequency has to be increased, false if it has to be decreased. |
value | Parameter used in the formula |
exp | Parameter used in the formula |
References ast_is_busy().
Referenced by ast_configure_digital_tuner().
void ast_set_alarm0_value | ( | volatile avr32_ast_t * | ast, |
U32 | alarm_value | ||
) |
This function Set the AST alarm0 value.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_value | AST alarm0 value. |
References ast_is_busy().
Referenced by main().
void ast_set_alarm1_value | ( | volatile avr32_ast_t * | ast, |
U32 | alarm_value | ||
) |
This function Set the AST alarm1 value.
ast | Base address of the AST (i.e. &AVR32_AST). |
alarm_value | AST alarm1 value. |
References ast_is_busy().
void ast_set_calendar_value | ( | volatile avr32_ast_t * | ast, |
ast_calendar_t | ast_calendar | ||
) |
This function sets the AST current calendar value.
ast | Base address of the AST (i.e. &AVR32_AST). |
ast_calendar | Startup date |
References ast_is_busy(), and ast_calendar_t::field.
Referenced by ast_init_calendar().
void ast_set_counter_value | ( | volatile avr32_ast_t * | ast, |
uint32_t | ast_counter | ||
) |
This function sets the AST current counter value.
ast | Base address of the AST (i.e. &AVR32_AST). |
ast_counter | Startup counter value |
References ast_is_busy().
Referenced by ast_init_counter().
void ast_set_periodic0_value | ( | volatile avr32_ast_t * | ast, |
avr32_ast_pir0_t | pir | ||
) |
This function Set the AST periodic0 value.
ast | Base address of the AST (i.e. &AVR32_AST). |
pir | AST periodic0. |
References ast_is_busy().
Referenced by init_ast().
void ast_set_periodic1_value | ( | volatile avr32_ast_t * | ast, |
avr32_ast_pir1_t | pir | ||
) |
This function Set the AST periodic1 value.
ast | Base address of the AST (i.e. &AVR32_AST). |
pir | AST periodic1. |
References ast_is_busy().