Jelajahi Sumber

change init spi flash (because use new flash)

balbekova 6 tahun lalu
induk
melakukan
1f459be0fb
1 mengubah file dengan 12 tambahan dan 2 penghapusan
  1. 12 2
      peripheral_modules/src/spi_flash.c

+ 12 - 2
peripheral_modules/src/spi_flash.c

@@ -246,7 +246,7 @@ int spi_flash_erase_sector(int addr, uint32_t timeout) {
 //	tn_mutex_unlock(&spi_mutex);
 	return 0;
 }
-
+/*
 bool spi_flash_init(void) {
 	uint32_t i, ptable, bitsize = 0;
 	uint8_t tmp[4];
@@ -257,7 +257,7 @@ bool spi_flash_init(void) {
 
 	// check SFDP magic
 	spi_flash_read_sfdp(0, tmp, 4);
-	if (!(tmp[0] == 0x53 && tmp[1] == 0x46 && 
+	if (!(tmp[0] == 0x53 && tmp[1] == 0x46 &&
 		tmp[2] == 0x44 && tmp[3] == 0x50))
 		return 0;
 
@@ -296,6 +296,16 @@ bool spi_flash_init(void) {
     
     return 1;
 
+}*/
+
+bool spi_flash_init(void){
+	spi_init_();
+	spi_flash_desc.sector_size = SPI_FLASH_SECTOR_SIZE;
+	spi_flash_desc.sector_erase_op = 32;
+	spi_flash_desc.sector_count = 512;
+	spi_flash_desc.present = true;
+
+	return 1;
 }
 
 uint8_t txbuf1[] = "This film came out on DVD yesterday and I rushed to buy it. \