@@ -139,10 +139,14 @@ struct RP2Algo {
139139}
140140
141141algorithm ! ( RP2Algo , {
142+ device_name: "Raspberry Pi RP2" ,
143+ device_type: DeviceType :: ExtSpi ,
142144 flash_address: 0x1000_0000 ,
143145 flash_size: 0x0100_0000 ,
144146 page_size: 0x100 ,
145147 empty_value: 0xFF ,
148+ program_time_out: 500 , // 500 ms
149+ erase_time_out: 5000 , // 5 s
146150 sectors: [ {
147151 size: 0x1000 ,
148152 address: 0x10000000 ,
@@ -152,55 +156,12 @@ algorithm!(RP2Algo, {
152156const BLOCK_SIZE : u32 = 65536 ;
153157const SECTOR_SIZE : u32 = 4096 ;
154158const 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- }
171159
172160#[ cfg( feature = "device_description" ) ]
173161#[ no_mangle]
174162#[ link_section = ".PrgData" ]
175163pub static dummy: u32 = 0 ;
176164
177- #[ cfg( feature = "device_description" ) ]
178- #[ no_mangle]
179- #[ link_section = ".DevDscr" ]
180- pub static FlashDevice : FlashDevice = FlashDevice {
181- version : 1 , // Version 1.01
182- device_name : [
183- 0x52 , 0x61 , 0x73 , 0x70 , 0x65 , 0x72 , 0x72 , 0x79 , 0x20 , 0x50 , 0x69 , 0x20 , 0x52 , 0x50 , 0x32 ,
184- 0x30 , 0x34 , 0x30 , 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 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
187- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
188- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
189- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
190- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
191- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
192- ] , // "Rasperry Pi RP2040"
193- device_type : 5 , // External SPI
194- device_address : FLASH_BASE , // Default device start address
195- size_device : 16 * 1024 * 1024 , // Total Size of device (16 MiB)
196- size_page : PAGE_SIZE , // Programming page size
197- reserved : 0 , // Must be zero
198- val_empty : 0xFF , // Content of erase memory
199- timeout_program : 500 , // 500 ms
200- timeout_erase : 5000 , // 5 s
201- sectors : [ SECTOR_SIZE , FLASH_BASE , 0xFFFFFFFF , 0xFFFFFFFF ] ,
202- } ;
203-
204165impl FlashAlgorithm for RP2Algo {
205166 fn new ( _address : u32 , _clock : u32 , _function : Function ) -> Result < Self , ErrorCode > {
206167 let funcs = ROMFuncs :: load ( ) ?;
0 commit comments