/*******************************************************************************
** Document: xmgr_bcm_utils.h
** Copyright (c) 2005 R&D Center, Tailyn Communication Company, Ltd.  
** Created by: Chien Chung Lo
** Date: Mar. 16, 2005
** Description:
** Version: 0.1
*******************************************************************************/
#ifndef _XMGR_BCM_UTILS_H_
#define _XMGR_BCM_UTILS_H_

#include "umap_type.h"
#include "sharememory.h"

#include "bcm_genericOptions.h"
#include "bcm_utils.h"
#include "bcm_devObject.h"
#include "bcm_lineObject.h"
#include "bcm_hmiCoreServices.h"
#include "bcm_hmiLineServices.h"
#include "bcm_errorHandler.h"
#include "bcm_globalObject.h"

#include "bcm_transfer.h"
//#include "bcm_hmiQA.h"
//#include "bcm_message.h"


//----------------------------------------------------------------------
#define CONFIG_OK			1
#define	BCM6411_CHIP_ID		0x0651017f

//----------------------------------------------------------------------
//ERROR CODE
//#define BCM6411_CHIP_ID_FAILE	-1

//----------------------------------------------------------------------
#define CALC_LINE_NO(cardNo, portNo) ((cardNo*24) + (PORTS_MAP[portNo%24]))

//----------------------------------------------------------------------
#define XDSL_PORT_INDEX			1841
#define CARD_NB_LINES			24

//----------------------------------------------------------------------
UMAP_S32 ResetAndInitialCard(UMAP_U32 cardNo);
UMAP_S32 ConfigureProfile(UMAP_U32 cardNo, UMAP_U32 portNo);
void ProcessSetProtocol(UMAP_U32 opMode01, UMAP_U32 opMode02, UMAP_U32* bitMapNonOverlap, UMAP_U32* bitMapOverlap);

void unexpectedLineError(int lineId);
UMAP_S32 InitialLineCard(UMAP_U8 cardNo);
UMAP_S32 ConfigureBcmDSP(DevObject *devPtr);
UMAP_S32 GetBcmDspFirmwareInfo(DevObject *devPtr);
UMAP_S32 initBcmDspDev(DevObject *devPtr);
void showBcmDspSelfTestOutput(SelfTest *selfTest);
void SetBcmStartLine(UMAP_U8 cardNo, UMAP_U8 portNo);
void LT_host_bus_enable(UMAP_U8 cardNo);
void LT_host_bus_disable(UMAP_U8 cardNo);
//void LT_reset(UMAP_U8 cardNo);
void auto_run(UMAP_U8 cardNo);
void LT_link_led(UMAP_U8 cardNo, UMAP_U8 led);
void LT_unit_led(UMAP_U8 cardNo, UMAP_U8 led);
void LT_utopia_enable(UMAP_U8 cardNo);
void LT_utopia_disable(UMAP_U8 cardNo);


//----------------------------------------------------------------------
#endif // _XMGR_BCM_UTILS_H_
