00001 /* Gxsm - Gnome X Scanning Microscopy 00002 * universal STM/AFM/SARLS/SPALEED/... controlling and 00003 * data analysis software 00004 * 00005 * Copyright (C) 1999,2000,2001 Percy Zahl 00006 * 00007 * Authors: Percy Zahl <zahl@users.sf.net> 00008 * additional features: Andreas Klust <klust@users.sf.net> 00009 * WWW Home: http://gxsm.sf.net 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00024 */ 00025 00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */ 00027 /* pc31.h 00028 * Kernel Module 00029 * (C) 1998 by Percy Zahl, Inst. f. FKP 00030 */ 00031 00032 #define MODNAME "pc31: " 00033 #define MODID PCDSP_MODID_PC31 00034 00035 /* 00036 * ============================================================ 00037 * PC31's I/O und Memory (DSP-Karte) 00038 * ============================================================ 00039 */ 00040 00041 /* Default Adressen */ 00042 #define BASEPORT 0x280 /* PC31 BASEPORT */ 00043 #define RANGE 0x10 /* PC31 IO-SPACESIZE */ 00044 00045 /* default is 0xdc000 */ 00046 /* #define DPRAMBASE 0xdc000 */ /* DPRAMBASEADRESS */ 00047 #define DPRAMBASE 0xd0000 /* DPRAMBASEADRESS */ 00048 #define DPRAMSIZE (DSP_DPRAMLEN*4) /* 8kByte DPRAM */ 00049 #define DPLen32 (DSP_DPRAMLEN) /* 2k Wort a 32bit */ 00050 00051 /* CRTL Register 00052 1 2 4 8 10 20 40 80 00053 Bit 0 1 2 3 4 5 6 7 00054 */ 00055 #define PC31_CRTL_RESET 0x01 00056 #define PC31_CRTL_EI2 0x10 00057 #define PC31_CRTL_HOLD 0x20 00058 #define PC31_CRTL_BL 0x80 00059 00060 /* IO - Mapping */ 00061 #define DSP_BASE pcdsp_iobase 00062 #define DSP_ADR_H DSP_BASE+0 /* W: Adresslatch MSB von 32 Bits */ 00063 #define DSP_ADR_L DSP_BASE+2 /* W: Adresslatch LSB von 32 Bits */ 00064 #define DSP_DAT_H DSP_BASE+4 /* R/W: Datenlatch MSB von 32 Bits */ 00065 #define DSP_DAT_L DSP_BASE+6 /* R/W: Datenlatch LSB von 32 Bits */ 00066 #define DSP_CRTL DSP_BASE+8 /* W: Latch 8-bit Bus Control */ 00067 /* Bit 0: PC31 Reset, active high */ 00068 /* Bit 4: PC31 EI2 */ 00069 /* Bit 5: Hold Reqest */ 00070 /* Bit 7: Boot loader Control */ 00071 #define DSP_DPCTL DSP_BASE+10 /* DPRAM Control Register 00072 * Bit 0: Read 0: use denied 00073 * Bit 0: Read 1: use granted 00074 * Bit 0: Write 0: give away 00075 * Bit 0: Write 1: use reqired 00076 */ 00077 #define DSP_SRQ DSP_BASE+12 /* W: Service Request to PC31, latch bit 0 */ 00078 /* R: Return Service Request Status: */ 00079 /* Bit 0: PC_AT service request */ 00080 /* Bit 1: PC31 service request */ 00081 #define DSP_ACK DSP_BASE+14 /* R/W: Acknowledge, Clear PC31 Service Request */ 00082 00083 /* Version Stuff ... */ 00084 #define DSPNEW 1 /* PC31 Version 1997/98 mit DPRAM Acesskontrolle */ 00085 #define DSPOLD 0 /* PC31 alt, (in Quantum) ohne DPRAM Acesskontrolle */ 00086 00087 #define PC31J 00088 #define PC31K 00089 00090 /* 00091 * DSP - Host Communication 00092 * - low level handshaking via Semaphores for controlling DPRAM access - 00093 */ 00094 00095 #define PCDSP_SEMANZ 4 00096 00097 /* Request for Semaphore [0..3] */ 00098 #define GET_SEM(N) outw(1, DSP_DPCTL) 00099 /* Release SEM */ 00100 #define FREE_SEM(N) outw(0, DSP_DPCTL) 00101 /* Status SEM ? 0: busy, 1: free */ 00102 #define SEM(N) (inw(DSP_DPCTL)&1) 00103 00104 00105 /* DSP IRQ control */ 00106 #define CLR_IRQ0 00107 #define SET_IRQ0 00108 #define CLR_IRQ1 00109 #define SET_IRQ1 00110 00111 /* Hardware Mbox control, only PC31 */ 00112 #define PC31_SRQ(X) outw_p((X), DSP_SRQ) 00113 #define PC31_SRQED (inw_p(DSP_SRQ) & 2) 00114 #define PC31_ACKED (~inw_p(DSP_SRQ) & 1) 00115 #define PC31_ACK outw_p(0, DSP_ACK) 00116 00117 /* DSP control */ 00118 unsigned short pc31_crtlword=0; 00119 00120 #define PCDSP_PC31CRTL outw_p(pc31_crtlword, DSP_CRTL) 00121 00122 #define PCDSP_HALT_X outw_p(0x13, DSP_CRTL); PC31_SRQ(0); PC31_ACK 00123 /* outw(1, DSP_ADR_H); outw(DSP_CRTL, DSP_ADR_L); outw(1, DSP_ADR_L); */ 00124 #define PCDSP_RUN_X outw_p(0x12, DSP_CRTL) 00125 /* outw(1, DSP_ADR_L); */ 00126 #define ENABLE_PC31_DPRAM outw_p(0x00, DSP_CRTL) 00127 #define PC31_CONTROL(X) outw_p((X), DSP_CRTL) 00128 00129 /* END */