/**
 * @file Hv_Mw_Bcon.c
 * @brief middlware bcon cpp file.
 * @details This file provides the following functions: \n
 *          (1) Initialization and de-initialization functions \n
 *          (2) Start and stop functions \n
 *          (3) Feed functions \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-23
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                        <th>Date         <th>Change Description
 * <tr><td>HiView SoC Software Team      <td>2022-08-23   <td>init
 * </table>
*/

#include"hv_drv_Bcon.h"
#include"hv_drv_HY8603.h"
#include"hv_drv_XP7008.h"

VOID Hv_Mw_Bcon_Init(UCHAR8 ucVendor, UINT32 uiClk)
{
    Hv_Drv_Bcon_Init(ucVendor, uiClk);
    if(3 == ucVendor)
    {
        Hv_Drv_Bcon_HYDataType();
    }
    return;
}

VOID Hv_Mw_Bcon_HY8603_Init()
{
    Hv_Drv_HY8603_1stInit(); 

    return;
}

VOID Hv_Mw_Bcon_HY8603BlDataPrep(UCHAR8 ucPort, USHORT16 *ausBlData, UINT32 uiLen)
{
    Hv_Drv_HY8603_BlDataPrep(ucPort, ausBlData, uiLen);
    //Hv_Drv_Bcon_WriteData(ucPort, (USHORT16*)ausBlData, uiLen);
    //Hv_Drv_Bcon_SetDataLength(ucPort, uiLen);//send uiBconOutLen 16bits
    return;
}

VOID Hv_Mw_Bcon_HY8603BlDataSend()
{
    Hv_Drv_HY8603_BlDataSend();
    //Hv_Drv_Bcon_SwitchSram();
    //Hv_Drv_Bcon_Start(0x1ff);

    return;
}

VOID Hv_Mw_Bcon_HY8603SetLanes(UCHAR8 ucDisLane, USHORT16 usDipLanes)
{
    Hv_Drv_HY8603_SetDisLane(ucDisLane);
    Hv_Drv_HY8603_SetDipLanes(usDipLanes);
    return;
}


VOID Hv_Mw_Bcon_XP7008_Init(UINT32 uiLanes)
{
    Hv_Drv_XC7008_Init(uiLanes); 
    return;
}


USHORT16 Hv_Mw_XP7008_PrepCmd(UCHAR8 ucStart, UCHAR8 ucLen, UCHAR8 *regs, USHORT16* pusOutData)
{
    return Hv_Drv_XP7008_PrepCmd(ucStart, ucLen, regs, pusOutData);
}


USHORT16 Hv_Mw_XP7008_PrepData(UCHAR8 ucStart, UCHAR8 ucLen, USHORT16 *pusPwm, USHORT16 *pusOutData)
{
    return Hv_Drv_XP7008_PrepData(ucStart, ucLen, pusPwm, pusOutData);
}

VOID Hv_Mw_Bcon_XP7008BlDataPrep(UCHAR8 ucPort, USHORT16 *ausBlData, UINT32 uiLen)
{
    //Hv_Drv_HY8603_BlDataPrep(ucPort, ausBlData, uiLen);
    Hv_Drv_Bcon_WriteData(ucPort, (USHORT16*)ausBlData, uiLen);
    Hv_Drv_Bcon_SetDataLength(ucPort, uiLen);//send uiBconOutLen 16bits
    return;
}

VOID Hv_Mw_Bcon_XP7008_SendData()
{
    Hv_Drv_XP7008_SendData();
    return;
}

VOID Hv_Mw_Bcon_ReadData(UCHAR8 ucLane, USHORT16 usLen, USHORT16 *pusBuf)
{
    Hv_Drv_Bcon_ReadData(ucLane, usLen, pusBuf);
    return;
}

