PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/wc/wc.c File Reference
#include "wc.h"
Include dependency graph for wc.c:

Go to the source code of this file.

Functions

static void Wc_InitNvic (void)
 Set NVIC Interrupt depending on ADC instance.
static void Wc_DeInitNvic (void)
 Clear NVIC Interrupt depending on ADC instance.
void Wc_IrqHandler (void)
 Watch counter interrupt function.
en_result_t Wc_Pres_SelClk (stc_wc_pres_clk_t *pstcWcPresClk)
 Select the input clock an and set the division clock to be output.
en_result_t Wc_Pres_EnableDiv ()
 Enable oscillation of the division clock.
en_result_t Wc_Pres_DisableDiv ()
 Disable oscillation of the division clock.
en_stat_flag_t Wc_GetDivStat ()
 Get the operation status of the division counter.
en_result_t Wc_Init (stc_wc_config_t *pstcWcConfig)
 Select the input clock and set the division clock to be output.
en_result_t Wc_EnableCount (void)
 Enable WC operation.
en_result_t Wc_DisableCount (void)
 Disable WC operation.
en_result_t Wc_EnableInt (func_ptr_t pfnIntCallback)
 Enable WC underflow interrupt.
en_result_t Wc_DisableInt (void)
 Disable WC underflow interrupt.
en_result_t Wc_WriteReloadVal (uint8_t u8Val)
 Set the counter value of WC.
uint8_t Wc_ReadCurCnt ()
 Read the value in the 6-bit down counter.
en_result_t Wc_ClearIntFlag ()
 Clear WC underflow flag.
en_int_flag_t Wc_GetIntFlag ()
 Get WC underflow flag status.
en_stat_flag_t Wc_GetOperationFlag ()
 Get WC operation state.

Variables

static func_ptr_t pWcfnIntCallback = NULL

Detailed Description

A detailed description is available at WC Module description

History:

  • 2014-02-17 0.1 Edison Zhang First version.

Definition in file wc.c.


Function Documentation

Clear WC underflow flag.

The Function clear WCIF to 0 of WC

Return values:
OkClear WC underflow flag normally

Definition at line 361 of file wc.c.

References Ok.

Referenced by Wc_IrqHandler().

Here is the caller graph for this function:

static void Wc_DeInitNvic ( void  ) [static]

Clear NVIC Interrupt depending on ADC instance.

Definition at line 89 of file wc.c.

References PDL_DEFAULT_INTERRUPT_LEVEL.

Referenced by Wc_DisableInt().

Here is the caller graph for this function:

Disable WC operation.

The Function can clear WCCR:WCEN to 0 of WC

Return values:
OkDisable WC operation normally

Definition at line 266 of file wc.c.

References Ok.

Disable WC underflow interrupt.

The Function can clear WCIE of WC

Return values:
OkDisable WC underflow interrupt normally

Definition at line 308 of file wc.c.

References Ok, pWcfnIntCallback, and Wc_DeInitNvic().

Here is the call graph for this function:

Enable WC operation.

The Function can set WCCR:WCEN to 1 of WC

Return values:
OkEnable WC operation normally

Definition at line 251 of file wc.c.

References Ok.

en_result_t Wc_EnableInt ( func_ptr_t  pfnIntCallback)

Enable WC underflow interrupt.

The Function can set WCIE of WC

Parameters:
[in]pfnIntCallbackWC interrupt to be enabled
Return values:
OkWrite data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • pfnIntCallback == NULL

Definition at line 286 of file wc.c.

References ErrorInvalidParameter, Ok, pWcfnIntCallback, and Wc_InitNvic().

Here is the call graph for this function:

Get the operation status of the division counter.

The Function can get CLK_EN:CLK_EN_R to 0 of WCP

Return values:
PdlClrCLK_EN_R is 0, oscillation of the division clock is not performed
PdlSetCLK_EN R is 1, oscillation of the division clock is performed

Definition at line 198 of file wc.c.

Get WC underflow flag status.

The Function get value WCIF of WC

Return values:
PdlClrWCIF is 0, WC underflow does not occur
PdlSetWCIF is 1, WC underflow occurs

Definition at line 377 of file wc.c.

Referenced by Wc_IrqHandler().

Here is the caller graph for this function:

Get WC operation state.

The Function get value WCOP of WC

Return values:
PdlClrWCOP is 0, The WC is stopped
PdlSetWCOP is 1, The WC is active

Definition at line 392 of file wc.c.

en_result_t Wc_Init ( stc_wc_config_t pstcWcConfig)

Select the input clock and set the division clock to be output.

The Function can set SEL_OUT, SEL_IN of Watch counter prescaler (hereafter WCP)

Parameters:
[in]pstcWcConfigWC configuration
Return values:
OkWrite data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • invalid value of pstcWcConfig->enCntClk

Definition at line 216 of file wc.c.

References stc_wc_config::enCntClk, ErrorInvalidParameter, Ok, stc_wc_config::u8ReloadValue, WcCntClkWcck0, WcCntClkWcck1, WcCntClkWcck2, and WcCntClkWcck3.

static void Wc_InitNvic ( void  ) [static]

Set NVIC Interrupt depending on ADC instance.

Definition at line 78 of file wc.c.

References PDL_IRQ_LEVEL_CLK_WC_RTC.

Referenced by Wc_EnableInt().

Here is the caller graph for this function:

void Wc_IrqHandler ( void  )

Watch counter interrupt function.

Definition at line 99 of file wc.c.

References PdlSet, pWcfnIntCallback, Wc_ClearIntFlag(), and Wc_GetIntFlag().

Referenced by TIM_IRQHandler().

Here is the call graph for this function:

Here is the caller graph for this function:

Disable oscillation of the division clock.

The Function can clear CLK_EN:CLK_EN to 0 of WCP

Return values:
OkDisable oscillation of the division clock normally

Definition at line 182 of file wc.c.

References Ok.

Enable oscillation of the division clock.

The Function can set CLK_EN:CLK_EN to 1 of WCP

Return values:
OkEnable oscillation of the division clock normally

Definition at line 167 of file wc.c.

References Ok.

Select the input clock an and set the division clock to be output.

The Function can set SEL_OUT, SEL_IN of Watch counter prescaler (hereafter WCP)

Parameters:
[in]pstcWcPresClkWC prescaler clock configuration
Return values:
OkWrite data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • invalid value of pstcWcPresClk->enInputClk
  • invalid value of pstcWcPresClk->enOutputClk

Definition at line 126 of file wc.c.

References stc_wc_pres_clk::enInputClk, stc_wc_pres_clk::enOutputClk, ErrorInvalidParameter, Ok, WcPresInClkHighCr, WcPresInClkLowCr, WcPresInClkMainOsc, WcPresInClkSubOsc, WcPresOutClkArray0, WcPresOutClkArray1, WcPresOutClkArray2, WcPresOutClkArray3, WcPresOutClkArray4, WcPresOutClkArray5, and WcPresOutClkArray6.

uint8_t Wc_ReadCurCnt ( void  )

Read the value in the 6-bit down counter.

The Function can read value of WCRD of WC

Return values:
Currentcount value of WC

Definition at line 347 of file wc.c.

en_result_t Wc_WriteReloadVal ( uint8_t  u8Val)

Set the counter value of WC.

The Function can set value to WCRL of WC

Return values:
OkSet the counter value of WC normally

Definition at line 332 of file wc.c.

References Ok.


Variable Documentation

func_ptr_t pWcfnIntCallback = NULL [static]

Definition at line 67 of file wc.c.

Referenced by Wc_DisableInt(), Wc_EnableInt(), and Wc_IrqHandler().