CC26xx Driver Library
flash.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_types.h"
#include "../inc/hw_flash.h"
#include "../inc/hw_nvmnw.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_ints.h"
#include "../inc/hw_aon_pmctl.h"
#include "../inc/hw_fcfg1.h"
#include "interrupt.h"
#include "debug.h"

Macros

#define FAPI_STATUS_SUCCESS   0x00000000
 
#define FAPI_STATUS_FSM_BUSY   0x00000001
 
#define FAPI_STATUS_FSM_READY   0x00000002
 
#define FAPI_STATUS_INCORRECT_DATABUFFER_LENGTH   0x00000003
 
#define FAPI_STATUS_FSM_ERROR   0x00000004
 
#define FAPI_STATUS_ADDRESS_ERROR   0x00000005
 
#define FAPI_STATUS_ADDRESS_ALIGN_ERROR   0x00000006
 
#define FAPI_STATUS_BANK_NUM_ERROR   0x00000007
 
#define FAPI_STATUS_NOSUPPORT_ERROR   0x00000008
 
#define FAPI_STATUS_UNPROTECT_ERROR   0x00000009
 
#define FLASH_INT_FSM_DONE   0x00400000
 
#define FLASH_INT_RV   0x00010000
 
#define FLASH_PWR_ACTIVE_MODE   0x00000000
 
#define FLASH_PWR_OFF_MODE   0x00000001
 
#define FLASH_PWR_DEEP_STDBY_MODE   0x00000002
 
#define FLASH_NO_PROTECT   0x00000000
 
#define FLASH_WRITE_PROTECT   0x00000001
 
#define FCFG1_OFFSET   0x0800
 
#define FLASHWORD_SHIFTBIT   (2)
 
#define FLASHWORD_MASKBIT   (0x03)
 
#define FLASHWORDSIZE_FOUR   (0x40)
 
#define FLASHWORDSIZE_TWO   (0x20)
 
#define FLASHWORDSIZE_ONE   (0x10)
 
#define FSM_REG_WRT_ENABLE   5
 
#define FSM_REG_WRT_DISABLE   2
 
#define FBFALLBACK_SLEEP   0
 
#define FBFALLBACK_DEEP_STDBY   1
 
#define FBFALLBACK_ACTIVE   3
 
#define FW_WRT_TRIMMED   0x00000001
 
#define FW_PWRMODE_DEPRECATED   0x00000002
 
#define DUMPWORD_INSTR   0x04
 

Enumerations

enum  tFlashStateCommandsType {
  FAPI_PROGRAM_FOURWORD = 0x0021, FAPI_PROGRAM_TWOWORD = 0x0011, FAPI_PROGRAM_ONEWORD = 0x0001, FAPI_ERASE_SECTOR = 0x0042,
  FAPI_ERASE_BANK = 0x0052, FAPI_CLEAR_STATUS = 0x0005, FAPI_READVERIFY = 0x0003
}
 Defined values for Flash State Machine commands. More...
 

Functions

static uint32_t FlashSectorSizeGet (void)
 Get size of a flash sector in number of bytes. More...
 
static uint32_t FlashSizeGet (void)
 Get the size of the flash. More...
 
void FlashPowerModeSet (uint32_t ui32PowerMode, uint32_t ui32BankGracePeriod, uint32_t ui32PumpGracePeriod)
 Set power mode. More...
 
uint32_t FlashPowerModeGet (void)
 Get current configured power mode. More...
 
void FlashProtectionSet (uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)
 Set sector protection. More...
 
uint32_t FlashProtectionGet (uint32_t ui32SectorAddress)
 Get sector protection. More...
 
uint32_t FlashProtectionSave (uint32_t ui32SectorAddress)
 Save sector protection to make it permanent. More...
 
static uint32_t FlashCheckFsmForError (void)
 Checks if the Flash state machine has detected an error. More...
 
static uint32_t FlashCheckFsmForReady (void)
 Checks if the Flash state machine is ready. More...
 
static void FlashIntRegister (void(*pfnHandler)(void))
 Registers an interrupt handler for the flash interrupt in the dynamic interrupt table. More...
 
static void FlashIntUnregister (void)
 Unregisters the interrupt handler for the flash interrupt in the dynamic interrupt table. More...
 
static void FlashIntEnable (uint32_t ui32IntFlags)
 Enables flash controller interrupt sources. More...
 
static void FlashIntDisable (uint32_t ui32IntFlags)
 Disables individual flash controller interrupt sources. More...
 
static uint32_t FlashIntStatus (void)
 Gets the current interrupt status. More...
 
static void FlashIntClear (uint32_t ui32IntFlags)
 Clears flash controller interrupt source. More...
 
uint32_t FlashSectorErase (uint32_t ui32SectorAddress)
 Erase a flash sector. More...
 
uint32_t FlashProgram (uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
 Programs unprotected flash sectors in the main bank. More...
 
uint32_t FlashProgram4X (uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
 
uint32_t FlashProgramNowait (uint32_t ui32StartAddress, uint8_t *pui8DataBuffer, uint8_t ui8NoOfBytes)
 Starts programming within unprotected main bank flash sector and returns. More...
 
bool FlashEfuseReadRow (uint32_t *pui32EfuseData, uint32_t ui32RowAddress)
 Reads efuse data from specified row. More...
 
void FlashDisableSectorsForWrite (void)
 Disables all sectors for erase and programming on the active bank. More...