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 /*! \defgroup G_BDMA BDMA interface 95 \ingroup G_PERIPHERAL 96 97 \brief 98 99 BDMA is Byte-aligned data transfer DMA engine. It can execute data transmission between MIU to MIU, 100 flash to MIU, SRAM to MIU?�etc. 101 102 <b>Features</b> 103 104 - Byte-aligned data transfer DMA engine 105 - Address increase or decrease while DMA 106 - Two command channels (optional). Note that when 2 command channels exist, they are processed as FIFO (First trigger, first service) 107 - Several data width for device (1/2/4/8/16 bytes) 108 - Bundled source device: MIU/Flash 109 - Bundled destination device: MIU/VDMCU/DSP/TSP/HK51 1K SRAM 110 111 <b> Address decreasing mode:</b> \n 112 Avoid data overlapped on the same storage. Ex: Copy data A to B. 113 \image html drvBDMA_pic.png 114 115 <b> BDMA Block Diagram: </b> \n 116 \image html drvBDMA_pic2.png 117 118 <b> Operation Code Flow: </b> \n 119 -# Prepare BDMA setting for each operation 120 -# Set and start BDMA in command handle 121 -# Get BDMA free channel 122 -# Set setting 123 -# Trigger BDMA 124 -# BDMA done by polling 125 \image html drvBDMA_pic3.png 126 127 128 \defgroup G_BDMA_INIT Initialization Task relative 129 \ingroup G_BDMA 130 \defgroup G_BDMA_COMMON Common Task relative 131 \ingroup G_BDMA 132 \defgroup G_BDMA_PS Pattern search relative 133 \ingroup G_BDMA 134 \defgroup G_BDMA_MOBF MOBF relative 135 \ingroup G_BDMA 136 \defgroup G_BDMA_ToBeModified BDMA api to be modified 137 \ingroup G_BDMA 138 \defgroup G_BDMA_ToBeRemove BDMA api to be removed 139 \ingroup G_BDMA 140 */ 141 142 #ifndef _DRVBDMA_H_ 143 #define _DRVBDMA_H_ 144 145 //////////////////////////////////////////////////////////////////////////////// 146 /// @file drvBDMA.h 147 /// @author MStar Semiconductor Inc. 148 /// @brief Byte DMA control driver 149 //////////////////////////////////////////////////////////////////////////////// 150 151 //////////////////////////////////////////////////////////////////////////////// 152 // Header Files 153 //////////////////////////////////////////////////////////////////////////////// 154 #ifdef __cplusplus 155 extern "C" 156 { 157 #endif 158 159 #include "MsTypes.h" 160 #include "MsDevice.h" 161 162 #define BDMA_UTOPIA20 (1) 163 164 //////////////////////////////////////////////////////////////////////////////// 165 // Define & data type 166 //////////////////////////////////////////////////////////////////////////////// 167 #define MSIF_BDMA_LIB_CODE {'B','D','M','A'} //Lib code 168 #define MSIF_BDMA_LIBVER {'0','3'} //LIB version 169 #define MSIF_BDMA_BUILDNUM {'0','1'} //Build Number 170 #define MSIF_BDMA_CHANGELIST {'0','0','3','4','8','0','3','3'} //P4 ChangeList Number 171 172 #define BDMA_DRV_VERSION /* Character String for DRV/API version */ \ 173 MSIF_TAG, /* 'MSIF' */ \ 174 MSIF_CLASS, /* '00' */ \ 175 MSIF_CUS, /* 0x0000 */ \ 176 MSIF_MOD, /* 0x0000 */ \ 177 MSIF_CHIP, \ 178 MSIF_CPU, \ 179 MSIF_BDMA_LIB_CODE, /* IP__ */ \ 180 MSIF_BDMA_LIBVER, /* 0.0 ~ Z.Z */ \ 181 MSIF_BDMA_BUILDNUM, /* 00 ~ 99 */ \ 182 MSIF_BDMA_CHANGELIST, /* CL# */ \ 183 MSIF_OS 184 185 //v: value n: shift n bits 186 #define _LShift(v, n) ((v) << (n)) 187 #define _RShift(v, n) ((v) >> (n)) 188 189 #define BDMA_SEARCH_ALL_MATCHED (0) 190 #define BDMA_CRC32_POLY (0x04C11DB7) 191 #define BDMA_CRC16_POLY (0x8005) 192 #define BDMA_CRC_SEED_0 (0) 193 #define BDMA_CRC_SEED_F (0xFFFFFFFF) 194 195 /// Operation cfg 196 #define BDMA_OPCFG_DEF (0) 197 #define BDMA_OPCFG_INV_COPY (0x01) 198 #define BDMA_OPCFG_CRC_REFLECT (0x02) //bit reflection of each input byte 199 #define BDMA_OPCFG_CRC_COPY (0x04) //copy then crc check 200 #define BDMA_OPCFG_NOWAIT_COPY (0x08) //copy then quit 201 #define BDMA_OPCFG_MOBF_PS (0x10) //copy then quit 202 203 typedef enum _BDMA_DbgLv 204 { 205 E_BDMA_DBGLV_NONE //no debug message 206 ,E_BDMA_DBGLV_PERFORMANCE //show performance only 207 ,E_BDMA_DBGLV_ERR_ONLY //show error only 208 ,E_BDMA_DBGLV_REG_DUMP //show error & reg dump 209 ,E_BDMA_DBGLV_INFO //show error & informaiton 210 ,E_BDMA_DBGLV_ALL //show error, information & funciton name 211 }BDMA_DbgLv; 212 213 typedef enum _BDMA_Dev 214 { 215 E_BDMA_DEV_MIU0 216 ,E_BDMA_DEV_MIU1 217 ,E_BDMA_DEV_SEARCH 218 ,E_BDMA_DEV_CRC32 219 ,E_BDMA_DEV_MEM_FILL 220 ,E_BDMA_DEV_FLASH 221 ,E_BDMA_DEV_DMDMCU 222 ,E_BDMA_DEV_VDMCU 223 ,E_BDMA_DEV_DSP 224 ,E_BDMA_DEV_TSP 225 ,E_BDMA_DEV_1KSRAM_HK51 226 ,E_BDMA_DEV_MIU2 227 ,E_BDMA_DEV_MIU3 228 ,E_BDMA_DEV_NOT_SUPPORT 229 }BDMA_Dev; 230 231 typedef enum _BDMA_SrcDev 232 { 233 E_BDMA_SRCDEV_MIU0 = E_BDMA_DEV_MIU0 234 ,E_BDMA_SRCDEV_MIU1 = E_BDMA_DEV_MIU1 235 ,E_BDMA_SRCDEV_MEM_FILL = E_BDMA_DEV_MEM_FILL 236 ,E_BDMA_SRCDEV_FLASH = E_BDMA_DEV_FLASH 237 ,E_BDMA_SRCDEV_MIU2 = E_BDMA_DEV_MIU2 238 ,E_BDMA_SRCDEV_MIU3 = E_BDMA_DEV_MIU3 239 ,E_BDMA_SRCDEV_NOT_SUPPORT = E_BDMA_DEV_NOT_SUPPORT 240 }BDMA_SrcDev; 241 242 typedef enum _BDMA_DstDev 243 { 244 E_BDMA_DSTDEV_MIU0 = E_BDMA_DEV_MIU0 245 ,E_BDMA_DSTDEV_MIU1 = E_BDMA_DEV_MIU1 246 ,E_BDMA_DSTDEV_SEARCH = E_BDMA_DEV_SEARCH 247 ,E_BDMA_DSTDEV_CRC32 = E_BDMA_DEV_CRC32 248 ,E_BDMA_DSTDEV_DMDMCU = E_BDMA_DEV_DMDMCU //Demod 249 ,E_BDMA_DSTDEV_VDMCU = E_BDMA_DEV_VDMCU //VD 250 ,E_BDMA_DSTDEV_DSP = E_BDMA_DEV_DSP 251 ,E_BDMA_DSTDEV_TSP = E_BDMA_DEV_TSP 252 ,E_BDMA_DSTDEV_HK51_1KSRAM = E_BDMA_DEV_1KSRAM_HK51 253 ,E_BDMA_DSTDEV_MIU2 = E_BDMA_DEV_MIU2 254 ,E_BDMA_DSTDEV_MIU3 = E_BDMA_DEV_MIU3 255 ,E_BDMA_DSTDEV_NOT_SUPPORT = E_BDMA_DEV_NOT_SUPPORT 256 }BDMA_DstDev; 257 258 #define BDMA_SET_CPYTYPE(src, dst) ((src & 0x0F) | _LShift((dst &0x0F), 8)) 259 260 typedef enum _BDMA_CpyType 261 { 262 E_BDMA_SDRAM2SDRAM = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_MIU0) 263 ,E_BDMA_SDRAM2SDRAM1 = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_MIU1) 264 ,E_BDMA_SDRAM2SDRAM2 = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_MIU2) 265 ,E_BDMA_SDRAM2SDRAM3 = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_MIU3) 266 ,E_BDMA_SDRAM2DMDMCU = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_DMDMCU) 267 ,E_BDMA_SDRAM2VDMCU = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_VDMCU) 268 ,E_BDMA_SDRAM2DSP = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_DSP) 269 ,E_BDMA_SDRAM2TSP = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_TSP) 270 ,E_BDMA_SDRAM2SRAM1K_HK51 = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU0, E_BDMA_DEV_1KSRAM_HK51) 271 ,E_BDMA_SDRAM12SDRAM = BDMA_SET_CPYTYPE(E_BDMA_DEV_MIU1, E_BDMA_DEV_MIU0) 272 ,E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_DEV_MIU1) 300 ,E_BDMA_FLASH2DMDMCU = BDMA_SET_CPYTYPE(E_BDMA_DEV_FLASH, E_BDMA_DEV_DMDMCU) 301 ,E_BDMA_FLASH2VDMCU = BDMA_SET_CPYTYPE(E_BDMA_DEV_FLASH, E_BDMA_DEV_VDMCU) 302 ,E_BDMA_FLASH2DSP = BDMA_SET_CPYTYPE(E_BDMA_DEV_FLASH, E_BDMA_DEV_DSP) 303 ,E_BDMA_FLASH2TSP = BDMA_SET_CPYTYPE(E_BDMA_DEV_FLASH, E_BDMA_DEV_TSP) 304 ,E_BDMA_FLASH2SRAMHK51 = BDMA_SET_CPYTYPE(E_BDMA_DEV_FLASH, E_BDMA_DEV_1KSRAM_HK51) 305 ,E_BDMA_CPYTYPE_MAX 306 }BDMA_CpyType; 307 308 typedef enum _BDMA_Result 309 { 310 E_BDMA_NOT_SUPPORT = -1 311 ,E_BDMA_FAIL = 0 312 ,E_BDMA_OK = 1 313 ,E_BDMA_TIMEOUT 314 ,E_BDMA_QUEUE_FULL 315 ,E_BDMA_BUSY 316 }BDMA_Result; 317 318 typedef struct _BDMA_HwInfo 319 { 320 MS_BOOL bEnMIU1; //MIU1 321 MS_BOOL bEnHost; //bdma host 322 MS_BOOL bEnMemFill; //memory fill 323 MS_BOOL bEnFlsCpy; //flash copy 324 MS_BOOL bEnDevDw; //bdma device data width 325 MS_BOOL bEnDmyWrCnt; //bdma dummy wr count 326 MS_BOOL bEnDMDMCU; //bdma to DeMod MCU 327 MS_BOOL bEnTSP; //bdma to TSP 328 MS_BOOL bEnDSP; //bdma to DSP 329 MS_BOOL bEnHK51_1KSRAM; //bdma to HK51_1KSRAM 330 }BDMA_HwInfo; 331 332 typedef struct _BDMA_Info 333 { 334 MS_U8 u8ChNum; 335 MS_U16 u16ChipVer; 336 MS_VIRT u32IOMap; 337 MS_PHY phy64MIU1Base; 338 MS_S32 s32Mutex; 339 MS_BOOL bInit; 340 BDMA_DbgLv eDbgLv; 341 BDMA_HwInfo sHwCap; 342 }BDMA_Info; 343 344 typedef struct _BDMA_ChStatus 345 { 346 MS_BOOL bIsBusy; 347 MS_BOOL bIsInt; 348 MS_BOOL bIsFound; 349 }BDMA_ChStatus; 350 351 typedef struct _BDMA_Status 352 { 353 MS_BOOL bInit; 354 BDMA_DbgLv eDbgLv; 355 BDMA_ChStatus sChSta[2]; 356 }BDMA_Status; 357 358 #ifdef MOBF_ENABLE 359 360 typedef struct _BDMA_MOBF_PS 361 { 362 MS_U32 u32Pattern; 363 MS_U32 u32ExcluBit; 364 MS_U32 u32MobfKey; 365 }BDMA_MOBF_PS; 366 367 #endif 368 369 typedef void (*BDMA_ISR_CBF)(BDMA_Result eRet); 370 //////////////////////////////////////////////////////////////////////////////// 371 // Extern Function 372 //////////////////////////////////////////////////////////////////////////////// 373 374 //////////////////////////////////////////////////////////////////////////////// 375 // include utopia v2 header files here 376 //////////////////////////////////////////////////////////////////////////////// 377 #include "drvBDMA_v2.h" 378 379 380 // status check & dbg level 381 //------------------------------------------------------------------------------------------------- 382 /// MOBF Encrypt 383 /// @ingroup G_BDMA_COMMON 384 /// @param u32Key \b IN: Key 385 /// @param bEnable \b IN: TRUE/FLASE 386 /// @return DRVAESDMA_OK : Success 387 /// @return Others : Fail 388 //------------------------------------------------------------------------------------------------- 389 BDMA_Result MDrv_BDMA_GetLibVer(const MSIF_Version **ppVersion); 390 //------------------------------------------------------------------------------------------------- 391 /// MOBF Encrypt 392 /// @ingroup G_BDMA_COMMON 393 /// @param u32Key \b IN: Key 394 /// @param bEnable \b IN: TRUE/FLASE 395 /// @return DRVAESDMA_OK : Success 396 /// @return Others : Fail 397 //------------------------------------------------------------------------------------------------- 398 void MDrv_BDMA_GetStatus(BDMA_Status *pStatus); 399 //------------------------------------------------------------------------------------------------- 400 /// MOBF Encrypt 401 /// @ingroup G_BDMA_COMMON 402 /// @param u32Key \b IN: Key 403 /// @param bEnable \b IN: TRUE/FLASE 404 /// @return DRVAESDMA_OK : Success 405 /// @return Others : Fail 406 //------------------------------------------------------------------------------------------------- 407 const BDMA_Info* MDrv_BDMA_GetInfo(void); 408 //------------------------------------------------------------------------------------------------- 409 /// MOBF Encrypt 410 /// @ingroup G_BDMA_COMMON 411 /// @param u32Key \b IN: Key 412 /// @param bEnable \b IN: TRUE/FLASE 413 /// @return DRVAESDMA_OK : Success 414 /// @return Others : Fail 415 //------------------------------------------------------------------------------------------------- 416 MS_U32 MDrv_BDMA_GetMinSize(void); 417 //------------------------------------------------------------------------------------------------- 418 /// MOBF Encrypt 419 /// @ingroup G_BDMA_COMMON 420 /// @param u32Key \b IN: Key 421 /// @param bEnable \b IN: TRUE/FLASE 422 /// @return DRVAESDMA_OK : Success 423 /// @return Others : Fail 424 //------------------------------------------------------------------------------------------------- 425 BDMA_Result MDrv_BDMA_SetDbgLevel(BDMA_DbgLv eLevel); 426 //------------------------------------------------------------------------------------------------- 427 /// MOBF Encrypt 428 /// @ingroup G_BDMA_INIT 429 /// @param u32Key \b IN: Key 430 /// @param bEnable \b IN: TRUE/FLASE 431 /// @return DRVAESDMA_OK : Success 432 /// @return Others : Fail 433 //------------------------------------------------------------------------------------------------- 434 BDMA_Result MDrv_BDMA_Init(MS_PHY phy64Miu1Base); 435 //------------------------------------------------------------------------------------------------- 436 /// MOBF Encrypt 437 /// @ingroup G_BDMA_INIT 438 /// @param u32Key \b IN: Key 439 /// @param bEnable \b IN: TRUE/FLASE 440 /// @return DRVAESDMA_OK : Success 441 /// @return Others : Fail 442 //------------------------------------------------------------------------------------------------- 443 MS_U32 MDrv_BDMA_Search(MS_PHY phy64Addr, MS_U32 u32Len, MS_U32 u32Pattern, MS_U32 u32ExcluBit, BDMA_SrcDev eDev); 444 #ifdef MOBF_ENABLE 445 //------------------------------------------------------------------------------------------------- 446 /// MOBF Encrypt 447 /// @ingroup G_BDMA_PS 448 /// @param u32Key \b IN: Key 449 /// @param bEnable \b IN: TRUE/FLASE 450 /// @return DRVAESDMA_OK : Success 451 /// @return Others : Fail 452 //------------------------------------------------------------------------------------------------- 453 MS_PHY MDrv_BDMA_MOBFSearch(MS_PHY phy64Addr, MS_U32 u32Len, BDMA_MOBF_PS *pMobfPsCfg, BDMA_SrcDev eDev); 454 #endif 455 //------------------------------------------------------------------------------------------------- 456 /// MOBF Encrypt 457 /// @ingroup G_BDMA_MOBF 458 /// @param u32Key \b IN: Key 459 /// @param bEnable \b IN: TRUE/FLASE 460 /// @return DRVAESDMA_OK : Success 461 /// @return Others : Fail 462 //------------------------------------------------------------------------------------------------- 463 MS_U32 MDrv_BDMA_CRC32(MS_PHY phy64Addr, MS_U32 u32Len, MS_U32 u32Poly, MS_U32 u32Seed, BDMA_SrcDev eDev, MS_BOOL bReflect); 464 //------------------------------------------------------------------------------------------------- 465 /// MOBF Encrypt 466 /// @ingroup G_BDMA_COMMON 467 /// @param u32Key \b IN: Key 468 /// @param bEnable \b IN: TRUE/FLASE 469 /// @return DRVAESDMA_OK : Success 470 /// @return Others : Fail 471 //------------------------------------------------------------------------------------------------- 472 BDMA_Result MDrv_BDMA_PatternFill(MS_PHY u32Addr, MS_U32 u32Len, MS_U32 u32Pattern, BDMA_DstDev eDev); 473 //------------------------------------------------------------------------------------------------- 474 /// MOBF Encrypt 475 /// @ingroup G_BDMA_PS 476 /// @param u32Key \b IN: Key 477 /// @param bEnable \b IN: TRUE/FLASE 478 /// @return DRVAESDMA_OK : Success 479 /// @return Others : Fail 480 //------------------------------------------------------------------------------------------------- 481 BDMA_Result MDrv_BDMA_MemCopy(MS_PHY phy64SrcAddr, MS_PHY phy64DstAddr, MS_U32 u32Len); 482 //------------------------------------------------------------------------------------------------- 483 /// MOBF Encrypt 484 /// @ingroup G_BDMA_COMMON 485 /// @param u32Key \b IN: Key 486 /// @param bEnable \b IN: TRUE/FLASE 487 /// @return DRVAESDMA_OK : Success 488 /// @return Others : Fail 489 //------------------------------------------------------------------------------------------------- 490 BDMA_Result MDrv_BDMA_FlashCopy2Dram(MS_PHY phy64FlashAddr, MS_PHY phy64DramAddr, MS_U32 u32Len); 491 //------------------------------------------------------------------------------------------------- 492 /// MOBF Encrypt 493 /// @ingroup G_BDMA_COMMON 494 /// @param u32Key \b IN: Key 495 /// @param bEnable \b IN: TRUE/FLASE 496 /// @return DRVAESDMA_OK : Success 497 /// @return Others : Fail 498 //------------------------------------------------------------------------------------------------- 499 BDMA_Result MDrv_BDMA_CopyHnd(MS_PHY phy64SrcAddr, MS_PHY phy64DstAddr, MS_U32 u32Len, BDMA_CpyType eCpyType, MS_U8 u8OpCfg); 500 //------------------------------------------------------------------------------------------------- 501 /// MOBF Encrypt 502 /// @ingroup G_BDMA_COMMON 503 /// @param u32Key \b IN: Key 504 /// @param bEnable \b IN: TRUE/FLASE 505 /// @return DRVAESDMA_OK : Success 506 /// @return Others : Fail 507 //------------------------------------------------------------------------------------------------- 508 MS_U32 MDrv_BDMA_SetPowerState(EN_POWER_MODE u16PowerState); 509 //------------------------------------------------------------------------------------------------- 510 /// MOBF Encrypt 511 /// @ingroup G_BDMA_COMMON 512 /// @param u32Key \b IN: Key 513 /// @param bEnable \b IN: TRUE/FLASE 514 /// @return DRVAESDMA_OK : Success 515 /// @return Others : Fail 516 //------------------------------------------------------------------------------------------------- 517 BDMA_Result MDrv_BDMA_WaitFlashDone(void); 518 //------------------------------------------------------------------------------------------------- 519 /// MOBF Encrypt 520 /// @ingroup G_BDMA_ToBeModified 521 /// @param u32Key \b IN: Key 522 /// @param bEnable \b IN: TRUE/FLASE 523 /// @return DRVAESDMA_OK : Success 524 /// @return Others : Fail 525 //------------------------------------------------------------------------------------------------- 526 void MDrv_BDMA_SetSPIOffsetForMCU(void); 527 528 // status 529 //------------------------------------------------------------------------------------------------- 530 /// MOBF Encrypt 531 /// @ingroup G_BDMA_COMMON 532 /// @param u32Key \b IN: Key 533 /// @param bEnable \b IN: TRUE/FLASE 534 /// @return DRVAESDMA_OK : Success 535 /// @return Others : Fail 536 //------------------------------------------------------------------------------------------------- 537 // void MDrv_BDMA_DumpCB(void *pvOpCB); 538 //------------------------------------------------------------------------------------------------- 539 /// MOBF Encrypt 540 /// @ingroup G_BDMA_ToBeModified 541 /// @param u32Key \b IN: Key 542 /// @param bEnable \b IN: TRUE/FLASE 543 /// @return DRVAESDMA_OK : Success 544 /// @return Others : Fail 545 //------------------------------------------------------------------------------------------------- 546 // BDMA_Result MDrv_BDMA_Stop_All(void); 547 //------------------------------------------------------------------------------------------------- 548 /// MOBF Encrypt 549 /// @ingroup G_BDMA_ToBeModified 550 /// @param u32Key \b IN: Key 551 /// @param bEnable \b IN: TRUE/FLASE 552 /// @return DRVAESDMA_OK : Success 553 /// @return Others : Fail 554 //------------------------------------------------------------------------------------------------- 555 // BDMA_Result MDrv_BDMA_Stop(MS_U8 u8Ch); 556 //------------------------------------------------------------------------------------------------- 557 /// MOBF Encrypt 558 /// @ingroup G_BDMA_INIT 559 /// @param u32Key \b IN: Key 560 /// @param bEnable \b IN: TRUE/FLASE 561 /// @return DRVAESDMA_OK : Success 562 /// @return Others : Fail 563 //------------------------------------------------------------------------------------------------- 564 // BDMA_Result MDrv_BDMA_Exit(void); 565 566 567 #ifdef __cplusplus 568 } 569 #endif 570 #endif 571