#ifndef _B004_H #define _B004_H /* * b004.h * * Based on the Linux driver, by * Christoph Niemann (niemann@swt.ruhr-uni-bochum.de) * * Ported to FreeBSD by Luigi Rizzo (luigi@iet.unipi.it) * and Lorenzo Vicisano (l.vicisano@iet.unipi.it) * * Works for FreeBSD 1.1.5 */ #include /* * device status FLAGS */ #define B004_EXIST 0x0001 /* Is a B004-Board with at least one Transputer present ? */ #define B004_BUSY 0x0002 /* Is the B004-board in use ? */ /* * IOCTL numbers */ #define B004RESET _IO ('Q', 0) /* Reset transputer(s) */ #define B004WRITEABLE _IOR ('Q', 1, int) /* Return C012 Output Ready */ #define B004READABLE _IOR ('Q', 2, int) /* Return C012 Data Present */ #define B004ANALYSE _IO ('Q', 3) /* Switch transputer(s) to ANALYSE mode */ #define B004ERROR _IOR ('Q', 4, int) /* Return 1 on ERROR set */ #define B004TIMEOUT _IOW ('Q', 5, int) /* Set TIMEOUT for subsequent writing or reading call, value in ticks, initial 0 = no timeout (read/write blocking) "open" sets timeout to 0 */ #define B004_INIT_TIMEOUT 0 /* No timeout yet */ /* * Registers DISPLACEMENT */ #define B004_IDR_OFFSET 0 /* Input Data Register */ #define B004_ODR_OFFSET 1 /* Output Data Register */ #define B004_ISR_OFFSET 2 /* Input Status Register */ #define B004_OSR_OFFSET 3 /* Output Status Register */ #define B004_RESET_OFFSET 16 /* Reset/Error Register */ #define B004_ERROR_OFFSET B004_RESET_OFFSET #define B004_ANALYSE_OFFSET 17 /* Analyse Register */ #define B008_DMA_OFFSET 18 /* B008: DMA request register */ #define B008_INT_OFFSET 19 /* B008: Interrupt control reg */ struct b004_struct { int flags; /* various flags */ int idr; /* address of the input data register */ int odr; /* address if the output data register */ int isr; /* address of the input status register */ int osr; /* address of the output status register */ unsigned int timeout; /* timeout for writing/reading the link */ int boardtype; /* what kind of board is installed */ }; /* * Id's for the supported boards */ #define B004 1 #define B008 2 /* * Defines for easier access to the b004_table. */ #define B004_F(minor) b004_table[minor].flags #define B004_TIMEOUT(minor) b004_table[minor].timeout #define B004_BASE(minor) B004_IDR(minor) #define B004_IDR(minor) b004_table[minor].idr #define B004_ODR(minor) b004_table[minor].odr #define B004_ISR(minor) b004_table[minor].isr #define B004_OSR(minor) b004_table[minor].osr #define B004_WAIT(minor) b004_table[minor].wait #define B004_BOARDTYPE(minor) b004_table[minor].boardtype /* * Additonal defines for B008-boards */ #define B008_DMA(minor) b004_table[minor].int #define B008_INT(minor) b004_table[minor].dma /* * Number of tries to access isr or osr before reading or writing sleeps */ #define B004_MAXTRY 200 /* * Maximum number of bytes to transfer at once */ #define B004_MAX_BYTES 2048 /* * bit defines for C012 status ports at base + 2/3 * accessed with B004_IS, B004_OS, which gets the byte... */ #define B004_READBYTE 1 #define B004_WRITEBYTE 1 /* * bit defines for C012 reset/error port at base + 16 */ #define B004_ASSERT_RESET 0x01 /* resetting the transputer */ #define B004_DEASSERT_RESET 0x00 #define B004_TEST_ERROR 0x01 /* for testing the transputer's error flag */ /* * bit defines for C012 analyse port at base + 17 */ #define B004_ASSERT_ANALYSE 0x01 /* switch transputer to analyse-mode */ #define B004_DEASSERT_ANALYSE 0x00 #endif