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 /* pci32.h 00028 * Driver 00029 */ 00030 00031 #define MODNAME "pci32: " 00032 #define MODID PCDSP_MODID_PCI32 00033 00034 /* PCI Device Identification Numbers */ 00035 00036 #define PCI_VENDOR_ID_INNOVATIVE 0x10e8 00037 #define PCI_DEVICE_ID_PCI32DSP 0x807c 00038 00039 /* 00040 * PCI32 IO Mappings 00041 */ 00042 00043 #define PCI32_BASE pcdsp_iobase 00044 #define PCI32_CTRL PCI32_BASE+0x00 /* PCI32 Controlregister: Write: 1 Reset, 0 Run; Read: - */ 00045 #define PCI32_IRQ0 PCI32_BASE+0x04 /* PCI32 Control Interrupt Signal (PCINT0) : 1 asserts (JP17 low), 0 deasserts (JP17 high); Read: - */ 00046 #define PCI32_IRQ1 PCI32_BASE+0x08 /* PCI32 Control Interrupt Signal (PCINT1) : 1 asserts (JP17 low), 0 deasserts (JP17 high); Read: - */ 00047 /* realtive: */ 00048 00049 #define PCI32_SEMANZ 4 00050 #define PCDSP_SEMANZ PCI32_SEMANZ 00051 00052 #define PCI32_SEM0 0x0C /* PCI32 Semaphore 0 : Write 1 request, 0 free; Read 1: Busy, 0 free */ 00053 #define PCI32_SEM1 0x10 /* PCI32 Semaphore 1 : Write 1 request, 0 free; Read 1: Busy, 0 free */ 00054 #define PCI32_SEM2 0x14 /* PCI32 Semaphore 2 : Write 1 request, 0 free; Read 1: Busy, 0 free */ 00055 #define PCI32_SEM3 0x18 /* PCI32 Semaphore 3 : Write 1 request, 0 free; Read 1: Busy, 0 free */ 00056 00057 static unsigned long pci32_sems[4] = { PCI32_SEM0, PCI32_SEM1, PCI32_SEM2, PCI32_SEM3 }; 00058 00059 /* 00060 * DSP - Host Communication 00061 * - low level handshaking via Semaphores for controlling DPRAM access - 00062 */ 00063 00064 /* Request for Semaphore [0..3] */ 00065 #define GET_SEM(N) outw(1, pcdsp_iobase+pci32_sems[N]) 00066 /* Release SEM */ 00067 #define FREE_SEM(N) outw(0, pcdsp_iobase+pci32_sems[N]) 00068 /* Status SEM ? 0: busy, 1: free */ 00069 #define SEM(N) (inw(pcdsp_iobase+pci32_sems[N])&1) 00070 00071 00072 /* DSP IRQ control */ 00073 #define CLR_IRQ0 outw(0, PCI32_IRQ0) 00074 #define SET_IRQ0 outw(1, PCI32_IRQ0) 00075 #define CLR_IRQ1 outw(0, PCI32_IRQ1) 00076 #define SET_IRQ1 outw(1, PCI32_IRQ1) 00077 00078 /* DSP control */ 00079 #define PCDSP_HALT_X outw(1, PCI32_CTRL) 00080 #define PCDSP_RUN_X outw(0, PCI32_CTRL)