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