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

Common functionality between real-time and non-real-time synchronous driver. More...

Go to the source code of this file.

Defines

#define most_sync_setup_rx_common(param, file, sync_dev, hw_buffer_size,sw_buffer_size, error_var,most_sync_file_name)
#define most_sync_setup_tx_common(param, file, sync_dev, hw_buffer_size,sw_buffer_size, error_var,most_sync_file_name)
#define most_sync_stop_rx_common(sync_dev, file)
#define most_sync_stop_tx_common(sync_dev, file)
#define most_sync_last_closed_rx(sync_dev, file, stop_rx)
#define most_sync_last_closed_tx(sync_dev, file, stop_tx)

Functions

static void most_sync_set_sbc_reg (struct most_dev *dev)

Variables

long sw_rx_buffer_size
long sw_tx_buffer_size
long hw_rx_buffer_size
long hw_tx_buffer_size


Detailed Description

Common functionality between real-time and non-real-time synchronous driver.

Todo:
Find a way to implement this as inline functions and not as macros. The reasons why this doesn't have to be done are

Definition in file most-sync-common.h.


Define Documentation

#define most_sync_setup_rx_common ( param,
file,
sync_dev,
hw_buffer_size,
sw_buffer_size,
error_var,
most_sync_file_name   ) 

See documentation of MOST_SYNC_RT_SETUP_RX.

Most be locked, this is done in most_sync_setup_rx() or most_sync_rt_setup_rx() respectively.

The device must be stopped before calling this function!

This must be a macro because it can be used with RT and NRT structures, so a function is not suitable. Using a common "base" structure leads to more problems than it solves (because of the list issue).

Parameters:
param the frame part as described in MOST_SYNC_RT_SETUP_RX
file the struct most_sync_file or struct most_sync_rt_file structure
sync_dev the synchronous device (struct most_sync_dev or struct most_sync_dev_rt)
hw_buffer_size the hardware buffer size (kernel module parameter)
sw_buffer_size the software buffer size
error_var the variable where errors (negative value) are stored
most_sync_file_name the name of the structure (some kind of typeof(file))
Returns:
0 on success, a negative error code on failure.

Definition at line 93 of file most-sync-common.h.

Referenced by most_sync_nrt_setup_rx(), and most_sync_setup_rx().

#define most_sync_setup_tx_common ( param,
file,
sync_dev,
hw_buffer_size,
sw_buffer_size,
error_var,
most_sync_file_name   ) 

See documentation of MOST_SYNC_RT_SETUP_TX.

Most be locked, this is done in most_sync_setup_tx() or most_sync_rt_setup_tx() respectively.

The device must be stopped before calling this function!

This must be a macro because it can be used with RT and NRT structures, so a function is not suitable. Using a common "base" structure leads to more problems than it solves (because of the list issue).

Parameters:
param the frame part as described in MOST_SYNC_RT_SETUP_RX
file the struct most_sync_file or struct most_sync_rt_file structure
sync_dev the synchronous device (struct most_sync_dev or struct most_sync_dev_rt)
hw_buffer_size the hardware buffer size (kernel module parameter)
sw_buffer_size the software buffer size
error_var the variable where errors (negative value) are stored
most_sync_file_name the name of the structure (some kind of typeof(file))
Returns:
0 on success, a negative error code on failure.

Definition at line 226 of file most-sync-common.h.

Referenced by most_sync_nrt_setup_tx(), and most_sync_setup_tx().

#define most_sync_stop_rx_common ( sync_dev,
file   ) 

Value:

do {                                                                      \
        most_intset(sync_dev->most_dev, 0, IESRX, NULL);                      \
        most_changereg(sync_dev->most_dev, MOST_PCI_SRXCTRL_REG, 0, SRXST);   \
        most_intclear(sync_dev->most_dev, ISSRX);                             \
                                                                              \
        file->rx_running = false;                                             \
    } while (0)
Common part of most_sync_stop_rx() and most_sync_nrt_stop_rx().

Parameters:
sync_dev the synchronous device (struct most_sync_rt_dev or struct struct most_sync_dev
file the synchronous file (struct most_sync_file or struct most_sync_rt_file)

Definition at line 343 of file most-sync-common.h.

Referenced by most_sync_nrt_stop_rx(), and most_sync_stop_rx().

#define most_sync_stop_tx_common ( sync_dev,
file   ) 

