Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CPU - SCIF - System Control Interface

Driver for the SCIF (System Control Interface).

The SCIF controls the Oscillators, PLL, Generic Clocks, BODs, the voltage regulators and general purpose low power registers.

Data Structures

struct  scif_gclk_opt_t
 Generic clock generation settings. More...
 
struct  scif_osc32_opt_t
 OSC32 startup options. More...
 
struct  scif_osc_opt_t
 OSC0/OSC1 startup options. More...
 
struct  scif_pll_opt_t
 PLL0/PLL1 startup options. More...
 

Macros

#define AVR32_SCIF_OSCCTRL1   0x00000028
 
#define SCIF_EXT_CRYSTAL_MAX_FREQ_HZ   20000000
 
#define SCIF_EXT_CRYSTAL_MIN_FREQ_HZ   4000000
 Device-specific data. More...
 
#define SCIF_NOT_SUPPORTED   (-10000)
 Define "not supported" for the chosen implementation. More...
 
#define SCIF_POLL_TIMEOUT   100000
 The timeguard used for polling in ticks. More...
 
#define SCIF_UNLOCK(reg)   (AVR32_SCIF.unlock = (AVR32_SCIF_UNLOCK_KEY_VALUE << AVR32_SCIF_UNLOCK_KEY_OFFSET)|(reg))
 Unlock SCIF register macro. More...
 

Enumerations

enum  scif_gcctrl_oscsel_t {
  SCIF_GCCTRL_SLOWCLOCK = AVR32_SCIF_GC_USES_CLK_SLOW,
  SCIF_GCCTRL_OSC32K = AVR32_SCIF_GC_USES_CLK_32,
  SCIF_GCCTRL_OSC0 = AVR32_SCIF_GC_USES_OSC0,
  SCIF_GCCTRL_OSC1 = AVR32_SCIF_GC_USES_OSC1,
  SCIF_GCCTRL_PLL0 = AVR32_SCIF_GC_USES_PLL0,
  SCIF_GCCTRL_PLL1 = AVR32_SCIF_GC_USES_PLL1,
  SCIF_GCCTRL_RC8M = AVR32_SCIF_GC_USES_RCOSC8,
  SCIF_GCCTRL_CPUCLOCK = AVR32_SCIF_GC_USES_CLK_CPU,
  SCIF_GCCTRL_HSBCLOCK = AVR32_SCIF_GC_USES_CLK_HSB,
  SCIF_GCCTRL_PBACLOCK = AVR32_SCIF_GC_USES_CLK_PBA,
  SCIF_GCCTRL_PBBCLOCK = AVR32_SCIF_GC_USES_CLK_PBB,
  SCIF_GCCTRL_PBCCLOCK = AVR32_SCIF_GC_USES_CLK_PBC,
  SCIF_GCCTRL_OSCSEL_INVALID
}
 The different clock source for the generic clocks. More...
 
enum  scif_osc_mode_t {
  SCIF_OSC_MODE_EXT_CLK = 0,
  SCIF_OSC_MODE_2PIN_CRYSTAL = 1,
  SCIF_OSC_MODE_2PIN_CRYSTAL_HICUR = 2
}
 The different oscillator modes. More...
 
enum  scif_osc_t {
  SCIF_OSC0 = 0,
  SCIF_OSC1 = 1
}
 The different oscillators. More...
 
enum  scif_pll_t {
  SCIF_PLL0 = 0,
  SCIF_PLL1 = 1
}
 The different plls. More...
 

Interrupt Functions

static __always_inline void scif_enable_interrupts (unsigned long mask)
 Enable SCIF interrupts. More...
 
static __always_inline void scif_disable_interrupts (unsigned long mask)
 Disable SCIF interrupts. More...
 
static __always_inline
unsigned long 
scif_get_enabled_interrupts (void)
 Read the SCIF currently enabled interrupts. More...
 
