From 1da2567df43f8c8faced3df1730eb4ee3039d24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sat, 24 Nov 2012 07:00:00 +0000 Subject: [PATCH] write diagnostic message if PIC initialization failed --- BaS_gcc/Makefile | 2 +- BaS_gcc/sources/BaS.c | 15 +++++++++++---- BaS_gcc/sources/sd_card.c | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index 56ec251..676e5c9 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -10,7 +10,7 @@ # can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint # toolchain -COMPILE_ELF=N +COMPILE_ELF=Y ifeq (Y,$(COMPILE_ELF)) TCPREFIX=m68k-elf- diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index 706d7c3..da5a608 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -57,7 +57,7 @@ static inline bool pic_rxready(void) void write_pic_byte(uint8_t value) { - /* Wait until the tramsmitter is ready or 1000us are passed */ + /* Wait until the transmitter is ready or 1000us are passed */ waitfor(1000, pic_txready); /* Transmit the byte */ @@ -75,7 +75,7 @@ uint8_t read_pic_byte(void) void pic_init(void) { - char answer[4]; + char answer[4] = "OLD"; xprintf("initialize the PIC: "); @@ -91,7 +91,14 @@ void pic_init(void) answer[2] = read_pic_byte(); answer[3] = '\0'; - xprintf("%s\r\n", answer); + if (answer[0] != 'O' || answer[1] != 'K' || answer[2] != '!') + { + xprintf("PIC initialization failed. Already initialized?\r\n"); + } + else + { + xprintf("%s\r\n", answer); + } } void nvram_init(void) @@ -135,7 +142,7 @@ void BaS(void) if (az_sectors > 0) { - //sd_card_idle(); + sd_card_idle(); } pic_init(); diff --git a/BaS_gcc/sources/sd_card.c b/BaS_gcc/sources/sd_card.c index bdcde22..0b49a96 100644 --- a/BaS_gcc/sources/sd_card.c +++ b/BaS_gcc/sources/sd_card.c @@ -205,7 +205,21 @@ void sd_card_read_ic(void) if (rb == 5) { - ; /* sd v1 */ + while (rb == 5) + { + rb = sd_send_byte(0xff); + rb = sd_send_byte(0x7a); + rb = sd_send_byte(0x00); + rb = sd_send_byte(0x00); + rb = sd_send_byte(0x00); + rb = sd_send_byte(0x00); + rb = sd_send_byte(0x01); + rb = sd_card_get_status(); + } + } + else if (rb == 1) + { + //sd_card_read_ic(); } else {