esp8266 Flash Memory Map

看了一下esp-open-sdk,Cache_Read_Enable()是boot rom 提供的api,lx106-hal有cache源码,下一步再研究具体怎么实现

1 Flash Memory Map
Map the flash

/*
 * Memory map first 8Mbit of flash
 * address space is: 0x4020 0000 - 0x402F FFFF
 */
Cache_Read_Enable (0, 0, 0);
 */

Unmap the flash

Cache_Read_Disable();

2 Cache_Read_Enable
void Cache_Read_Enable(uint8 odd_even, uint8 mb_count, unt8 no_idea);

Valid values for odd_even:

0 – clears bits 24 & 25 of control register 0x3FF0000C
1 – clears bit 24, sets bit 25

other – clears bit 25, sets bit 24

Function of odd_even:

0 – allows access to even numbered mb
1 – allow access to odd numbered mb

other – appears to do the same as 1, there must be a difference but I haven’t worked out what it it

Valid values for mb_count:

0-7 – set bits 16, 17 & 18 of control register 0x3FF0000C

Function of mb_count:

Which odd or even bank to map (according to odd_even option)

e.g. mb_count = 0, odd_even = 0 -> map first 8Mbit of flash
e.g. mb_count = 0, odd_even = 1 -> map second 8Mbit of flash
e.g. mb_count = 1, odd_even = 0 -> map third 8Mbit of flash
e.g. mb_count = 1, odd_even = 1 -> map fourth 8Mbit of flash

Valid values for no_idea:

0 – sets bit 3 of 0x3FF00024
1 – sets bit 26 of 0x3FF0000C and sets bits 3 & 4 of 0x3FF00024

Function of no_idea:

The clue is in the name, I can’t work out what this does from my experiments, but the SDK always sets this to 1.

Reference http://wiki.jackslab.org/ESP8266_Flash#Cache_Read_Enable

你可能感兴趣的:(singlechip)