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

Definitions for the MOST Base driver. More...

Go to the source code of this file.

Data Structures

struct  dma_buffer
struct  most_ops
struct  most_ops_rt
struct  most_dev
struct  most_high_driver
struct  most_low_driver

Defines

#define most_readreg(dev, addr)   (dev)->ops.readreg((dev), addr)
#define most_writereg(dev, value, addr)   (dev)->ops.writereg((dev), (value), (addr))
#define most_changereg(dev, addr, value, mask)   (dev)->ops.changereg((dev), (addr), (value), (mask))
#define most_readreg8104(dev, dest, len, addr)   (dev)->ops.readreg8104((dev), (dest), (len), (addr))
#define most_writereg8104(dev, src, len, addr)   (dev)->ops.writereg8104((dev), (src), (len), (addr))
#define most_intset(dev, interrupts, mask, oldmask)   (dev)->ops.intset((dev), (interrupts), (mask), (oldmask))
#define most_intclear(dev, interrupts)   (dev)->ops.intclear((dev), (interrupts))
#define most_dma_allocate(dev, dma_buffer)   (dev)->ops.dma_allocate(dev, dma_buffer)
#define most_dma_deallocate(dev, dma_buffer)   (dev)->ops.dma_deallocate(dev, dma_buffer)
#define most_reset(dev)   (dev)->ops.reset((dev))
#define most_features(dev)   (dev)->ops.features(dev)
#define most_readreg_rt(dev, addr)   (dev)->rt_ops.readreg((dev), addr)
#define most_writereg_rt(dev, value, addr)   (dev)->rt_ops.writereg((dev), (value), (addr))
#define most_manage_usage(dev, change)   (dev)->manage_usage((dev), (change))
#define MOST_DEV_MAJOR(most_device)   ((most_device)->major_device_no)
#define MOST_DEV_CARDNUMBER(most_device)   ((most_device)->card_number)

Typedefs

typedef u32(*) readreg_func (struct most_dev *dev, u32 addr)
typedef void(*) writereg_func (struct most_dev *dev, u32 val, u32 addr)
typedef void(*) changereg_func (struct most_dev *dev, u32 address, u32 value, u32 mask)
typedef int(*) read_os8104_func (struct most_dev *dev, unsigned char *dest, size_t len, u32 addr)
typedef int(*) write_os8104_func (struct most_dev *dev, unsigned char *src, size_t len, u32 addr)
typedef void(*) intset_func (struct most_dev *dev, unsigned int interrupts, unsigned int mask, unsigned int *oldmask)
typedef void(*) intclear_func (struct most_dev *dev, unsigned int interrupts)
typedef void(*) reset_func (struct most_dev *dev)
typedef int(*) dma_alloc_fun (struct most_dev *dev, struct dma_buffer *buf)
typedef void(*) dma_dealloc_fun (struct most_dev *dev, struct dma_buffer *buf)
typedef int(*) probe_func (struct most_dev *dev)
typedef int(*) remove_func (struct most_dev *dev)
typedef void(*) irq_func (struct most_dev *dev, unsigned int intstatus)
typedef void(*) proc_show_func (struct seq_file *file)
typedef int(*) feature_fun (struct most_dev *dev)
typedef void(*) usage_fun (struct most_dev *dev, int change)

Functions

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 *low_driver)
void most_deregister_low_driver (struct most_low_driver *low_driver)
most_devmost_dev_new (void)
void most_dev_free (struct most_dev *dev)

Variables

rwsema_locked_list most_base_low_drivers
rwsema_locked_list most_base_high_drivers_sema
spin_locked_list most_base_high_drivers_spin


Detailed Description

Definitions for the MOST Base driver.

Definition in file most-base.h.


Define Documentation

#define most_readreg ( dev,
addr   )     (dev)->ops.readreg((dev), addr)

See also:
readreg_func

Definition at line 302 of file most-base.h.

Referenced by ioctl_read_int(), and most_sync_int_handler().

#define most_writereg ( dev,
value,
addr   )     (dev)->ops.writereg((dev), (value), (addr))

See also:
writereg_func

Definition at line 308 of file most-base.h.

#define most_changereg ( dev,
addr,
value,
mask   )     (dev)->ops.changereg((dev), (addr), (value), (mask))

See also:
changereg_func

Definition at line 314 of file most-base.h.

Referenced by most_sync_set_sbc_reg().

#define most_readreg8104 ( dev,
dest,
len,
addr   )     (dev)->ops.readreg8104((dev), (dest), (len), (addr))

See also:
read_os8104_func

Definition at line 320 of file most-base.h.

Referenced by ioctl_read_regblock(), ioctl_read_register(), and most_sync_set_sbc_reg().

