Revert "Use small lock to protect resources related to cpufifo."
This reverts commit 8b5ea40a2b.
This commit is contained in:
parent
191e3ba1f7
commit
52d0b4ccf4
1 changed files with 7 additions and 9 deletions
|
|
@ -28,7 +28,6 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/queue.h>
|
||||
#include <nuttx/spinlock.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
|
@ -80,7 +79,6 @@ static sq_queue_t g_pushqueue;
|
|||
static sq_queue_t g_emptyqueue;
|
||||
static struct cfpushdata_s g_pushbuffer[NR_PUSHBUFENTRIES];
|
||||
static cpufifo_handler_t g_cfrxhandler;
|
||||
static spinlock_t g_cpufifo_lock = SP_UNLOCKED;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
|
|
@ -177,11 +175,11 @@ int cxd56_cfpush(uint32_t data[2])
|
|||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
flags = spin_lock_irqsave(&g_cpufifo_lock);
|
||||
flags = enter_critical_section();
|
||||
if (!sq_empty(&g_pushqueue))
|
||||
{
|
||||
ret = cpufifo_reserve(data);
|
||||
spin_unlock_irqrestore(&g_cpufifo_lock, flags);
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +190,7 @@ int cxd56_cfpush(uint32_t data[2])
|
|||
up_enable_irq(CXD56_IRQ_FIFO_TO);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&g_cpufifo_lock, flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -216,7 +214,7 @@ int cxd56_cfregrxhandler(cpufifo_handler_t handler)
|
|||
irqstate_t flags;
|
||||
int ret = OK;
|
||||
|
||||
flags = spin_lock_irqsave(&g_cpufifo_lock);
|
||||
flags = enter_critical_section();
|
||||
if (g_cfrxhandler)
|
||||
{
|
||||
ret = -1;
|
||||
|
|
@ -226,16 +224,16 @@ int cxd56_cfregrxhandler(cpufifo_handler_t handler)
|
|||
g_cfrxhandler = handler;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&g_cpufifo_lock, flags);
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cxd56_cfunregrxhandler(void)
|
||||
{
|
||||
irqstate_t flags;
|
||||
flags = spin_lock_irqsave(&g_cpufifo_lock);
|
||||
flags = enter_critical_section();
|
||||
g_cfrxhandler = NULL;
|
||||
spin_unlock_irqrestore(&g_cpufifo_lock, flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
int cxd56_cfinitialize(void)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue