...
Code Block |
---|
INT32 awe_fwGetFirstFile(AWEFlashFSInstance * pAWEFlashFSInstance, PDIRECTORY PDIRECTORY_ENTRY * pDirEntry) |
Arguments:
...
Code Block |
---|
INT32 awe_fwGetNextFile(AWEFlashFSInstance * pAWEFlashFSInstance, PDIRECTORY_ENTRY * pDirEntry) |
...
Code Block |
---|
INT32 awe_fwOpenFile(AWEFlashFSInstance * pAWEFlashFSInstance, UINT32 nFileAttribute, UINT32 * pFileNameInDWords, UINT32 UINT32 nFileAttribute, UINT32 * pFileNameInDWords, UINT32 * nFileLenInDWords) |
...
* nFileLenInDWords) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
awe_fwWriteFile
Prototype:
Code Block |
---|
INT32 awe_fwWriteFile(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
UINT32 nWordsToWrite, |
...
UINT32 * pBuffer, UINT32 * pDWordsWritten) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This function writes a block of data onto the Flash File System for the file opened before. If this function called without prior file open, then it returns failure.
Returns:
E_SUCCESS
E_OUT_OF_SPACE
E_ERROR_WRITING_FLASH_MEMORY
E_NO_OPEN_FILE
awe_fwReadFile
Prototype:
Code Block |
---|
INT32 awe_fwReadFile(AWEFlashFSInstance |
...
UINT32 nWordsToRead,
UINT32 * pBuffer,
...
* pAWEFlashFSInstance, UINT32 nWordsToRead, UINT32 * pBuffer, UINT32 * pDWordsRead) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
If the file is opened for reading before, then this function copies specified number of words from the Flash File System into the buffer. Otherwise, error code is returned.
Returns:
E_SUCCESS
E_ERROR_READING_FLASH_MEMORY
E_NO_OPEN_FILE
awe_fwDeleteFile
Prototype:
Code Block |
---|
INT32 awe_fwDeleteFile(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
UINT32 * pFileNameInDWords) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
Specified file, if exists, will be marked as deleted in the Flash File System.
Returns:
E_SUCCESS
E_FILE_ALREADY_OPEN
E_FILE_NOT_FOUND
E_ERROR_READING_FLASH_MEMORY
E_ERROR_WRITING_FLASH_MEMORY
awe_fwFindFile
Prototype:
Code Block |
---|
PDIRECTORY_ENTRY awe_fwFindFile(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
UINT32 * pFileNameInDWords) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This function looks through the Flash File System and returns the file directory pointer, if exists. otherwise, NULL pointer is returned.
Returns:
Valid PDIRECTORY_ENTRY
NULL
awe_fwEraseFlash
Prototype:
Code Block |
---|
INT32 awe_fwEraseFlash(AWEFlashFSInstance * pAWEFlashFSInstance) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
Entire Flash File System will be erased and reinitializes with default state.
Returns:
E_SUCCESS
E_ERROR_ERASING_FLASH_MEMORY
awe_fwExecuteFile
Prototype:
Code Block |
---|
INT32 awe_fwExecuteFile(AWEInstance * pAWE, |
...
AWEFlashFSInstance * pAWEFlashFSInstance, UINT32 * pFileNameInDWords) |
Arguments:
pAWE
- AWE Instance pointer.
...
This function just calls awe_loadAWBfromFlash with the provided file name to execute it. Generally, this is called from awe_fwExecuteFlashFiles, to load any compiled script marked as bootable.
Returns:
Error returned from awe_loadAWBfromFlash
awe_fwExecuteFlashFiles
Prototype:
Code Block |
---|
INT32 awe_fwExecuteFlashFiles(AWEInstance * pAWE, |
...
AWEFlashFSInstance * pAWEFlashFSInstance) |
Arguments:
pAWE
- AWE Instance pointer.
...
This function walkthrough the Flash File System and if any compiled script marked as bootable then awe_fwExecuteFile is called with that file name.
Returns:
E_SUCCESS
E_ERROR_READING_FLASH_MEMORY
E_NO_MORE_FILES
Error returned from awe_loadAWBfromFlash
awe_fwReadFileMem
Prototype:
Code Block |
---|
INT32 awe_fwReadFileMem(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
UINT32 nStartingAddress, |
...
UINT32 nOffsetInDWords, |
...
UINT32 nWordsToRead, |
...
UINT32 * pBuffer) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This is an alternative function to awe_fwReadFile, to read file data based on the address in the flash file system.
Returns:
E_SUCCESS
E_ERROR_READING_FLASH_MEMORY
awe_fwGetFileMemStartingAddress
Prototype:
Code Block |
---|
INT32 awe_fwGetFileMemStartingAddress(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
UINT32 * nStartingAddress, UINT32 * nFileLenInDWords) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This is a supporting function to alternate Flash File System read method awe_fwReadFileMem, to get the start address and the length of a file in the Flash File System.
Returns:
E_SUCCESS
E_FILE_NOT_FOUND
awe_fwGetFileAttribute
Prototype:
Code Block |
---|
UINT8 awe_fwGetFileAttribute(PDIRECTORY_ENTRY pDirectoryEntry) |
Arguments:
pDirectoryEntry
- Pointer to a file directory entry.
This function extracts and returns the file attribute information from the provided file directory entry.
Returns:
File attribute byte
awe_initFlashFS
Prototype:
Code Block |
---|
void awe_initFlashFS(AWEInstance * pAWE, AWEFlashFSInstance * pAWEFlashFSInstance) |
Firmware (BSP) has to call this public API to initialize internal flash file system states when flash file system is implemented.
awe_fwResetFileSystem
Prototype:
Code Block |
---|
INT32 awe_fwResetFileSystem(AWEFlashFSInstance * pAWEFlashFSInstance) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
Initializes internal Flash File System structure to default state.
Returns:
E_SUCCESS
awe_fwAllocateBlock
Prototype:
Code Block |
---|
BOOL awe_fwAllocateBlock(AWEFlashFSInstance * pAWEFlashFSInstance, UINT32 nAddress) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This is an internal function which allocate a block in the Flash File System. Generally, this function is called during file open to write data.
Returns:
SUCCESS
FAILURE
GetFileNameLengthInDWords
Prototype:
Code Block |
---|
UINT32 GetFileNameLengthInDWords(UINT32 * pFileNameInDWords) |
Arguments:
pFileNameInDWords
- File name packed into 32-bit words.
This is an internal method to find the length of the null terminated file name and returns the file name in 32-bit words. If the file name is not exact multiple of 4 bytes, then the last remaining bytes are expected to be filled with 0’s in the provided file name.
Returns:
Word count
awe_fwGetFileSystemInfo
Prototype:
Code Block |
---|
INT32 awe_fwGetFileSystemInfo(AWEFlashFSInstance * pAWEFlashFSInstance, |
...
FileSystemInfo *pFileSystemInfo) |
Arguments:
pAWEFlashFSInstance
- Flash File System instance pointer.
...
This function returns the current file system information like file system type (Flash), allocation table size (16 words), max file name length etc.
Returns:
E_SUCCESS
E_PARAMETER_ERROR
awe_fwFlashFileSystemCommandHandler
Prototype:
Code Block |
---|
INT32 awe_fwFlashFileSystemCommandHandler(AWEInstance * pAWE) |
Arguments:
pAWE
- AWE instance pointer.
This is the main function handler to process all the Flash File System related PFID commands.
Returns:
E_SUCCESS
E_COMMAND_NOT_IMPLEMENTED
awe_fwInitFFS
Prototype:
Code Block |
---|
INT32 awe_fwInitFFS(AWEInstance * pAWE) |
Arguments:
pAWE
- AWE instance pointer.
Just a wrapper function to Flash File System initialization and making a call to user callback cbInit.
Returns:
E_SUCCESS
E_NOT_OBJECT
E_EXCEPTION
Internal Callback to Process Command
An internal callback is implemented to enable AWECore to process commands that are read from the flash file system to instantiate a signal processing layout. This callback is invoked as part of the process called by awe_pltExecuteFlashFiles. awe_pltExecuteFlashFiles calls awe_pltExecutFile for each file marked for boot which calls an internal method awe_loadAWBfromFlash. This method calls the callback cbFlashProcessCmd, if defined, which must point to a BSP method with the following prototype:
Code Block |
---|
INT32 cbFlashProcessCmd(AWEInstance * pAWE); |
If not defined by the BSP, the internal packet processing method is used.
...
AWE_Server sends packets with a command ID 32-bit word followed by any argument 32-bit words and ending with a CRC 32-bit word. Also, the flash file system reserves 14 32-bit words for a file name.
Command Packet |
---|
Command ID |
N data words |
CRC |
Command ID List |
---|
PFID_FileSystemReset |
PFID_GetFirstFile |
PFID_GetNextFile |
PFID_OpenFile |
PFID_ReadFile |
PFID_WriteFile |
PFID_CloseFile |
PFID_DeleteFile |
PFID_ExecuteFile |
PFID_EraseFlash |
PFID_GetFileSystemInfo |
PFID_Get_Flash_Erase_Time |
...