streo mp3 player see: http://mbed.org/users/okini3939/notebook/I2S_AUDIO

Dependencies:   FatFileSystemCpp I2SSlave TLV320 mbed

Fork of madplayer by Andreas Grün

Committer:
okini3939
Date:
Fri Jul 26 15:02:49 2013 +0000
Revision:
5:50015f4868e2
Parent:
4:30b2cf4a8ee2
fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gruenfrosch 2:f28cf0afd021 1 #include "mbed.h"
Gruenfrosch 2:f28cf0afd021 2 #include "config.h"
Gruenfrosch 2:f28cf0afd021 3
Gruenfrosch 2:f28cf0afd021 4 static char *free_ptr = (char *)AHBMEM;
Gruenfrosch 2:f28cf0afd021 5 static int free_sz = AHBMEMSIZE;
Gruenfrosch 2:f28cf0afd021 6 void reset_ahb_mem(void)
Gruenfrosch 2:f28cf0afd021 7 {
Gruenfrosch 2:f28cf0afd021 8 free_ptr = (char *)AHBMEM;
Gruenfrosch 2:f28cf0afd021 9 free_sz = AHBMEMSIZE;
Gruenfrosch 2:f28cf0afd021 10 }
Gruenfrosch 2:f28cf0afd021 11 void *mad_malloc(unsigned int sz)
Gruenfrosch 2:f28cf0afd021 12 {
Gruenfrosch 2:f28cf0afd021 13 unsigned int nsz = ((sz >> 3) + 1) << 3; // align to 8 byte
Gruenfrosch 2:f28cf0afd021 14 if(nsz < free_sz)
Gruenfrosch 2:f28cf0afd021 15 {
Gruenfrosch 2:f28cf0afd021 16 char *p = free_ptr;
Gruenfrosch 2:f28cf0afd021 17 free_ptr += nsz;
Gruenfrosch 2:f28cf0afd021 18 free_sz -=nsz;
Gruenfrosch 2:f28cf0afd021 19 return(p);
Gruenfrosch 2:f28cf0afd021 20 }
Gruenfrosch 2:f28cf0afd021 21 else
Gruenfrosch 2:f28cf0afd021 22 {
Gruenfrosch 2:f28cf0afd021 23 return(malloc(sz));
Gruenfrosch 2:f28cf0afd021 24 }
Gruenfrosch 2:f28cf0afd021 25 }