XINU
gpioread.c
Go to the documentation of this file.
1 /* gpioread.c - gpioread */
2 
3 #include <xinu.h>
4 
5 /*------------------------------------------------------------------------
6  * gpioread - Read aspecified set of GPIO pins
7  *------------------------------------------------------------------------
8  */
10  struct dentry *devptr, /* Entry in device switch table */
11  char *value, /* Pointer to a 32bit buffer */
12  int32 pinmask /* Pins from which to read */
13  )
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
devcall gpioread(struct dentry *devptr, char *value, int32 pinmask)
Definition: gpioread.c:9
Definition: conf.h:6
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
volatile uint32 datain
Definition: gpio.h:33
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition: kernel.h:15
int32 devcall
デバイスコール関数 返り値の型
Definition: kernel.h:49
void * dvcsr
Definition: conf.h:19