📄 bbu_dd_gpioadl.c
字号:
* 函数描述: Reads the current GPIO Configuration Structure *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* config GPIO_Config* out Configuration structure for GPIO*
* *
* 返回值: void *
* 说明: *
*******************************************************************************/
CSLAPI void GPIO_getConfig(GPIO_Handle *hGpio,GPIO_Config *config)
{
Uint32 gie;
register int x0,x1,x2,x3,x4,x5,x6;
volatile Uint32 *base = (volatile Uint32 *)(hGpio->baseAddr);
gie = IRQ_globalDisable();
x0 = base[GPIO_GPGC_OFFSET];
x1 = base[GPIO_GPEN_OFFSET];
x2 = base[GPIO_GPDIR_OFFSET];
x3 = base[GPIO_GPVAL_OFFSET];
x4 = base[GPIO_GPHM_OFFSET];
x5 = base[GPIO_GPLM_OFFSET];
x6 = base[GPIO_GPPOL_OFFSET];
config->gpgc = x0;
config->gpen = x1;
config->gpdir = x2;
config->gpval = x3;
config->gphm = x4;
config->gplm = x5;
config->gppol = x6;
IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_close *
* 函数描述: This function closes a GPIO channel previously opened *
* via GPIO_open() *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* *
* 返回值: void *
* 说明: *
*******************************************************************************/
CSLAPI void GPIO_close(GPIO_Handle *hGpio)
{
Uint32 gie;
gie = IRQ_globalDisable();
if (hGpio != GPIO_HINV)
{
GPIO_resetAll(hGpio);
hGpio->allocated = FALSE;
}
IRQ_globalRestore(gie);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_Init *
* 函数描述: This function initialize the GPIO Device *
* 相关文档: *
* 参数描述: void *
* *
* 返回值: hGpio *
* 说明: *
*******************************************************************************/
CSLAPI GPIO_Handle *GPIO_init(void)
{
GPIO_Handle *hGpio;
hGpio = GPIO_open();
if( hGpio == GPIO_HINV)
{
return hGpio;
}
GPIO_config(hGpio,&gpioConfig);
return hGpio;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_getDspId *
* 函数描述: This function get DSPs's ID *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* *
* 返回值: dspId *
* 说明: *
*******************************************************************************/
CSLAPI Uint32 GPIO_getDspId(GPIO_Handle *hGpio)
{
Uint32 dspId;
dspId = (GPIO_read(hGpio,GPIO_PIN15 | GPIO_PIN14 | GPIO_PIN13)) >> 13;
return dspId;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_setLedOn *
* 函数描述: light on DSP's LED *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* pinMask Uint32 in Specific Pin *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI void GPIO_setLedOn(GPIO_Handle *hGpio,Uint32 pinMask)
{
GPIO_pinWrite(hGpio,pinMask,0);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_setLedOff *
* 函数描述: light off DSP's LED *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* pinMask Uint32 in Specific Pin *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI void GPIO_setLedOff(GPIO_Handle *hGpio,Uint32 pinMask)
{
GPIO_pinWrite(hGpio,pinMask,1);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: GPIO_setDspReady *
* 函数描述: set DSP ready signal to MPC8260 *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* hGpio GPIO_Handle* in GPIO Handle for GPIO *
* val Uint32 in DSP Ready Value *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI void GPIO_setDspReady(GPIO_Handle *hGpio,Uint32 val)
{
GPIO_pinWrite(hGpio,GPIO_PIN3,val);
}
/*----------------------------------------------------------------------------*/
/******************************************************************************\
* End of BBU_DD_GpioAdl.c
\******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -