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 /// @file drvMPIF.h 97 /// @brief MPIF Driver Interface 98 /// @author MStar Semiconductor Inc. 99 /////////////////////////////////////////////////////////////////////////////////////////////////// 100 101 #ifndef _DRV_MPIF_H_ 102 #define _DRV_MPIF_H_ 103 104 #include "MsCommon.h" 105 106 #ifdef __cplusplus 107 extern "C" 108 { 109 #endif 110 111 112 //------------------------------------------------------------------------------------------------- 113 // Driver Capability 114 //------------------------------------------------------------------------------------------------- 115 116 //------------------------------------------------------------------------------------------------- 117 // Macro and Define 118 //------------------------------------------------------------------------------------------------- 119 #define MSIF_MPIF_TAG {'M','S','I','F'} //Version ID header 120 #define MSIF_MPIF_CLASS {'1','0'} //info Class code 121 #define MSIF_MPIF_CUS 0x6666 //Customer ID 122 #define MSIF_MPIF_MOD 0x0000 //Module ID 123 #define MSIF_MPIF_CHIP 0x000F //CHIP ID: T3 124 #define MSIF_MPIF_CPU '1' //CPU 125 #define MSIF_MPIF_LIB_CODE {'M','P','I','F'} //Lib code 126 #define MSIF_MPIF_LIBVER {'0','2'} //LIB version 127 #define MSIF_MPIF_BUILDNUM {'0','3'} //Build Number 128 #define MSIF_MPIF_CHANGELIST {'0','0','5','6','7','4','8','0'} //P4 ChangeList Number 129 #define MSIF_MPIF_OS '0' //OS 130 131 #define MPIF_DRV_VERSION /* Character String for DRV/API version */ \ 132 MSIF_MPIF_TAG, /* 'MSIF' */ \ 133 MSIF_MPIF_CLASS, /* '00' */ \ 134 MSIF_MPIF_CUS, /* 0x0000 */ \ 135 MSIF_MPIF_MOD, /* 0x0000 */ \ 136 MSIF_MPIF_CHIP, \ 137 MSIF_MPIF_CPU, \ 138 MSIF_MPIF_LIB_CODE, /* IP__ */ \ 139 MSIF_MPIF_LIBVER, /* 0.0 ~ Z.Z */ \ 140 MSIF_MPIF_BUILDNUM, /* 00 ~ 99 */ \ 141 MSIF_MPIF_CHANGELIST, /* CL# */ \ 142 MSIF_MPIF_OS 143 144 #define MPIF_TR_CYCLE_0T 0 145 #define MPIF_TR_CYCLE_1T 1 146 #define MPIF_TR_CYCLE_2T 2 147 #define MPIF_TR_CYCLE_3T 3 148 #define MPIF_TR_CYCLE_4T 4 149 #define MPIF_TR_CYCLE_5T 5 150 #define MPIF_TR_CYCLE_6T 6 151 #define MPIF_TR_CYCLE_7T 7 152 #define MPIF_TR_CYCLE_1A2X_SEL MPIF_TR_CYCLE_1T 153 #define MPIF_TR_CYCLE_3X4A_SEL MPIF_TR_CYCLE_1T 154 155 156 #define MPIF_WAIT_CYCLE_0T 0 157 #define MPIF_WAIT_CYCLE_1T 1 158 #define MPIF_WAIT_CYCLE_2T 2 159 #define MPIF_WAIT_CYCLE_3T 3 160 #define MPIF_WAIT_CYCLE_SEL MPIF_WAIT_CYCLE_1T 161 162 #define MPIF_SLAVE_DATAWIDTH_1bit 0 163 #define MPIF_SLAVE_DATAWIDTH_2bit 1 164 #define MPIF_SLAVE_DATAWIDTH_4bit 2 165 #define MPIF_SLAVE_DATAWIDTH_8bit 3 166 #define MPIF_SLAVE_DATAWIDTH_SEL MPIF_SLAVE_DATAWIDTH_1bit 167 168 #define MPIF_CMD_DATAWIDTH_1bit 0 169 #define MPIF_CMD_DATAWIDTH_2bit 1 170 #define MPIF_CMD_DATAWIDTH_4bit 2 171 #define MPIF_CMD_DATAWIDTH_8bit 3 172 #define MPIF_CMD_DATAWIDTH_SEL MPIF_CMD_DATAWIDTH_1bit 173 174 #define MPIF_LC1A_INDEX_0 0x00 175 #define MPIF_LC1A_INDEX_1 0x01 176 #define MPIF_LC1A_INDEX_2 0x02 177 #define MPIF_LC1A_INDEX_3 0x03 178 #define MPIF_LC1A_INDEX_4 0x04 179 #define MPIF_LC1A_INDEX_5 0x05 180 #define MPIF_LC1A_INDEX_6 0x06 181 #define MPIF_LC1A_INDEX_7 0x07 182 183 #define MPIF_2X_DEST_SPIF 0 184 #define MPIF_2X_DEST_XIU 1 185 186 #define MPIF_MAX_RTX_0 0x00 // 0 time 187 #define MPIF_MAX_RTX_1 0x01 // 1 times 188 #define MPIF_MAX_RTX_2 0x02 // 2 times 189 #define MPIF_MAX_RTX_3 0x03 // 3 times 190 #define MPIF_MAX_RTX_SEL MPIF_MAX_RTX_0 191 192 //------------------------------------------------------------------------------------------------- 193 // Type and Structure 194 //------------------------------------------------------------------------------------------------- 195 typedef struct _MPIF_CONFIG 196 { 197 MS_U8 u8trc_1A2X; //MPIF read/write turn around cycle for 1A/2X channel 198 MS_U8 u8trc_3X4A; //MPIF read/write turn around cycle for 3X/4A channel 199 MS_U8 u8wc; //MPIF wait ACK/NAK cycle 200 MS_U8 u8Slave0Dw; //Slave 0 Data Width 201 MS_U8 u8Slave1Dw; //Slave 1 Data Width 202 MS_U8 u8Slave2Dw; //Slave 2 Data Width 203 MS_U8 u8Slave3Dw; //Slave 3 Data Width 204 MS_U8 u8CmdDw; //commend data width 205 }MPIF_CONFIG; 206 207 typedef struct _MPIF_3XCTL 208 { 209 MS_BOOL bChkSum; 210 MS_U8 u8rtx; 211 MS_BOOL bFastMode; 212 MS_U8 u8wcnt; 213 }MPIF_3XCTL; 214 215 typedef struct _MPIF_DrvStatus 216 { 217 MS_BOOL bIsBusy; 218 }MPIF_DrvStatus; 219 220 #ifdef MPIF_SPI_SUPPORT 221 222 typedef struct _MPIF_SPI_CONFIG 223 { 224 MS_U8 u8SerialMode; //[0]: CPHA, [1]:CPOL 225 MS_U8 u8LeadingCyc; 226 MS_U8 u8TrailingCyc; 227 MS_U8 u8CMDLen; 228 MS_BOOL bSrcMIU; 229 MS_U8 u8MIUSel; 230 } MPIF_SPI_CONFIG; 231 232 #endif 233 //------------------------------------------------------------------------------------------------- 234 // Function and Variable 235 //------------------------------------------------------------------------------------------------- 236 237 //------------------------------------------------------------------------------ 238 /// Description: Show the MPIF driver version 239 /// @param ppVersion \b OUT Library version string 240 /// @return TRUE : succeed 241 /// @return FALSE : failed to set the debug level 242 //------------------------------------------------------------------------------ 243 MS_BOOL MDrv_MPIF_GetLibVer(const MSIF_Version **ppVersion); 244 245 //------------------------------------------------------------------------------ 246 /// Description: Get MPIF driver information 247 /// @return MPIF_CONFIG: mpif driver configuration informtion. 248 //------------------------------------------------------------------------------ 249 const MPIF_CONFIG* MDrv_MPIF_GetInfo(void); 250 251 //------------------------------------------------------------------------------ 252 /// Description: Show MPIF driver status 253 /// @param pStatus \b OUT pointer to store status data 254 //------------------------------------------------------------------------------ 255 void MDrv_MPIF_GetStatus(MPIF_DrvStatus *pStatus); 256 257 //------------------------------------------------------------------------------ 258 /// Set detailed level of MPIF driver debug message 259 /// @param u8DbgLevel \b IN debug level for MPIF driver 260 /// @return TRUE : succeed 261 /// @return FALSE : failed to set the debug level 262 //------------------------------------------------------------------------------ 263 MS_BOOL MDrv_MPIF_SetDbgLevel(MS_U8 u8DbgLevel); 264 265 //------------------------------------------------------------------------------------------------- 266 /// MPIF logical channel 1A read/write 267 /// @param bWite \b IN : If writing, set to TRUE; if reading, set to FALSE. 268 /// @param u8slaveid \b IN : Slave ID 269 /// @param u8index \b IN : index of 1A channel 270 /// @param pu8data \b IN/OUT : pointer which stored wrriten/read data 271 /// @return TRUE if successed or return FALSE if failed. 272 //------------------------------------------------------------------------------------------------- 273 void MDrv_MPIF_Init(MPIF_CONFIG* pcfg); 274 275 void MDrv_MPIF_Uninit(void); 276 //------------------------------------------------------------------------------------------------- 277 /// MPIF logical channel 1A read/write 278 /// @param bWrite \b IN : If set to true, do writing; else do reading. 279 /// @param u8slaveid \b IN : Slave ID 280 /// @param u8index \b IN : index of 1A channel 281 /// @param pu8data \b OUT : pointer which stored reading data or writing data 282 /// @return TRUE if successed or return FALSE if failed. 283 //------------------------------------------------------------------------------------------------- 284 MS_BOOL MDrv_MPIF_LC1A_RW(MS_U8 bWrite, MS_U8 u8slaveid, MS_U8 u8index, MS_U8 *pu8data); 285 286 //------------------------------------------------------------------------------------------------- 287 /// MPIF set 2X path to be SPIF or XIU 288 /// @param u8slaveid \b IN : Slave ID 289 /// @param u8path \b IN : 2X path data 290 /// @return TRUE if successed or return FALSE if failed. 291 /// @note Please always call this function before calling LC2X read/write function 292 //------------------------------------------------------------------------------------------------- 293 MS_BOOL MDrv_MPIF_Set_LC2XPath(MS_U8 u8slaveid, MS_U8 u8path); 294 295 //------------------------------------------------------------------------------------------------- 296 /// MPIF logical channel 2A read/write 297 /// @param bWrite \b IN : If set to TRUE, do writing; else do reading. 298 /// @param u8slaveid \b IN : Slave ID 299 /// @param bchecksum \b IN : If set to TRUE, do checksum enabled; else do checksum disabled. 300 /// @param u8rtx \b IN : Re-transmit/receive count limit. 0~3 times. 301 /// @param u16addr \b IN : Reading address 302 /// @param pu16data \b OUT : Pointer to stored reading data. It's a visual address. 303 /// @return TRUE if successed or return FALSE if failed. 304 //------------------------------------------------------------------------------------------------- 305 MS_BOOL MDrv_MPIF_LC2A_RW(MS_U8 bWrite, MS_U8 u8slaveid, MS_BOOL bchecksum, MS_U8 u8rtx, MS_U16 u16addr, MS_U16* pu16data); 306 307 //------------------------------------------------------------------------------------------------- 308 /// MPIF logical channel 2B read/write 309 /// @param bWrite \b IN : If set to TRUE, do writing; else do reading. 310 /// @param u8slaveid \b IN : Slave ID 311 /// @param bchecksum \b IN : If set to TRUE, do checksum enabled; else do checksum disabled. 312 /// @param u8rtx \b IN : Re-transmit/receive count limit. 0~3 times. 313 /// @param u16addr \b IN : Reading address 314 /// @param pu16data \b OUT : Pointer to stored reading data. It's a visual address. 315 /// @return TRUE if successed or return FALSE if failed. 316 //------------------------------------------------------------------------------------------------- 317 MS_BOOL MDrv_MPIF_LC2B_RW(MS_U8 bWrite, MS_U8 u8slaveid, MS_BOOL bchecksum, MS_U8 u8rtx, MS_U16 u16addr, MS_U16* pu16data); 318 319 //------------------------------------------------------------------------------------------------- 320 /// MPIF logical channel 3A RIU mode ead/write 321 /// @param bWrite \b IN : If set to true, do writing; else do reading. 322 /// @param u8slaveid \b IN : Slave ID 323 /// @param u8datalen \b IN : Data length. Unit by 16 bytes. 324 /// @param pu8data \b IN/OUT : pointer to store writing/reading data. It's a visual address. 325 /// @param p3xctl \b IN/OUT : pointer to store 3X control configure data 326 /// @return TRUE if successed or return FALSE if failed. 327 //------------------------------------------------------------------------------------------------- 328 MS_BOOL MDrv_MPIF_LC3A_RIURW(MS_BOOL bWrite, MS_U8 u8slaveid, MS_U8 u8datalen, MS_U8 *pu8data, MPIF_3XCTL *p3xctl); 329 330 //------------------------------------------------------------------------------------------------- 331 /// MPIF logical channel 3B RIU mode read/write 332 /// @param bWrite \b IN : If set to true, do writing; else do reading. 333 /// @param u8slaveid \b IN : Slave ID 334 /// @param u8datalen \b IN : Data length. Unit by 16 bytes. 335 /// @param pu8data \b IN/OUT : pointer to store writing/reading data. It's a visual address. 336 /// @param p3xctl \b IN/OUT : pointer to store 3X control configure data 337 /// @return TRUE if successed or return FALSE if failed. 338 //------------------------------------------------------------------------------------------------- 339 MS_BOOL MDrv_MPIF_LC3B_RIURW(MS_BOOL bWrite, MS_U8 u8slaveid, MS_U8 u8datalen, MS_U8 *pu8data, MPIF_3XCTL *p3xctl); 340 341 //------------------------------------------------------------------------------------------------- 342 /// MPIF logical channel 3A MIU mode read/write 343 /// @param bWrite \b IN : If set to true, do writing; else do reading. 344 /// @param u8slaveid \b IN : Slave ID 345 /// @param u32datalen \b IN : Data length. Unit by 16 bytes. 346 /// @param u32miu_addr \b IN : MPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 347 /// @param u32spif_mdr \b IN : SPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 348 /// @param p3xctl \b IN/OUT : pointer to store 3X control configure data 349 /// @return TRUE if successed or return FALSE if failed. 350 /// @note If using cache buffer, please do buffer flush first. 351 //------------------------------------------------------------------------------------------------- 352 MS_BOOL MDrv_MPIF_LC3A_MIURW(MS_BOOL bWrite, MS_U8 u8slaveid, MS_U32 u32datalen, MS_PHYADDR u32miu_addr, MS_PHYADDR u32spif_mdr, MPIF_3XCTL *p3xcfg); 353 354 //------------------------------------------------------------------------------------------------- 355 /// MPIF logical channel 3B MIU mode read/write 356 /// @param bWrite \b IN : If set to true, do writing; else do reading. 357 /// @param u8slaveid \b IN : Slave ID 358 /// @param u32datalen \b IN : Data length. Unit by 16 bytes. 359 /// @param u32miu_addr \b IN : MPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 360 /// @param u32spif_mdr \b IN : SPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 361 /// @param p3xctl \b IN/OUT : pointer to store 3X control configure data 362 /// @return TRUE if successed or return FALSE if failed. 363 /// @note If using cache buffer, please do buffer flush first. 364 //------------------------------------------------------------------------------------------------- 365 MS_BOOL MDrv_MPIF_LC3B_MIURW(MS_BOOL bWrite, MS_U8 u8slaveid, MS_U32 u32datalen, MS_PHYADDR u32miu_addr, MS_PHYADDR u32spif_mdr, MPIF_3XCTL *p3xcfg); 366 367 //------------------------------------------------------------------------------------------------- 368 /// MPIF logical channel 3B MIU mode read/write 369 /// @param bWrite \b IN : If set to true, do writing; else do reading. 370 /// @param u8slaveid \b IN : Slave ID 371 /// @param u16datalen \b IN : Data length. Unit by 16 bytes. 372 /// @param u32miu_addr \b IN : MPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 373 /// @param u32spif_mdr \b IN : SPIF MIU Start address. Unit is byte. Must be 8bytes aligmant. 374 /// @return TRUE if successed or return FALSE if failed. 375 //------------------------------------------------------------------------------------------------- 376 MS_BOOL MDrv_MPIF_LC4A_MIURW(MS_BOOL bWrite, MS_U8 u8slaveid, MS_U16 u16datalen, MS_PHYADDR u32miu_addr, MS_PHYADDR u32spif_mdr); 377 378 //------------------------------------------------------------------------------------------------- 379 /// MPIF printf SPIF's configure information 380 /// @param u8slaveid \b IN : Slave ID 381 /// @return TRUE if successed or return FALSE if failed. 382 //------------------------------------------------------------------------------------------------- 383 MS_BOOL MDrv_MPIF_Print_SPIFCfgInfo(MS_U8 u8slaveid); 384 385 //------------------------------------------------------------------------------------------------- 386 /// MPIF Set commend and slave data-width 387 /// @param u8slaveid \b IN : Slave ID 388 /// @param u8cmdwidth \b IN : Commend data width 389 /// @param u8datawidth \b IN : Slave data width 390 /// @return TRUE if successed or return FALSE if failed. 391 //------------------------------------------------------------------------------------------------- 392 MS_BOOL MDrv_MPIF_SetCmdDataMode(MS_U8 u8slaveid, MS_U8 u8cmdwidth, MS_U8 u8datawidth); 393 394 //------------------------------------------------------------------------------------------------- 395 /// MPIF Set Clock 396 /// @param u8slaveid \b IN : Slave ID 397 /// @param u8clk \b IN : Select MPIF clock 398 /// @param u8slaveClkInvDlyNum \b IN : Slave Delay buffer number. (0~15) 399 /// @return TRUE if successed or return FALSE if failed. 400 //------------------------------------------------------------------------------------------------- 401 MS_BOOL MDrv_MPIF_Set_Clock(MS_U8 u8slaveid, MS_U8 u8clk, MS_U8 u8slaveClkInvDlyNum); 402 403 //------------------------------------------------------------------------------------------------- 404 /// MPIF Clock Disable or Enable 405 /// @param bDisabled \b IN : If true, enable MPIF clock; if false, disable MPIF clock 406 /// @return TRUE if successed or return FALSE if failed. 407 //------------------------------------------------------------------------------------------------- 408 MS_BOOL MDrv_MPIF_Clock_Disable(MS_BOOL bDisabled); 409 410 //------------------------------------------------------------------------------------------------- 411 /// MPIF Set Slave Clock Invers delay 412 /// @param u8slaveid \b IN : Slave ID 413 /// @param u8DlyBufNum \b IN : Delay buffer number. (0~15) 414 /// @return TRUE if successed or return FALSE if failed. 415 //------------------------------------------------------------------------------------------------- 416 MS_BOOL MDrv_MPIF_SetSlave_ClkInv_Delay(MS_U8 u8slaveid, MS_U8 u8DlyBufNum); 417 418 //------------------------------------------------------------------------------------------------- 419 /// MPIF Set Slave turn around cycle and wait ack cycle 420 /// @param u8slaveid \b IN : Slave ID 421 /// @param u8trc \b IN : Turn around cycle. (0T~3T) 422 /// @param u8wt \b IN : Wait ACK cycle. (0T~3T) 423 /// @return TRUE if successed or return FALSE if failed. 424 //------------------------------------------------------------------------------------------------- 425 MS_BOOL MDrv_MPIF_SetSlave_Trc_Wt(MS_U8 u8slaveid, MS_U8 u8trc, MS_U8 u8wt); 426 427 //------------------------------------------------------------------------------------------------- 428 /// MPIF Set Slave Clock delay 429 /// @param u8slaveid \b IN : Slave ID 430 /// @param u8DlyBufNum \b IN : Delay buffer number. (0~15) 431 /// @return TRUE if successed or return FALSE if failed. 432 //------------------------------------------------------------------------------------------------- 433 MS_BOOL MDrv_MPIF_SetSlave_Clk_Delay(MS_U8 u8slaveid, MS_U8 u8DlyBufNum); 434 435 #ifdef MPIF_SPI_SUPPORT 436 //------------------------------------------------------------------------------------------------- 437 /// Configure MPIF SPI mode 438 /// @param u8slaveid \b IN : Slave ID 439 /// @param pcfg \b IN pointer stored configure data 440 /// @return TRUE if successed or return FALSE if failed. 441 //------------------------------------------------------------------------------------------------- 442 // struct MPIF_SPI_CONFIG must sync to HAL struct HAL_MPIF_SPI_CONFIG 443 MS_BOOL MDrv_MPIF_SPI_Configure(MS_U8 u8slaveid, MPIF_SPI_CONFIG* pcfg); 444 445 //------------------------------------------------------------------------------------------------- 446 /// Use SPI RIU mode to read flash ID 447 /// @param bWrite \b IN : If TRUE, it is write data mode, otherwise is read data mode 448 /// @param pu32cmd \b IN : pointer stored commend 449 /// @param u8cmdlen \b IN : commend length to write 450 /// @param pudata \b IN/OUT : pointer to store write/read data 451 /// @param u16datalen \b IN : data length to write/read 452 /// @return TRUE if successed or return FALSE if failed. 453 //------------------------------------------------------------------------------------------------- 454 MS_BOOL MDrv_MPIF_SPI_RIU_RWData(MS_BOOL bWrite, MS_U32 *pu32cmd, MS_U8 u8cmdlen, MS_U8 *pudata, MS_U16 u16datalen); 455 456 457 //------------------------------------------------------------------------------------------------- 458 /// Use SPI RIU mode to read flash ID 459 /// @param bWrite \b IN : If TRUE, it is write data mode, otherwise is read data mode 460 /// @param pu32cmd \b IN : pointer stored commend 461 /// @param u8cmdlen \b IN : commend length to write 462 /// @param u32MiuAddr \b IN : MIU write/read base address 463 /// @param u16datalen \b IN : data length to write/read 464 /// @return TRUE if successed or return FALSE if failed. 465 //------------------------------------------------------------------------------------------------- 466 MS_BOOL MDrv_MPIF_SPI_MIU_RWData(MS_BOOL bWrite, MS_U32 *pu32cmd, MS_U8 u8cmdlen, MS_PHYADDR u32MiuAddr, MS_U16 u16datalen); 467 468 469 #endif //MPIF_SPI_SUPPORT 470 471 #ifdef __cplusplus 472 } 473 #endif 474 475 #endif // _DRV_MPIF_H_ 476