Now bootloader OK on Taranis
This commit is contained in:
+1
-1
@@ -232,7 +232,7 @@ void SystemInit(void)
|
||||
#ifdef VECT_TAB_SRAM
|
||||
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
|
||||
#else
|
||||
#if defined(BOOTLOADER)
|
||||
#if defined(BOOTLOADER) || defined(BOOT)
|
||||
extern uint32_t g_pfnVectors ;
|
||||
SCB->VTOR = (uint32_t) &g_pfnVectors ; /* Vector Table Relocation in Internal FLASH */
|
||||
#else
|
||||
|
||||
@@ -670,14 +670,23 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count)
|
||||
{
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
||||
|
||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
||||
do {
|
||||
if (!rcvr_datablock(buff, 512)) {
|
||||
break;
|
||||
if (count == 1) { /* Single block read */
|
||||
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
|
||||
if (rcvr_datablock(buff, 512)) {
|
||||
count = 0;
|
||||
}
|
||||
buff += 512;
|
||||
} while (--count);
|
||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
||||
}
|
||||
}
|
||||
else { /* Multiple block read */
|
||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
||||
do {
|
||||
if (!rcvr_datablock(buff, 512)) {
|
||||
break;
|
||||
}
|
||||
buff += 512;
|
||||
} while (--count);
|
||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
||||
}
|
||||
}
|
||||
|
||||
release_spi();
|
||||
@@ -695,29 +704,9 @@ DRESULT disk_read (
|
||||
if (drv || !count) return RES_PARERR;
|
||||
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
||||
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
||||
SD_ReadSectors(buff, sector, count);
|
||||
|
||||
if (count == 1) { /* Single block read */
|
||||
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
|
||||
if (rcvr_datablock(buff, 512)) {
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { /* Multiple block read */
|
||||
if (send_cmd(CMD18, sector) == 0) { /* READ_MULTIPLE_BLOCK */
|
||||
do {
|
||||
if (!rcvr_datablock(buff, 512)) {
|
||||
break;
|
||||
}
|
||||
buff += 512;
|
||||
} while (--count);
|
||||
send_cmd(CMD12, 0); /* STOP_TRANSMISSION */
|
||||
}
|
||||
}
|
||||
release_spi();
|
||||
|
||||
return count ? RES_ERROR : RES_OK;
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#define WriteData(x) AspiData(x)
|
||||
#define WriteCommand(x) AspiCmd(x)
|
||||
#define CONTRAST_OFS 5
|
||||
#define CONTRAST_OFS 5
|
||||
|
||||
static void LCD_Init()
|
||||
{
|
||||
@@ -22,9 +22,9 @@ static void LCD_Init()
|
||||
AspiCmd(0xEA); //set bias=1/10 :Command table NO.27
|
||||
AspiCmd(0x81); //Set Vop
|
||||
#if defined(BOOT)
|
||||
AspiCmd(CONTRAST_OFS);
|
||||
AspiCmd(CONTRAST_OFS+25);
|
||||
#else
|
||||
AspiCmd(g_eeGeneral.contrast+CONTRAST_OFS); //0--255
|
||||
AspiCmd(CONTRAST_OFS+g_eeGeneral.contrast);
|
||||
#endif
|
||||
AspiCmd(0xA6); //inverse display off
|
||||
AspiCmd(0xD1); //SET RGB:Command table NO.21 .SET RGB or BGR. D1=RGB
|
||||
|
||||
@@ -203,14 +203,11 @@ int8_t STORAGE_Read (uint8_t lun,
|
||||
uint16_t blk_len)
|
||||
{
|
||||
if (lun == 1) {
|
||||
if (fat12Read(buf, blk_addr, blk_len) != 0) {
|
||||
if (fat12Read(buf, blk_addr, blk_len) != 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (SD_ReadSectors(buf,
|
||||
blk_addr,
|
||||
blk_len) != 0) {
|
||||
if (SD_ReadSectors(buf, blk_addr, blk_len) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -238,9 +235,7 @@ int8_t STORAGE_Write (uint8_t lun,
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if (SD_WriteSectors(buf,
|
||||
blk_addr,
|
||||
blk_len) != 0)
|
||||
if (SD_WriteSectors(buf, blk_addr, blk_len) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user