20
20
#include " OSPIFBlockDevice.h"
21
21
#include < string.h>
22
22
#include " rtos/ThisThread.h"
23
- #if defined(TARGET_MX25LM51245G)
24
- #include " MX25LM51245G_config.h"
25
- #endif
26
23
27
24
#ifndef MBED_CONF_MBED_TRACE_ENABLE
28
25
#define MBED_CONF_MBED_TRACE_ENABLE 0
@@ -51,18 +48,6 @@ using namespace mbed;
51
48
#define OSPIF_STATUS_BIT_WEL 0x2 // Write Enable Latch
52
49
#define OSPIF_NO_QUAD_ENABLE (-1 )
53
50
54
- // Configuration Register2 address
55
- #define OSPIF_CR2_OPI_EN_ADDR 0x00000000
56
- #define OSPIF_CR2_BANK_STATUS_ADDR 0xc0000000
57
- #define OSPIF_CR2_RWWDI ((uint8_t )0x00 ) /* !< No active program or erase operation */
58
- #define OSPIF_CR2_RWWDS ((uint8_t )0x01 ) /* !< Program/erase in other bank */
59
- #define OSPIF_CR2_RWWBS ((uint8_t )0x03 ) /* !< program/erase operation in addressed bank */
60
-
61
- #ifdef MX_FLASH_SUPPORT_RWW
62
- #define MX25LM51245G_BANK_SIZE 0x01000000 /* 16 MBytes */
63
- #define MX25LM51245G_BANK_SIZE_MASK ~(MX25LM51245G_BANK_SIZE - 1 ) /* 0xFF000000 */
64
- #endif
65
-
66
51
/* SFDP Header Parsing */
67
52
/* **********************/
68
53
#define OSPIF_RSFDP_DUMMY_CYCLES 8
@@ -177,6 +162,21 @@ using namespace mbed;
177
162
// Length of data returned from RDID instruction
178
163
#define OSPI_RDID_DATA_LENGTH 3
179
164
165
+ #ifdef NEED_DEFINE_SFDP_PARA
166
+ uint8_t _sfdp_head_table[32 ] = {0x53 , 0x46 , 0x44 , 0x50 , 0x06 , 0x01 , 0x02 , 0xFF , 0x00 , 0x06 , 0x01 ,
167
+ 0x10 , 0x30 , 0x00 , 0x00 , 0xFF , 0xC2 , 0x00 , 0x01 , 0x04 , 0x10 , 0x01 ,
168
+ 0x00 , 0xFF , 0x84 , 0x00 , 0x01 , 0x02 , 0xC0 , 0x00 , 0x00 , 0xFF
169
+ };
170
+ uint8_t _sfdp_basic_param_table[64 ] = {0x30 , 0xFF , 0xFB , 0xFF , 0xFF , 0xFF , 0xFF , 0x1F , 0xFF , 0xFF ,
171
+ 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x14 , 0xEC ,
172
+ 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x0C , 0x20 ,
173
+ 0x10 , 0xDC , 0x00 , 0xFF , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
174
+ 0x81 , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
175
+ 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
176
+ 0xFF , 0x50 , 0xF9 , 0x80
177
+ };
178
+ uint8_t _sfdp_4_byte_inst_table[8 ] = {0x7F , 0xEF , 0xFF , 0xFF , 0x21 , 0x5C , 0xDC , 0x14 };
179
+ #endif
180
180
181
181
/* Init function to initialize Different Devices CS static list */
182
182
static PinName *generate_initialized_active_ospif_csel_arr ();
@@ -407,7 +407,7 @@ int OSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
407
407
408
408
#ifdef MX_FLASH_SUPPORT_RWW
409
409
bool need_wait;
410
- need_wait = (_wait_flag != NOT_STARTED) && ((addr & MX25LM51245G_BANK_SIZE_MASK ) == _busy_bank);
410
+ need_wait = (_wait_flag != NOT_STARTED) && ((addr & MX25LW51245G_BANK_SIZE_MASK ) == _busy_bank);
411
411
412
412
// Wait for ready
413
413
if (need_wait) {
@@ -499,7 +499,7 @@ int OSPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size
499
499
500
500
#ifdef MX_FLASH_SUPPORT_RWW
501
501
_wait_flag = WRITE_WAIT_STARTED;
502
- _busy_bank = addr & MX25LM51245G_BANK_SIZE_MASK ;
502
+ _busy_bank = addr & MX25LW51245G_BANK_SIZE_MASK ;
503
503
504
504
_mutex.unlock ();
505
505
@@ -512,7 +512,7 @@ int OSPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size
512
512
goto exit_point;
513
513
}
514
514
_mutex.unlock ();
515
- #endif
515
+ #endif
516
516
buffer = static_cast <const uint8_t *>(buffer) + chunk;
517
517
addr += chunk;
518
518
size -= chunk;
@@ -606,7 +606,7 @@ int OSPIFBlockDevice::erase(bd_addr_t addr, bd_size_t size)
606
606
607
607
#ifdef MX_FLASH_SUPPORT_RWW
608
608
_wait_flag = ERASE_WAIT_STARTED;
609
- _busy_bank = addr & MX25LM51245G_BANK_SIZE_MASK ;
609
+ _busy_bank = addr & MX25LW51245G_BANK_SIZE_MASK ;
610
610
611
611
_mutex.unlock ();
612
612
@@ -1631,7 +1631,7 @@ bool OSPIFBlockDevice::_is_mem_ready_rww(bd_addr_t addr, uint8_t rw)
1631
1631
static uint32_t rww_cnt = 0 ; // For testing
1632
1632
static uint32_t rwe_cnt = 0 ; // For testing
1633
1633
1634
- bd_addr_t bank_addr = addr & MX25LM51245G_BANK_SIZE_MASK ;
1634
+ bd_addr_t bank_addr = addr & MX25LW51245G_BANK_SIZE_MASK ;
1635
1635
1636
1636
if ((_wait_flag == NOT_STARTED) || (!rw && bank_addr != _busy_bank)) {
1637
1637
return mem_ready;
0 commit comments