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
13
14
15
16
17
18 #define AUXIO_ORMEIN 0xf0
19 #define AUXIO_ORMEIN4M 0xc0
20 #define AUXIO_FLPY_DENS 0x20
21 #define AUXIO_FLPY_DCHG 0x10
22 #define AUXIO_EDGE_ON 0x10
23 #define AUXIO_FLPY_DSEL 0x08
24
25
26 #define AUXIO_FLPY_TCNT 0x04
27
28
29 #define AUXIO_FLPY_EJCT 0x02
30 #define AUXIO_LED 0x01
31
32 #define AUXREG ((volatile unsigned char *)(AUXIO_VADDR + 3))
33 #define AUXREG4M ((volatile unsigned char *)(AUXIO_VADDR))
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
48 cli();
49
50 switch(sparc_cpu_model) {
51 case sun4c:
52 regval = *AUXREG;
53 *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN;
54 break;
55 case sun4m:
56 regval = *AUXREG4M;
57 *AUXREG4M = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M;
58 break;
59 default:
60 panic("Can't set AUXIO register on this machine.");
61 };
62
63 sti();
64
65 return;
66 }
67 #endif
68
69 #endif