lisodsp.h File Reference


Detailed Description

lisodsp global header file.

Author:
Benjamin Gerard <ben@sashipa.com>
Date:
2004/05/12

#include <linux/config.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/major.h>
#include <linux/module.h>
#include <linux/modversions.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/sound.h>
#include <linux/soundcard.h>
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/tqueue.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <asm/atomic.h>
#include <asm/byteorder.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include "lisodsp_debug.h"

Go to the source code of this file.

Data Structures

struct  liso_convertor_t
 Audio format convertor info. More...

struct  liso_frag_t
 A fragment. More...

struct  liso_frags_t
 Fragments. More...

struct  liso_subdev_t
 Sub-Device info. More...

struct  _liso_t
 lisodsp info structure. More...


Sub-device status bits.

#define LISO_DEVICE_USED   0
 0:device-used 1:device-free

#define LISO_DEVICE_IDLE   1
 0:device-ready 1:device-idle

#define LISO_DEVICE_DEAD   2
 0:device-ok 1:device-dead

#define LISO_DEVICE_SLEEP   3
 0:device-awake 1:device-asleep

#define LISO_DEVICE_ALERT   4
 0:No Alert 1:Alert (really awaited)

#define LISO_DEVICE_USED_MSK   (1<<LISO_DEVICE_USED)
 Useful bit mask combinaisons.

#define LISO_DEVICE_IDLE_MSK   (1<<LISO_DEVICE_IDLE)
 0:device-used 1:device-free

#define LISO_DEVICE_DEAD_MSK   (1<<LISO_DEVICE_DEAD)
 0:device-used 1:device-free

#define LISO_DEVICE_UD_MSK   (LISO_DEVICE_USED_MSK|LISO_DEVICE_DEAD_MSK)
 0:device-used 1:device-free

#define LISO_DEVICE_UID_MSK   (LISO_DEVICE_IDLE_MSK|LISO_DEVICE_UD_MSK)
 0:device-used 1:device-free


PCM convertor functions

const liso_convertor_tliso_pcmconv_get (int fmt)
 Get convertor info for a given format.

char * liso_pcmconv_desc (const liso_convertor_t *convertor, liso_fmt_desc_t buf, int sampling, int stereo)
 Make a description string.

int liso_pcmconv_get_fmts (void)
 Get supported audio format.


Fragment functions

void liso_frag_mix (liso_frag_t *const d, const liso_frag_t *const s)
 Mix two fragments.


Setup functions

void liso_subdev_preinit (liso_subdev_t *const sd, liso_t *const lisodsp, int chn)
 Pre-init sub-device.

int liso_subdev_init (liso_subdev_t *const sd)
 Init sub-device.

int liso_subdev_set_format (liso_subdev_t *const sd)
 Commit requested format.

void liso_subdev_set_cur_frag (liso_subdev_t *const sd)
 Copy current format information for the next frag to process.


Status functions.

const char * liso_subdev_status (const liso_subdev_t *const sd)
 Get device status description string.

void liso_subdev_asleep (liso_subdev_t *const sd)
 Make sub-device sleep.

void liso_subdev_wakeup_partner (liso_subdev_t *const sd)
 Wake up partner sub-device(s).

int liso_subdev_has_sleepy_partner (liso_subdev_t *const sd)
 Test for partner to wake up.

int liso_subdev_is_reader (const liso_subdev_t *const sd)
 Test if sub-device is a reader.

int liso_subdev_is_writer (const liso_subdev_t *const sd)
 Test if sub-device is a writer.

int liso_subdev_is_active (const liso_subdev_t *const sd)
 Test if sub-device is active.

int liso_subdev_is_valid (const liso_subdev_t *const sd)
 Test if sub-device is valid.


Locking functions

int liso_subdev_lock (liso_subdev_t *sd)
 Lock sub-device.

int liso_subdev_trylock (liso_subdev_t *sd)
 Try lock sub-device.

int liso_subdev_xlock (liso_subdev_t *sd, const int nonblock)
 Extended lock of sub-device.

void liso_subdev_unlock (liso_subdev_t *sd)
 Unlock sub-device.


Filesystem functions

int liso_writer_open (struct inode *inode, struct file *filp)
 Open file operation for writer sub-devices.

int liso_reader_open (struct inode *inode, struct file *filp)
 Open file operation for reader sub-devices.

int liso_subdev_release (struct inode *inode, struct file *filp)
 Release sub-device.

int liso_subdev_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
 ioctl file operation for sub-devices.

unsigned int liso_subdevice_poll (struct file *filp, poll_table *wait)
 Poll file operation for sub-devices.


Synchronize functions

int liso_subdev_wait_idx (liso_subdev_t *const sd, const int idx)
 Wait until reader reach a given idx.

int liso_subdev_synchronize (liso_subdev_t *const sd, const int lock)
 Synchromize writer device with the reader.

void liso_writer_synchronize (liso_subdev_t *const writer)
 Synchronize a writer device.

void liso_reader_synchronize (liso_subdev_t *const reader)
 Synchronize a reader device.

int liso_writer_flush (liso_subdev_t *const writer)
 Flush writer buffer.


Init functions

int liso_device_init (liso_t *lisodsp)
 Init device driver.

int liso_device_shutdown (liso_t *lisodsp)
 Shutdown device driver.


Wake up functions

void liso_wakeup_writers (liso_t *lisodsp)
 Wake up sleepy writers.

void liso_wakeup_reader (liso_t *lisodsp)
 Wake up sleepy reader.


Timer functions

start/stop device timer.

The timer is used to simulate the device reader by flushing out PCM silently at a given rate. It allows user process to keep time synchronizing themself with the write() function by assuming it is blocking. The PCM-fragment size depends directly on Linux timer granularity (as defined by the HZ constant in linux source) in a manner that the time to play a fragment must be a multiple of the timer period (1/HZ second).

int liso_timer_start (liso_t *lisodsp, unsigned int offset, void(*task)(void *))
 Start the timer.

int liso_timer_stop (liso_t *lisodsp)
 Stop the timer.


ProcFS functions

int liso_proc_init (liso_t *lisodsp)
 Init lisodsp procfs support.

int liso_proc_shutdown (liso_t *lisodsp)
 Shutdown lisodsp procfs support.


Defines

#define LISO_MAX_SUBDEV   (sizeof(int)<<3)
 Maximum number of sub-device.

#define LISO_MAX_CHANNEL   (LISO_MAX_SUBDEV-1)
 Maximum number of mixed channel (device writer).

#define LISO_DEF_CHANNEL   8
 Default maximum number of mixed channel.

#define LISO_RD_CHANNEL   LISO_MAX_CHANNEL
 Channel id reserved for reader.

#define LISO_RD_MASK   (1<<LISO_RD_CHANNEL)
 Bit mask for reader.

#define LISO_DEF_SAMPLING   44100
 Maximal sampling rate.

#define LISO_MAX_SAMPLING   48000
 Maximal sampling rate.

#define LISO_MIN_SAMPLING   (LISO_MAX_SAMPLING/10)
 Minimal sampling rate.

#define LISO_DEF_FORMAT_STR   "S2WN"
 Default format string ([S]igned [2]-channel [W]ord [N]ative-endian).

#define LISO_MIXER_FIX   14
 Mixer scale factor fixed point bit.


Typedefs

typedef _liso_t liso_t
typedef void(* liso_topcm_t )(int *d, const void *s, int n)
 To internal PCM conversion.

typedef void(* liso_tofmt_t )(void *d, const int *s, const int f, int n)
 From internal PCM conversion.

typedef char liso_fmt_desc_t [24]
 Format description string.


Functions

int liso_device_update_active (liso_t *const lisodsp)
 Check active status for all sub-devices.

int liso_device_active_writers (const liso_t *const lisodsp)
 Get current active writers.


Variables

liso_t g_lisodsp
 The global lisodsp object.

int liso_volume []
 Attenuation factors.


lisodsp logo lisodsp developer documentation
version 0.5.0
Generated on June 2004
by doxygen 1.3.7