XINU
device
gpio
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
*/
9
devcall
gpioread
(
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
}
gpio_csreg
Definition:
gpio.h:12
xinu.h
全てのシステムヘッダファイルをインクルードする。
OK
#define OK
処理が成功した場合
Definition:
kernel.h:77
gpioread
devcall gpioread(struct dentry *devptr, char *value, int32 pinmask)
Definition:
gpioread.c:9
dentry
Definition:
conf.h:6
int32
int int32
符号あり32ビット整数(int)
Definition:
kernel.h:11
gpio_csreg::datain
volatile uint32 datain
Definition:
gpio.h:33
uint32
unsigned int uint32
符号なし32ビット整数(unsigned int)
Definition:
kernel.h:15
devcall
int32 devcall
デバイスコール関数 返り値の型
Definition:
kernel.h:49
dentry::dvcsr
void * dvcsr
Definition:
conf.h:19
Generated by
1.8.13