00001 00015 /**************************************************************************** 00016 * 00017 * Axis 2 PCI Linux Kernel driver 00018 * File: parallel_io.h 00019 * Version: 1.0 00020 * Copyright 2004 Heber Limited (http://www.heber.co.uk) 00021 * 00022 * This program is free software; you can redistribute it and/or modify it 00023 * under the terms of the GNU General Public License as published by the 00024 * Free Software Foundation; either version 2, or (at your option) any 00025 * later version. 00026 * 00027 * This program is distributed in the hope that it will be useful, but 00028 * WITHOUT ANY WARRANTY; without even the implied warranty of 00029 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00030 * General Public License for more details. 00031 * 00032 * You should have received a copy of the GNU General Public License along 00033 * with this program; if not, write to the Free Software Foundation, Inc., 00034 * 675 Mass Ave, Cambridge, MA 02139, USA. 00035 * 00036 * Changes: 00037 * 00038 ****************************************************************************/ 00039 #ifndef AXIS_PARALLEL_IO_H 00040 #define AXIS_PARALLEL_IO_H 00041 #ifndef _LINUX_KERNEL_H 00042 00043 #include <linux/kernel.h> 00044 #include <linux/sched.h> 00045 #include <linux/version.h> 00046 #include <linux/module.h> 00047 #include <linux/proc_fs.h> 00048 #include <linux/delay.h> 00049 #include <linux/pci.h> 00050 #include <linux/list.h> 00051 #include <linux/ioport.h> 00052 #include <linux/serial.h> 00053 #include <linux/interrupt.h> 00054 #include <linux/string.h> 00055 #include <linux/spinlock.h> 00056 #include <linux/mtd/mtd.h> 00057 #include <linux/crypto.h> 00058 #include <asm/uaccess.h> 00059 00060 #endif //_LINUX_KERNEL_H 00061 00062 #ifndef AXIS_HARDWARE_H 00063 #include "axis_hardware.h" 00064 #endif //AXIS_HARDWARE_H 00065 00066 00067 #define AXIS_DIPSWITCH_NUMBER 16 00068 #define AXIS_DIPSWITCH_MAP_SIZE (AXIS_DIPSWITCH_NUMBER>>3) 00069 #define AXIS_OUTPUTS_NUMBER 32 00070 #define AXIS_OUTPUTS_MAP_SIZE (AXIS_OUTPUTS_NUMBER>>3) 00071 00072 00073 #define PARALLEL_IO_CONFIGURATION (0x30+CONTROL_OFFSET) 00074 #define PARALLEL_OUTPUTS_PORT (0x34+CONTROL_OFFSET) 00075 #define RAW_PARALLEL_INPUTS_PORT (0x20+CONTROL_OFFSET) 00076 #define DEBOUNCED_PARALLEL_INPUTS_PORT (0x28+CONTROL_OFFSET) 00077 #define RAW_MISC_INPUTS_PORT (0x24+CONTROL_OFFSET) 00078 #define DEBOUNCED_MISC_INPUTS_PORT (0x2C+CONTROL_OFFSET) 00079 #define READ_INPUTS_MASK_REGISTER (0x38+CONTROL_OFFSET) 00080 #define READ_MISC_MASK_REGISTER (0x3C+CONTROL_OFFSET) 00081 #define DIPSWITCH_OFFSET 0x64 00082 00083 /* ------------- Input control bit definition --------------------*/ 00084 #define AUTO_READ_ENABLE (1<<0) 00085 #define AUTO_WRITE_ENABLE (1<<4) 00086 #define MISC_INPUTS 4 //offset of misc inputs in inputs bitmap 00087 00088 /* 00089 Define a struct to map inputs to name 00090 00091 */ 00092 00093 #define AXIS_INPUTS_NUMBER 40 //(sizeof(input_definitions)/sizeof(struct input_def)) 00094 #define AXIS_INPUTS_MAP_SIZE (AXIS_INPUTS_NUMBER>>3) 00095 #define AXIS_OUTPUTS_NUMBER 32 //(sizeof(output_definitions)/sizeof(struct output_def)) 00096 #define AXIS_OUTPUTS_MAP_SIZE (AXIS_OUTPUTS_NUMBER>>3) 00097 00104 struct input_def 00105 { 00106 const char * name ; 00107 } ; 00108 00115 struct output_def 00116 { 00117 const char * name ; 00118 } ; 00119 00120 00129 struct axis_io_bitmap 00130 { 00131 unsigned char outputs_bitmap[AXIS_OUTPUTS_MAP_SIZE]; 00132 unsigned char dipswitch_bitmap[AXIS_DIPSWITCH_MAP_SIZE]; 00133 unsigned char inputs_bitmap[AXIS_INPUTS_MAP_SIZE]; 00134 unsigned char debounced_inputs_bitmap[AXIS_INPUTS_MAP_SIZE]; 00135 }; 00136 00137 extern struct file_operations output_file_operations ; 00138 extern struct file_operations dipswitch_file_operations ; 00139 extern struct file_operations input_file_operations ; 00140 00141 void create_proc_dipswitch_entries(struct axis_pci_device_entry* device); 00142 void delete_proc_dipswitch_entries(struct axis_pci_device_entry* device); 00143 void create_proc_input_entries(struct axis_pci_device_entry* device); 00144 void delete_proc_input_entries(struct axis_pci_device_entry* device); 00145 void create_proc_output_entries(struct axis_pci_device_entry* device); 00146 void delete_proc_output_entries(struct axis_pci_device_entry* device); 00147 void update_inputs_bitmap(struct axis_pci_device_entry * device); 00148 void enable_axis_inputs(struct axis_pci_device_entry * device); 00149 void init_parallel_io(struct axis_pci_device_entry * device); 00150 00151 #endif //AXIS_PARALLEL_IO_H 00152
1.3.6