uint8_tbuffer[BUFFER_SIZE];/* buffer for mmc data */
uint8_tpos=0;/* current playing position */
uint8_trefresh_buffer=0;/* position to start buffer refreshing */
#define BUFFER_SIZE 32
uint16_tbuffer[BUFFER_SIZE];/* buffer for mmc data */
/*ISR(TIMER1_OVF1_vect, ISR_NAKED)
{
@ -53,7 +48,7 @@ uint8_t refresh_buffer = 0;/* position to start buffer refreshing */
cnt_to_next=8;
needs_new_data_flag=1;
}
__asm__("out 0x2f,r2");// restore sreg
__asm__("out 0x3f,r2");// restore sreg
reti();
}//*/
@ -77,26 +72,21 @@ ISR(TIMER1_OVF1_vect){
intmain(void)__attribute__((noreturn));
intmain(void)
{
uint8_tref;// TODO: what does this do?
ringbuf_trb;
ringbuf_init(&rb,buffer,BUFFER_SIZE);
if(mmc_init()!=0){/* mmc fail */;}
mmc_read_part(0,length,4);
timer_init_tiny26();
sei();
for(;;)
unsignedlongblock=0;
for(;;block++)
{
if(pos==refresh_buffer)/* refresh buffer if running low */
{
/* TODO: this won't do. we don't have enough time to read unnecessary bytes -> read data with the same speed as we consume it, keeping a small buffer. */
/* expect 2 bit read from mmc between 2 timer interrupts --> 2 byte read per sample played */