我现在先移植CC3100驱动,再基于CC3200中tcp_socket代码进行修改,进行测试。(CC3100+Tiva能够正常联网,CC3100驱动移植是基于CC3100的SDk进行的)
目前遇到的问题是:
1、在初始化变量后,调用ConfigureSimpleLinkToDefaultState()函数,程序移植在while中死循环,不能获取IP地址。这是什么原因导致的呢?
2、 如果将这段代码注释掉,直接调用后面的sl_DevGet()函数,获取设备版本信息,获取的结果也不太正确,并且会调用SimpleLinkGeneralEventHandler()函数,直至最后返回错误代码。以上的问题是驱动移植有问题吗?如果是,为什么sl_start()能够正常返回值2呢?
// If the device is not in station-mode, try configuring it in station-mode
if (ROLE_STA != lMode)
{
if (ROLE_AP == lMode)
{
// If the device is in AP mode, we need to wait for this event
// before doing anything
while(!IS_IP_ACQUIRED(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#endif
}
}
// Switch to STA role and restart
lRetVal = sl_WlanSetMode(ROLE_STA);
ASSERT_ON_ERROR(lRetVal);
lRetVal = sl_Stop(0xFF);
ASSERT_ON_ERROR(lRetVal);
lRetVal = sl_Start(0, 0, 0);
ASSERT_ON_ERROR(lRetVal);
// Check if the device is in station again
if (ROLE_STA != lRetVal)
{
// We don't want to proceed if the device is not coming up in STA-mode
return DEVICE_NOT_IN_STATION_MODE;
}
}