Hi, I am trying organize exchange between OMAP and PC.
I am using CCS 6.1 / NDK 2.25.00.09 / NSP 1.10.03.15. I found good examples in \ndk_2_25_00_09\packages\ti\ndk\tools\servers and they was working.
But if i try to move "sendto(..)" in own Task "tskUdpSend()" after (100..128) packets function "sendto(..)" don`t send anything and "recvncfrom(..)" hang in "recUDP()".
UPDATE( i read 3.1.2.2 NDK GUIDE and create "tskUdpSend()" dynamically)
/* Init udp daemon */
void netOpenHook()
{
udpStart = DaemonNew( SOCK_DGRAM, 0, PORT_UDP, recUDP, 1, 16384, 0, 1 );
sendudp = TaskCreate( tskUdpSend, "SendUDP", OS_TASKPRINORM, 2048, 0, 0, 0 );
}
/* Receive frame and put him in circular buffer for parsing */
int recUDP( SOCKET s, UINT32 unused )
{
int rxSize, i , tmp;
pDat = (uint8_t*)malloc(2048);
for(;;)
{
tmp = sizeof( sin1 );
currentSoc = s;
rxSize = (int)recvncfrom( s, (void **)&pDat, 0, (PSA)&sin1, &tmp, &hBuffer );
if( rxSize >= 0 )
{
for( i = 0; i < rxSize; i++)
putBuffer(*pDat++);// analyzing data and create answer
// this block is working, when i send only one frame
//Semaphore_pend(semDatagramIsFull, BIOS_WAIT_FOREVER); // wait answer
//sendto( currentSoc, txDatagram , sizeD, 0, (PSA)&sin1, sizeof(sin1) );
}
}
free(pDat);
return(1);
}
/* Send UDP */
void tskUdpSend()
{
while(1)
{
Semaphore_pend(semDatagramIsFull, BIOS_WAIT_FOREVER); // wait answer
sendto( currentSoc, txDatagram , sizeD, 0, (PSA)&sin1, sizeof(sin1) );
memset(txDatagram, 0, sizeof(txDatagram));
recvncfree( hBuffer );
}
}