sysctrl.h

来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C头文件 代码 · 共 134 行

H
134
字号
/*************************************************************************
 *
 *    Used with ICCARM and AARM.
 *
 *    (c) Copyright IAR Systems 2006
 *
 *    File name   : sysctrl.h
 *    Description : Prototypes for the system controller driver
 *
 *    History :
 *    1. Data        :
 *       Author      : Stanimir Bonev
 *       Description : 28, April 2006
 *
 *
 *    $Revision: 20136 $
 **************************************************************************/
#ifndef __SYSCTRL_H

#include <Luminary/iolm3s102.h>
#include "cortex_m3_comm.h"

typedef enum {
  SysCtrlPass = 0, SysCtrlParamErr, SysCtrlFault,
} SysCtrlStatus_t;

typedef enum {
  OSC_3_58MHZ = 4, OSC_3_69MHZ, OSC_4_00MHZ, OSC_4_10MHZ,
  OSC_4_92MHZ, OSC_5_00MHZ, OSC_5_12MHZ, OSC_6_00MHZ,
  OSC_6_14MHZ, OSC_7_37MHZ, OSC_8_00MHZ, OSC_8_19MHZ
} MainOscType_t;

typedef enum {
  MAIN_OSC_SRC = 0, BOOT_OSC_SRC, BOOT_OSC_4_SRC,
} ClkSrc_t;

#define MAX_SYS_DIV   15  // clk/16

typedef enum {
  REF_CLK = 0, CORE_CLK,
} SysTickSrcClk_t;

/*************************************************************************
 * Function Name: SysCtrlSetClk
 * Parameters: MainOscType_t MainOscType, Int32U SysDiv,
 *             ClkSrc_t ClkSrc, Boolean PllEna, Boolean PllPD
 *
 * Return: SysCtrlStatus_t
 *
 * Description: Sets the clocking of the device
 *
 *************************************************************************/
SysCtrlStatus_t SysCtrlSetClk (MainOscType_t MainOscType, Int32U SysDiv,
                               ClkSrc_t ClkSrc, Boolean PllEna, Boolean PllPD);

/*************************************************************************
 * Function Name: SysCtrlGetCoreClk
 * Parameters: none
 *
 * Return: Int32U
 *
 * Description: Gets the processor clock rate
 *
 *************************************************************************/
Int32U SysCtrlGetCoreClk (void);

/*************************************************************************
 * Function Name: SysCtrlGetRefClk
 * Parameters: none
 *
 * Return: Int32U
 *
 * Description: Gets the reference clock rate
 *
 *************************************************************************/
Int32U SysCtrlGetRefClk (void);

/*************************************************************************
 * Function Name: SysCtrlSysTimerInit
 * Parameters: Int32U Freq, SysTickSrcClk_t SysTickSrcClk
 *
 * Return: SysCtrlStatus_t
 *
 * Description: Initialize the SysTick Timer
 *
 *************************************************************************/
SysCtrlStatus_t SysCtrlSysTimerInit(Int32U Freq, SysTickSrcClk_t SysTickSrcClk);

/*************************************************************************
 * Function Name: SysCtrlSysTimerEna
 * Parameters: none
 *
 * Return: none
 *
 * Description: Enable the SysTick Timer
 *
 *************************************************************************/
void SysCtrlSysTimerEna(void);

/*************************************************************************
 * Function Name: SysCtrlSysTimerDis
 * Parameters: none
 *
 * Return: none
 *
 * Description: Disable the SysTick Timer
 *
 *************************************************************************/
void SysCtrlSysTimerDis(void);

/*************************************************************************
 * Function Name: SysCtrlSysTimerGetPeriod
 * Parameters: none
 *
 * Return: Int32U
 *
 * Description: Gets the period of the SysTick counter
 *
 *************************************************************************/
Int32U SysCtrlSysTimerGetPeriod(void);

/*************************************************************************
 * Function Name: SysCtrlSysTimerGetValue
 * Parameters: none
 *
 * Return: Int32U
 *
 * Description: Gets the current value of the SysTick counter
 *
 *************************************************************************/
Int32U SysCtrlSysTimerGetValue(void);

#endif // __SYSCTRL_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?