/* SPDX-License-Identifier: GPL-2.0-or-later */ /*************************************************************************** * Copyright (C) 2019 by Andreas Bolsch * * andreas.bolsch@mni.thm.de * ***************************************************************************/ .text .syntax unified .cpu cortex-m0 .thumb .thumb_func /* Params: * r0 - total count (bytes), crc32 (out) * r1 - flash page size * r2 - address offset into flash * r3 - OCTOSPI io_base * Clobbered: * r4 - tmp * r5 - address of OCTOSPI_DR * r6 - address of OCTOSPI_CCR * r7 - tmp */ #include "../../../../src/flash/nor/stmqspi.h" #define OCTOSPI_CCR_CCR (OCTOSPI_CCR - OCTOSPI_CCR) #define OCTOSPI_TCR_CCR (OCTOSPI_TCR - OCTOSPI_CCR) #define OCTOSPI_IR_CCR (OCTOSPI_IR - OCTOSPI_CCR) .macro octospi_abort movs r5, #(1< CRC32XOR, pos. -> 0x0 */ lsls r4, r4, #1 /* shift result */ eors r4, r4, r7 /* eor by CRC32XOR or 0x0 */ .endr adds r2, r2, #1 /* increment address */ subs r0, r0, #1 /* decrement (count-1) */ bmi exit /* stop if no data left */ tst r2, r1 /* page end ? */ bne read_loop /* if not, then next byte */ page_end: bal start_read /* then next page */ .pool exit: mvns r0, r4 /* invert to get final result */ octospi_abort /* to idle state */ .align 2 /* align to word, bkpt is 4 words */ bkpt #0 /* before code end for exit_point */ .align 2 /* align to word */ cr_page_read: .space 4 /* OCTOSPI_CR value for read command */ ccr_page_read: .space 4 /* OCTOSPI_CCR value for read command */ tcr_page_read: .space 4 /* OCTOSPI_TCR value for read command */ ir_page_read: .space 4 /* OCTOSPI_IR value for read command */