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

axis_pci.c File Reference


Detailed Description

Handles Events From PCI Subsystem + interrupts.

Author:
Andrew Roca
This contains code to handle a successful connection by the PCI subsystem so in practice most of the systems initalisation is triggered by a successful PCI probe. The initalisation also maps the PCI memory ranges into the kernel address space (not SRAM that handled in the SRAM module).

Once finished the PCI system installs interrupt handlers (in here) and initalises the interrupt hardware.

The code to pull all this down on module unload is in here too. On unload the pci subsystem is requested to close down this device. The subsystem then calls back into the delete code in here. Its this code that cleans up

#include "axis_pci.h"
#include "axis_driver.h"
#include "axis_sram.h"
#include "axis_smart_card.h"

Include dependency graph for axis_pci.c:

Include dependency graph

Functions

void enable_axis_interrupts (struct axis_pci_device_entry *device)
 The system has two interrupt enables this one sets an interrupt mask in the axis device.

void dispatch_DES_interrupt (struct axis_pci_device_entry *device, int number)
 Processes interrupts triggered by 3DES operations completing.

void dispatch_SPI_interrupt (struct axis_pci_device_entry *device)
 SPI interrupt handler.

void dispatch_inputs_interrupt (struct axis_pci_device_entry *device)
 Handle change in debounced input.

void dispatch_outputs_interrupt (struct axis_pci_device_entry *device)
 Not implemented yet.

void dispatch_smart_card_tx_interrupt (struct axis_pci_device_entry *device)
 Handle smart card tx complete interrupt.

void dispatch_smart_card_rx_interrupt (struct axis_pci_device_entry *device)
 Handle smart card rx interrupt.

void dispatch_security_interrupt (struct axis_pci_device_entry *device, unsigned long interrupt_source)
 not currently use

irqreturn_t interrupt_handler (int irq, void *dev_id, struct pt_regs *regs)
 Interrupt entry code called by kernel in resonse to a interrupt from the axis device.

void init_sub_devices (struct axis_pci_device_entry *device)
 Setup table of sub-devices.

void init_pci_device_entry (struct axis_pci_device_entry *new_device, struct pci_dev *dev, int device_number)
 initalise structures associated with an axis hardware master structure

 LIST_HEAD (axis_device_list)
 Maintains a list of currently active devices in case Axis moves onto PCI card.

void clean_regions (struct axis_pci_device_entry *device)
 umap any allocated regions

int get_next_device_number (void)
 Find a unique integer ID to associate with device.

int pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
 Called by PCI on load/detection.

axis_pci_device_entrychoose_device (struct inode *inode_ptr,struct file *file_ptr)
 Find a axis device for DES ops.

axis_pci_device_entryfind_axis_device (void)
 Find a axis device for DES ops.

void delete_axis_pci_device (struct axis_pci_device_entry *device)
 unload axis PCI based resources

int proc_fpga_issue (char *buf, char **start, off_t offset, int count, int *eof, void *data)
int proc_fpga_id (char *buf, char **start, off_t offset, int count, int *eof, void *data)
void create_proc_id_entries (struct axis_pci_device_entry *device)
 Creates a couple of /proc entries to export FPGA ID and issue data.

void delete_proc_id_entries (struct axis_pci_device_entry *device)
 Deletes the issue and ID /proc entries.


Function Documentation

struct axis_pci_device_entry * choose_device struct inode *  inode_ptr,
struct file *  file_ptr
 

Find a axis device for DES ops.

Parameters:
inode_ptr - not currently used
file_ptr - not currently used
Returns:
master structure pointer

Des operations need not be associated with a particular hardware set in future we may if we have multiple device want to load balance DES ops entry allows logic to be added later

void clean_regions struct axis_pci_device_entry device  )  [static]
 

umap any allocated regions

Parameters:
device - master hardware structure
Returns:
none

Called as part of a module unload call Ummap any memory/IO regions driver still has mapped ignoring reference counts

void create_proc_id_entries struct axis_pci_device_entry device  ) 
 

Creates a couple of /proc entries to export FPGA ID and issue data.

Returns:
none
Parameters:
device - Pointer to the hardware master control block
This function creates a /proc entry that exports the formatted contents of the FPGA ID and issue register

Here is the call graph for this function:

void delete_axis_pci_device struct axis_pci_device_entry device  ) 
 

unload axis PCI based resources

Parameters:
device - master structure
Returns:
none

Clean up occurs when we de-register from the PCI subsystem rather than being directly called by the module unload function

Here is the call graph for this function:

void delete_proc_id_entries struct axis_pci_device_entry device  ) 
 

Deletes the issue and ID /proc entries.

