Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
vwsnd.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <asm/visws/cobalt.h>
#include "sound_config.h"

Go to the source code of this file.

Data Structures

struct  lithium
 
struct  dma_chan_desc
 
struct  dma_chan
 
struct  ustmsc
 
struct  ad1843_bitfield
 
struct  ad1843_gain
 
struct  vwsnd_port
 
struct  vwsnd_dev
 

Macros

#define ASSERT(e)   ((void) 0)
 
#define DBGDO(x)   /* don't */
 
#define DBGX(fmt, args...)   ((void) 0)
 
#define DBGP(fmt, args...)   ((void) 0)
 
#define DBGE(fmt, args...)   ((void) 0)
 
#define DBGC(rtn)   ((void) 0)
 
#define DBGR()   ((void) 0)
 
#define DBGPV(fmt, args...)   ((void) 0)
 
#define DBGXV(fmt, args...)   ((void) 0)
 
#define DBGEV(fmt, args...)   ((void) 0)
 
#define DBGCV(rtn)   ((void) 0)
 
#define DBGRV()   ((void) 0)
 
#define LI_HOST_CONTROLLER   0x000
 
#define LI_HC_RESET   0x00008000
 
#define LI_HC_LINK_ENABLE   0x00004000
 
#define LI_HC_LINK_FAILURE   0x00000004
 
#define LI_HC_LINK_CODEC   0x00000002
 
#define LI_HC_LINK_READY   0x00000001
 
#define LI_INTR_STATUS   0x010
 
#define LI_INTR_MASK   0x014
 
#define LI_INTR_LINK_ERR   0x00008000
 
#define LI_INTR_COMM2_TRIG   0x00000008
 
#define LI_INTR_COMM2_UNDERFLOW   0x00000004
 
#define LI_INTR_COMM1_TRIG   0x00000002
 
#define LI_INTR_COMM1_OVERFLOW   0x00000001
 
#define LI_CODEC_COMMAND   0x018
 
#define LI_CC_BUSY   0x00008000
 
#define LI_CC_DIR   0x00000080
 
#define LI_CC_DIR_RD   LI_CC_DIR
 
#define LI_CC_DIR_WR   (!LI_CC_DIR)
 
#define LI_CC_ADDR_MASK   0x0000007F
 
#define LI_CODEC_DATA   0x01C
 
#define LI_COMM1_BASE   0x100
 
#define LI_COMM1_CTL   0x104
 
#define LI_CCTL_RESET   0x80000000
 
#define LI_CCTL_SIZE   0x70000000
 
#define LI_CCTL_DMA_ENABLE   0x08000000
 
#define LI_CCTL_TMASK   0x07000000 /* trigger mask */
 
#define LI_CCTL_TPTR   0x00FF0000 /* trigger pointer */
 
#define LI_CCTL_RPTR   0x0000FF00
 
#define LI_CCTL_WPTR   0x000000FF
 
#define LI_COMM1_CFG   0x108
 
#define LI_CCFG_LOCK   0x00008000
 
#define LI_CCFG_SLOT   0x00000070
 
#define LI_CCFG_DIRECTION   0x00000008
 
#define LI_CCFG_DIR_IN   (!LI_CCFG_DIRECTION)
 
#define LI_CCFG_DIR_OUT   LI_CCFG_DIRECTION
 
#define LI_CCFG_MODE   0x00000004
 
#define LI_CCFG_MODE_MONO   (!LI_CCFG_MODE)
 
#define LI_CCFG_MODE_STEREO   LI_CCFG_MODE
 
#define LI_CCFG_FORMAT   0x00000003
 
#define LI_CCFG_FMT_8BIT   0x00000000
 
#define LI_CCFG_FMT_16BIT   0x00000001
 
#define LI_COMM2_BASE   0x10C
 
#define LI_COMM2_CTL   0x110
 
#define LI_COMM2_CFG   0x114
 
#define LI_UST_LOW   0x200 /* 64-bit Unadjusted System Time is */
 
#define LI_UST_HIGH   0x204 /* microseconds since boot */
 
#define LI_AUDIO1_UST   0x300 /* UST-MSC pairs */
 
#define LI_AUDIO1_MSC   0x304 /* MSC (Media Stream Counter) */
 
#define LI_AUDIO2_UST   0x308 /* counts samples actually */
 
#define LI_AUDIO2_MSC   0x30C /* processed as of time UST */
 
#define DMACHUNK_SHIFT   5
 
#define DMACHUNK_SIZE   (1 << DMACHUNK_SHIFT)
 
#define BYTES_TO_CHUNKS(bytes)   ((bytes) >> DMACHUNK_SHIFT)
 
#define CHUNKS_TO_BYTES(chunks)   ((chunks) << DMACHUNK_SHIFT)
 
#define SHIFT_FIELD(val, mask)   (((val) * ((mask) & -(mask))) & (mask))
 
#define UNSHIFT_FIELD(val, mask)   (((val) & (mask)) / ((mask) & -(mask)))
 
#define READ_INTR_MASK   (LI_INTR_COMM1_TRIG | LI_INTR_COMM1_OVERFLOW)
 
#define WRITE_INTR_MASK   (LI_INTR_COMM2_TRIG | LI_INTR_COMM2_UNDERFLOW)
 
#define INC_USE_COUNT   (atomic_inc(&vwsnd_use_count))
 
#define DEC_USE_COUNT   (atomic_dec(&vwsnd_use_count))
 
#define IN_USE   (atomic_read(&vwsnd_use_count) != 0)
 
#define HWBUF_SHIFT   13
 
#define HWBUF_SIZE   (1 << HWBUF_SHIFT)
 
#define HBO   (HWBUF_SHIFT > PAGE_SHIFT ? HWBUF_SHIFT - PAGE_SHIFT : 0)
 
#define HWBUF_ORDER   (HBO + 1) /* next size bigger */
 
#define MIN_SPEED   4000
 
#define MAX_SPEED   49000
 
#define MIN_FRAGSHIFT   (DMACHUNK_SHIFT + 1)
 
#define MAX_FRAGSHIFT   (PAGE_SHIFT)
 
#define MIN_FRAGSIZE   (1 << MIN_FRAGSHIFT)
 
#define MAX_FRAGSIZE   (1 << MAX_FRAGSHIFT)
 
#define MIN_FRAGCOUNT(fragsize)   3
 
#define MAX_FRAGCOUNT(fragsize)   (32 * PAGE_SIZE / (fragsize))
 
#define DEFAULT_FRAGSHIFT   12
 
#define DEFAULT_FRAGCOUNT   16
 
#define DEFAULT_SUBDIVSHIFT   0
 

Typedefs

typedef struct lithium lithium_t
 
typedef struct dma_chan_desc dma_chan_desc_t
 
typedef struct dma_chan dma_chan_t
 
typedef struct ustmsc ustmsc_t
 
typedef struct ad1843_bitfield ad1843_bitfield_t
 
typedef struct ad1843_gain ad1843_gain_t
 
typedef enum vwsnd_port_swstate vwsnd_port_swstate_t
 
typedef enum vwsnd_port_hwstate vwsnd_port_hwstate_t
 
typedef enum vwsnd_port_flags vwsnd_port_flags_t
 
typedef struct vwsnd_port vwsnd_port_t
 
typedef struct vwsnd_dev vwsnd_dev_t
 

Enumerations

enum  { LI_PAGE0_OFFSET = 0x01000 - 0x1000, LI_PAGE1_OFFSET = 0x0F000 - 0x1000, LI_PAGE2_OFFSET = 0x10000 - 0x1000 }
 
enum  vwsnd_port_swstate { SW_OFF, SW_INITIAL, SW_RUN, SW_DRAIN }
 
enum  vwsnd_port_hwstate { HW_STOPPED, HW_RUNNING }
 
enum  vwsnd_port_flags { DISABLED = 1 << 0, ERFLOWN = 1 << 1, HW_BUSY = 1 << 2 }
 

Functions

 MODULE_DESCRIPTION ("SGI Visual Workstation sound module")
 
 MODULE_AUTHOR ("Bob Miller <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 
 module_init (init_vwsnd)
 
 module_exit (cleanup_vwsnd)
 

Macro Definition Documentation

#define ASSERT (   e)    ((void) 0)

Definition at line 213 of file vwsnd.c.

#define BYTES_TO_CHUNKS (   bytes)    ((bytes) >> DMACHUNK_SHIFT)

Definition at line 433 of file vwsnd.c.

#define CHUNKS_TO_BYTES (   chunks)    ((chunks) << DMACHUNK_SHIFT)

Definition at line 434 of file vwsnd.c.

#define DBGC (   rtn)    ((void) 0)

Definition at line 218 of file vwsnd.c.

#define DBGCV (   rtn)    ((void) 0)

Definition at line 223 of file vwsnd.c.

#define DBGDO (   x)    /* don't */

Definition at line 214 of file vwsnd.c.

#define DBGE (   fmt,
  args... 
)    ((void) 0)

Definition at line 217 of file vwsnd.c.

#define DBGEV (   fmt,
  args... 
)    ((void) 0)

Definition at line 222 of file vwsnd.c.

#define DBGP (   fmt,
  args... 
)    ((void) 0)

Definition at line 216 of file vwsnd.c.

#define DBGPV (   fmt,
  args... 
)    ((void) 0)

Definition at line 220 of file vwsnd.c.

#define DBGR ( )    ((void) 0)

Definition at line 219 of file vwsnd.c.

#define DBGRV ( )    ((void) 0)

Definition at line 224 of file vwsnd.c.

#define DBGX (   fmt,
  args... 
)    ((void) 0)

Definition at line 215 of file vwsnd.c.

#define DBGXV (   fmt,
  args... 
)    ((void) 0)

Definition at line 221 of file vwsnd.c.

#define DEC_USE_COUNT   (atomic_dec(&vwsnd_use_count))

Definition at line 1527 of file vwsnd.c.

#define DEFAULT_FRAGCOUNT   16

Definition at line 1557 of file vwsnd.c.

#define DEFAULT_FRAGSHIFT   12

Definition at line 1556 of file vwsnd.c.

#define DEFAULT_SUBDIVSHIFT   0

Definition at line 1558 of file vwsnd.c.

#define DMACHUNK_SHIFT   5

Definition at line 431 of file vwsnd.c.

#define DMACHUNK_SIZE   (1 << DMACHUNK_SHIFT)

Definition at line 432 of file vwsnd.c.

#define HBO   (HWBUF_SHIFT > PAGE_SHIFT ? HWBUF_SHIFT - PAGE_SHIFT : 0)

Definition at line 1545 of file vwsnd.c.

#define HWBUF_ORDER   (HBO + 1) /* next size bigger */

Definition at line 1546 of file vwsnd.c.

#define HWBUF_SHIFT   13

Definition at line 1543 of file vwsnd.c.

#define HWBUF_SIZE   (1 << HWBUF_SHIFT)

Definition at line 1544 of file vwsnd.c.

#define IN_USE   (atomic_read(&vwsnd_use_count) != 0)

Definition at line 1528 of file vwsnd.c.

#define INC_USE_COUNT   (atomic_inc(&vwsnd_use_count))

Definition at line 1526 of file vwsnd.c.

#define LI_AUDIO1_MSC   0x304 /* MSC (Media Stream Counter) */

Definition at line 422 of file vwsnd.c.

#define LI_AUDIO1_UST   0x300 /* UST-MSC pairs */

Definition at line 421 of file vwsnd.c.

