11/*
22 * Copyright (c) 2020-2021, Bluetrum Development Team
3- *
3+ *
44 * SPDX-License-Identifier: Apache-2.0
55 *
66 * Date Author Notes
@@ -139,7 +139,7 @@ void saia_volume_set(rt_uint8_t volume)
139139{
140140 if (volume > 100 )
141141 volume = 100 ;
142-
142+
143143 uint32_t dvol = volume * 327 ; // max is 0x7ffff
144144 LOG_D ("dvol=0x%x" , dvol );
145145 DACVOLCON = dvol | (0x02 << 16 ); // dac fade in
@@ -155,7 +155,7 @@ static rt_err_t sound_getcaps(struct rt_audio_device *audio, struct rt_audio_cap
155155 rt_err_t result = RT_EOK ;
156156 struct sound_device * snd_dev = RT_NULL ;
157157
158- RT_ASSERT (audio != RT_NULL );
158+ RT_ASSERT (audio != RT_NULL );
159159 snd_dev = (struct sound_device * )audio -> parent .user_data ;
160160
161161 switch (caps -> main_type )
@@ -231,7 +231,7 @@ static rt_err_t sound_getcaps(struct rt_audio_device *audio, struct rt_audio_cap
231231 break ;
232232 }
233233
234- return RT_EOK ;
234+ return RT_EOK ;
235235}
236236
237237static rt_err_t sound_configure (struct rt_audio_device * audio , struct rt_audio_caps * caps )
@@ -320,14 +320,14 @@ static rt_err_t sound_configure(struct rt_audio_device *audio, struct rt_audio_c
320320 break ;
321321 }
322322
323- return RT_EOK ;
323+ return RT_EOK ;
324324}
325325
326326static rt_err_t sound_init (struct rt_audio_device * audio )
327327{
328328 struct sound_device * snd_dev = RT_NULL ;
329329
330- RT_ASSERT (audio != RT_NULL );
330+ RT_ASSERT (audio != RT_NULL );
331331 snd_dev = (struct sound_device * )audio -> parent .user_data ;
332332
333333 adpll_init (0 );
@@ -337,14 +337,14 @@ static rt_err_t sound_init(struct rt_audio_device *audio)
337337 saia_frequency_set (snd_dev -> replay_config .samplerate );
338338 saia_channels_set (snd_dev -> replay_config .channels );
339339
340- return RT_EOK ;
340+ return RT_EOK ;
341341}
342342
343343static rt_err_t sound_start (struct rt_audio_device * audio , int stream )
344344{
345345 struct sound_device * snd_dev = RT_NULL ;
346346
347- RT_ASSERT (audio != RT_NULL );
347+ RT_ASSERT (audio != RT_NULL );
348348 snd_dev = (struct sound_device * )audio -> parent .user_data ;
349349
350350 if (stream == AUDIO_STREAM_REPLAY )
@@ -369,8 +369,8 @@ static rt_err_t sound_stop(struct rt_audio_device *audio, int stream)
369369{
370370 struct sound_device * snd_dev = RT_NULL ;
371371
372- RT_ASSERT (audio != RT_NULL );
373- snd_dev = (struct sound_device * )audio -> parent .user_data ;
372+ RT_ASSERT (audio != RT_NULL );
373+ snd_dev = (struct sound_device * )audio -> parent .user_data ;
374374
375375 if (stream == AUDIO_STREAM_REPLAY )
376376 {
@@ -387,22 +387,22 @@ rt_size_t sound_transmit(struct rt_audio_device *audio, const void *writeBuf, vo
387387 rt_size_t tmp_size = size / 4 ;
388388 rt_size_t count = 0 ;
389389
390- RT_ASSERT (audio != RT_NULL );
390+ RT_ASSERT (audio != RT_NULL );
391391 snd_dev = (struct sound_device * )audio -> parent .user_data ;
392392
393393 while (tmp_size -- > 0 ) {
394394 while (AUBUFCON & BIT (8 )); // aubuf full
395395 AUBUFDATA = ((const uint32_t * )writeBuf )[count ++ ];
396396 }
397397
398- return size ;
398+ return size ;
399399}
400400
401401static void sound_buffer_info (struct rt_audio_device * audio , struct rt_audio_buf_info * info )
402402{
403403 struct sound_device * snd_dev = RT_NULL ;
404404
405- RT_ASSERT (audio != RT_NULL );
405+ RT_ASSERT (audio != RT_NULL );
406406 snd_dev = (struct sound_device * )audio -> parent .user_data ;
407407
408408 /**
@@ -425,7 +425,7 @@ static struct rt_audio_ops ops =
425425 .init = sound_init ,
426426 .start = sound_start ,
427427 .stop = sound_stop ,
428- .transmit = sound_transmit ,
428+ .transmit = sound_transmit ,
429429 .buffer_info = sound_buffer_info ,
430430};
431431
@@ -443,20 +443,20 @@ void audio_isr(int vector, void *param)
443443
444444static int rt_hw_sound_init (void )
445445{
446- rt_uint8_t * tx_fifo = RT_NULL ;
447- rt_uint8_t * rx_fifo = RT_NULL ;
446+ rt_uint8_t * tx_fifo = RT_NULL ;
447+ rt_uint8_t * rx_fifo = RT_NULL ;
448448
449- /* 分配 DMA 搬运 buffer */
450- tx_fifo = rt_calloc (1 , TX_FIFO_SIZE );
449+ /* 分配 DMA 搬运 buffer */
450+ tx_fifo = rt_calloc (1 , TX_FIFO_SIZE );
451451 if (tx_fifo == RT_NULL )
452452 {
453453 return - RT_ENOMEM ;
454454 }
455455
456456 snd_dev .tx_fifo = tx_fifo ;
457457
458- /* 分配 DMA 搬运 buffer */
459- rx_fifo = rt_calloc (1 , TX_FIFO_SIZE );
458+ /* 分配 DMA 搬运 buffer */
459+ rx_fifo = rt_calloc (1 , TX_FIFO_SIZE );
460460 if (rx_fifo == RT_NULL )
461461 {
462462 return - RT_ENOMEM ;
0 commit comments