static __always_inline
unsigned long 
scif_get_interrupts_status (void)
 Read the interrupt status of the SCIF. More...
 
static __always_inline void scif_clear_interrupts_status (unsigned long mask)
 Clear raised interrupts from the SCIF. More...
 

Power and Clocks Status Functions

static __always_inline
unsigned long 
scif_get_pclk_status (void)
 Read the Power and Clocks Status of the SCIF. More...
 

OSC0/OSC1 Functions

long int scif_start_osc (scif_osc_t osc, const scif_osc_opt_t *opt, bool wait_for_ready)
 Configure and start an OSC0/OSC1 oscillator. More...
 
bool scif_is_osc_ready (scif_osc_t osc)
 Is an oscillator stable and ready to be used as clock source? More...
 
long int scif_stop_osc (scif_osc_t osc)
 Stop an oscillator. More...
 
long int scif_configure_osc_crystalmode (scif_osc_t osc, unsigned int fcrystal)
 Configure an oscillator in crystal mode. More...
 
long int scif_configure_osc_extmode (scif_osc_t osc)
 Configure an external clock as input clock. More...
 
long int scif_enable_osc (scif_osc_t osc, unsigned int startup, bool wait_for_ready)
 Enable an oscillator with a given startup time. More...
 
long int scif_enable_extosc (scif_osc_t osc)
 Enable external clock. More...
 

PLL0/PLL1 Functions

long int scif_pll_setup (scif_pll_t pll, const scif_pll_opt_t *opt)
 This function will setup a PLL. More...
 
long int scif_pll_enable (scif_pll_t pll)
 This function will enable a PLL. More...
 
long int scif_pll_disable (scif_pll_t pll)
 This function will disable a PLL. More...
 
long int scif_wait_for_pll_locked (scif_pll_t pll)
 This function will wait for PLL locked. More...
 

OSC32 Functions

long int scif_start_osc32 (const scif_osc32_opt_t *opt, bool wait_for_ready)
 Configure and start the OSC32 oscillator. More...
 
static __always_inline bool scif_is_osc32_ready (void)
 Is OSC32 stable and ready to be used as clock source? More...
 
long int scif_stop_osc32 (void)
 Stop the OSC32 oscillator. More...
 

Calibration Functions

void scif_bod18_enable_irq (void)
 Enables the 1.8V Brown-Out Detector interrupt. More...
 
void scif_bod18_disable_irq (void)
 Disables the 1.8V Brown-Out Detector interrupt. More...
 
void scif_bod18_clear_irq (void)
 Clears the 1.8V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod18_get_irq_status (void)
 Gets the 1.8V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod18_get_irq_enable_bit (void)
 Gets the 1.8V Brown-Out Detector interrupt enable status. More...
 
unsigned long scif_bod18_get_level (void)
 Gets the triggering threshold of the 1.8V Brown-Out Detector. More...
 
void scif_bod33_enable_irq (void)
 Enables the 3.3V Brown-Out Detector interrupt. More...
 
void scif_bod33_disable_irq (void)
 Disables the 3.3V Brown-Out Detector interrupt. More...
 
void scif_bod33_clear_irq (void)
 Clears the 3.3V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod33_get_irq_status (void)
 Gets the 3.3V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod33_get_irq_enable_bit (void)
 Gets the 3.3V Brown-Out Detector interrupt enable status. More...
 
unsigned long scif_bod33_get_level (void)
 Gets the triggering threshold of the 3.3V Brown-Out Detector. More...
 
void scif_bod50_enable_irq (void)
 Enables the 5.0V Brown-Out Detector interrupt. More...
 
void scif_bod50_disable_irq (void)
 Disables the 5.0V Brown-Out Detector interrupt. More...
 
void scif_bod50_clear_irq (void)
 Clears the 5.0V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod50_get_irq_status (void)
 Gets the 5.0V Brown-Out Detector interrupt flag. More...
 
