FreeBSD kernel sound device code
clone.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <dev/sound/clone.h>
Include dependency graph for clone.c:

Go to the source code of this file.

Data Structures

struct  snd_clone_entry
 
struct  snd_clone
 

Macros

#define SND_CLONE_ASSERT(...)   KASSERT(__VA_ARGS__)
 
#define SND_CLONE_ELAPSED(x, y)
 
#define SND_CLONE_EXPIRED(x, y, z)
 

Functions

struct snd_clonesnd_clone_create (int typemask, int maxunit, int deadline, uint32_t flags)
 
int snd_clone_busy (struct snd_clone *c)
 
int snd_clone_enable (struct snd_clone *c)
 
int snd_clone_disable (struct snd_clone *c)
 
int snd_clone_getsize (struct snd_clone *c)
 
int snd_clone_getmaxunit (struct snd_clone *c)
 
int snd_clone_setmaxunit (struct snd_clone *c, int maxunit)
 
int snd_clone_getdeadline (struct snd_clone *c)
 
int snd_clone_setdeadline (struct snd_clone *c, int deadline)
 
uint32_t snd_clone_getflags (struct snd_clone *c)
 
uint32_t snd_clone_setflags (struct snd_clone *c, uint32_t flags)
 
uint32_t snd_clone_getdevflags (struct cdev *dev)
 
uint32_t snd_clone_setdevflags (struct cdev *dev, uint32_t flags)
 
int snd_clone_gc (struct snd_clone *c)
 
void snd_clone_destroy (struct snd_clone *c)
 
int snd_clone_acquire (struct cdev *dev)
 
int snd_clone_release (struct cdev *dev)
 
int snd_clone_ref (struct cdev *dev)
 
int snd_clone_unref (struct cdev *dev)
 
void snd_clone_register (struct snd_clone_entry *ce, struct cdev *dev)
 
struct snd_clone_entrysnd_clone_alloc (struct snd_clone *c, struct cdev **dev, int *unit, int tmask)
 

Macro Definition Documentation

◆ SND_CLONE_ASSERT

#define SND_CLONE_ASSERT (   ...)    KASSERT(__VA_ARGS__)

Definition at line 99 of file clone.c.

◆ SND_CLONE_ELAPSED

#define SND_CLONE_ELAPSED (   x,
 
)
Value:
((((x)->tv_sec - (y)->tv_sec) * 1000) + \
(((y)->tv_nsec > (x)->tv_nsec) ? \
(((1000000000L + (x)->tv_nsec - \
(y)->tv_nsec) / 1000000) - 1000) : \
(((x)->tv_nsec - (y)->tv_nsec) / 1000000)))

Definition at line 291 of file clone.c.

◆ SND_CLONE_EXPIRED

#define SND_CLONE_EXPIRED (   x,
  y,
 
)
Value:
((x)->deadline < 1 || \
((y)->tv_sec - (z)->tv_sec) > ((x)->deadline / 1000) || \
SND_CLONE_ELAPSED(y, z) > (x)->deadline)

Definition at line 298 of file clone.c.

Function Documentation

◆ snd_clone_acquire()

int snd_clone_acquire ( struct cdev *  dev)

Definition at line 385 of file clone.c.

References dev, SND_CLONE_ASSERT, and SND_CLONE_BUSY.

Referenced by dsp_open().

Here is the caller graph for this function:

◆ snd_clone_alloc()

struct snd_clone_entry * snd_clone_alloc ( struct snd_clone c,
struct cdev **  dev,
int *  unit,
int  tmask 
)

Definition at line 519 of file clone.c.

References c, dev, pcm_channel::flags, SND_CLONE_ALLOC, SND_CLONE_ASSERT, SND_CLONE_BUSY, SND_CLONE_ENABLE, SND_CLONE_INVOKE, and SND_CLONE_WAITOK.

Referenced by dsp_clone().

Here is the caller graph for this function:

◆ snd_clone_busy()

int snd_clone_busy ( struct snd_clone c)

Definition at line 134 of file clone.c.

References c, SND_CLONE_ASSERT, and SND_CLONE_BUSY.

Referenced by pcm_unregister().

Here is the caller graph for this function:

◆ snd_clone_create()

struct snd_clone * snd_clone_create ( int  typemask,
int  maxunit,
int  deadline,
uint32_t  flags 
)

Definition at line 106 of file clone.c.

References c, pcm_channel::flags, pcm_channel::refcount, SND_CLONE_ASSERT, SND_CLONE_MASK, and SND_CLONE_MAXUNIT.

Referenced by pcm_register().

Here is the caller graph for this function:

◆ snd_clone_destroy()

void snd_clone_destroy ( struct snd_clone c)

Definition at line 360 of file clone.c.

References c, free, and SND_CLONE_ASSERT.

