Microchip® Advanced Software Framework

ast.h File Reference

AST driver for AVR32 UC3.

Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include <avr32/io.h>

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

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