SmartSnippets DA1459x SDK
hw_fcu.h
Go to the documentation of this file.
1 
42 #ifndef HW_FCU_H_
43 #define HW_FCU_H_
44 
45 #if dg_configUSE_HW_FCU
46 
47 #include <stdbool.h>
48 #include "sdk_defs.h"
49 #include "hw_dma.h"
50 
51 /*
52  * The following macros are defined according to FCU properties and its registers default values
53  * and size in bits
54  */
55 #define HW_FCU_FLASH_PAGE_SIZE_IN_BYTES (2048)
56 #define HW_FCU_FLASH_PAGE_SIZE_IN_WORDS (HW_FCU_FLASH_PAGE_SIZE_IN_BYTES / 4)
57 
58 #define HW_FCU_ERASE_FLASH_PAGE_MIN_TIME (0x13880)
59 /*
60  * FLASH_PTERASE_REG[PTERASE] field is 24 bits but FCU hardware only uses
61  * 18 bits, so maximum erase time is 262143 us
62  */
63 #define HW_FCU_ERASE_FLASH_PAGE_MAX_TIME (0x3FFFF)
64 
65 #define HW_FCU_ERASE_FLASH_BLOCK_MIN_TIME (0x13880)
66 /*
67  * FLASH_PTME_REG[PTME] field is 24 bits but FCU hardware only uses
68  * 18 bits, so maximum erase time is 262143 us
69  */
70 #define HW_FCU_ERASE_FLASH_BLOCK_MAX_TIME (0x3FFFF)
71 
72 #define HW_FCU_ERASE_FLASH_PAGE_SEGMENT_MIN_TIME (0x3E8)
73 /*
74  * FLASH_PTERASE_SEG_REG[PTERASE_SEG] field is 24 bits but FCU hardware only uses
75  * 18 bits, so maximum erase time is 262143 us
76  */
77 #define HW_FCU_ERASE_FLASH_PAGE_SEGMENT_MAX_TIME (0x3FFFF)
78 
82 typedef enum {
83  HW_FCU_ERROR_ERASE_IN_PROGRESS = -5,
84  HW_FCU_ERROR_WRITE_IN_PROGRESS = -4,
85  HW_FCU_ERROR_PROTECTED_AGAINST_ACTION = -3,
86  HW_FCU_ERROR_INVALID_ADDRESS = -2,
87  HW_FCU_ERROR_INVALID_FUNCTION_INPUT = -1,
88  HW_FCU_ERROR_NONE = 0
89 } HW_FCU_ERROR;
90 
94 typedef enum {
102 
106 typedef enum {
110 
114 typedef enum {
120 
124 typedef enum {
125  HW_FCU_WAIT_CYCLES_0,
126  HW_FCU_WAIT_CYCLES_1,
127  HW_FCU_WAIT_CYCLES_2,
128  HW_FCU_WAIT_CYCLES_3,
129  HW_FCU_WAIT_CYCLES_4,
130  HW_FCU_WAIT_CYCLES_5,
131  HW_FCU_WAIT_CYCLES_6,
132  HW_FCU_WAIT_CYCLES_7,
133  HW_FCU_WAIT_CYCLES_MAX
135 
139 typedef enum {
143 
149 typedef void (*hw_fcu_operation_completed_cb)(void *user_data);
150 
156  void *user_data;
157 #if dg_configUSE_HW_DMA
159 #endif
160 };
161 
172 __STATIC_FORCEINLINE void hw_fcu_set_vdd_level_value(HW_FCU_VDD_LEVEL_VALUE value)
173 {
174  REG_SETF(FCU, FLASH_CTRL_REG, VDD_LEVEL_VALUE, value);
175 }
176 
188 {
189  return REG_GETF(FCU, FLASH_CTRL_REG, VDD_LEVEL_VALUE);
190 }
191 
195 __STATIC_FORCEINLINE void hw_fcu_enable_vdd_level_overriding(void)
196 {
197  REG_SET_BIT(FCU, FLASH_CTRL_REG, VDD_LEVEL_FORCE);
198 }
199 
203 __STATIC_FORCEINLINE void hw_fcu_disable_vdd_level_overriding(void)
204 {
205  REG_CLR_BIT(FCU, FLASH_CTRL_REG, VDD_LEVEL_FORCE);
206 }
207 
211 __STATIC_FORCEINLINE void hw_fcu_prohibit_flash_operations(void)
212 {
213  REG_SET_BIT(FCU, FLASH_CTRL_REG, FLASH_PROT);
214 }
215 
219 __STATIC_FORCEINLINE void hw_fcu_permit_flash_operations(void)
220 {
221  REG_CLR_BIT(FCU, FLASH_CTRL_REG, FLASH_PROT);
222 }
223 
229 __STATIC_FORCEINLINE bool hw_fcu_are_flash_operations_prohibited(void)
230 {
231  return REG_GETF(FCU, FLASH_CTRL_REG, FLASH_PROT) == 1;
232 }
233 
243 __STATIC_FORCEINLINE bool hw_fcu_is_flash_erase_suspended(void)
244 {
245  return REG_GETF(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_STAT) == 1;
246 }
247 
256 {
257  REG_SETF(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_MODE, mode);
258 }
259 
268 {
269  return REG_GETF(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_MODE);
270 }
271 
278 __STATIC_FORCEINLINE void hw_fcu_enable_erase_suspend(void)
279 {
280  REG_SET_BIT(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_EN);
281 }
282 
286 __STATIC_FORCEINLINE void hw_fcu_disable_erase_suspend(void)
287 {
288  REG_CLR_BIT(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_EN);
289 }
290 
296 __STATIC_FORCEINLINE bool hw_fcu_is_erase_suspend_enabled(void)
297 {
298  return REG_GETF(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_EN) == 1;
299 }
300 
307 __STATIC_FORCEINLINE bool hw_fcu_is_asleep(void)
308 {
309  return REG_GETF(FCU, FLASH_CTRL_REG, SLEEP) == 1;
310 }
311 
317 __STATIC_FORCEINLINE void hw_fcu_enable_dma(void)
318 {
319  REG_SET_BIT(FCU, FLASH_CTRL_REG, DMA_EN);
320 }
321 
327 __STATIC_FORCEINLINE void hw_fcu_disable_dma(void)
328 {
329  REG_CLR_BIT(FCU, FLASH_CTRL_REG, DMA_EN);
330 }
331 
337 __STATIC_FORCEINLINE bool hw_fcu_is_dma_enabled(void)
338 {
339  return REG_GETF(FCU, FLASH_CTRL_REG, DMA_EN) == 1;
340 }
341 
348 __STATIC_FORCEINLINE void hw_fcu_enable_bus_error(void)
349 {
350  REG_SET_BIT(FCU, FLASH_CTRL_REG, BUS_ERROR_EN);
351 }
352 
358 __STATIC_FORCEINLINE bool hw_fcu_is_bus_error_enabled(void)
359 {
360  return REG_GETF(FCU, FLASH_CTRL_REG, BUS_ERROR_EN) == 1;
361 }
362 
370 __STATIC_FORCEINLINE bool hw_fcu_get_bus_error_status(void)
371 {
372  return REG_GETF(FCU, FLASH_CTRL_REG, BUS_ERROR) == 1;
373 }
374 
378 __STATIC_FORCEINLINE void hw_fcu_clear_interrupt(void)
379 {
380  REG_SET_BIT(FCU, FLASH_CTRL_REG, IRQ_CLEAR);
381 }
382 
390 __STATIC_FORCEINLINE HW_FCU_WAIT_CYCLES hw_fcu_get_wait_cycles(void)
391 {
392  return REG_GETF(FCU, FLASH_CTRL_REG, WAIT_CYCLES);
393 }
394 
411 __STATIC_FORCEINLINE void hw_fcu_set_wait_cycles(HW_FCU_WAIT_CYCLES wait_cycles)
412 {
413  ASSERT_WARNING(wait_cycles < HW_FCU_WAIT_CYCLES_MAX);
414 
415  REG_SETF(FCU, FLASH_CTRL_REG, WAIT_CYCLES, wait_cycles);
416 }
417 
433 __STATIC_FORCEINLINE bool hw_fcu_is_protected_against_actions(uint32_t mask)
434 {
435  return ((FCU->FLASH_CTRL_REG & mask) != 0);
436 }
437 
443 __STATIC_FORCEINLINE void hw_fcu_enable_flash_read_protection(void)
444 {
445  REG_SET_BIT(FCU, FLASH_CTRL_REG, FLASH_RPROT);
446 }
447 
453 __STATIC_FORCEINLINE bool hw_fcu_is_flash_read_protection_enabled(void)
454 {
455  return REG_GETF(FCU, FLASH_CTRL_REG, FLASH_RPROT) == 1;
456 }
457 
463 __STATIC_FORCEINLINE void hw_fcu_enable_flash_write_protection(void)
464 {
465  REG_SET_BIT(FCU, FLASH_CTRL_REG, FLASH_WPROT);
466 }
467 
473 __STATIC_FORCEINLINE bool hw_fcu_is_flash_write_protection_enabled(void)
474 {
475  return REG_GETF(FCU, FLASH_CTRL_REG, FLASH_WPROT) == 1;
476 }
477 
483 __STATIC_FORCEINLINE bool hw_fcu_is_flash_read_mode_inhibited(void)
484 {
485  return REG_GETF(FCU, FLASH_CTRL_REG, PROG_RMIN) == 1;
486 }
487 
494 __STATIC_FORCEINLINE bool hw_fcu_is_erase_in_progress(void)
495 {
496  return REG_GETF(FCU, FLASH_CTRL_REG, PROG_ERS) == 1;
497 }
498 
505 __STATIC_FORCEINLINE void hw_fcu_resume_erase(void)
506 {
507  uint32_t reg_val = FCU->FLASH_CTRL_REG;
508  uint32_t mask = REG_MSK(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_EN) |
509  REG_MSK(FCU, FLASH_CTRL_REG, ERASE_SUSPEND_STAT);
510 
511  if (mask == (reg_val & mask)) {
512  REG_SET_BIT(FCU, FLASH_CTRL_REG, ERASE_RESUME);
513  while (!hw_fcu_is_erase_in_progress());
514  }
515 }
516 
523 __STATIC_FORCEINLINE bool hw_fcu_is_write_in_progress(void)
524 {
525  return REG_GETF(FCU, FLASH_CTRL_REG, PROG_WRS) == 1;
526 }
527 
536 {
537  REG_SETF(FCU, FLASH_CTRL_REG, PROG_SEL, mode);
538 }
539 
548 {
549  return REG_GETF(FCU, FLASH_CTRL_REG, PROG_SEL);
550 }
551 
560 {
561  REG_SETF(FCU, FLASH_CTRL_REG, PROG_MODE, mode);
562 }
563 
572 {
573  return REG_GETF(FCU, FLASH_CTRL_REG, PROG_MODE);
574 }
575 
581 __STATIC_FORCEINLINE void hw_fcu_set_sleep_mode(void)
582 {
583  REG_SET_BIT(FCU, FLASH_CTRL_REG, SLEEP_MODE);
584 }
585 
592 __STATIC_FORCEINLINE void hw_fcu_set_flash_hold_time(uint16_t hold_time)
593 {
594  ASSERT_WARNING(hold_time >= 100);
595  REG_SETF(FCU, FLASH_PTNVH1_REG, PTNVH1, hold_time);
596 }
597 
603 __STATIC_FORCEINLINE uint16_t hw_fcu_get_flash_hold_time(void)
604 {
605  return REG_GETF(FCU, FLASH_PTNVH1_REG, PTNVH1);
606 }
607 
614 __STATIC_FORCEINLINE void hw_fcu_set_flash_program_time(uint16_t prog_time)
615 {
616  ASSERT_WARNING(prog_time >= 8);
617  REG_SETF(FCU, FLASH_PTPROG_REG, PTPROG, prog_time);
618 }
619 
625 __STATIC_FORCEINLINE uint16_t hw_fcu_get_flash_program_time(void)
626 {
627  return REG_GETF(FCU, FLASH_PTPROG_REG, PTPROG);
628 }
629 
636 __STATIC_FORCEINLINE void hw_fcu_set_flash_page_erase_time(uint32_t erase_time)
637 {
638  ASSERT_WARNING(erase_time >= HW_FCU_ERASE_FLASH_PAGE_MIN_TIME &&
639  erase_time < HW_FCU_ERASE_FLASH_PAGE_MAX_TIME + 1);
640  REG_SETF(FCU, FLASH_PTERASE_REG, PTERASE, erase_time);
641 }
642 
648 __STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_page_erase_time(void)
649 {
650  return REG_GETF(FCU, FLASH_PTERASE_REG, PTERASE);
651 }
652 
659 __STATIC_FORCEINLINE void hw_fcu_set_flash_mass_erase_time(uint32_t erase_time)
660 {
661  ASSERT_WARNING(erase_time >= HW_FCU_ERASE_FLASH_BLOCK_MIN_TIME &&
662  erase_time < HW_FCU_ERASE_FLASH_BLOCK_MAX_TIME + 1);
663  REG_SETF(FCU, FLASH_PTME_REG, PTME, erase_time);
664 }
665 
671 __STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_mass_erase_time(void)
672 {
673  return REG_GETF(FCU, FLASH_PTME_REG, PTME);
674 }
675 
681 __STATIC_FORCEINLINE void hw_fcu_set_flash_sleep_to_standby_time(uint8_t wakeup_time)
682 {
683  ASSERT_WARNING(wakeup_time >= 3);
684  REG_SETF(FCU, FLASH_PTWK_SP_REG, PTWK_SP, wakeup_time);
685 }
686 
692 __STATIC_FORCEINLINE uint8_t hw_fcu_get_flash_sleep_to_standby_time(void)
693 {
694  return REG_GETF(FCU, FLASH_PTWK_SP_REG, PTWK_SP);
695 }
696 
702 __STATIC_FORCEINLINE void hw_fcu_set_flash_page_segment_erase_time(uint32_t erase_time)
703 {
704  ASSERT_WARNING(erase_time >= HW_FCU_ERASE_FLASH_PAGE_SEGMENT_MIN_TIME &&
705  erase_time < HW_FCU_ERASE_FLASH_PAGE_SEGMENT_MAX_TIME + 1);
706  REG_SETF(FCU, FLASH_PTERASE_SEG_REG, PTERASE_SEG, erase_time);
707 }
708 
714 __STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_page_segment_erase_time(void)
715 {
716  return REG_GETF(FCU, FLASH_PTERASE_SEG_REG, PTERASE_SEG);
717 }
718 
724 __STATIC_FORCEINLINE uint32_t hw_fcu_get_total_erase_counter(void)
725 {
726  return REG_GETF(FCU, FLASH_RTERASE_TOT_CNT_REG, RTERASE_TOT_CNT);
727 }
728 
734 __STATIC_FORCEINLINE uint32_t hw_fcu_get_segment_erase_counter(void)
735 {
736  return REG_GETF(FCU, FLASH_RTERASE_SEG_CNT_REG, RTERASE_SEG_CNT);
737 }
738 
742 __STATIC_FORCEINLINE void hw_fcu_enable_reset_delay(void)
743 {
744  REG_SET_BIT(CRG_TOP, RST_CTRL_REG, GATE_RST_WITH_FCU);
745 }
746 
750 __STATIC_FORCEINLINE void hw_fcu_disable_reset_delay(void)
751 {
752  REG_CLR_BIT(CRG_TOP, RST_CTRL_REG, GATE_RST_WITH_FCU);
753 }
754 
758 __ALWAYS_RETAINED_CODE void hw_fcu_wakeup(void);
759 
763 __ALWAYS_RETAINED_CODE void hw_fcu_sleep(void);
764 
770 __ALWAYS_RETAINED_CODE void hw_fcu_enable_erase(HW_FCU_FLASH_PROG_MODE mode);
771 
785 __ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_erase_page(uint32_t address,
786  struct hw_fcu_operation_params_t *params);
787 
800  uint32_t page_erase_time,
801  uint32_t segment_erase_time);
802 
820 __ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_erase_block(uint32_t address,
821  struct hw_fcu_operation_params_t *params);
822 
826 __ALWAYS_RETAINED_CODE void hw_fcu_enable_write(void);
827 
843 __ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_write(uint32_t *src, uint32_t address, uint32_t len,
844  struct hw_fcu_operation_params_t *params);
845 
849 __ALWAYS_RETAINED_CODE void hw_fcu_enable_read(void);
850 
869 __ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_read(uint32_t address, uint32_t *dst, uint32_t len,
870  struct hw_fcu_operation_params_t *params);
871 
877 __ALWAYS_RETAINED_CODE bool hw_fcu_is_available(void);
878 
879 #endif /* dg_configUSE_HW_FCU */
880 #endif /* HW_FCU_H_ */
881 
hw_fcu_enable_bus_error
__STATIC_FORCEINLINE void hw_fcu_enable_bus_error(void)
Enable bus error response.
Definition: hw_fcu.h:348
hw_dma.h
Definition of API for the DMA Low Level Driver.
REG_SETF
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
hw_fcu_enable_erase_suspend
__STATIC_FORCEINLINE void hw_fcu_enable_erase_suspend(void)
Enable erase/suspend functionality.
Definition: hw_fcu.h:278
hw_fcu_enable_read
__ALWAYS_RETAINED_CODE void hw_fcu_enable_read(void)
Put FCU in read mode.
REG_CLR_BIT
#define REG_CLR_BIT(base, reg, field)
Clear a bit of a register.
Definition: sdk_defs.h:781
HW_FCU_FLASH_ACCESS_MODE_WRITE_ERASE
Definition: hw_fcu.h:108
hw_fcu_get_flash_access_mode
__STATIC_FORCEINLINE HW_FCU_FLASH_ACCESS_MODE hw_fcu_get_flash_access_mode(void)
Get flash read/write/erase mode.
Definition: hw_fcu.h:547
REG_SET_BIT
#define REG_SET_BIT(base, reg, field)
Set a bit of a register.
Definition: sdk_defs.h:766
hw_fcu_get_total_erase_counter
__STATIC_FORCEINLINE uint32_t hw_fcu_get_total_erase_counter(void)
Get total erase time counter value.
Definition: hw_fcu.h:724
hw_fcu_disable_reset_delay
__STATIC_FORCEINLINE void hw_fcu_disable_reset_delay(void)
Disables reset delay when FCU write/erase has finished.
Definition: hw_fcu.h:750
hw_fcu_get_flash_page_erase_time
__STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_page_erase_time(void)
Get program flash page erase time.
Definition: hw_fcu.h:648
hw_fcu_is_bus_error_enabled
__STATIC_FORCEINLINE bool hw_fcu_is_bus_error_enabled(void)
Check if bus error response is enabled.
Definition: hw_fcu.h:358
hw_fcu_wakeup
__ALWAYS_RETAINED_CODE void hw_fcu_wakeup(void)
Wakeup FCU.
hw_fcu_get_flash_programming_mode
__STATIC_FORCEINLINE HW_FCU_FLASH_PROG_MODE hw_fcu_get_flash_programming_mode(void)
Get program flash mode.
Definition: hw_fcu.h:571
hw_fcu_set_erase_suspend_mode
__STATIC_FORCEINLINE void hw_fcu_set_erase_suspend_mode(HW_FCU_ERASE_SUSPEND_MODE mode)
Set erase/suspend mode.
Definition: hw_fcu.h:255
hw_fcu_get_vdd_level_value
__STATIC_FORCEINLINE HW_FCU_VDD_LEVEL_VALUE hw_fcu_get_vdd_level_value(void)
Get VDD level value.
Definition: hw_fcu.h:187
HW_FCU_VDD_GREATER_THAN_1V08
Definition: hw_fcu.h:141
hw_fcu_is_asleep
__STATIC_FORCEINLINE bool hw_fcu_is_asleep(void)
Check if fcu is in sleeping mode.
Definition: hw_fcu.h:307
hw_fcu_prohibit_flash_operations
__STATIC_FORCEINLINE void hw_fcu_prohibit_flash_operations(void)
Prohibit flash operations.
Definition: hw_fcu.h:211
hw_fcu_get_flash_mass_erase_time
__STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_mass_erase_time(void)
Get program flash mass erase time.
Definition: hw_fcu.h:671
hw_fcu_get_flash_hold_time
__STATIC_FORCEINLINE uint16_t hw_fcu_get_flash_hold_time(void)
Get program flash NVSTR1 hold time.
Definition: hw_fcu.h:603
sdk_defs.h
Central include header file with platform definitions.
hw_fcu_get_bus_error_status
__STATIC_FORCEINLINE bool hw_fcu_get_bus_error_status(void)
Get bus error status.
Definition: hw_fcu.h:370
HW_FCU_FLASH_ACCESS_MODE
HW_FCU_FLASH_ACCESS_MODE
FCU flash read/write/erase mode.
Definition: hw_fcu.h:106
hw_fcu_enable_reset_delay
__STATIC_FORCEINLINE void hw_fcu_enable_reset_delay(void)
Enables reset delay when FCU write/erase begins.
Definition: hw_fcu.h:742
hw_fcu_get_flash_page_segment_erase_time
__STATIC_FORCEINLINE uint32_t hw_fcu_get_flash_page_segment_erase_time(void)
Get program flash page segment erase time for suspend erase.
Definition: hw_fcu.h:714
hw_fcu_set_flash_hold_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_hold_time(uint16_t hold_time)
Set program flash NVSTR1 hold time.
Definition: hw_fcu.h:592
HW_FCU_FLASH_PROG_MODE_WRITE_PAGE
Definition: hw_fcu.h:116
hw_fcu_enable_flash_read_protection
__STATIC_FORCEINLINE void hw_fcu_enable_flash_read_protection(void)
Enable program flash read protection.
Definition: hw_fcu.h:443
HW_FCU_VDD_LESS_THAN_1V08
Definition: hw_fcu.h:140
hw_fcu_set_sleep_mode
__STATIC_FORCEINLINE void hw_fcu_set_sleep_mode(void)
Puts FCU (eFlash) in sleep mode for lower leakage current.
Definition: hw_fcu.h:581
hw_fcu_resume_erase
__STATIC_FORCEINLINE void hw_fcu_resume_erase(void)
Resume erase.
Definition: hw_fcu.h:505
hw_fcu_write
__ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_write(uint32_t *src, uint32_t address, uint32_t len, struct hw_fcu_operation_params_t *params)
Write a buffer to flash address (first flash page should be erased)
HW_FCU_FLASH_ACCESS_MODE_READ
Definition: hw_fcu.h:107
HW_DMA_CHANNEL
HW_DMA_CHANNEL
DMA channel number.
Definition: hw_dma.h:62
hw_fcu_get_segment_erase_counter
__STATIC_FORCEINLINE uint32_t hw_fcu_get_segment_erase_counter(void)
Get segment erase time counter value.
Definition: hw_fcu.h:734
hw_fcu_enable_write
__ALWAYS_RETAINED_CODE void hw_fcu_enable_write(void)
Put FCU in write mode.
hw_fcu_operation_params_t::dma_channel
HW_DMA_CHANNEL dma_channel
Definition: hw_fcu.h:158
hw_fcu_set_flash_sleep_to_standby_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_sleep_to_standby_time(uint8_t wakeup_time)
Set program flash sleep to standby wake-up time.
Definition: hw_fcu.h:681
hw_fcu_set_vdd_level_value
__STATIC_FORCEINLINE void hw_fcu_set_vdd_level_value(HW_FCU_VDD_LEVEL_VALUE value)
Set VDD level value.
Definition: hw_fcu.h:172
hw_fcu_set_flash_page_erase_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_page_erase_time(uint32_t erase_time)
Set program flash page erase time.
Definition: hw_fcu.h:636
hw_fcu_enable_erase
__ALWAYS_RETAINED_CODE void hw_fcu_enable_erase(HW_FCU_FLASH_PROG_MODE mode)
Put FCU in erase mode.
hw_fcu_is_available
__ALWAYS_RETAINED_CODE bool hw_fcu_is_available(void)
Check if FCU is not busy or in sleeping mode.
HW_FCU_FLASH_PROG_MODE_ERASE_PAGE
Definition: hw_fcu.h:117
hw_fcu_configure_erase_page_suspend
__ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_configure_erase_page_suspend(HW_FCU_ERASE_SUSPEND_MODE mode, uint32_t page_erase_time, uint32_t segment_erase_time)
Configure page erase suspend/resume.
hw_fcu_erase_block
__ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_erase_block(uint32_t address, struct hw_fcu_operation_params_t *params)
Erase flash block.
hw_fcu_is_flash_write_protection_enabled
__STATIC_FORCEINLINE bool hw_fcu_is_flash_write_protection_enabled(void)
Check program flash write protection.
Definition: hw_fcu.h:473
HW_FCU_FLASH_PROG_MODE_ERASE_BLOCK
Definition: hw_fcu.h:118
hw_fcu_is_flash_erase_suspended
__STATIC_FORCEINLINE bool hw_fcu_is_flash_erase_suspended(void)
Check if flash erase is suspended.
Definition: hw_fcu.h:243
hw_fcu_read
__ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_read(uint32_t address, uint32_t *dst, uint32_t len, struct hw_fcu_operation_params_t *params)
Read from flash address to buffer.
HW_FCU_ERASE_SUSPEND_MODE_NONPREEMPTIVE
Definition: hw_fcu.h:98
REG_MSK
#define REG_MSK(base, reg, field)
Access register field mask.
Definition: sdk_defs.h:583
mode
HW_GPIO_MODE mode
Definition: hw_gpio.h:211
hw_fcu_clear_interrupt
__STATIC_FORCEINLINE void hw_fcu_clear_interrupt(void)
Clear FCU interrupt.
Definition: hw_fcu.h:378
hw_fcu_is_flash_read_mode_inhibited
__STATIC_FORCEINLINE bool hw_fcu_is_flash_read_mode_inhibited(void)
Check if program flash read mode is inhibited.
Definition: hw_fcu.h:483
hw_fcu_permit_flash_operations
__STATIC_FORCEINLINE void hw_fcu_permit_flash_operations(void)
Permit flash operations.
Definition: hw_fcu.h:219
hw_fcu_enable_flash_write_protection
__STATIC_FORCEINLINE void hw_fcu_enable_flash_write_protection(void)
Enable program flash write protection.
Definition: hw_fcu.h:463
hw_fcu_set_flash_access_mode
__STATIC_FORCEINLINE void hw_fcu_set_flash_access_mode(HW_FCU_FLASH_ACCESS_MODE mode)
Set flash read or write/erase mode.
Definition: hw_fcu.h:535
hw_fcu_erase_page
__ALWAYS_RETAINED_CODE HW_FCU_ERROR hw_fcu_erase_page(uint32_t address, struct hw_fcu_operation_params_t *params)
Erase flash block's page.
hw_fcu_operation_completed_cb
void(* hw_fcu_operation_completed_cb)(void *user_data)
Callback called upon completion of erase or write (interrupt or DMA)
Definition: hw_fcu.h:149
hw_fcu_get_flash_sleep_to_standby_time
__STATIC_FORCEINLINE uint8_t hw_fcu_get_flash_sleep_to_standby_time(void)
Get program flash sleep to standby wake-up time.
Definition: hw_fcu.h:692
hw_fcu_get_wait_cycles
__STATIC_FORCEINLINE HW_FCU_WAIT_CYCLES hw_fcu_get_wait_cycles(void)
Get wait cycles.
Definition: hw_fcu.h:390
hw_fcu_is_erase_suspend_enabled
__STATIC_FORCEINLINE bool hw_fcu_is_erase_suspend_enabled(void)
Check if erase/suspend functionality is enabled.
Definition: hw_fcu.h:296
HW_FCU_VDD_LEVEL_VALUE
HW_FCU_VDD_LEVEL_VALUE
FCU VDD level value.
Definition: hw_fcu.h:139
REG_GETF
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
HW_FCU_WAIT_CYCLES
HW_FCU_WAIT_CYCLES
FCU wait cycles.
Definition: hw_fcu.h:124
hw_fcu_disable_vdd_level_overriding
__STATIC_FORCEINLINE void hw_fcu_disable_vdd_level_overriding(void)
Disable overriding of VDD level FCU input signal.
Definition: hw_fcu.h:203
hw_fcu_set_wait_cycles
__STATIC_FORCEINLINE void hw_fcu_set_wait_cycles(HW_FCU_WAIT_CYCLES wait_cycles)
Set wait cycles.
Definition: hw_fcu.h:411
HW_FCU_FLASH_PROG_MODE
HW_FCU_FLASH_PROG_MODE
FCU program flash mode.
Definition: hw_fcu.h:114
hw_fcu_set_flash_page_segment_erase_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_page_segment_erase_time(uint32_t erase_time)
Set program flash page segment erase time for suspend erase.
Definition: hw_fcu.h:702
hw_fcu_sleep
__ALWAYS_RETAINED_CODE void hw_fcu_sleep(void)
Set FCU to sleep mode.
hw_fcu_is_protected_against_actions
__STATIC_FORCEINLINE bool hw_fcu_is_protected_against_actions(uint32_t mask)
Definition: hw_fcu.h:433
hw_fcu_is_erase_in_progress
__STATIC_FORCEINLINE bool hw_fcu_is_erase_in_progress(void)
Check if flash erase is in progress.
Definition: hw_fcu.h:494
hw_fcu_operation_params_t
Operation parameters structure.
Definition: hw_fcu.h:154
hw_fcu_enable_vdd_level_overriding
__STATIC_FORCEINLINE void hw_fcu_enable_vdd_level_overriding(void)
Enable overriding of VDD level FCU input signal.
Definition: hw_fcu.h:195
hw_fcu_disable_erase_suspend
__STATIC_FORCEINLINE void hw_fcu_disable_erase_suspend(void)
Disable erase/suspend functionality.
Definition: hw_fcu.h:286
hw_fcu_disable_dma
__STATIC_FORCEINLINE void hw_fcu_disable_dma(void)
Disable DMA handshake when writing to the FCU.
Definition: hw_fcu.h:327
hw_fcu_is_flash_read_protection_enabled
__STATIC_FORCEINLINE bool hw_fcu_is_flash_read_protection_enabled(void)
Check program flash read protection.
Definition: hw_fcu.h:453
hw_fcu_is_write_in_progress
__STATIC_FORCEINLINE bool hw_fcu_is_write_in_progress(void)
Check if flash write is in progress.
Definition: hw_fcu.h:523
hw_fcu_set_flash_program_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_program_time(uint16_t prog_time)
Set program flash programming time.
Definition: hw_fcu.h:614
HW_FCU_ERASE_SUSPEND_MODE_PREEMPTIVE
Definition: hw_fcu.h:95
hw_fcu_operation_params_t::user_data
void * user_data
Definition: hw_fcu.h:156
hw_fcu_enable_dma
__STATIC_FORCEINLINE void hw_fcu_enable_dma(void)
Enable DMA handshake when writing to the FCU.
Definition: hw_fcu.h:317
HW_FCU_FLASH_PROG_MODE_READ
Definition: hw_fcu.h:115
hw_fcu_are_flash_operations_prohibited
__STATIC_FORCEINLINE bool hw_fcu_are_flash_operations_prohibited(void)
Check if flash operations are prohibited.
Definition: hw_fcu.h:229
hw_fcu_get_flash_program_time
__STATIC_FORCEINLINE uint16_t hw_fcu_get_flash_program_time(void)
Get program flash programming time.
Definition: hw_fcu.h:625
hw_fcu_is_dma_enabled
__STATIC_FORCEINLINE bool hw_fcu_is_dma_enabled(void)
Check if DMA handshake when writing to the FCU is enabled.
Definition: hw_fcu.h:337
hw_fcu_set_flash_programming_mode
__STATIC_FORCEINLINE void hw_fcu_set_flash_programming_mode(HW_FCU_FLASH_PROG_MODE mode)
Set program flash mode.
Definition: hw_fcu.h:559
hw_fcu_set_flash_mass_erase_time
__STATIC_FORCEINLINE void hw_fcu_set_flash_mass_erase_time(uint32_t erase_time)
Set program flash mass erase time.
Definition: hw_fcu.h:659
hw_fcu_get_erase_suspend_mode
__STATIC_FORCEINLINE HW_FCU_ERASE_SUSPEND_MODE hw_fcu_get_erase_suspend_mode(void)
Get erase/suspend mode.
Definition: hw_fcu.h:267
HW_FCU_ERASE_SUSPEND_MODE
HW_FCU_ERASE_SUSPEND_MODE
FCU erase/suspend modes.
Definition: hw_fcu.h:94
HW_FCU_ERROR
HW_FCU_ERROR
FCU error codes.
Definition: hw_fcu.h:82
hw_fcu_operation_params_t::cb
hw_fcu_operation_completed_cb cb
Definition: hw_fcu.h:155