unsigned long scif_bod50_get_irq_enable_bit (void)
 Gets the 5.0V Brown-Out Detector interrupt enable status. More...
 
unsigned long scif_bod50_get_level (void)
 Gets the triggering threshold of the 5.0V Brown-Out Detector. More...
 

8MHz RCosc Functions

void scif_start_rc8M (void)
 Start the 8MHz internal RCosc (RC8M) clock. More...
 
void scif_stop_rc8M (void)
 Stop the 8MHz internal RCosc (RC8M) clock. More...
 

120MHz RCosc Functions

void scif_start_rc120M (void)
 Start the 120MHz internal RCosc (RC120M) clock. More...
 
void scif_stop_rc120M (void)
 Stop the 120MHz internal RCosc (RC120M) clock. More...
 

Generic Clock Functions

long int scif_start_gclk (unsigned int gclk, const scif_gclk_opt_t *opt)
 Setup and start a generic clock. More...
 
long int scif_stop_gclk (unsigned int gclk)
 Stop a generic clock. More...
 
long int scif_gc_setup (unsigned int gclk, scif_gcctrl_oscsel_t clk_src, unsigned int diven, unsigned int divfactor)
 Setup a generic clock. More...
 
long int scif_gc_enable (unsigned int gclk)
 Enable a generic clock. More...
 

Backup Registers Functions

unsigned long scif_read_gplp (unsigned long gplp)
 Read the content of the SCIF GPLP registers. More...
 
void scif_write_gplp (int gplp, unsigned long value)
 Write into the SCIF GPLP registers. More...
 

Temperature Sensor Management Functions

static __always_inline void scif_temperature_sensor_enable (void)
 Enable the temperature sensor. More...
 
static __always_inline void scif_temperature_sensor_disable (void)
 Disable the temperature sensor. More...
 

#define AVR32_SCIF_OSCCTRL1   0x00000028
#define SCIF_EXT_CRYSTAL_MAX_FREQ_HZ   20000000

Referenced by scif_start_osc(), and scif_start_osc32().

#define SCIF_EXT_CRYSTAL_MIN_FREQ_HZ   4000000

Device-specific data.

< External crystal/clock min frequency (in Herz) External crystal/clock max frequency (in Herz)

Referenced by scif_start_osc(), and scif_start_osc32().

#define SCIF_NOT_SUPPORTED   (-10000)

Define "not supported" for the chosen implementation.

#define SCIF_POLL_TIMEOUT   100000

The timeguard used for polling in ticks.

Referenced by scif_pclksr_statushigh_wait(), and scif_stop_gclk().

The different clock source for the generic clocks.

Enumerator
SCIF_GCCTRL_SLOWCLOCK 
SCIF_GCCTRL_OSC32K 
SCIF_GCCTRL_OSC0 
SCIF_GCCTRL_OSC1 
SCIF_GCCTRL_PLL0 
SCIF_GCCTRL_PLL1 
SCIF_GCCTRL_RC8M 
SCIF_GCCTRL_CPUCLOCK 
SCIF_GCCTRL_HSBCLOCK 
SCIF_GCCTRL_PBACLOCK 
SCIF_GCCTRL_PBBCLOCK 
SCIF_GCCTRL_PBCCLOCK 
SCIF_GCCTRL_OSCSEL_INVALID 

The different oscillator modes.

Enumerator
SCIF_OSC_MODE_EXT_CLK 
SCIF_OSC_MODE_2PIN_CRYSTAL 
SCIF_OSC_MODE_2PIN_CRYSTAL_HICUR 
enum scif_osc_t

The different oscillators.

Enumerator
SCIF_OSC0 
SCIF_OSC1 
enum scif_pll_t

The different plls.

Enumerator
SCIF_PLL0 
SCIF_PLL1 

void scif_bod18_clear_irq ( void  )

Clears the 1.8V Brown-Out Detector interrupt flag.

void scif_bod18_disable_irq ( void  )

