This source file includes following definitions.
- set_auxio
1
2
3
4
5
6 #ifndef _SPARC_AUXIO_H
7 #define _SPARC_AUXIO_H
8
9 #include <asm/system.h>
10 #include <asm/vaddrs.h>
11
12 extern unsigned char *auxio_register;
13
14
15
16
17
18
19 #define AUXIO_ORMEIN 0xf0
20 #define AUXIO_ORMEIN4M 0xc0
21 #define AUXIO_FLPY_DENS 0x20
22 #define AUXIO_FLPY_DCHG 0x10
23 #define AUXIO_EDGE_ON 0x10
24 #define AUXIO_FLPY_DSEL 0x08
25
26
27 #define AUXIO_FLPY_TCNT 0x04
28
29
30 #define AUXIO_FLPY_EJCT 0x02
31 #define AUXIO_LED 0x01
32
33 #define AUXREG ((volatile unsigned char *)(auxio_register))
34
35 #define TURN_ON_LED *AUXREG = (*AUXREG | AUXIO_ORMEIN | AUXIO_LED)
36 #define TURN_OFF_LED *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_LED))
37 #define FLIP_LED *AUXREG = ((*AUXREG | AUXIO_ORMEIN) ^ AUXIO_LED)
38 #define FLPY_MOTORON *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_DSEL)
39 #define FLPY_MOTOROFF *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL))
40 #define FLPY_TCNTON *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_TCNT)
41 #define FLPY_TCNTOFF *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT))
42
43 #ifndef __ASSEMBLY__
44 extern inline void set_auxio(unsigned char bits_on, unsigned char bits_off)
45 {
46 unsigned char regval;
47 unsigned long flags;
48
49 save_flags(flags); cli();
50
51 switch(sparc_cpu_model) {
52 case sun4c:
53 regval = *AUXREG;
54 *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN;
55 break;
56 case sun4m:
57 regval = *AUXREG;
58 *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M;
59 break;
60 default:
61 panic("Can't set AUXIO register on this machine.");
62 };
63
64 restore_flags(flags);
65 }
66 #endif
67
68 #endif