summaryrefslogtreecommitdiff
path: root/target/linux/etrax-2.6/patches/cris/020-syscalls.patch
blob: 5e674a6232b2bbb1c95a28b77185093dfc84bf5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
diff -urN linux-2.6.19.2.orig/include/asm-cris/unistd.h linux-2.6.19.2/include/asm/unistd.h
--- linux-2.6.19.2.orig/include/asm-cris/unistd.h	2007-06-16 23:59:11.000000000 +0200
+++ linux-2.6.19.2/include/asm/unistd.h	2007-06-17 03:43:10.000000000 +0200
@@ -325,9 +325,52 @@
 #define __NR_getcpu		318
 #define __NR_epoll_pwait	319
 
+#ifdef CONFIG_ETRAX_GPIO 
+	#ifdef CONFIG_FOXBONE
+		#define __NR_gpiosetbits	320
+		#define __NR_gpioclearbits	321
+		#define __NR_gpiosetdir		322
+		#define __NR_gpiotogglebit	323
+		#define __NR_gpiogetbits	324
+		#define __NR_foxboneread	325
+		#define __NR_foxbonewrite	326 
+		#define __NR_foxbonebulkread	327 
+		#define __NR_foxbonebulkwrite	328 
+		#define __NR_foxbonereset	329
+		#define __NR_foxboneintreg	330
+		#define __NR_foxboneintcheck	331
+		#define __NR_foxboneintwait	332
+		#define NR_syscalls 333
+	
+	#else
+		#define __NR_gpiosetbits	320
+		#define __NR_gpioclearbits	321
+		#define __NR_gpiosetdir		322
+		#define __NR_gpiotogglebit	323
+		#define __NR_gpiogetbits	324
+		
+		#define NR_syscalls 325
+	#endif
+#else
+	#ifdef CONFIG_FOXBONE 
+		#define __NR_foxboneread	320
+		#define __NR_foxbonewrite	321 
+		#define __NR_foxbonebulkread	322
+		#define __NR_foxbonebulkwrite	323
+		#define __NR_foxboneintreg	324
+		#define __NR_foxboneintcheck	325
+		#define __NR_foxboneintwait	326
+	
+		#define NR_syscalls 327
+	
+	#else 
+	
+		#define NR_syscalls 320
+	#endif
+#endif
+	
 #ifdef __KERNEL__
 
-#define NR_syscalls 320
 
 #include <asm/arch/unistd.h>
 
--- linux-2.6.19.2.orig/include/linux/gpio_syscalls.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.19.2/include/linux/gpio_syscalls.h	2007-06-17 03:44:49.000000000 +0200
@@ -0,0 +1,75 @@
+#ifndef __LINUX_SYSCALL_GPIO
+#define __LINUX_SYSCALL_GPIO
+#include <linux/autoconf.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <asm/unistd.h>
+
+// port defines
+#define PORTA 	'A'
+#define PORTB 	'B'
+#define PORTG 	'G'
+
+//direction defines
+#define DIRIN 	'I'
+#define DIROUT 	'O'
+
+// pin defines for PORTG
+#define PG0	(1<<0)
+#define PG1     (1<<1)
+#define PG2     (1<<2)
+#define PG3     (1<<3)
+#define PG4     (1<<4)
+#define PG5     (1<<5)
+#define PG6     (1<<6)
+#define PG7     (1<<7)
+#define PG8     (1<<8)
+#define PG9     (1<<9)
+#define PG10	(1<<10)
+#define PG11    (1<<11)
+#define PG12    (1<<12)
+#define PG13    (1<<13)
+#define PG14    (1<<14)
+#define PG15    (1<<15)
+#define PG16    (1<<16)
+#define PG17    (1<<17)
+#define PG18    (1<<18)
+#define PG19    (1<<19)
+#define PG20    (1<<20)
+#define PG21    (1<<21)
+#define PG22    (1<<22)
+#define PG23    (1<<23)
+#define PG24    (1<<24)
+
+#define PG8_15	0x00ff00
+#define PG16_23	0xff0000
+
+
+// pin defines for PORTA
+#define PA0	(1<<0)
+#define PA1	(1<<1)
+#define PA2	(1<<2)
+#define PA3	(1<<3)
+#define PA4	(1<<4)
+#define PA5	(1<<5)
+#define PA6	(1<<6)
+#define PA7	(1<<7)
+
+// pin defines for PORTB
+#define PB0	(1<<0)
+#define PB1	(1<<1)
+#define PB2	(1<<2)
+#define PB3	(1<<3)
+#define PB4	(1<<4)
+#define PB5	(1<<5)
+#define PB6	(1<<6)
+#define PB7	(1<<7)
+
+int errno;
+_syscall2(void, gpiosetbits, unsigned char, port, unsigned int, bits);
+_syscall2(void, gpioclearbits, unsigned char, port, unsigned int, bits);
+_syscall3(void, gpiosetdir, unsigned char, port, unsigned char, dir, unsigned int, bits);
+_syscall2(void, gpiotogglebit, unsigned char, port, unsigned int, bits);
+_syscall2(unsigned int, gpiogetbits, unsigned char, port, unsigned int, bits);
+
+#endif
--- linux-2.6.19.2.orig/arch/cris/arch-v10/kernel/entry.S	2007-06-16 23:58:14.000000000 +0200
+++ linux-2.6.19.2/arch/cris/arch-v10/kernel/entry.S	2007-06-17 03:48:21.000000000 +0200
@@ -1200,6 +1200,23 @@
 	.long sys_move_pages
 	.long sys_getcpu
 	.long sys_epoll_pwait
+#ifdef CONFIG_ETRAX_GPIO
+	.long sys_gpiosetbits
+	.long sys_gpioclearbits
+	.long sys_gpiosetdir
+	.long sys_gpiotogglebit
+	.long sys_gpiogetbits
+#endif
+#ifdef CONFIG_FOXBONE
+	.long sys_foxboneread
+	.long sys_foxbonewrite
+	.long sys_foxbonebulkread
+	.long sys_foxbonebulkwrite
+	.long sys_foxbonereset
+	.long sys_foxboneintreg
+	.long sys_foxboneintcheck
+	.long sys_foxboneintwait	
+#endif
 		
         /*
          * NOTE!! This doesn't have to be exact - we just have
diff linux-2.6.19.2.orig/arch/cris/arch-v10/drivers/Makefile linux-2.6.19.2/arch/cris/arch-v10/drivers/Makefile
--- linux-2.6.19.2.orig/arch/cris/arch-v10/drivers/Makefile	2007-06-16 23:58:14.000000000 +0200
+++ linux-2.6.19.2/arch/cris/arch-v10/drivers/Makefile 2007-06-17 03:48:21.000000000 +0200
8a9
> obj-$(CONFIG_ETRAX_GPIO)            += gpio_syscalls.o