Tool/software: TI C/C++ Compiler
Hello!
I have a simple NDk project. And i need to change the version of netcontrol lib to netctrl_min.
How can I change the variant of netcontrol lib in my project?
NDK2.24.01.18
Thanks.
Andriy
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hello!
I have a simple NDk project. And i need to change the version of netcontrol lib to netctrl_min.
How can I change the variant of netcontrol lib in my project?
NDK2.24.01.18
Thanks.
Andriy
Hello
As you adviced, I changed Global.enableCodeGeneration = true;
Build finished without errors. But when I try to debug project on c6670 I see the following run-time errors on CCS console.
Thanks.
Andriy
Hello Todd!
Ok
I send you my .cfg file.
Also I sand you my .c file . Maybe it can help
/*
* helloWorld_bios6.c
*
* TCP/IP Stack 'Hello World!' Example ported to use BIOS6 OS.
*
* Copyright (C) 2007, 2011 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------
// IP Stack 'Hello World!' Example
//
// This is a skeleton application, intended to provide application
// programmers with a basic Stack setup, to which they can start
// adding their code.
//
// To test it as is, use with helloWorld.exe from \winapps directory
//
#include <stdio.h>
#include <ti/ndk/inc/netmain.h>
/* BIOS6 include */
#include <ti/sysbios/BIOS.h>
/* Platform utilities include */
#include "ti/platform/platform.h"
#include "ti/platform/resource_mgr.h"
#include <xdc/runtime/Error.h>
#include <ti/sysbios/knl/Task.h>
//// sss ////
#include <HeapMem.h>
#include <Memory.h>
#include "DDR3_INI.h"
//#include <C:\ti\bios_6_33_06_50\packages\ti\bios\include\sem.h>
#include <ti/sysbios/knl/Semaphore.h>
////////////////////////
/////////////////////////
////////////////////////
//#include "types.h"
//#include "csl_types.h"
//
//#include "platform.h"
//
//#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//
#include "csl_chip.h"
#include "csl_chipAux.h"
#include "csl_semAux.h"
#include "cslr_device.h"
#include "cslr_psc.h"
#include "csl_psc.h"
//#include "csl_emif4f.h"
//#include "csl_emif4fAux.h"
//
//#include "evmc66x_fpga.h"
//#include "evmc66x_i2c.h"
//#include "cslr_i2c.h"
//
#include "csl_cpsw.h"
#include "csl_cpsgmii.h"
#include "csl_cpsgmiiAux.h"
#include "csl_mdio.h"
#include "csl_mdioAux.h"
//
//#include "evmc66x_uart.h"
//#include "cslr_uart.h"
//
//#include "evmc66x_gpio.h"
//#include "csl_gpioAux.h"
//
//#include "evmc66x_i2c_eeprom.h"
//
//#include "evmc66x_nand.h"
#include "csl_pscAux.h"
#include "csl_bootcfg.h"
#include "csl_bootcfgAux.h"
//
//#include "evmc66x_nor.h"
//#include "evmc66x_spi.h"
//#include "cslr_spi.h"
//
//#include "csl_pllcAux.h"
//#include "csl_xmcAux.h"
//#include "evmc66x_pllc.h"
////////////////////////////
/////////////////////////////////
/* Platform Information - we will read it form the Platform Library */
platform_info gPlatformInfo;
void Init_SGMII_S (uint32_t macPortNum);
//---------------------------------------------------------------------------
// Title String
//
char *VerStr = "\nTCP/IP Stack 'Hello World!' Application\n\n";
// Our NETCTRL callback functions
static void NetworkOpen();
static void NetworkClose();
static void NetworkIPAddr( IPN IPAddr, uint IfIdx, uint fAdd );
// Fun reporting function
static void ServiceReport( uint Item, uint Status, uint Report, HANDLE hCfgEntry );
// External references
extern int dtask_udp_hello();
//// sss ///
extern void DDR_CNTRL();
extern void PLL_CNTRL(void);
extern void SLEEP_CNTRL(void);
extern Semaphore_Handle semaNDK;
//
// System Task Code [ Server Daemon Servers ]
//
static HANDLE hHello=0;
//---------------------------------------------------------------------------
// Configuration
//
char *HostName = "tidsp";
char *LocalIPAddr = "192.168.30.78";
char *LocalIPMask = "255.255.255.0"; // Not used when using DHCP
char *GatewayIP = "192.168.30.101"; // Not used when using DHCP
char *DomainName = "demo.net"; // Not used when using DHCP
char *DNSServer = "0.0.0.0"; // Used when set to anything but zero
// Simulator EMAC Switch does not handle ALE_LEARN mode, so please configure the
// MAC address of the PC where you want to launch the webpages and initiate PING to NDK */
Uint8 clientMACAddress [6] = {0x5C, 0x26, 0x0A, 0x69, 0x44, 0x0B}; /* MAC address for my PC */
/*************************************************************************
* @b EVM_init()
*
* @n
*
* Initializes the platform hardware. This routine is configured to start in
* the evm.cfg configuration file. It is the first routine that BIOS
* calls and is executed before Main is called. If you are debugging within
* CCS the default option in your target configuration file may be to execute
* all code up until Main as the image loads. To debug this you should disable
* that option.
*
* @param[in] None
*
* @retval
* None
************************************************************************/
extern void configSerdes(); /// sss ////
extern void Init_SGMII (uint32_t macPortNum); /// sss ///
extern int dtask_udp_hello( SOCKET s, UINT32 unused );
//// sss ////
Task_Params taskParams;
Task_Handle ETH_Task_hndl;
Error_Block eb;
extern void ConCmdEcho( int ntok, char *tok1, char *tok2 );
int SOCK_OK=0;
void EVM_init()
{
platform_init_flags sFlags;
platform_init_config sConfig;
/* Status of the call to initialize the platform */
int32_t pform_status;
/////// sss ////
//return;
/*
* You can choose what to initialize on the platform by setting the following
* flags. Things like the DDR, PLL, etc should have been set by the boot loader.
*/
memset( (void *) &sFlags, 0, sizeof(platform_init_flags));
memset( (void *) &sConfig, 0, sizeof(platform_init_config));
sFlags.pll = 0; /* PLLs for clocking */
sFlags.ddr = 0; /* External memory */
sFlags.tcsl = 1; /* Time stamp counter */
#ifdef _SCBP6618X_
sFlags.phy = 0; /* Ethernet */
#else
sFlags.phy = 1; /* Ethernet */
#endif
sFlags.ecc = 0; /* Memory ECC */
sConfig.pllm = 0; /* Use libraries default clock divisor */
pform_status = platform_init(&sFlags, &sConfig);
/// sss C:\ti\pdk_C6670_1_1_2_6\packages\ti\platform\evmc6670l\platform_lib\src\platform.c ///
/* If we initialized the platform okay */
if (pform_status != Platform_EOK) {
/* Initialization of the platform failed... die */
//// sss ////
while (1) {
(void) platform_led(1, PLATFORM_LED_ON, PLATFORM_USER_LED_CLASS);
(void) platform_delay(50000);
(void) platform_led(1, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
(void) platform_delay(50000);
}
//// sss ////
}
}
int timer_n=0;
void Timer0_Func(void)
{
static int ii=0;
ii++; timer_n++;
//if(ii>5)``
{
ii = 0;
//Semaphore_post(semaNDK);
}
// Semaphore_post(semaNDK);
}
int task1_n=0;
void Task1Func(void)
{
static int ii=0;
while(1)
{
task1_n++;
do{ ii++;
}
while(ii<200);
// if(ii>1000)
ii = 0;
// if (SOCK_OK==1)
// dtask_udp_hello(hHello, 0);
Semaphore_pend(semaNDK, BIOS_WAIT_FOREVER);
}
}
//---------------------------------------------------------------------
// Main Entry Point
//---------------------------------------------------------------------
int main()
{
//// sss ////
//EVM_init();
PLL_CNTRL();
SLEEP_CNTRL();
//////// sss!!! /////////////
///////////////// CSL_BootCfgUnlockKicker();
//DDR_CNTRL();
//// sss /// EVM_init();
//// RESET ETHER////
//GPIO_DIR GPIO_BASE_ADDR = 0x02320000u
*(unsigned int*)(0x02320000u + 0x00000010u) = 0x00001030;
///GPIO_CLR_DATA
*(unsigned int*)(0x02320000u + 0x0000001cu) = 0x1;
configSerdes();
/// sss C:\ti\pdk_C6670_1_1_2_6\packages\ti\platform\evmc6670l\platform_lib\src\evmc6670_phy.c
#define ETH_CHANEL 1 /// 1 - EVM 0 - BCOSU
/// Init_SGMII_S(0); ////BCOSU
///sss!!!
///
Init_SGMII_S(ETH_CHANEL);///EVM
///// CACHE ///
KICK0 = KICK0_UNLOCK;////// CACHE ON /////
KICK1 = KICK1_UNLOCK;
*(volatile unsigned int*)(0x01840000u) &=~7; /// L2CFG CACHE_OFF
*(volatile unsigned int*)(0x01840000u) |=1; /// L2CFG CACHE_ON
*(volatile unsigned int*)(0x01840020u) &=~7; /// L1PCFG CACHE_OFF
*(volatile unsigned int*)(0x01840020u) |=4 ; /// L1PCFG CACHE_ON
*(volatile unsigned int*)(0x01840040u) &=~7; /// L1DCFG CACHE_OFF
*(volatile unsigned int*)(0x01840040u) |=7; /// L1DCFG CACHE_ON
*(volatile unsigned int*)(0x01848200u) &= ~9;//|=9; /// MAR128
*(volatile unsigned int*)(0x01848204u) &= ~9;/// MAR129 16M - 2block DDR
KICK0 = KICK0_LOCK; //lock kicker registers
KICK1 = KICK1_LOCK;
// //// sss //////////////
// Error_init(&eb);
// /* Create a Task with priority xx */
// Task_Params_init(&taskParams);
// taskParams.stackSize = 1024;
// taskParams.priority = 3;
// ETH_Task_hndl = Task_create((Task_FuncPtr)Task1Func , &taskParams, &eb);
// //ConCmdEcho
// if (ETH_Task_hndl == NULL) {
// //System_abort
// printf("Task create failed");
// }
// HeapMem_Params prms;
// static char *buf[1024];
// HeapMem_Handle heap;
// HeapMem_Params_init(&prms);
// prms.size = 0x30000;//1024;
// prms.buf = (Ptr)buf;
// heap = HeapMem_create(&prms, NULL);
//
// char* buf1;
// /* Alloc and free using systemHeap */
// buf1 = Memory_alloc(NULL, 128, 0, NULL);
// Memory_free(NULL, buf1, 128);
/* Start the BIOS 6 Scheduler */
BIOS_start ();
}
//
// Main Thread
//
int StackTest()
{
int rc;
int i;
HANDLE hCfg;
QMSS_CFG_T qmss_cfg;
CPPI_CFG_T cppi_cfg;
// Error_init(&eb); //////////// sss /////////////
// /* Create a Task with priority 5 */
// Task_Params_init(&taskParams);
// taskParams.stackSize = 4096;
// taskParams.priority = 7;
// ETH_Task_hndl = Task_create((Task_FuncPtr)ConCmdEcho, &taskParams, &eb);
// if (ETH_Task_hndl == NULL) {
// //System_abort
// printf("Task create failed");
// }
/// while(1);
/* Get information about the platform so we can use it in various places */
memset( (void *) &gPlatformInfo, 0, sizeof(platform_info));
(void) platform_get_info(&gPlatformInfo);
/* */ //// sss ////// FOR PRINTING MASSAGES
(void) platform_uart_init();
(void) platform_uart_set_baudrate(115200);
(void) platform_write_configure(PLATFORM_WRITE_ALL);
/* //// sss ////// */
/* Clear the state of the User LEDs to OFF */
/* //// sss ////// */
// for (i=0; i < gPlatformInfo.led[PLATFORM_USER_LED_CLASS].count; i++) {
// (void) platform_led(i, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
// }
/**/ //// sss //////
/* Initialize the components required to run this application:
* (1) QMSS
* (2) CPPI
* (3) Packet Accelerator
*/
/* Initialize QMSS */
// if (platform_get_coreid() == 0) //// sss //////
// {
qmss_cfg.master_core = 1; ///// sss This Way!
// }
// else
// {
// qmss_cfg.master_core = 0;
// } //// sss //////
qmss_cfg.max_num_desc = MAX_NUM_DESC;
qmss_cfg.desc_size = MAX_DESC_SIZE;
qmss_cfg.mem_region = Qmss_MemRegion_MEMORY_REGION0;
if (res_mgr_init_qmss (&qmss_cfg) != 0)
{
//// sss ////// platform_write
printf("Failed to initialize the QMSS subsystem \n");
goto main_exit;
}
else
{
//// sss //////platform_write
printf("QMSS successfully initialized \n");
}
/* Initialize CPPI */
// if (platform_get_coreid() == 0)//// sss //////
// {
cppi_cfg.master_core = 1; ///// sss This Way!
// }
// else
// {
// cppi_cfg.master_core = 0;
// } //// sss //////
cppi_cfg.dma_num = Cppi_CpDma_PASS_CPDMA;
cppi_cfg.num_tx_queues = NUM_PA_TX_QUEUES;
cppi_cfg.num_rx_channels = NUM_PA_RX_CHANNELS;
if (res_mgr_init_cppi (&cppi_cfg) != 0)
{
//// sss //////platform_write
printf("Failed to initialize CPPI subsystem \n");
goto main_exit;
}
else
{
////// sss //////platform_write
printf("CPPI successfully initialized \n");
}
if (res_mgr_init_pass()!= 0) {
//// sss ////// platform_write
printf("Failed to initialize the Packet Accelerator \n");
goto main_exit;
}
else
{
//// sss //////platform_write
printf("PA successfully initialized \n");
}
//
// THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION before
// using the stack!!
//
rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
if( rc )
{
//// sss //////platform_write
printf("NC_SystemOpen Failed (%d)\n",rc);
for(;;);
}
// Print out our banner
//// sss //////platform_write
printf(VerStr);
//
// Create and build the system configuration from scratch.
//
// Create a new configuration
hCfg = CfgNew();
if( !hCfg )
{
//// sss //////platform_write
printf("Unable to create configuration\n");
goto main_exit;
}
/////////////////////////////////////////////////////
// //
// // THIS MUST BE THE ABSOLUTE FIRST THING DONE IN AN APPLICATION!!
// //
// rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );
// if( rc )
// {
// printf("NC_SystemOpen Failed (%d)\n",rc);
// for(;;);
// }
//
// // Print out our banner
// printf(VerStr);
//
// //
// // Create and build the system configuration from scratch.
// //
//
// // Create a new configuration
// hCfg = CfgNew();
// if( !hCfg )
// {
// printf("Unable to create configuration\n");
// goto main_exit;
// }
//
////////////////////////////////////////////////////////
// We better validate the length of the supplied names
if( strlen( DomainName ) >= CFG_DOMAIN_MAX ||
strlen( HostName ) >= CFG_HOSTNAME_MAX )
{
printf("Names too long\n");
goto main_exit;
}
// Add our global hostname to hCfg (to be claimed in all connected domains)
CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0,
strlen(HostName), (UINT8 *)HostName, 0 );
//// sss ////
#define MINE_ MINE__
// If the IP address is specified, manually configure IP and Gateway
#if defined( MINE_) || defined( _SCBP6618X_) || defined(_EVMTCI6614_) || defined(DEVICE_K2H) || defined(DEVICE_K2K)
/* SCBP6618x, EVMTCI6614, EVMK2H, EVMK2K always uses DHCP */
if (1) ////// sss ///// 0)
#else
if (!platform_get_switch_state(1))
#endif
{
CI_IPNET NA;
CI_ROUTE RT;
IPN IPTmp;
// Setup manual IP address
bzero( &NA, sizeof(NA) );
NA.IPAddr = inet_addr(LocalIPAddr);
NA.IPMask = inet_addr(LocalIPMask);
strcpy( NA.Domain, DomainName );
NA.NetType = 0;
// Add the address to interface 1
CfgAddEntry( hCfg, CFGTAG_IPNET,
1,
0,
sizeof(CI_IPNET), (UINT8 *)&NA, 0 );
// Add the default gateway. Since it is the default, the
// destination address and mask are both zero (we go ahead
// and show the assignment for clarity).
bzero( &RT, sizeof(RT) );
RT.IPDestAddr = 0;
RT.IPDestMask = 0;
RT.IPGateAddr = inet_addr(GatewayIP);
// Add the route
CfgAddEntry( hCfg, CFGTAG_ROUTE, 0, 0,
sizeof(CI_ROUTE), (UINT8 *)&RT, 0 );
// // Manually add the DNS server when specified ///// !!!!!!
// IPTmp = inet_addr(DNSServer);
// if( IPTmp )
// CfgAddEntry( hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
// 0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );
}
// // Else we specify DHCP
// else
// {
// CI_SERVICE_DHCPC dhcpc;
//
// // Specify DHCP Service on IF-1
// bzero( &dhcpc, sizeof(dhcpc) );
// dhcpc.cisargs.Mode = CIS_FLG_IFIDXVALID;
// dhcpc.cisargs.IfIdx = 1;
// dhcpc.cisargs.pCbSrv = &ServiceReport;
// CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_DHCPCLIENT, 0,
// sizeof(dhcpc), (UINT8 *)&dhcpc, 0 );
// }
//
//
// Configure IPStack/OS Options
//
// We don't want to see debug messages less than WARNINGS
rc = DBG_ERROR;///DBG_INFO; //// sss //// DBG_WARN;
CfgAddEntry( hCfg, CFGTAG_OS, CFGITEM_OS_DBGPRINTLEVEL,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, 0 );
//
// This code sets up the TCP and UDP buffer sizes
// (Note 8192 is actually the default. This code is here to
// illustrate how the buffer and limit sizes are configured.)
//
// UDP Receive limit //////////////////////////////////!!!!!!!!!!!!!!!!!!!!!!
rc = 8192;
//4096;
////16384;
CfgAddEntry( hCfg, CFGTAG_IP, CFGITEM_IP_SOCKUDPRXLIMIT,
CFG_ADDMODE_UNIQUE, sizeof(uint), (UINT8 *)&rc, 0 );
//
// Boot the system using this configuration
//
// We keep booting until the function returns 0. This allows
// us to have a "reboot" command.
//
do
{ SOCK_OK =1;
rc = NC_NetStart( hCfg, NetworkOpen, NetworkClose, NetworkIPAddr );
} while( rc > 0 );
// Delete Configuration
CfgFree( hCfg );
// Close the OS
main_exit:
NC_SystemClose();
return(0);
}
////
//// System Task Code [ Server Daemon Servers ]
////
//static HANDLE hHello=0;
//
// NetworkOpen
//
// This function is called after the configuration has booted
//
static void NetworkOpen()
{
//// sss //////////////
Error_init(&eb);
/* Create a Task with priority xx */
Task_Params_init(&taskParams);
taskParams.stackSize = 2048;
taskParams.priority = 9;
ETH_Task_hndl = Task_create((Task_FuncPtr)Task1Func , &taskParams, &eb);
//ConCmdEcho
if (ETH_Task_hndl == NULL) {
//System_abort
printf("Task create failed");
}
// Create our local server
hHello = DaemonNew( SOCK_DGRAM, 0,
// 7,
12288,
dtask_udp_hello,
OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
}
//
// NetworkClose
//
// This function is called when the network is shutting down,
// or when it no longer has any IP addresses assigned to it.
//
static void NetworkClose()
{
DaemonFree( hHello );
}
//
// NetworkIPAddr
//
// This function is called whenever an IP address binding is
// added or removed from the system.
//
static void NetworkIPAddr( IPN IPAddr, uint IfIdx, uint fAdd )
{
IPN IPTmp;
if( fAdd )
printf("Network Added: ");
else
printf("Network Removed: ");
// Print a message
IPTmp = ntohl( IPAddr );
printf("If-%d:%d.%d.%d.%d\n", IfIdx,
(UINT8)(IPTmp>>24)&0xFF, (UINT8)(IPTmp>>16)&0xFF,
(UINT8)(IPTmp>>8)&0xFF, (UINT8)IPTmp&0xFF );
}
//
// Service Status Reports
//
// Here's a quick example of using service status updates
//
static char *TaskName[] = { "Telnet","HTTP","NAT","DHCPS","DHCPC","DNS" };
static char *ReportStr[] = { "","Running","Updated","Complete","Fault" };
static char *StatusStr[] = { "Disabled","Waiting","IPTerm","Failed","Enabled" };
static void ServiceReport( uint Item, uint Status, uint Report, HANDLE h )
{
printf( "Service Status: %-9s: %-9s: %-9s: %03d\n",
TaskName[Item-1], StatusStr[Status],
ReportStr[Report/256], Report&0xFF );
//
// Example of adding to the DHCP configuration space
//
// When using the DHCP client, the client has full control over access
// to the first 256 entries in the CFGTAG_SYSINFO space.
//
// Note that the DHCP client will erase all CFGTAG_SYSINFO tags except
// CFGITEM_DHCP_HOSTNAME. If the application needs to keep manual
// entries in the DHCP tag range, then the code to maintain them should
// be placed here.
//
// Here, we want to manually add a DNS server to the configuration, but
// we can only do it once DHCP has finished its programming.
//
// if( Item == CFGITEM_SERVICE_DHCPCLIENT && /////////////// !!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Status == CIS_SRV_STATUS_ENABLED &&
// (Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPADD) ||
// Report == (NETTOOLS_STAT_RUNNING|DHCPCODE_IPRENEW)) )
// {
// IPN IPTmp;
//
// // Manually add the DNS server when specified
// IPTmp = inet_addr(DNSServer);
// if( IPTmp )
// CfgAddEntry( 0, CFGTAG_SYSINFO, CFGITEM_DHCP_DOMAINNAMESERVER,
// 0, sizeof(IPTmp), (UINT8 *)&IPTmp, 0 );
// }
}
void Init_SGMII_S (uint32_t macPortNum)
{
CSL_SGMII_ADVABILITY sgmiiCfg;
CSL_SGMII_STATUS sgmiiStatus;
//// sss!!! ///
volatile unsigned int i32;
/* Reset the port before configuring it */
CSL_SGMII_doSoftReset (macPortNum);
while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0);
if (macPortNum == 1) {
/* Hold the port in soft reset and set up
* the SGMII control register:
* (1) Enable Master Mode
* (2) Enable Auto-negotiation
*/
CSL_SGMII_startRxTxSoftReset (macPortNum);
//CSL_SGMII_disableMasterMode (macPortNum);
CSL_SGMII_enableMasterMode (macPortNum); //// sss!!! get it out! //////
CSL_SGMII_enableAutoNegotiation (macPortNum);
CSL_SGMII_endRxTxSoftReset (macPortNum);
/* Setup the Advertised Ability register for this port:
* (1) Enable Full duplex mode
* (2) Enable Auto Negotiation
* (3) Enable the Link
*/
sgmiiCfg.linkSpeed = CSL_SGMII_1000_MBPS;
sgmiiCfg.duplexMode = CSL_SGMII_FULL_DUPLEX;
sgmiiCfg.bLinkUp = 1; //////sss!!! (get out this!)
CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
i32 = *(unsigned int*)(0x02090118);
do
{
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
} while (sgmiiStatus.bIsLinkUp != 1);
/* Wait for SGMII Autonegotiation to complete without error */
do
{
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
if (sgmiiStatus.bIsAutoNegError != 0)
{
printf("SGM ERROR\n");
return; /* This is an error condition */
}
} while (sgmiiStatus.bIsAutoNegComplete != 1);
}
if (macPortNum == 0) {
/* Hold the port in soft reset and set up
* the SGMII control register:
* (1) Disable Master Mode
* (2) Enable Auto-negotiation
*/
CSL_SGMII_startRxTxSoftReset (macPortNum);
// CSL_SGMII_disableMasterMode (macPortNum);
CSL_SGMII_enableMasterMode (macPortNum); //// sss!!! get it out! //////
CSL_SGMII_enableAutoNegotiation (macPortNum);
CSL_SGMII_endRxTxSoftReset (macPortNum);
/* Setup the Advertised Ability register for this port:
* (1) Enable Full duplex mode
* (2) Enable Auto Negotiation
* (3) Enable the Link
*/
sgmiiCfg.linkSpeed = CSL_SGMII_1000_MBPS;
sgmiiCfg.duplexMode = CSL_SGMII_FULL_DUPLEX;
sgmiiCfg.bLinkUp = 1;
CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg);
i32 = *(unsigned int*)(0x02090118);
do
{
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
} while (sgmiiStatus.bIsLinkUp != 1);
/////////// sss!!! get it out! ///////////////
/* Wait for SGMII Autonegotiation to complete without error */
do
{
CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);
if (sgmiiStatus.bIsAutoNegError != 0)
{
printf("SGM ERROR\n");
return; /* This is an error condition */
}
} while (sgmiiStatus.bIsAutoNegComplete != 1);
/////////// sss!!! get it out! ///////////////
}
/* All done with configuration. Return Now. */
return;
}
Thanks.
Andriy
Hello Todd
Do you have a simple example NDK UDP project configured with .cfg ?
If you dont have it , please let me know where I can find this sample.
Thanks Todd
Andriy