arch/arm/src/lc823450: Assign I2S IRQ handling to CPU0

Previous commit assumed that the caller is running on CPU0.
However, the caller sometimes runs at CPU1.  This patch will
assign the caller to CPU0 explicitly.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2018-01-18 12:30:43 +09:00 committed by Matt Thompson
parent d7cc0c7368
commit c70df0960d

View File

@ -51,6 +51,10 @@
#include <nuttx/audio/audio.h>
#include <nuttx/audio/i2s.h>
#ifdef CONFIG_SMP
# include <nuttx/signal.h>
#endif
#include "up_arch.h"
#include "lc823450_dma.h"
#include "lc823450_i2s.h"
@ -460,8 +464,32 @@ FAR struct i2s_dev_s *lc823450_i2sdev_initialize(void)
nxsem_init(&_sem_txdma, 0, 0);
nxsem_init(&_sem_buf_under, 0, 0);
#ifdef CONFIG_SMP
cpu_set_t cpuset0;
cpu_set_t cpuset1;
CPU_ZERO(&cpuset1);
CPU_SET(0, &cpuset1);
/* Backup the current affinity */
sched_getaffinity(getpid(), sizeof(cpuset0), &cpuset0);
/* Set the new affinity which assigns to CPU0 */
sched_setaffinity(getpid(), sizeof(cpuset1), &cpuset1);
nxsig_usleep(10 * 1000);
#endif
irq_attach(LC823450_IRQ_AUDIOBUF0, _i2s_isr, NULL);
#ifdef CONFIG_SMP
/* Restore the original affinity */
sched_setaffinity(getpid(), sizeof(cpuset0), &cpuset0);
nxsig_usleep(10 * 1000);
#endif
/* Enable IRQ for Audio Buffer */
up_enable_irq(LC823450_IRQ_AUDIOBUF0);