- reduced compiler warnings git-svn-id: http://moon:8086/svn/mips@180 a8ebac50-d88d-4704-bea3-6648445a41b3
29 lines
749 B
C
29 lines
749 B
C
#include "libsys.h"
|
|
#include "gpio.h"
|
|
|
|
// ---------------------------------------------------------
|
|
uint32_t gpio_init(gpio_if_t *pGPIO, uint32_t base_addr)
|
|
{
|
|
pGPIO->pBase = (uint32_t*)base_addr;
|
|
return 0;
|
|
}
|
|
|
|
uint32_t gpio_clean(gpio_if_t *pGPIO)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
uint32_t gpio_write(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t value)
|
|
{
|
|
*(pGPIO->pBase + offset) = (((*(pGPIO->pBase + offset) >> shift) & ~mask) | (value & mask)) << shift;
|
|
return 0;
|
|
}
|
|
|
|
uint32_t gpio_read(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t *pValue)
|
|
{
|
|
*pValue = (*(pGPIO->pBase + offset) >> shift) & mask;
|
|
return 0;
|
|
}
|
|
|
|
// ---------------------------------------------------------
|