| 1 |
199 |
simons |
/* $Id: auxio.h,v 1.1.1.1 2001-09-10 07:44:42 simons Exp $
|
| 2 |
|
|
* auxio.h: Definitions and code for the Auxiliary I/O register.
|
| 3 |
|
|
*
|
| 4 |
|
|
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
| 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 |
|
|
/* 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.
|
| 18 |
|
|
*/
|
| 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 |
|
|
|
| 26 |
|
|
/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
|
| 27 |
|
|
#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
|
| 28 |
|
|
|
| 29 |
|
|
/* Set the following to zero to eject the floppy. */
|
| 30 |
|
|
#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
|
| 31 |
|
|
#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
|
| 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 /* !(__ASSEMBLY__) */
|
| 67 |
|
|
|
| 68 |
|
|
#endif /* !(_SPARC_AUXIO_H) */
|