Skip to content

Commit d9d720b

Browse files
jerpeleapatacongo
authored andcommitted
audio: nxstyle fixes for core and drivers
nxstyle fixes for the audio core and drivers Signed-off-by: Alin Jerpelea <[email protected]>
1 parent 76c47f6 commit d9d720b

24 files changed

+660
-434
lines changed

audio/audio.c

+70-41
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
****************************************************************************/
6969

7070
/* Debug ********************************************************************/
71+
7172
/* Non-standard debug that may be enabled just for testing Audio */
7273

7374
#ifndef AUDIO_MAX_DEVICE_PATH
@@ -86,11 +87,11 @@
8687

8788
struct audio_upperhalf_s
8889
{
89-
uint8_t crefs; /* The number of times the device has been opened */
90-
volatile bool started; /* True: playback is active */
91-
sem_t exclsem; /* Supports mutual exclusion */
90+
uint8_t crefs; /* The number of times the device has been opened */
91+
volatile bool started; /* True: playback is active */
92+
sem_t exclsem; /* Supports mutual exclusion */
9293
FAR struct audio_lowerhalf_s *dev; /* lower-half state */
93-
mqd_t usermq; /* User mode app's message queue */
94+
mqd_t usermq; /* User mode app's message queue */
9495
};
9596

9697
/****************************************************************************
@@ -99,17 +100,29 @@ struct audio_upperhalf_s
99100

100101
static int audio_open(FAR struct file *filep);
101102
static int audio_close(FAR struct file *filep);
102-
static ssize_t audio_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
103-
static ssize_t audio_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
104-
static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
103+
static ssize_t audio_read(FAR struct file *filep,
104+
FAR char *buffer,
105+
size_t buflen);
106+
static ssize_t audio_write(FAR struct file *filep,
107+
FAR const char *buffer,
108+
size_t buflen);
109+
static int audio_ioctl(FAR struct file *filep,
110+
int cmd,
111+
unsigned long arg);
105112
#ifdef CONFIG_AUDIO_MULTI_SESSION
106-
static int audio_start(FAR struct audio_upperhalf_s *upper, FAR void *session);
107-
static void audio_callback(FAR void *priv, uint16_t reason,
108-
FAR struct ap_buffer_s *apb, uint16_t status, FAR void *session);
113+
static int audio_start(FAR struct audio_upperhalf_s *upper,
114+
FAR void *session);
115+
static void audio_callback(FAR void *priv,
116+
uint16_t reason,
117+
FAR struct ap_buffer_s *apb,
118+
uint16_t status,
119+
FAR void *session);
109120
#else
110121
static int audio_start(FAR struct audio_upperhalf_s *upper);
111-
static void audio_callback(FAR void *priv, uint16_t reason,
112-
FAR struct ap_buffer_s *apb, uint16_t status);
122+
static void audio_callback(FAR void *priv,
123+
uint16_t reason,
124+
FAR struct ap_buffer_s *apb,
125+
uint16_t status);
113126
#endif /* CONFIG_AUDIO_MULTI_SESSION */
114127

115128
/****************************************************************************
@@ -131,13 +144,13 @@ static const struct file_operations g_audioops =
131144
* Private Functions
132145
****************************************************************************/
133146

134-
/************************************************************************************
147+
/****************************************************************************
135148
* Name: audio_open
136149
*
137150
* Description:
138151
* This function is called whenever the Audio device is opened.
139152
*
140-
************************************************************************************/
153+
****************************************************************************/
141154

142155
static int audio_open(FAR struct file *filep)
143156
{
@@ -184,13 +197,13 @@ static int audio_open(FAR struct file *filep)
184197
return ret;
185198
}
186199

187-
/************************************************************************************
200+
/****************************************************************************
188201
* Name: audio_close
189202
*
190203
* Description:
191204
* This function is called when the Audio device is closed.
192205
*
193-
************************************************************************************/
206+
****************************************************************************/
194207

195208
static int audio_close(FAR struct file *filep)
196209
{
@@ -241,15 +254,17 @@ static int audio_close(FAR struct file *filep)
241254
return ret;
242255
}
243256

244-
/************************************************************************************
257+
/****************************************************************************
245258
* Name: audio_read
246259
*
247260
* Description:
248261
* A dummy read method. This is provided only to satsify the VFS layer.
249262
*
250-
************************************************************************************/
263+
****************************************************************************/
251264

252-
static ssize_t audio_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
265+
static ssize_t audio_read(FAR struct file *filep,
266+
FAR char *buffer,
267+
size_t buflen)
253268
{
254269
FAR struct inode *inode = filep->f_inode;
255270
FAR struct audio_upperhalf_s *upper = inode->i_private;
@@ -267,15 +282,17 @@ static ssize_t audio_read(FAR struct file *filep, FAR char *buffer, size_t bufle
267282
return 0;
268283
}
269284

270-
/************************************************************************************
285+
/****************************************************************************
271286
* Name: audio_write
272287
*
273288
* Description:
274289
* A dummy write method. This is provided only to satsify the VFS layer.
275290
*
276-
************************************************************************************/
291+
****************************************************************************/
277292

278-
static ssize_t audio_write(FAR struct file *filep, FAR const char *buffer, size_t buflen)
293+
static ssize_t audio_write(FAR struct file *filep,
294+
FAR const char *buffer,
295+
size_t buflen)
279296
{
280297
FAR struct inode *inode = filep->f_inode;
281298
FAR struct audio_upperhalf_s *upper = inode->i_private;
@@ -293,16 +310,17 @@ static ssize_t audio_write(FAR struct file *filep, FAR const char *buffer, size_
293310
return 0;
294311
}
295312

296-
/************************************************************************************
313+
/****************************************************************************
297314
* Name: audio_start
298315
*
299316
* Description:
300317
* Handle the AUDIOIOC_START ioctl command
301318
*
302-
************************************************************************************/
319+
****************************************************************************/
303320

304321
#ifdef CONFIG_AUDIO_MULTI_SESSION
305-
static int audio_start(FAR struct audio_upperhalf_s *upper, FAR void *session)
322+
static int audio_start(FAR struct audio_upperhalf_s *upper,
323+
FAR void *session)
306324
#else
307325
static int audio_start(FAR struct audio_upperhalf_s *upper)
308326
#endif
@@ -339,13 +357,13 @@ static int audio_start(FAR struct audio_upperhalf_s *upper)
339357
return ret;
340358
}
341359

342-
/************************************************************************************
360+
/****************************************************************************
343361
* Name: audio_ioctl
344362
*
345363
* Description:
346364
* The standard ioctl method. This is where ALL of the Audio work is done.
347365
*
348-
************************************************************************************/
366+
****************************************************************************/
349367

350368
static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
351369
{
@@ -379,7 +397,8 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
379397

380398
case AUDIOIOC_GETCAPS:
381399
{
382-
FAR struct audio_caps_s *caps = (FAR struct audio_caps_s *)((uintptr_t)arg);
400+
FAR struct audio_caps_s *caps =
401+
(FAR struct audio_caps_s *)((uintptr_t)arg);
383402
DEBUGASSERT(lower->ops->getcaps != NULL);
384403

385404
audinfo("AUDIOIOC_GETCAPS: Device=%d\n", caps->ac_type);
@@ -420,7 +439,8 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
420439
}
421440
break;
422441

423-
/* AUDIOIOC_START - Start the audio stream. The AUDIOIOC_SETCHARACTERISTICS
442+
/* AUDIOIOC_START - Start the audio stream.
443+
* The AUDIOIOC_SETCHARACTERISTICS
424444
* command must have previously been sent.
425445
*
426446
* ioctl argument: Audio session
@@ -647,7 +667,9 @@ static int audio_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
647667
}
648668
break;
649669

650-
/* Any unrecognized IOCTL commands might be platform-specific ioctl commands */
670+
/* Any unrecognized IOCTL commands might be
671+
* platform-specific ioctl commands
672+
*/
651673

652674
default:
653675
{
@@ -711,8 +733,8 @@ static inline void audio_dequeuebuffer(FAR struct audio_upperhalf_s *upper,
711733

712734
if (upper->usermq != NULL)
713735
{
714-
msg.msgId = AUDIO_MSG_DEQUEUE;
715-
msg.u.pPtr = apb;
736+
msg.msg_id = AUDIO_MSG_DEQUEUE;
737+
msg.u.ptr = apb;
716738
#ifdef CONFIG_AUDIO_MULTI_SESSION
717739
msg.session = session;
718740
#endif
@@ -750,8 +772,8 @@ static inline void audio_complete(FAR struct audio_upperhalf_s *upper,
750772
upper->started = false;
751773
if (upper->usermq != NULL)
752774
{
753-
msg.msgId = AUDIO_MSG_COMPLETE;
754-
msg.u.pPtr = NULL;
775+
msg.msg_id = AUDIO_MSG_COMPLETE;
776+
msg.u.ptr = NULL;
755777
#ifdef CONFIG_AUDIO_MULTI_SESSION
756778
msg.session = session;
757779
#endif
@@ -823,7 +845,8 @@ static void audio_callback(FAR void *handle, uint16_t reason,
823845
FAR struct ap_buffer_s *apb, uint16_t status)
824846
#endif
825847
{
826-
FAR struct audio_upperhalf_s *upper = (FAR struct audio_upperhalf_s *)handle;
848+
FAR struct audio_upperhalf_s *upper =
849+
(FAR struct audio_upperhalf_s *)handle;
827850

828851
audinfo("Entry\n");
829852

@@ -854,7 +877,9 @@ static void audio_callback(FAR void *handle, uint16_t reason,
854877

855878
case AUDIO_CALLBACK_COMPLETE:
856879
{
857-
/* Send a complete message to the user if a message queue is registered */
880+
/* Send a complete message to the user if a message queue
881+
* is registered
882+
*/
858883

859884
#ifdef CONFIG_AUDIO_MULTI_SESSION
860885
audio_complete(upper, apb, status, session);
@@ -902,9 +927,9 @@ static void audio_callback(FAR void *handle, uint16_t reason,
902927
* filesystem. The recommended convention is to name Audio drivers
903928
* based on the function they provide, such as "/dev/pcm0", "/dev/mp31",
904929
* etc.
905-
* dev - A pointer to an instance of lower half audio driver. This instance
906-
* is bound to the Audio driver and must persists as long as the driver
907-
* persists.
930+
* dev - A pointer to an instance of lower half audio driver.
931+
* This instance is bound to the Audio driver and must persists as long
932+
* as the driver persists.
908933
*
909934
* Returned Value:
910935
* Zero on success; a negated errno value on failure.
@@ -926,14 +951,17 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)
926951

927952
/* Allocate the upper-half data structure */
928953

929-
upper = (FAR struct audio_upperhalf_s *)kmm_zalloc(sizeof(struct audio_upperhalf_s));
954+
upper = (FAR struct audio_upperhalf_s *)kmm_zalloc(
955+
sizeof(struct audio_upperhalf_s));
930956
if (!upper)
931957
{
932958
auderr("ERROR: Allocation failed\n");
933959
return -ENOMEM;
934960
}
935961

936-
/* Initialize the Audio device structure (it was already zeroed by kmm_zalloc()) */
962+
/* Initialize the Audio device structure
963+
* (it was already zeroed by kmm_zalloc())
964+
*/
937965

938966
nxsem_init(&upper->exclsem, 0, 1);
939967
upper->dev = dev;
@@ -979,6 +1007,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)
9791007
{
9801008
*pathptr++ = *ptr++;
9811009
}
1010+
9821011
*pathptr = '\0';
9831012

9841013
/* Make this level of directory */

audio/audio_comp.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,13 @@ static int audio_comp_release(FAR struct audio_lowerhalf_s *dev);
139139

140140
#ifdef CONFIG_AUDIO_MULTI_SESSION
141141
static void audio_comp_callback(FAR void *arg, uint16_t reason,
142-
FAR struct ap_buffer_s *apb, uint16_t status,
142+
FAR struct ap_buffer_s *apb,
143+
uint16_t status,
143144
FAR void *session);
144145
#else
145146
static void audio_comp_callback(FAR void *arg, uint16_t reason,
146-
FAR struct ap_buffer_s *apb, uint16_t status);
147+
FAR struct ap_buffer_s *apb,
148+
uint16_t status);
147149
#endif
148150

149151
/****************************************************************************

0 commit comments

Comments
 (0)