C90 SSD Driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C90 SSD Driver

Jump to solution
1,885 Views
chenxiubo
Contributor III

Hi,

     I am using MPC5634 MCU  Flash module for bootloader, but  there are two versions:

for example :

1. BlankCheck.c     

vertion 1: 

/*****************************************************************
* PROJECT : Standard Software Driver (SSD) for M10ST based devices
* FILE : blankcheck.c
*
* DESCRIPTION : This file contains BlankCheck function implementation
*
* COPYRIGHT :(c) 2008, Freescale & STMicroelectronics
*
* VERSION : EAR 0.2
* DATE : 04.18.2008
* AUTHOR : ...
*
* HISTORY :
* 2007.12.11 Arvind Awasthi Initial Version
* 2008.04.18 Leonardo Colombo Changed header in agreement with JDP SW
* template
******************************************************************/

#include "ssd_c90fl.h"
#include "ssd_c90fl_internal.h"


/*******************************************************************
| external declarations
|------------------------------------------------------------------*/

/*******************************************************************
| defines and macros (scope: module-local)
|------------------------------------------------------------------*/

/*******************************************************************
| typedefs and structures (scope: module-local)
|------------------------------------------------------------------*/

/*******************************************************************
| global variable definitions (scope: module-exported)
|------------------------------------------------------------------*/

/*******************************************************************
| global variable definitions (scope: module-local)
|------------------------------------------------------------------*/

/*******************************************************************
| function prototypes (scope: module-local)
|------------------------------------------------------------------*/

/*******************************************************************
| function implementations (scope: module-local)
|------------------------------------------------------------------*/

/*******************************************************************
| function implementations (scope: module-exported)
|------------------------------------------------------------------*/

/************************************************************************
* *
* FUNCTION : BlankCheck *
* DESCRIPTION : This function will verify a specified flash range *
* to be erased. *
* PARAMETERS : *
* pSSDConfig - Flash driver configuration structure *
* dest - start flash addr to be programmed *
* size - number of bytes to be programmed *
* (need to be dword-aligned) *
* pFailAddress - pointer to first failing address *
* pFailData - pointer to first failing actual data *
* CallBack - Callback function pointer for timeout *
* checking. *
* RETURN : C90FL_OK - passes *
* C90FL_ERROR_VERIFY - failed verify *
* C90FL_ERROR_RANGE - Invalid addr range *
* C90FL_ERROR_ALIGNMENT - Invalid alignment *
* *
*************************************************************************/
UINT32 BlankCheck ( PSSD_CONFIG pSSDConfig,
UINT32 dest,
UINT32 size,
UINT32 *pFailAddress,
UINT64 *pFailData,
void (*CallBack)(void))
{
register UINT32 returnCode; /* return code */
UINT32 destIndex; /* destination address index */
UINT32 shadowRowEnd; /* shadow row base + shadow size */
UINT32 mainArrayEnd; /* main array base + main array size */
UINT32 temp; /* dest + size, or CallBack step */

returnCode = C90FL_OK;

/* Check alignments */
if ( ((dest | size) % C90FL_DWORD_SIZE) != 0 )
{
returnCode = C90FL_ERROR_ALIGNMENT;
goto EXIT;
}

/* The flash range should fall within either shadow row or main array */
shadowRowEnd = pSSDConfig->shadowRowBase + pSSDConfig->shadowRowSize;
mainArrayEnd = pSSDConfig->mainArrayBase + pSSDConfig->mainArraySize;
temp = dest + size;

if ( !((dest >= pSSDConfig->shadowRowBase) && (dest < shadowRowEnd) &&
(size <= pSSDConfig->shadowRowSize) && (temp <= shadowRowEnd))
&&
!((dest >= pSSDConfig->mainArrayBase) && (dest < mainArrayEnd) &&
(size <= pSSDConfig->mainArraySize) && (temp <= mainArrayEnd)) )
{
returnCode = C90FL_ERROR_RANGE;
goto EXIT;
}

temp = 0;

/* Blank check by double word */
for (destIndex = 0; destIndex < (size / C90FL_DWORD_SIZE); destIndex++)
{
if ( (*(UINT64 *)dest) != 0xFFFFFFFFFFFFFFFF )
{
returnCode = C90FL_ERROR_NOT_BLANK;
*pFailAddress = dest;
*pFailData = *(UINT64 *)dest;
break;
}

dest += C90FL_DWORD_SIZE;

/* CallBack */
if ( (CallBack != NULL_CALLBACK) && (destIndex == temp) )
{
CallBack();
temp += CALLBACK_BC;
}
}

EXIT:
if (pSSDConfig->BDMEnable)
{
//asm ( "mr r3,returnCode" ); /* save the return code to R3 */
#ifdef VLE_ASM
asm ( "se_sc " ); /* generate system call interrupt */
#else
asm ( "sc " );
#endif
}

return returnCode;
}

 

Vertion 2:


const unsigned long BlankCheck_C[] =
{

0x9421FFA0, 0x7C0802A6, 0xBEA10034, 0x90010064, 0x7C7F1B78,
0x7C9E2378, 0x7CBD2B78, 0x7CDC3378, 0x7CFB3B78, 0x7D1A4378,
0x57CC077E, 0x2B0C0000, 0x57AB07BE, 0x280B0000, 0x4C5A1202,
0x4182000C, 0x3B200100, 0x48000130, 0x819F000C, 0x817F0010,
0x7F0C5A14, 0x815F0004, 0x813F0008, 0x7EEA4A14, 0x7EDEEA14,
0x817F0004, 0x7C0BF040, 0x41810020, 0x7C1EB840, 0x40800018,
0x819F0008, 0x7C0CE840, 0x4180000C, 0x7C16B840, 0x4081002C,
0x819F000C, 0x7C0CF040, 0x418100DC, 0x7C1EC040, 0x408000D4,
0x819F0010, 0x7C0CE840, 0x418000C8, 0x7C16C040, 0x418100C0,
0x3B200000, 0x3AC00050, 0x57B5E8FE, 0x3AE00000, 0x7C17A840,
0x40800068, 0x817E0000, 0x819E0004, 0x3920FFFF, 0x3940FFFF,
0x7C0B4840, 0x40820008, 0x7C0C5040, 0x41820020, 0x3B200600,
0x93DC0000, 0x813E0000, 0x815E0004, 0x913B0000, 0x915B0004,
0x4800002C, 0x3BDE0008, 0x2C1AFFFF, 0x41820018, 0x7C17B040,
0x40820010, 0x7F4903A6, 0x4E800421, 0x3AD60050, 0x3AF70001,
0x4BFFFF98, 0x57B6077E, 0x2C160000, 0x4182003C, 0x2C190000,
0x40820034, 0x819E0000, 0x2C0CFFFF, 0x41820028, 0x3B200600,
0x93DC0000, 0x817E0000, 0x7D6A5B78, 0x39200000, 0x913B0000,
0x915B0004, 0x48000008, 0x3B200200, 0x819F0024, 0x2C0C0000,
0x41820014, 0x7F23CB78, 0x60000000, 0x00000000, 0x60000000,
0x7F23CB78, 0xBAA10034, 0x80010064, 0x7C0803A6, 0x38210060,
0x4E800020, 0x4D504339, 0x30424331, 0x3130FFFF
};
/* Total Data Size = 436 bytes */

 

 

 

One vertion is function,the other is array.Is there any different between them? 

Also you can see  attachment files.

Original Attachment has been moved to: Flash.rar

Labels (1)
0 Kudos
1 Solution
1,261 Views
chenxiubo
Contributor III

@Lukas Zadrapa ,Thank you very much.

I want to use first vertion-- f

 

View solution in original post

3 Replies
1,261 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

use the C-array drivers. The source codes are provided only for reference. The SSD drivers are provided in pre-compiled form to avoid possible issues caused by different compilers.

The latest driver for MPC5634M is this one:

http://www.nxp.com/files/soft_dev_tools/software/device_drivers/MPC56XX_C90LC_JDP_SSD_100_DEVD.exe

Examples are included in the package.

You can also take a look at this bootloader for MPC5634M - SDD flash drivers are used there:

https://community.nxp.com/servlet/JiveServlet/download/427962-1-279359/bootloader.zip

Regards,

Lukas

0 Kudos
1,262 Views
chenxiubo
Contributor III

@Lukas Zadrapa ,Thank you very much.

I want to use first vertion-- f

 

1,261 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

OK, but please notice that we do not support customers who use the source files directly...

Lukas

0 Kudos