#define LI_AUDIO2_MSC   0x30C /* processed as of time UST */

Definition at line 424 of file vwsnd.c.

#define LI_AUDIO2_UST   0x308 /* counts samples actually */

Definition at line 423 of file vwsnd.c.

#define LI_CC_ADDR_MASK   0x0000007F

Definition at line 387 of file vwsnd.c.

#define LI_CC_BUSY   0x00008000

Definition at line 383 of file vwsnd.c.

#define LI_CC_DIR   0x00000080

Definition at line 384 of file vwsnd.c.

#define LI_CC_DIR_RD   LI_CC_DIR

Definition at line 385 of file vwsnd.c.

#define LI_CC_DIR_WR   (!LI_CC_DIR)

Definition at line 386 of file vwsnd.c.

#define LI_CCFG_DIR_IN   (!LI_CCFG_DIRECTION)

Definition at line 404 of file vwsnd.c.

#define LI_CCFG_DIR_OUT   LI_CCFG_DIRECTION

Definition at line 405 of file vwsnd.c.

#define LI_CCFG_DIRECTION   0x00000008

Definition at line 403 of file vwsnd.c.

#define LI_CCFG_FMT_16BIT   0x00000001

Definition at line 411 of file vwsnd.c.

#define LI_CCFG_FMT_8BIT   0x00000000

Definition at line 410 of file vwsnd.c.

#define LI_CCFG_FORMAT   0x00000003

Definition at line 409 of file vwsnd.c.

#define LI_CCFG_LOCK   0x00008000

Definition at line 401 of file vwsnd.c.

#define LI_CCFG_MODE   0x00000004

Definition at line 406 of file vwsnd.c.

#define LI_CCFG_MODE_MONO   (!LI_CCFG_MODE)

Definition at line 407 of file vwsnd.c.

#define LI_CCFG_MODE_STEREO   LI_CCFG_MODE

Definition at line 408 of file vwsnd.c.

#define LI_CCFG_SLOT   0x00000070

Definition at line 402 of file vwsnd.c.

#define LI_CCTL_DMA_ENABLE   0x08000000

Definition at line 395 of file vwsnd.c.

#define LI_CCTL_RESET   0x80000000

Definition at line 393 of file vwsnd.c.

#define LI_CCTL_RPTR   0x0000FF00

Definition at line 398 of file vwsnd.c.

#define LI_CCTL_SIZE   0x70000000

Definition at line 394 of file vwsnd.c.

#define LI_CCTL_TMASK   0x07000000 /* trigger mask */

Definition at line 396 of file vwsnd.c.

#define LI_CCTL_TPTR   0x00FF0000 /* trigger pointer */

Definition at line 397 of file vwsnd.c.

#define LI_CCTL_WPTR   0x000000FF

Definition at line 399 of file vwsnd.c.

#define LI_CODEC_COMMAND   0x018

Definition at line 382 of file vwsnd.c.

#define LI_CODEC_DATA   0x01C

Definition at line 389 of file vwsnd.c.

#define LI_COMM1_BASE   0x100

Definition at line 391 of file vwsnd.c.

#define LI_COMM1_CFG   0x108

Definition at line 400 of file vwsnd.c.

#define LI_COMM1_CTL   0x104

Definition at line 392 of file vwsnd.c.

#define LI_COMM2_BASE   0x10C

Definition at line 412 of file vwsnd.c.

#define LI_COMM2_CFG   0x114

Definition at line 415 of file vwsnd.c.

#define LI_COMM2_CTL   0x110

Definition at line 413 of file vwsnd.c.

#define LI_HC_LINK_CODEC   0x00000002

Definition at line 371 of file vwsnd.c.

#define LI_HC_LINK_ENABLE   0x00004000

Definition at line 369 of file vwsnd.c.

#define LI_HC_LINK_FAILURE   0x00000004

Definition at line 370 of file vwsnd.c.

#define LI_HC_LINK_READY   0x00000001

