summaryrefslogtreecommitdiff
path: root/firmware/test/i2c/gendata.c
blob: 03bb002b88415cfe5456d1ddd6328b31ba5acce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>

int main(int argc, char *argv[])
{
    FILE *f;
    int i;
    unsigned char buf[128000];

    f = fopen("mp.mp3", "r");
    
    if(f)
    {
	if(fread(buf, 1, 128000, f) < 128000)
	{
	    fprintf(stderr, "FAN!\n");
	    exit(1);
	}

	printf("int mp3datalen = 128000;\n");
	printf("unsigned char mp3data[128000] =\n{");
	for(i = 0;i < 128000;i++)
	{
	    if(i % 8 == 0)
	    {
		printf("\n");
	    }
	    printf("0x%02x, ", buf[i]);
	}
	printf("};\n");
    }
}