Fix intr_wait
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
(chopstx_release_irq): Remove.
|
||||
(chx_release_irq): New internal function.
|
||||
(THREAD_WAIT_INT): Remove.
|
||||
(chopstx_intr_wait): Remove, now offered as a macro.
|
||||
(chopstx_intr_wait): Rewrite by chopstx_poll.
|
||||
|
||||
2016-05-13 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
|
||||
2
NEWS
2
NEWS
@@ -13,7 +13,7 @@ variables, threads' exit, or IRQ simultaneously with timeout.
|
||||
Releasing irq is now called automaticall, internally.
|
||||
|
||||
** Function chopstx_intr_wait is deprecated
|
||||
It's now a macro with chopstx_poll.
|
||||
Use of chopstx_poll is recommended.
|
||||
|
||||
** FS-BB48: Kinetis L MCU
|
||||
Support for FS-BB48 board with Kinetis L MCU is added.
|
||||
|
||||
36
chopstx.c
36
chopstx.c
@@ -1454,25 +1454,31 @@ chx_intr_hook (struct chx_px *px, struct chx_poll_head *pd)
|
||||
|
||||
chopstx_testcancel ();
|
||||
chx_cpu_sched_lock ();
|
||||
if (intr->ready)
|
||||
{
|
||||
chx_spin_lock (&px->lock);
|
||||
(*px->counter_p)++;
|
||||
*px->ready_p = 1;
|
||||
chx_spin_unlock (&px->lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
px->v = intr->irq_num;
|
||||
chx_spin_lock (&q_intr.lock);
|
||||
chx_enable_intr (intr->irq_num);
|
||||
ll_prio_enqueue ((struct chx_pq *)px, &q_intr.q);
|
||||
chx_spin_unlock (&q_intr.lock);
|
||||
}
|
||||
intr->ready = 0;
|
||||
px->v = intr->irq_num;
|
||||
chx_spin_lock (&q_intr.lock);
|
||||
chx_enable_intr (intr->irq_num);
|
||||
ll_prio_enqueue ((struct chx_pq *)px, &q_intr.q);
|
||||
chx_spin_unlock (&q_intr.lock);
|
||||
chx_cpu_sched_unlock ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chopstx_intr_wait - Wait for interrupt request from hardware
|
||||
* @intr: Pointer to INTR structure
|
||||
*
|
||||
* Wait for the interrupt @intr to be occured.
|
||||
*
|
||||
* This function is DEPRECATED. Use chopstx_poll.
|
||||
*/
|
||||
void
|
||||
chopstx_intr_wait (chopstx_intr_t *intr)
|
||||
{
|
||||
chopstx_poll (NULL, 1, intr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* chopstx_cleanup_push - Register a clean-up
|
||||
* @clp: Pointer to clean-up structure
|
||||
|
||||
@@ -159,7 +159,7 @@ typedef struct chx_intr chopstx_intr_t;
|
||||
|
||||
void chopstx_claim_irq (chopstx_intr_t *intr, uint8_t irq_num);
|
||||
|
||||
#define chopstx_intr_wait(intr) chopstx_poll (NULL, 1, intr)
|
||||
void chopstx_intr_wait (chopstx_intr_t *intr); /* DEPRECATED */
|
||||
|
||||
|
||||
struct chx_poll_head {
|
||||
|
||||
@@ -118,20 +118,14 @@ Wake up all threads waiting on @var{cond}.
|
||||
Claim interrupt @var{intr} with @var{irq_num} for this thread.
|
||||
@end deftypefun
|
||||
|
||||
@subheading chopstx_release_irq
|
||||
@anchor{chopstx_release_irq}
|
||||
@deftypefun {void} {chopstx_release_irq} (chopstx_intr_t * @var{intr0})
|
||||
@var{intr0}: Interrupt request to be unregistered
|
||||
|
||||
Release the interrupt request specified by @var{intr0}.
|
||||
@end deftypefun
|
||||
|
||||
@subheading chopstx_intr_wait
|
||||
@anchor{chopstx_intr_wait}
|
||||
@deftypefun {void} {chopstx_intr_wait} (chopstx_intr_t * @var{intr})
|
||||
@var{intr}: Pointer to INTR structure
|
||||
|
||||
Wait for the interrupt @var{intr} to be occured.
|
||||
|
||||
This function is DEPRECATED. Use chopstx_poll.
|
||||
@end deftypefun
|
||||
|
||||
@subheading chopstx_cleanup_push
|
||||
@@ -212,7 +206,7 @@ Returns old state which is 0 when it was enabled.
|
||||
@subheading chopstx_poll
|
||||
@anchor{chopstx_poll}
|
||||
@deftypefun {int} {chopstx_poll} (uint32_t * @var{usec_p}, int @var{n}, @var{...})
|
||||
@var{usec_p}: Pointer to usec
|
||||
@var{usec_p}: Pointer to usec for timeout. Forever if NULL.
|
||||
|
||||
@var{n}: Number of poll descriptors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user