Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AST - Asynchronous Timer

Driver for the AST (Asynchronous Timer).

Provides functions for configuring and operating the AST in the calendar or timer/counter modes.

Modules

 

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,
 
)    ((x % y) ? ((x / y) + 1) : (x / y))

Roundup operation for Digital Tuner in AST.

Referenced by ast_configure_digital_tuner().

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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
osc_typeThe oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ).
pselThe 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.
Returns
Boolean true if the initialization succeeds, false otherwise.

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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
periodic_channelAST 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
status_maskAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
input_freqPrescaled AST Clock Frequency
tuned_freqDesired AST frequency
Return values
falseIf invalid frequency is passed
trueIf configuration succeeds
Note
Parameter Calculation: Formula:
ADD=0 -> ft= fi(1 - (1/((roundup(256/value) * (2^exp)) + 1)))
ADD=1 -> ft= fi(1 + (1/((roundup(256/value) * (2^exp)) - 1)))
Specifications:
exp > 0, value > 1
Let X = (2 ^ exp), Y = roundup(256 / value)
Tuned Frequency -> ft
Input Frequency -> fi
IF ft < fi
ADD = 0
Z = (ft / (fi - ft))
ELSE IF ft > fi
ADD = 1
Z = (ft / (ft - fi))
ELSE
exit function -> Tuned Frequency = Input Frequency
The equation can be reduced to (X * Y) = Z

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)

Disable the AST.

Parameters
astBase address of the AST (i.e. &AVR32_AST).

References ast_is_busy().

void ast_disable_alarm0 ( volatile avr32_ast_t *  ast)

This function Disable the AST alarm0.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST Alarm Channel

References ast_disable_interrupt().

void ast_disable_all_interrupts ( volatile avr32_ast_t *  ast)

This function disables all the AST interrupts.

Parameters
astBase 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

Parameters
astBase address of the AST (i.e. &AVR32_AST).
wakeup_maskAST 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
interrupt_maskAST 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
periodic_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
periodic_channelAST Periodic Channel

References ast_disable_interrupt().

void ast_disable_ready_interrupt ( volatile avr32_ast_t *  ast)

This function enables the AST Ready interrupt.

Parameters
astBase address of the AST (i.e. &AVR32_AST).

References ast_disable_interrupt().

void ast_enable ( volatile avr32_ast_t *  ast)

Enable the AST.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
wakeup_maskAST 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
interrupt_maskAST 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
periodic_channelAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
periodic_channelAST Periodic Channel

References ast_enable_interrupt().

void ast_enable_ready_interrupt ( volatile avr32_ast_t *  ast)

This function enables the AST Ready interrupt.

Parameters
astBase 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
Returns
The AST current calendar value.

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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
Returns
The AST current counter value.

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.

Note
If you use the 32 KHz oscillator, it must be enabled before calling this function.
Parameters
astBase address of the AST (i.e. &AVR32_AST).
osc_typeThe oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ).
pselThe 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_calendarStartup date
Returns
Boolean true if the initialization succeeds, false otherwise.

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.

Note
If you use the 32 KHz oscillator, it must be enabled before calling this function.
Parameters
astBase address of the AST (i.e. &AVR32_AST).
osc_typeThe oscillator you want to use. If you need a better accuracy, use the 32 KHz oscillator (i.e. AST_OSC_32KHZ).
pselThe 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_counterStartup counter value
Returns
Boolean true if the initialization succeeds, false otherwise.

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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
addset to true if frequency has to be increased, false if it has to be decreased.
valueParameter used in the formula
expParameter 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_valueAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
alarm_valueAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
ast_calendarStartup 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
ast_counterStartup 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
pirAST 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.

Parameters
astBase address of the AST (i.e. &AVR32_AST).
pirAST periodic1.

References ast_is_busy().