XINU
Functions
gpioread.c File Reference
#include <xinu.h>
Include dependency graph for gpioread.c:

Go to the source code of this file.

Functions

devcall gpioread (struct dentry *devptr, char *value, int32 pinmask)
 

Function Documentation

◆ gpioread()

devcall gpioread ( struct dentry devptr,
char *  value,
int32  pinmask 
)

Definition at line 9 of file gpioread.c.

References gpio_csreg::datain, dentry::dvcsr, and OK.

14 {
15  struct gpio_csreg *csrptr; /* Pointer to GPIO CSRs */
16 
17  /* Obtain the address of the CSR from the device switch table */
18 
19  csrptr = (struct gpio_csreg *)(devptr->dvcsr);
20 
21  /* Access the GPIO pins, use the mask to select a subset, and */
22  /* store the result in the specified buffer */
23 
24  *((uint32 *)value) = csrptr->datain & pinmask;
25 
26  return OK;
27 }
#define OK
処理が成功した場合
Definition: kernel.h:77
volatile uint32 datain
Definition: gpio.h:33
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
void * dvcsr
Definition: conf.h:19