Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 20, 2012
I am Facing a issue while calling xemacif_input(netif)in FreeRTOS task using TCP and UDP Connection establishment.This is a example of LWIP echo sever.

Regards
Anurag Gupta


################################ main.c ################################



#include
#include "xenv_standalone.h"
#include "xparameters.h"
#include "netif/xadapter.h"

#ifdef XPAR_EMACLITE_0_BASEADDR
#define EMAC_BASEADDR XPAR_EMACLITE_0_BASEADDR
#elif XPAR_LLTEMAC_0_BASEADDR
#define EMAC_BASEADDR XPAR_LLTEMAC_0_BASEADDR
#else
#error
#endif

int start_application();
int transfer_data();

void print_ip(char *msg, struct ip_addr *ip)
{
print(msg);
xil_printf("%d.%d.%d.%d\n\r", ip4_addr1(ip), ip4_addr2(ip), ip4_addr3(ip), ip4_addr4(ip));
}

void print_ip_settings(struct ip_addr *ip, struct ip_addr *mask, struct ip_addr *gw)
{
print_ip("Board IP: ", ip);
print_ip("Netmask : ", mask);
print_ip("Gateway : ", gw);
}

int main()
{
struct netif *netif, server_netif;
struct ip_addr ipaddr, netmask, gw;

/* the mac address of the board. this should be unique per board */
unsigned char mac_ethernet_address[] = {0x00, 0x0A, 0x35, 0x01, 0xC2, 0x5C};
netif = &server_netif;

#ifdef __MICROBLAZE__
microblaze_init_icache_range(0, XPAR_MICROBLAZE_0_CACHE_BYTE_SIZE);
microblaze_init_dcache_range(0, XPAR_MICROBLAZE_0_DCACHE_BYTE_SIZE);
#endif

/* enable caches */
XCACHE_ENABLE_ICACHE();
XCACHE_ENABLE_DCACHE();
//platform_setup_interrupts();

/* initliaze IP addresses to be used */
IP4_ADDR(&ipaddr, 131, 169, 117, 2);
IP4_ADDR(&netmask, 255, 255, 255, 0);
IP4_ADDR(&gw, 0, 0, 0, 0);

print_app_header();
print_ip_settings(&ipaddr, &netmask, &gw);

lwip_init();

/* Add network interface to the netif_list, and set it as default */

if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, EMAC_BASEADDR))
{
xil_printf("Error adding N/W interface\n\r");
return -1;
}

netif_set_default(netif);


/* Create a new DHCP client for this interface.
* Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
* the predefined regular intervals after starting the client.
*/

/* dhcp_start(netif); */

/* now enable interrupts */
platform_enable_interrupts();

/* specify that the network if is up */
netif_set_up(netif);

/* start the application (web server, rxtest, txtest, etc..) */
start_application();

/* receive and process packets */
while (1)
{
xemacif_input(netif);
transfer_data();
}

XCACHE_DISABLE_DCACHE();
XCACHE_DISABLE_ICACHE();

#ifdef __MICROBLAZE__
microblaze_init_dcache_range(0, XPAR_MICROBLAZE_0_DCACHE_BYTE_SIZE);
microblaze_init_icache_range(0, XPAR_MICROBLAZE_0_CACHE_BYTE_SIZE);
#endif

return 0;
}



RE: xemacif_input(netif) in FreeRTOS

Posted by Dave on June 20, 2012
Often people don't provide enough information to allow forum members to reply. In this case, all you have said is "I'm facing an issue". The only sensible reply is then "what is the issue?", so why didn't you say in the first place?

I suggest you read the FAQ on using the forum (link at top of forum front page), and then ask your question on the lwIP forum as it does not look like a FreeRTOS question anyway.

RE: xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 20, 2012
Dear Sir
Thanks for reply.I am using LWIP1.3.0 and make ACS_TCP_Server task in FreeRTOS

void prvACS_TCP_ServerTask (void* pvParameters)
{
(void) pvParameters; // Just to stop compiler warnings.
//err_t Err;

static int gi_TCP_Server_Connection_Status= TCP_SERVER_DISCONNECTED;

for (;;) {

// if(gi_TCP_Server_Connection_Status!=TCP_SERVER_DISCONNECTED){

// }



/* receive packets */
xemacif_input(netif);
/* do application specific processing */


switch(gi_TCP_Server_Connection_Status){

case TCP_SERVER_DISCONNECTED:
#ifdef DEBUG_PRINT
print("TCP disconnected\n\r");
#endif

InitACS_TCP_SERVER();
gi_TCP_Server_Connection_Status=TCP_SERVER_INITIALIZED;

#ifdef DEBUG_PRINT
print("TCP initialized\n\r");
#endif

break;

case TCP_SERVER_INITIALIZED:

gi_TCP_Server_Connection_Status=TCP_SERVER_CONNECTED;
break;

case TCP_SERVER_CONNECTED:
#ifdef DEBUG_PRINT
print("TCP Connected\n\r");
#endif


break;


default:
gi_TCP_Server_Connection_Status=TCP_SERVER_DISCONNECTED;
break;
}

print("TCP\n\r ");

vTaskDelay(1);
}
}

