1 #include <linux/autoconf.h>
3 #include <linux/module.h>
4 #include <linux/sched.h>
5 #include <linux/slab.h>
6 #include <linux/ioport.h>
7 #include <linux/errno.h>
8 #include <linux/kernel.h>
10 #include <linux/string.h>
11 #include <linux/poll.h>
12 #include <linux/init.h>
13 #include <linux/interrupt.h>
15 #include <asm/uaccess.h>
16 #include <linux/gpio_syscalls.h>
18 #include <asm/etraxgpio.h>
19 #include <asm/arch/svinto.h>
21 #include <asm/system.h>
23 #include <asm/arch/io_interface_mux.h>
25 #include <asm/unistd.h>
31 asmlinkage
void sys_gpiosetbits(unsigned char port
, unsigned int bits
){
35 *R_PORT_G_DATA
= port_g_data_shadow
|= bits
;
40 *R_PORT_PA_DATA
= port_pa_data_shadow
|= bits
;
45 *R_PORT_PB_DATA
= port_pb_data_shadow
|= bits
;
52 asmlinkage
void sys_gpioclearbits(unsigned char port
, unsigned int bits
){
56 *R_PORT_G_DATA
= port_g_data_shadow
&= ~bits
;
61 *R_PORT_PA_DATA
= port_pa_data_shadow
&= ~bits
;
66 *R_PORT_PB_DATA
= port_pb_data_shadow
&= ~bits
;
72 asmlinkage
void sys_gpiosetdir(unsigned char port
, unsigned char dir
, unsigned int bits
){
73 if((dir
=='I' )||(dir
=='i')){
78 genconfig_shadow
&= ~IO_MASK(R_GEN_CONFIG
, g0dir
);
80 if((bits
& 0x0000FF00)==0x0000FF00){
81 genconfig_shadow
&= ~IO_MASK(R_GEN_CONFIG
, g8_15dir
);
83 if((bits
& 0x00FF0000)==0x00FF0000){
84 genconfig_shadow
&= ~IO_MASK(R_GEN_CONFIG
, g16_23dir
);
87 genconfig_shadow
&= ~IO_MASK(R_GEN_CONFIG
, g24dir
);
89 *R_GEN_CONFIG
= genconfig_shadow
;
94 *R_PORT_PA_DIR
= port_pa_dir_shadow
&= ~(bits
& 0xff);
99 *R_PORT_PB_DIR
= port_pb_dir_shadow
&= ~(bits
& 0xff);
102 } else if((dir
=='O' )||(dir
=='o')){
107 genconfig_shadow
|= IO_MASK(R_GEN_CONFIG
, g0dir
);
109 if((bits
& 0x0000FF00)==0x0000FF00){
110 genconfig_shadow
|= IO_MASK(R_GEN_CONFIG
, g8_15dir
);
112 if((bits
& 0x00FF0000)==0x00FF0000){
113 genconfig_shadow
|= IO_MASK(R_GEN_CONFIG
, g8_15dir
);
116 genconfig_shadow
|= IO_MASK(R_GEN_CONFIG
, g24dir
);
118 *R_GEN_CONFIG
= genconfig_shadow
;
123 *R_PORT_PA_DIR
= port_pa_dir_shadow
|= (bits
& 0xff);
128 *R_PORT_PB_DIR
= port_pb_dir_shadow
|= (bits
& 0xff);
135 asmlinkage
void sys_gpiotogglebit(unsigned char port
, unsigned int bits
){
139 if(port_g_data_shadow
& bits
){
140 *R_PORT_G_DATA
= port_g_data_shadow
&= ~bits
;
142 *R_PORT_G_DATA
= port_g_data_shadow
|= bits
;
148 if(*R_PORT_PA_DATA
& bits
){
149 *R_PORT_PA_DATA
= port_pa_data_shadow
&= ~(bits
& 0xff);
151 *R_PORT_PA_DATA
= port_pa_data_shadow
|= (bits
& 0xff);
157 if(*R_PORT_PB_DATA
& bits
){
158 *R_PORT_PB_DATA
= port_pb_data_shadow
&= ~(bits
& 0xff);
160 *R_PORT_PB_DATA
= port_pb_data_shadow
|= (bits
& 0xff);
168 asmlinkage
unsigned int sys_gpiogetbits(unsigned char port
, unsigned int bits
){
169 unsigned int data
= 0;
173 data
= *R_PORT_G_DATA
;
178 data
= *R_PORT_PA_DATA
;
183 data
= *R_PORT_PB_DATA
;
This page took 0.069325 seconds and 5 git commands to generate.