1*53ee8cc1Swenshuai.xi //<MStar Software> 2*53ee8cc1Swenshuai.xi //****************************************************************************** 3*53ee8cc1Swenshuai.xi // MStar Software 4*53ee8cc1Swenshuai.xi // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved. 5*53ee8cc1Swenshuai.xi // All software, firmware and related documentation herein ("MStar Software") are 6*53ee8cc1Swenshuai.xi // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by 7*53ee8cc1Swenshuai.xi // law, including, but not limited to, copyright law and international treaties. 8*53ee8cc1Swenshuai.xi // Any use, modification, reproduction, retransmission, or republication of all 9*53ee8cc1Swenshuai.xi // or part of MStar Software is expressly prohibited, unless prior written 10*53ee8cc1Swenshuai.xi // permission has been granted by MStar. 11*53ee8cc1Swenshuai.xi // 12*53ee8cc1Swenshuai.xi // By accessing, browsing and/or using MStar Software, you acknowledge that you 13*53ee8cc1Swenshuai.xi // have read, understood, and agree, to be bound by below terms ("Terms") and to 14*53ee8cc1Swenshuai.xi // comply with all applicable laws and regulations: 15*53ee8cc1Swenshuai.xi // 16*53ee8cc1Swenshuai.xi // 1. MStar shall retain any and all right, ownership and interest to MStar 17*53ee8cc1Swenshuai.xi // Software and any modification/derivatives thereof. 18*53ee8cc1Swenshuai.xi // No right, ownership, or interest to MStar Software and any 19*53ee8cc1Swenshuai.xi // modification/derivatives thereof is transferred to you under Terms. 20*53ee8cc1Swenshuai.xi // 21*53ee8cc1Swenshuai.xi // 2. You understand that MStar Software might include, incorporate or be 22*53ee8cc1Swenshuai.xi // supplied together with third party`s software and the use of MStar 23*53ee8cc1Swenshuai.xi // Software may require additional licenses from third parties. 24*53ee8cc1Swenshuai.xi // Therefore, you hereby agree it is your sole responsibility to separately 25*53ee8cc1Swenshuai.xi // obtain any and all third party right and license necessary for your use of 26*53ee8cc1Swenshuai.xi // such third party`s software. 27*53ee8cc1Swenshuai.xi // 28*53ee8cc1Swenshuai.xi // 3. MStar Software and any modification/derivatives thereof shall be deemed as 29*53ee8cc1Swenshuai.xi // MStar`s confidential information and you agree to keep MStar`s 30*53ee8cc1Swenshuai.xi // confidential information in strictest confidence and not disclose to any 31*53ee8cc1Swenshuai.xi // third party. 32*53ee8cc1Swenshuai.xi // 33*53ee8cc1Swenshuai.xi // 4. MStar Software is provided on an "AS IS" basis without warranties of any 34*53ee8cc1Swenshuai.xi // kind. Any warranties are hereby expressly disclaimed by MStar, including 35*53ee8cc1Swenshuai.xi // without limitation, any warranties of merchantability, non-infringement of 36*53ee8cc1Swenshuai.xi // intellectual property rights, fitness for a particular purpose, error free 37*53ee8cc1Swenshuai.xi // and in conformity with any international standard. You agree to waive any 38*53ee8cc1Swenshuai.xi // claim against MStar for any loss, damage, cost or expense that you may 39*53ee8cc1Swenshuai.xi // incur related to your use of MStar Software. 40*53ee8cc1Swenshuai.xi // In no event shall MStar be liable for any direct, indirect, incidental or 41*53ee8cc1Swenshuai.xi // consequential damages, including without limitation, lost of profit or 42*53ee8cc1Swenshuai.xi // revenues, lost or damage of data, and unauthorized system use. 43*53ee8cc1Swenshuai.xi // You agree that this Section 4 shall still apply without being affected 44*53ee8cc1Swenshuai.xi // even if MStar Software has been modified by MStar in accordance with your 45*53ee8cc1Swenshuai.xi // request or instruction for your use, except otherwise agreed by both 46*53ee8cc1Swenshuai.xi // parties in writing. 47*53ee8cc1Swenshuai.xi // 48*53ee8cc1Swenshuai.xi // 5. If requested, MStar may from time to time provide technical supports or 49*53ee8cc1Swenshuai.xi // services in relation with MStar Software to you for your use of 50*53ee8cc1Swenshuai.xi // MStar Software in conjunction with your or your customer`s product 51*53ee8cc1Swenshuai.xi // ("Services"). 52*53ee8cc1Swenshuai.xi // You understand and agree that, except otherwise agreed by both parties in 53*53ee8cc1Swenshuai.xi // writing, Services are provided on an "AS IS" basis and the warranty 54*53ee8cc1Swenshuai.xi // disclaimer set forth in Section 4 above shall apply. 55*53ee8cc1Swenshuai.xi // 56*53ee8cc1Swenshuai.xi // 6. Nothing contained herein shall be construed as by implication, estoppels 57*53ee8cc1Swenshuai.xi // or otherwise: 58*53ee8cc1Swenshuai.xi // (a) conferring any license or right to use MStar name, trademark, service 59*53ee8cc1Swenshuai.xi // mark, symbol or any other identification; 60*53ee8cc1Swenshuai.xi // (b) obligating MStar or any of its affiliates to furnish any person, 61*53ee8cc1Swenshuai.xi // including without limitation, you and your customers, any assistance 62*53ee8cc1Swenshuai.xi // of any kind whatsoever, or any information; or 63*53ee8cc1Swenshuai.xi // (c) conferring any license or right under any intellectual property right. 64*53ee8cc1Swenshuai.xi // 65*53ee8cc1Swenshuai.xi // 7. These terms shall be governed by and construed in accordance with the laws 66*53ee8cc1Swenshuai.xi // of Taiwan, R.O.C., excluding its conflict of law rules. 67*53ee8cc1Swenshuai.xi // Any and all dispute arising out hereof or related hereto shall be finally 68*53ee8cc1Swenshuai.xi // settled by arbitration referred to the Chinese Arbitration Association, 69*53ee8cc1Swenshuai.xi // Taipei in accordance with the ROC Arbitration Law and the Arbitration 70*53ee8cc1Swenshuai.xi // Rules of the Association by three (3) arbitrators appointed in accordance 71*53ee8cc1Swenshuai.xi // with the said Rules. 72*53ee8cc1Swenshuai.xi // The place of arbitration shall be in Taipei, Taiwan and the language shall 73*53ee8cc1Swenshuai.xi // be English. 74*53ee8cc1Swenshuai.xi // The arbitration award shall be final and binding to both parties. 75*53ee8cc1Swenshuai.xi // 76*53ee8cc1Swenshuai.xi //****************************************************************************** 77*53ee8cc1Swenshuai.xi //<MStar Software> 78*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 79*53ee8cc1Swenshuai.xi // 80*53ee8cc1Swenshuai.xi // Copyright (c) 2008-2009 MStar Semiconductor, Inc. 81*53ee8cc1Swenshuai.xi // All rights reserved. 82*53ee8cc1Swenshuai.xi // 83*53ee8cc1Swenshuai.xi // Unless otherwise stipulated in writing, any and all information contained 84*53ee8cc1Swenshuai.xi // herein regardless in any format shall remain the sole proprietary of 85*53ee8cc1Swenshuai.xi // MStar Semiconductor Inc. and be kept in strict confidence 86*53ee8cc1Swenshuai.xi // ("MStar Confidential Information") by the recipient. 87*53ee8cc1Swenshuai.xi // Any unauthorized act including without limitation unauthorized disclosure, 88*53ee8cc1Swenshuai.xi // copying, use, reproduction, sale, distribution, modification, disassembling, 89*53ee8cc1Swenshuai.xi // reverse engineering and compiling of the contents of MStar Confidential 90*53ee8cc1Swenshuai.xi // Information is unlawful and strictly prohibited. MStar hereby reserves the 91*53ee8cc1Swenshuai.xi // rights to any and all damages, losses, costs and expenses resulting therefrom. 92*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 93*53ee8cc1Swenshuai.xi 94*53ee8cc1Swenshuai.xi #ifndef _DRVSERFLASH_PRIV_H_ 95*53ee8cc1Swenshuai.xi #define _DRVSERFLASH_PRIV_H_ 96*53ee8cc1Swenshuai.xi 97*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 98*53ee8cc1Swenshuai.xi /// @file drvBDMA.h 99*53ee8cc1Swenshuai.xi /// @author MStar Semiconductor Inc. 100*53ee8cc1Swenshuai.xi /// @brief Byte DMA control driver 101*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 102*53ee8cc1Swenshuai.xi 103*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 104*53ee8cc1Swenshuai.xi // Header Files 105*53ee8cc1Swenshuai.xi //////////////////////////////////////////////////////////////////////////////// 106*53ee8cc1Swenshuai.xi #ifdef __cplusplus 107*53ee8cc1Swenshuai.xi extern "C" 108*53ee8cc1Swenshuai.xi { 109*53ee8cc1Swenshuai.xi #endif 110*53ee8cc1Swenshuai.xi 111*53ee8cc1Swenshuai.xi #include "MsTypes.h" 112*53ee8cc1Swenshuai.xi #include "drvSERFLASH.h" 113*53ee8cc1Swenshuai.xi 114*53ee8cc1Swenshuai.xi 115*53ee8cc1Swenshuai.xi typedef const SERFLASH_Info* (*IOCTL_SERFLASH_GetInfo)(void); 116*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_GetLibVer)(const MSIF_Version**); 117*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_GetStatus)(SERFLASH_DrvStatus*); 118*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_SetDbgLevel)(MS_U8); 119*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_SetWPInfo)(MS_BOOL); 120*53ee8cc1Swenshuai.xi typedef void (*IOCTL_SERFLASH_SetMcuCSCallBack)(ms_Mcu_ChipSelect_CB); 121*53ee8cc1Swenshuai.xi typedef void (*IOCTL_SERFLASH_SetFlashWPCallBack)(ms_Flash_SetHWWP_CB); 122*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_DetectType)(void); 123*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_DetectSize)(MS_U32*); 124*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_Set2XRead)(MS_BOOL); 125*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_SetCKG)(SPI_DrvCKG); 126*53ee8cc1Swenshuai.xi typedef void (*IOCTL_SERFLASH_ClkDiv)(SPI_DrvClkDiv); 127*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_SetMode)(MS_BOOL); 128*53ee8cc1Swenshuai.xi typedef MS_U64 (*IOCTL_SERFLASH_ReadUID)(void); 129*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_ChipSelect)(MS_U8); 130*53ee8cc1Swenshuai.xi typedef void (*IOCTL_SERFLASH_Init)(void); 131*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_ReadID)(MS_U8*, MS_U32); 132*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_Read)(MS_U32, MS_U32, MS_U8*); 133*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_EraseChip)(void); 134*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_AddressToBlock)(MS_U32, MS_U32*); 135*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_BlockToAddress)(MS_U32, MS_U32*); 136*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_AddressErase)(MS_U32, MS_U32, MS_BOOL); 137*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_BlockErase)(MS_U32, MS_U32, MS_BOOL); 138*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_SectorErase)(MS_U32, MS_U32); 139*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_CheckWriteDone)(void); 140*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_Write)(MS_U32, MS_U32, MS_U8*); 141*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_DMA)(MS_U32, MS_U32, MS_U32); 142*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteProtect)(MS_BOOL); 143*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteProtect_Enable_All_Range)(void); 144*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteProtect_Disable_All_Range)(void); 145*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteProtect_Disable_Range_Set)(MS_U32, MS_U32); 146*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteProtect_Area)(MS_BOOL, MS_U8); 147*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_ReadStatusRegister)(MS_U8*); 148*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_ReadStatusRegister2)(MS_U8*); 149*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_WriteStatusRegister)(MS_U16); 150*53ee8cc1Swenshuai.xi typedef MS_BOOL (*IOCTL_SERFLASH_CopyHnd)(MS_PHYADDR, MS_PHYADDR, MS_U32, SPIDMA_Dev, MS_U8); 151*53ee8cc1Swenshuai.xi typedef void (*IOCTL_SERFLASH_SetGPIO)(MS_BOOL); 152*53ee8cc1Swenshuai.xi 153*53ee8cc1Swenshuai.xi 154*53ee8cc1Swenshuai.xi typedef struct _SERFLASH_RESOURCE_PRIVATE 155*53ee8cc1Swenshuai.xi { 156*53ee8cc1Swenshuai.xi MS_U32 Dummy; 157*53ee8cc1Swenshuai.xi }SERFLASH_RESOURCE_PRIVATE; 158*53ee8cc1Swenshuai.xi 159*53ee8cc1Swenshuai.xi typedef struct _SERFLASH_INSTANT_PRIVATE 160*53ee8cc1Swenshuai.xi { 161*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_GetInfo fpSERFLASHGetInfo; 162*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_GetLibVer fpSERFLASHGetLibVer; 163*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_GetStatus fpSERFLASHGetStatus; 164*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetDbgLevel fpSERFLASHSetDbgLevel; 165*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetWPInfo fpSERFLASHSetWPInfo; 166*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetMcuCSCallBack fpSERFLASHSetMcuCSCallBack; 167*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetFlashWPCallBack fpSERFLASHSetFlashWPCallBack; 168*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_DetectType fpSERFLASHDetectType; 169*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_DetectSize fpSERFLASHDetectSize; 170*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_Set2XRead fpSERFLASHSet2XRead; 171*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetCKG fpSERFLASHSetCKG; 172*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ClkDiv fpSERFLASHClkDiv; 173*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetMode fpSERFLASHSetMode; 174*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ReadUID fpSERFLASHReadUID; 175*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ChipSelect fpSERFLASHChipSelect; 176*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_Init fpSERFLASHInit; 177*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ReadID fpSERFLASHReadID; 178*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_Read fpSERFLASHRead; 179*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_EraseChip fpSERFLASHEraseChip; 180*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_AddressToBlock fpSERFLASHAddressToBlock; 181*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_BlockToAddress fpSERFLASHBlockToAddress; 182*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_AddressErase fpSERFLASHAddressErase; 183*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_BlockErase fpSERFLASHBlockErase; 184*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SectorErase fpSERFLASHSectorErase; 185*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_CheckWriteDone fpSERFLASHCheckWriteDone; 186*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_Write fpSERFLASHWrite; 187*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_DMA fpSERFLASHDMA; 188*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteProtect fpSERFLASHWriteProtect; 189*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteProtect_Enable_All_Range fpSERFLASHWriteProtectEnableAllRange; 190*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteProtect_Disable_All_Range fpSERFLASHWriteProtectDisableAllRange; 191*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteProtect_Disable_Range_Set fpSERFLASHWriteProtectDisableRangeSet; 192*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteProtect_Area fpSERFLASHWriteProtectArea; 193*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ReadStatusRegister fpSERFLASHReadStatusRegister; 194*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_ReadStatusRegister2 fpSERFLASHReadStatusRegister2; 195*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_WriteStatusRegister fpSERFLASHWriteStatusRegister; 196*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_CopyHnd fpSERFLASHCopyHnd; 197*53ee8cc1Swenshuai.xi IOCTL_SERFLASH_SetGPIO fpSERFLASHSetGPIO; 198*53ee8cc1Swenshuai.xi }SERFLASH_INSTANT_PRIVATE; 199*53ee8cc1Swenshuai.xi 200*53ee8cc1Swenshuai.xi void FLASHRegisterToUtopia(FUtopiaOpen ModuleType); 201*53ee8cc1Swenshuai.xi MS_U32 FLASHOpen(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute); 202*53ee8cc1Swenshuai.xi MS_U32 FLASHClose(void* pInstance); 203*53ee8cc1Swenshuai.xi MS_U32 FLASHIoctl(void* pInstance, MS_U32 u32Cmd, void* pArgs); 204*53ee8cc1Swenshuai.xi #if (SERFLASH_UTOPIA20) 205*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 206*53ee8cc1Swenshuai.xi /// Description : Set detailed level of Parallel Flash driver debug message 207*53ee8cc1Swenshuai.xi /// @param u8DbgLevel \b IN debug level for Serial Flash driver 208*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 209*53ee8cc1Swenshuai.xi /// @return FALSE : failed to set the debug level 210*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 211*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_SetDbgLevel(MS_U8 u8DbgLevel); 212*53ee8cc1Swenshuai.xi 213*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 214*53ee8cc1Swenshuai.xi /// Description : Set WP pin info to driver 215*53ee8cc1Swenshuai.xi /// @param bWPInfo 216*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 217*53ee8cc1Swenshuai.xi /// @return FALSE : failed to set the WP pin info 218*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 219*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_SetWPInfo(MS_BOOL bWPInfo); 220*53ee8cc1Swenshuai.xi 221*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 222*53ee8cc1Swenshuai.xi /// Description : HK ask 8051 to select flash chip by call back function 223*53ee8cc1Swenshuai.xi /// @param ms_Mcu_ChipSelect_CB \b IN call back function 224*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 225*53ee8cc1Swenshuai.xi /// @return NULL : 226*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------ 227*53ee8cc1Swenshuai.xi void _MDrv_SERFLASH_SetMcuCSCallBack(ms_Mcu_ChipSelect_CB ChipSel_cb); 228*53ee8cc1Swenshuai.xi 229*53ee8cc1Swenshuai.xi void _MDrv_SERFLASH_SetFlashWPCallBack(ms_Flash_SetHWWP_CB FlashWP_cb); 230*53ee8cc1Swenshuai.xi 231*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 232*53ee8cc1Swenshuai.xi /// Description : Detect flash type by reading the MID and DID 233*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 234*53ee8cc1Swenshuai.xi /// @return FALSE : unknown flash type 235*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 236*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 237*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_DetectType(void); 238*53ee8cc1Swenshuai.xi 239*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 240*53ee8cc1Swenshuai.xi /// Description : Detect flash Size 241*53ee8cc1Swenshuai.xi /// @param u32FlashSize \b OUT: u32 ptr to store flash size 242*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 243*53ee8cc1Swenshuai.xi /// @return FALSE : unknown flash size 244*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 245*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 246*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_DetectSize(MS_U32 *u32FlashSize); 247*53ee8cc1Swenshuai.xi 248*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 249*53ee8cc1Swenshuai.xi /// Description : Enable Flash 2XREAD mode, if support 250*53ee8cc1Swenshuai.xi /// @param b2XMode \b IN: ENABLE/DISABLE 251*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 252*53ee8cc1Swenshuai.xi /// @return FALSE : not succeed 253*53ee8cc1Swenshuai.xi /// @note Please ref. sprc. to confirm Flash support or not 254*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 255*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_Set2XRead(MS_BOOL b2XMode); 256*53ee8cc1Swenshuai.xi 257*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 258*53ee8cc1Swenshuai.xi /// Description : Set ckg_spi which flash supports (please ref. the spec. before using this function) 259*53ee8cc1Swenshuai.xi /// @param SPI_DrvCKG \b IN: enumerate the ckg_spi 260*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 261*53ee8cc1Swenshuai.xi /// @return FALSE : not succeed 262*53ee8cc1Swenshuai.xi /// @note Please ref. sprc. to confirm Flash support or not. It is safty to run at 43M (Default). 263*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 264*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_SetCKG(SPI_DrvCKG eCKGspi); 265*53ee8cc1Swenshuai.xi 266*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 267*53ee8cc1Swenshuai.xi /// Description : Set clock div such that spi clock = mcu clock /clock_div. 268*53ee8cc1Swenshuai.xi /// @param SPI_DrvClkDiv \b IN: enumerate the clock_div 269*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 270*53ee8cc1Swenshuai.xi /// @return FALSE : not succeed 271*53ee8cc1Swenshuai.xi /// @note 272*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 273*53ee8cc1Swenshuai.xi void _MDrv_SERFLASH_ClkDiv(SPI_DrvClkDiv eClkDivspi); 274*53ee8cc1Swenshuai.xi 275*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 276*53ee8cc1Swenshuai.xi /// Description : Set XIU/RIU mode (Default : XIU) 277*53ee8cc1Swenshuai.xi /// @param bXiuRiu \b IN: 1 for XIU, 0 for RIU 278*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 279*53ee8cc1Swenshuai.xi /// @return FALSE : not succeed 280*53ee8cc1Swenshuai.xi /// @note XIU mode is faster than RIU mode. It is stable to run by XIU (Default) 281*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 282*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_SetMode(MS_BOOL bXiuRiu); 283*53ee8cc1Swenshuai.xi 284*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 285*53ee8cc1Swenshuai.xi /// Description : Set active flash among multi-spi flashes 286*53ee8cc1Swenshuai.xi /// @param u8FlashIndex \b IN: The Flash index, 0 for external #1 spi flash, 1 for external #2 spi flash 287*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 288*53ee8cc1Swenshuai.xi /// @return FALSE : not succeed 289*53ee8cc1Swenshuai.xi /// @note For Secure booting = 0, please check hw_strapping or e-fuse (the board needs to jump) 290*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 291*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_ChipSelect(MS_U8 u8FlashIndex); 292*53ee8cc1Swenshuai.xi 293*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 294*53ee8cc1Swenshuai.xi /// Description : Erase all sectors in Serial Flash 295*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 296*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 297*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 298*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 299*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 300*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_EraseChip(void); 301*53ee8cc1Swenshuai.xi 302*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 303*53ee8cc1Swenshuai.xi /// Description : Get flash start block index of a flash address 304*53ee8cc1Swenshuai.xi /// @param u32FlashAddr \b IN: flash address 305*53ee8cc1Swenshuai.xi /// @param pu32BlockIndex \b IN: poniter to store the returning block index 306*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 307*53ee8cc1Swenshuai.xi /// @return FALSE : illegal parameters 308*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 309*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 310*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_AddressToBlock(MS_U32 u32FlashAddr, MS_U32 *pu32BlockIndex); 311*53ee8cc1Swenshuai.xi 312*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 313*53ee8cc1Swenshuai.xi /// Description : Get flash start address of a block index 314*53ee8cc1Swenshuai.xi /// @param u32BlockIndex \b IN: block index 315*53ee8cc1Swenshuai.xi /// @param pu32FlashAddr \b IN: pointer to store the returning flash address 316*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 317*53ee8cc1Swenshuai.xi /// @return FALSE : illegal parameters 318*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 319*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 320*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_BlockToAddress(MS_U32 u32BlockIndex, MS_U32 *pu32FlashAddr); 321*53ee8cc1Swenshuai.xi 322*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 323*53ee8cc1Swenshuai.xi /// Description : Get Unique ID 324*53ee8cc1Swenshuai.xi /// @param None 325*53ee8cc1Swenshuai.xi /// @return the SPI Flash's Unique ID 326*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 327*53ee8cc1Swenshuai.xi MS_U64 _MDrv_SERFLASH_ReadUID(void); 328*53ee8cc1Swenshuai.xi 329*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 330*53ee8cc1Swenshuai.xi /// Description : Erase certain sectors given starting address and size in Serial Flash 331*53ee8cc1Swenshuai.xi /// @param u32StartAddr \b IN: start address at block boundry 332*53ee8cc1Swenshuai.xi /// @param u32EraseSize \b IN: size to erase 333*53ee8cc1Swenshuai.xi /// @param bWait \b IN: wait write done or not 334*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 335*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 336*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 337*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 338*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_AddressErase(MS_U32 u32StartAddr, MS_U32 u32EraseSize, MS_BOOL bWait); 339*53ee8cc1Swenshuai.xi 340*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 341*53ee8cc1Swenshuai.xi /// Description : Erase certain sectors in Serial Flash 342*53ee8cc1Swenshuai.xi /// @param u32StartBlock \b IN: start block 343*53ee8cc1Swenshuai.xi /// @param u32EndBlock \b IN: end block 344*53ee8cc1Swenshuai.xi /// @param bWait \b IN: wait write done or not 345*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 346*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 347*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 348*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 349*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_BlockErase(MS_U32 u32StartBlock, MS_U32 u32EndBlock, MS_BOOL bWait); 350*53ee8cc1Swenshuai.xi 351*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 352*53ee8cc1Swenshuai.xi /// Description : Erase certain 4K sectors in Serial Flash 353*53ee8cc1Swenshuai.xi /// @param u32StartBlock \b IN: start address 354*53ee8cc1Swenshuai.xi /// @param u32EndBlock \b IN: end address 355*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 356*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 357*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 358*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 359*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_SectorErase(MS_U32 u32StartAddr, MS_U32 u32EndAddr); 360*53ee8cc1Swenshuai.xi 361*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 362*53ee8cc1Swenshuai.xi /// Description : Check write done in Serial Flash 363*53ee8cc1Swenshuai.xi /// @return TRUE : done 364*53ee8cc1Swenshuai.xi /// @return FALSE : not done 365*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 366*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 367*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_CheckWriteDone(void); 368*53ee8cc1Swenshuai.xi 369*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 370*53ee8cc1Swenshuai.xi /// Description : Write data to Serial Flash 371*53ee8cc1Swenshuai.xi /// @param u32FlashAddr \b IN: start address (4-B aligned) 372*53ee8cc1Swenshuai.xi /// @param u32FlashSize \b IN: size in Bytes (4-B aligned) 373*53ee8cc1Swenshuai.xi /// @param user_buffer \b IN: Virtual Buffer Address ptr to flash write data 374*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 375*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 376*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 377*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 378*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 379*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_Write(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 380*53ee8cc1Swenshuai.xi 381*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 382*53ee8cc1Swenshuai.xi /// Description : Read data from Serial Flash 383*53ee8cc1Swenshuai.xi /// @param u32FlashAddr \b IN: Flash Address 384*53ee8cc1Swenshuai.xi /// @param u32FlashSize \b IN: Flash Size Data in Bytes 385*53ee8cc1Swenshuai.xi /// @param user_buffer \b OUT: Virtual Buffer Address ptr to store flash read data 386*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 387*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 388*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 389*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 390*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 391*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_Read(MS_U32 u32FlashAddr, MS_U32 u32FlashSize, MS_U8 *user_buffer); 392*53ee8cc1Swenshuai.xi 393*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 394*53ee8cc1Swenshuai.xi /// Description : Protect blocks in Serial Flash 395*53ee8cc1Swenshuai.xi /// @param bEnable \b IN: TRUE/FALSE: enable/disable protection 396*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 397*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 398*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 399*53ee8cc1Swenshuai.xi /// @note 400*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 401*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 402*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteProtect(MS_BOOL bEnable); 403*53ee8cc1Swenshuai.xi 404*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 405*53ee8cc1Swenshuai.xi /// Description : Enables all range of flash write protection 406*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 407*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 408*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 409*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 410*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteProtect_Enable_All_Range(void); 411*53ee8cc1Swenshuai.xi 412*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 413*53ee8cc1Swenshuai.xi /// Description : Disables all range of flash write protection 414*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 415*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 416*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 417*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 418*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteProtect_Disable_All_Range(void); 419*53ee8cc1Swenshuai.xi 420*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 421*53ee8cc1Swenshuai.xi /// Description : Set flash disable lower bound and size 422*53ee8cc1Swenshuai.xi /// @param u32DisableLowerBound \b IN: the lower bound to disable write protect 423*53ee8cc1Swenshuai.xi /// @param u32DisableSize \b IN: size to disable write protect 424*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 425*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 426*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 427*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 428*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteProtect_Disable_Range_Set(MS_U32 u32DisableLowerBound, MS_U32 u32DisableSize); 429*53ee8cc1Swenshuai.xi 430*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 431*53ee8cc1Swenshuai.xi /// Description : Protect blocks in Serial Flash 432*53ee8cc1Swenshuai.xi /// @param bEnableAllArea \b IN: enable or disable protection 433*53ee8cc1Swenshuai.xi /// @param u8BlockProtectBits \b IN: block protection bits which stand for the area to enable write protect 434*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 435*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 436*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 437*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 438*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteProtect_Area(MS_BOOL bEnableAllArea, MS_U8 u8BlockProtectBits); 439*53ee8cc1Swenshuai.xi 440*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 441*53ee8cc1Swenshuai.xi /// Description : Read ID from Serial Flash 442*53ee8cc1Swenshuai.xi /// @param pu8FlashID \b OUT: Virtual data ptr to store the read ID 443*53ee8cc1Swenshuai.xi /// @param u32IDSize \b IN: size in Bytes 444*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 445*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 446*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 447*53ee8cc1Swenshuai.xi /// @note 448*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 449*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 450*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_ReadID(MS_U8 *pu8FlashID, MS_U32 u32IDSize); 451*53ee8cc1Swenshuai.xi 452*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 453*53ee8cc1Swenshuai.xi /// Description : Read data from Serial Flash to DRAM in DMA mode 454*53ee8cc1Swenshuai.xi /// @param u32FlashStart \b IN: src start address in flash (0 ~ flash size-1) 455*53ee8cc1Swenshuai.xi /// @param u32DRAMStart \b IN: dst start address in DRAM (16B-aligned) (0 ~ DRAM size-1) 456*53ee8cc1Swenshuai.xi /// @param u32Size \b IN: size in Bytes (8B-aligned) (>=8) 457*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 458*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout or illegal parameters 459*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 460*53ee8cc1Swenshuai.xi /// @note 461*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 462*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 463*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_DMA(MS_U32 u32FlashStart, MS_U32 u32DRAMStart, MS_U32 u32Size); 464*53ee8cc1Swenshuai.xi 465*53ee8cc1Swenshuai.xi //------- ------------------------------------------------------------------------------------------ 466*53ee8cc1Swenshuai.xi /// Description : Read Status Register in Serial Flash 467*53ee8cc1Swenshuai.xi /// @param pu8StatusReg \b OUT: ptr to Status Register value 468*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 469*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 470*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 471*53ee8cc1Swenshuai.xi /// @note 472*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 473*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 474*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_ReadStatusRegister(MS_U8 *pu8StatusReg); 475*53ee8cc1Swenshuai.xi 476*53ee8cc1Swenshuai.xi //------- ------------------------------------------------------------------------------------------ 477*53ee8cc1Swenshuai.xi /// Description : Read Status Register2 in Serial Flash 478*53ee8cc1Swenshuai.xi /// @param pu8StatusReg \b OUT: ptr to Status Register value 479*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 480*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 481*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 482*53ee8cc1Swenshuai.xi /// @note For Specific Flash IC with 16-bit status register (high-byte) 483*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 484*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 485*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_ReadStatusRegister2(MS_U8 *pu8StatusReg); 486*53ee8cc1Swenshuai.xi 487*53ee8cc1Swenshuai.xi //------- ------------------------------------------------------------------------------------------ 488*53ee8cc1Swenshuai.xi /// Description : Write Status Register in Serial Flash 489*53ee8cc1Swenshuai.xi /// @param u16StatusReg \b IN: Status Register value 490*53ee8cc1Swenshuai.xi /// @return TRUE : succeed 491*53ee8cc1Swenshuai.xi /// @return FALSE : fail before timeout 492*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 493*53ee8cc1Swenshuai.xi /// @note For Specific Flash IC with 16-bit status register 494*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 495*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 496*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_WriteStatusRegister(MS_U16 u16StatusReg); 497*53ee8cc1Swenshuai.xi 498*53ee8cc1Swenshuai.xi //------- ------------------------------------------------------------------------------------------ 499*53ee8cc1Swenshuai.xi /// Description : Handle for BDMA copy data from ONLY Flash src to other dst 500*53ee8cc1Swenshuai.xi /// @param u32FlashAddr \b IN: Physical Source address in spi flash 501*53ee8cc1Swenshuai.xi /// @param u32DramAddr \b IN: Physical Dst address 502*53ee8cc1Swenshuai.xi /// @param u32Len \b IN: data length 503*53ee8cc1Swenshuai.xi /// @param eDstDev \b IN: The Dst Device of Flash BDMA 504*53ee8cc1Swenshuai.xi /// @param u8OpCfg \b IN: u8OpCfg: default is SPIDMA_OPCFG_DEF 505*53ee8cc1Swenshuai.xi /// - Bit0: inverse mode --> SPIDMA_OPCFG_INV_COPY 506*53ee8cc1Swenshuai.xi /// - Bit2: Copy & CRC check in wait mode --> SPIDMA_OPCFG_CRC_COPY 507*53ee8cc1Swenshuai.xi /// - Bit3: Copy without waiting --> SPIDMA_OPCFG_NOWAIT_COPY 508*53ee8cc1Swenshuai.xi /// @return \b MS_BOOL 509*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 510*53ee8cc1Swenshuai.xi /// [fw : drvBDMA ] 511*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 512*53ee8cc1Swenshuai.xi MS_BOOL _MDrv_SERFLASH_CopyHnd(MS_PHYADDR u32FlashAddr, 513*53ee8cc1Swenshuai.xi MS_PHYADDR u32DstAddr, 514*53ee8cc1Swenshuai.xi MS_U32 u32Len, 515*53ee8cc1Swenshuai.xi SPIDMA_Dev eDstDev, 516*53ee8cc1Swenshuai.xi MS_U8 u8OpCfg); 517*53ee8cc1Swenshuai.xi 518*53ee8cc1Swenshuai.xi //------- ------------------------------------------------------------------------------------------ 519*53ee8cc1Swenshuai.xi /// Description : Switch SPI as GPIO Input 520*53ee8cc1Swenshuai.xi /// @param bSwitch \b IN: 1 for GPIO, 0 for NORMAL 521*53ee8cc1Swenshuai.xi /// @note Not allowed in interrupt context 522*53ee8cc1Swenshuai.xi /// @note For project's power consumption 523*53ee8cc1Swenshuai.xi /// [NONOS_SUPPORT] 524*53ee8cc1Swenshuai.xi //------------------------------------------------------------------------------------------------- 525*53ee8cc1Swenshuai.xi void _MDrv_SERFLASH_SetGPIO(MS_BOOL bSwitch); 526*53ee8cc1Swenshuai.xi 527*53ee8cc1Swenshuai.xi #endif 528*53ee8cc1Swenshuai.xi 529*53ee8cc1Swenshuai.xi #ifdef __cplusplus 530*53ee8cc1Swenshuai.xi } 531*53ee8cc1Swenshuai.xi #endif 532*53ee8cc1Swenshuai.xi #endif // _DRVBDMA_PRIV_H_ 533