csl_ledpg.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 550 行 · 第 1/2 页

H
550
字号
/** ============================================================================
 *   @file  csl_ledpg.h
 *
 *   @path  $(CSLPATH)\arm\ledpg\src
 *
 *   @desc  APIs and Data structures 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] (xxxx-xx-xx) */

/* =============================================================================
 *  Revision History
 *  ===============
 *  10-Jul-2004 sp    Modifications done according to new CSL architecture.
 *  09-Jun-2004 Shiva Revisied: Modified the comments to doxygen compatible.
 *  xx-xxx-xxxx XXX   Created.
 *
 * =============================================================================
 */

#ifndef _CSL_LEDPG_H_
#define _CSL_LEDPG_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <csl.h>
#include <cslr_ledpg.h>

/**
  * LEDPG global typedef declarations
  */
/** Permanent ON/OFF setting. */
typedef enum 
{
    /** Set high to force permanent light off */
    CSL_LEDPG_PERMONOFF_OFF         = 0,
    /** Set high to force permanent light on */
    CSL_LEDPG_PERMONOFF_ON          = 1
    /**  */
} CSL_LedpgPermOnOff;

/** LPG counter reset */
typedef enum 
{
    /** LPG counter reset active */
    CSL_LEDPG_RESET_ACTIVELOW       =0,
    /** LPG counter reset low */
    CSL_LEDPG_RESET_ACTIVEHIGH      =1
} CSL_LedpgReset;

/** Time LED is on parameter */
typedef enum 
{
    /** Time LED is zero */
    CSL_LEDPG_LEDONTIME_CLK1   =0,
    /** Time LED is one */
    CSL_LEDPG_LEDONTIME_CLK2   =1,
    /** Time LED is two */
    CSL_LEDPG_LEDONTIME_CLK4   =2,
    /** Time LED is three */
    CSL_LEDPG_LEDONTIME_CLK8   =3,
    /** Time LED is four */
    CSL_LEDPG_LEDONTIME_CLK12  =4,
    /** Time LED is five */
    CSL_LEDPG_LEDONTIME_CLK16  =5,
    /** Time LED is six */
    CSL_LEDPG_LEDONTIME_CLK20  =6,
    /** Time LED is seven */
    CSL_LEDPG_LEDONTIME_CLK24  =7
}CSL_LedpgLEDOnTime;

/** LED blink frequency */
typedef enum 
{
    /** LED blink frequency at zero */
    CSL_LEDPG_PERIOD_CLK32   =0,
    /** LED blink frequency at one */
    CSL_LEDPG_PERIOD_CLK64   =1,
    /** LED blink frequency at two */
    CSL_LEDPG_PERIOD_CLK128  =2,
    /** LED blink frequency at three */
    CSL_LEDPG_PERIOD_CLK256  =3,
    /** LED blink frequency at four */
    CSL_LEDPG_PERIOD_CLK384  =4,
    /** LED blink frequency at five */
    CSL_LEDPG_PERIOD_CLK512  =5,
    /** LED blink frequency at six */
    CSL_LEDPG_PERIOD_CLK640  =6,
    /** LED blink frequency at seven*/
    CSL_LEDPG_PERIOD_CLK768  =7
} CSL_LedpgPeriod;

/** Cmd's used to control the ledpg. */
typedef enum 
{    
    /** 
     * @brief   LED Permanently ON
     * @param   (NULL)
     */
	CSL_LEDPG_CMD_ON,
    /** 
     * @brief   LED Permanently OFF
     * @param   (NULL)
     */
    CSL_LEDPG_CMD_OFF,
    /** 
     * @brief   Use the LED in the blinking
     * @param   (CSL_LedpgHwSetup *)
     */
    CSL_LEDPG_CMD_BLINK,
    /** 
     * @brief   Enable clock to LEDPG
     * @param   (NULL)
     */
    CSL_LEDPG_CMD_ENABLE_CLK,
    /** 
     * @brief   Disable clock to LEDPG
     * @param   (NULL)
     */
    CSL_LEDPG_CMD_DISABLE_CLK,
    /** 
     * @brief   Reset counter low
     * @param   (NULL)
     */
    CSL_LEDPG_CMD_RESET_COUNT_LOW,
    /** 
     * @brief   Reset counter high
     * @param   (NULL)
     */
    CSL_LEDPG_CMD_RESET_COUNT_HIGH
} CSL_LedpgHwControlCmd;

/* Enum's used to query the Ledpg h/w */
typedef enum 
{
    /** 
     * @brief   The duration of each blink cycle
     * @param   (CSL_LedpgPeriod *)
     */
    CSL_LEDPG_QUERY_PERIOD,
    /** 
     * @brief   The duration for which the LED is ON in a blink cycle
     * @param   (CSL_LedpgLEDOnTime *)
     */
    CSL_LEDPG_QUERY_ONTIME
} CSL_LedpgHwStatusQuery;

/** Functional clock */
typedef enum 
{
    /** Functional clock disable */
    CSL_LEDPG_CLKEN_DISABLE =0,
    /** Functional clock enable */
    CSL_LEDPG_CLKEN_ENABLE =1
} CSL_LedpgClken;

/** Default setup value for LEDPG */
#define CSL_LEDPG_HWSETUP_DEFAULTS { \
    CSL_LEDPG_LEDONTIME_CLK1, \
    CSL_LEDPG_PERIOD_CLK32 \
	}

/** Default config values for LEDPG */
#define CSL_LEDPG_CONFIG_DEFAULTS { \
    CSL_LEDPG_LCR_RESETVAL, \
    CSL_LEDPG_PMR_RESETVAL \
}

/** Structure used to setup LED Pulse Generator (in the default Blinking Mode). */
typedef struct CSL_LedpgHwSetup 
{
    /** Led on time */
    CSL_LedpgLEDOnTime  ledontime;
    /** Led blink period */
    CSL_LedpgPeriod     period;
} CSL_LedpgHwSetup;

/** LEDPG config structure */
typedef struct CSL_LedpgConfig
{
    /** LEDPG control register */
    CSL_Reg32 LCR;
    /** Power management register */
    CSL_Reg32 PMR;
} CSL_LedpgConfig;

/** 
 * This will have the base-address information for the peripheral instance 
 */
typedef struct CSL_LedpgBaseAddress 
{
    /** Base-address of the Configuration registers of the peripheral */
    CSL_LedpgRegsOvly   regs;
} CSL_LedpgBaseAddress;

/**
 * LEDPG Module specific parameters. Present implementation doesn't have
 * any module specific parameters.
 */
typedef struct CSL_LedpgParam 
{
    /** Bit mask to be used for module specific parameters.
     *  The below declaration is just a place-holder for future
     *  implementation.
     */
    CSL_BitMask16   flags;
} CSL_LedpgParam;

/** 
 * LEDPG module specific context information. Present implementation doesn't
 * have any Context information.
 */
typedef struct CSL_LedpgContext 
{
    /** Context information of LEDPG.
     *  The below declaration is just a place-holder for future
     *  implementation.
     */
    Uint16  contextInfo;
} CSL_LedpgContext;

/** LEDPG types */
typedef struct CSL_LedpgObj 
{
    /** Register overlay of the LEDPG */
    CSL_LedpgRegsOvly       regs;
    /** LEDPG instance */
    CSL_InstNum             perNum;
} CSL_LedpgObj;

/** Pointer to the LEDPG instance */
typedef struct CSL_LedpgObj *CSL_LedpgHandle;


/*
 * LEDPG global function declarations
 */
/** ============================================================================
 *   @func CSL_ledpgInit
 *
 *   @desc
 *      This is the initialization function for the LEDPG CSL. This function 
 *      needs to be called before any LEDPG CSL functions are called. 
 *      This function is idem-potent.Currently, this function does not 
 *      perform anything.
 *
 *   @arg   pContext
 *          Context information for LEDPG
 *
 *   @ret   CSL_Status
 *          CSL_SOK - Always returns 
 *
 *   @eg
 *          CSL_ledpgInit (NULL)
 * =============================================================================
 */
extern CSL_Status  CSL_ledpgInit (
    CSL_LedpgContext  *pContext
);

/*
 * =============================================================================
 *   @func csl_ledpgOpen
 *

⌨️ 快捷键说明

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