RadioTestLibrary  1.32.0
Public Member Functions | Static Public Member Functions | Protected Member Functions
RTLFlashHandler Class Reference

#include <rtl_flash_handler.h>

Public Member Functions

 RTLFlashHandler (const QString &devName, const QString &devId, XbalEb *pXbalEb, RTLDevice *pParent=NULL)
 
virtual ~RTLFlashHandler (void)
 
virtual int eraseFlash (EraseInfo_t *pEraseInfo=NULL, FPLFile *pFile=NULL)
 Erase Flash (FPL Feature) More...
 
virtual int programFlash (FPLFile *pFplFile, ProgramInfo_t *pProgInfo=NULL)
 Program Flash from file (FPL Feature) More...
 
virtual int programFlash (const quint32 &address, const quint32 &length, quint8 *pBuffer)
 Program Flash (FPL Feature) More...
 
virtual FPLFile * readFile (const QString &fileName, const quint32 &startAddress=0)
 Read File. More...
 
virtual int readMemory (const quint32 &address, quint32 *pLength, quint8 *pBuffer)
 Read memory (FPL Feature) More...
 
virtual int resetTarget (RESET_MODE mode)
 Reset Target device. More...
 
virtual int verifyFlash (FPLFile *pFplFile, ProgramInfo_t *pProgInfo=NULL)
 Verify Flash (FPL Feature) More...
 
virtual int writeMemory (const quint32 &address, const quint32 &length, quint8 *pBuffer)
 Write memory (FPL Feature) More...
 
virtual int runCpu (bool debugMode)
 Run CPU (FPL Feature) More...
 
virtual int haltCpu (void)
 Halt CPU (FPL Feature) More...
 
virtual int writeCpuReg (const CM3_CPU_REGISTERS &regNumber, const uint32_t &value)
 Write CPU register (FPL Feature) More...
 
virtual int readCpuReg (const CM3_CPU_REGISTERS &regNumber, uint32_t *pValue)
 Read CPU register (FPL Feature) More...
 

Static Public Member Functions

static int deleteFileObject (FPLFile *pFplFile)
 Delete file Object. More...
 
static void initEraseInfo (EraseInfo_t *pEraseInfo)
 Initialize erase info. Default is to erase all unprotected pages. More...
 
static void initProgramInfo (ProgramInfo_t *pProgInfo)
 Initialize program info. Default is to program all pages in the source file. More...
 

Protected Member Functions

QString normDeviceNameForFpl (const QString rfDevName)
 Function to normalize the device name for use in FPL. More...
 

Constructor & Destructor Documentation

§ RTLFlashHandler()

RTLFlashHandler::RTLFlashHandler ( const QString &  devName,
const QString &  devId,
XbalEb *  pXbalEb,
RTLDevice pParent = NULL 
)

§ ~RTLFlashHandler()

RTLFlashHandler::~RTLFlashHandler ( void  )
virtual

Member Function Documentation

§ eraseFlash()

int RTLFlashHandler::eraseFlash ( EraseInfo_t pEraseInfo = NULL,
FPLFile *  pFile = NULL 
)
virtual

Erase Flash (FPL Feature)

This function will erase the part of flash specified in pEraseInfo.

Erase type RTLDevice::ET_ERASE_ALL_FORCED, must be followed by a device re-connect.

Parameters
[in]pEraseInfoPointer to erase info. If set to NULL all main flash sectors that are not locked will be erased.
[in]pFilePointer to FPL file object. Must be given if erase type is set to RTLDevice::ET_ERASE_PAGES_IN_SOURCE.
Returns
int TST_OK or TST_FAILED

References ET_ERASE_ALL, ET_ERASE_ALL_FORCED, ET_ERASE_PAGE_RANGE, ET_ERASE_PAGES_IN_SOURCE, EraseInfo_t::parameters, RTLDevice::TST_FAILED, RTLDevice::TST_OK, and EraseInfo_t::type.

§ programFlash() [1/2]

int RTLFlashHandler::programFlash ( FPLFile *  pFplFile,
ProgramInfo_t pProgInfo = NULL 
)
virtual

Program Flash from file (FPL Feature)

This function will program the flash with data from the given file. The file format must be either a binary file(*.bin), an Intel hex file(*.hex), or an "elf" file (Executable and Linkable Format, *.elf).

Parameters
[in]pFplFilePointer to FPL file object
[in]pProgInfoPointer to program info. If set to NULL, all pages in file will be programmed.
Returns
int TST_OK or TST_FAILED

References ProgramInfo_t::parameters, PT_PROGRAM_EXLUDE_PAGES, PT_PROGRAM_EXLUDE_PAGES_FILLED_WITH, PT_PROGRAM_PAGES_IN_SOURCE, RTLDevice::TST_FAILED, RTLDevice::TST_OK, and ProgramInfo_t::type.

§ programFlash() [2/2]

int RTLFlashHandler::programFlash ( const quint32 &  address,
const quint32 &  length,
quint8 *  pBuffer 
)
virtual

Program Flash (FPL Feature)

This function will program flash with data from the given buffer. To write data to a non-flash memory, see RTLDevice26_13xx::writeMemory()

Parameters
[in]addressFlash address to program
[in]lengthLength of data buffer that should be programmed
[in]pBufferBuffer with input data to be programmed
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ readFile()

FPLFile * RTLFlashHandler::readFile ( const QString &  fileName,
const quint32 &  startAddress = 0 
)
virtual

Read File.

Read given file and create FPL File object.

Parameters
[in]fileNameFile name with relative or absolute path
[in]startAddressThe start address is required if the input file is a binary file (.bin)
Returns
FPLFile Pointer to FPL file object or NULL if function failed.

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ readMemory()

