Follow the change of eventflag change, fixining long-standing bug of LED

This commit is contained in:
NIIBE Yutaka
2016-05-19 11:50:13 +09:00
parent d5c5571423
commit 25fed157e1
5 changed files with 23 additions and 13 deletions

View File

@@ -1,3 +1,8 @@
2016-05-19 Niibe Yutaka <gniibe@fsij.org>
* src/gnuk.h (LED_START_COMMAND, LED_FINISH_COMMAND): Change the
values for a case both flags will be handled.
2016-05-18 Niibe Yutaka <gniibe@fsij.org>
* src/gnuk.ld.in: Tweak thread size.

Submodule chopstx updated: 1b0fe5a6e8...03bba13005

View File

@@ -421,8 +421,8 @@ extern const uint8_t gnuk_string_serial[];
#define LED_ONESHOT 1
#define LED_TWOSHOTS 2
#define LED_SHOW_STATUS 4
#define LED_START_COMMAND 8
#define LED_FINISH_COMMAND 16
#define LED_FINISH_COMMAND 8
#define LED_START_COMMAND 16
#define LED_FATAL 32
#define LED_GNUK_EXEC 64
void led_blink (int spec);

View File

@@ -2,8 +2,8 @@
* ST32F103 memory setup.
*/
__main_stack_size__ = 0x0080; /* Exception handlers */
__process0_stack_size__ = 0x0120; /* main */
__process1_stack_size__ = 0x0160; /* ccid */
__process0_stack_size__ = 0x0100; /* main */
__process1_stack_size__ = 0x0180; /* ccid */
__process2_stack_size__ = 0x0160; /* rng */
__process3_stack_size__ = 0x1640; /* gpg */
__process4_stack_size__ = 0; /* --- */

View File

@@ -266,9 +266,7 @@ static void ccid_init (struct ccid *c, struct ep_in *epi, struct ep_out *epo,
memset (&c->icc_header, 0, sizeof (struct icc_header));
c->sw1sw2[0] = 0x90;
c->sw1sw2[1] = 0x00;
eventflag_init (&c->ccid_comm);
c->application = 0;
eventflag_init (&c->openpgp_comm);
c->epi = epi;
c->epo = epo;
c->a = a;
@@ -1373,6 +1371,7 @@ void *
ccid_thread (void *arg)
{
chopstx_intr_t interrupt;
uint32_t timeout;
struct ep_in *epi = &endpoint_in;
struct ep_out *epo = &endpoint_out;
@@ -1380,9 +1379,13 @@ ccid_thread (void *arg)
struct apdu *a = &apdu;
(void)arg;
eventflag_init (&ccid.ccid_comm);
eventflag_init (&ccid.openpgp_comm);
usb_lld_init (USB_INITIAL_FEATURE);
chopstx_claim_irq (&interrupt, INTR_REQ_USB);
usb_interrupt_handler ();
usb_interrupt_handler (); /* For old SYS < 3.0 */
reset:
epi_init (epi, ENDP1, notify_tx, c);
@@ -1394,16 +1397,18 @@ ccid_thread (void *arg)
while (1)
{
eventmask_t m;
uint32_t timeout = USB_ICC_TIMEOUT;
chopstx_poll_cond_t poll_desc;
eventflag_set_poll_desc (&c->ccid_comm, &poll_desc);
eventflag_prepare_poll (&c->ccid_comm, &poll_desc);
chopstx_poll (&timeout, 2, &interrupt, &poll_desc);
if (interrupt.ready)
usb_interrupt_handler ();
{
usb_interrupt_handler ();
continue;
}
if (poll_desc.ready)
m = eventflag_wait (&c->ccid_comm);
timeout = USB_ICC_TIMEOUT;
m = eventflag_get (&c->ccid_comm);
if (m == EV_USB_RESET)
{