Returns:
none
Parameters:
device - Pointer to the hardware master control block
Deletes the ISSUE related entries in the axis /Proc filesystem

void dispatch_DES_interrupt struct axis_pci_device_entry device,
int  number
[inline, static]
 

Processes interrupts triggered by 3DES operations completing.

signal completion

wake any processes waiting for this

Last Channel is a little different and handles only keys

signal completion

wake any processes waiting for this

void dispatch_inputs_interrupt struct axis_pci_device_entry device  )  [inline, static]
 

Handle change in debounced input.

Parameters:
device - pointer to Axis master hardware structure
Returns:
none

If the debounced inputs have changed then Axis generates an interrupt which should end up in this function. Function then updates inputs bitmap.

void dispatch_outputs_interrupt struct axis_pci_device_entry device  )  [inline, static]
 

Not implemented yet.

Parameters:
device - pointer to Axis master hardware structure
Returns:
none

Possible support of queued outputs not fully implemented yet

void dispatch_security_interrupt struct axis_pci_device_entry device,
unsigned long  interrupt_source
[inline, static]
 

not currently use

Parameters:
device - device master structure
interrupt_source - interrupt sources

void dispatch_smart_card_rx_interrupt struct axis_pci_device_entry device  )  [inline, static]
 

Handle smart card rx interrupt.

Parameters:
device - hardware master structure
Returns:
none

The smart card core has a simple internal uart that can generate interrupts handle rx here

Here is the call graph for this function:

void dispatch_smart_card_tx_interrupt struct axis_pci_device_entry device  )  [inline, static]
 

Handle smart card tx complete interrupt.

Parameters:
device - pointer to Axis master hardware structure
Returns:
none

The smart card core has a simple internal uart that can generate interrupts handle tx here

void dispatch_SPI_interrupt struct axis_pci_device_entry device  )  [inline, static]
 

SPI interrupt handler.

signal completion

wake any processes waiting for this

void enable_axis_interrupts struct axis_pci_device_entry device  )  [inline, static]
 

The system has two interrupt enables this one sets an interrupt mask in the axis device.

Parameters:
device - hardware structure
Returns:
none

Writes to interrupt enable register in the Axis device each interrupt source has one bit the interrupt source register and one bit in the interrupt enable register

struct axis_pci_device_entry * find_axis_device void   ) 
 

Find a axis device for DES ops.

Returns:
master structure pointer

Des operations need not be associated with a particular hardware set in future we may if we have multiple device want to load balance DES ops entry allows logic to be added later

int get_next_device_number void   )  [static]
 

Find a unique integer ID to associate with device.

Returns:
next unsigned number

Searchs the device list for a free number to allocate in case of having to handle multiple sets of hardware

void init_pci_device_entry struct axis_pci_device_entry new_device,
struct pci_dev *  dev,
int  device_number
[static]
 

initalise structures associated with an axis hardware master structure

Parameters:
new_device 
dev 
device_number 
Returns:
none

Initialise the device(s) here. Remap IO addresses get sizes.

Here is the call graph for this function:

void init_sub_devices struct axis_pci_device_entry device  ) 
 

Setup table of sub-devices.

Parameters:
device - axis hardware master structure
Returns:
none

Sub device table contains an array of structures that assoicated a pointer to the hardware master structure with an integer. The driver passes pointers to entries in this table a user data members in callback setups for various devices and /proc entries. For instance the /proc call back to read a single input can use this entry to find both the master table and which input (the integer) it should return. As these entries should not be written at any point other than here the old table can be shared between dipswitches inputs outputs and any others that need this facility.

irqreturn_t interrupt_handler int  irq,
void *  dev_id,
struct pt_regs *  regs
[static]
 

Interrupt entry code called by kernel in resonse to a interrupt from the axis device.

then we should allow the serial driver to handle it

if axis UART generated an interrupt

Here is the call graph for this function:

LIST_HEAD axis_device_list   ) 
 

Maintains a list of currently active devices in case Axis moves onto PCI card.

pci_probe struct pci_dev *  dev,
const struct pci_device_id *  id
 

Called by PCI on load/detection.

Parameters:
dev - pointer to structure containing PCI configuration for device
id - pointer to structure containing vendor and device ids
Returns:
0 on success

Called if the PCI sub system thinks our hardware is present Check that it is the right hardware if it is remember the PCI devices details

Here is the call graph for this function:

int proc_fpga_id char *  buf,
char **  start,
off_t  offset,
int  count,
int *  eof,
void *  data
[static]
 

int proc_fpga_issue char *  buf,
char **  start,
off_t  offset,
int  count,
int *  eof,
void *  data
[static]
 


Generated on Fri Jan 28 12:34:22 2005 for Axis Kernel Driver by doxygen 1.3.6