/home/hillier_g/checkout/most4linux/most-kernel/most-netservice.h File Reference

NetServices driver declarations. More...

Go to the source code of this file.

Data Structures

struct  single_transfer_arg
struct  block_transfer_arg
struct  interrupt_set_arg
struct  most_nets_dev

Defines

#define MOST_NETS_IOCTL_MAGIC   'g'
#define MOST_NETS_WRITEREG   _IOW(MOST_NETS_IOCTL_MAGIC, 0, struct single_transfer_arg)
#define MOST_NETS_READREG   _IOWR(MOST_NETS_IOCTL_MAGIC, 1, struct single_transfer_arg)
#define MOST_NETS_READREG_BLOCK   _IOWR(MOST_NETS_IOCTL_MAGIC, 2, struct block_transfer_arg)
#define MOST_NETS_WRITEREG_BLOCK   _IOW(MOST_NETS_IOCTL_MAGIC, 3, struct block_transfer_arg)
#define MOST_NETS_READ_INT   _IO(MOST_NETS_IOCTL_MAGIC, 4)
#define MOST_NETS_IRQ_SET   _IOW(MOST_NETS_IOCTL_MAGIC, 5, struct interrupt_set_arg)
#define MOST_NETS_IRQ_RESET   _IOW(MOST_NETS_IOCTL_MAGIC, 6, unsigned char)
#define MOST_NETS_RESET   _IO(MOST_NETS_IOCTL_MAGIC, 7)
#define MOST_NETS_MAXIOCTL   7
#define MOST_NETS_MINOR_OFFSET   0
#define NETS_BUFSIZ   256
#define MAX_OPEN_PROCESSES   1

Enumerations

enum  most_nets_interrupt { MNS_INT = (1<<0), MNS_AINT = (1<<1) }


Detailed Description

NetServices driver declarations.

This header file can also be included in userspace. It contains the ioctl() definitions necessary to implement userspace programs.

Definition in file most-netservice.h.


Define Documentation

#define MOST_NETS_IOCTL_MAGIC   'g'

Magic number. Should be unique in the whole system to simplify debugging, but it is not a requirement.

Definition at line 49 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_WRITEREG   _IOW(MOST_NETS_IOCTL_MAGIC, 0, struct single_transfer_arg)

Writes a register. The argument must be a pointer to a single_transfer_arg structure. The return value is 0 on success and a negative error code on failure. The data in the transferred date structure remains unchanged.

Definition at line 102 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_READREG   _IOWR(MOST_NETS_IOCTL_MAGIC, 1, struct single_transfer_arg)

Reads a register. The argument must be a pointer to a single_transfer_arg structure. The return value is 0 on success and a negative error code on failure. The read byte will be filled in the given data structure (the value field).

Definition at line 111 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_READREG_BLOCK   _IOWR(MOST_NETS_IOCTL_MAGIC, 2, struct block_transfer_arg)

Reads a block of registers starting from an address for count values. The argument must be a pointer to a block_transfer_arg structure. The return value is the numbers of bytes read on success and a negative error code on failure. The bytes that have been read are stored in the data part of the data structure. The user is responsible for allocating at least count bytes in this data structure.

Definition at line 122 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_WRITEREG_BLOCK   _IOW(MOST_NETS_IOCTL_MAGIC, 3, struct block_transfer_arg)

Writes a block of registers starting from an address for count values. The argument must be a pointer to a block_transfer_arg structure. The return value is the number of bytes written on success and a negative error code on failure. The data which should be written is stored in the data part of the strucuture.

Definition at line 132 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_READ_INT   _IO(MOST_NETS_IOCTL_MAGIC, 4)

Reads the value of the /INT pin of the OS8104 transceiver (i.e. not /INTA pin!). Returns true if /INT is low and returns false if /INT is high. On error, a negative error value is returned.

Definition at line 140 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_IRQ_SET   _IOW(MOST_NETS_IOCTL_MAGIC, 5, struct interrupt_set_arg)

Allows a userspace process to register for interrupts. You have to specify an argument of type struct interrupt_set_arg. The interrupt number must be a real-time interrupt (i.e. in the range SIGRTMIN .. SIGRTMAX).

The process gets the siginfo.si_value.sigval_int value which contains the interrupt (i.e. MNS_AINT or MNS_INT) which is responsible for that signal.

Because only one process can open a MOST NetService device, only one process can register for interrupts. The process that has opened the file gets signalled for interrupts.

If an interrupt of the MOST PCI card occures, the hardware does following

1. Disable the interrupt of the PCI card. Because the interrupt is handled in userspace, it the ISR would be called in an infinite loop until userspace handles the interrupt (and it cannot because ISRs have a higher priority than tasks).

2. Notify the tasks that is responsible for this interrupt with the signal.

After the task has handled the interrupt, it calls the MOST_NETS_IRQ_RESET ioctl() to enable interrupts again.

Todo:
Check what is if the process forks() and inherits the file descriptors?

Definition at line 170 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_IRQ_RESET   _IOW(MOST_NETS_IOCTL_MAGIC, 6, unsigned char)

Please read also the description of the MOST_NETS_IRQ_SET ioctl above.

This ioctl() does following:

1. It resets the MOST Interrupt by writing mask to MSGC register in OS 8104.

2. It enables MOST PCI interrupts again.

After callling this ioctl(), the next interrupt can occure.

Definition at line 185 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_RESET   _IO(MOST_NETS_IOCTL_MAGIC, 7)

Reset the MOST Transceiver.

Definition at line 191 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_MAXIOCTL   7

The maximum ioctl number. This value may change in future.

Definition at line 197 of file most-netservice.h.

Referenced by most_nets_ioctl().

#define MOST_NETS_MINOR_OFFSET   0

Offset for minor device numbers from zero.

Definition at line 209 of file most-netservice.h.

Referenced by nets_probe().

#define NETS_BUFSIZ   256

Buffer size for some ioctls(). The value of 255 was chosen because one page is 256 bytes large.

Definition at line 215 of file most-netservice.h.

#define MAX_OPEN_PROCESSES   1

Defines the maximum number of processes which are allowed to open a MOST NetServices device. Currently, only one process is supported.

WARNING: Changing this constant only is not sufficient to increase the number of allowed processes. You have to change the structure of the driver and of the Userspace program. So this constant is meant to be _constant_, it's only a define to increase code readability.

Definition at line 226 of file most-netservice.h.

Referenced by nets_probe().


Enumeration Type Documentation

enum most_nets_interrupt

Enumeration that defines numbers that must be used as intmask in interrupt_set_arg.

Enumerator:
MNS_INT  MOST Interrupt (/INT pin)
MNS_AINT  MOST Asynchronous Interrupt (/AINT pin)

Definition at line 80 of file most-netservice.h.


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