Standard Software Driver for C90FL Flash module embedded on
SPC56 A line microcontroller
Introduction
This document is the user manual for the Standard Software Driver (SSD) for single C90
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 C90FL SSD contains a set of functions to
program/erase a single C90FL Flash module.
The C90FL Standard Software Driver (SSD) provides the following API’s:
This document is the user manual for the Standard Software Driver (SSD) for single C90FL
Flash module. The road-map for the document is as follows.
Section 1.2shows the features of the driver. Appendix B: System requirementsdetails the
system requirement for the driver development. Appendix D: Document referencelists the
documents referred and terms used in making of this document. Appendix C: Acronymslists
the acronyms used.
Chapter 2describes 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.2mentions about the type definitions used for the driver. Section 2.3 mentions the
driver configuration parameters and configuration macros respectively. Section 2.4 and
Section 2.5 describe the CallBack notifications, and return codes used for the driver.
Section 2.6 and Section 2.7 provide the detailed description of normal mode and special
Two sets of driver binaries built on Power Architecture instruction set technology and
Variable-Length-Encoding (VLE) instruction set.
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
debugmode/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
6/41UM1620 Rev 4
UM1620API specification
2 API specification
2.1 General overview
The C90FL 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
Table 1. Type definitions
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.
Parameter nameTypeParameter description
c90flRegBaseUINT32The base address of C90FL and BIU control registers.
mainArrayBaseUINT32The base address of Flash main array.
mainArraySizeUINT32The size of Flash main array in byte.
Table 2. SSD configuration structure field definition
UM1620 Rev 47/41
API specificationUM1620
Table 2. SSD configuration structure field definition (continued)
Parameter nameTypeParameter description
shadowRowBaseUINT32The base address of shadow row
shadowRowSizeUINT32The size of shadow row in byte.
shadowRowSizeUINT32Number of blocks of the large address space (128K or 256K).
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 C90FL Flash
BDMEnableUINT32
Defines the state of background debug mode (enable
/disable)
The type definition for the structure is given below.
Note:The macro value COMPILER_SELECT should be set to
CODE_WARRIOR – if CodeWarrior compiler is used for compiling
DIAB_COMPILER – if Diab compiler is used for compiling
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 C90FL 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.
8/41UM1620 Rev 4
UM1620API specification
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
UM1620 Rev 49/41
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.
API specificationUM1620
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. ‘FlashInit()’ 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
UINT32
can be returned with a single return code. Each bit in
the returned value, except for C90FL_OK, indicates a
kind of current status of C90FL module.
Table 5. Return values for FlashInit()
C90FL_OK
C90FL_INFO_EER
C90FL_INFO_RWE
Troubleshooting
None.
Comments
‘FlashInit()’ checks the C90FL_MCR_RWE and C90FL_MCR_EER bit, and clear them
when any of them is set. If RWE bit is set, Flash program/erase operations can still be
performed.
Assumptions
The user must correctly initialize the fields including c90flRegBase, mainArrayBase,
shadowRowBase, shadowRowSize, pageSize and BDMEnable before passing the structure
to the FlashInit() functions
10/41UM1620 Rev 4
.
UM1620API specification
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.
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
Address of void call
back function pointer.
UM1620 Rev 411/41
Any addressable void function address. To disable it
use NULL_CALLBACK macro.
API specificationUM1620
Return values
TypeDescriptionPossible values
UINT32Successful completion or error value.
Table 7. Return values for FlashErase()
C90FL_OK
C90FL_ERROR_BUSY
C90FL_ERROR_EGOOD
Troubleshooting
Error codesPossible causesSolution
C90FL_ERROR_BUSY
C90FL_ERROR_ EGOOD Erase operation failed.
Table 8. Troubleshooting for FlashErase()
Wait until all previous
program/erase operations on the
New erase operation cannot be
performed because there is
program/erase sequence in
progress on the Flash module.
Flash module finish.
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 C90FL is available
and high voltage is applied to
C90FL. 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 show the formats of lowEnabledBlocks,
midEnabledBlocks and highEnabledBlocks for the C90FL module.
For low address space valid bits are from bit 0 to bit (lowBlockNum – 1). In which,
lowBlockNum is the number of low blocks returned from FlashInit();
For middle address space valid bits are from bit 0 and bit (midBlockNum – 1). In which,
midBlockNum is the number of middle blocks returned from FlashInit();
For high address space valid bits are from bit 0 to bit (highBlockNum – 1). In which,
highBlockNum is the number of high blocks returned from FlashInit();
12/41UM1620 Rev 4
UM1620API specification
For example, below are bit allocations for blocks in Low/Mid/High Address Space of
SPC564A70:
MSBLSB
bit 31…bit 10bit 9bit 8…bit 1bit 0
reserved…reservedblock 9block 8…block 1block 0
Table 9. Bit allocation for blocks in low address space
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 10. Bit allocation for blocks in middle address space
Table 11. 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 C90FL module. ‘FlashErase()’ returns C90FL_ERROR_BUSY
when trying to do so. Similarly, once an erasing operation has started on C90FL 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. User provides the
correct ssdconfig parameters to FlashErase() as returned by FlashInit().
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.
UM1620 Rev 413/41
Loading...
+ 28 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.