csl_ledpgaux.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 431 行
H
431 行
/** ============================================================================
* @file csl_ledpgAux.h
*
* @path $(CSLPATH)\arm\ledpg\inc
*
* @desc Inline functions for LEDPG
*
*/
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/* @(#) PSP/CSL 3.00.01.00[5912] (2004-07-10) */
/* =============================================================================
* Revision History
* ===============
* 10-Jul-2004 sp Created.
*
* =============================================================================
*/
#ifndef _CSL_LEDPGAUX_H_
#define _CSL_LEDPGAUX_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl_ledpg.h>
/** ============================================================================
* @n@b CSL_ledpgGetPeriod
*
* @b Description
* @n This function gets the duration of each blink cycle.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b> value
* @li value - Duration of each blink cycle
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_LedpgPeriod period;
...
period = CSL_ledpgGetPeriod (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
CSL_LedpgPeriod CSL_ledpgGetPeriod (
CSL_LedpgHandle hLedpg
)
{
CSL_LedpgPeriod value;
value = (CSL_LedpgPeriod)CSL_FEXT(hLedpg->regs->LCR, LEDPG_LCR_PERCTRL );
return value;
}
/** ============================================================================
* @n@b CSL_ledpgGetOnTime
*
* @b Description
* @n This function gets the duration for which the LED is
* ON in a blink cycle.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b> value
* @li value - duration of LED being ON in a blink cycle
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_LedpgLEDOnTime period;
...
period = CSL_ledpgGetOnTime (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
CSL_LedpgLEDOnTime CSL_ledpgGetOnTime (
CSL_LedpgHandle hLedpg
)
{
CSL_LedpgLEDOnTime value;
value = (CSL_LedpgLEDOnTime)CSL_FEXT(hLedpg->regs->LCR, LEDPG_LCR_ONCTRL );
return value;
}
/** ============================================================================
* @n@b CSL_ledpgSetLedOn
*
* @b Description
* @n This function makes the LED Permanently ON.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n The LED is in Blink or in OFF state
*
* <b> Post Condition </b>
* @n The LED is ON permanently
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgSetLedOn (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgSetLedOn (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST( hLedpg->regs->LCR, LEDPG_LCR_PERMON, ON );
}
/** ============================================================================
* @n@b CSL_ledpgSetLedOff
*
* @b Description
* @n This function makes the LED Permanently OFF.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n The LED is in ON or Blink state
*
* <b> Post Condition </b>
* @n The LED is ON permanently
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgSetLedOff (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgSetLedOff (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST( hLedpg->regs->LCR, LEDPG_LCR_PERMON, OFF );
}
/** ============================================================================
* @n@b CSL_ledpgSetLedBlink
*
* @b Description
* @n This function makes the LED blink with period as specified in the
* command arguements.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
cmdArg Command arguments
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n The LED is in ON or in OFF state
*
* <b> Post Condition </b>
* @n The LED will be in blinking state
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
CSL_LedpgHwSetup cmdArg;
cmdArg.ledontime = CSL_LEDPG_LEDONTIME_CLK2;
cmdArg.period = CSL_LEDPG_PERIOD_CLK32;
...
void CSL_ledpgSetLedBlink (hLedpg, &cmdArg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgSetLedBlink (
CSL_LedpgHandle hLedpg,
CSL_LedpgHwSetup *cmdArg
)
{
CSL_Reg32 cntl;
cntl = hLedpg->regs->LCR;
CSL_FINS( cntl, LEDPG_LCR_PERCTRL, cmdArg->period);
CSL_FINS( cntl, LEDPG_LCR_ONCTRL, cmdArg->ledontime);
hLedpg->regs->LCR = cntl;
}
/** ============================================================================
* @n@b CSL_ledpgEnableClk
*
* @b Description
* @n This function enables the clock to LEDPG.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The clock is enabled
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgEnableClk (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgEnableClk (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST (hLedpg->regs->PMR, LEDPG_PMR_CLKEN, ENABLE);
}
/** ============================================================================
* @n@b CSL_ledpgDisableClk
*
* @b Description
* @n This function disables the clock to LEDPG.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The clock to LEDPG is disabled
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgDisableClk (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgDisableClk (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST (hLedpg->regs->PMR, LEDPG_PMR_CLKEN, DISABLE);
}
/** ============================================================================
* @n@b CSL_ledpgResetCntLow
*
* @b Description
* @n This function resets the LEDPG counter to active low.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The LEDPG counter is reset to active low
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgResetCntLow (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgResetCntLow (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST( hLedpg->regs->LCR, LEDPG_LCR_LPGRES, LOW );
}
/** ============================================================================
* @n@b CSL_ledpgResetCntHigh
*
* @b Description
* @n This function sets the LEDPG counter to high.
*
* @b Arguments
* @verbatim
hLedpg Handle to the LEDPG instance
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The LEDPG counter is set to high
*
* @b Modifies
* @n LEDPG hardware registers
*
* @b Example
* @verbatim
void CSL_ledpgResetCntHigh (hLedpg);
@endverbatim
* ===========================================================================
*/
static inline
void CSL_ledpgResetCntHigh (
CSL_LedpgHandle hLedpg
)
{
CSL_FINST( hLedpg->regs->LCR, LEDPG_LCR_LPGRES, HIGH );
}
#ifdef __cplusplus
}
#endif
#endif /* _CSL_LEDPGAUX_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?