Definition at line 372 of file vwsnd.c.

#define LI_HC_RESET   0x00008000

Definition at line 368 of file vwsnd.c.

#define LI_HOST_CONTROLLER   0x000

Definition at line 367 of file vwsnd.c.

#define LI_INTR_COMM1_OVERFLOW   0x00000001

Definition at line 380 of file vwsnd.c.

#define LI_INTR_COMM1_TRIG   0x00000002

Definition at line 379 of file vwsnd.c.

#define LI_INTR_COMM2_TRIG   0x00000008

Definition at line 377 of file vwsnd.c.

#define LI_INTR_COMM2_UNDERFLOW   0x00000004

Definition at line 378 of file vwsnd.c.

#define LI_INTR_LINK_ERR   0x00008000

Definition at line 376 of file vwsnd.c.

#define LI_INTR_MASK   0x014

Definition at line 375 of file vwsnd.c.

#define LI_INTR_STATUS   0x010

Definition at line 374 of file vwsnd.c.

#define LI_UST_HIGH   0x204 /* microseconds since boot */

Definition at line 419 of file vwsnd.c.

#define LI_UST_LOW   0x200 /* 64-bit Unadjusted System Time is */

Definition at line 418 of file vwsnd.c.

#define MAX_FRAGCOUNT (   fragsize)    (32 * PAGE_SIZE / (fragsize))

Definition at line 1555 of file vwsnd.c.

#define MAX_FRAGSHIFT   (PAGE_SHIFT)

Definition at line 1551 of file vwsnd.c.

#define MAX_FRAGSIZE   (1 << MAX_FRAGSHIFT)

Definition at line 1553 of file vwsnd.c.

#define MAX_SPEED   49000

Definition at line 1548 of file vwsnd.c.

#define MIN_FRAGCOUNT (   fragsize)    3

Definition at line 1554 of file vwsnd.c.

#define MIN_FRAGSHIFT   (DMACHUNK_SHIFT + 1)

Definition at line 1550 of file vwsnd.c.

#define MIN_FRAGSIZE   (1 << MIN_FRAGSHIFT)

Definition at line 1552 of file vwsnd.c.

#define MIN_SPEED   4000

Definition at line 1547 of file vwsnd.c.

#define READ_INTR_MASK   (LI_INTR_COMM1_TRIG | LI_INTR_COMM1_OVERFLOW)

Definition at line 1417 of file vwsnd.c.

#define SHIFT_FIELD (   val,
  mask 
)    (((val) * ((mask) & -(mask))) & (mask))

Definition at line 444 of file vwsnd.c.

#define UNSHIFT_FIELD (   val,
  mask 
)    (((val) & (mask)) / ((mask) & -(mask)))

Definition at line 445 of file vwsnd.c.

#define WRITE_INTR_MASK   (LI_INTR_COMM2_TRIG | LI_INTR_COMM2_UNDERFLOW)

Definition at line 1418 of file vwsnd.c.

Typedef Documentation

Enumeration Type Documentation

anonymous enum
Enumerator:
LI_PAGE0_OFFSET 
LI_PAGE1_OFFSET 
LI_PAGE2_OFFSET 

Definition at line 236 of file vwsnd.c.

Enumerator:
DISABLED 
ERFLOWN 
HW_BUSY 

Definition at line 1436 of file vwsnd.c.

Enumerator:
HW_STOPPED 
HW_RUNNING 

Definition at line 1427 of file vwsnd.c.

Enumerator:
SW_OFF 
SW_INITIAL 
SW_RUN 
SW_DRAIN 

Definition at line 1420 of file vwsnd.c.

Function Documentation

MODULE_AUTHOR ( "Bob Miller <[email protected]>"  )
MODULE_DESCRIPTION ( "SGI Visual Workstation sound module )
module_exit ( cleanup_vwsnd  )
module_init ( init_vwsnd  )
MODULE_LICENSE ( "GPL"  )