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 GitHub
parent daf3fb9366
commit dfc40a74d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,8 +132,7 @@ static void cmd_play_audio(char *buf, int len, int argc, char **argv)
int sampling = 0;
int fd_audio;
romfs_filebuf_t filebuf;
//uint16_t *p_u16addr;
uint32_t *p_u32addr;
uint16_t *p_u16addr;
uint32_t bufsize;
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_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;
audio_dac_dma_test(p_u32addr, bufsize, sampling);
audio_dac_dma_test(p_u16addr, bufsize, sampling);
return;