Disables the 1.8V Brown-Out Detector interrupt.

References Disable_global_interrupt, Enable_global_interrupt, and Is_global_interrupt_enabled.

void scif_bod18_enable_irq ( void  )

Enables the 1.8V Brown-Out Detector interrupt.

unsigned long scif_bod18_get_irq_enable_bit ( void  )

Gets the 1.8V Brown-Out Detector interrupt enable status.

Return values
0BOD interrupt disabled.
1BOD interrupt enabled.
unsigned long scif_bod18_get_irq_status ( void  )

Gets the 1.8V Brown-Out Detector interrupt flag.

Return values
0No BOD interrupt.
1BOD interrupt pending.
unsigned long scif_bod18_get_level ( void  )

Gets the triggering threshold of the 1.8V Brown-Out Detector.

void scif_bod33_clear_irq ( void  )

Clears the 3.3V Brown-Out Detector interrupt flag.

void scif_bod33_disable_irq ( void  )

Disables the 3.3V Brown-Out Detector interrupt.

References Disable_global_interrupt, Enable_global_interrupt, and Is_global_interrupt_enabled.

void scif_bod33_enable_irq ( void  )

Enables the 3.3V Brown-Out Detector interrupt.

unsigned long scif_bod33_get_irq_enable_bit ( void  )

Gets the 3.3V Brown-Out Detector interrupt enable status.

Return values
0BOD interrupt disabled.
1BOD interrupt enabled.
unsigned long scif_bod33_get_irq_status ( void  )

Gets the 3.3V Brown-Out Detector interrupt flag.

Return values
0No BOD interrupt.
1BOD interrupt pending.
unsigned long scif_bod33_get_level ( void  )

Gets the triggering threshold of the 3.3V Brown-Out Detector.

void scif_bod50_clear_irq ( void  )

Clears the 5.0V Brown-Out Detector interrupt flag.

void scif_bod50_disable_irq ( void  )

Disables the 5.0V Brown-Out Detector interrupt.

References Disable_global_interrupt, Enable_global_interrupt, and Is_global_interrupt_enabled.

void scif_bod50_enable_irq ( void  )

Enables the 5.0V Brown-Out Detector interrupt.

unsigned long scif_bod50_get_irq_enable_bit ( void  )

Gets the 5.0V Brown-Out Detector interrupt enable status.

Return values
0BOD interrupt disabled.
1BOD interrupt enabled.
unsigned long scif_bod50_get_irq_status ( void  )

Gets the 5.0V Brown-Out Detector interrupt flag.

Return values
0No BOD interrupt.
1BOD interrupt pending.
unsigned long scif_bod50_get_level ( void  )

Gets the triggering threshold of the 5.0V Brown-Out Detector.

static __always_inline void scif_clear_interrupts_status ( unsigned long  mask)
static

Clear raised interrupts from the SCIF.

Parameters
maskThe interrupts to clear.
long int scif_configure_osc_crystalmode ( scif_osc_t  osc,
unsigned int  fcrystal 
)

Configure an oscillator in crystal mode.

Parameters
oscThe oscillator to configure [INPUT]
fcrystalCrystal frequency (Hz) [INPUT]
Returns
Status.
Return values
0Oscillator successfully configured.
<0Error configuring the oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, AVR32_SCIF_OSCCTRL1, u_avr32_scif_oscctrl_t::OSCCTRL, PASS, SCIF_OSC0, SCIF_OSC1, SCIF_OSC_MODE_2PIN_CRYSTAL, and SCIF_UNLOCK.

Referenced by clockfrequencies_configure(), and pcl_switch_to_osc().

long int scif_configure_osc_extmode ( scif_osc_t  osc)

Configure an external clock as input clock.

Parameters
oscThe external clock to configure [INPUT]
Returns
Status.
Return values
0External clock successfully configured.
<0Error configuring the external clock.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, u_avr32_scif_oscctrl_t::OSCCTRL, PASS, SCIF_OSC_MODE_EXT_CLK, and SCIF_UNLOCK.

