@@ -12,14 +12,7 @@ use crate::{
1212impl IO for SerialConnection {
1313 async fn read ( & mut self , address : u64 , size : usize ) -> Result < Vec < u8 > , TockloaderError > {
1414 let mut pkt = ( address as u32 ) . to_le_bytes ( ) . to_vec ( ) ;
15- <<<<<<< HEAD
1615 pkt. append ( & mut ( size as u16 ) . to_le_bytes ( ) . to_vec ( ) ) ;
17- =======
18- let length = ( size as u16 ) . to_le_bytes( ) . to_vec( ) ;
19- for i in length {
20- pkt. push( i) ;
21- }
22- >>>>>>> 6 df3b8d ( feat : io rework )
2316 let stream = self . stream . as_mut ( ) . expect ( "Board must be open" ) ;
2417
2518 let ( _, appdata) = issue_command (
@@ -41,7 +34,6 @@ impl IO for SerialConnection {
4134 }
4235
4336 async fn write ( & mut self , address : u64 , pkt : & [ u8 ] ) -> Result < ( ) , TockloaderError > {
44- <<<<<<< HEAD
4537 let page_size = self . get_settings ( ) . page_size as usize ;
4638 let stream = self . stream . as_mut ( ) . expect ( "Board must be open" ) ;
4739 let mut binary = pkt. to_vec ( ) ;
@@ -56,28 +48,6 @@ impl IO for SerialConnection {
5648 . to_vec ( ) ;
5749 pkt. append (
5850 & mut binary[ ( page_number * page_size) ..( ( page_number + 1 ) * page_size) ] . to_vec ( ) ,
59- =======
60- let settings = self . get_settings( ) ;
61- let stream = self . stream. as_mut( ) . expect( "Board must be open" ) ;
62- let mut binary = pkt. to_vec( ) ;
63-
64- if !binary. len( ) . is_multiple_of( settings. page_size as usize) {
65- binary. extend( vec ! [
66- 0u8 ;
67- settings. page_size as usize
68- - ( binary. len( ) % settings. page_size as usize )
69- ] ) ;
70- }
71-
72- for page_number in 0 ..( binary. len( ) / settings. page_size as usize) {
73- let mut pkt = ( address as u32 + page_number as u32 * settings. page_size as u32)
74- . to_le_bytes( )
75- . to_vec( ) ;
76- pkt. append(
77- & mut binary[ ( page_number * settings. page_size as usize )
78- ..( ( page_number + 1 ) * settings. page_size as usize ) ]
79- . to_vec( ) ,
80- >>>>>>> 6 df3b8d ( feat: io rework)
8151 ) ;
8252 let _ = issue_command ( stream, Command :: WritePage , pkt, true , 0 , Response :: OK ) . await ?;
8353 }
@@ -97,20 +67,12 @@ impl IOCommands for SerialConnection {
9767 if !self . is_open ( ) {
9868 return Err ( InternalError :: ConnectionNotOpen . into ( ) ) ;
9969 }
100- <<<<<<< HEAD
10170 let start_address = self . get_settings ( ) . start_address ;
102- =======
103- let settings = self . get_settings( ) ;
104- >>>>>>> 6 df3b8d ( feat : io rework )
10571 let stream = self . stream . as_mut ( ) . expect ( "Board must be open" ) ;
10672
10773 ping_bootloader_and_wait_for_response ( stream) . await ?;
10874
109- <<<<<<< HEAD
11075 AppAttributes :: read_apps_data_serial ( stream, start_address) . await
111- =======
112- AppAttributes :: read_apps_data_serial ( stream , settings. start_address ) . await
113- >>>>>>> 6 df3b8d ( feat : io rework )
11476 }
11577
11678 async fn read_system_attributes ( & mut self ) -> Result < SystemAttributes , TockloaderError > {
0 commit comments