- initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include "libsys.h"
|
||||
#include "gpio.h"
|
||||
|
||||
// ---------------------------------------------------------
|
||||
UINT32 gpio_init(gpio_if_t *pGPIO, UINT32 base_addr)
|
||||
{
|
||||
pGPIO->pBase = (UINT32*)base_addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_clean(gpio_if_t *pGPIO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_write(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 value)
|
||||
{
|
||||
*(pGPIO->pBase + offset) = (*(pGPIO->pBase + offset) & ~(mask << shift)) | ((value & mask) << shift);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_read(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 *pValue)
|
||||
{
|
||||
*pValue = (*(pGPIO->pBase + offset) & (mask << shift)) >> shift;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
Reference in New Issue
Block a user