Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34919
b: refs/heads/master
c: aaad365
h: refs/heads/master
i:
  34917: e909f19
  34915: e106055
  34911: 8331d36
v: v3
  • Loading branch information
Krzysztof Helt authored and Jaroslav Kysela committed Sep 23, 2006
1 parent 98b0411 commit 1da60a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c7782b420ee137057eeec7c24a565ac85fc1988
refs/heads/master: aaad3653a5f073ce9eaef4efd387cf7fc3a53d18
65 changes: 20 additions & 45 deletions trunk/sound/sparc/dbri.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static char *cmds[] = {
#define dprintk(a, x...) if(dbri_debug & a) printk(KERN_DEBUG x)

#else
#define dprintk(a, x...)
#define dprintk(a, x...) do { } while (0)

#endif /* DBRI_DEBUG */

Expand Down Expand Up @@ -610,10 +610,10 @@ CPU interrupt to signal completion.
Since the DBRI can run in parallel with the CPU, several means of
synchronization present themselves. The method implemented here is only
to use the dbri_cmdwait() to wait for execution of batch of sent commands.
use of the dbri_cmdwait() to wait for execution of batch of sent commands.
A circular command buffer is used here. A new command is being added
while other can be executed. The scheme works by adding two WAIT commands
while another can be executed. The scheme works by adding two WAIT commands
after each sent batch of commands. When the next batch is prepared it is
added after the WAIT commands then the WAITs are replaced with single JUMP
command to the new batch. The the DBRI is forced to reread the last WAIT
Expand All @@ -628,7 +628,7 @@ to send them to the DBRI.
*/

#define MAXLOOPS 10
#define MAXLOOPS 20
/*
* Wait for the current command string to execute
*/
Expand Down Expand Up @@ -692,9 +692,8 @@ static void dbri_cmdsend(struct snd_dbri * dbri, s32 * cmd,int len)
if (cmd > dbri->cmdptr) {
s32 *ptr;

for (ptr = dbri->cmdptr; ptr < cmd+2; ptr++) {
for (ptr = dbri->cmdptr; ptr < cmd+2; ptr++)
dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
}
} else {
s32 *ptr = dbri->cmdptr;

Expand Down Expand Up @@ -1141,13 +1140,9 @@ static int setup_descs(struct snd_dbri * dbri, int streamno, unsigned int period
return -1;
}

if (streamno == DBRI_PLAY) {
dbri->dma->desc[last_desc].word1 |=
DBRI_TD_F | DBRI_TD_B;
dbri->dma->desc[last_desc].nda =
dbri->dma_dvma + dbri_dma_off(desc, first_desc);
dbri->next_desc[last_desc] = first_desc;
}
dbri->dma->desc[last_desc].nda =
dbri->dma_dvma + dbri_dma_off(desc, first_desc);
dbri->next_desc[last_desc] = first_desc;
dbri->pipes[info->pipe].first_desc = first_desc;
dbri->pipes[info->pipe].desc = first_desc;

Expand Down Expand Up @@ -1639,7 +1634,6 @@ static void xmit_descs(struct snd_dbri *dbri)
if (dbri == NULL)
return; /* Disabled */

/* First check the recording stream for buffer overflow */
info = &dbri->stream_info[DBRI_REC];
spin_lock_irqsave(&dbri->lock, flags);

Expand All @@ -1649,27 +1643,20 @@ static void xmit_descs(struct snd_dbri *dbri)
dprintk(D_DESC, "xmit_descs rec @ TD %d\n", first_td);

/* Stream could be closed by the time we run. */
if (first_td < 0) {
goto play;
}

cmd = dbri_cmdlock(dbri, 2);
*(cmd++) = DBRI_CMD(D_SDP, 0,
dbri->pipes[info->pipe].sdp
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
*(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
dbri_cmdsend(dbri, cmd, 2);
if (first_td >= 0) {
cmd = dbri_cmdlock(dbri, 2);
*(cmd++) = DBRI_CMD(D_SDP, 0,
dbri->pipes[info->pipe].sdp
| D_SDP_P | D_SDP_EVERY | D_SDP_C);
*(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
dbri_cmdsend(dbri, cmd, 2);

/* Reset our admin of the pipe & bytes read. */
dbri->pipes[info->pipe].desc = first_td;
/* Reset our admin of the pipe. */
dbri->pipes[info->pipe].desc = first_td;
}
}

play:
spin_unlock_irqrestore(&dbri->lock, flags);

/* Now check the playback stream for buffer underflow */
info = &dbri->stream_info[DBRI_PLAY];
spin_lock_irqsave(&dbri->lock, flags);

if (info->pipe >= 0) {
first_td = dbri->pipes[info->pipe].first_desc;
Expand All @@ -1685,7 +1672,7 @@ static void xmit_descs(struct snd_dbri *dbri)
*(cmd++) = dbri->dma_dvma + dbri_dma_off(desc, first_td);
dbri_cmdsend(dbri, cmd, 2);

/* Reset our admin of the pipe & bytes written. */
/* Reset our admin of the pipe. */
dbri->pipes[info->pipe].desc = first_td;
}
}
Expand Down Expand Up @@ -1755,7 +1742,6 @@ static void reception_complete_intr(struct snd_dbri * dbri, int pipe)
return;
}

dbri->dma->desc[rd].ba = 0;
dbri->pipes[pipe].desc = dbri->next_desc[rd];
status = dbri->dma->desc[rd].word1;
dbri->dma->desc[rd].word1 = 0; /* Reset it for next time. */
Expand All @@ -1768,18 +1754,6 @@ static void reception_complete_intr(struct snd_dbri * dbri, int pipe)
dprintk(D_INT, "Recv RD %d, status 0x%02x, len %d\n",
rd, DBRI_RD_STATUS(status), DBRI_RD_CNT(status));

/* On the last TD, transmit them all again. */
#if 0
if (dbri->next_desc[rd] == -1) {
if (info->left > info->size) {
printk(KERN_WARNING
"%d bytes recorded in %d size buffer.\n",
info->left, info->size);
}
tasklet_schedule(&xmit_descs_task);
}
#endif

/* Notify ALSA */
if (spin_is_locked(&dbri->lock)) {
spin_unlock(&dbri->lock);
Expand Down Expand Up @@ -2113,6 +2087,7 @@ static int snd_dbri_prepare(struct snd_pcm_substream *substream)
info->pipe = 6; /* Receive pipe */

spin_lock_irq(&dbri->lock);
info->offset = 0;

/* Setup the all the transmit/receive desciptors to cover the
* whole DMA buffer.
Expand Down

0 comments on commit 1da60a1

Please sign in to comment.