📄 csl_pwmgetbaseaddress.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/** @file csl_pwmGetBaseAddress.c
*
* @brief File for functional layer of CSL API @a CSL_pwmGetBaseAddress()
*
* Path: \\(CSLPATH)\\soc\\Davinci\\arm9\\src
*
* Description
* - The @a CSL_pwmGetBaseAddress() function definition & it's associated functions
*
*/
/* =============================================================================
* Revision History
* ===============
* 08-Sep-2004 brn File Created.
* 11-Oct_2004 brn File updated with the review comments
* =============================================================================
*/
#include <soc.h>
#include <csl_pwm.h>
/** ============================================================================
* @n@b CSL_pwmGetBaseAddress
*
* @b Description
* @n This function gets the base address of the given pulse width modulation
* instance.
*
* @b Arguments
* @verbatim
pwmNum Specifies the instance of the pulse width modulation to be
opened.
pPwmParam pulse width modulation module specific parameters.
pBaseAddress Pointer to base address structure containing base
address details.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL pulse width modulation instance is not
* available.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Base address structure is populated
*
* @b Modifies
* @n 1. The status variable
*
* 2. Base address structure is modified.
*
* @b Example
* @verbatim
CSL_Status status;
CSL_PwmBaseAddress baseAddress;
...
status = CSL_pwmGetBaseAddress(CSL_PWM, NULL, &baseAddress);
...
@endverbatim
* ===========================================================================
*/
#pragma CODE_SECTION (CSL_pwmGetBaseAddress, ".text:csl_section:pwm");
CSL_Status CSL_pwmGetBaseAddress (
CSL_InstNum pwmNum,
CSL_PwmParam *pPwmParam,
CSL_PwmBaseAddress *pBaseAddress
)
{
CSL_Status status = CSL_SOK;
*pPwmParam = *pPwmParam;
/* Added the following code according to the code review comments*/
if (pBaseAddress == NULL)
return CSL_ESYS_INVPARAMS;
switch (pwmNum) {
case CSL_PWM_1:
pBaseAddress->regs = (CSL_PwmRegsOvly)CSL_PWM_1_REGS;
break;
case CSL_PWM_2:
pBaseAddress->regs = (CSL_PwmRegsOvly)CSL_PWM_2_REGS;
break;
case CSL_PWM_3:
pBaseAddress->regs = (CSL_PwmRegsOvly)CSL_PWM_3_REGS;
break;
default:
pBaseAddress->regs = (CSL_PwmRegsOvly)NULL;
status = CSL_ESYS_FAIL;
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -