FreeBSD kernel sound device code
midiq.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIDIQ_MOVE(a, b, c)   bcopy(b,a,c)
 
#define MIDIQ_HEAD(name, type)
 
#define MIDIQ_INIT(head, buf, size)
 
#define MIDIQ_EMPTY(head)   ((head).h == (head).t )
 
#define MIDIQ_LENBASE(head)
 
#define MIDIQ_FULL(head)   ((head).h == -1)
 
#define MIDIQ_AVAIL(head)   (MIDIQ_FULL(head) ? 0 : (head).s - MIDIQ_LENBASE(head))
 
#define MIDIQ_LEN(head)   ((head).s - MIDIQ_AVAIL(head))
 
#define MIDIQ_DEBUG   0
 
#define MIDIQ_ENQ(head, buf, size)
 
#define MIDIQ_DEQ_I(head, buf, size, move, update)
 
#define MIDIQ_SIZE(head)   ((head).s)
 
#define MIDIQ_CLEAR(head)   ((head).h = (head).t = 0)
 
#define MIDIQ_BUF(head)   ((head).b)
 
#define MIDIQ_DEQ(head, buf, size)   MIDIQ_DEQ_I(head, buf, size, 1, 1)
 
#define MIDIQ_PEEK(head, buf, size)   MIDIQ_DEQ_I(head, buf, size, 1, 0)
 
#define MIDIQ_POP(head, size)   MIDIQ_DEQ_I(head, &head, size, 0, 1)
 

Macro Definition Documentation

◆ MIDIQ_AVAIL

#define MIDIQ_AVAIL (   head)    (MIDIQ_FULL(head) ? 0 : (head).s - MIDIQ_LENBASE(head))

Definition at line 55 of file midiq.h.

◆ MIDIQ_BUF

#define MIDIQ_BUF (   head)    ((head).b)

Definition at line 103 of file midiq.h.

◆ MIDIQ_CLEAR

#define MIDIQ_CLEAR (   head)    ((head).h = (head).t = 0)

Definition at line 102 of file midiq.h.

◆ MIDIQ_DEBUG

#define MIDIQ_DEBUG   0

Definition at line 57 of file midiq.h.

◆ MIDIQ_DEQ

#define MIDIQ_DEQ (   head,
  buf,
  size 
)    MIDIQ_DEQ_I(head, buf, size, 1, 1)

Definition at line 104 of file midiq.h.

◆ MIDIQ_DEQ_I

#define MIDIQ_DEQ_I (   head,
  buf,
  size,
  move,
  update 
)
Value:
do { \
if(MIDIQ_FULL(head)) (head).h=(head).t; \
printf("#1 %p %p bytes copied %jd tran req s %d h %d t %d\n", &(head).b[(head).t], (buf), (intmax_t)sizeof(*(head).b) * MIN((size), (head).s - (head).t), (size), (head).h, (head).t); \
if (move) MIDIQ_MOVE((buf), &(head).b[(head).t], sizeof(*(head).b) * MIN((size), (head).s - (head).t)); \
if( (head).s - (head).t < (size) ) { \
printf("#2 %p %p bytes copied %jd\n", (head).b, (buf) + (head).s - (head).t, (intmax_t)sizeof(*(head).b) * ((size) - (head).s + (head).t) ); \
if (move) MIDIQ_MOVE((buf) + (head).s - (head).t, (head).b, sizeof(*(head).b) * ((size) - (head).s + (head).t) ); \
} \
if (update) { \
(head).t+=(size); \
(head).t%=(head).s; \
} else { \
if (MIDIQ_EMPTY(head)) (head).h=-1; \
} \
printf("#E h %d t %d\n", (head).h, (head).t); \
} while (0)
struct snd_dbuf * b
Definition: channel_if.m:105
bus_addr_t buf
Definition: hdac_if.m:63
#define MIDIQ_DEBUG
Definition: midiq.h:57
#define MIDIQ_MOVE(a, b, c)
Definition: midiq.h:34
#define MIDIQ_FULL(head)
Definition: midiq.h:54
#define MIDIQ_EMPTY(head)
Definition: midiq.h:48

Definition at line 81 of file midiq.h.

◆ MIDIQ_EMPTY

#define MIDIQ_EMPTY (   head)    ((head).h == (head).t )

Definition at line 48 of file midiq.h.

◆ MIDIQ_ENQ

#define MIDIQ_ENQ (   head,
  buf,
  size 
)
Value:
do { \
printf("#1 %p %p bytes copied %jd tran req s %d h %d t %d\n", \
&(head).b[(head).h], (buf), \
(intmax_t)(sizeof(*(head).b) * \
MIN( (size), (head).s - (head).h) ), \
(size), (head).h, (head).t); \
MIDIQ_MOVE(&(head).b[(head).h], (buf), sizeof(*(head).b) * MIN((size), (head).s - (head).h)); \
if( (head).s - (head).h < (size) ) { \
printf("#2 %p %p bytes copied %jd\n", (head).b, (buf) + (head).s - (head).h, (intmax_t)sizeof(*(head).b) * ((size) - (head).s + (head).h) ); \
MIDIQ_MOVE((head).b, (buf) + (head).s - (head).h, sizeof(*(head).b) * ((size) - (head).s + (head).h) ); \
} \
(head).h+=(size); \
(head).h%=(head).s; \
if(MIDIQ_EMPTY(head)) (head).h=-1; \
printf("#E h %d t %d\n", (head).h, (head).t); \
} while (0)

Definition at line 61 of file midiq.h.

◆ MIDIQ_FULL

#define MIDIQ_FULL (   head)    ((head).h == -1)

Definition at line 54 of file midiq.h.

◆ MIDIQ_HEAD

#define MIDIQ_HEAD (   name,
  type 
)
Value:
struct name { \
int h, t, s; \
type * b; \
}
const char * name
Definition: audio_soc.c:90

Definition at line 36 of file midiq.h.

◆ MIDIQ_INIT

#define MIDIQ_INIT (   head,
  buf,
  size 
)
Value:
do { \
(head).h=(head).t=0; \
(head).s=size; \
(head).b=buf; \
} while (0)

Definition at line 42 of file midiq.h.

◆ MIDIQ_LEN

#define MIDIQ_LEN (   head)    ((head).s - MIDIQ_AVAIL(head))

Definition at line 56 of file midiq.h.

◆ MIDIQ_LENBASE

#define MIDIQ_LENBASE (   head)
Value:
((head).h - (head).t < 0 ? \
(head).h - (head).t + (head).s : \
(head).h - (head).t)

Definition at line 50 of file midiq.h.

◆ MIDIQ_MOVE

#define MIDIQ_MOVE (   a,
  b,
  c 
)    bcopy(b,a,c)

Definition at line 34 of file midiq.h.

◆ MIDIQ_PEEK

#define MIDIQ_PEEK (   head,
  buf,
  size 
)    MIDIQ_DEQ_I(head, buf, size, 1, 0)

Definition at line 105 of file midiq.h.

◆ MIDIQ_POP

#define MIDIQ_POP (   head,
  size 
)    MIDIQ_DEQ_I(head, &head, size, 0, 1)

Definition at line 106 of file midiq.h.

◆ MIDIQ_SIZE

#define MIDIQ_SIZE (   head)    ((head).s)

Definition at line 101 of file midiq.h.