#define most_writereg8104 ( dev,
src,
len,
addr   )     (dev)->ops.writereg8104((dev), (src), (len), (addr))

See also:
write_os8104_func

Definition at line 326 of file most-base.h.

Referenced by ioctl_irq_reset(), ioctl_write_regblock(), and ioctl_write_register().

#define most_intset ( dev,
interrupts,
mask,
oldmask   )     (dev)->ops.intset((dev), (interrupts), (mask), (oldmask))

See also:
intset_func

Definition at line 332 of file most-base.h.

Referenced by ioctl_irq_reset(), ioctl_irq_set(), nets_int_handler(), and probe().

#define most_intclear ( dev,
interrupts   )     (dev)->ops.intclear((dev), (interrupts))

See also:
intclear_func

Definition at line 338 of file most-base.h.

#define most_dma_allocate ( dev,
dma_buffer   )     (dev)->ops.dma_allocate(dev, dma_buffer)

See also:
dma_alloc_fun

Definition at line 344 of file most-base.h.

#define most_dma_deallocate ( dev,
dma_buffer   )     (dev)->ops.dma_deallocate(dev, dma_buffer)

See also:
dma_dealloc_fun

Definition at line 350 of file most-base.h.

#define most_reset ( dev   )     (dev)->ops.reset((dev))

See also:
reset_func

Definition at line 356 of file most-base.h.

Referenced by ioctl_reset().

#define most_features ( dev   )     (dev)->ops.features(dev)

See also:
feature_fun

Definition at line 362 of file most-base.h.

#define most_readreg_rt ( dev,
addr   )     (dev)->rt_ops.readreg((dev), addr)

See also:
readreg_func

Definition at line 368 of file most-base.h.

Referenced by most_sync_rt_interrupt_handler().

#define most_writereg_rt ( dev,
value,
addr   )     (dev)->rt_ops.writereg((dev), (value), (addr))

See also:
writereg_func

Definition at line 374 of file most-base.h.

#define most_manage_usage ( dev,
change   )     (dev)->manage_usage((dev), (change))

See also:
usage_func

Definition at line 380 of file most-base.h.

Referenced by most_nets_open(), most_nets_release(), most_sync_do_open(), most_sync_do_release(), most_sync_nrt_close(), and most_sync_nrt_open().

#define MOST_DEV_MAJOR ( most_device   )     ((most_device)->major_device_no)

Returns the major device number from a struct most_pci_device data structure.

Parameters:
most_device a pointer to a most_pci_device structure

Definition at line 389 of file most-base.h.

Referenced by most_sync_probe(), and nets_probe().

#define MOST_DEV_CARDNUMBER ( most_device   )     ((most_device)->card_number)

Returns the card number (from 0 to 7 including). Each card number is unique.

Parameters:
most_device a pointer to a most_pci_device structure

Definition at line 397 of file most-base.h.

Referenced by most_alsa_int_handler(), most_alsa_probe(), most_alsa_remove(), most_dev_new(), most_nets_open(), most_nets_release(), most_sync_do_open(), most_sync_do_release(), most_sync_int_handler(), most_sync_nrt_close(), most_sync_nrt_open(), most_sync_probe(), most_sync_remove(), most_sync_rt_interrupt_handler(), most_sync_rt_probe(), most_sync_rt_remove(), nets_int_handler(), nets_probe(), nets_remove(), probe(), remove(), snd_most_capture_setup_sync_file(), and snd_most_playback_setup_sync_file().


Typedef Documentation

typedef u32(*) readreg_func(struct most_dev *dev, u32 addr)

Function prototype for reading a register from an OS8604 chip.

Parameters:
dev the device to read from
addr the address to read from
Returns:
the value which was read

Definition at line 65 of file most-base.h.

typedef void(*) writereg_func(struct most_dev *dev, u32 val, u32 addr)

Function prototype for writing to a register on a OS8604 chip.

Parameters:
dev the device to write to
val the value to write to
addr the address where to write

Definition at line 74 of file most-base.h.

typedef void(*) changereg_func(struct most_dev *dev, u32 address, u32 value, u32 mask)

It's a common operation to change the value of a register. I.e. change only a few bits and leave the other bits untouched. The bits that are 1 in mask are set to the corresponding bits in value.

Parameters:
dev the device
address the register address
value the value to set
mask which bits should be set

Definition at line 86 of file most-base.h.

typedef int(*) read_os8104_func(struct most_dev *dev, unsigned char *dest, size_t len, u32 addr)

Function prototype for reading one or more registers from an OS8104 chip.

