XINU
device
gpio
gpiowrite.c
Go to the documentation of this file.
1
/* gpiowrite.c - gpiowrite */
2
3
#include <
xinu.h
>
4
5
/*------------------------------------------------------------------------
6
* gpiowrite - Write value of gpio pins
7
*------------------------------------------------------------------------
8
*/
9
devcall
gpiowrite
(
10
struct
dentry
*devptr,
/* Entry in device switch table */
11
char
*value,
/* Pointer to 32-bit buffer */
12
int32
pinmask
/* Pins to be written written */
13
)
14
{
15
struct
gpio_csreg
*csrptr;
/* Pointer to GPIO CSRs */
16
uint32
val;
/* Value to be written */
17
18
csrptr = (
struct
gpio_csreg
*)(devptr->
dvcsr
);
19
val = * (
uint32
*)value;
20
21
/* Set bits that should become one */
22
23
csrptr->
set_data
= pinmask & val;
24
25
/* Clear bits that should become zero */
26
27
csrptr->
clear_data
= pinmask & ~val;
28
29
return
OK
;
30
}
gpio_csreg
Definition:
gpio.h:12
xinu.h
全てのシステムヘッダファイルをインクルードする。
OK
#define OK
処理が成功した場合
Definition:
kernel.h:77
dentry
Definition:
conf.h:6
gpio_csreg::set_data
volatile uint32 set_data
Definition:
gpio.h:43
gpio_csreg::clear_data
volatile uint32 clear_data
Definition:
gpio.h:42
gpiowrite
devcall gpiowrite(struct dentry *devptr, char *value, int32 pinmask)
Definition:
gpiowrite.c:9
int32
int int32
符号あり32ビット整数(int)
Definition:
kernel.h:11
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