Compare commits

8 Commits

Author SHA1 Message Date
NIIBE Yutaka
cc49f4ef23 Version 1.18.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-30 10:43:35 +09:00
NIIBE Yutaka
a0732c125a Add ChangeLog entry.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-27 10:20:27 +09:00
NIIBE Yutaka
6be482413c chopstx_poll: More change.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-27 10:20:07 +09:00
NIIBE Yutaka
9253777f5f Fix chopstx_poll for condition variables, check after woken up.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-27 10:19:50 +09:00
NIIBE Yutaka
63f47cede3 example-cdc,etc.: Bug fix of examples.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-20 14:39:38 +09:00
NIIBE Yutaka
4c0c15588e Add a ChangeLog entry for USB fix.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-20 08:27:33 +09:00
NIIBE Yutaka
e58e134b42 Fix EP0 receiving more packets.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-20 08:26:49 +09:00
NIIBE Yutaka
4cd47453ae Fix GNU/Linux emulation about termination of a thread.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-12-04 13:44:57 +09:00
11 changed files with 71 additions and 10 deletions

View File

@@ -1,3 +1,22 @@
2019-12-30 NIIBE Yutaka <gniibe@fsij.org>
* VERSION: 1.18.
* doc/chopstx.texi (VERSION): 1.18.
2019-12-27 NIIBE Yutaka <gniibe@fsij.org>
* chopstx.c (chopstx_poll): Call CHECK for condition
valiable after woken up.
2019-12-20 NIIBE Yutaka <gniibe@fsij.org>
* mcu/usb-st-common.c (usb_lld_ctrl_recv): Fix receiving
more than one packet.
2019-12-04 NIIBE Yutaka <gniibe@fsij.org>
* chopstx-gnu-linux.c (chx_thread_start): Fix return value.
2019-11-21 NIIBE Yutaka <gniibe@fsij.org>
* chopstx-cortex-m.c (chx_set_running): New.

19
NEWS
View File

@@ -1,6 +1,25 @@
NEWS - Noteworthy changes
* Major changes in Chopstx 1.18
Released 2019-12-30
** Fix of chopstx_poll
When waiting for a condition variable, we supply CHECK method with a
descriptor. Since a condition variable may be fired for multiple
reasons, old implementation of chopstx_poll may return with wrong
information saying a condition of CHECK were met but actually not. It
should not return when condition is not satisfied and it should not
give wrong information to application. Fixed by calling the CHECK
method again when woken up, and don't return when no condition meet.
** Bug fix for GNU/Linux emulation
When woken up, return value of chx_sched was wrong. Because of this,
timeout handling had problem. Termination value of a thread was
wrong.
* Major changes in Chopstx 1.17
Released 2019-11-20

7
README
View File

@@ -1,6 +1,6 @@
Chopstx - Threads and only Threads
Version 1.17
2019-11-20
Version 1.18
2019-12-30
Niibe Yutaka
Flying Stone Technology
@@ -60,7 +60,8 @@ For STM32 Primer2, see the directory: example-primer2.
Future Works
============
RISC-V port (for GD32VF103) is under development.
RISC-V port (for GD32VF103) is under development. Please have a look
at the master branch.
Convenience function to determine the bottom of thread stack,
configuration of thread size by compiler's output would be next things

View File

@@ -1 +1 @@
release/1.17
release/1.18

View File

@@ -328,9 +328,11 @@ chx_sched (uint32_t yield)
static void __attribute__((__noreturn__))
chx_thread_start (voidfunc thread_entry, void *arg)
{
void *ret;
chx_cpu_sched_unlock ();
thread_entry (arg);
chopstx_exit (0);
ret = thread_entry (arg);
chopstx_exit (ret);
}
static struct chx_thread *

View File

@@ -1411,6 +1411,7 @@ chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[])
for (i = 0; i < n; i++)
chx_proxy_init (&px[i], &counter);
again:
for (i = 0; i < n; i++)
{
pd = pd_array[i];
@@ -1473,6 +1474,20 @@ chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[])
ll_dequeue ((struct chx_pq *)&px[i]);
chx_spin_unlock (&pc->cond->lock);
}
else
{ /* Check the condition again after woken up. */
if (pc->mutex)
chopstx_mutex_lock (pc->mutex);
if ((*pc->check) (pc->arg) == 0)
{ /* Condition doesn't met. */
pc->ready = 0;
counter--;
}
if (pc->mutex)
chopstx_mutex_unlock (pc->mutex);
}
}
else if (pd->type == CHOPSTX_POLL_INTR)
{
@@ -1504,6 +1519,9 @@ chopstx_poll (uint32_t *usec_p, int n, struct chx_poll_head *const pd_array[])
if (r < 0)
chopstx_exit (CHOPSTX_CANCELED);
if (counter == 0 && (usec_p == NULL || *usec_p))
goto again;
return counter;
}

View File

@@ -1,7 +1,7 @@
\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename chopstx.info
@set VERSION 1.17
@set VERSION 1.18
@settitle Chopstx Reference Manual
@c Unify some of the indices.
@syncodeindex tp fn

View File

@@ -768,7 +768,7 @@ tty_main (void *arg)
&& t->flag_send_ready)
{
uint8_t line[32];
int len = get_chars_from_ringbuffer (t, line, sizeof (len));
int len = get_chars_from_ringbuffer (t, line, sizeof (line));
if (len)
{

View File

@@ -780,7 +780,7 @@ tty_main (void *arg)
&& t->flag_send_ready)
{
uint8_t line[32];
int len = get_chars_from_ringbuffer (t, line, sizeof (len));
int len = get_chars_from_ringbuffer (t, line, sizeof (line));
if (len)
{

View File

@@ -768,7 +768,7 @@ tty_main (void *arg)
&& t->flag_send_ready)
{
uint8_t line[32];
int len = get_chars_from_ringbuffer (t, line, sizeof (len));
int len = get_chars_from_ringbuffer (t, line, sizeof (line));
if (len)
{

View File

@@ -864,6 +864,8 @@ usb_lld_ctrl_recv (struct usb_dev *dev, void *p, size_t len)
struct ctrl_data *data_p = &dev->ctrl_data;
data_p->addr = p;
data_p->len = len;
if (len > USB_MAX_PACKET_SIZE)
len = USB_MAX_PACKET_SIZE;
dev->state = OUT_DATA;
ep_set_rx_status (ENDP0, EP_RX_VALID);
return USB_EVENT_OK;