Go to the source code of this file.
Defines | |
#define | DRIVER_NAME "most-netservice" |
#define | PR DRIVER_NAME ": " |
Functions | |
static int | most_nets_open (struct inode *, struct file *) |
static int | most_nets_release (struct inode *inode, struct file *file) |
static int | most_nets_ioctl (struct inode *, struct file *, unsigned int, unsigned long) |
static void | process_sigsend_handler (unsigned long) |
static int | ioctl_write_register (struct most_nets_dev *, unsigned long) |
static int | ioctl_read_register (struct most_nets_dev *, unsigned long) |
static int | ioctl_write_regblock (struct most_nets_dev *, unsigned long) |
static int | ioctl_read_regblock (struct most_nets_dev *, unsigned long) |
static int | ioctl_read_int (struct most_nets_dev *) |
static int | ioctl_irq_set (struct most_nets_dev *, unsigned long) |
static int | ioctl_irq_reset (struct most_nets_dev *, unsigned long) |
static int | ioctl_reset (struct most_nets_dev *) |
static | DECLARE_TASKLET (sigsend_tasklet, process_sigsend_handler, 0) |
DEFINE_NRTSIG (nrt_signal) | |
static int | nets_probe (struct most_dev *most_dev) |
int | nets_remove (struct most_dev *dev) |
static void | nrtsig_handler (rtnrt_nrtsig_t nrt_sig) |
static void | nets_int_handler (struct most_dev *dev, unsigned int intstatus) |
static int __init | most_nets_init (void) |
static void __exit | most_nets_exit (void) |
Variables | |
static char * | version = "$Rev: 641 $" |
most_nets_dev * | most_nets_devices [MOST_DEVICE_NUMBER] |
static struct file_operations | most_nets_file_operations |
static unsigned long | cards_to_send_interrupt = 0 |
static struct most_high_driver | most_netservice_high_driver |
Definition in file most-netservice.c.
#define DRIVER_NAME "most-netservice" |
The name of the driver.
Definition at line 50 of file most-netservice.c.
#define PR DRIVER_NAME ": " |
The prefix for printk statements in this driver
Definition at line 55 of file most-netservice.c.
static int most_nets_open | ( | struct inode * | inode, | |
struct file * | filp | |||
) | [static] |
Opens the device. Creates a per-file structure.
inode | the inode | |
filp | the file pointer |
Definition at line 176 of file most-netservice.c.
References most_nets_dev::cdev, most_nets_dev::most_dev, MOST_DEV_CARDNUMBER, most_manage_usage, most_nets_dev::open_count, PR, pr_nets_debug, and rtnrt_info.
static int most_nets_release | ( | struct inode * | inode, | |
struct file * | filp | |||
) | [static] |
The release function. Frees the allocated memory.
inode | the inode | |
filp | the file pointer |
Definition at line 294 of file most-netservice.c.
References most_nets_dev::most_dev, MOST_DEV_CARDNUMBER, most_manage_usage, most_nets_dev::open_count, PR, and pr_nets_debug.
static int most_nets_ioctl | ( | struct inode * | inode, | |
struct file * | file, | |||
unsigned int | cmd, | |||
unsigned long | arg | |||
) | [static] |
The ioctl() system call which implements the basic operations. The valid commands are described in the header file most-netservices.h where they are defined.
inode | the inode | |
file | the file | |
cmd | the command | |
arg | the command argument |
Definition at line 219 of file most-netservice.c.
References ioctl_irq_reset(), ioctl_irq_set(), ioctl_read_int(), ioctl_read_regblock(), ioctl_read_register(), ioctl_reset(), ioctl_write_regblock(), ioctl_write_register(), MOST_NETS_IOCTL_MAGIC, MOST_NETS_IRQ_RESET, MOST_NETS_IRQ_SET, MOST_NETS_MAXIOCTL, MOST_NETS_READ_INT, MOST_NETS_READREG, MOST_NETS_READREG_BLOCK, MOST_NETS_RESET, MOST_NETS_WRITEREG, and MOST_NETS_WRITEREG_BLOCK.
static void process_sigsend_handler | ( | unsigned long | data | ) | [static] |
Tasklet that gets started if an interrupt occured. It sends all processes that belongs to a PCI card that has an interrupt signalled in cards_to_send_interrupt the requested signal.
data | the "cookie" (required if more tasklets have been assigned the same function) |
Definition at line 129 of file most-netservice.c.
References assert, cards_to_send_interrupt, ISMAINT, ISMINT, MNS_AINT, MNS_INT, MOST_DEVICE_NUMBER, most_kill(), and most_nets_devices.
static int ioctl_write_register | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Writes the register specified in arg
with the value specified in arg
.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl argument (must be parsed in this function) |
Definition at line 316 of file most-netservice.c.
References single_transfer_arg::address, most_nets_dev::most_dev, most_writereg8104, PR, pr_ioctl_debug, and single_transfer_arg::value.
Referenced by most_nets_ioctl().
static int ioctl_read_register | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Reads the register specified in arg
with the value specified in arg
.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl argument (must be parsed in this function) |
Definition at line 345 of file most-netservice.c.
References single_transfer_arg::address, most_nets_dev::most_dev, most_readreg8104, PR, pr_ioctl_debug, and single_transfer_arg::value.
Referenced by most_nets_ioctl().
static int ioctl_write_regblock | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Performs the MOST_NETS_WRITEREG_BLOCK ioctl() call as described in the desciption of the definition of MOST_NETS_WRITEREG_BLOCK.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl argument (must be parsed in this function) |
Definition at line 425 of file most-netservice.c.
References block_transfer_arg::address, most_nets_dev::buffer, block_transfer_arg::count, block_transfer_arg::data, most_nets_dev::most_dev, most_writereg8104, PR, and pr_ioctl_debug.
Referenced by most_nets_ioctl().
static int ioctl_read_regblock | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Performs the MOST_NETS_READREG_BLOCK ioctl() call as described in the command near the definition of MOST_NETS_WRITEREG_BLOCK.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl argument (must be parsed in this function) |
Definition at line 383 of file most-netservice.c.
References block_transfer_arg::address, most_nets_dev::buffer, block_transfer_arg::count, block_transfer_arg::data, most_nets_dev::most_dev, most_readreg8104, PR, and pr_ioctl_debug.
Referenced by most_nets_ioctl().
static int ioctl_read_int | ( | struct most_nets_dev * | dev | ) | [static] |
Performs the MOST_NETS_READ_INT ioctl() call as described in the description of the definition of MOST_NETS_READ_INT.
dev | the most_nets_dev structure |
true
if an interrupt is active (i.e. /INT is low), false
if no interrupt is active (i.e. /INT is high) and a negative value on error Definition at line 470 of file most-netservice.c.
References ISMINT, most_nets_dev::most_dev, MOST_PCI_INTSTATUS_REG, most_readreg, PR, and pr_ioctl_debug.
Referenced by most_nets_ioctl().
static int ioctl_irq_set | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Implements registering a userspace process for the IRQ. This function is called in process context, so current is set valid.
See documentation of MOST_NETS_IRQ_SET ioctl() constant in the header file for more information.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl() argument |
0
on success Definition at line 496 of file most-netservice.c.
References IEMAINT, IEMINT, most_nets_dev::intmask, is_between_excl, MNS_AINT, MNS_INT, most_nets_dev::most_dev, most_intset, PR, pr_ioctl_debug, rtnrt_err, interrupt_set_arg::sigmask, most_nets_dev::signo, interrupt_set_arg::signo, and most_nets_dev::task.
Referenced by most_nets_ioctl().
static int ioctl_irq_reset | ( | struct most_nets_dev * | dev, | |
unsigned long | ioctl_arg | |||
) | [static] |
Implements registering a userspace process for the IRQ. This function is called in process context, so current is set valid.
See documentation of MOST_NETS_IRQ_SET ioctl() constant in the header file for more information.
dev | the most_nets_dev structure | |
ioctl_arg | the ioctl() argument |
0
on success Definition at line 545 of file most-netservice.c.
References IEMAINT, IEMINT, most_nets_dev::intmask, most_nets_dev::most_dev, most_intset, most_writereg8104, MSGC, PR, and pr_ioctl_debug.
Referenced by most_nets_ioctl().
static int ioctl_reset | ( | struct most_nets_dev * | dev | ) | [static] |
Resets the MOST Transceiver.
dev | the MOST NetService device |
Definition at line 577 of file most-netservice.c.
References most_nets_dev::most_dev, and most_reset.
Referenced by most_nets_ioctl().
static DECLARE_TASKLET | ( | sigsend_tasklet | , | |
process_sigsend_handler | , | |||
0 | ||||
) | [static] |
Tasklet that is responsible for sending signals to the processes, see documentation of process_sigsend_handler.
DEFINE_NRTSIG | ( | nrt_signal | ) |
Non real-time signalling service handler. This is needed because the interrupt handler runs in RT context if compiled with RT_RTDM and some tasks must be done from Linux context.
static int nets_probe | ( | struct most_dev * | most_dev | ) | [static] |
Gets called by the MOST driver when a new MOST device was discovered.
0
on success, an error code on failure Definition at line 590 of file most-netservice.c.
References most_nets_dev::buffer, most_nets_dev::cdev, MAX_OPEN_PROCESSES, most_nets_dev::most_dev, MOST_DEV_CARDNUMBER, MOST_DEV_MAJOR, MOST_DEVICE_NUMBER, most_nets_devices, most_nets_file_operations, MOST_NETS_MINOR_OFFSET, most_nets_dev::open_count, PR, pr_nets_debug, return_value_if_fails_dbg, and most_nets_dev::task.
int nets_remove | ( | struct most_dev * | dev | ) |
Gets called by the MOST Base driver when a MOST device was removed.
dev | the most_pci_device that was discovered |
0
on success, an error code on failure Definition at line 646 of file most-netservice.c.
References most_nets_dev::cdev, MOST_DEV_CARDNUMBER, most_nets_devices, PR, and pr_nets_debug.
static void nrtsig_handler | ( | rtnrt_nrtsig_t | nrt_sig | ) | [inline, static] |
Handles the NRT part of the interrupt handling if compiled with RT_RTDM
. It simply schedules the tasklet. This must be done from Linux context because RTAI could interrupt the Linux kernel at any time.
nrt_sig | the signal handle |
Definition at line 670 of file most-netservice.c.
Referenced by most_nets_init(), and nets_int_handler().
static void nets_int_handler | ( | struct most_dev * | dev, | |
unsigned int | intstatus | |||
) | [static] |
Called on every interrupt. This function needs to make sure that the corresponding processes gets notified on the interrupt. To do this, it sets a bit in the module-global variable cards_to_send_interrupt and schedules a tasklet which then sends the signal. This guarantees short durations of the interrupt service routine.
dev | the device that fired the interrupt | |
intstatus | the interrupt status register |
Definition at line 685 of file most-netservice.c.
References assert, cards_to_send_interrupt, IEMINT, most_nets_dev::intstatus, MOST_DEV_CARDNUMBER, most_intset, most_nets_devices, nrtsig_handler(), and rtnrt_nrtsig_action.
static int __init most_nets_init | ( | void | ) | [static] |
This function gets called if the kernel loads this module.
Definition at line 727 of file most-netservice.c.
References DRIVER_NAME, most_netservice_high_driver, most_register_high_driver(), nrtsig_handler(), rtnrt_info, rtnrt_nrtsig_init, and version.
static void __exit most_nets_exit | ( | void | ) | [static] |
This function gets called if the Kernel removes this module.
Definition at line 746 of file most-netservice.c.
References DRIVER_NAME, most_deregister_high_driver(), most_netservice_high_driver, rtnrt_info, rtnrt_nrtsig_destroy, and version.
char* version = "$Rev: 641 $" [static] |
Variable that holds the driver version.
Definition at line 61 of file most-netservice.c.
struct most_nets_dev* most_nets_devices[MOST_DEVICE_NUMBER] |
Array for each device.
Definition at line 86 of file most-netservice.c.
Referenced by nets_int_handler(), nets_probe(), nets_remove(), and process_sigsend_handler().
struct file_operations most_nets_file_operations [static] |
Initial value:
{ .owner = THIS_MODULE, .open = most_nets_open, .ioctl = most_nets_ioctl, .release = most_nets_release }
Definition at line 92 of file most-netservice.c.
Referenced by nets_probe().
unsigned long cards_to_send_interrupt = 0 [static] |
A bitmask of tasks which should be sent an interrupt. The interrupt service routine just sets a bit in this mask and schedules the corresponding tasklet. The tasklet then sends the interrupt.
Definition at line 104 of file most-netservice.c.
Referenced by nets_int_handler(), and process_sigsend_handler().
struct most_high_driver most_netservice_high_driver [static] |
Initial value:
{ .name = "most-netservice", .sema_list = LIST_HEAD_INIT(most_netservice_high_driver.sema_list), .spin_list = LIST_HEAD_INIT(most_netservice_high_driver.spin_list), .probe = nets_probe, .remove = nets_remove, .int_handler = nets_int_handler, .interrupt_mask = (IEMAINT | IEMINT) }
Definition at line 711 of file most-netservice.c.
Referenced by most_nets_exit(), and most_nets_init().