@@ -152,6 +152,49 @@ algorithm!(RP2Algo, {
152152const BLOCK_SIZE : u32 = 65536 ;
153153const SECTOR_SIZE : u32 = 4096 ;
154154const BLOCK_ERASE_CMD : u8 = 0xd8 ;
155+ const FLASH_BASE : u32 = 0x1000_0000 ;
156+
157+ #[ repr( C ) ]
158+ pub struct FlashDevice {
159+ pub version : u16 ,
160+ pub device_name : [ u8 ; 128 ] ,
161+ pub device_type : u16 ,
162+ pub device_address : u32 ,
163+ pub size_device : u32 ,
164+ pub size_page : u32 ,
165+ pub reserved : u32 ,
166+ pub val_empty : u8 ,
167+ pub timeout_program : u32 ,
168+ pub timeout_erase : u32 ,
169+ pub sectors : [ u32 ; 4 ] ,
170+ }
171+
172+ #[ cfg( feature = "device_description" ) ]
173+ #[ no_mangle]
174+ #[ link_section = ".DevDscr" ]
175+ pub static FlashDevice : FlashDevice = FlashDevice {
176+ version : 1 , // Version 1.01
177+ device_name : [
178+ 0x52 , 0x61 , 0x73 , 0x70 , 0x65 , 0x72 , 0x72 , 0x79 , 0x20 , 0x50 , 0x69 , 0x20 , 0x52 , 0x50 , 0x32 ,
179+ 0x30 , 0x34 , 0x30 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
180+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
181+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
182+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
183+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
184+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
185+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
186+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
187+ ] , // "Rasperry Pi RP2040"
188+ device_type : 5 , // External SPI
189+ device_address : FLASH_BASE , // Default device start address
190+ size_device : 16 * 1024 * 1024 , // Total Size of device (16 MiB)
191+ size_page : PAGE_SIZE , // Programming page size
192+ reserved : 0 , // Must be zero
193+ val_empty : 0xFF , // Content of erase memory
194+ timeout_program : 500 , // 500 ms
195+ timeout_erase : 5000 , // 5 s
196+ sectors : [ SECTOR_SIZE , FLASH_BASE , 0xFFFFFFFF , 0xFFFFFFFF ] ,
197+ } ;
155198
156199impl FlashAlgorithm for RP2Algo {
157200 fn new ( _address : u32 , _clock : u32 , _function : Function ) -> Result < Self , ErrorCode > {
0 commit comments