Specifications

* First pre-release with 2.4 stack
*
*/
/*
* MP3 player with network interface.
* The Ethernut code
* Engineering Thesis 2002
* Modified by Michael Somersmith
* Added different buffer controls
*/
#include <interrupt.h>
#include <sys/event.h>
#include "vs1001k.h"
static u_char writeDelay = 0;
u_char * volatile tx_ptr;
u_char * volatile wr_ptr;
static volatile u_char tx_act;
static u_char *mem_start;
static u_char *mem_end;
static u_char *mem_flip;
static u_short empty = 0;
static HANDLE q_dreq = 0;
/*!
* Data request interrupt service.
*/
static void VsDataRequest(void *arg)
{
u_char yd;
if(tx_act) {
sbi(VS_XCS_PORT, VS_XCS_BIT);
/*
* Write MP3 data until either no more
* data is available or the chip clears
* the DREQ line.
*/
for(;;) {
sbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
outp(*tx_ptr, SPDR);
asm volatile("nop\n\tnop\n\tnop");
cbi(VS_BSYNC_PORT, VS_BSYNC_BIT);
if(++tx_ptr > mem_flip)
tx_ptr = mem_start;
loop_until_bit_is_set(SPSR, SPIF);
/*
* Stop transfer if our data buffer is empty.
95