1 //<MStar Software> 2 //****************************************************************************** 3 // MStar Software 4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5 // All software, firmware and related documentation herein ("MStar Software") are 6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7 // law, including, but not limited to, copyright law and international treaties. 8 // Any use, modification, reproduction, retransmission, or republication of all 9 // or part of MStar Software is expressly prohibited, unless prior written 10 // permission has been granted by MStar. 11 // 12 // By accessing, browsing and/or using MStar Software, you acknowledge that you 13 // have read, understood, and agree, to be bound by below terms ("Terms") and to 14 // comply with all applicable laws and regulations: 15 // 16 // 1. MStar shall retain any and all right, ownership and interest to MStar 17 // Software and any modification/derivatives thereof. 18 // No right, ownership, or interest to MStar Software and any 19 // modification/derivatives thereof is transferred to you under Terms. 20 // 21 // 2. You understand that MStar Software might include, incorporate or be 22 // supplied together with third party`s software and the use of MStar 23 // Software may require additional licenses from third parties. 24 // Therefore, you hereby agree it is your sole responsibility to separately 25 // obtain any and all third party right and license necessary for your use of 26 // such third party`s software. 27 // 28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29 // MStar`s confidential information and you agree to keep MStar`s 30 // confidential information in strictest confidence and not disclose to any 31 // third party. 32 // 33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34 // kind. Any warranties are hereby expressly disclaimed by MStar, including 35 // without limitation, any warranties of merchantability, non-infringement of 36 // intellectual property rights, fitness for a particular purpose, error free 37 // and in conformity with any international standard. You agree to waive any 38 // claim against MStar for any loss, damage, cost or expense that you may 39 // incur related to your use of MStar Software. 40 // In no event shall MStar be liable for any direct, indirect, incidental or 41 // consequential damages, including without limitation, lost of profit or 42 // revenues, lost or damage of data, and unauthorized system use. 43 // You agree that this Section 4 shall still apply without being affected 44 // even if MStar Software has been modified by MStar in accordance with your 45 // request or instruction for your use, except otherwise agreed by both 46 // parties in writing. 47 // 48 // 5. If requested, MStar may from time to time provide technical supports or 49 // services in relation with MStar Software to you for your use of 50 // MStar Software in conjunction with your or your customer`s product 51 // ("Services"). 52 // You understand and agree that, except otherwise agreed by both parties in 53 // writing, Services are provided on an "AS IS" basis and the warranty 54 // disclaimer set forth in Section 4 above shall apply. 55 // 56 // 6. Nothing contained herein shall be construed as by implication, estoppels 57 // or otherwise: 58 // (a) conferring any license or right to use MStar name, trademark, service 59 // mark, symbol or any other identification; 60 // (b) obligating MStar or any of its affiliates to furnish any person, 61 // including without limitation, you and your customers, any assistance 62 // of any kind whatsoever, or any information; or 63 // (c) conferring any license or right under any intellectual property right. 64 // 65 // 7. These terms shall be governed by and construed in accordance with the laws 66 // of Taiwan, R.O.C., excluding its conflict of law rules. 67 // Any and all dispute arising out hereof or related hereto shall be finally 68 // settled by arbitration referred to the Chinese Arbitration Association, 69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70 // Rules of the Association by three (3) arbitrators appointed in accordance 71 // with the said Rules. 72 // The place of arbitration shall be in Taipei, Taiwan and the language shall 73 // be English. 74 // The arbitration award shall be final and binding to both parties. 75 // 76 //****************************************************************************** 77 //<MStar Software> 78 //////////////////////////////////////////////////////////////////////////////// 79 // 80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81 // All rights reserved. 82 // 83 // Unless otherwise stipulated in writing, any and all information contained 84 // herein regardless in any format shall remain the sole proprietary of 85 // MStar Semiconductor Inc. and be kept in strict confidence 86 // ("MStar Confidential Information") by the recipient. 87 // Any unauthorized act including without limitation unauthorized disclosure, 88 // copying, use, reproduction, sale, distribution, modification, disassembling, 89 // reverse engineering and compiling of the contents of MStar Confidential 90 // Information is unlawful and strictly prohibited. MStar hereby reserves the 91 // rights to any and all damages, losses, costs and expenses resulting therefrom. 92 // 93 //////////////////////////////////////////////////////////////////////////////// 94 95 /////////////////////////////////////////////////////////////////////////////////////////////////// 96 /// 97 /// @file drvSERFLASH.h 98 /// @brief Serial Flash Driver Interface 99 /// @author MStar Semiconductor Inc. 100 /////////////////////////////////////////////////////////////////////////////////////////////////// 101 102 /*! \defgroup G_SERFLASH SERFLASH interface 103 * \ingroup G_PERIPHERAL 104 105 \brief 106 107 Flash Self Programming controlleris designed to for easy read/write external Serial Peripheral interface (SPI) flash. 108 109 <b>Features</b> 110 111 - Read ID Sequence 112 - Read SPI Status Sequence 113 - Write SPI Status Sequence 114 - Chip Erase Sequence 115 - Sector/Block Erase Sequence 116 - Page Program Sequence 117 - Read Data Sequence 118 119 <b>SPI Diagram</b> \n 120 \image html drvSERFLASH_pic.png 121 122 *! \defgroup G_SERFLASH_INIT Initialization Task relative 123 * \ingroup G_SERFLASH 124 \defgroup G_SERFLASH_COMMON Common Task relative 125 \ingroup G_SERFLASH 126 \defgroup G_SERFLASH_CONTROL Control relative 127 \ingroup G_SERFLASH 128 \defgroup G_SERFLASH_FSP FSP relative 129 \ingroup G_SERFLASH 130 *! \defgroup G_SERFLASH_OTHER other relative 131 * \ingroup G_SERFLASH 132 *! \defgroup G_SERFLASH_ToBeModified SERFLASH api to be modified 133 * \ingroup G_SERFLASH 134 \defgroup G_SERFLASH_ToBeRemove SERFLASH api to be removed 135 \ingroup G_SERFLASH 136 */ 137 138 #ifndef _DRV_SERFLASH_H_ 139 #define _DRV_SERFLASH_H_ 140 141 #include "MsCommon.h" 142 143 #ifdef __cplusplus 144 extern "C" 145 { 146 #endif 147 148 //------------------------------------------------------------------------------------------------- 149 // Driver Capability 150 //------------------------------------------------------------------------------------------------- 151 152 //------------------------------------------------------------------------------------------------- 153 // Macro and Define 154 //------------------------------------------------------------------------------------------------- 155 #define SERFLASH_UTOPIA20 (0) 156 #define MSIF_SPIF_LIB_CODE {'S','P','I','F'} //Lib code 157 #define MSIF_SPIF_LIBVER {'0','6'} //LIB version 158 #define MSIF_SPIF_BUILDNUM {'0','1'} //Build Number 159 #define MSIF_SPIF_CHANGELIST {'0','0','4','5','6','1','5','8'} //P4 ChangeList Number 160 161 #define SPIF_DRV_VERSION /* Character String for DRV/API version */ \ 162 MSIF_TAG, /* 'MSIF' */ \ 163 MSIF_CLASS, /* '00' */ \ 164 MSIF_CUS, /* 0x0000 */ \ 165 MSIF_MOD, /* 0x0000 */ \ 166 MSIF_CHIP, \ 167 MSIF_CPU, \ 168 MSIF_SPIF_LIB_CODE, /* IP__ */ \ 169 MSIF_SPIF_LIBVER, /* 0.0 ~ Z.Z */ \ 170 MSIF_SPIF_BUILDNUM, /* 00 ~ 99 */ \ 171 MSIF_SPIF_CHANGELIST, /* CL# */ \ 172 MSIF_OS 173 174 /// Operation cfg 175 #define SPIDMA_CFG_ADDR_DIR_BIT (0) 176 #define SPIDMA_CFG_REFLECT_BIT (1) 177 #define SPIDMA_CFG_CRCCOPY_BIT (2) 178 #define SPIDMA_CFG_NOWAITCOPY_BIT (3) 179 180 #define SPIDMA_OPCFG_DEF (0) 181 #define SPIDMA_OPCFG_INV_COPY _LShift(1, SPIDMA_CFG_ADDR_DIR_BIT) 182 #define SPIDMA_OPCFG_CRC_REFLECT _LShift(1, SPIDMA_CFG_REFLECT_BIT) //bit reflection of each input byte 183 #define SPIDMA_OPCFG_CRC_COPY _LShift(1, SPIDMA_CFG_CRCCOPY_BIT) //copy then crc check 184 #define SPIDMA_OPCFG_NOWAIT_COPY _LShift(1, SPIDMA_CFG_NOWAITCOPY_BIT) //copy then quit 185 //------------------------------------------------------------------------------------------------- 186 // Type and Structure 187 //------------------------------------------------------------------------------------------------- 188 /// Serial Flash information structure 189 typedef struct 190 { 191 MS_U32 u32AccessWidth; //data access width in bytes 192 MS_U32 u32TotalSize; //total size in bytes 193 MS_U32 u32SecNum; //number of sectors 194 MS_U32 u32SecSize; //sector size in bytes 195 } SERFLASH_Info; 196 197 typedef struct 198 { 199 MS_BOOL bIsBusy; 200 } SERFLASH_DrvStatus; 201 202 typedef enum 203 { 204 E_SERFLASH_DBGLV_NONE, //disable all the debug message 205 E_SERFLASH_DBGLV_INFO, //information 206 E_SERFLASH_DBGLV_NOTICE, //normal but significant condition 207 E_SERFLASH_DBGLV_WARNING, //warning conditions 208 E_SERFLASH_DBGLV_ERR, //error conditions 209 E_SERFLASH_DBGLV_CRIT, //critical conditions 210 E_SERFLASH_DBGLV_ALERT, //action must be taken immediately 211 E_SERFLASH_DBGLV_EMERG, //system is unusable 212 E_SERFLASH_DBGLV_DEBUG, //debug-level messages 213 } SERFLASH_DbgLv; 214 215 typedef enum _SPIDMA_Dev 216 { 217 E_SPIDMA_DEV_MIU0 218 ,E_SPIDMA_DEV_MIU1 219 ,E_SPIDMA_DEV_DMDMCU = 6 220 ,E_SPIDMA_DEV_VDMCU 221 ,E_SPIDMA_DEV_DSP 222 ,E_SPIDMA_DEV_TSP 223 ,E_SPIDMA_DEV_1KSRAM_HK51 224 ,E_SPIDMA_DEV_MIU2 225 ,E_SPIDMA_DEV_MIU3 226 ,E_SPIDMA_DEV_NOT_SUPPORT 227 }SPIDMA_Dev; 228 229 typedef enum _SPI_DrvCKG 230 { 231 E_SPI_XTALI = 0 232 ,E_SPI_27M 233 ,E_SPI_36M 234 ,E_SPI_43M 235 ,E_SPI_54M 236 ,E_SPI_72M 237 ,E_SPI_86M 238 ,E_SPI_108M 239 ,E_SPI_24M = 15 // T3 only 240 ,E_SPI_HALCKG_NOT_SUPPORT 241 }SPI_DrvCKG; 242 243 typedef enum _SPI_DrvClkDiv 244 { 245 E_SPI_DIV2 246 ,E_SPI_DIV4 247 ,E_SPI_DIV8 248 ,E_SPI_DIV16 249 ,E_SPI_DIV32 250 ,E_SPI_DIV64 251 ,E_SPI_DIV128 252 ,E_SPI_ClkDiv_NOT_SUPPORT 253 }SPI_DrvClkDiv; 254 255 ///SPI CS callback 256 typedef void (*ms_Mcu_ChipSelect_CB)(void); 257 typedef void (*ms_Flash_SetHWWP_CB)(MS_BOOL); 258 //////////////////////////////////////////////////////////////////////////////// 259 // include utopia v2 header files here 260 //////////////////////////////////////////////////////////////////////////////// 261 #include "drvSERFLASH_v2.h" 262 263 //------------------------------------------------------------------------------------------------- 264 // Function and Variable 265 //------------------------------------------------------------------------------------------------- 266 267 //------------------------------------------------------------------------------------------------- 268 /// Description : Get the information of Serial Flash 269 /// @ingroup G_SERFLASH_COMMON 270 /// @return the pointer to the driver information 271 //------------------------------------------------------------------------------------------------- 272 const SERFLASH_Info *MDrv_SERFLASH_GetInfo(void); 273 274 //------------------------------------------------------------------------------ 275 /// Description : Show the SERFLASH driver version 276 /// @ingroup G_SERFLASH_COMMON 277 /// @param ppVersion \b OUT: output NORF driver version 278 /// @return TRUE : succeed 279 /// @return FALSE : failed 280 //------------------------------------------------------------------------------ 281 // MS_BOOL MDrv_SERFLASH_GetLibVer(const MSIF_Version **ppVersion); 282 283 //------------------------------------------------------------------------------ 284 /// Description : Get Serial Flash driver status 285 /// @ingroup G_SERFLASH_COMMON 286 /// @param pDrvStatus \b OUT: poniter to store the returning driver status 287 /// @return TRUE : succeed 288 /// @return FALSE : failed to get the driver status 289 //------------------------------------------------------------------------------ 290 // MS_BOOL MDrv_SERFLASH_GetStatus(SERFLASH_DrvStatus* pDrvStatus); 291 292 //------------------------------------------------------------------------------ 293 /// Description : Set detailed level of Parallel Flash driver debug message 294 /// @ingroup G_SERFLASH_COMMON 295 /// @param u8DbgLevel \b IN debug level for Serial Flash driver 296 /// @return TRUE : succeed 297 /// @return FALSE : failed to set the debug level 298 //------------------------------------------------------------------------------ 299 MS_BOOL MDrv_SERFLASH_SetDbgLevel(MS_U8 u8DbgLevel); 300 //------------------------------------------------------------------------------ 301 /// Description : Set detailed level of Parallel Flash driver debug message 302 /// @ingroup G_SERFLASH_CONTROL 303 /// @param u8DbgLevel \b IN debug level for Serial Flash driver 304 /// @return TRUE : succeed 305 /// @return FALSE : failed to set the debug level 306 //------------------------------------------------------------------------------ 307 MS_BOOL MDrv_SERFLASH_SetWPInfo(MS_BOOL bWPInfo); 308 309 //------------------------------------------------------------------------------ 310 /// Description : HK ask 8051 to select flash chip by call back function 311 /// @ingroup G_SERFLASH_COMMON 312 /// @param ms_Mcu_ChipSelect_CB \b IN call back function 313 /// @return TRUE : succeed 314 /// @return NULL : 315 //------------------------------------------------------------------------------ 316 // void MDrv_SERFLASH_SetMcuCSCallBack(ms_Mcu_ChipSelect_CB ChipSel_cb); 317 //------------------------------------------------------------------------------ 318 /// Description : HK ask 8051 to select flash chip by call back function 319 /// @ingroup G_SERFLASH_COMMON 320 /// @param ms_Mcu_ChipSelect_CB \b IN call back function 321 /// @return TRUE : succeed 322 /// @return NULL : 323 //------------------------------------------------------------------------------ 324 void MDrv_SERFLASH_SetFlashWPCallBack(ms_Flash_SetHWWP_CB FlashWP_cb); 325 326 //------------------------------------------------------------------------------------------------- 327 /// Description : Detect flash type by reading the MID and DID 328 /// @ingroup G_SERFLASH_CONTROL 329 /// @return TRUE : succeed 330 /// @return FALSE : unknown flash type 331 /// @note Not allowed in interrupt context 332 //------------------------------------------------------------------------------------------------- 333 MS_BOOL MDrv_SERFLASH_DetectType(void); 334 335 //------------------------------------------------------------------------------------------------- 336 /// Description : Detect flash Size 337 /// @ingroup G_SERFLASH_CONTROL 338 /// @return TRUE : succeed 339 /// @return FALSE : unknown flash size 340 /// @note Not allowed in interrupt context 341 //------------------------------------------------------------------------------------------------- 342 MS_BOOL MDrv_SERFLASH_DetectSize(MS_U32 *u32FlashSize); 343 344 //------------------------------------------------------------------------------------------------- 345 /// Description : Enable Flash 2XREAD mode, if support 346 /// @ingroup G_SERFLASH_CONTROL 347 /// @param b2XMode \b IN: ENABLE/DISABLE 348 /// @return TRUE : succeed 349 /// @return FALSE : not succeed 350 /// @note Please ref. sprc. to confirm Flash support or not 351 //------------------------------------------------------------------------------------------------- 352 // MS_BOOL MDrv_SERFLASH_Set2XRead(MS_BOOL b2XMode); 353 354 //------------------------------------------------------------------------------------------------- 355 /// Description : Set ckg_spi which flash supports (please ref. the spec. before using this function) 356 /// @ingroup G_SERFLASH_CONTROL 357 /// @param SPI_DrvCKG \b IN: enumerate the ckg_spi 358 /// @return TRUE : succeed 359 /// @return FALSE : not succeed 360 /// @note Please ref. sprc. to confirm Flash support or not. It is safty to run at 43M (Default). 361 //------------------------------------------------------------------------------------------------- 362 // MS_BOOL MDrv_SERFLASH_SetCKG(SPI_DrvCKG eCKGspi); 363 364 //------------------------------------------------------------------------------------------------- 365 /// Description : Set clock div such that spi clock = mcu clock /clock_div. 366 /// @ingroup G_SERFLASH_CONTROL 367 /// @param SPI_DrvClkDiv \b IN: enumerate the clock_div 368 /// @return TRUE : succeed 369 /// @return FALSE : not succeed 370 /// @note 371 //------------------------------------------------------------------------------------------------- 372 // void MDrv_SERFLASH_ClkDiv(SPI_DrvClkDiv eClkDivspi); 373 374 //------------------------------------------------------------------------------------------------- 375 /// Description : Set XIU/RIU mode (Default : XIU) 376 /// @ingroup G_SERFLASH_CONTROL 377 /// @param bXiuRiu \b IN: 1 for XIU, 0 for RIU 378 /// @return TRUE : succeed 379 /// @return FALSE : not succeed 380 /// @note XIU mode is faster than RIU mode. It is stable to run by XIU (Default) 381 //------------------------------------------------------------------------------------------------- 382 MS_BOOL MDrv_SERFLASH_SetMode(MS_BOOL bXiuRiu); 383 384 //------------------------------------------------------------------------------------------------- 385 /// Description : Get Unique ID 386 /// @ingroup G_SERFLASH_CONTROL 387 /// @param None 388 /// @return the SPI Flash's Unique ID 389 //------------------------------------------------------------------------------------------------- 390 MS_U64 MDrv_SERFLASH_ReadUID(void); 391 392 //------------------------------------------------------------------------------------------------- 393 /// Description : Set active flash among multi-spi flashes 394 /// @ingroup G_SERFLASH_CONTROL 395 /// @param u8FlashIndex \b IN: The Flash index, 0 for external #1 spi flash, 1 for external #2 spi flash 396 /// @return TRUE : succeed 397 /// @return FALSE : not succeed 398 /// @note For Secure booting = 0, please check hw_strapping or e-fuse (the board needs to jump) 399 //------------------------------------------------------------------------------------------------- 400 // MS_BOOL MDrv_SERFLASH_ChipSelect(MS_U8 u8FlashIndex); 401 402 //------------------------------------------------------------------------------------------------- 403 /// Initialize Serial Flash 404 /// @ingroup G_INIT 405 /// @return None 406 //------------------------------------------------------------------------------------------------- 407 void MDrv_SERFLASH_Init(void); 408 409 //------------------------------------------------------------------------------------------------- 410 /// Description : Read ID from Serial Flash 411 /// @ingroup G_SERFLASH_CONTROL 412 /// @param pu8FlashID \b OUT: Virtual data ptr to store the read ID 413 /// @param u32IDSize \b IN: size in Bytes 414 /// @return TRUE : succeed 415 /// @return FALSE : fail before timeout 416 /// @note Not allowed in interrupt context 417 /// @note 418 /// [NONOS_SUPPORT] 419 //------------------------------------------------------------------------------------------------- 420 MS_BOOL MDrv_SERFLASH_ReadID(MS_U8 *pu8FlashID, MS_U32 u32IDSize); 421 422 //------------------------------------------------------------------------------------------------- 423 /// Description : Read data from Serial Flash 424 /// @ingroup G_SERFLASH_CONTROL 425 /// @param u32FlashAddr \b IN: Flash Address 426 /// @param u32FlashSize \b IN: Flash Size Data in Bytes 427 /// @param user_buffer \b OUT: Virtual Buffer Address ptr to store flash read data 428 /// @return TRUE : succeed 429 /// @return FALSE : fail before timeout or illegal parameters 430 /// @note Not allowed in interrupt context 431 /// [NONOS_SUPPORT] 432 //------------------------------------------------------------------------------------------------- 433 MS_BOOL MDrv_SERFLASH_Read(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 434 435 //------------------------------------------------------------------------------------------------- 436 /// Description : Erase all sectors in Serial Flash 437 /// @ingroup G_SERFLASH_CONTROL 438 /// @return TRUE : succeed 439 /// @return FALSE : fail before timeout 440 /// @note Not allowed in interrupt context 441 //------------------------------------------------------------------------------------------------- 442 MS_BOOL MDrv_SERFLASH_EraseChip(void); 443 444 //------------------------------------------------------------------------------------------------- 445 /// Description : Get flash start block index of a flash address 446 /// @ingroup G_SERFLASH_CONTROL 447 /// @param u32FlashAddr \b IN: flash address 448 /// @param pu32BlockIndex \b IN: poniter to store the returning block index 449 /// @return TRUE : succeed 450 /// @return FALSE : illegal parameters 451 /// @note Not allowed in interrupt context 452 //------------------------------------------------------------------------------------------------- 453 MS_BOOL MDrv_SERFLASH_AddressToBlock(MS_U32 u32FlashAddr, MS_U32 *pu32BlockIndex); 454 455 //------------------------------------------------------------------------------------------------- 456 /// Description : Get flash start address of a block index 457 /// @ingroup G_SERFLASH_CONTROL 458 /// @param u32BlockIndex \b IN: block index 459 /// @param pu32FlashAddr \b IN: pointer to store the returning flash address 460 /// @return TRUE : succeed 461 /// @return FALSE : illegal parameters 462 /// @note Not allowed in interrupt context 463 //------------------------------------------------------------------------------------------------- 464 MS_BOOL MDrv_SERFLASH_BlockToAddress(MS_U32 u32BlockIndex, MS_U32 *pu32FlashAddr); 465 466 //------------------------------------------------------------------------------------------------- 467 /// Description : Erase certain sectors given starting address and size in Serial Flash 468 /// @ingroup G_SERFLASH_CONTROL 469 /// @param u32StartAddr \b IN: start address at block boundry 470 /// @param u32EraseSize \b IN: size to erase 471 /// @param bWait \b IN: wait write done or not 472 /// @return TRUE : succeed 473 /// @return FALSE : fail before timeout or illegal parameters 474 /// @note Not allowed in interrupt context 475 //------------------------------------------------------------------------------------------------- 476 MS_BOOL MDrv_SERFLASH_AddressErase(MS_U32 u32StartAddr, MS_U32 u32EraseSize, MS_BOOL bWait); 477 478 //------------------------------------------------------------------------------------------------- 479 /// Description : Erase certain sectors in Serial Flash 480 /// @ingroup G_SERFLASH_CONTROL 481 /// @param u32StartBlock \b IN: start block 482 /// @param u32EndBlock \b IN: end block 483 /// @param bWait \b IN: wait write done or not 484 /// @return TRUE : succeed 485 /// @return FALSE : fail before timeout or illegal parameters 486 /// @note Not allowed in interrupt context 487 //------------------------------------------------------------------------------------------------- 488 MS_BOOL MDrv_SERFLASH_BlockErase(MS_U32 u32StartBlock, MS_U32 u32EndBlock, MS_BOOL bWait); 489 490 //------------------------------------------------------------------------------------------------- 491 /// Description : Erase certain 4K sectors in Serial Flash 492 /// @ingroup G_SERFLASH_CONTROL 493 /// @param u32StartBlock \b IN: start address 494 /// @param u32EndBlock \b IN: end address 495 /// @return TRUE : succeed 496 /// @return FALSE : fail before timeout or illegal parameters 497 /// @note Not allowed in interrupt context 498 //------------------------------------------------------------------------------------------------- 499 MS_BOOL MDrv_SERFLASH_SectorErase(MS_U32 u32StartAddr, MS_U32 u32EndAddr); 500 501 //------------------------------------------------------------------------------------------------- 502 /// Description : Check write done in Serial Flash 503 /// @ingroup G_SERFLASH_COMMON 504 /// @return TRUE : done 505 /// @return FALSE : not done 506 /// @note Not allowed in interrupt context 507 //------------------------------------------------------------------------------------------------- 508 // MS_BOOL MDrv_SERFLASH_CheckWriteDone(void); 509 510 //------------------------------------------------------------------------------------------------- 511 /// Description : Write data to Serial Flash 512 /// @ingroup G_SERFLASH_CONTROL 513 /// @param u32FlashAddr \b IN: start address (4-B aligned) 514 /// @param u32FlashSize \b IN: size in Bytes (4-B aligned) 515 /// @param user_buffer \b IN: Virtual Buffer Address ptr to flash write data 516 /// @return TRUE : succeed 517 /// @return FALSE : fail before timeout or illegal parameters 518 /// @note Not allowed in interrupt context 519 /// [NONOS_SUPPORT] 520 //------------------------------------------------------------------------------------------------- 521 MS_BOOL MDrv_SERFLASH_Write(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 522 523 //------------------------------------------------------------------------------------------------- 524 /// Description : Read data from Serial Flash to DRAM in DMA mode 525 /// @ingroup G_SERFLASH_CONTROL 526 /// @param u32FlashStart \b IN: src start address in flash (0 ~ flash size-1) 527 /// @param u32DRAMStart \b IN: dst start address in DRAM (16B-aligned) (0 ~ DRAM size-1) 528 /// @param u32Size \b IN: size in Bytes (8B-aligned) (>=8) 529 /// @return TRUE : succeed 530 /// @return FALSE : fail before timeout or illegal parameters 531 /// @note Not allowed in interrupt context 532 /// @note 533 /// [NONOS_SUPPORT] 534 //------------------------------------------------------------------------------------------------- 535 // MS_BOOL MDrv_SERFLASH_DMA(MS_U32 u32FlashStart, MS_U32 u32DRAMStart, MS_U32 u32Size); 536 537 //------------------------------------------------------------------------------------------------- 538 /// Description : Protect blocks in Serial Flash 539 /// @ingroup G_SERFLASH_CONTROL 540 /// @param bEnable \b IN: TRUE/FALSE: enable/disable protection 541 /// @return TRUE : succeed 542 /// @return FALSE : fail before timeout 543 /// @note Not allowed in interrupt context 544 //------------------------------------------------------------------------------------------------- 545 MS_BOOL MDrv_SERFLASH_WriteProtect(MS_BOOL bEnable); 546 547 //------------------------------------------------------------------------------------------------- 548 /// Description : Enables all range of flash write protection 549 /// @ingroup G_SERFLASH_ToBeRemove 550 /// @return TRUE : succeed 551 /// @return FALSE : fail before timeout 552 /// @note Not allowed in interrupt context 553 //------------------------------------------------------------------------------------------------- 554 // MS_BOOL MDrv_SERFLASH_WriteProtect_Enable_All_Range(void); 555 556 //------------------------------------------------------------------------------------------------- 557 /// Description : Disables all range of flash write protection 558 /// @ingroup G_SERFLASH_ToBeRemove 559 /// @return TRUE : succeed 560 /// @return FALSE : fail before timeout 561 /// @note Not allowed in interrupt context 562 //------------------------------------------------------------------------------------------------- 563 MS_BOOL MDrv_SERFLASH_WriteProtect_Disable_All_Range(void); 564 565 //------------------------------------------------------------------------------------------------- 566 /// Description : Set flash disable lower bound and size 567 /// @ingroup G_SERFLASH_ToBeRemove 568 /// @param u32DisableLowerBound \b IN: the lower bound to disable write protect 569 /// @param u32DisableSize \b IN: size to disable write protect 570 /// @return TRUE : succeed 571 /// @return FALSE : fail before timeout or illegal parameters 572 /// @note Not allowed in interrupt context 573 //------------------------------------------------------------------------------------------------- 574 // MS_BOOL MDrv_SERFLASH_WriteProtect_Disable_Range_Set(MS_U32 u32DisableLowerBound, MS_U32 u32DisableSize); 575 576 //------------------------------------------------------------------------------------------------- 577 /// Description : Protect blocks in Serial Flash 578 /// @ingroup G_SERFLASH_ToBeRemove 579 /// @param bEnableAllArea \b IN: enable or disable protection 580 /// @param u8BlockProtectBits \b IN: block protection bits which stand for the area to enable write protect 581 /// @return TRUE : succeed 582 /// @return FALSE : fail before timeout 583 /// @note Not allowed in interrupt context 584 //------------------------------------------------------------------------------------------------- 585 MS_BOOL MDrv_SERFLASH_WriteProtect_Area(MS_BOOL bEnableAllArea, MS_U8 u8BlockProtectBits); 586 587 //------- ------------------------------------------------------------------------------------------ 588 /// Description : Read Status Register in Serial Flash 589 /// @ingroup G_SERFLASH_CONTROL 590 /// @param pu8StatusReg \b OUT: ptr to Status Register value 591 /// @return TRUE : succeed 592 /// @return FALSE : fail before timeout 593 /// @note Not allowed in interrupt context 594 //------------------------------------------------------------------------------------------------- 595 MS_BOOL MDrv_SERFLASH_ReadStatusRegister(MS_U8 *pu8StatusReg); 596 597 //------- ------------------------------------------------------------------------------------------ 598 /// Description : Read Status Register2 in Serial Flash 599 /// @ingroup G_SERFLASH_ToBeRemove 600 /// @param pu8StatusReg \b OUT: ptr to Status Register value 601 /// @return TRUE : succeed 602 /// @return FALSE : fail before timeout 603 /// @note Not allowed in interrupt context 604 /// @note For Specific Flash IC with 16-bit status register (high-byte) 605 /// [NONOS_SUPPORT] 606 //------------------------------------------------------------------------------------------------- 607 // MS_BOOL MDrv_SERFLASH_ReadStatusRegister2(MS_U8 *pu8StatusReg); 608 609 //------- ------------------------------------------------------------------------------------------ 610 /// Description : Write Status Register in Serial Flash 611 /// @ingroup G_SERFLASH_CONTROL 612 /// @param u16StatusReg \b IN: Status Register value 613 /// @return TRUE : succeed 614 /// @return FALSE : fail before timeout 615 /// @note Not allowed in interrupt context 616 /// @note For Specific Flash IC with 16-bit status register 617 /// [NONOS_SUPPORT] 618 //------------------------------------------------------------------------------------------------- 619 MS_BOOL MDrv_SERFLASH_WriteStatusRegister(MS_U16 u16StatusReg); 620 621 //------- ------------------------------------------------------------------------------------------ 622 /// Description : Handle for BDMA copy data from ONLY Flash src to other dst 623 /// @ingroup G_SERFLASH_ToBeRemove 624 /// @param u32FlashAddr \b IN: Physical Source address in spi flash 625 /// @param u32DramAddr \b IN: Physical Dst address 626 /// @param u32Len \b IN: data length 627 /// @param eDstDev \b IN: The Dst Device of Flash BDMA 628 /// @param u8OpCfg \b IN: u8OpCfg: default is SPIDMA_OPCFG_DEF 629 /// - Bit0: inverse mode --> SPIDMA_OPCFG_INV_COPY 630 /// - Bit2: Copy & CRC check in wait mode --> SPIDMA_OPCFG_CRC_COPY 631 /// - Bit3: Copy without waiting --> SPIDMA_OPCFG_NOWAIT_COPY 632 /// @return \b MS_BOOL 633 /// [NONOS_SUPPORT] 634 /// [fw : drvBDMA ] 635 //------------------------------------------------------------------------------------------------- 636 // MS_BOOL MDrv_SERFLASH_CopyHnd(MS_PHYADDR u32FlashAddr, MS_PHYADDR u32DstAddr, MS_U32 u32Len, SPIDMA_Dev eDstDev, MS_U8 u8OpCfg); 637 638 //------- ------------------------------------------------------------------------------------------ 639 /// Description : Switch SPI as GPIO Input 640 /// @ingroup G_SERFLASH_CONTROL 641 /// @param bSwitch \b IN: 1 for GPIO, 0 for NORMAL 642 /// @note Not allowed in interrupt context 643 /// @note For project's power consumption 644 /// [NONOS_SUPPORT] 645 //------------------------------------------------------------------------------------------------- 646 // void MDrv_SERFLASH_SetGPIO(MS_BOOL bSwitch); 647 648 //------------------------------------------------------------------------------------------------- 649 // WRAPPER FOR CHAKRA 650 //------------------------------------------------------------------------------------------------- 651 MS_BOOL MDrv_SERFLASH_WriteProtect_Area_Lookup(MS_U32 u32ProtectSpace, MS_U32 u32NonProtectSpace, MS_U8 *pu8BlockProtectBits); 652 //------------------------------------------------------------------------------------------------- 653 /// MOBF Encrypt 654 /// @ingroup G_SERFLASH_ToBeRemove 655 /// @param u32Key \b IN: Key 656 /// @param bEnable \b IN: TRUE/FLASE 657 /// @return DRVAESDMA_OK : Success 658 /// @return Others : Fail 659 //------------------------------------------------------------------------------------------------- 660 MS_U32 MDrv_SERFLASH_WriteProtect_Area_Boundary(void); 661 //------------------------------------------------------------------------------------------------- 662 /// MOBF Encrypt 663 /// @ingroup G_SERFLASH_ToBeRemove 664 /// @param u32Key \b IN: Key 665 /// @param bEnable \b IN: TRUE/FLASE 666 /// @return DRVAESDMA_OK : Success 667 /// @return Others : Fail 668 //------------------------------------------------------------------------------------------------- 669 MS_BOOL MDrv_FLASH_Write(MS_U32 u32FlashAddr,MS_U32 u32FlashSize,MS_U8 * user_buffer); 670 //------------------------------------------------------------------------------------------------- 671 /// MOBF Encrypt 672 /// @ingroup G_SERFLASH_ToBeRemove 673 /// @param u32Key \b IN: Key 674 /// @param bEnable \b IN: TRUE/FLASE 675 /// @return DRVAESDMA_OK : Success 676 /// @return Others : Fail 677 //------------------------------------------------------------------------------------------------- 678 MS_BOOL MDrv_FLASH_Read(MS_U32 u32FlashAddr,MS_U32 u32FlashSize,MS_U8 * user_buffer); 679 //------------------------------------------------------------------------------------------------- 680 /// MOBF Encrypt 681 /// @ingroup G_SERFLASH_ToBeRemove 682 /// @param u32Key \b IN: Key 683 /// @param bEnable \b IN: TRUE/FLASE 684 /// @return DRVAESDMA_OK : Success 685 /// @return Others : Fail 686 //------------------------------------------------------------------------------------------------- 687 MS_BOOL MDrv_FLASH_WriteProtect(MS_BOOL bEnable); 688 //------------------------------------------------------------------------------------------------- 689 /// MOBF Encrypt 690 /// @ingroup G_SERFLASH_ToBeRemove 691 /// @param u32Key \b IN: Key 692 /// @param bEnable \b IN: TRUE/FLASE 693 /// @return DRVAESDMA_OK : Success 694 /// @return Others : Fail 695 //------------------------------------------------------------------------------------------------- 696 // MS_BOOL MDrv_FLASH_WriteProtect_Enable_All_Range(void); 697 //------------------------------------------------------------------------------------------------- 698 /// MOBF Encrypt 699 /// @ingroup G_SERFLASH_ToBeRemove 700 /// @param u32Key \b IN: Key 701 /// @param bEnable \b IN: TRUE/FLASE 702 /// @return DRVAESDMA_OK : Success 703 /// @return Others : Fail 704 //------------------------------------------------------------------------------------------------- 705 // MS_BOOL MDrv_FLASH_WriteProtect_Disable_All_Range(void); 706 //------------------------------------------------------------------------------------------------- 707 /// MOBF Encrypt 708 /// @ingroup G_SERFLASH_ToBeRemove 709 /// @param u32Key \b IN: Key 710 /// @param bEnable \b IN: TRUE/FLASE 711 /// @return DRVAESDMA_OK : Success 712 /// @return Others : Fail 713 //------------------------------------------------------------------------------------------------- 714 // MS_BOOL MDrv_FLASH_WriteProtect_Disable_Range_Set(MS_U32 DisableLowerBound, MS_U32 DisableSize); 715 //------------------------------------------------------------------------------------------------- 716 /// MOBF Encrypt 717 /// @ingroup G_SERFLASH_ToBeRemove 718 /// @param u32Key \b IN: Key 719 /// @param bEnable \b IN: TRUE/FLASE 720 /// @return DRVAESDMA_OK : Success 721 /// @return Others : Fail 722 //------------------------------------------------------------------------------------------------- 723 // MS_BOOL MDrv_FLASH_WriteProtect_Area(MS_BOOL bEnableAllArea, MS_U8 BlockProtectBits); 724 //------------------------------------------------------------------------------------------------- 725 /// MOBF Encrypt 726 /// @ingroup G_SERFLASH_ToBeRemove 727 /// @param u32Key \b IN: Key 728 /// @param bEnable \b IN: TRUE/FLASE 729 /// @return DRVAESDMA_OK : Success 730 /// @return Others : Fail 731 //------------------------------------------------------------------------------------------------- 732 MS_BOOL MDrv_FLASH_ReadStatusRegister(MS_U8 *pu8StatusReg); 733 //------------------------------------------------------------------------------------------------- 734 /// MOBF Encrypt 735 /// @ingroup G_SERFLASH_ToBeRemove 736 /// @param u32Key \b IN: Key 737 /// @param bEnable \b IN: TRUE/FLASE 738 /// @return DRVAESDMA_OK : Success 739 /// @return Others : Fail 740 //------------------------------------------------------------------------------------------------- 741 // MS_BOOL MDrv_FLASH_ReadStatusRegister2(MS_U8 *pu8StatusReg); 742 //------------------------------------------------------------------------------------------------- 743 /// MOBF Encrypt 744 /// @ingroup G_SERFLASH_ToBeRemove 745 /// @param u32Key \b IN: Key 746 /// @param bEnable \b IN: TRUE/FLASE 747 /// @return DRVAESDMA_OK : Success 748 /// @return Others : Fail 749 //------------------------------------------------------------------------------------------------- 750 MS_BOOL MDrv_FLASH_WriteStatusRegister(MS_U16 u16StatusReg); 751 //------------------------------------------------------------------------------------------------- 752 /// MOBF Encrypt 753 /// @ingroup G_SERFLASH_ToBeRemove 754 /// @param u32Key \b IN: Key 755 /// @param bEnable \b IN: TRUE/FLASE 756 /// @return DRVAESDMA_OK : Success 757 /// @return Others : Fail 758 //------------------------------------------------------------------------------------------------- 759 // MS_BOOL MDrv_FLASH_DetectType(void); 760 //------------------------------------------------------------------------------------------------- 761 /// MOBF Encrypt 762 /// @ingroup G_SERFLASH_ToBeRemove 763 /// @param u32Key \b IN: Key 764 /// @param bEnable \b IN: TRUE/FLASE 765 /// @return DRVAESDMA_OK : Success 766 /// @return Others : Fail 767 //------------------------------------------------------------------------------------------------- 768 // MS_BOOL MDrv_FLASH_DetectSize(MS_U32 *u32FlashSize); 769 //------------------------------------------------------------------------------------------------- 770 /// MOBF Encrypt 771 /// @ingroup G_SERFLASH_ToBeRemove 772 /// @param u32Key \b IN: Key 773 /// @param bEnable \b IN: TRUE/FLASE 774 /// @return DRVAESDMA_OK : Success 775 /// @return Others : Fail 776 //------------------------------------------------------------------------------------------------- 777 // MS_BOOL MDrv_FLASH_AddressToBlock(MS_U32 u32FlashAddr, MS_U32 *pu32BlockIndex); 778 //------------------------------------------------------------------------------------------------- 779 /// MOBF Encrypt 780 /// @ingroup G_SERFLASH_ToBeRemove 781 /// @param u32Key \b IN: Key 782 /// @param bEnable \b IN: TRUE/FLASE 783 /// @return DRVAESDMA_OK : Success 784 /// @return Others : Fail 785 //------------------------------------------------------------------------------------------------- 786 // MS_BOOL MDrv_FLASH_BlockToAddress(MS_U32 u32BlockIndex, MS_U32 *pu32FlashAddr); 787 //------------------------------------------------------------------------------------------------- 788 /// MOBF Encrypt 789 /// @ingroup G_SERFLASH_ToBeRemove 790 /// @param u32Key \b IN: Key 791 /// @param bEnable \b IN: TRUE/FLASE 792 /// @return DRVAESDMA_OK : Success 793 /// @return Others : Fail 794 //------------------------------------------------------------------------------------------------- 795 MS_BOOL MDrv_FLASH_AddressErase(MS_U32 u32StartAddr,MS_U32 u32EraseSize,MS_BOOL bWait); 796 //------------------------------------------------------------------------------------------------- 797 /// MOBF Encrypt 798 /// @ingroup G_SERFLASH_ToBeRemove 799 /// @param u32Key \b IN: Key 800 /// @param bEnable \b IN: TRUE/FLASE 801 /// @return DRVAESDMA_OK : Success 802 /// @return Others : Fail 803 //------------------------------------------------------------------------------------------------- 804 MS_BOOL MDrv_FLASH_BlockErase(MS_U16 u16StartBlock,MS_U16 u16EndBlock,MS_BOOL bWait); 805 //------------------------------------------------------------------------------------------------- 806 /// MOBF Encrypt 807 /// @ingroup G_SERFLASH_ToBeRemove 808 /// @param u32Key \b IN: Key 809 /// @param bEnable \b IN: TRUE/FLASE 810 /// @return DRVAESDMA_OK : Success 811 /// @return Others : Fail 812 //------------------------------------------------------------------------------------------------- 813 MS_BOOL MDrv_FLASH_CheckWriteDone(void); 814 815 #ifdef MXIC_IBPM 816 //------------------------------------------------------------------------------------------------- 817 /// MOBF Encrypt 818 /// @ingroup G_SERFLASH_ToBeRemove 819 /// @param u32Key \b IN: Key 820 /// @param bEnable \b IN: TRUE/FLASE 821 /// @return DRVAESDMA_OK : Success 822 /// @return Others : Fail 823 //------------------------------------------------------------------------------------------------- 824 void MDrv_SERFLASH_EnterIBPM(void); 825 //------------------------------------------------------------------------------------------------- 826 /// MOBF Encrypt 827 /// @ingroup G_SERFLASH_ToBeRemove 828 /// @param u32Key \b IN: Key 829 /// @param bEnable \b IN: TRUE/FLASE 830 /// @return DRVAESDMA_OK : Success 831 /// @return Others : Fail 832 //------------------------------------------------------------------------------------------------- 833 MS_U8 MDrv_SERFLASH_ReadBlockStatus(MS_PHYADDR u32FlashAddr); 834 //------------------------------------------------------------------------------------------------- 835 /// MOBF Encrypt 836 /// @ingroup G_SERFLASH_ToBeRemove 837 /// @param u32Key \b IN: Key 838 /// @param bEnable \b IN: TRUE/FLASE 839 /// @return DRVAESDMA_OK : Success 840 /// @return Others : Fail 841 //------------------------------------------------------------------------------------------------- 842 MS_BOOL MDrv_SERFLASH_SingleBlockProtect(MS_PHYADDR u32FlashAddr,MS_BOOL bLock); 843 //------------------------------------------------------------------------------------------------- 844 /// MOBF Encrypt 845 /// @ingroup G_SERFLASH_ToBeRemove 846 /// @param u32Key \b IN: Key 847 /// @param bEnable \b IN: TRUE/FLASE 848 /// @return DRVAESDMA_OK : Success 849 /// @return Others : Fail 850 //------------------------------------------------------------------------------------------------- 851 MS_U32 MDrv_SERFLASH_MultiBlockProtect(MS_U32 u32StartBlock, MS_U32 u32EndBlock, MS_BOOL bLock); 852 #endif 853 854 #ifdef MUNINN_ENABLE 855 //------------------------------------------------------------------------------------------------- 856 /// MOBF Encrypt 857 /// @ingroup G_SERFLASH_ToBeRemove 858 /// @param u32Key \b IN: Key 859 /// @param bEnable \b IN: TRUE/FLASE 860 /// @return DRVAESDMA_OK : Success 861 /// @return Others : Fail 862 //------------------------------------------------------------------------------------------------- 863 MS_U8 MDrv_OTP_ReadStatusReg(MS_U8 u8ByteAddr); 864 //------------------------------------------------------------------------------------------------- 865 /// MOBF Encrypt 866 /// @ingroup G_SERFLASH_ToBeRemove 867 /// @param u32Key \b IN: Key 868 /// @param bEnable \b IN: TRUE/FLASE 869 /// @return DRVAESDMA_OK : Success 870 /// @return Others : Fail 871 //------------------------------------------------------------------------------------------------- 872 void MDrv_OTP_WriteStatusReg(MS_U8 u8ByteAddr, MS_U8 u8ByteReg); 873 //------------------------------------------------------------------------------------------------- 874 /// MOBF Encrypt 875 /// @ingroup G_SERFLASH_ToBeRemove 876 /// @param u32Key \b IN: Key 877 /// @param bEnable \b IN: TRUE/FLASE 878 /// @return DRVAESDMA_OK : Success 879 /// @return Others : Fail 880 //------------------------------------------------------------------------------------------------- 881 MS_PHYADDR MDrv_OTP_Read(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 882 //------------------------------------------------------------------------------------------------- 883 /// MOBF Encrypt 884 /// @ingroup G_SERFLASH_ToBeRemove 885 /// @param u32Key \b IN: Key 886 /// @param bEnable \b IN: TRUE/FLASE 887 /// @return DRVAESDMA_OK : Success 888 /// @return Others : Fail 889 //------------------------------------------------------------------------------------------------- 890 MS_PHYADDR MDrv_OTP_FastRead(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 891 //------------------------------------------------------------------------------------------------- 892 /// MOBF Encrypt 893 /// @ingroup G_SERFLASH_ToBeRemove 894 /// @param u32Key \b IN: Key 895 /// @param bEnable \b IN: TRUE/FLASE 896 /// @return DRVAESDMA_OK : Success 897 /// @return Others : Fail 898 //------------------------------------------------------------------------------------------------- 899 MS_PHYADDR MDrv_OTP_Write(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 900 //------------------------------------------------------------------------------------------------- 901 /// MOBF Encrypt 902 /// @ingroup G_SERFLASH_ToBeRemove 903 /// @param u32Key \b IN: Key 904 /// @param bEnable \b IN: TRUE/FLASE 905 /// @return DRVAESDMA_OK : Success 906 /// @return Others : Fail 907 //------------------------------------------------------------------------------------------------- 908 MS_BOOL MDrv_OTP_WriteTestMode(MS_U32 u32FlashAddr, MS_U8 ByteData); 909 #endif 910 911 // FSP 912 //------------------------------------------------------------------------------------------------- 913 /// MOBF Encrypt 914 /// @ingroup G_SERFLASH_FSP 915 /// @param u32Key \b IN: Key 916 /// @param bEnable \b IN: TRUE/FLASE 917 /// @return DRVAESDMA_OK : Success 918 /// @return Others : Fail 919 //------------------------------------------------------------------------------------------------- 920 MS_BOOL MDrv_FSP_WriteData(MS_U32 u32Addr, MS_U32 u32DataSize, MS_U8 *pu8Data); 921 //------------------------------------------------------------------------------------------------- 922 /// MOBF Encrypt 923 /// @ingroup G_SERFLASH_FSP 924 /// @param u32Key \b IN: Key 925 /// @param bEnable \b IN: TRUE/FLASE 926 /// @return DRVAESDMA_OK : Success 927 /// @return Others : Fail 928 //------------------------------------------------------------------------------------------------- 929 MS_BOOL MDrv_FSP_ReadData(MS_U32 u32Addr, MS_U32 u32DataSize, MS_U8 *pu8Data); 930 //------------------------------------------------------------------------------------------------- 931 /// MOBF Encrypt 932 /// @ingroup G_SERFLASH_FSP 933 /// @param u32Key \b IN: Key 934 /// @param bEnable \b IN: TRUE/FLASE 935 /// @return DRVAESDMA_OK : Success 936 /// @return Others : Fail 937 //------------------------------------------------------------------------------------------------- 938 // MS_BOOL MDrv_FSP_BlockErase(MS_U32 u32StartBlock, MS_U32 u32EndBlock, MS_BOOL bWait); 939 //------------------------------------------------------------------------------------------------- 940 /// MOBF Encrypt 941 /// @ingroup G_SERFLASH_FSP 942 /// @param u32Key \b IN: Key 943 /// @param bEnable \b IN: TRUE/FLASE 944 /// @return DRVAESDMA_OK : Success 945 /// @return Others : Fail 946 //------------------------------------------------------------------------------------------------- 947 // MS_BOOL MDrv_FSP_AddressErase(MS_U32 u32StartAddr, MS_U32 u32EraseSize, MS_BOOL bWait); 948 949 //power state 950 //------------------------------------------------------------------------------------------------- 951 /// MOBF Encrypt 952 /// @ingroup G_SERFLASH_COMMON 953 /// @param u32Key \b IN: Key 954 /// @param bEnable \b IN: TRUE/FLASE 955 /// @return DRVAESDMA_OK : Success 956 /// @return Others : Fail 957 //------------------------------------------------------------------------------------------------- 958 MS_U32 MDrv_SERFLASH_SetPowerState(EN_POWER_MODE u16PowerState); 959 960 extern ms_Mcu_ChipSelect_CB McuChipSelectCB; 961 extern ms_Flash_SetHWWP_CB FlashSetHWWPCB; 962 #ifdef __cplusplus 963 } 964 #endif 965 966 #endif // _DRV_SERFLASH_H_ 967