1 // SPDX-License-Identifier: GPL-2.0-or-later
5 #define FLASH_BSY (1 << 0)
6 #define FLASH_PGERR (1 << 2)
7 #define FLASH_WRPRTERR (1 << 4)
9 void flash_write(volatile uint32_t *flash_sr,
10 uint32_t hwords_count,
12 uint16_t *target_addr) __attribute__((naked));
14 void flash_write(volatile uint32_t *flash_sr,
15 uint32_t hwords_count,
17 uint16_t *target_addr)
20 *target_addr = *buffer++;
25 } while (sr & FLASH_BSY);
27 if (sr & (FLASH_PGERR | FLASH_WRPRTERR))
31 } while (--hwords_count);