Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FatFileSystemCpp I2SSlave TLV320 mbed
Fork of madplayer by
lpc1768_mem.cpp@3:6f07b5f52c38, 2012-12-19 (annotated)
- Committer:
- okini3939
- Date:
- Wed Dec 19 06:01:00 2012 +0000
- Revision:
- 3:6f07b5f52c38
- Parent:
- 2:f28cf0afd021
1st build;
Who changed what in which revision?
| User | Revision | Line number | New 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 | } |
