Follow the change of eventflag change, fixining long-standing bug of LED
This commit is contained in:
@@ -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>
|
2016-05-18 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* src/gnuk.ld.in: Tweak thread size.
|
* src/gnuk.ld.in: Tweak thread size.
|
||||||
|
|||||||
2
chopstx
2
chopstx
Submodule chopstx updated: 1b0fe5a6e8...03bba13005
@@ -421,8 +421,8 @@ extern const uint8_t gnuk_string_serial[];
|
|||||||
#define LED_ONESHOT 1
|
#define LED_ONESHOT 1
|
||||||
#define LED_TWOSHOTS 2
|
#define LED_TWOSHOTS 2
|
||||||
#define LED_SHOW_STATUS 4
|
#define LED_SHOW_STATUS 4
|
||||||
#define LED_START_COMMAND 8
|
#define LED_FINISH_COMMAND 8
|
||||||
#define LED_FINISH_COMMAND 16
|
#define LED_START_COMMAND 16
|
||||||
#define LED_FATAL 32
|
#define LED_FATAL 32
|
||||||
#define LED_GNUK_EXEC 64
|
#define LED_GNUK_EXEC 64
|
||||||
void led_blink (int spec);
|
void led_blink (int spec);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
* ST32F103 memory setup.
|
* ST32F103 memory setup.
|
||||||
*/
|
*/
|
||||||
__main_stack_size__ = 0x0080; /* Exception handlers */
|
__main_stack_size__ = 0x0080; /* Exception handlers */
|
||||||
__process0_stack_size__ = 0x0120; /* main */
|
__process0_stack_size__ = 0x0100; /* main */
|
||||||
__process1_stack_size__ = 0x0160; /* ccid */
|
__process1_stack_size__ = 0x0180; /* ccid */
|
||||||
__process2_stack_size__ = 0x0160; /* rng */
|
__process2_stack_size__ = 0x0160; /* rng */
|
||||||
__process3_stack_size__ = 0x1640; /* gpg */
|
__process3_stack_size__ = 0x1640; /* gpg */
|
||||||
__process4_stack_size__ = 0; /* --- */
|
__process4_stack_size__ = 0; /* --- */
|
||||||
|
|||||||
@@ -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));
|
memset (&c->icc_header, 0, sizeof (struct icc_header));
|
||||||
c->sw1sw2[0] = 0x90;
|
c->sw1sw2[0] = 0x90;
|
||||||
c->sw1sw2[1] = 0x00;
|
c->sw1sw2[1] = 0x00;
|
||||||
eventflag_init (&c->ccid_comm);
|
|
||||||
c->application = 0;
|
c->application = 0;
|
||||||
eventflag_init (&c->openpgp_comm);
|
|
||||||
c->epi = epi;
|
c->epi = epi;
|
||||||
c->epo = epo;
|
c->epo = epo;
|
||||||
c->a = a;
|
c->a = a;
|
||||||
@@ -1373,6 +1371,7 @@ void *
|
|||||||
ccid_thread (void *arg)
|
ccid_thread (void *arg)
|
||||||
{
|
{
|
||||||
chopstx_intr_t interrupt;
|
chopstx_intr_t interrupt;
|
||||||
|
uint32_t timeout;
|
||||||
|
|
||||||
struct ep_in *epi = &endpoint_in;
|
struct ep_in *epi = &endpoint_in;
|
||||||
struct ep_out *epo = &endpoint_out;
|
struct ep_out *epo = &endpoint_out;
|
||||||
@@ -1380,9 +1379,13 @@ ccid_thread (void *arg)
|
|||||||
struct apdu *a = &apdu;
|
struct apdu *a = &apdu;
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
|
eventflag_init (&ccid.ccid_comm);
|
||||||
|
eventflag_init (&ccid.openpgp_comm);
|
||||||
|
|
||||||
usb_lld_init (USB_INITIAL_FEATURE);
|
usb_lld_init (USB_INITIAL_FEATURE);
|
||||||
chopstx_claim_irq (&interrupt, INTR_REQ_USB);
|
chopstx_claim_irq (&interrupt, INTR_REQ_USB);
|
||||||
usb_interrupt_handler ();
|
usb_interrupt_handler (); /* For old SYS < 3.0 */
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
epi_init (epi, ENDP1, notify_tx, c);
|
epi_init (epi, ENDP1, notify_tx, c);
|
||||||
@@ -1394,16 +1397,18 @@ ccid_thread (void *arg)
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
eventmask_t m;
|
eventmask_t m;
|
||||||
uint32_t timeout = USB_ICC_TIMEOUT;
|
|
||||||
chopstx_poll_cond_t poll_desc;
|
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);
|
chopstx_poll (&timeout, 2, &interrupt, &poll_desc);
|
||||||
if (interrupt.ready)
|
if (interrupt.ready)
|
||||||
usb_interrupt_handler ();
|
{
|
||||||
|
usb_interrupt_handler ();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (poll_desc.ready)
|
timeout = USB_ICC_TIMEOUT;
|
||||||
m = eventflag_wait (&c->ccid_comm);
|
m = eventflag_get (&c->ccid_comm);
|
||||||
|
|
||||||
if (m == EV_USB_RESET)
|
if (m == EV_USB_RESET)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user