Compare commits
4 Commits
39683dbc5f
...
release/1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6c90e3df4 | ||
|
|
4d4f82fd06 | ||
|
|
1ef6256784 | ||
|
|
1400e677e3 |
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
||||
2018-12-19 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* VERSION: 1.13.
|
||||
* doc/chopstx.texi (VERSION): 1.13.
|
||||
|
||||
2018-12-08 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* chopstx.c (chx_timer_dequeue): Fix calculation of return value.
|
||||
|
||||
2018-12-07 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* chopstx.c (chx_timer_dequeue): Return ticks remained.
|
||||
(chx_wakeup, chopstx_mutex_lock): Use return value of
|
||||
chx_timer_dequeue.
|
||||
(chx_snooze): Update *USEC_P, accordingly.
|
||||
|
||||
2018-11-12 NIIBE Yutaka <gniibe@fsij.org>
|
||||
|
||||
* VERSION: 1.12.
|
||||
|
||||
9
NEWS
9
NEWS
@@ -1,6 +1,15 @@
|
||||
NEWS - Noteworthy changes
|
||||
|
||||
|
||||
* Major changes in Chopstx 1.13
|
||||
|
||||
Released 2018-12-19
|
||||
|
||||
** API fix (redefinition): chopstx_poll
|
||||
In old implementations, when chopstx_poll returns by non-timeout
|
||||
event, *USEC_P is not updated. Now, it is updated.
|
||||
|
||||
|
||||
* Major changes in Chopstx 1.12
|
||||
|
||||
Released 2018-11-12
|
||||
|
||||
@@ -293,8 +293,8 @@ chx_request_preemption (uint16_t prio)
|
||||
* AAPCS: ARM Architecture Procedure Call Standard
|
||||
*
|
||||
* Returns:
|
||||
* 1 on wakeup by others.
|
||||
* 0 on normal wakeup (timer expiration, lock aquirement).
|
||||
* >= 1 on wakeup by others, value means ticks remained for sleep.
|
||||
* 0 on normal wakeup (timer expiration, lock acquirement).
|
||||
* -1 on cancellation.
|
||||
*/
|
||||
static uintptr_t __attribute__ ((naked, noinline))
|
||||
|
||||
43
chopstx.c
43
chopstx.c
@@ -107,7 +107,7 @@ static struct chx_queue q_intr;
|
||||
static void chx_request_preemption (uint16_t prio);
|
||||
static int chx_wakeup (struct chx_pq *p);
|
||||
static struct chx_thread * chx_timer_insert (struct chx_thread *tp, uint32_t usec);
|
||||
static void chx_timer_dequeue (struct chx_thread *tp);
|
||||
static uint32_t chx_timer_dequeue (struct chx_thread *tp);
|
||||
|
||||
|
||||
|
||||
@@ -349,29 +349,35 @@ chx_timer_insert (struct chx_thread *tp, uint32_t usec)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static uint32_t
|
||||
chx_timer_dequeue (struct chx_thread *tp)
|
||||
{
|
||||
struct chx_thread *tp_prev;
|
||||
uint32_t ticks_remained;
|
||||
|
||||
chx_spin_lock (&q_timer.lock);
|
||||
ticks_remained = chx_systick_get ();
|
||||
tp_prev = (struct chx_thread *)tp->prev;
|
||||
if (tp_prev == (struct chx_thread *)&q_timer.q)
|
||||
{
|
||||
if (tp->next == (struct chx_pq *)&q_timer.q)
|
||||
chx_set_timer (tp_prev, 0); /* Cancel timer*/
|
||||
chx_systick_reload (0); /* Cancel timer. */
|
||||
else
|
||||
{ /* Update timer. */
|
||||
uint32_t next_ticks = chx_systick_get () + tp->v;
|
||||
|
||||
chx_set_timer (tp_prev, next_ticks);
|
||||
}
|
||||
chx_systick_reload (ticks_remained + tp->v); /* Update timer. */
|
||||
}
|
||||
else
|
||||
tp_prev->v += tp->v;
|
||||
{
|
||||
struct chx_pq *p;
|
||||
|
||||
for (p = q_timer.q.next; p != (struct chx_pq *)tp; p = p->next)
|
||||
ticks_remained += p->v;
|
||||
|
||||
tp_prev->v += tp->v;
|
||||
}
|
||||
ll_dequeue ((struct chx_pq *)tp);
|
||||
tp->v = 0;
|
||||
chx_spin_unlock (&q_timer.lock);
|
||||
return ticks_remained;
|
||||
}
|
||||
|
||||
|
||||
@@ -502,9 +508,11 @@ chx_wakeup (struct chx_pq *pq)
|
||||
tp = px->master;
|
||||
if (tp->state == THREAD_WAIT_POLL)
|
||||
{
|
||||
tp->v = (uintptr_t)1;
|
||||
if (tp->parent == &q_timer.q)
|
||||
chx_timer_dequeue (tp);
|
||||
tp->v = (uintptr_t)chx_timer_dequeue (tp);
|
||||
else
|
||||
tp->v = (uintptr_t)1;
|
||||
|
||||
chx_ready_enqueue (tp);
|
||||
if (!running || tp->prio > running->prio)
|
||||
yield = 1;
|
||||
@@ -679,6 +687,11 @@ chx_snooze (uint32_t state, uint32_t *usec_p)
|
||||
r = chx_sched (CHX_SLEEP);
|
||||
if (r == 0)
|
||||
*usec_p -= usec0;
|
||||
else if (r > 0)
|
||||
{
|
||||
*usec_p -= (usec0 - r / MHZ);
|
||||
r = 1;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -803,9 +816,10 @@ chopstx_mutex_lock (chopstx_mutex_t *mutex)
|
||||
if (tp0->state == THREAD_WAIT_TIME
|
||||
|| tp0->state == THREAD_WAIT_POLL)
|
||||
{
|
||||
tp0->v = (uintptr_t)1;
|
||||
if (tp0->parent == &q_timer.q)
|
||||
chx_timer_dequeue (tp0);
|
||||
tp0->v = (uintptr_t)chx_timer_dequeue (tp0);
|
||||
else
|
||||
tp0->v = (uintptr_t)1;
|
||||
|
||||
chx_ready_enqueue (tp0);
|
||||
tp0 = NULL;
|
||||
@@ -1347,7 +1361,8 @@ chx_proxy_init (struct chx_px *px, uint32_t *cp)
|
||||
|
||||
/**
|
||||
* chopstx_poll - wait for condition variable, thread's exit, or IRQ
|
||||
* @usec_p: Pointer to usec for timeout. Forever if NULL.
|
||||
* @usec_p: Pointer to usec for timeout. Forever if NULL. It is
|
||||
* updated on return
|
||||
* @n: Number of poll descriptors
|
||||
* @pd_array: Pointer to an array of poll descriptor pointer which
|
||||
* should be one of:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* chopstx.h - Threads and only threads.
|
||||
*
|
||||
* Copyright (C) 2013, 2016, 2017 Flying Stone Technology
|
||||
* Copyright (C) 2013, 2016, 2017, 2018 Flying Stone Technology
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
* This file is a part of Chopstx, a thread library for embedded.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename chopstx.info
|
||||
@set VERSION 1.12
|
||||
@set VERSION 1.13
|
||||
@settitle Chopstx Reference Manual
|
||||
@c Unify some of the indices.
|
||||
@syncodeindex tp fn
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* usb-mkl27z.c - USB driver for MKL27Z
|
||||
*
|
||||
* Copyright (C) 2016 Flying Stone Technology
|
||||
* Copyright (C) 2016, 2018 Flying Stone Technology
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
* This file is a part of Chopstx, a thread library for embedded.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* usb-stm32f103.c - USB driver for STM32F103
|
||||
*
|
||||
* Copyright (C) 2016, 2017 Flying Stone Technology
|
||||
* Copyright (C) 2016, 2017, 2018 Flying Stone Technology
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
* This file is a part of Chopstx, a thread library for embedded.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* usb-usbip.c - USB Device Emulation (server side) by USBIP
|
||||
*
|
||||
* Copyright (C) 2017 g10 Code GmbH
|
||||
* Copyright (C) 2017, 2018 g10 Code GmbH
|
||||
* Author: NIIBE Yutaka <gniibe@fsij.org>
|
||||
*
|
||||
* This file is a part of Chopstx, a thread library for embedded.
|
||||
|
||||
Reference in New Issue
Block a user