Standard Software Driver for C90LC Flash module embedded on
SPC56 M, B, C, D and P lines microcontroller
Introduction
This document is the user manual for the Standard Software Driver (SSD) for C90LC Flash
module.
The SSD is a set of API’s that enables user application to operate on the Flash module
embedded on a microcontroller. The C90LC SSD contains a set of functions to
program/erase C90LC Flash modules.
The C90LC Standard Software Driver (SSD) provides the following API’s:
This document is the user manual for the Standard Software Driver (SSD) for C90LC Flash
module. The roadmap for the document is as follows.
Section 1.2 shows the features of the driver. Appendix A: System requirements details the
system requirement for the driver development. Appendix B: Acronyms and Appendix C:
Documentation references list the documents referred and terms used in making of this
document. Appendix B: Acronyms lists the acronyms used.
Section 2 describes the API specifications. In this section there are many sub sections,
which describe the different aspects of the driver. Section 2.1 provides a general overview of
the driver. Section 2.2 mentions about the type definitions used for the driver. Section 2.3
mentions the driver configuration parameters. Section 2.4 and Section 2.5 describe the
CallBack notifications and return codes for the driver respectively. Section 2.6 and
Section 2.7 provides the detailed description of normal mode and special mode standard
software Flash Driver APIs’ respectively.
1.2 Features
The C90LC SSD provides the following features:
Two sets of driver binaries built with Variable-Length-Encoding (VLE) instruction set.
Three sets of driver binaries built with three different toolchains.
Drivers released in binary c-array format to provide compiler-independent support for
non-debug-mode embedded applications.
Drivers released in s-record format to provide compiler-independent support for debug-
mode/JTAG programming tools.
Each driver function is independent of each other so the end user can choose the
function subset to meet their particular needs.
Support page-wise programming for fast programming.
Position-independent and ROM-able
Ready-to-use demos illustrating the usage of the driver
Concurrency support via callback
UM1627 Rev35/38
API specificationUM1627
2 API specification
2.1 General overview
The C90LC SSD has APIs to handle the erase, program, erase verify and program verify
operations on the Flash. Apart from these, it also provides the feature for locking specific
blocks and calculating Check sum. This SSD also provides 3 user test APIs for checking the
Array Integrity and the ECC Logic.
2.2 General type definitions
Derived typeSizeC language type description
BOOL8-bitsunsigned char
INT88-bitssigned char
VINT88-bitsvolatile signed char
UINT88-bitsunsigned char
VUINT88-bitsvolatile unsigned char
INT1616-bitssigned short
VINT1616-bitsvolatile signed short
UINT1616-bitsunsigned short
VUINT1616-bitsvolatile unsigned short
INT3232-bitssigned long
VINT3232-bitsvolatile signed long
UINT3232-bitsunsigned long
VUINT3232-bitsvolatile unsigned long
INT6464-bitssigned long long
VINT6464-bitsvolatile signed long long
UINT6464-bitsunsigned long long
Table 1. Type definitions
VUINT6464-bitsvolatile unsigned long long
2.3 Configuration parameters and macros
The configuration parameter which is used for SSD operations is explained in this section.
The configuration parameters are handled as structure. The user should correctly initialize
the fields including c90flRegBase, mainArrayBase, shadowRowBase, shadowRowSize,
pageSize and BDMEnable before passing the structure to SSD functions. The pointer to
CallBack has to be initialized either to a null pointer or a valid CallBack function pointer.
6/38UM1627 Rev3
UM1627API specification
Parameter nameTypeParameter description
c90flRegBaseUINT32The base address of C90LC and BIU control registers.
mainArrayBaseUINT32The base address of Flash main array.
mainArraySizeUINT32The size of Flash main array.
shadowRowBaseUINT32The base address of shadow row
shadowRowSizeUINT32The size of shadow row in byte.
lowBlockNumUINT32Block number of the low address space.
midBlockNumUINT32Block number of the mid address space.
highBlockNumUINT32Block number of the high address space.
pageSizeUINT32The page size of the C90LC Flash
BDMEnableUINT32
Table 2. SSD configuration structure field definition
Defines the state of background debug mode (enable
/disable)
The type definition for the structure is given below.
typedef struct _ssd_config
{
UINT32 c90flRegBase;
UINT32 mainArrayBase;
UINT32 mainArraySize;
UINT32 shadowRowBase;
UINT32 shadowRowSize;
UINT32 lowBlockNum;
UINT32 midBlockNum;
UINT32 highBlockNum;
UINT32 pageSize;
UINT32 BDMEnable;
} SSD_CONFIG, *PSSD_CONFIG;
2.4 Callback notification
The Standard Software Driver facilitates the user to supply a pointer to ‘CallBack()’ function
so that time-critical events can be serviced during C90LC Standard Software driver
operations.
Servicing watchdog timers is one such time critical event. If it is not necessary to provide the
CallBack service, the user is able to disable it by a NULL function macro.
#define NULL_CALLBACK ((void *) 0xFFFFFFFF)
The job processing callback notifications shall have no parameters and no return value.
UM1627 Rev37/38
API specificationUM1627
2.5 Return codes
The return code is returned to the caller function to notify the success or errors of the API
execution. These are the possible values of return code:
NameValueDescription
C90FL_OK0x00000000The requested operation is successful.
C90FL_INFO_RWE 0x00000001RWE bit is set before Flash operations.
C90FL_INFO_EER0x00000002EER bit is set before Flash operations.
C90FL_ERROR_ALIGNMENT0x00000100Alignment error.
C90FL_ERROR_RANGE0x00000200Address range error.
C90FL_ERROR_BUSY0x00000300
C90FL_ERROR_PGOOD0x00000400The program operation is unsuccessful.
C90FL_ERROR_EGOOD0x00000500The erase operation is unsuccessful.
New program/erase cannot be preformed
while a high voltage operation is already in
progress.
There is a non-blank Flash memory location
within the checked Flash memory region.
There is a mismatch between the source
data and the content in the checked Flash
memory.
Read-while-write error occurred in previous
reads.
The password provided cannot unlock the
block lock register for register writes
C90FL_ERROR_AIC_MISMATCH0x00000B00
C90FL_ERROR_AIC_NO_BLOCK0x00000C00
C90FL_ERROR_FMR_MISMATCH0x00000D00
C90FL_ERROR_FMR_NO_BLOCK0x00000E00
C90FL_ERROR_ECC_LOGIC0x00000F00
C90FL_ERROR_SUSP0x00001000
8/38UM1627 Rev3
In ‘FlashArrayIntegrityCheck()’ the MISR
values generated by the hardware do not
match the values passed by the user.
In ‘FlashArrayIntegrityCheck()’ no blocks
have been enabled for Array Integrity check
In ‘FactoryMarginReadCheck()’ the MISR
values generated by the hardware do not
match the values passed by the user.
In ‘FactoryMarginReadCheck()’ no blocks
have been enabled for Array Integrity check
In ‘FlashECCLogicCheck()’ the simulated
ECC error has not occurred.
On going high voltage operation cannot be
suspended.
UM1627API specification
2.6 Normal mode functions
2.6.1 FlashInit()
Description
This function reads the Flash configuration information from the Flash control registers and
initialize parameters in SSD configuration structure. ‘FlashIni()’ must be called prior to any
other Flash operations.
Prototype
UINT32 FlashInit (PSSD_CONFIG pSSDConfig);
Arguments
ArgumentDescriptionRange
pSSDConfig
Pointer to the SSD
Configuration Structure.
Table 4. Arguments for FlashInit()
The values in this structure are chip-dependent.
Please refer to Section 2.3 for more details.
Return values
TypeDescriptionPossible values
Indicates either success or failure type. It is a bit mapped
return code so that more than one condition can be
UINT32
returned with a single return code. Each bit in the returned
value, except for C90FL_OK, indicates a kind of current
status of C90LC module.
Table 5. Return values for FlashInit()
C90FL_OK
C90FL_INFO_EER
C90FL_INFO_RWE
Troubleshooting
Error codesPossible causesSolution
C90FL_INFO_EER
Table 6. Troubleshooting for FlashInit()
An ECC Error occurred during a
previous read.
Clear FLASH_MCR-EER bit.
C90FL_INFO_RWE
A Read While Write Error occurred
during a previous read
Clear the FLASH_MCR-RWE bit.
Comments
‘FlashIni()’ checks the C90FL_MCR_RWE and C90FL_MCR_EER bit, but does not clear
them when any of them is set. If RWE bit is set, Flash program/erase operations can still be
performed.
Assumptions
None.
UM1627 Rev39/38
API specificationUM1627
2.6.2 FlashErase()
Description
This function erases the enabled blocks in the main array or the shadow row. Input
arguments together with relevant Flash module status are checked, and relevant error code
is returned if there is any error.
Prototypse
UINT32 FlahErase (PSSD_CONFIG pSSDConfig,
BOOL shadowFlag,
UINT32 lowEnabledBlocks,
UINT32 midEnabledBlocks,
UINT32 highEnabledBlocks,
void (*CallBack)(void));
Arguments
ArgumentDescription Range
Table 7. Arguments for FlashErase()
pSSDConfig
shadowFlag
lowEnabledBlocks
midEnabledBlocks
highEnabledBlocks
Pointer to the SSD
Configuration Structure.
Indicate either the main
array or the shadow row
to be erased.
To select the array
blocks in low address
space for erasing.
To select the array
blocks in mid address
space for erasing.
To select the array
blocks in high address
space for erasing.
The values in this structure are chip-dependent.
Please refer to Section 2.3 for more details.
TRUE: the shadow row is erased. The
lowEnabledBlocks, midEnabledBlocks and
highEnabledBlocks are ignored;
FALSE: the main array is erased. Which blocks are
erased in low, mid and high address spaces are
specified by lowEnabledBlocks, midEnabledBlocks
and highEnabledBlocks respectively.
Bit-mapped value. Select the block in the low
address space to be erased by setting 1 to the
appropriate bit of lowEnabledBlocks. If there is not
any block to be erased in the low address space,
lowEnabledBlocks must be set to 0.
Bit-mapped value. Select the block in the middle
address space to be erased by setting 1 to the
appropriate bit of midEnabledBlocks. If there is not
any block to be erased in the middle address space,
midEnabledBlocks must be set to 0.
Bit-mapped value. Select the block in the high
address space to be erased by setting 1 to the
appropriate bit of highEnabledBlocks. If there is not
any block to be erased in the high address space,
highEnabledBlocks must be set to 0.
CallBack
10/38UM1627 Rev3
Address of void call
back function pointer.
Any addressable void function address. To disable it
use NULL_CALLBACK macro.
UM1627API specification
Return values
TypeDescriptionPossible values
UINT32Successful completion or error value.
Table 8. Return values for FlashErase()
C90FL_OK
C90FL_ERROR_BUSY
C90FL_ERROR_EGOOD
Troubleshooting
Error codesPossible causesSolution
C90FL_ERROR_BUSY
Table 9. Troubleshooting for FlashErase()
Wait until all previous program/erase
operations on the Flash module finish.
New erase operation cannot
be performed because there is
program/erase sequence in
progress on the Flash module.
Possible cases that erase cannot start
are:
– erase in progress (FLASH_MCR-
ERS is high);
– program in progress (FLASH_MCR-
PGM is high);
Check if the C90LC is available and
C90FL_ERROR_ EGOODErase operation failed.
high voltage is applied to C90LC. Then
try to do the erase operation again.
Comments
When shadowFlag is set to FALSE, the ‘FlashErase()’ function erases the blocks in the main
array. It is capable of erasing any combination of blocks in the low, mid and high address
spaces in one operation. If shadowFlag is TRUE, this function erases the shadow row.
The inputs lowEnabledBlocks, midEnabledBlocks and highEnabledBlocks are bit-mapped
arguments that are used to select the blocks to be erased in the Low/Mid/High address
spaces of main array. The selection of the blocks of the main array is determined by
setting/clearing the corresponding bit in lowEnabledBlocks, midEnabledBlocks or
highEnabledBlocks.
The bit allocations for blocks in one address space are: bit 0 is assigned to block 0, bit 1 to
block 1, etc. The following diagrams give an example of the formats of lowEnabledBlocks,
midEnabledBlocks and highEnabledBlocks for the C90LC module. Refer to Appendix C:
Documentation references for the valid bits configuration depending from the specific
microcontroller Flash module sectors.
MSBLSB
Table 10. Bit allocation for blocks in low address space
bit 31…bit 10bit 9bit 8…bit 1bit 0
reserved…reservedblock 9block 8…block 1block 0
UM1627 Rev311/38
API specificationUM1627
MSBLSB
bit 31…bit 4bit 3bit 2bit 1bit 0
reserved…reservedreservedreservedblock 1block 0
MSBLSB
bit 31…bit 6bit 5bit 4…bit 1bit 0
reserved…reservedblock 5block 4…Block 1Block 0
Table 11. Bit allocation for blocks in middle address space
Table 12. Bit allocation for blocks in high address space
If the selected main array blocks or the shadow row is locked for erasing, those blocks or
the shadow row are not erased, but ‘FlashErase()’ still returns C90FL_OK. User needs to
check the erasing result with the ‘BlankCheck()’ function.
It is impossible to erase any Flash block or shadow row when a program or erase operation
is already in progress on C90LC module. ‘FlashErase()’ returns C90FL_ERROR_BUSY
when trying to do so. Similarly, once an erasing operation has started on C90LC module, it
is impossible to run another program or erase operation.
In addition, when ‘FlashErase()’ is running, it is unsafe to read the data from the Flash
module having one or more blocks being erased. Otherwise, it causes a Read-While-Write
error.
Assumptions
It assumes that the Flash block is initialized using a ‘FlashInit()’ API.
2.6.3 BlankCheck()
Description
This function checks on the specified Flash range in the main array or shadow row for blank
state. If the blank checking fails, the first failing address and the failing data in Flash block
are saved.
Prototype
UINT32 BlankCheck (PSSD_CONFIG pSSDConfig,
UINT32 dest,
UINT32 size,
UINT32 * pFailAddress,
UINT64 *pFailData,
void (*CallBack) (void ));
12/38UM1627 Rev3
Loading...
+ 26 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.