Parameters:
dev the device to read from
dest the destination array (kernelspace) where the bytes should be stored
len the number of bytes which should be read
addr the address (consists of address and page part) to read from
Returns:
the number of bytes that have been read successfully or a negative error code

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

typedef int(*) write_os8104_func(struct most_dev *dev, unsigned char *src, size_t len, u32 addr)

Function prototype for writing one or more registers on a OS8104 chip.

Parameters:
dev the device to write to
src the bytes that should be written (kernelspace)
len the number of bytes that should be written
addr the address where to write (consists of address and page part)
Returns:
the number of bytes that have been written successfully or a negative error code

Definition at line 117 of file most-base.h.

typedef void(*) intset_func(struct most_dev *dev, unsigned int interrupts, unsigned int mask, unsigned int *oldmask)

Changes the interrupt mask. All bits that are set in mask are set as specified in interrupts.

interrupts and mask consists of the components which have to be modified with bit operators to get the requested effect. IOMLOCK_MASK, IEMAINT_MASK, IEMINT_MASK, IEGP_MASK, IESRX_MASK, IESTX_MASK, IEARX_MASK, IEATX_MASK and IECPFSM_MASK.

Parameters:
dev the device
interrupts the interrupt bits to set
mask the mask; a bit in interrupts only apply if the corresponding bit in mask is set
oldmask if not NULL, the function fills the value with the old interrupt mask (valid are only the bits (oldmask & mask)), used to restore the interrupts

Definition at line 139 of file most-base.h.

typedef void(*) intclear_func(struct most_dev *dev, unsigned int interrupts)

Clears pending interrupts.

Definition at line 147 of file most-base.h.

typedef void(*) reset_func(struct most_dev *dev)

Resets the MOST Transceiver.

Parameters:
dev the MOST device
Returns:
0 on success, an error code (e.g. -ERESTARTSYS) on failure

Definition at line 156 of file most-base.h.

typedef int(*) dma_alloc_fun(struct most_dev *dev, struct dma_buffer *buf)

Allocates a DMA buffer.

Parameters:
dev the MOST device
buf the buffer
Returns:
0 on success, a negative error vlaue1 on failure

Definition at line 176 of file most-base.h.

typedef void(*) dma_dealloc_fun(struct most_dev *dev, struct dma_buffer *buf)

Deallocates a DMA buffer.

Parameters:
dev the MOST device
buf the buffer
Returns:
0 on success, a negative error vlaue1 on failure

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

typedef int(*) probe_func(struct most_dev *dev)

the probe function that gets called if the card was found or the module was load (i.e. the driver was registered) and the card is already present

Parameters:
dev the MOST device
Returns:
0 on success, a negative error vlaue1 on failure

Definition at line 194 of file most-base.h.

typedef int(*) remove_func(struct most_dev *dev)

deregistration function

Parameters:
dev the MOST device

Definition at line 201 of file most-base.h.

typedef void(*) irq_func(struct most_dev *dev, unsigned int intstatus)

The interrupt handler function.

Parameters:
dev the MOST device
intstatus the interrupt status register value

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

typedef void(*) proc_show_func(struct seq_file *file)

This file implements the show handler of the MOST device.

Parameters:
file the sequence file

Definition at line 216 of file most-base.h.

typedef int(*) feature_fun(struct most_dev *dev)

Returns the features, a bitwise combination of ...

Definition at line 221 of file most-base.h.

typedef void(*) usage_fun(struct most_dev *dev, int change)

Manages the usage count of the device. If a device is opened, the usage count must be incremented. If it's closed, it must be decremented. Currently this is used to prevent the low modules from being unloaded if the device is opened (used) by a high module.

Parameters:
dev the MOST device (currently unused)
change 1 if the usage count should be increased, -1 if it should be decreased

Definition at line 233 of file most-base.h.


Function Documentation

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, most_low_driver::list, spin_locked_list::list, rwsema_locked_list::list, spin_locked_list::lock, rwsema_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, most_low_driver::list, rwsema_locked_list::list, spin_locked_list::lock, rwsema_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 rwsema_locked_list::list, most_low_driver::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().


Variable Documentation

struct rwsema_locked_list most_base_low_drivers

Linked list of all MOST PCI Low Drivers.

Referenced by most_base_seq_show(), most_deregister_high_driver(), most_deregister_low_driver(), most_register_high_driver(), and most_register_low_driver().

struct rwsema_locked_list most_base_high_drivers_sema

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

Referenced by most_deregister_high_driver(), most_register_high_driver(), probe(), and remove().

struct spin_locked_list most_base_high_drivers_spin

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

Referenced by handle_interrupt(), most_deregister_high_driver(), and most_register_high_driver().


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