int RTLFlashHandler::readMemory ( const quint32 &  address,
quint32 *  pLength,
quint8 *  pBuffer 
)
virtual

Read memory (FPL Feature)

Read any kind of memory that is accessible from the debug interface of the target device.

This method will use the FPL library to read the memory but it will not have any affect on the time when using any non-FPL Feature afterwards. See "Limitations" under the "Introduction" for further details.

Before reading GPRAM the user must make sure that the GPRAM is enabled. This function will return TST_OK even if the GPRAM is not enabled but the returned data will be garbage.

Parameters
[in]addressMemory address to read
[in,out]pLengthMaximum length of buffer as input and actual length of data successfully read as output.
[out]pBufferBuffer to save the data
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ resetTarget()

int RTLFlashHandler::resetTarget ( RESET_MODE  mode)
virtual

Reset Target device.

Reset target device.

  • Reset modes
    1. RM_NORMAL Normal reset controlled by the Debugger API and the JTAG interface.
    2. RM_PIN Debugger use the reset pins.
    3. RM_PIN_HIB Same as RM_PIN but in addition the device will Halt in Bootloader.

The connection to the target device will be lost after a reset.

Parameters
[in]modeReset mode
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ verifyFlash()

int RTLFlashHandler::verifyFlash ( FPLFile *  pFplFile,
ProgramInfo_t pProgInfo = NULL 
)
virtual

Verify Flash (FPL Feature)

This function will verify the flash content by calculating the CRC checksum in flash and compare it with the CRC checksum from the file object on the host.

Parameters
[in]pFplFilePointer to FPL File Object
[in]pProgInfoPointer to the program info used for programming. The verification will inherit the option set for programming. E.g. if a set of pages was excluded in programming, the same pages will be excluded in verification. If set to NULL all pages in file will be verified.
Returns
int TST_OK or TST_FAILED

References ProgramInfo_t::parameters, PT_PROGRAM_EXLUDE_PAGES, PT_PROGRAM_EXLUDE_PAGES_FILLED_WITH, PT_PROGRAM_PAGES_IN_SOURCE, RTLDevice::TST_FAILED, RTLDevice::TST_OK, and ProgramInfo_t::type.

§ writeMemory()

int RTLFlashHandler::writeMemory ( const quint32 &  address,
const quint32 &  length,
quint8 *  pBuffer 
)
virtual

Write memory (FPL Feature)

This function can be used to write all non-flash memory. Before using this function the user must make sure that the requested memory range is enabled. The function will return TST_FAILED if memory not enabled. For example flash cache RAM must be configured as GPRAM before it can be written. Some memory blocks can be powered down and in that case the memory block must be powered before it can be written.

For programming flash memory, see RTLDevice26_13xx::programFlash(const QString&, const QString&, const quint32&, const quint32&, quint8*).

Parameters
[in]addressMemory address to write
[in]lengthLength of buffer to be written.
[out]pBufferBuffer with data to be written.
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ runCpu()

int RTLFlashHandler::runCpu ( bool  debugMode)
virtual

Run CPU (FPL Feature)

Start Cortex CPU (in free run [debug disabled] or in profiling mode [debug enabled])

Parameters
[in]debugModeDebug mode enabled or disabled.
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ haltCpu()

int RTLFlashHandler::haltCpu ( void  )
virtual

Halt CPU (FPL Feature)

Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ writeCpuReg()

int RTLFlashHandler::writeCpuReg ( const CM3_CPU_REGISTERS regNumber,
const uint32_t &  value 
)
virtual

Write CPU register (FPL Feature)

Parameters
[in]regNumberRegister number. Valid range from 0 to 15
[in]valueRegister value
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ readCpuReg()

int RTLFlashHandler::readCpuReg ( const CM3_CPU_REGISTERS regNumber,
uint32_t *  pValue 
)
virtual

Read CPU register (FPL Feature)

Parameters
[in]regNumberCPU Register number.
[out]pValueRegister value
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

§ deleteFileObject()

int RTLFlashHandler::deleteFileObject ( FPLFile *  pFplFile)
static

Delete file Object.

Delete given File Object.

Parameters
[in]pFplFilePointer to FPL file object
Returns
int TST_OK or TST_FAILED

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

Referenced by RTLDevice::deleteFileObject().

§ initEraseInfo()

void RTLFlashHandler::initEraseInfo ( EraseInfo_t pEraseInfo)
static

Initialize erase info. Default is to erase all unprotected pages.

Parameters
[in,out]pEraseInfoPointer to the erase info structure to initialize.

References ET_ERASE_ALL, EraseInfo_t::parameters, and EraseInfo_t::type.

Referenced by RTLDevice::initEraseInfo().

§ initProgramInfo()

void RTLFlashHandler::initProgramInfo ( ProgramInfo_t pProgInfo)
static

Initialize program info. Default is to program all pages in the source file.

Parameters
[in,out]pProgInfoPointer to the program info structure to initialize.

References RTLDevice::appendError(), ProgramInfo_t::parameters, PT_PROGRAM_PAGES_IN_SOURCE, RTLDevice::TST_FAILED, RTLDevice::TST_OK, and ProgramInfo_t::type.

Referenced by RTLDevice::initProgramInfo().

§ normDeviceNameForFpl()

QString RTLFlashHandler::normDeviceNameForFpl ( const QString  rfDevName)
protected

Function to normalize the device name for use in FPL.

Normalize device name for FPL.

Some of the device names need to be changed in order to be recognized by the FPL library.

Parameters
[in]rfDevNameRF Device name like "CC2650"
Returns
QString The normalized Device name

References RTLDevice::TST_FAILED, and RTLDevice::TST_OK.

Referenced by RTLFlashHandler().


The documentation for this class was generated from the following files:
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale