CC13xx Driver Library
flashsafe.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <inc/hw_types.h>
#include <inc/hw_flash.h>
#include <inc/hw_memmap.h>
#include <inc/hw_ints.h>
#include <inc/hw_fcfg1.h>
#include <driverlib/interrupt.h>
#include <driverlib/debug.h>
#include <driverlib/flash.h>
#include <driverlib/rom.h>
#include <driverlib/smph.h>

Go to the source code of this file.

Macros

#define FLASHSAFE_ACCESS_DENIED   0x000000ff
 
#define FLASHSAFE_ACCESS_OK   0x000000ee
 
#define SMPH_ALLOC_FLASH   1
 
#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 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 FSM_REG_WRT_ENABLE   5
 
#define FSM_REG_WRT_DISABLE   2
 

Functions

static bool FlashsafeSMPHTryAcquire (void)
 Aquire the flash semaphore. More...
 
static void FlashsafeSMPHRelease (void)
 Release the flash semaphore. More...
 
uint32_t FlashsafeSizeGet (void)
 Get the size of the flash. More...
 
uint32_t FlashsafeSectorSizeGet (void)
 Get size of a flash sector in no of bytes. More...
 
uint32_t FlashsafePowerModeSet (uint32_t ui32PowerMode, uint32_t ui32BankGracePeriode, uint32_t ui32PumpGracePeriode)
 Set power mode. More...
 
uint32_t FlashsafePowerModeGet (void)
 Get current configured power mode. More...
 
uint32_t FlashsafeProtectionSet (uint32_t ui32SectorAddress, uint32_t ui32ProtectMode)
 Set sector protection. More...
 
uint32_t FlashsafeProtectionGet (uint32_t ui32SectorAddress)
 Get sector protection. More...
 
uint32_t FlashsafeProtectionSave (uint32_t ui32SectorAddress)
 Save sector protection to make it permanent. More...
 
uint32_t FlashsafeCheckFsmForError (void)
 Checks if the Flashsafe state machine has detected an error. More...
 
uint32_t FlashsafeCheckFsmForReady (void)
 Checks if the Flash state machine is ready. More...
 
uint32_t FlashsafeIntRegister (void(*pfnHandler)(void))
 Registers an interrupt handler for the flash interrupt. More...
 
uint32_t FlashsafeIntUnregister (void)
 Unregisters the interrupt handler for the flash interrupt. More...
 
uint32_t FlashsafeIntEnable (uint32_t ui32IntFlags)
 Enables flash controller interrupt sources. More...
 
uint32_t FlashsafeIntDisable (uint32_t ui32IntFlags)
 Disables individual flash controller interrupt sources. More...
 
uint32_t FlashsafeIntStatus (void)
 Gets the current interrupt status. More...
 
uint32_t FlashsafeIntClear (uint32_t ui32IntFlags)
 Clears flash controller interrupt source. More...
 
uint32_t FlashsafeSectorErase (uint32_t ui32SectorAddress)
 Erase a flash sector. More...
 
uint32_t FlashsafeProgram (uint8_t *pui8DataBuffer, uint32_t ui32Address, uint32_t ui32Count)
 Programs unprotected main bank flash sectors. More...
 
uint32_t FlashsafeDisableSectorsForWrite (void)
 Disables all sectors for erase and programming on the active bank. More...