Axis Area
Public Area
Special pages
NOTE
Only 5 signals are required to control the DSP VS1002.
First Enable theses option inside kernel
CONFIG_ETRAX_SYNCHRONOUS_SERIAL=y
CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1=y
CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA=y
This small code snippet tests sending mp3 data's over the SPI bus with Frame (DREQ VS1002 signal) flow control.
FILE *file; unsigned char buf[2048]; ...... if ((fd = open ("/dev/syncser1", O_RDWR )) < 0) { fprintf (stderr, "Failed to open syncser1\n"); exit (1); } fprintf (stderr, "syncser1 open\n\n"); ioctl (fd, SSP_SPI, SPI_MASTER); if (ioctl (fd, SSP_SPEED, SSP3125000)) { fprintf (stderr, "Couldn't change sync SSP_SPEED\n"); err++; } if (ioctl (fd, SSP_INBUFCHUNK, 8192)) { fprintf (stderr, "Couldn't change sync SSP_BUFCHUNK\n"); err++; } fprintf (stderr, "Running ...\n"); tmp = NORMAL_SYNC | WORD_SYNC | SYNC_ON | WORD_SIZE_8 | BIT_ORDER_MSB | FLOW_CONTROL_ENABLE | CLOCK_NOT_GATED; if (ioctl (fd, SSP_FRAME_SYNC, tmp)) { fprintf (stderr, "Couldn't change sync SSP_FRAME_SYNC\n"); err++; } fprintf (stderr, "xDCS = 0\n"); tmp = CLOCK_INVERT | FRAME_INVERT | STATUS_INVERT; if (ioctl (fd, SSP_IPOLARITY, tmp)) { fprintf (stderr, "Couldn't change polarity SSP_IPOLARITY\n"); err++; } tmp = CLOCK_INVERT | FRAME_INVERT | STATUS_INVERT; if (ioctl (fd, SSP_OPOLARITY, tmp)) { fprintf (stderr, "Couldn't change polarity SSP_OPOLARITY\n"); err++; } /* Open mp3 file (usage : "mp3play -p < file.mp3" */ if((df=fileno(stdin))==-1) { fprintf(stderr, "Unknow file\n"); exit(1); } fprintf(stderr, "Open mp3 file \n"); file = fdopen(df, "r"); fprintf (stderr, "Playing ...\n"); size = write(fd, 0, 2048); fprintf (stderr, "Sending 0x00 \n"); while(!feof(file)) { n = fread(buf, 1, sizeof(buf), file); // fprintf (stderr, "Blocs read %d \n", n); size = write(fd, buf, sizeof(buf)); // fprintf (stderr, "Write bloc %d \n", size); } fprintf (stderr, "End playing \n"); close(fd); fclose(file); exit(1); }
Drop me a mail : habib.bouaziz@gmail.com
Report on top -d 1
Mem: 9400K used, 5568K free, 0K shrd, 0K buff, 5696K cached Load average: 0.00, 0.00, 0.00 (State: S=sleeping R=running, W=waiting)
PID USER STATUS RSS PPID %CPU %MEM COMMAND 156 root R 840 110 8.1 5.6 top 85 root S 480 1 2.7 3.2 utelnetd 51 root S 496 1 0.6 3.3 respawnd 147 root S 424 110 0.6 2.8 mp3play 54 root S 728 1 0.0 4.8 syslogd 100 root S 704 1 0.0 4.7 boa 110 root S 696 85 0.0 4.6 sh 106 root S 680 1 0.0 4.5 udhcpc 104 root S 624 1 0.0 4.1 sh 91 root S 520 1 0.0 3.4 vftpd 57 root S 488 1 0.0 3.2 klogd 1 root S 432 0 0.0 2.8 init 7 root SW 0 1 0.0 0.0 mtdblockd 2 root SW 0 1 0.0 0.0 keventd 3 root SWN 0 1 0.0 0.0 ksoftirqd_CPU0 4 root SW 0 1 0.0 0.0 kswapd 5 root SW 0 1 0.0 0.0 bdflush 6 root SW 0 1 0.0 0.0 kupdated
The relevant process
147 root S 424 110 0.6 2.8 mp3play
does not exceed 0.8% CPU with any mp3 rate between [32Kbits/s .. 192Kbits/s]. Surprising isn”t it ?
Habib Bouaziz-Viallet (Friends of mine often they call me Bib)