static __always_inline void scif_disable_interrupts ( unsigned long  mask)
static

Disable SCIF interrupts.

Parameters
maskthe interrupts to disable.
long int scif_enable_extosc ( scif_osc_t  osc)

Enable external clock.

Parameters
oscThe oscillator to configure [INPUT]
Returns
Status.
Return values
0Oscillator successfully started
<0Error starting the oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, ENABLE, u_avr32_scif_oscctrl_t::OSCCTRL, PASS, and SCIF_UNLOCK.

static __always_inline void scif_enable_interrupts ( unsigned long  mask)
static

Enable SCIF interrupts.

Parameters
maskthe interrupts to enable.
long int scif_enable_osc ( scif_osc_t  osc,
unsigned int  startup,
bool  wait_for_ready 
)

Enable an oscillator with a given startup time.

Parameters
oscThe oscillator to configure [INPUT]
startupOscillator startup time (one of AVR32_SCIF_OSCCTRLx_STARTUP_x_RCOSC) [INPUT]
wait_for_readyWait for the oscillator to be stable before return [INPUT]
Returns
Status.
Return values
0Oscillator successfully started
<0Error starting the oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, ENABLE, u_avr32_scif_oscctrl_t::OSCCTRL, PASS, SCIF_OSC0, scif_pclksr_statushigh_wait(), and SCIF_UNLOCK.

Referenced by clockfrequencies_configure(), and pcl_switch_to_osc().

long int scif_gc_enable ( unsigned int  gclk)

Enable a generic clock.

Parameters
gclkgeneric clock number (0 for gc0...)
Returns
Status.
Return values
0Success.
<0An error occurred.

References PASS.

Referenced by can_task_init(), init_gclk(), main(), pcl_configure_usb_clock(), and pwm_start_gc().

long int scif_gc_setup ( unsigned int  gclk,
scif_gcctrl_oscsel_t  clk_src,
unsigned int  diven,
unsigned int  divfactor 
)

Setup a generic clock.

Parameters
gclkgeneric clock number (0 for gc0...)
clk_srcThe input clock source to use for the generic clock
divenGeneric clock divisor enable
divfactorGeneric clock divisor
Note
If the generic clock is already enabled, this function will disable it, apply the configuration then restart the generic clock.
Returns
Status.
Return values
0Success.
<0An error occurred.

References PASS, SCIF_GCCTRL_OSCSEL_INVALID, and scif_stop_gclk().

Referenced by can_task_init(), init_gclk(), main(), pcl_configure_usb_clock(), and pwm_start_gc().

static __always_inline unsigned long scif_get_enabled_interrupts ( void  )
static

Read the SCIF currently enabled interrupts.

Returns
The enabled interrupts.
static __always_inline unsigned long scif_get_interrupts_status ( void  )
static

Read the interrupt status of the SCIF.

Returns
The interrupts which have been triggered.
static __always_inline unsigned long scif_get_pclk_status ( void  )
static

Read the Power and Clocks Status of the SCIF.

Returns
The content of the PCLKSR register
static __always_inline bool scif_is_osc32_ready ( void  )
static

Is OSC32 stable and ready to be used as clock source?

Returns
Status.
Return values
trueoscillator stable and ready
falseoscillator not enabled or not ready.
bool scif_is_osc_ready ( scif_osc_t  osc)

Is an oscillator stable and ready to be used as clock source?

Parameters
oscThe oscillator [INPUT]
Returns
Status.
Return values
trueoscillator stable and ready
falseoscillator not enabled or not ready.

References SCIF_OSC0.

long int scif_pll_disable ( scif_pll_t  pll)

This function will disable a PLL.

Parameters
pllThe PLL to configure [INPUT]
Returns
Status.
Return values
0PLL successfully started
<0Error starting the PLL.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, DISABLE, PASS, u_avr32_scif_pll_t::PLL, and SCIF_UNLOCK.

long int scif_pll_enable ( scif_pll_t  pll)

This function will enable a PLL.

Parameters
pllThe PLL to configure [INPUT]
Returns
Status.
Return values
0PLL successfully started
<0Error starting the PLL.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, ENABLE, PASS, u_avr32_scif_pll_t::PLL, and SCIF_UNLOCK.

Referenced by clockfrequencies_configure(), local_start_highfreq_clock(), and pcl_configure_usb_clock().

long int scif_pll_setup ( scif_pll_t  pll,
const scif_pll_opt_t opt 
)

This function will setup a PLL.

Parameters
pllThe PLL to configure [INPUT]
optThe configuration of the PLL [INPUT]
Returns
Status.
Return values
0PLL successfully started
<0Error starting the PLL.

This function will setup a PLL.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, scif_pll_opt_t::div, scif_pll_opt_t::lockcount, scif_pll_opt_t::mul, scif_pll_opt_t::osc, PASS, u_avr32_scif_pll_t::PLL, scif_pll_opt_t::pll_div2, scif_pll_opt_t::pll_freq, scif_pll_opt_t::pll_wbwdisable, and SCIF_UNLOCK.

Referenced by clockfrequencies_configure(), local_start_highfreq_clock(), and pcl_configure_usb_clock().

unsigned long scif_read_gplp ( unsigned long  gplp)

Read the content of the SCIF GPLP registers.

Parameters
gplpGPLP register index (0,1,... depending on the number of GPLP registers for a given part)
Returns
The content of the chosen GPLP register.

Referenced by pcl_read_gplp().

long int scif_start_gclk ( unsigned int  gclk,
const scif_gclk_opt_t opt 
)

Setup and start a generic clock.

Parameters
gclkThe generic clock number to setup and start (cf. datasheet)
optThe settings for the generic clock.
Returns
Status.
Return values
0Success.
<0An error occurred.

Setup and start a generic clock.

References scif_gclk_opt_t::clock_source, scif_gclk_opt_t::diven, scif_gclk_opt_t::divider, PASS, and SCIF_GCCTRL_OSCSEL_INVALID.

Referenced by init_gclk().

long int scif_start_osc ( scif_osc_t  osc,
const scif_osc_opt_t opt,
bool  wait_for_ready 
)

Configure and start an OSC0/OSC1 oscillator.

Parameters
oscThe oscillator to start [INPUT]
optThe configuration of the oscillator [INPUT]
wait_for_readyWait for the oscillator to be stable before return [INPUT]
Note
To avoid an infinite loop, this function checks the osc0 ready flag SCIF_POLL_TIMEOUT times.
Returns
Status.
Return values
0Oscillator start successful.
<0Error starting the oscillator.

Configure and start an OSC0/OSC1 oscillator.

Power and Clocks Status Functions OSC0/OSC1 Functions

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, ENABLE, scif_osc_opt_t::freq_hz, scif_osc_opt_t::gain, scif_osc_opt_t::mode, u_avr32_scif_oscctrl_t::OSCCTRL, PASS, SCIF_EXT_CRYSTAL_MAX_FREQ_HZ, SCIF_EXT_CRYSTAL_MIN_FREQ_HZ, SCIF_OSC0, SCIF_OSC_MODE_2PIN_CRYSTAL, SCIF_OSC_MODE_EXT_CLK, scif_pclksr_statushigh_wait(), SCIF_UNLOCK, and scif_osc_opt_t::startup.

long int scif_start_osc32 ( const scif_osc32_opt_t opt,
bool  wait_for_ready 
)

Configure and start the OSC32 oscillator.

Parameters
optThe configuration of the oscillator [INPUT]
wait_for_readyWait for the oscillator to be stable before return [INPUT]
Note
To avoid an infinite loop, this function checks the osc32 ready flag SCIF_POLL_TIMEOUT times.
Returns
Status.
Return values
0Oscillator start successful.
<0Error starting the oscillator.

Configure and start the OSC32 oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, ENABLE, scif_osc32_opt_t::freq_hz, scif_osc32_opt_t::mode, u_avr32_scif_oscctrl32_t::oscctrl32, u_avr32_scif_oscctrl32_t::OSCCTRL32, PASS, SCIF_EXT_CRYSTAL_MAX_FREQ_HZ, SCIF_EXT_CRYSTAL_MIN_FREQ_HZ, SCIF_OSC_MODE_2PIN_CRYSTAL, SCIF_OSC_MODE_EXT_CLK, scif_pclksr_statushigh_wait(), SCIF_UNLOCK, and scif_osc32_opt_t::startup.

Referenced by init_ast(), init_gclk(), and main().

void scif_start_rc120M ( void  )

Start the 120MHz internal RCosc (RC120M) clock.

Start the 120MHz internal RCosc (RC120M) clock.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, and SCIF_UNLOCK.

void scif_start_rc8M ( void  )

Start the 8MHz internal RCosc (RC8M) clock.

Start the 8MHz internal RCosc (RC8M) clock.

Critical Path Oscillator Functions 8MHz RCosc Functions

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, and SCIF_UNLOCK.

long int scif_stop_gclk ( unsigned int  gclk)

Stop a generic clock.

Parameters
gclkThe generic clock number to stop.
Note
To avoid an infinite loop, this function checks the Clock enable flag SCIF_POLL_TIMEOUT times.
Returns
Status.
Return values
0Success.
<0Unable to stop generic clock.

References PASS, and SCIF_POLL_TIMEOUT.

Referenced by scif_gc_setup().

long int scif_stop_osc ( scif_osc_t  osc)

Stop an oscillator.

Parameters
oscThe oscillator to stop
Returns
Status.
Return values
0Oscillator successfully stopped.
<0An error occurred when stopping the oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, PASS, SCIF_UNLOCK, and temp.

long int scif_stop_osc32 ( void  )

Stop the OSC32 oscillator.

Returns
Status.
Return values
0Oscillator successfully stopped.
<0An error occurred when stopping the oscillator.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, PASS, SCIF_UNLOCK, and temp.

void scif_stop_rc120M ( void  )

Stop the 120MHz internal RCosc (RC120M) clock.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, SCIF_UNLOCK, and temp.

void scif_stop_rc8M ( void  )

Stop the 8MHz internal RCosc (RC8M) clock.

References AVR32_ENTER_CRITICAL_REGION, AVR32_LEAVE_CRITICAL_REGION, SCIF_UNLOCK, and temp.

static __always_inline void scif_temperature_sensor_disable ( void  )
static

Disable the temperature sensor.

Note
Due to register unlock process, this function needs to be atomic so if there's risk that call is split by an interrupt, disable them first.

References SCIF_UNLOCK.

static __always_inline void scif_temperature_sensor_enable ( void  )
static

Enable the temperature sensor.

Note
Due to register unlock process, this function needs to be atomic. So if there's risk that call is split by any interrupts, disable them first.

References SCIF_UNLOCK.

long int scif_wait_for_pll_locked ( scif_pll_t  pll)

This function will wait for PLL locked.

Parameters
pllThe PLL to configure [INPUT]
Returns
Status.
Return values
0PLL successfully started
<0Error starting the PLL.

References PASS, and SCIF_PLL0.

Referenced by clockfrequencies_configure(), local_start_highfreq_clock(), and pcl_configure_usb_clock().

void scif_write_gplp ( int  gplp,
unsigned long  value 
)

Write into the SCIF GPLP registers.

Parameters
gplpGPLP register index (0,1,... depending on the number of GPLP registers for a given part)
valueValue to write

References SCIF_UNLOCK.

Referenced by pcl_write_gplp().