This function i am, using for Transmit packets for raw API for xemacif_input(netif);
between TCP and UDP Connection establishment.

Can you help to guide.how can we used this function in FreeRTOS in xemacif_input(netif);

Regards
Anurag Gupta

RE: xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 20, 2012
Dear Sir
Thanks for reply.I am using LWIP1.3.0 and make ACS_TCP_Server task in FreeRTOS

void prvACS_TCP_ServerTask (void* pvParameters)
{
(void) pvParameters; // Just to stop compiler warnings.
//err_t Err;

static int gi_TCP_Server_Connection_Status= TCP_SERVER_DISCONNECTED;

for (;;) {

// if(gi_TCP_Server_Connection_Status!=TCP_SERVER_DISCONNECTED){

// }



/* receive packets */
xemacif_input(netif);
/* do application specific processing */


switch(gi_TCP_Server_Connection_Status){

case TCP_SERVER_DISCONNECTED:
#ifdef DEBUG_PRINT
print("TCP disconnected\n\r");
#endif

InitACS_TCP_SERVER();
gi_TCP_Server_Connection_Status=TCP_SERVER_INITIALIZED;

#ifdef DEBUG_PRINT
print("TCP initialized\n\r");
#endif

break;

case TCP_SERVER_INITIALIZED:

gi_TCP_Server_Connection_Status=TCP_SERVER_CONNECTED;
break;

case TCP_SERVER_CONNECTED:
#ifdef DEBUG_PRINT
print("TCP Connected\n\r");
#endif


break;


default:
gi_TCP_Server_Connection_Status=TCP_SERVER_DISCONNECTED;
break;
}

print("TCP\n\r ");

vTaskDelay(1);
}
}

This function i am, using for Transmit packets for raw API for xemacif_input(netif);
between TCP and UDP Connection establishment.

Can you help to guide.how can we used this function in FreeRTOS in xemacif_input(netif);

Regards
Anurag Gupta

RE: xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 20, 2012
Dear Sir
Thanks for reply.I am using LWIP1.3.0 and make ACS_TCP_Server task in FreeRTOS

void prvACS_TCP_ServerTask (void* pvParameters)
{
(void) pvParameters; // Just to stop compiler warnings.
//err_t Err;

static int gi_TCP_Server_Connection_Status= TCP_SERVER_DISCONNECTED;

for (;;) {

// if(gi_TCP_Server_Connection_Status!=TCP_SERVER_DISCONNECTED){

// }



/* receive packets */
xemacif_input(netif);
/* do application specific processing */


switch(gi_TCP_Server_Connection_Status){

case TCP_SERVER_DISCONNECTED:
#ifdef DEBUG_PRINT
print("TCP disconnected\n\r");
#endif

InitACS_TCP_SERVER();
gi_TCP_Server_Connection_Status=TCP_SERVER_INITIALIZED;

#ifdef DEBUG_PRINT
print("TCP initialized\n\r");
#endif

break;

case TCP_SERVER_INITIALIZED:

gi_TCP_Server_Connection_Status=TCP_SERVER_CONNECTED;
break;

case TCP_SERVER_CONNECTED:
#ifdef DEBUG_PRINT
print("TCP Connected\n\r");
#endif


break;


default:
gi_TCP_Server_Connection_Status=TCP_SERVER_DISCONNECTED;
break;
}

print("TCP\n\r ");

vTaskDelay(1);
}
}

This function i am, using for Transmit packets for raw API for xemacif_input(netif);
between TCP and UDP Connection establishment.

Can you help to guide.how can we used this function in FreeRTOS in xemacif_input(netif);

Regards
Anurag Gupta

RE: xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 21, 2012
Dear Sir

I want to be used Keil as Development IDE and Ported current Project for Supported Demo of FreeRTOS ARM9_AT91SAM9XE_IAR for Atmel microcontroller is using IAR Tools as development any Application.As per my knowlege files that’s is Provided by IAR tools in FreeRTOS in FreeRTOSV7.1.0\Source\portable\IAR\AtmelSAM9XE


•ISR_Support.H
•Port.c
•Portasm.s79
•Portmacro.c
From where i can get these Files for used KIEL as development IDE for My Application Development Application for atmel microcontroller project of FreeRTOS Demo ARM9_AT91SAM9XE_IAR .


RE: xemacif_input(netif) in FreeRTOS

Posted by Anurag on June 28, 2012
Hi Richard

I am able to run LWIP using netconnAPI on Atmel microcontroller.that was major achivements of till date for me in FreeRTOS.Thanks for your support and guidelines.

Regards
Anurag Gupta


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS