PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/clk/clk.h File Reference
#include "mcu.h"
#include "pdl_user.h"
Include dependency graph for clk.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stc_clk_intern_data
 Datatype for holding internal data needed for CLK. More...
struct  stc_clk_config
 Clock configuration. More...

Defines

#define FM0P_PSW_TMR_PINC_BITPOS   0x10u
#define FM0P_INT_ENR_PCSE_BITPOS   0x04u
#define FM0P_INT_ENR_SCSE_BITPOS   0x02u
#define FM0P_INT_ENR_MCSE_BITPOS   0x01u
#define FM0P_INT_STR_PCSI_BITPOS   0x04u
#define FM0P_INT_STR_SCSI_BITPOS   0x02u
#define FM0P_INT_STR_MCSI_BITPOS   0x01u
#define FM0P_INT_CLR_PCSC_BITPOS   0x04u
#define FM0P_INT_CLR_SCSC_BITPOS   0x02u
#define FM0P_INT_CLR_MCSC_BITPOS   0x01u

Typedefs

typedef enum en_clk_source en_clk_source_t
 Clock Source.
typedef enum en_clk_baseclkdiv en_clk_baseclkdiv_t
 Base Clock Prescaler Settings.
typedef enum en_clk_apb0div en_clk_apb0div_t
 APB0 Prescaler Settings.
typedef enum en_clk_apb1div en_clk_apb1div_t
 APB1 Prescaler Settings.
typedef enum en_clk_scowaittime en_clk_scowaittime_t
 Sub Clock oscillation stabilization wait time.
typedef enum en_clk_mcowaittime en_clk_mcowaittime_t
 Main Clock oscillation stabilization wait time.
typedef enum en_clk_pllowaittime en_clk_pllowaittime_t
 PLL Clock oscillation stabilization wait time.
typedef enum en_clk_pll_src en_clk_pll_src_t
 PLL SourceClock (PINC bit of PSW_TMR)
typedef struct stc_clk_intern_data stc_clk_intern_data_t
 Datatype for holding internal data needed for CLK.
typedef enum en_clk_gate_peripheral en_clk_gate_peripheral_t
 Clock Gate peripheral enumerators.
typedef enum
en_clk_reset_peripheral 
en_clk_reset_peripheral_t
 Reset peripheral enumerators.
typedef struct stc_clk_config stc_clk_config_t
 Clock configuration.

Enumerations

enum  en_clk_source {
  ClkMain = 0, ClkSub = 1, ClkHsCr = 2, ClkLsCr = 3,
  ClkPll = 4, ClkHsCrPll = 5
}
 Clock Source. More...
enum  en_clk_baseclkdiv {
  BaseClkDiv1 = 0, BaseClkDiv2 = 1, BaseClkDiv3 = 2, BaseClkDiv4 = 3,
  BaseClkDiv6 = 4, BaseClkDiv8 = 5, BaseClkDiv16 = 6, BaseClkErr = 7
}
 Base Clock Prescaler Settings. More...
enum  en_clk_apb0div { Apb0Div1 = 0, Apb0Div2 = 1, Apb0Div4 = 2, Apb0Div8 = 3 }
 APB0 Prescaler Settings. More...
enum  en_clk_apb1div { Apb1Div1 = 0, Apb1Div2 = 1, Apb1Div4 = 2, Apb1Div8 = 3 }
 APB1 Prescaler Settings. More...
enum  en_clk_scowaittime {
  ScoWaitExp10 = 0, ScoWaitExp11 = 1, ScoWaitExp12 = 2, ScoWaitExp13 = 3,
  ScoWaitExp14 = 4, ScoWaitExp15 = 5, ScoWaitExp16 = 6, ScoWaitExp17 = 7,
  ScoWaitExp18 = 8, ScoWaitExp19 = 9, ScoWaitExp20 = 10, ScoWaitExp21 = 11,
  ScoWaitErr = 12
}
 Sub Clock oscillation stabilization wait time. More...
enum  en_clk_mcowaittime {
  McoWaitExp11 = 0, McoWaitExp15 = 1, McoWaitExp16 = 2, McoWaitExp17 = 3,
  McoWaitExp18 = 4, McoWaitExp19 = 5, McoWaitExp110 = 6, McoWaitExp111 = 7,
  McoWaitExp112 = 8, McoWaitExp113 = 9, McoWaitExp114 = 10, McoWaitExp115 = 11,
  McoWaitExp117 = 12, McoWaitExp119 = 13, McoWaitExp121 = 14, McoWaitExp123 = 15
}
 Main Clock oscillation stabilization wait time. More...
enum  en_clk_pllowaittime {
  PlloWaitExp19 = 0, PlloWaitExp110 = 1, PlloWaitExp111 = 2, PlloWaitExp112 = 3,
  PlloWaitExp113 = 4, PlloWaitExp114 = 5, PlloWaitExp115 = 6, PlloWaitExp116 = 7
}
 PLL Clock oscillation stabilization wait time. More...
enum  en_clk_pll_src { PllSrcClkMo = 0, PllSrcClkHc = 123 }
 PLL SourceClock (PINC bit of PSW_TMR) More...
enum  en_clk_gate_peripheral {
  ClkGateGpio = 0, ClkGateDma = 2, ClkGateAdc0 = 3, ClkGateAdc1 = 4,
  ClkGateAdc2 = 5, ClkGateAdc3 = 6, ClkGateMfs0 = 7, ClkGateMfs1 = 8,
  ClkGateMfs2 = 9, ClkGateMfs3 = 10, ClkGateMfs4 = 11, ClkGateMfs5 = 12,
  ClkGateMfs6 = 13, ClkGateMfs7 = 14, ClkGateMfs8 = 15, ClkGateMfs9 = 16,
  ClkGateMfs10 = 17, ClkGateMfs11 = 18, ClkGateMfs12 = 19, ClkGateMfs13 = 20,
  ClkGateMfs14 = 21, ClkGateMfs15 = 22, ClkGateQprc0 = 23, ClkGateQprc1 = 24,
  ClkGateQprc2 = 25, ClkGateQprc3 = 26, ClkGateMft0 = 27, ClkGateMft1 = 28,
  ClkGateMft2 = 29, ClkGateMft3 = 30, ClkGateBt0 = 31, ClkGateBt4 = 32,
  ClkGateBt8 = 33, ClkGateBt12 = 34, ClkGateCan0 = 36, ClkGateCan1 = 37
}
 Clock Gate peripheral enumerators. More...
enum  en_clk_reset_peripheral {
  ClkResetDma = 2, ClkResetAdc0 = 3, ClkResetAdc1 = 4, ClkResetAdc2 = 5,
  ClkResetAdc3 = 6, ClkResetMfs0 = 7, ClkResetMfs1 = 8, ClkResetMfs2 = 9,
  ClkResetMfs3 = 10, ClkResetMfs4 = 11, ClkResetMfs5 = 12, ClkResetMfs6 = 13,
  ClkResetMfs7 = 14, ClkResetMfs8 = 15, ClkResetMfs9 = 16, ClkResetMfs10 = 17,
  ClkResetMfs11 = 18, ClkResetMfs12 = 19, ClkResetMfs13 = 20, ClkResetMfs14 = 21,
  ClkResetMfs15 = 22, ClkResetQprc0 = 23, ClkResetQprc1 = 24, ClkResetQprc2 = 25,
  ClkResetQprc3 = 26, ClkResetMft0 = 27, ClkResetMft1 = 28, ClkResetMft2 = 29,
  ClkResetMft3 = 30, ClkResetBt0 = 31, ClkResetBt4 = 32, ClkResetBt8 = 33,
  ClkResetBt12 = 34, ClkResetSdIf = 35, ClkResetCan0 = 36, ClkResetCan1 = 37
}
 Reset peripheral enumerators. More...

Functions

void Clk_IrqHandler (void)
 Clock Stabilization Interrupt Handler.
en_result_t Clk_Init (stc_clk_config_t *pstcClk)
 Initialize system clock according to user configuration.
en_result_t Clk_EnableHscr (boolean_t bBlock)
 Enable high speed CR.
en_result_t Clk_DisableHscr (void)
 Disable Main Clock.
en_result_t Clk_EnableMainClock (boolean_t bBlock)
 Enable Main Clock and wait until it is stable.
en_result_t Clk_DisableMainClock (void)
 Disable Main Clock.
en_result_t Clk_EnableSubClock (boolean_t bBlock)
 Enable Sub Clock.
en_result_t Clk_DisableSubClock (void)
 Disable Sub Clock.
en_result_t Clk_EnablePllClock (boolean_t bBlock)
 Enable PLL Clock.
en_result_t Clk_DisablePllClock (void)
 Disable PLL Clock.
en_result_t Clk_SetSource (en_clk_source_t enSource)
 Set Clock Source.
en_result_t Clk_PeripheralClockEnable (en_clk_gate_peripheral_t enPeripheral)
 Enables the clock gate of a peripheral.
en_result_t Clk_PeripheralClockDisable (en_clk_gate_peripheral_t enPeripheral)
 Disables the clock gate of a peripheral.
boolean_t Clk_PeripheralGetClockState (en_clk_gate_peripheral_t enPeripheral)
 Read the clock gate state of a peripheral.
en_result_t Clk_PeripheralSetReset (en_clk_reset_peripheral_t enPeripheral)
 Set reset bit a peripheral.
en_result_t Clk_PeripheralClearReset (en_clk_reset_peripheral_t enPeripheral)
 Clear reset bit a peripheral.

Variables

stc_clk_intern_data_t stcClkInternData
 Store the internal data of clock.

Detailed Description

Headerfile for CLK functions

History:

  • 2014-02-24 1.0 Edison Zhang First version.

Definition in file clk.h.