Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c index 29e1450..1c4afb0 100644 void _backlight_off(void) void _buttonlight_on(void) { +#if 0 GPIOB_DIR |= 1<<5; GPIOB_PIN(5) = (1<<5); buttonlight_is_on = 1; +#endif } void _buttonlight_off(void) { +#if 0 GPIOB_PIN(5) = 0; GPIOB_DIR &= ~(1<<5); buttonlight_is_on = 0; +#endif } diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index 060933d..51d3d53 100644 int button_read_device(void) btn |= BUTTON_SELECT; if (GPIOC_PIN(5) & 1<<5) btn |= BUTTON_RIGHT; - if (GPIOB_PIN(1) & 1<<1) + if (!(GPIOB_PIN(1) & 1<<1)) btn |= BUTTON_HOME; if (gpiod6 & 1<<6) { /* power/hold is on the same pin. we know it's hold if the bit isn't diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 85913ec..0393d49 100644 static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); +static const int model = 1; + static tCardInfo card_info[NUM_DRIVES]; /* for compatibility */ static bool send_cmd(const int drive, const int cmd, const int arg, const int fl #if defined(HAVE_MULTIDRIVE) if(sd_present(SD_SLOT_AS3525)) GPIOB_PIN(5) = (1-drive) << 5; +#elif defined(SANSA_FUZEV2) + if (model == 1) + GPIOB_PIN(5) = (1-drive) << 5; #endif MCI_ARGUMENT = arg; + int card_no; + if (model == 1) + card_no = 1 << 16; + else + card_no = CMD_CARD_NO(drive); + /* Construct MCI_COMMAND */ MCI_COMMAND = /*b5:0*/ cmd static bool send_cmd(const int drive, const int cmd, const int arg, const int fl /*b13 */ | (TRANSFER_CMD ? CMD_WAIT_PRV_DAT_BIT: 0) /*b14 | CMD_ABRT_CMD_BIT unused */ /*b15 | CMD_SEND_INIT_BIT unused */ - /*b20:16 */ | CMD_CARD_NO(drive) + /*b20:16 */ | card_no /*b21 | CMD_SEND_CLK_ONLY unused */ /*b22 | CMD_READ_CEATA unused */ /*b23 | CMD_CCS_EXPECTED unused */ /*b31 */ | CMD_DONE_BIT; -#ifdef SANSA_FUZEV2 +#if 0 //def SANSA_FUZEV2 extern int buttonlight_is_on; if(buttonlight_is_on) _buttonlight_on(); static int sd_init_card(const int drive) /* assume 24 MHz clock / 60 = 400 kHz */ MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */ + mci_delay(); + mci_delay(); + mci_delay(); + mci_delay(); /* 100 - 400kHz clock required for Identification Mode */ /* Start of Card Identification Mode ************************************/ static int sd_init_card(const int drive) if(!send_cmd(drive, SD_GO_IDLE_STATE, 0, MCI_NO_RESP, NULL)) return -1; mci_delay(); + mci_delay(); + mci_delay(); /* CMD8 Check for v2 sd card. Must be sent before using ACMD41 Non v2 cards will not respond to this command*/ static int sd_init_card(const int drive) /* ACMD41 For v2 cards set HCS bit[30] & send host voltage range to all */ if(!send_cmd(drive, SD_APP_OP_COND, (0x00FF8000 | (sd_v2 ? 1<<30 : 0)), MCI_RESP, &card_info[drive].ocr)) + { + panicf("ERROR OPCOND 0x%x", cmd_error); return -3; + } } while(!(card_info[drive].ocr & (1<<31)) ); /* CMD2 send CID */ static int sd_init_card(const int drive) #endif /* End of Card Identification Mode ************************************/ +#if 0 /* Attempt to switch cards to HS timings, non HS cards just ignore this */ /* CMD7 w/rca: Select card to put it in TRAN state */ if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL)) static int sd_init_card(const int drive) /* CMD7 w/rca=0: Deselect card to put it in STBY state */ if(!send_cmd(drive, SD_DESELECT_CARD, 0, MCI_NO_RESP, NULL)) return -10; - +#endif /* CMD9 send CSD */ if(!send_cmd(drive, SD_SEND_CSD, card_info[drive].rca, MCI_RESP|MCI_LONG_RESP, card_info[drive].csd)) + { + panicf("ERROR CSD 0x%x", cmd_error); return -11; + } sd_parse_csd(&card_info[drive]); static int sd_init_card(const int drive) if(!send_cmd(drive, SD_SELECT_CARD, card_info[drive].rca, MCI_NO_RESP, NULL)) return -12; -#ifndef BOOTLOADER +#if 0 //ndef BOOTLOADER /* Switch to to 4 bit widebus mode */ if(sd_wait_for_tran_state(drive) < 0) return -13; static void init_controller(void) { int hcon_numcards = ((MCI_HCON>>1) & 0x1F) + 1; int card_mask = (1 << hcon_numcards) - 1; + int pwr_mask; + + if (model == 1) + { + pwr_mask = 1 << 1; + //card_mask |= card_mask << 16; // LP + } + else + pwr_mask = card_mask; - MCI_PWREN &= ~card_mask; /* power off all cards */ - - MCI_CLKSRC = 0x00; /* All CLK_SRC_CRD set to 0*/ - MCI_CLKDIV = 0x00; /* CLK_DIV_0 : bits 7:0 */ + MCI_PWREN &= ~pwr_mask; /* power off all cards */ + mci_delay(); + mci_delay(); - MCI_PWREN |= card_mask; /* power up cards */ + MCI_PWREN = pwr_mask; /* power up cards */ + mci_delay(); + mci_delay(); + mci_delay(); mci_delay(); MCI_CTRL |= CTRL_RESET; while(MCI_CTRL & CTRL_RESET) ; +#if 0 + MCI_CLKSRC = 0x00; /* All CLK_SRC_CRD set to 0*/ + MCI_CLKDIV = 0x00; /* CLK_DIV_0 : bits 7:0 */ +#endif + MCI_RAW_STATUS = 0xffffffff; /* Clear all MCI Interrupts */ MCI_TMOUT = 0xffffffff; /* data b31:8, response b7:0 */ int sd_init(void) GPIOA_IE |= EXT_SD_BITS; /* Configure XPD for SD-MCI interface */ - CCU_IO |= (1<<2); #endif + CCU_IO |= (1<<2); VIC_INT_ENABLE = INTERRUPT_NAND; |