initial import
[ICEs.git] / 153708 / ice.i.2
1 typedef int (*initcall_t)(void);
2 struct cdev {
3 };
4 extern unsigned int iop13xx_atux_mem_base;
5 static inline __attribute__((always_inline)) void * __iop13xx_ioremap(unsigned long cookie, unsigned int size, unsigned long flags) {
6 void * retval;
7 switch (cookie) {
8 case 0x80000000UL ... (0x80000000UL + 0x3a000000UL - 1): if (__builtin_expect(!!(!iop13xx_atux_mem_base), 0)) retval = ((void *)0);
9 break;
10 default: retval = __ioremap(cookie, size, flags);
11 }
12 };
13 struct imu_dev {
14 struct cdev cdev;
15 };
16 static struct imu_dev imu[4];
17 static int imu_major = 0;
18 void init_callback(int queueid) {
19 }
20 void error_callback(int queueid) {
21 }
22 static int __attribute__ ((__section__ (".init.text"))) imu_dev_init(void) {
23 int err, i;
24 char *queue_base;
25 for (i = 1;
26 i < 4;
27 i++) {
28 if (cdev_add(&imu[i].cdev, (((imu_major) << 20) | (i)), 1)) {
29 printk("<4>" "Error cdev_add imu%i\n", i);
30 }
31 queue_base = __iop13xx_ioremap(((128*1024*1024) + (i * (16*64))), ((16*64)), 0);
32 err = iop_queue_init(i, (void *)(128*1024*1024) + (i * (16*64)), queue_base, 64, 16, init_callback, error_callback);
33 }
34 }
35 static initcall_t __initcall_imu_dev_init __attribute__((__used__)) __attribute__((__section__(".initcall" "6" ".init"))) = imu_dev_init;