save memory (3)

This commit is contained in:
NIIBE Yutaka
2011-05-11 09:31:16 +09:00
parent 0ef47be2da
commit 582612ddc7
2 changed files with 20 additions and 10 deletions

View File

@@ -1,7 +1,8 @@
2011-05-11 NIIBE Yutaka <gniibe@fsij.org> 2011-05-11 NIIBE Yutaka <gniibe@fsij.org>
* src/flash.c (keystore_pool): Remove. Use &_keystore_pool. * src/usb-icc.c (icc_thread): Remove. Use chThdSelf ().
* src/flash.c (keystore_pool): Remove. Use &_keystore_pool.
* src/ac.c (auth_status): Don't assign 0 as it's automatically * src/ac.c (auth_status): Don't assign 0 as it's automatically
cleared. cleared.

View File

@@ -112,8 +112,6 @@ static uint8_t *icc_chain_p;
*/ */
static int icc_tx_size; static int icc_tx_size;
static Thread *icc_thread;
#define EV_RX_DATA_READY (eventmask_t)1 /* USB Rx data available */ #define EV_RX_DATA_READY (eventmask_t)1 /* USB Rx data available */
/* EV_EXEC_FINISHED == 2 */ /* EV_EXEC_FINISHED == 2 */
#define EV_TX_FINISHED (eventmask_t)4 /* USB Tx finished */ #define EV_TX_FINISHED (eventmask_t)4 /* USB Tx finished */
@@ -125,8 +123,12 @@ void
EP1_IN_Callback (void) EP1_IN_Callback (void)
{ {
if (icc_next_p == NULL) if (icc_next_p == NULL)
{
Thread *me = chThdSelf ();
/* The sequence of Bulk-IN transactions finished */ /* The sequence of Bulk-IN transactions finished */
chEvtSignalI (icc_thread, EV_TX_FINISHED); chEvtSignalI (me, EV_TX_FINISHED);
}
else if (icc_next_p == &icc_buffer[icc_tx_size]) else if (icc_next_p == &icc_buffer[icc_tx_size])
/* It was multiple of USB_LL_BUF_SIZE */ /* It was multiple of USB_LL_BUF_SIZE */
{ {
@@ -217,8 +219,12 @@ EP2_OUT_Callback (void)
icc_prepare_receive (0); icc_prepare_receive (0);
} }
else else
/* Notify icc_thread */ {
chEvtSignalI (icc_thread, EV_RX_DATA_READY); Thread *me = chThdSelf ();
/* Notify myself */
chEvtSignalI (me, EV_RX_DATA_READY);
}
} }
} }
@@ -305,8 +311,12 @@ icc_power_on (void)
int size_atr; int size_atr;
if (gpg_thread == NULL) if (gpg_thread == NULL)
{
Thread *me = chThdSelf ();
gpg_thread = chThdCreateStatic (waGPGthread, sizeof(waGPGthread), gpg_thread = chThdCreateStatic (waGPGthread, sizeof(waGPGthread),
NORMALPRIO, GPGthread, (void *)icc_thread); NORMALPRIO, GPGthread, (void *)me);
}
size_atr = sizeof (ATR); size_atr = sizeof (ATR);
icc_buffer[0] = ICC_DATA_BLOCK_RET; icc_buffer[0] = ICC_DATA_BLOCK_RET;
@@ -681,7 +691,6 @@ USBthread (void *arg)
{ {
(void)arg; (void)arg;
icc_thread = chThdSelf ();
chEvtClear (ALL_EVENTS); chEvtClear (ALL_EVENTS);
icc_state = ICC_STATE_START; icc_state = ICC_STATE_START;