RTEMS Network initialization Problem for MVME162 VME CPU Board
AJAI KUMAR MEDHAVI
akmedhavi at rrcat.gov.in
Tue Jan 1 07:22:35 UTC 2013
Hi
I have developed an Application using RTEMS 4.10.2 on MVME162 VME CPU
Board. The Application consists of 4 Tasks with Priorities from 101 to
104.
I have to test my RTEMS Application with another application running on
Another PC through Ethernet (10 Mbps). Both the CPU board and another PC
are interconnected though Hub.
In RTEMS Init Task,I have called the function
rtems_bsdnet_initialize_network() to Initialize Networking. When I run my
application on MVME162 CPU board, it hangs during Network Initialization.
On debugging the problem, I have found the problem in uti596_issueCA(...)
during uti_diagnose during uti596_initMem. It hangs immediately after
"i82596->chan_attn = 0x00000000;" The flow of functions called is as given
below (in rtems_glue.c and network.c in libbsp\m68k\mvme167 shared by
mvme162) :
rtems_bsdnet_initialize_network()---> rtems_bsdnet_setup() -->
rtems_bsdnet_ifconfig(ifp->name, SIOCSIFFLAGS, &flags)-->
ioctl (s, SIOCSIFFLAGS, &ifreq)---> ut596_ioctl(s, SIOCSIFFLAGS, &ifreq)with
case IFF_UP --> uti596_init(void *sc) --> uit596_initialize_hardware(sc) [
Please note that in this function, uti596_initialize successfully and
DynamicInterrupt Hander gets installed ] -->
uti_596_initMem(sc)--> uti596_diagnose()-->uti596_addPolledCmd(&diagnose)-->
uti596_issueCA(uti596_softc, uti596_WAIT_FOR_CU_ACCEPT) with SCB.Command =
CUC_START
Please note that the first call of "uti596_issueCA(...)" during
uti596_initialize (sc) executes successfully. But the application hanges
in uti596_issueCA(...) called by uti_diagnose() during uti596_initMem. It
hangs immediately after "i82596->chan_attn = 0x00000000;"
Please find the code for The RTEMS INIT Task , rtems_bsdnet_ifconfig &
rtems_bsdnet_config structures initialization as given below :
rtems_task Init(rtems_task_argument argument)
{
rtems_status_code status;
puts("\nRTEMS INIT TASK : Creating Application Resources
.......\n" );
/*-----Network
initialization--------------------------------------------*/
puts("\nNetwork initializing..........\n");
rtems_bsdnet_initialize_network();
puts("\nNetwork initialized!\n");
/*------------------------------------------------------------------------*/
/*-----Create Application Tasks
Names------------------------------------*/
APPINIT_TASK_NAME = rtems_build_name( 'T', 'A',
'1', ' ' );
RECV_TASK_NAME = rtems_build_name( 'T',
'A', '2', ' ' );
RecvProcessTask_NAME = rtems_build_name( 'T', 'A', '3', '
' );
PeriodicReadTask_NAME = rtems_build_name( 'T', 'A', '4',
' ' );
/*-----Create Application Semaphores / Message Queues
Names------------------------------------*/
ioread_sema_NAME = rtems_build_name( 'S',
'E', '1', ' ' );
RecvProcessTask_msgQ_NAME = rtems_build_name( 'M', 'Q',
'1', ' ' );
PeriodicReadTask_msgQ_NAME = rtems_build_name( 'M', 'Q',
'2', ' ' );
/*-----Create Application
Resources--------------------------------------*/
create_app_tasks();
create_app_msgqueues();
create_app_sema();
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
For Network Initialization, I have set my CPU Board IP address as
100.100.100.101 and configured following structures as given below :
struct rtems_bsdnet_ifconfig Appnetdriver_config = {
RTEMS_BSP_NETWORK_DRIVER_NAME,
RTEMS_BSP_NETWORK_DRIVER_ATTACH,
NULL, /* link to next interface */
"100.100.100.101", /* IP address */
"255.255.255.0", /* IP net mask */
/*{0x08, 0x00, 0x3E, 0x24, 0x92, 0xCA}, */ /* hardware_address
Initailly NULL */
NULL,
0,
0,
0,
0,
0,
0,
0,
NULL
};
struct rtems_bsdnet_config rtems_bsdnet_config = {
&Appnetdriver_config, /* Network interface */
NULL, /* Not use BOOTP to get network configuration */
NETWORK_TASK_PRIORITY, /* Network task priority */
64*1024, /* MBUF space, Default 64KB */
128*1024, /* MBUF cluster space, Default 128KB */
"rtems_host", /* Host name (rtems_host) */
"localnet", /* Domain name (default - 0) */
"100.100.100.101", /* Gateway (default - 0) */
"100.100.100.101", /* Log host */
{"100.100.100.101"}, /* Name server(s) (default - 0) */
{"100.100.100.101"}, /* NTP server(s) (default - 0) */
0,
0,
0,
0,
0
};
The RTEMS_BSP_NETWORK_DRIVER_NAME and RTEMS_BSP_NETWORK_DRIVER_ATTACH has
been defined in mvme16x_hw.h (in /c/src/lib/libbsp/m68k/shared/mvme/)as
given below :
struct rtems_bsdnet_ifconfig;
int uti596_attach(struct rtems_bsdnet_ifconfig * pConfig, int attaching );
#define RTEMS_BSP_NETWORK_DRIVER_NAME "uti1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH uti596_attach
For RTEMS INIT task have also included following network files :
#include <rtems/rtems_bsdnet.h>
#include <rtems/error.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
Also defined :
/*-------Init Task---------------------------------------------------*/
#define CONFIGURE_INIT_TASK_STACK_SIZE (32*1024)
#define CONFIGURE_INIT_TASK_PRIORITY 50
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
RTEMS_NO_TIMESLICE
|
\
RTEMS_NO_ASR
|
\
RTEMS_INTERRUPT_LEVEL(0))
/*-------Network Task Priorities----------*/
#define NETWORK_TASK_PRIORITY 100
/*-------Application Task Priorities------*/
#define APPINIT_TASK_PRIORITY 101
#define RecvProcessTask_PRIORITY 102
#define Recv_Task_PRIORITY 103
#define PeriodicReadTask_PRIORITY 104
/*-------------- configuration
information-------------------------------------------------------------------
*/
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
#define CONFIGURE_MAXIMUM_SEMAPHORES 20
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 20
#define CONFIGURE_MAXIMUM_PERIODS 1
#define CONFIGURE_MAXIMUM_TASKS 20
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MICROSECONDS_PER_TICK
10000 /*--- Changed
from 1000 to 10000 on July 11, 2012 ----------*/
#define CONFIGURE_MAXIMUM_DRIVERS
10
#define CONFIGURE_MAXIMUM_DEVICES
20
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 50
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
I am not sure whether Interrupt has been disabled before uti596_issueCA
and enabled just before the end of uti596_issueCA. In uti596_addCmd ,
Interrupt has been disabled/Enabled by _ISR_Disable(level) and
_ISR_Enable(level), but here level is local parameter and uninitialized.
I feel problem may be due to one or more of following :
- Interrupts Enabling/Disabling
- Any uninitialized pointer
- wait time in uti596_wait
- The port address where CHAN ATTENTION value (0x0) is written
- may be any other reasons
Kindly suggest solutions/improvement/advice at the earliest.
Thanks in advance
Best regards
AJAI KUMAR MEDHAVI
SCIENTIFIC OFFICER
RAJA RAMMANNA CENTRE FOR ADVANCED TECHNOLGY
DEPARTMENT OF ATOMIC ENERGY, GOV. OF INDIA,
PO : CAT, INDORE-452013, INDIA
PH. 91-731-2488052
Email : akmedhavi at rrcat.gov.in , akmedhavi at rediffmail.com
--
More information about the users
mailing list