?? bbu_dd_gpioadl.c
字號:
* 函數(shù)描述: Reads the current GPIO Configuration Structure *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_close *
* 函數(shù)描述: This function closes a GPIO channel previously opened *
* via GPIO_open() *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_Init *
* 函數(shù)描述: This function initialize the GPIO Device *
* 相關(guān)文檔: *
* 參數(shù)描述: 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;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_getDspId *
* 函數(shù)描述: This function get DSPs's ID *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_setLedOn *
* 函數(shù)描述: light on DSP's LED *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_setLedOff *
* 函數(shù)描述: light off DSP's LED *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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);
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函數(shù)名稱: GPIO_setDspReady *
* 函數(shù)描述: set DSP ready signal to MPC8260 *
* 相關(guān)文檔: *
* 參數(shù)描述: *
* 參數(shù)名 類型 輸入/輸出 描述 *
* -------- ---- --------- ----------- *
* 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
\******************************************************************************/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -