📄 csl_pwl.h
字号:
/** ============================================================================
* @file csl_pwl.h
*
* @path $(CSLPATH)\arm\pwl\src
*
* @desc APIs and Data structures for PWL
*
*/
/* ============================================================================
* 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-06-01) */
/* =============================================================================
* Revision History
* ================
* 09-Jul-2004 sp Modifications done according to the new CSL architecture.
* 01-Jun-2004 Shiva File Created.
*
* =============================================================================
*/
#ifndef _CSL_PWL_H_
#define _CSL_PWL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl_types.h>
#include <csl_error.h>
#include <cslr_pwl.h>
/**
* PWL global typedef declarations
*/
/** Enums used to control the PWL */
typedef enum
{
/**
* @brief Disable clock to PWL
* @param (NULL)
*/
CSL_PWL_CMD_CLK_EN_DIS,
/**
* @brief Enable clock to PWL
* @param (NULL)
*/
CSL_PWL_CMD_CLK_EN_EN
} CSL_PwlHwControlCmd;
/** Enums used to query the PWL H/W */
typedef enum
{
/**
* @brief Query the mean value of the PWL output signal
* @param (Uint8 *)
*/
CSL_PWL_QUERY_LEVEL
} CSL_PwlHwStatusQuery;
/** Default setup values */
#define CSL_PWL_HWSETUP_DEFAULTS { \
0xFF \
}
/** Default config values */
#define CSL_PWL_CONFIG_DEFAULTS { \
CSL_PWL_PWL_LEVEL_RESETVAL, \
CSL_PWL_PWL_CTRL_RESETVAL \
}
/** Structure used to setup PWL device */
typedef struct CSL_PwlHwSetup
{
/** Mean value of PWL output signal */
Uint8 level;
} CSL_PwlHwSetup;
/** Config structure */
typedef struct CSL_PwlConfig
{
/** PWL level register */
volatile Uint8 PWL_LEVEL;
/** PWL control register */
volatile Uint8 PWL_CTRL;
} CSL_PwlConfig;
/**
* This will have the base-address information for the peripheral instance
*/
typedef struct CSL_PwlBaseAddress
{
/** Base-address of the Configuration registers of the peripheral */
CSL_PwlRegsOvly regs;
} CSL_PwlBaseAddress;
/**
* PWL Module specific parameters. Present implementation doesn't have
* any module specific parameters.
*/
typedef struct CSL_PwlParam
{
/** Bit mask to be used for module specific parameters.
* The below declaration is just a place-holder for future
* implementation.
*/
CSL_BitMask16 flags;
} CSL_PwlParam;
/**
* PWL module specific context information. Present implementation doesn't
* have any Context information.
*/
typedef struct CSL_PwlContext
{
/** Context information of PWL.
* The below declaration is just a place-holder for future
* implementation.
*/
Uint16 contextInfo;
} CSL_PwlContext;
/** PWL object structure */
typedef struct CSL_PwlObj
{
/** Register overlay of the PWL */
CSL_PwlRegsOvly regs;
/** PWL instance */
CSL_InstNum perNum;
} CSL_PwlObj;
/** Pointer to the PWL object */
typedef struct CSL_PwlObj *CSL_PwlHandle;
/*
* PWL global function declarations
*/
/** ============================================================================
* @func CSL_pwlInit
*
* @desc
* This is the initialization function for the PWL CSL. This function
* needs to be called before any PWL CSL functions are called.
* This function is idem-potent.Currently, this function does not
* perform anything.
*
* @arg pContext
* Context information for PWL
*
* @ret CSL_Status
* CSL_SOK - Always returns
*
* @eg
* CSL_pwlInit (NULL)
* =============================================================================
*/
extern CSL_Status CSL_pwlInit (
CSL_PwlContext *pContext
);
/*
* =============================================================================
* @func csl_pwlOpen
*
* @desc
* This function populates the peripheral data object for the instance and
* returns a handle to the instance
*
* @arg hPwlObj
* Pointer to the PWL instance object
*
* @arg pwlNum
* Instance of the PWL to be opened
*
* @arg pPwlParam
* Pointer to module specific parameters
*
* @arg pStatus
* pointer for returning status of the function call
*
* @ret CSL_PwlHandle
* Valid PWL instance handle will be returned if status value is
* equal to CSL_SOK.
*
* @eg
* CSL_status status;
* CSL_PwlObj hPwlObj;
* CSL_PwlHandle hPwl;
*
* hPwl = CSL_pwlOpen (&hPwlObj, CSL_PWL, NULL, &status);
* =============================================================================
*/
extern CSL_PwlHandle CSL_pwlOpen (
CSL_PwlObj *hPwlObj,
CSL_InstNum pwlNum,
CSL_PwlParam *pPwlParam,
CSL_Status *pstatus
);
/*
* =============================================================================
* @func CSL_pwlClose
*
* @desc
* This function closes the PWL instance specified by its handle.
*
* @arg hPwl
* The handle to the PWL instance.
*
* @ret CSL_Status
* CSL_SOK : Successful, desired operation is done.
* CSL_ESYS_BADHANDLE : handle pass is invalid.
*
* @eg
* status = CSL_pwlClose(hPwl);
* =============================================================================
*/
extern CSL_Status CSL_pwlClose(
CSL_PwlHandle hPwl
);
/*
* =============================================================================
* @func CSL_pwlHwSetup
*
* @desc
* This function sets the specified PWL H/W parameters
*
* @arg hPwl
* The handle to the PWL instance
*
* @arg setup
* The setup structure used to setup PWL device
*
* @ret CSL_Status
* CSL_SOK : Desired operation is done successful
* CSL_ESYS_INVPARAMS : Parameters passed is NULL.
*
* @eg
* CSL_PwlHwSetup setup = CSL_PWL_HWSETUP_DEFAULTS;
*
* status = CSL_pwlHwSetup(hPwl, &setup);
* =============================================================================
*/
extern CSL_Status CSL_pwlHwSetup (
CSL_PwlHandle hPwl,
CSL_PwlHwSetup *setup
);
/*
* =============================================================================
* @func CSL_pwlHwSetupRaw
*
* @desc
* This function configures the registers of PWL instance as per the
* values given in the Config structure.
*
* @arg hPwl
* Handle to the PWL instance
*
* @arg pwlConfig
* Pointer to the PWL config structure
*
* @ret CSL_Status
* CSL_SOK - Configuration successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
* CSL_status status;
* CSL_PwlConfig pwlConfig = CSL_PWL_CONFIG_DEFAULTS;
*
* status = CSL_pwlHwsetupRaw (hPwl, &pwlConfig);
* =============================================================================
*/
extern CSL_Status CSL_pwlHwSetupRaw (
CSL_PwlHandle hPwl,
CSL_PwlConfig *pwlConfig
);
/*
* =============================================================================
* @func CSL_pwlGetHwSetup
*
* @desc
* This function is for quering the hardware setup parameters. It
* passes back the setup paramters.
*
* @arg hPwl
* Handle to the PWL instance
*
* @arg setup
* Pointer to hardware setup structure
*
* @ret CSL_Status
* CSL_SOK : Successful, desired operation is done.
* CSL_ESYS_BADHANDLE : handle pass is invalid.
*
* @eg
* CSL_Status status;
* CSL_PwlHandle hPwl;
* CSL_PwlHwSetup setup;
*
* status = CSL_pwlGetHwSetup (hPwl, &setup);
* =============================================================================
*/
extern CSL_Status CSL_pwlGetHwSetup(
CSL_PwlHandle hPwl,
CSL_PwlHwSetup *setup
);
/*
* =============================================================================
* @func CSL_pwlHwControl
* @desc
* Function controls the PWL peripheral specified by the hanldle.
* Operation done is based on the "cmd".
*
* @arg hPwl
* The handle to the PWL instance
*
* @arg cmd
* Control command which needs to performed
*
* @arg cmdArgs
* Argument related to the command
*
* @ret CSL_Status
* CSL_SOK : Desired operation is done successful
* CSL_ESYS_INVCMD : Control command is not supported
*
* @eg
* CSL_Status status;
*
* status = CSL_pwlHwControl(hpwl, CSL_PWL_CMD_VRC_ONOFF_ON, NULL);
*
* =============================================================================
*/
extern CSL_Status CSL_pwlHwControl(
CSL_PwlHandle hPwl,
CSL_PwlHwControlCmd cmd,
void *cmdArg
);
/*
* =============================================================================
* @func CSL_pwlGetHwStatus
*
* @desc
* This function query's the H/W - PWL specified by the handle,
* query is specified by the CSL_PwlHwQuery command.
*
* @arg hPwl
* Handle to PWL object instance
*
* @arg myQuery
* User's query
*
* @arg response
* Slot for saving response to query placed
*
* @ret CSL_Status
* CSL_SOK : Successful Retreive, response will have the desired value
* CSL_ESYS_INVQUERY : Query option is not supported
*
* @eg
* CSL_Status status;
* void *response;
* ...
* status = CSL_pwlGetHwStatus(hPwl, CSL_PWL_QUERY_FRQ,
* (void *)&response);
* =============================================================================
*/
extern CSL_Status CSL_pwlGetHwStatus(
CSL_PwlHandle hPwl,
CSL_PwlHwStatusQuery myQuery,
void *response
);
/** ============================================================================
* @n@b CSL_pwlGetBaseAddress
*
* @b Description
* @n Function to get the base address of the peripheral instance.
* This function is used for getting the base address of the peripheral
* instance. This function will be called inside the CSL_pwlOpen()
* function call.This function is open for re-implementing if the user
* wants to modify the base address of the peripheral object to point to
* a different location and there by allow CSL initiated write/reads into
* peripheral MMR's go to an alternate location.
*
* @b Arguments
* @verbatim
pwlNum Specifies the instance of PWL to be opened
pPwlParam Module specific parameters
pBaseAddress Pointer to baseaddress structure containing base
address details
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL The instance number is invalid
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Base Address structure is populated
*
* @b Modifies
* @n Base address structure is modified
*
* @b Example
* @verbatim
CSL_Status status;
CSL_PwlBaseAddress baseAddress;
...
status = CSL_pwlGetBaseAddress(CSL_PWL, NULL, &baseAddress);
@endverbatim
* =============================================================================
*/
extern CSL_Status CSL_pwlGetBaseAddress (
CSL_InstNum pwlNum,
CSL_PwlParam *pPwlParam,
CSL_PwlBaseAddress *pBaseAddress
);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -