/**
 * \file   osdrv_ndkdeviceconfig.h
 *
 * \brief 
 *
*/
/*
 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
 */

#ifndef _OSDRV_NDKDEVICECONFIG_H
#define _OSDRV_NDKDEVICECONFIG_H
/* ========================================================================== */
/*                             Include Files                                  */
/* ========================================================================== */
#include <xdc/std.h>
#include <ti/ndk/inc/stkmain.h>
#include "icss_iSwitchDrv.h"
/* ========================================================================== */
/*                           Macros & Typedefs                                */
/* ========================================================================== */

#define MAX_PORT_NUMBER 	2
#define CPSW_NETIF_INIT 	1
#define ICSS_NETIF_INIT		2
#define MAX_TABLE_ENTRIES   3

/**
* @brief Enum for enableIntrPacing
*/
typedef enum {
	enablePacing = 0,		/**< Interrupt pacing enabled*/
	disablePacing			/**< Interrupt pacing disabled*/
} intrPacing;

typedef int (*NIMUInitFn) (STKEVENT_Handle hEvent) ;

#define info_printf(...) DbgPrintf(1, __VA_ARGS__) /* level 1 = DBG_INFO */


/* ========================================================================== */
/*                         Structures and Enums                               */
/* ========================================================================== */

/**
 *  \brief Hardware dependent values. Set from application
 *
 */
typedef struct mac_config {
	Uint32 phyAddr[MAX_PORT_NUMBER];
	/**< Phy Address                                                     */
	Uint32 macModeFlags;
	/**< MAC Control Flags(CPSW)                                         */
	Uint32 numberPorts;
	/**< Number of supported ports(CPSW) IDK - 1 ICE - 2                  */
	Uint32 resvd;
	/**< If values set by User, resvd set to 1		                   	   */
	Uint8 tlk110Flag;
}MAC_CONFIG;
/**
 *  @brief Hardware dependent values. Set from application
 *
 */
typedef struct icss_switch_config {
	Uint8 ethPrioQueue;			/**< Priority Queue used for ethernet packets*/
	Uint32 halfDuplexEnable;
	Uint32 enableIntrPacing;	/**< Enables Interrupt Pacing NOTE: This is only supported by Profinet Firmware.Uses intrPacing enum */
	Uint32 resvd;				/**< If values set by User, resvd set to 1	*/
}ICSS_SWITCH_CONFIG;

/* ========================================================================== */
/*                            Global Variables Declarations                   */
/* ========================================================================== */
/*
 * following two variables are required for correct oinit of NDK
 * they need to be defined in project (see eg. main.c in examples
 */
extern MAC_CONFIG mac_configuration;
extern ICSS_SWITCH_CONFIG switch_configuration;

/* Used to check status of NDK shutdown */
extern int shutdown_complete;

/* This string array corresponds to link state */
static Uint8 *LinkStr[] = { "No Link",
                     	    "None",
                            "10Mb/s Half Duplex",
                            "10Mb/s Full Duplex",
                            "100Mb/s Half Duplex",
                            "100Mb/s Full Duplex"
						  };

/**** informational or debug printfs *****************************************/
void DbgPrintf(unsigned int ErrLevel, char *format, ...);

/*
 * Desc
 * 		 This API adds initialization function to NDK device table,
 * 		  that will be executed by NDK on startup. This needs to be called before BIOS_Start
 * Params
 * 		 CPSW_NETIF_INIT - To initiate CPSW driver
 * 		 ICSS_NETIF_INIT - To initiate ICSS Netif driver
 * Return
 * 		0 - Failure
 * 		1 - Success
 *
 */
int AddNetifEntryFn(NIMUInitFn initFct);

/*
 * Desc
 * 		Returns the shutdown status of NDK, i.e., if shutdown sequence is complete or not
 * Return
 * 		1 - Shutdown Complete
 * 		0 - Shutdown not complete
 */
int ShutdownCompleteCheck();

/**
 *  @b setMacConfiguration
 *  @n
 *  The function is used to setup the hardware Config
 *
 *  @param[in]  config
 *    Configuration of the hardware
 *
 *  @retval
 *     none
 */
void SetMacConfiguration(MAC_CONFIG* config);

/**
 *  @b setIcssSwitchConfiguration
 *  @n
 *  The function is used to setup the ICSS Switch config
 *
 *  @param[in]  config
 *    Configuration of the ICSS Switch
 *
 *  @retval
 *     none
 */
void SetIcssSwitchConfiguration(ICSS_SWITCH_CONFIG* switchConfig);
#endif  //_OSDRV_NDKDEVICECONFIG_H

