VS1053 worker thread stack size is now configurable; Worker thread is named via pthread_setname_np(). From Ken Pettit

This commit is contained in:
Gregory Nutt 2013-11-10 11:03:19 -06:00
parent f7f5923d9d
commit 926e91555d
4 changed files with 24 additions and 6 deletions

View File

@ -6017,3 +6017,6 @@
Kinetis KL family from Alan Carvalho de Assis (2013-11-10).
* configs/freedom-kl25z: Add PWM support. From Alan Carvalho de Assis
(2013-11-10).
* drivers/audio/vs1053: VS1053 worker thread stack size is now
configurable and assigned a name via pthread_setname_np(). From Ken
Pettit (2013-11-10).

View File

@ -35,6 +35,12 @@ config VS1053_DEVICE_COUNT
context pointers for the DREQ ISR to use for lookup when it needs
to signal that additional data is being requested.
config VS1053_WORKER_STACKSIZE
int "VS1053 worker thread stack size"
default 768
---help---
Stack size to use with the VS1053 worker thread.
if AUDIO_DRIVER_SPECIFIC_BUFFERS
config VS1053_NUM_BUFFERS

View File

@ -88,6 +88,10 @@
# define CONFIG_VS1053_NUM_BUFFERS 2
#endif
#ifndef CONFIG_VS1053_WORKER_STACKSIZE
# define CONFIG_VS1053_WORKER_STACKSIZE 768
#endif
#define VS1053_DUMMY 0xFF
#define VS1053_DEFAULT_XTALI 12288000
#define VS1053_DATA_FREQ 20000000
@ -1474,7 +1478,8 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
pthread_attr_init(&tattr);
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO) - 3;
pthread_attr_setschedparam(&tattr, &sparam);
(void)pthread_attr_setschedparam(&tattr, &sparam);
(void)pthread_attr_setstacksize(&tattr, CONFIG_VS1053_WORKER_STACKSIZE);
auddbg("Starting workerthread\n");
ret = pthread_create(&dev->threadid, &tattr, vs1053_workerthread,
@ -1484,7 +1489,10 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower)
auddbg("Can't create worker thread, errno=%d\n", errno);
}
else
{
pthread_setname_np(dev->threadid, "vs1053");
auddbg("Created worker thread\n");
}
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/prctl.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,8 +65,8 @@
* prctl(PR_GET_NAME, myname, 0);
*/
#define PR_SET_NAME 1
#define PR_GET_NAME 2
#define PR_SET_NAME 1
#define PR_GET_NAME 2
/****************************************************************************
* Public Type Definitions
@ -79,7 +79,8 @@
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
extern "C"
{
#else
#define EXTERN extern
#endif
@ -104,7 +105,7 @@ extern "C" {
*
****************************************************************************/
EXTERN int prctl(int option, ...);
int prctl(int option, ...);
#undef EXTERN
#if defined(__cplusplus)