Value:

do {                                                                      \
        most_intset(sync_dev->most_dev, 0, IESTX, NULL);                      \
        most_changereg(sync_dev->most_dev, MOST_PCI_STXCTRL_REG, 0, STXST);   \
        most_intclear(sync_dev->most_dev, ISSTX);                             \
                                                                              \
        file->tx_running = false;                                             \
    } while (0)
Common part of most_sync_stop_tx() and most_sync_nrt_stop_tx().

Parameters:
sync_dev the synchronous device (struct most_sync_rt_dev or struct struct most_sync_dev
file the synchronous file (struct most_sync_file or struct most_sync_rt_file)

Definition at line 360 of file most-sync-common.h.

Referenced by most_sync_nrt_stop_tx(), and most_sync_stop_tx().

#define most_sync_last_closed_rx ( sync_dev,
file,
stop_rx   ) 

Value:

do {                                                                      \
        sync_dev->rx_current_page = 0;                                        \
                                                                              \
        stop_rx(file);                                                        \
        rxbuf_free(sync_dev->sw_receive_buf);                                 \
                                                                              \
        /* free the DMA buffers */                                            \
        if (sync_dev->hw_receive_buf.size != 0) {                             \
            most_dma_deallocate(sync_dev->most_dev,                           \
                    &sync_dev->hw_receive_buf);                               \
        }                                                                     \
                                                                              \
        /* mark all as deallocated */                                         \
        sync_dev->sw_receive_buf = NULL;                                      \
        sync_dev->hw_receive_buf.size = 0;                                    \
    } while (0)
Must be called if the device is closed and this is the last device. This is for reception. See most_sync_last_closed_tx to do the same action for transmission. The config_lock must be held if this macro is called.

Parameters:
sync_dev the synchronous device
file the sync file
stop_rx the function that stops the receiver

Definition at line 378 of file most-sync-common.h.

Referenced by most_sync_do_release(), and most_sync_nrt_close().

#define most_sync_last_closed_tx ( sync_dev,
file,
stop_tx   ) 

Value:

do {                                                                      \
        sync_dev->tx_current_page = 0;                                        \
                                                                              \
        stop_tx(file);                                                        \
        txbuf_free(sync_dev->sw_transmit_buf);                                \
                                                                              \
        /* free the DMA buffer */                                             \
        if (sync_dev->hw_transmit_buf.size != 0) {                            \
            most_dma_deallocate(sync_dev->most_dev,                           \
                    &sync_dev->hw_transmit_buf);                              \
        }                                                                     \
                                                                              \
        /* mark as deallocated */                                             \
        sync_dev->sw_transmit_buf = NULL;                                     \
        sync_dev->hw_transmit_buf.size = 0;                                   \
    } while (0)
Must be called if the device is closed and this is the last device. This is for transmission. See most_sync_last_closed_rx to do the same action for transmission. The config_lock must be held if this macro is called.

Parameters:
sync_dev the synchronous device
file the sync file
stop_tx the function that stops the transmitter

Definition at line 405 of file most-sync-common.h.

Referenced by most_sync_do_release(), and most_sync_nrt_close().


Function Documentation

static void most_sync_set_sbc_reg ( struct most_dev dev  )  [inline, static]

Sets the Synchronous Bandwidth And Node Position (SBC_NPOS) Register

Parameters:
dev the MOST device

Definition at line 57 of file most-sync-common.h.

References MOST_8104_SBC_REG, most_changereg, MOST_PCI_SBC_NPOS_REG, and most_readreg8104.


Variable Documentation

long sw_rx_buffer_size

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.

Referenced by most_sync_nrt_setup_rx(), and most_sync_setup_rx().

long sw_tx_buffer_size

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.

Referenced by most_sync_nrt_setup_tx(), most_sync_setup_tx(), snd_most_capture_open(), and snd_most_playback_open().

long hw_rx_buffer_size

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.

Referenced by most_sync_nrt_setup_rx(), most_sync_setup_rx(), and snd_most_new_pcm().

long hw_tx_buffer_size

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.

Referenced by most_sync_nrt_setup_tx(), most_sync_setup_tx(), snd_most_capture_open(), snd_most_new_pcm(), and snd_most_playback_open().


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