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

serial_io.c File Reference


Detailed Description

Code to support the axis one write devices (serial number chips).

Author:
Andrew Roca

#include "serial_io.h"
#include "axis_pci.h"

Include dependency graph for serial_io.c:

Include dependency graph

Functions

int get_int_from_text (const char *buffer, const struct text_to_int *table, unsigned long *oldvalue)
 Searchs a table associating integers and strings for a match.

const char * get_text_from_int (const struct text_to_int *table, unsigned long value)
 Do reverse lookup.

const char * get_route_name (unsigned long i)
 looks up the name of a route

int get_route_command (const char *name, unsigned long *target)
 looks up command to write to routing register given a route name

int get_enable_command (const char *name, unsigned long *target)
 search string for enable command

const char * get_enable_string (unsigned long i)
 returns text string to represent current enable state

void output_serial_routing (struct axis_pci_device_entry *device)
 writes routing mirrot to hardware

void input_serial_routing (struct axis_pci_device_entry *device)
 copy hardware serial route register to mirror

void set_default_routing (struct axis_pci_device_entry *device)
 sets up a sensible default for routing

void enable_uarts (struct axis_pci_device_entry *device)
 register Axis 16550's with kernel serial module

void disable_uarts (struct axis_pci_device_entry *device)
 Cleanup code for 16550's.

int proc_routing_dump (char *buf, char **start, off_t offset, int count, int *eof, void *data)
 Dump the routing table to /proc.

int proc_write_route_table_entry (struct file *file, const char *buffer, unsigned long count, void *data)
 write a new value into the rs232 routing table

int proc_write_serial_enable_entry (struct file *file, const char *buffer, unsigned long count, void *data)
 allow enable/disable of serial routing destinations

int proc_read_serial_enable_entry (char *buf, char **start, off_t offset, int count, int *eof, void *data)
 Allow a user mode program to query the enable state of specified route destinations.

int proc_read_route_table_entry (char *buf, char **start, off_t offset, int count, int *eof, void *data)
 Allow a user mode program to query the current route for a specific UART.

void create_proc_serial_entries (struct axis_pci_device_entry *device)
 Create /proc entries assoicated with serial routing.

void delete_proc_serial_entries (struct axis_pci_device_entry *device)
 Remove serial routing /proc entries.


Variables

const char * uart_route_format = "tty%d_Route"
text_to_int enable_texts []
const struct text_to_int serial_output_enable_table []
const struct text_to_int serial_route_lookup_tables []
const int uart_address_offsets [] = {0,8,16,24,32,40,48,56}

Function Documentation

void create_proc_serial_entries struct axis_pci_device_entry device  ) 
 

Create /proc entries assoicated with serial routing.

Parameters:
device - hardware master structure
Returns:
NONE

Called by the PCI probe function creates a directory full of entries to allow queries and reconfiguration of the serial port routing

Here is the call graph for this function:

void delete_proc_serial_entries struct axis_pci_device_entry device  ) 
 

Remove serial routing /proc entries.

Parameters:
device - hardware master structure
Returns:
NONE

Remove all the entries in the /proc file system related to serial routing

void disable_uarts struct axis_pci_device_entry device  ) 
 

Cleanup code for 16550's.

Parameters:
device - hardware master structure
Returns:
NONE

Tell the serial subsystem that we are about to unload so ask it to return control of the 16550's

Here is the call graph for this function:

void enable_uarts struct axis_pci_device_entry device  ) 
 

register Axis 16550's with kernel serial module

Parameters:
device - hardware master structure
Returns:
NONE

Enable uart interrupts setup the PCI region (1) map a chip select and then register the uarts with the kernel serial driver

Here is the call graph for this function:

int get_enable_command const char *  name,
unsigned long *  target
[inline, static]
 

search string for enable command

Parameters:
name - string to search
target - where to write new enable value
Returns:
zero on success

Find if enable state should change

Here is the call graph for this function:

const char * get_enable_string unsigned long  i  )  [inline, static]
 

returns text string to represent current enable state

Parameters:
i 
Returns:
NONE

Gets a text string to describe the current state of an serial route

Here is the call graph for this function:

int get_int_from_text const char *  buffer,
const struct text_to_int table,
unsigned long *  oldvalue
[static]
 

Searchs a table associating integers and strings for a match.

Parameters:
buffer- text to search for
table - table to search
oldvalue - ptr to where to write result
Returns:
0 on success

Searchs a table associating integers and strings for a match, if the passed in string matches the table entry the function sets the pointer to the integer value

int get_route_command const char *  name,
unsigned long *  target
[inline, static]
 

