/home/hillier_g/checkout/most4linux/most-kernel/most-base.c File Reference

Implementation of the MOST Base Driver. More...

Go to the source code of this file.

Defines

#define DRIVER_NAME   "most-base"
#define PR   DRIVER_NAME ": "

Functions

 RWSEMA_LOCKED_LIST (most_base_low_drivers)
 RWSEMA_LOCKED_LIST (most_base_high_drivers_sema)
 SPIN_LOCKED_LIST (most_base_high_drivers_spin)
int most_register_high_driver (struct most_high_driver *driver)
void most_deregister_high_driver (struct most_high_driver *driver)
void most_register_low_driver (struct most_low_driver *driver)
void most_deregister_low_driver (struct most_low_driver *driver)
most_devmost_dev_new (void)
void most_dev_free (struct most_dev *dev)
static void * most_base_seq_start (struct seq_file *s, loff_t *pos)
static void * most_base_seq_next (struct seq_file *s, void *v, loff_t *pos)
static void most_base_seq_stop (struct seq_file *sfile, void *v)
static int most_base_seq_show (struct seq_file *s, void *v)
static int most_base_proc_open (struct inode *inode, struct file *file)
static int __init most_base_init (void)
static void __exit most_base_exit (void)

Variables

static char * version = "$Rev: 639 $"
static dev_t major_id = 0
static atomic_t device_count = ATOMIC_INIT(0)
static struct seq_operations most_base_seq_ops
static struct file_operations most_base_proc_ops


Detailed Description

Implementation of the MOST Base Driver.

Definition in file most-base.c.


Define Documentation

#define DRIVER_NAME   "most-base"

The name of the driver.

Definition at line 52 of file most-base.c.

#define PR   DRIVER_NAME ": "

The prefix for printk outputs.

Definition at line 57 of file most-base.c.


Function Documentation

RWSEMA_LOCKED_LIST ( most_base_low_drivers   ) 

Linked list of all MOST PCI Low Drivers.

RWSEMA_LOCKED_LIST ( most_base_high_drivers_sema   ) 

Linked list of all MOST High Drivers, protected by a semaphore.

SPIN_LOCKED_LIST ( most_base_high_drivers_spin   ) 

Linked list of all MOST High drivers, protected by a spinlock.

int most_register_high_driver ( struct most_high_driver driver  ) 

Registers a higher level driver.

Parameters:
driver the driver to register
Returns:
0 on success, an error code on failure

Definition at line 93 of file most-base.c.

References most_low_driver::high_driver_registered, rwsema_locked_list::list, spin_locked_list::list, most_low_driver::list, rwsema_locked_list::lock, spin_locked_list::lock, low_driver, most_base_high_drivers_sema, most_base_high_drivers_spin, most_base_low_drivers, rtnrt_lock_get_irqsave, rtnrt_lock_put_irqrestore, most_high_driver::sema_list, and most_high_driver::spin_list.

Referenced by most_alsa_init(), most_nets_init(), most_sync_init(), and most_sync_rt_init().

void most_deregister_high_driver ( struct most_high_driver driver  ) 

Deregisters a higher level driver. This means that interrupts and remove function calls will not be processed to the driver any more from now. This means that the remove function is called.

Parameters:
driver the driver to remove from the list

Definition at line 127 of file most-base.c.

References most_low_driver::high_driver_deregistered, rwsema_locked_list::list, most_low_driver::list, rwsema_locked_list::lock, spin_locked_list::lock, low_driver, most_base_high_drivers_sema, most_base_high_drivers_spin, most_base_low_drivers, rtnrt_lock_get_irqsave, rtnrt_lock_put_irqrestore, most_high_driver::sema_list, and most_high_driver::spin_list.

Referenced by most_alsa_exit(), most_nets_exit(), most_sync_exit(), and most_sync_rt_exit().

void most_register_low_driver ( struct most_low_driver low_driver  ) 

Registers a low driver.

Parameters:
low_driver the driver to register. The list element must be (normally statically) initialized

Definition at line 155 of file most-base.c.

References most_low_driver::list, rwsema_locked_list::list, rwsema_locked_list::lock, and most_base_low_drivers.

Referenced by most_pci_init().

void most_deregister_low_driver ( struct most_low_driver low_driver  ) 

Deregisters a low driver.

Parameters:
low_driver the driver to deregister

Definition at line 166 of file most-base.c.

References most_low_driver::list, rwsema_locked_list::lock, and most_base_low_drivers.

Referenced by most_pci_exit().

struct most_dev* most_dev_new ( void   ) 

Creates a new most_dev structure (dynamically by allocating memory and filling following elements

Returns:
the allocated and initialized sturct most_dev on success, NULL on failure

Definition at line 178 of file most-base.c.

References most_dev::card_number, device_count, most_dev::list, most_dev::lock, most_dev::major_device_no, major_id, MOST_DEV_CARDNUMBER, and most_dev::name.

Referenced by probe().

void most_dev_free ( struct most_dev dev  ) 

Frees a most_dev structure. This frees the memory of the given pointer plus the dev->impl. It decrements also the device count which is the reason why this must be implemented as function (we avoid exporting the device_count variable here, and because we only need this in initializiation/deinitialization code, speed is no issue here).

Parameters:
dev the device

Definition at line 203 of file most-base.c.

References device_count, and most_dev::impl.

Referenced by probe(), and remove().

static void* most_base_seq_start ( struct seq_file *  s,
loff_t *  pos 
) [static]

Sequence file operation for proc device. This function is executed on start of the sequence file operation. Only one sequence is used, so the function return NULL if *pos is not 0.

Parameters:
s the seq_file
pos the position

Definition at line 220 of file most-base.c.

References version.

static void* most_base_seq_next ( struct seq_file *  s,
void *  v,
loff_t *  pos 
) [static]

Sequence file operation for the proc device. This function is executed to get the next sequence. Because only one sequence is used, NULL is returned always.

Parameters:
s the seq_file
v the data pointer
pos the position

Definition at line 236 of file most-base.c.

static void most_base_seq_stop ( struct seq_file *  sfile,
void *  v 
) [static]

Sequence file operation for the proc device. This function is executed on stop. There's nothing to do.

Parameters:
sfile the seq_file
v the data pointer

Definition at line 249 of file most-base.c.

static int most_base_seq_show ( struct seq_file *  s,
void *  v 
) [static]

Shows the information for the proc device. Calls all registered function.

Parameters:
s the seq_file
v the data pointer

Definition at line 258 of file most-base.c.

References most_low_driver::list, rwsema_locked_list::list, rwsema_locked_list::lock, low_driver, most_base_low_drivers, and most_low_driver::proc_show.

static int most_base_proc_open ( struct inode *  inode,
struct file *  file 
) [static]

The open function for the most_base_proc_ops.

Parameters:
inode the inode
file the file

Definition at line 295 of file most-base.c.

References most_base_seq_ops.

static int __init most_base_init ( void   )  [static]

This function gets called if the kernel loads this module.

Returns:
0 on success, an error code on failure

Definition at line 316 of file most-base.c.

References DRIVER_NAME, major_id, most_base_proc_ops, MOST_MINOR_IDS, rtnrt_err, and rtnrt_info.

static void __exit most_base_exit ( void   )  [static]

This function gets called if the Kernel removes this module.

Definition at line 342 of file most-base.c.

References DRIVER_NAME, major_id, MOST_MINOR_IDS, rtnrt_info, and version.


Variable Documentation

char* version = "$Rev: 639 $" [static]

Variable that holds the driver version.

Definition at line 62 of file most-base.c.

dev_t major_id = 0 [static]

The major id for all MOST devices.

Definition at line 82 of file most-base.c.

Referenced by most_base_exit(), most_base_init(), and most_dev_new().

atomic_t device_count = ATOMIC_INIT(0) [static]

The device count (includes ALL devices)

Definition at line 87 of file most-base.c.

Referenced by most_dev_free(), and most_dev_new().

struct seq_operations most_base_seq_ops [static]

Initial value:

The sequence operations for the proc file.

Definition at line 282 of file most-base.c.

Referenced by most_base_proc_open().

struct file_operations most_base_proc_ops [static]

Initial value:

 {
    .owner          = THIS_MODULE,
    .open           = most_base_proc_open,
    .read           = seq_read,
    .llseek         = seq_lseek,
    .release        = seq_release
}
The device operations for the MOST Base driver proc file.

Definition at line 303 of file most-base.c.

Referenced by most_base_init().


Generated on Fri Mar 9 14:48:58 2007 for MOST Linux Drivers (Linux and RTAI) by  doxygen 1.5.0