📄 pit_b.h
字号:
PIT_B_DEBUGModeControl_t DEBUGModeControl,
PIT_B_DOZEModeControl_t DOZEModeControl,
PIT_B_PreScalarSelect_t PreScalarSelect,
UINT16 ModulusValue
);
PIT_B_ReturnCode_t PIT_B_ControlInterrupt_f(
pPIT_B_t PITPtr,
PIT_B_InterruptEnable_t PIE
);
PIT_B_ReturnCode_t PIT_B_GetStatus_f(
pPIT_B_t PITPtr,
pPIT_B_Status_t GetStatusPtr
);
PIT_B_ReturnCode_t PIT_B_ControlOperation_f(
pPIT_B_t PITPtr,
PIT_B_PITEnable_t PITEnable
);
PIT_B_ReturnCode_t PIT_B_SetModulus_f(
pPIT_B_t PITPtr,
UINT16 Modulus,
PIT_B_CounterOverwriteEnable_t CounterOverwriteEnable
);
PIT_B_ReturnCode_t PIT_B_SetRegister_f(
pPIT_B_t PITPtr,
PIT_B_Register_t RegisterSelect,
UINT16 RegisterValue
);
PIT_B_ReturnCode_t PIT_B_GetRegister_f(
pPIT_B_t PITPtr,
PIT_B_Register_t PITRegister,
UINT16 *GetRegisterPtr
);
PIT_B_ReturnCode_t PIT_B_Reset_f(
pPIT_B_t PITPtr
);
/**********************************************************************/
/* Macro: PIT_B_Init_f */
/* */
/* Purpose: Initialize the Programmable Interval Timer */
/* */
/* Input: */
/* PITPtr : PIT register block base address. */
/* CounterReloadControl : Determines whether the PIT rolls over to a*/
/* programmed interval or at 0xFFFF. */
/* CounterOverwriteEnable : Determines whether the modulus latch is */
/* transparent or a holding register. */
/* DebugModeControl : Determines whether the PIT operates in */
/* DEBUG mode. */
/* DozeModeControl : Determines whether the PIT operates in */
/* DOZE mode. */
/* PreScalarSelect : Determines how the PIT clock is generated */
/* from the system clock. */
/* UINT 16 : Data to copy into PMR register. */
/* */
/* Output: */
/* PIT_B_ERR_NONE : No error. */
/* PIT_B_ERR_INVALID_HANDLE : Device handle is NULL.*/
/* PIT_B_ERR_INVALID_COUNTER_RELOAD_CONTROL : Counter reload control*/
/* is invalid. */
/* PIT_B_ERR_INVALID_COUNTER_OVERWRITE_ENABLE : Counter overwrite */
/* enable is invalid. */
/* PIT_B_ERR_INVALID_DEBUG_MODE_CONTROL : DEBUG mode control is */
/* invalid. */
/* PIT_B_ERR_INVALID_DOZE_MODE_CONTROL : DOZE mode control is */
/* invalid. */
/* PIT_B_ERR_INVALID_PRE_SCALAR_SELECT : Pre-scalar select is */
/* invalid. */
/**********************************************************************/
#define PIT_B_Init( \
PITPtr, \
CounterReloadControl, \
CounterOverwriteEnable, \
DEBUGModeControl, \
DOZEModeControl, \
PreScalarSelect, \
ModulusValue \
) \
( \
(PIT_B_PARAM_CHECKING) ? \
( \
((PITPtr) == NULL) ? \
PIT_B_ERR_INVALID_HANDLE : \
(((CounterReloadControl) < PIT_B_COUNTER_RELOAD_ROLLS_OVER) || \
((CounterReloadControl) > PIT_B_COUNTER_RELOAD_FROM_MODULUS)) ? \
PIT_B_ERR_INVALID_COUNTER_RELOAD_CONTROL : \
(((CounterOverwriteEnable) < PIT_B_DISABLE_COUNTER_OVERWRITE) || \
((CounterOverwriteEnable) > PIT_B_ENABLE_COUNTER_OVERWRITE)) ? \
PIT_B_ERR_INVALID_COUNTER_OVERWRITE_ENABLE : \
(((DEBUGModeControl) < PIT_B_ENABLE_IN_DEBUG) || \
((DEBUGModeControl) > PIT_B_DISABLE_IN_DEBUG)) ? \
PIT_B_ERR_INVALID_DEBUG_MODE_CONTROL : \
(((DOZEModeControl) < PIT_B_ENABLE_IN_DOZE) || \
((DOZEModeControl) > PIT_B_DISABLE_IN_DOZE)) ? \
PIT_B_ERR_INVALID_DOZE_MODE_CONTROL : \
(((PreScalarSelect) < PIT_B_SCALAR_00) || \
((PreScalarSelect) > PIT_B_SCALAR_15)) ? \
PIT_B_ERR_INVALID_PRE_SCALAR_SELECT : \
PIT_B_Init_f( (PITPtr), \
(CounterReloadControl), \
(CounterOverwriteEnable), \
(DEBUGModeControl), \
(DOZEModeControl), \
(PreScalarSelect), \
(ModulusValue) \
) \
) \
: \
PIT_B_Init_f( (PITPtr), \
(CounterReloadControl), \
(CounterOverwriteEnable), \
(DEBUGModeControl), \
(DOZEModeControl), \
(PreScalarSelect), \
(ModulusValue) \
) \
) /* end of PIT_B_Init Macro */
/**********************************************************************/
/* Macro: PIT_B_ControlInterrupt_f */
/* */
/* Purpose: Enable or disable the PIT interrupt enable (PIE) */
/* */
/* Input: */
/* PITPtr : PIT register block base address */
/* PIE : Determines if the PIT interrupt is */
/* enabled or disabled. */
/* */
/* Output: */
/* PIT_B_ERR_NONE : For successful */
/* completion */
/* PIT_B_ERR_INVALID_HANDLE : Device Handle is NULL. */
/* PIT_B_ERR_INVALID_PIT_INTERRUPT_ENABLE : PIT interrupt enable */
/* is invalid. */
/**********************************************************************/
#define PIT_B_ControlInterrupt( PITPtr, \
PIE \
) \
( \
(PIT_B_PARAM_CHECKING) ? \
( \
((PITPtr) == NULL) ? \
PIT_B_ERR_INVALID_HANDLE : \
(((PIE) < PIT_B_INTERRUPT_FLAG_NOT_ALLOWED) || \
((PIE) > PIT_B_INTERRUPT_FLAG_ALLOWED)) ? \
PIT_B_ERR_INVALID_PIT_INTERRUPT_ENABLE: \
PIT_B_ControlInterrupt_f((PITPtr), \
(PIE) \
) \
) \
: \
PIT_B_ControlInterrupt_f((PITPtr), \
(PIE) \
) \
) /* End of ControlInterrupt Macro */
/**********************************************************************/
/* Function: PIT_B_GetStatus_f */
/* */
/* Purpose: Return the status bit of the PIT */
/* */
/* Input: */
/* PITPtr : PIT register block base address */
/* GetStatusPtr : Result address for selected PIT_B register data */
/* */
/* Output: */
/* PIT_B_ERR_NONE : For successful */
/* completion */
/* PIT_B_ERR_INVALID_HANDLE : Device Handle is NULL. */
/* PIT_B_ERR_INVALID_PIT_INTERRUPT_ENABLE : PIT interrupt enable */
/* is invalid. */
/**********************************************************************/
#define PIT_B_GetStatus(PITPtr, \
GetStatusPtr \
) \
( \
(PIT_B_PARAM_CHECKING) ? \
( \
((PITPtr) == NULL) ? \
PIT_B_ERR_INVALID_HANDLE : \
((GetStatusPtr) == NULL) ? \
PIT_B_ERR_BAD_RESULT_ADDR : \
PIT_B_GetStatus_f( (PITPtr), \
(GetStatusPtr) \
) \
) \
: \
PIT_B_GetStatus_f( (PITPtr), \
(GetStatusPtr) \
) \
) /* End of PIT_B_GetStatus Macro */
/**********************************************************************/
/* Macro: PIT_B_ControlOperation_f */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -