* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / include / asm-sparc / auxio.h
blobadffbf9337acf471e7ed6c1cf14373b5e88a814b
1 /* $Id: auxio.h,v 1.18 1997/11/07 15:01:45 jj Exp $
2 * auxio.h: Definitions and code for the Auxiliary I/O register.
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6 #ifndef _SPARC_AUXIO_H
7 #define _SPARC_AUXIO_H
9 #include <asm/system.h>
10 #include <asm/vaddrs.h>
12 extern unsigned char *auxio_register;
14 /* This register is an unsigned char in IO space. It does two things.
15 * First, it is used to control the front panel LED light on machines
16 * that have it (good for testing entry points to trap handlers and irq's)
17 * Secondly, it controls various floppy drive parameters.
19 #define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */
20 #define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */
21 #define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */
22 #define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
23 #define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */
24 #define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */
25 #define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
27 /* Set the following to one, then zero, after doing a pseudo DMA transfer. */
28 #define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
30 /* Set the following to zero to eject the floppy. */
31 #define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
32 #define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
34 #define AUXREG ((volatile unsigned char *)(auxio_register))
36 /* These are available on sun4c */
37 #define TURN_ON_LED if (AUXREG) *AUXREG = (*AUXREG | AUXIO_ORMEIN | AUXIO_LED)
38 #define TURN_OFF_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_LED))
39 #define FLIP_LED if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) ^ AUXIO_LED)
40 #define FLPY_MOTORON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_DSEL)
41 #define FLPY_MOTOROFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_DSEL))
42 #define FLPY_TCNTON if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) | AUXIO_FLPY_TCNT)
43 #define FLPY_TCNTOFF if (AUXREG) *AUXREG = ((*AUXREG | AUXIO_ORMEIN) & (~AUXIO_FLPY_TCNT))
45 #ifndef __ASSEMBLY__
46 #define set_auxio(bits_on, bits_off) \
47 do { \
48 unsigned char regval; \
49 unsigned long flags; \
50 save_flags(flags); cli(); \
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 if(!AUXREG) \
58 break; /* VME chassic sun4m, no auxio. */ \
59 regval = *AUXREG; \
60 *AUXREG = ((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M; \
61 break; \
62 case sun4d: \
63 break; \
64 default: \
65 panic("Can't set AUXIO register on this machine."); \
66 }; \
67 restore_flags(flags); \
68 } while(0)
69 #endif /* !(__ASSEMBLY__) */
72 /* AUXIO2 (Power Off Control) */
73 extern __volatile__ unsigned char * auxio_power_register;
75 #define AUXIO_POWER_DETECT_FAILURE 32
76 #define AUXIO_POWER_CLEAR_FAILURE 2
77 #define AUXIO_POWER_OFF 1
80 #endif /* !(_SPARC_AUXIO_H) */