fix minor race with qdinc

This commit is contained in:
optixx 2009-10-24 16:43:49 +02:00
parent fe0df3430b
commit 9d72708064
5 changed files with 14 additions and 42 deletions

View File

@ -58,37 +58,6 @@ void usb_connect()
}
void send_reset()
{
info_P(PSTR("Reset SNES\n"));
cli();
snes_reset_on();
snes_reset_lo();
_delay_ms(2);
snes_reset_hi();
snes_reset_off();
sei();
}
void send_irq()
{
snes_irq_on();
snes_irq_lo();
_delay_us(20);
snes_irq_hi();
snes_irq_off();
}
void set_rom_mode()
{
if (usb_trans.req_bank_size == 0x8000) {
snes_lorom();
info_P(PSTR("Set SNES lowrom \n"));
} else {
snes_hirom();
info_P(PSTR("Set SNES hirom \n"));
}
}
void boot_startup_rom(uint16_t init_delay)
{

View File

@ -50,8 +50,9 @@
#define DO_CRC_CHECK_LOADER 0
#define DO_CRC_CHECK 0
#define DO_SHM_SCRATCHPAD 0
#define DO_SHM 0
#define DO_TIMER 0
#define DO_SHM_SCRATCHPAD 1
#define DO_SHM 1
#define DO_TIMER 1
#define DO_SHELL 0
#endif

View File

@ -1,6 +1,6 @@
/*
File: qd16boot01.smc
Time: Wed, 21 Oct 2009 21:10:02
Time: Sat, 24 Oct 2009 15:50:32
*/
#ifndef __FIFO_H__
#define __FIFO_H__

View File

@ -56,7 +56,7 @@ extern FILE uart_stdout;
#endif
extern system_t system;
uint8_t debug_level = (DEBUG | DEBUG_CRC);
uint8_t debug_level = (DEBUG | DEBUG_USB | DEBUG_CRC);
usb_transaction_t usb_trans;
@ -170,11 +170,6 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
* -------------------------------------------------------------------------
*/
} else if (rq->bRequest == USB_BULK_UPLOAD_END) {
if (usb_trans.req_state != REQ_STATUS_BULK_UPLOAD) {
debug_P(DEBUG_USB,
PSTR("USB_BULK_UPLOAD_END: ERROR state is not REQ_STATUS_BULK_UPLOAD\n"));
return 0;
}
debug_P(DEBUG_USB, PSTR("USB_BULK_UPLOAD_END:\n"));
usb_trans.req_state = REQ_STATUS_IDLE;
sram_bulk_write_end();
@ -219,6 +214,7 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
* -------------------------------------------------------------------------
*/
} else if (rq->bRequest == USB_SET_LAODER) {
debug_P(DEBUG_USB, PSTR("USB_SET_LAODER:\n"));
usb_trans.loader_enabled = rq->wValue.word;
ret_len = 0;
}
@ -275,8 +271,10 @@ int main(void)
info_P(PSTR("USB poll\n"));
while (usb_trans.req_state != REQ_STATUS_SNES) {
usbPoll();
#if DO_SHELL
#ifndef NO_DEBUG
shell_run();
#endif
#endif
}
@ -312,8 +310,10 @@ int main(void)
info_P(PSTR("Poll USB\n"));
while ((usb_trans.req_state != REQ_STATUS_AVR)) {
usbPoll();
#if DO_SHELL
#ifndef NO_DEBUG
shell_run();
#endif
#endif
}
//info_P(PSTR("-->Switch TO AVR\n"));

View File

@ -59,6 +59,8 @@ volatile uint8_t cr = 0;
uint8_t *token_ptr;
#if DO_SHELL
uint8_t *get_token(void)
{
uint8_t *p = token_ptr;
@ -488,4 +490,4 @@ void shell_run(void)
prompt();
}
#endif