looks up command to write to routing register given a route name

Parameters:
name name of command to lookup
target address of variable to update with result
Returns:
zero on success

Given a name lookup the bit pattern we need to write to the Axis to set up the route

Here is the call graph for this function:

const char * get_route_name unsigned long  i  )  [inline, static]
 

looks up the name of a route

Parameters:
i - integer identifing a Axis UART routing option
Returns:
pointer to route name

Given an Axis route command convert it to a text string

Here is the call graph for this function:

const char * get_text_from_int const struct text_to_int table,
unsigned long  value
[static]
 

Do reverse lookup.

Parameters:
table - table to search
value- value to search for
Returns:
pointer to text

Given a integer value looks for a table entry containing value and returns a pointer to the string associated with that entry

void input_serial_routing struct axis_pci_device_entry device  )  [inline, static]
 

copy hardware serial route register to mirror

Parameters:
device - hardware master structure
Returns:
NONE

Get the current serial routing from the Axis hardware

void output_serial_routing struct axis_pci_device_entry device  )  [inline, static]
 

writes routing mirrot to hardware

Parameters:
device - hardware master structure
Returns:
NONE

write the serial routing out to the Axis

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

Allow a user mode program to query the current route for a specific UART.

Parameters:
buf - write data here
start- not used
offset - not used
count - number to write
eof - signal completetion
data - pointer supplied at time of /proc entry creation
Returns:
number of bytes written

A callback function for a /proc entry. Outputs a text version of a UARTS current output route

Here is the call graph for this function:

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

Allow a user mode program to query the enable state of specified route destinations.

Parameters:
buf - write data here
start - not used
offset - not used
count - number to write
eof - signal completetion
data - pointer supplied at time of /proc entry creation
Returns:
number of bytes written

A callback function for a /proc entry. Outputs the enable state of specified route destinations

Here is the call graph for this function:

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

Dump the routing table to /proc.

Parameters:
buf - write data here
start - not used
offset - not used
count - number to write
eof - signal completetion
data - pointer supplied at time of /proc entry creation
Returns:
number of bytes written

A callback function for a /proc entry. Dumps a human friendly version of the current serial routing configuration

Here is the call graph for this function:

int proc_write_route_table_entry struct file *  file,
const char *  buffer,
unsigned long  count,
void *  data
[static]
 

write a new value into the rs232 routing table

Parameters:
file - not used
buffer - data to write here
count - number to write
data - pointer supplied at time of /proc entry creation
Returns:
number of bytes written

A callback function to handle writes from a /proc entry. Allows the serial routing to be configured via the /proc filesystem.

Here is the call graph for this function:

int proc_write_serial_enable_entry struct file *  file,
const char *  buffer,
unsigned long  count,
void *  data
[static]
 

allow enable/disable of serial routing destinations

Parameters:
file - not used
buffer - data to write here
count - number to write
data - pointer supplied at time of /proc entry creation
Returns:
number of bytes written

A callback function to handle writes from a /proc entry. Allows the serial routing destinations to be enabled/disabled via the /proc filesystem.

Here is the call graph for this function:

void set_default_routing struct axis_pci_device_entry device  )  [inline, static]
 

sets up a sensible default for routing

Parameters:
device - hardware master structure
Returns:
NONE

Setup a sensible set of defaults for the AXIS UART routing

Here is the call graph for this function:


Variable Documentation

struct text_to_int enable_texts[] [static]
 

Initial value:

{
    {"active",  1 },
    {"enable",  1 },
    {"disable", 0   },
    {"1",1},
    {"0",0},
    {"true",1},
    {"false",0},
    {NULL,0},
}

const struct text_to_int serial_output_enable_table[] [static]
 

Initial value:

{
    {   "RS232_A"   , 16   },       
    {   "TTL_A"     , 18  },            
    {   "CCTALK_A"  , 20   },       
    {   "RS485_A"   , 22  },
    {   "RS232_B"   , 17  },
    {   "TTL_B"     , 19  },
    {   "CCTALK_B"  , 21   },
    {   "RS485_B"   , 23  },
    {NULL,0},
}

const struct text_to_int serial_route_lookup_tables[] [static]
 

Initial value:

{
    { "RS232", 0 },
    { "TTL", 1 },
    { "CCTALK", 2 },
    { "RS485", 3 },
    {NULL,0}
}

const int uart_address_offsets[] = {0,8,16,24,32,40,48,56} [static]
 

const char* uart_route_format = "tty%d_Route" [static]
 


Generated on Fri Jan 28 12:37:09 2005 for Axis Kernel Driver by doxygen 1.3.6