fn write_words_chunk(&self, offset: u32, words: &[u32]) -> Result<(), Error> {
        debug_assert!(
            words.len() <= LCODE_MAX_RW_WORDS,
            "write_words requests cannot exceed {} words",
            LCODE_MAX_RW_WORDS
        );

        let mut arm_code = Vec::with_capacity(LCODE_ARM_RW_WORDS + words.len());
        arm_code.extend_from_slice(&[
            // `ldr   r0, [pc, #32] ; ldr r0,[write_addr]`
            0x_e5_9f_00_20_u32.to_le(),
            // `add   r1, pc, #36   ; adr r1, write_data`
            0x_e2_8f_10_24_u32.to_le(),
            // `ldr   r2, [pc, #28] ; ldr r2,[write_count]`
            0x_e5_9f_20_1c_u32.to_le(),
            // `cmp   r2, #LCODE_MAX_RW_WORDS`
            (0x_e3_52_00_00_u32 + LCODE_MAX_RW_WORDS as u32).to_le(),
            // `movgt r2, #LCODE_MAX_RW_WORDS`
            (0x_c3_a0_20_00_u32 + LCODE_MAX_RW_WORDS as u32).to_le(),
            // write_loop:
            // `subs  r2, r2, #1    ; r2 -= 1`
            0x_e2_52_20_01_u32.to_le(),
            // `bxmi  lr            ; return if (r2 < 0)`
            0x_41_2f_ff_1e_u32.to_le(),
            // `ldr   r3, [r1], #4  ; load and post-inc`
            0x_e4_91_30_04_u32.to_le(),
            // `str   r3, [r0], #4  ; store and post-inc`
            0x_e4_80_30_04_u32.to_le(),
            // `b     write_loop`
            0x_ea_ff_ff_fa_u32.to_le(),
            offset.to_le(),
            (words.len() as u32).to_le(),
        ]);
        // write_data (buffer) follows, i.e. values go here.
        // copy values from source buffer
        for word in words.iter() {
            arm_code.push(word.to_le());
        }

        // scratch buffer setup: transfers ARM code and data
        self.fel_write(self.soc_info.get_scratch_addr(), u32_as_u8(&arm_code))
            .context("unable to write ARM code to scratch address")?;
        // execute code
        self.fel_execute(self.soc_info.get_scratch_addr())
            .context("unable to execute ARM code")?;

        Ok(())
    }
/// Write words chunk to the FEL device memory.
Write words chunk to the FEL device memory.
Write words chunk to the FEL device memory .
fn write_words_chunk(&self, offset: u32, words: &[u32]) -> Result<(), Error> {
        debug_assert!(
            words.len() <= LCODE_MAX_RW_WORDS,
            "write_words requests cannot exceed {} words",
            LCODE_MAX_RW_WORDS
        );
        let mut arm_code = Vec::with_capacity(LCODE_ARM_RW_WORDS + words.len());
        arm_code.extend_from_slice(&[
            // `ldr   r0, [pc, #32] ; ldr r0,[write_addr]`
            0x_e5_9f_00_20_u32.to_le(),
            // `add   r1, pc, #36   ; adr r1, write_data`
            0x_e2_8f_10_24_u32.to_le(),
            // `ldr   r2, [pc, #28] ; ldr r2,[write_count]`
            0x_e5_9f_20_1c_u32.to_le(),
            // `cmp   r2, #LCODE_MAX_RW_WORDS`
            (0x_e3_52_00_00_u32 + LCODE_MAX_RW_WORDS as u32).to_le(),
            // `movgt r2, #LCODE_MAX_RW_WORDS`
            (0x_c3_a0_20_00_u32 + LCODE_MAX_RW_WORDS as u32).to_le(),
            // write_loop:
            // `subs  r2, r2, #1    ; r2 -= 1`
            0x_e2_52_20_01_u32.to_le(),
            // `bxmi  lr            ; return if (r2 < 0)`
            0x_41_2f_ff_1e_u32.to_le(),
            // `ldr   r3, [r1], #4  ; load and post-inc`
            0x_e4_91_30_04_u32.to_le(),
            // `str   r3, [r0], #4  ; store and post-inc`
            0x_e4_80_30_04_u32.to_le(),
            // `b     write_loop`
            0x_ea_ff_ff_fa_u32.to_le(),
            offset.to_le(),
            (words.len() as u32).to_le(),
        ]);
        // write_data (buffer) follows, i.e. values go here.
        // copy values from source buffer
        for word in words.iter() {
            arm_code.push(word.to_le());
        }
        // scratch buffer setup: transfers ARM code and data
        self.fel_write(self.soc_info.get_scratch_addr(), u32_as_u8(&arm_code))
            .context("unable to write ARM code to scratch address")?;
        // execute code
        self.fel_execute(self.soc_info.get_scratch_addr())
            .context("unable to execute ARM code")?;
        Ok(())
    }
fn write_words_chunk ( & self , offset : u32 , words : & [ u32 ] ) -> Result < ( ) , Error > { debug_assert ! ( words len ( ) LCODE_MAX_RW_WORDS " " LCODE_MAX_RW_WORDS ) ; let mut arm_code = Vec :: with_capacity ( LCODE_ARM_RW_WORDS + words . len ( ) ) ; arm_code . extend_from_slice ( & [ // `ldr   r0, [pc, #32] ; ldr r0,[write_addr]` 0x_e5_9f_00_20_u32 . to_le ( ) , // `add   r1, pc, #36   ; adr r1, write_data` 0x_e2_8f_10_24_u32 . to_le ( ) , // `ldr   r2, [pc, #28] ; ldr r2,[write_count]` 0x_e5_9f_20_1c_u32 . to_le ( ) , // `cmp   r2, #LCODE_MAX_RW_WORDS` ( 0x_e3_52_00_00_u32 + LCODE_MAX_RW_WORDS as u32 ) . to_le ( ) , // `movgt r2, #LCODE_MAX_RW_WORDS` ( 0x_c3_a0_20_00_u32 + LCODE_MAX_RW_WORDS as u32 ) . to_le ( ) , // write_loop: // `subs  r2, r2, #1    ; r2 -= 1` 0x_e2_52_20_01_u32 . to_le ( ) , // `bxmi  lr            ; return if (r2 < 0)` 0x_41_2f_ff_1e_u32 . to_le ( ) , // `ldr   r3, [r1], #4  ; load and post-inc` 0x_e4_91_30_04_u32 . to_le ( ) , // `str   r3, [r0], #4  ; store and post-inc` 0x_e4_80_30_04_u32 . to_le ( ) , // `b     write_loop` 0x_ea_ff_ff_fa_u32 . to_le ( ) , offset . to_le ( ) , ( words . len ( ) as u32 ) . to_le ( ) , ] ) ; // write_data (buffer) follows, i.e. values go here. // copy values from source buffer for word in words . iter ( ) { arm_code . push ( word . to_le ( ) ) ; } // scratch buffer setup: transfers ARM code and data self . fel_write ( self . soc_info . get_scratch_addr ( ) , u32_as_u8 ( & arm_code ) ) . context ( " " ) ? ; // execute code self . fel_execute ( self . soc_info . get_scratch_addr ( ) ) . context ( " " ) ? ; Ok ( ( ) ) }
Write words chunk to the FEL device memory.
Write words chunk to the FEL device memory .
&self
offset
u32
words
&[u32]
&self
offset
u32
words
&[u32]