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

Implementation of the MOST Synchronous driver. More...

Go to the source code of this file.

Defines

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

Functions

static int most_sync_probe (struct most_dev *)
static int most_sync_remove (struct most_dev *)
static void most_sync_int_handler (struct most_dev *, unsigned int)
static int most_sync_do_open (struct inode *, struct file *)
static int most_sync_do_release (struct inode *, struct file *)
static ssize_t most_sync_do_read (struct file *, char __user *, size_t, loff_t *)
static ssize_t most_sync_do_write (struct file *, const char __user *, size_t, loff_t *)
static int most_sync_do_ioctl (struct inode *, struct file *, unsigned int, unsigned long)
static int most_sync_do_setup_tx (struct file *, unsigned long)
static int most_sync_do_setup_rx (struct file *, unsigned long)
static void most_sync_stop_rx (struct most_sync_file *file)
static void most_sync_stop_tx (struct most_sync_file *file)
ssize_t most_sync_read (struct file *filp, void *buff, size_t count, struct rtnrt_memcopy_desc *copy)
ssize_t most_sync_write (struct file *filp, void *buff, size_t count, struct rtnrt_memcopy_desc *copy)
int most_sync_setup_rx (struct file *filp, struct frame_part *frame_part)
int most_sync_setup_tx (struct file *filp, struct frame_part *frame_part)
static int __init most_sync_init (void)
static void __exit most_sync_exit (void)

Variables

static char * version = "$Rev: 639 $"
most_sync_devmost_sync_devices [MOST_DEVICE_NUMBER]
long sw_rx_buffer_size = STD_MOST_FRAMES_PER_SEC
long sw_tx_buffer_size = STD_MOST_FRAMES_PER_SEC
long hw_rx_buffer_size = 44
long hw_tx_buffer_size = 44
static struct file_operations most_sync_file_operations
static struct most_high_driver most_sync_high_driver


Detailed Description

Implementation of the MOST Synchronous driver.

Definition in file most-sync-m.c.


Define Documentation

#define DRIVER_NAME   "most-sync"

The name of the driver.

Definition at line 52 of file most-sync-m.c.

#define PR   DRIVER_NAME ": "

The prefix for printk outputs.

Definition at line 57 of file most-sync-m.c.


Function Documentation

static int most_sync_probe ( struct most_dev most_dev  )  [static]

Gets called by the MOST driver when a new MOST device was discovered.

Parameters:
[in,out] most_dev the most_dev that was discovered
Returns:
0 on success, an error code on failure

Definition at line 182 of file most-sync-m.c.

References most_sync_dev::cdev, most_sync_dev::config_lock_rx, most_sync_dev::config_lock_tx, most_sync_dev::file_list, most_sync_dev::most_dev, MOST_DEV_CARDNUMBER, MOST_DEV_MAJOR, MOST_DEVICE_NUMBER, most_sync_devices, MOST_SYNC_MINOR_OFFSET, MOST_SYNC_OPENS, most_sync_dev::open_count, PR, pr_sync_debug, most_sync_dev::receiver_count, return_value_if_fails_dbg, rtnrt_warn, most_sync_dev::rx_queue, most_sync_dev::transmitter_count, and most_sync_dev::tx_queue.

static int most_sync_remove ( struct most_dev dev  )  [static]

Gets called by the MOST Base driver when a MOST device was removed.

Parameters:
dev the most_dev that was discovered
Returns:
0 on success, an error code on failure

Definition at line 242 of file most-sync-m.c.

References most_sync_dev::cdev, MOST_DEV_CARDNUMBER, most_sync_devices, PR, and pr_sync_debug.

static void most_sync_int_handler ( struct most_dev dev,
unsigned int  intstatus 
) [static]

Interrupt handler of a synchronous driver.

Parameters:
[in] dev the MOST device
[in] intstatus the interrupt status register content

Definition at line 265 of file most-sync-m.c.

References dma_buffer::addr_virt, assert, most_sync_dev::hw_receive_buf, most_sync_dev::hw_transmit_buf, ISSRX, ISSTX, measuring_receive_isr_start(), measuring_receive_isr_wakeup(), most_sync_dev::most_dev, MOST_DEV_CARDNUMBER, MOST_PCI_SRXCTRL_REG, MOST_PCI_STXCTRL_REG, most_readreg, most_sync_devices, PR, pr_irq_debug, rtnrt_warn, most_sync_dev::rx_current_page, most_sync_dev::rx_queue, rxbuf_put(), dma_buffer::size, SRXPP, STXPP, most_sync_dev::sw_receive_buf, most_sync_dev::sw_transmit_buf, most_sync_dev::tx_current_page, most_sync_dev::tx_queue, and txbuf_get().

static int most_sync_do_open ( struct inode *  inode,
struct file *  filp 
) [static]

Open the device. Create a per-file structure. There's no fixed file count per device, so the open() method cannot fail. The setup ioctl() method of the opened device can fail.

Parameters:
inode the inode
filp the file pointer
Returns:
0 on success, an error code on failure

Definition at line 395 of file most-sync-m.c.

References most_sync_dev::file_list, most_sync_file::list, most_dev::lock, most_sync_dev::most_dev, MOST_DEV_CARDNUMBER, most_manage_usage, MOST_SYNC_OPENS, most_sync_dev::open_count, PR, pr_sync_debug, rtnrt_err, and most_sync_file::sync_dev.

static int most_sync_do_release ( struct inode *  inode,
struct file *  filp 
) [static]

Releases the driver. Deletes the file from the global list of open files per device and frees the memory.

Parameters:
inode the inode
filp the file pointer
Returns:
0 on success

Definition at line 456 of file most-sync-m.c.

References most_sync_dev::config_lock_rx, most_sync_dev::config_lock_tx, most_sync_file::list, most_dev::lock, most_sync_dev::most_dev, MOST_DEV_CARDNUMBER, most_manage_usage, most_sync_last_closed_rx, most_sync_last_closed_tx, most_sync_stop_rx(), most_sync_stop_tx(), most_sync_dev::open_count, PR, pr_sync_debug, most_sync_dev::receiver_count, most_sync_file::rx_running, most_sync_file::sync_dev, most_sync_dev::transmitter_count, and most_sync_file::tx_running.

static ssize_t most_sync_do_read ( struct file *  filp,
char __user *  buff,
size_t  count,
loff_t *  offp 
) [static]

Read method for a synchronous MOST device

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
buff the userspace buffer that contains the destination
count the number of bytes allocated for buff
offp used together with llseek system call, unused here

Definition at line 558 of file most-sync-m.c.

References most_sync_read(), and rtnrt_copy_to_user().

static ssize_t most_sync_do_write ( struct file *  filp,
const char __user *  buff,
size_t  count,
loff_t *  offp 
) [static]

Write method for a synchronous MOST device

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
buff the userspace buffer that contains the destination
count the number of bytes allocated for buff
offp used together with llseek system call, unused here

Definition at line 632 of file most-sync-m.c.

References most_sync_write(), and rtnrt_copy_from_user().

static int most_sync_do_ioctl ( struct inode *  inode,
struct file *  filp,
unsigned int  cmd,
unsigned long  arg 
) [static]

Implements the ioctl method of a MOST Synchronous device.

Parameters:
inode the inode (unused here)
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
cmd the ioctl command value
arg the ioctl argument

Definition at line 650 of file most-sync-m.c.

References most_sync_do_setup_rx(), most_sync_do_setup_tx(), MOST_SYNC_IOCTL_MAGIC, MOST_SYNC_SETUP_RX, and MOST_SYNC_SETUP_TX.

static int most_sync_do_setup_tx ( struct file *  filp,
unsigned long  ioctl_arg 
) [inline, static]

See documentation of MOST_SYNC_SETUP_TX.

Parameters:
filp the Linux struct file
ioctl_arg the already checked ioctl argument

Definition at line 774 of file most-sync-m.c.

References most_sync_setup_tx().

Referenced by most_sync_do_ioctl().

static int most_sync_do_setup_rx ( struct file *  filp,
unsigned long  ioctl_arg 
) [inline, static]

See documentation of MOST_SYNC_SETUP_RX.

Parameters:
filp the Linux struct file
ioctl_arg the already checked ioctl argument

Definition at line 727 of file most-sync-m.c.

References most_sync_setup_rx().

Referenced by most_sync_do_ioctl().

static void most_sync_stop_rx ( struct most_sync_file file  )  [inline, static]

Stops reception (of the whole device) See p. 33 of OS8604 specification

Parameters:
[in,out] file the MOST synchronous file structure

Definition at line 356 of file most-sync-m.c.

References most_sync_stop_rx_common, and most_sync_file::sync_dev.

Referenced by most_sync_do_release(), and most_sync_setup_rx().

static void most_sync_stop_tx ( struct most_sync_file file  )  [inline, static]

Stops transmission (of the whole device) See p. 33 of OS8604 specification

Parameters:
[in,out] file the MOST synchronous file structure

Definition at line 367 of file most-sync-m.c.

References most_sync_stop_tx_common, and most_sync_file::sync_dev.

Referenced by most_sync_do_release(), and most_sync_setup_tx().

ssize_t most_sync_read ( struct file *  filp,
void *  buff,
size_t  count,
struct rtnrt_memcopy_desc copy 
)

Read implementation for a synchronous MOST device. Can be called from other kernel modules.

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
buff the userspace buffer that contains the destination
count the number of bytes allocated for buff
copy how the memory must be copied

Definition at line 497 of file most-sync-m.c.

References most_sync_dev::config_lock_rx, most_sync_file::part_rx, PR, pr_sync_debug, most_sync_file::reader_index, return_value_if_fails, rtnrt_err, most_sync_dev::rx_queue, most_sync_file::rx_running, rxbuf_get(), rxbuf_is_empty(), most_sync_dev::sw_receive_buf, and most_sync_file::sync_dev.

Referenced by most_sync_do_read(), and snd_most_capture_thread().

ssize_t most_sync_write ( struct file *  filp,
void *  buff,
size_t  count,
struct rtnrt_memcopy_desc copy 
)

Write implementation for a synchronous MOST device. Can be called from other kernel modules.

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
buff the userspace buffer that contains the destination
count the number of bytes allocated for buff
copy how the memory must be copied

Definition at line 570 of file most-sync-m.c.

References most_sync_dev::config_lock_tx, most_sync_file::part_tx, PR, pr_sync_debug, return_value_if_fails, rtnrt_err, most_sync_dev::sw_transmit_buf, most_sync_file::sync_dev, most_sync_dev::tx_queue, most_sync_file::tx_running, txbuf_is_full(), txbuf_put(), and most_sync_file::writer_index.

Referenced by most_sync_do_write(), and snd_most_playback_thread().

int most_sync_setup_rx ( struct file *  filp,
struct frame_part frame_part 
)

See documentation of MOST_SYNC_SETUP_RX. Can be called from other kernel modules.

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
frame_part the frame part for which the reader should be set up

Definition at line 699 of file most-sync-m.c.

References most_sync_dev::config_lock_rx, hw_rx_buffer_size, most_sync_setup_rx_common, most_sync_stop_rx(), most_sync_file::rx_running, sw_rx_buffer_size, and most_sync_file::sync_dev.

Referenced by most_sync_do_setup_rx(), and snd_most_capture_setup_sync_file().

int most_sync_setup_tx ( struct file *  filp,
struct frame_part frame_part 
)

See documentation of MOST_SYNC_SETUP_TX.

Parameters:
filp the file pointer of Linux, holds the private_data which is of type struct most_sync_file.
frame_part the frame part for which the writer should be set up

Definition at line 746 of file most-sync-m.c.

References most_sync_dev::config_lock_tx, hw_tx_buffer_size, most_sync_setup_tx_common, most_sync_stop_tx(), sw_tx_buffer_size, most_sync_file::sync_dev, and most_sync_file::tx_running.

Referenced by most_sync_do_setup_tx(), and snd_most_playback_setup_sync_file().

static int __init most_sync_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 794 of file most-sync-m.c.

References DRIVER_NAME, most_register_high_driver(), most_sync_high_driver, print_measuring_warning(), rtnrt_info, and version.

static void __exit most_sync_exit ( void   )  [static]

This function gets called if the Kernel removes this module.

Definition at line 813 of file most-sync-m.c.

References DRIVER_NAME, most_deregister_high_driver(), most_sync_high_driver, rtnrt_info, and version.


Variable Documentation

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

Variable that holds the version.

Definition at line 62 of file most-sync-m.c.

struct most_sync_dev* most_sync_devices[MOST_DEVICE_NUMBER]

Array for each device.

Definition at line 69 of file most-sync-m.c.

Referenced by most_sync_int_handler(), most_sync_probe(), and most_sync_remove().

long sw_rx_buffer_size = STD_MOST_FRAMES_PER_SEC

Module parameter that holds the size of the software receive buffer in number of stored frame parts.

Definition at line 92 of file most-sync-m.c.

long sw_tx_buffer_size = STD_MOST_FRAMES_PER_SEC

Module parameter that holds the size of the software transmit buffer in number of stored frame parts.

Definition at line 97 of file most-sync-m.c.

long hw_rx_buffer_size = 44

Module parameter that holds the size of the hardware receive buffer in number of stored frame parts.

Definition at line 102 of file most-sync-m.c.

long hw_tx_buffer_size = 44

Module parameter that holds the size of the hardware transmit buffer in number of stored frame parts.

Definition at line 107 of file most-sync-m.c.

struct file_operations most_sync_file_operations [static]

Initial value:

 {
    .owner   = THIS_MODULE,
    .open    = most_sync_do_open,
    .ioctl   = most_sync_do_ioctl,
    .release = most_sync_do_release,
    .read    = most_sync_do_read,
    .write   = most_sync_do_write
}
Create a set of file operations for the MOST Sync device.

Definition at line 135 of file most-sync-m.c.

struct most_high_driver most_sync_high_driver [static]

Initial value:

 {
    .name               = "most-sync",
    .sema_list          = LIST_HEAD_INIT(most_sync_high_driver.sema_list),
    .spin_list          = LIST_HEAD_INIT(most_sync_high_driver.spin_list),
    .probe              = most_sync_probe,
    .remove             = most_sync_remove,
    .int_handler        = most_sync_int_handler,
    .interrupt_mask     = (IESTX | IESRX)
}
The structure for the MOST High driver that is registered by the MOST PCI driver

Definition at line 376 of file most-sync-m.c.

Referenced by most_sync_exit(), and most_sync_init().


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