Data Buffer Functions
- 1 1. F_ReadCodeFile
- 2 2. F_ReadCodeFile_BaseAddr
- 3 3. F_AppendCodeFile
- 4 4. F_AppendCodeFile_BaseAddr
- 5 5. F_Get_CodeCS
- 6 6. F_Clr_Code_Buffer
- 7 7. F_Put_Byte_to_Code_Buffer
- 8 8. F_Get_Byte_from_Code_Buffer
- 9 9. F_Put_Byte_to_Buffer
- 10 10. F_Get_Byte_from_Buffer (FlashPro-ARM only)
- 11 11. F_Put_Byte_to_Gang_Buffer (GangPro-ARM only)
- 12 12. F_Get_Byte_from_Gang_Buffer (GangPro-ARM only)
Having setup the Multi API-DLL and API-DLL instances for the correct target devices using functions from previous sections. Use the functions in this section to specify what code should be written by each FPA to their target device.
All data coming to and from the target device is saved in temporary buffers located inside each API-DLL instance. In summary, these buffers are the Code Data Buffer, Write Data Buffer, and Read Data Buffer shown below:
During normal programming using Encapsulated Functions, such as F_AutoProgram, the Code Data Buffer is used to program the target device.
Custom Writes:
For custom modifications the Write Buffer can be used to write to the target device(s) without disturbing the Code Data Buffer. To modify the Write Buffer, use the function F_Put_Byte_to_Buffer. When using FlashPro-ARM, the one target will be modified, when using GangPro-ARM, all six targets will be written with the same data. Sequential Functions, such as F_Copy_Buffer_to_Flash can be used to write this buffer to target(s).
Additionally the GangPro-ARM library also has six Gang Write Buffers, where different custom data can be written to each of the six targets per adapter using the function F_Put_Byte_to_Gang_Buffer. Each target can be provided different data for the same address, i.e. calibration or serialization data. Use Sequential Functions, such as F_Copy_Gang_Buffer_to_Flash to write these buffers to targets.
Custom Reads:
FlashPro-ARM: The Read Data Buffer is used for reading from the target device by the F_Copy_Flash_to_Buffer and F_Memory_Read functions, the contents of which can be accessed using F_Get_Byte_from_Buffer.
GangPro-ARM: Six Gang Read Buffers are used for reading from up to six target devices by the F_Copy_Flash_to_Gang_Buffer and F_Memory_Read functions, the contents of which can be accessed using F_Get_Byte_from_Gang_Buffer.
1. F_ReadCodeFile
General Description
Read code from file and store in internal FPA buffer to be used in programming. Only code data that fits within the target MCUs memory space will be read, and the rest will be discarded. Therefore, it is necessary to configure the FPA for the correct MCU first, then load the code file. Unspecified locations within the code file are set to the target MCU’s default empty value (for most MCUs it is 0xFF, for some it is 0x00).
Syntax
INT_X F_ReadCodeFile( char * FileName )Input
char * FileName : path to code file including filename and extension
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
STATUS_OPEN_FILE_ERROR (535): could not open file
STATUS_FILE_NAME_ERROR (536): format not supported
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
2. F_ReadCodeFile_BaseAddr
General Description
Same as https://elprotronic.atlassian.net/wiki/spaces/FPGPARM/pages/57704798/Data+Buffer+Functions#F_ReadCodeFIle but designed for *.bin files. Function will add baseAddr to code address. Can also be used to shift regular code files by a fixed amount.
Syntax
INT_X F_ReadCodeFile_BaseAddr( char * FileName, UINT32 baseAddr );Input
char * FileName : path to code file including filename and extension
UINT32 baseAddr : unsigned 32-bit offset added to all data addresses from code file
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
STATUS_OPEN_FILE_ERROR (535): could not open file
STATUS_FILE_NAME_ERROR (536): format not supported
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
3. F_AppendCodeFile
General Description
Append code from selected file to internal FPA buffer to be used in programming. Only code data that fits within the target MCUs memory space will be read, and the rest will be discarded.
If overlapping code data is detected the function will return FALSE, unless existing code data locations contain the default empty value (for most MCUs it is 0xFF, for some it is 0x00) and the “OverwriteEmptyValues”, https://elprotronic.atlassian.net/wiki/spaces/FPGPARM/pages/57802857/General+Configuration#OverwriteEmptyValues, option is enabled in the configuration. By default, no overwrites are allowed.
Syntax
INT_X F_AppendCodeFile( char * FileName )Input
char * FileName : path to code file including filename and extension
Select FPA to perform operation on using Multi API-DLL Functions | F_Set_FPA_index, index 1 to 64. Use index 0 to perform operation on all FPAs (if results differ, use Multi API-DLL Functions | F_LastStatus to get individual results).
Output
INT_X : result of operation
FALSE (0) : failed
TRUE (1) : succeeded
STATUS_OPEN_FILE_ERROR (535): could not open file
STATUS_FILE_NAME_ERROR (536): format not supported
STATUS_MAX FILE_COUNT (557): total number of files exceeds MAX_FILE_INDEX (20)
STATUS_DUPLICATE_FILE PATH (558): appending already existing file
FPA_UNMATCHED_RESULTS (-1 or 0xFFFFFFFF) : Result of operation inconsistent across all selected FPAs, refer to Multi API-DLL Functions | F_LastStatus
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range