Referenced by pcm_unregister().

Here is the caller graph for this function:

◆ snd_clone_disable()

int snd_clone_disable ( struct snd_clone c)

Definition at line 170 of file clone.c.

References c, pcm_channel::flags, SND_CLONE_ASSERT, and SND_CLONE_ENABLE.

Referenced by pcm_unregister().

Here is the caller graph for this function:

◆ snd_clone_enable()

int snd_clone_enable ( struct snd_clone c)

Definition at line 157 of file clone.c.

References c, pcm_channel::flags, SND_CLONE_ASSERT, and SND_CLONE_ENABLE.

Referenced by pcm_setstatus(), and pcm_unregister().

Here is the caller graph for this function:

◆ snd_clone_gc()

int snd_clone_gc ( struct snd_clone c)

Definition at line 308 of file clone.c.

References c, pcm_channel::flags, free, SND_CLONE_ASSERT, SND_CLONE_BUSY, SND_CLONE_EXPIRED, SND_CLONE_GC_ENABLE, SND_CLONE_GC_EXPIRED, SND_CLONE_GC_REVOKE, and SND_CLONE_INVOKE.

Referenced by pcm_clonereset(), and snd_clone_unref().

Here is the caller graph for this function:

◆ snd_clone_getdeadline()

int snd_clone_getdeadline ( struct snd_clone c)

Definition at line 217 of file clone.c.

References c, and SND_CLONE_ASSERT.

◆ snd_clone_getdevflags()

uint32_t snd_clone_getdevflags ( struct cdev *  dev)

Definition at line 255 of file clone.c.

References dev, and SND_CLONE_ASSERT.

◆ snd_clone_getflags()

uint32_t snd_clone_getflags ( struct snd_clone c)

Definition at line 235 of file clone.c.

References c, pcm_channel::flags, and SND_CLONE_ASSERT.

◆ snd_clone_getmaxunit()

int snd_clone_getmaxunit ( struct snd_clone c)

Definition at line 194 of file clone.c.

References c, and SND_CLONE_ASSERT.

Referenced by dsp_clone().

Here is the caller graph for this function:

◆ snd_clone_getsize()

int snd_clone_getsize ( struct snd_clone c)

Definition at line 186 of file clone.c.

References c, and SND_CLONE_ASSERT.

◆ snd_clone_ref()

int snd_clone_ref ( struct cdev *  dev)

Definition at line 450 of file clone.c.

References c, dev, pcm_channel::refcount, and SND_CLONE_ASSERT.

Referenced by dsp_open().

Here is the caller graph for this function:

◆ snd_clone_register()

void snd_clone_register ( struct snd_clone_entry ce,
struct cdev *  dev 
)

Definition at line 498 of file clone.c.

References dev, SND_CLONE_ALLOC, SND_CLONE_ASSERT, and SND_CLONE_INVOKE.

Referenced by dsp_clone().

Here is the caller graph for this function:

◆ snd_clone_release()

int snd_clone_release ( struct cdev *  dev)

Definition at line 412 of file clone.c.

References dev, SND_CLONE_ASSERT, and SND_CLONE_BUSY.

Referenced by dsp_close(), and dsp_open().

Here is the caller graph for this function:

◆ snd_clone_setdeadline()

int snd_clone_setdeadline ( struct snd_clone c,
int  deadline 
)

Definition at line 225 of file clone.c.

References c, and SND_CLONE_ASSERT.

◆ snd_clone_setdevflags()

uint32_t snd_clone_setdevflags ( struct cdev *  dev,
uint32_t  flags 
)

Definition at line 271 of file clone.c.

References dev, SND_CLONE_ASSERT, and SND_CLONE_DEVMASK.

◆ snd_clone_setflags()

uint32_t snd_clone_setflags ( struct snd_clone c,
uint32_t  flags 
)

Definition at line 243 of file clone.c.

References c, pcm_channel::flags, SND_CLONE_ASSERT, and SND_CLONE_MASK.

◆ snd_clone_setmaxunit()

int snd_clone_setmaxunit ( struct snd_clone c,
int  maxunit 
)

Definition at line 202 of file clone.c.

References c, SND_CLONE_ASSERT, and SND_CLONE_MAXUNIT.

Referenced by dsp_clone(), and pcm_clonereset().

Here is the caller graph for this function:

◆ snd_clone_unref()

int snd_clone_unref ( struct cdev *  dev)

Definition at line 469 of file clone.c.

References c, dev, pcm_channel::flags, pcm_channel::refcount, SND_CLONE_ASSERT, snd_clone_gc(), SND_CLONE_GC_LASTREF, and SND_CLONE_GC_UNREF.

Referenced by dsp_close().

Here is the call graph for this function:
Here is the caller graph for this function: