Main Page | Data Structures | File List | Data Fields | Globals

axis_pci.h

Go to the documentation of this file.
00001 
00015 /***************************************************************************
00016 *
00017 *     Axis 2 PCI Linux Kernel driver
00018 *     File:    axis_pci.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_PCI_H
00040 #define AXIS_PCI_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 #ifndef AXIS_HARDWARE_H
00062     #include "axis_hardware.h"
00063 #endif //AXIS_HARDWARE_H
00064 
00065 #ifndef AXIS_SPI_IO_H
00066     #include "spi_io.h"
00067 #endif
00068 
00069 #ifndef AXIS_PARALLEL_IO_H
00070     #include "parallel_io.h"
00071 #endif
00072 
00073 #ifndef AXIS_SERIAL_IO_H
00074     #include "serial_io.h"
00075 #endif
00076 
00077 
00078 #ifndef AXIS_DES_IO_H
00079     #include "des_io.h"
00080 #endif
00081 
00082 #ifndef AXIS_W1_H
00083     #include "axis_w1.h"
00084 #endif
00085 //Lift and hack one of the inline functions from include/linux/proc_fs.h
00102 static inline struct proc_dir_entry *create_proc_read_write_entry(const char *name,
00103         mode_t mode, struct proc_dir_entry *base,
00104         read_proc_t *read_proc,write_proc_t *write_proc, void * data)
00105 {
00106         struct proc_dir_entry *res=create_proc_entry(name,mode,base);
00107         if (res) {
00108                 res->read_proc=read_proc;
00109                 res->write_proc=write_proc ;
00110                 res->data=data;
00111         }
00112         return res;
00113 }
00114 
00123 struct axis_region
00124 {
00125     unsigned long start_address ;           
00126     void * remapped_address ;               
00127     unsigned long length ;                  
00128     int is_memory_region ;                  
00129     int present     ;                       
00130 } ;
00131 
00132 //Pre declare axis_pci_device_entry this as we have a circular dependency
00133 struct axis_pci_device_entry ;
00144 struct axis_component_instance
00145 {
00146     struct axis_pci_device_entry * this_device ;    
00147     int subdevice_number ;                          
00148 };
00149 
00159 struct axis_pci_device_entry
00160 {
00161     struct list_head list;                          
00162     atomic_t smart_card_open_count ;                
00163     wait_queue_head_t des_key_queue             ;   
00164     wait_queue_head_t des_channel_queue ;           
00165     wait_queue_head_t spi_op_queue ;                
00166     wait_queue_head_t spi_interrupt_queue ;         
00167     wait_queue_head_t smart_card_tx_interrupt_queue ; 
00168     wait_queue_head_t smart_card_rx_interrupt_queue ; 
00169     unsigned char smart_card_rx_buffer[64];         
00170     unsigned char smart_card_tx_buffer[64];         
00171     volatile unsigned char * smart_card_tx_head ;   
00172     volatile unsigned char * smart_card_tx_tail ;   
00173     volatile unsigned char * smart_card_rx_head ;   
00174     volatile unsigned char * smart_card_rx_tail ;   
00175     volatile unsigned long rx_start_wait_time   ;   
00176     unsigned long smart_card_rx_timeout;            
00177     long smart_card_minimum_inter_char_time; 
00178     atomic_t smart_card_tx_finished ;               
00179     atomic_t smart_card_tx_active ;                 
00180     atomic_t spi_finished ;                         
00181     atomic_t spi_active   ;
00182     struct semaphore output_lock ;                  
00183     struct semaphore input_lock ;                   
00184     struct semaphore serial_lock ;                  
00185     struct semaphore des_security_lock ;            
00186     struct semaphore des_key_lock ;                 
00187     struct semaphore des_channel_lock ;             
00188     struct semaphore spi_lock ;                     
00189     pid_t   thread_pid;                             
00190     unsigned long thread_delay ;                    
00191     struct completion thread_exited ;               
00192     struct pci_dev * dev ;                          
00193     unsigned long route_register;                   
00194     int device_number    ;                          
00195     unsigned int last_uart ;                        
00196     unsigned long parallel_control_mirror ;         
00197     void * interrupt_dev_id ;                       
00198     int uart_idents[AXIS_MAX_UARTS];                
00199     struct spi_channel spi_channels[MAX_AXIS_SPI_DEVICES];  
00200     struct axis_des_hardware_key des_hardware_keys[NUMBER_OF_KEY_STORES];
00201     struct axis_des_hardware_channel des_channels[NUMBER_OF_DES_CHANNELS];
00202     struct axis_region regions[MAX_AXIS_REGIONS] ;  
00203     struct axis_component_instance  sub_devices[AXIS_MAX_SUB_DEVICES] ; 
00204     struct axis_io_bitmap * io_bitmap ;             
00205     struct proc_dir_entry * proc_root_directory ;   
00206     struct proc_dir_entry * proc_inputs_directory ;     
00207     struct proc_dir_entry * proc_outputs_directory ;    
00208     struct proc_dir_entry * proc_serial_directory ;     
00209     struct proc_dir_entry * proc_dipswitch_directory;   
00210     struct proc_dir_entry * proc_sram_directory;        
00211     struct axis_des_hardware_channel des_key_channel ;  
00212     struct list_head ram_partition_list ;           
00213     struct axis_w1 silicon_serial_number ;
00214     struct axis_w1 ibutton ;
00215 
00216 } ;
00217 
00228 static inline void enable_pci_interrupts(struct axis_pci_device_entry * device)
00229 {
00230     writel(INTERRUPT_SETUP,device->regions[0].remapped_address+INTERRUPT_CONTROL_REGISTER);
00231 }
00232 
00243 static inline void disable_pci_interrupts(struct axis_pci_device_entry * device)
00244 {
00245     writel(0,device->regions[0].remapped_address+INTERRUPT_CONTROL_REGISTER);
00246 }
00247 
00248 struct axis_pci_device_entry * choose_device(struct inode * inode_ptr ,struct file * file_ptr);
00249 struct axis_pci_device_entry * find_axis_device(void);
00250 
00252 void delete_axis_pci_device(struct axis_pci_device_entry * device);
00253 
00255 int pci_probe(struct pci_dev *dev,const struct pci_device_id *id);
00256 
00257 void create_proc_id_entries(struct axis_pci_device_entry* device);
00258 void delete_proc_id_entries(struct axis_pci_device_entry* device);
00259 
00260 
00261 #endif //AXIS_PCI_H
00262 
00263 

Generated on Fri Jan 28 12:33:46 2005 for Axis Kernel Driver by doxygen 1.3.6