Fix mismatched datatypes in DMA arguments. (#29)

The file's uint32_t alignment should be more restrictive than the
uint16_t alignment, so this SHOULD be safe ... and reduces build noise.

Co-authored-by: Robert Lipe <robertlipe@gpsbabel.org>
This commit is contained in:
Robert Lipe 2020-10-29 03:32:44 -05:00 committed by Yafei Jin
parent 8d1870b1b4
commit e1d0f68857

View File

@ -132,8 +132,7 @@ static void cmd_play_audio(char *buf, int len, int argc, char **argv)
int sampling = 0; int sampling = 0;
int fd_audio; int fd_audio;
romfs_filebuf_t filebuf; romfs_filebuf_t filebuf;
//uint16_t *p_u16addr; uint16_t *p_u16addr;
uint32_t *p_u32addr;
uint32_t bufsize; uint32_t bufsize;
fd_audio = aos_open("/romfs/audio_32k", 0); fd_audio = aos_open("/romfs/audio_32k", 0);
@ -145,10 +144,12 @@ static void cmd_play_audio(char *buf, int len, int argc, char **argv)
aos_ioctl(fd_audio, IOCTL_ROMFS_GET_FILEBUF, (long unsigned int)&filebuf); aos_ioctl(fd_audio, IOCTL_ROMFS_GET_FILEBUF, (long unsigned int)&filebuf);
aos_close(fd_audio); aos_close(fd_audio);
p_u32addr = filebuf.buf; // From a long unsigned int* to a uint16_t* should be a NOP, even
// considering alignment.
p_u16addr = (uint16_t*) filebuf.buf;
bufsize = filebuf.bufsize; bufsize = filebuf.bufsize;
audio_dac_dma_test(p_u32addr, bufsize, sampling); audio_dac_dma_test(p_u16addr, bufsize, sampling);
return; return;