Quantcast
Channel: Embedded Software (Read Only)
Viewing all articles
Browse latest Browse all 25965

Forum Post: About NDK RawETH developing on AM335x by using Industrual SDK

$
0
0

Hi All,

I am doing the developing of a RAWETH communication by using the NDK,SYSBIOS and AM335x industrual SDK.

After some porting job according to ind SDK os_drivers,I think I have already succeed to register the EMAC to NDK by calling NIMURegister() command.But I still be confused with how to use the socket commands and how the socket commands is connected with NIMU level.I also tried to find sample codes about RAWETH develop on NDK but failed.

So could some one provide a detail step by step guide after the NIMURegister() Job according to the industrual SDK done?

My code is like this, lt looks like can get the socket,but not able to make a send call.

void main()

{

Task_Params_init(&taskParams);
taskParams.priority = 5;
taskParams.stackSize = 0x400;
uartTask = Task_create (UARTproc, &taskParams, NULL);

...hardware initial codes....

if(AddNetifEntryFn(CPSW_NETIF_INIT) == 0)
BIOS_exit(0);

BIOS_start();

}

in task:

Void UARTproc(UArg arg1, UArg arg2)
{

/* Allocate the file environment for this task */
fdOpenSession(TaskSelf());

s_step = 100;

/* Initialize the allocated memory block. */
bzero(&PSA,sizeof(struct sockaddr_in));

PSA.sin_family = AF_RAWETH;
PSA.sin_len = sizeof(PSA);


for(i = 8;i<10;i++)
{
*(&pbuf+1) = 0;
}

while(1)

{

switch(s_step)
{
case 100:
sraw = INVALID_SOCKET;
s_step = 200;
break;

case 200:
sraw = socket(AF_RAWETH, SOCK_RAWETH, 0x88a4);
if(sraw != INVALID_SOCKET)
s_step = 300;
break;

case 300:
/* Configure the transmit device */
val = 1;
retVal = setsockopt(sraw, SOL_SOCKET, SO_IFDEVICE, &val, sizeof(val));
if(retVal)
System_printf("error in setsockopt \n");

s_step = 400;
break;

case 400:
/* Configure the EMAC channel number */
val = 3;
retVal = setsockopt(sraw, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val));
if(retVal)
System_printf("error in setsockopt \n");
s_step = 500;
break;

case 500:
retVal = sendto(sraw, pbuf, 10, 0, (struct sockaddr*)&PSA,sizeof(PSA));
if (retVal == -1)
err = fdError();
break;

}

}

}


Viewing all articles
Browse latest Browse all 25965

Latest Images

Trending Articles



Latest Images