Problem in Integration of Analog / Digital Drivce driver with RTEMS for MVME162-522A
AJAI KUMAR MEDHAVI
akmedhavi at rrcat.gov.in
Wed Mar 28 08:58:07 UTC 2012
Hi,
I have made Analog / Digital IO ( ADC, DAC, OPTO and Relay) Device
drivers for MVME162-512 VME CPU Board using RTEMS 4.10.2 on Windows with
MinGW-get-inst-20110802 and RTEMS4.10 tools
Before integrating ADC / DAC Drivers, I have successfully configured,
build and run all sample and test applications on my CPU board.
Now I have added ADC/DAC Device Drivers for Four IO boards i.e ADC, DAC,
RELAY and OPTO. I have integrated Device Driver files in following steps :
1. First created a new folder ADCDAC in
..\rtems-4.10.2\c\src\lib\libbsp\m68k\mvme162
And added following Files
ADC.c
DAC.c
OPTO.c
RELAY.c
in ..\rtems-4.10.2\c\src\lib\libbsp\m68k\mvme162\ADCDAC directory.
2. Then modify makefile.am in ..\rtems-4.10.2\c\src\lib\ libbsp\ m68k\
mvme162
With
# ADCDAC
libbsp_a_SOURCES += adcdac/adcdrv.c adcdac/dacdrv.c adcdac/optodrv.c \
adcdac/relaydrv.c
to include ADC/DAC C files in makefile.
3. Then added Header files adc.h, dac.h, opto.h and realy.h
In ..\rtems-4.10.2\c\src\lib\libbsp\m68k\mvme162\include
And modify makefile.am in ..\rtems-4.10.2\c\src\lib\ libbsp\ m68k\
mvme162
With
include_bspdir = $(includedir)/bsp
dist_project_lib_DATA = bsp_specs
include/adc.h include/dac.h include/opto.h include/relay.h
The modified makefile.am in ..\rtems-4.10.2\c\src\lib\libbsp\m68k\mvme162
is :
-----------------------------------------------------------------------------
##
## $Id: Makefile.am,v 1.42 2008/09/30 10:32:49 ralf Exp $
##
ACLOCAL_AMFLAGS = -I ../../../../aclocal
include $(top_srcdir)/../../../../automake/compile.am
include_bspdir = $(includedir)/bsp
dist_project_lib_DATA = bsp_specs
include_HEADERS = include/bsp.h include/adc.h include/dac.h include/opto.h
include/relay.h
include_HEADERS += include/tm27.h
nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
DISTCLEANFILES = include/bspopts.h
noinst_PROGRAMS =
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
# XXX ignore tools since it doesn't build
SUBDIRS = .
include_HEADERS += ../../shared/tod.h
include_HEADERS += include/coverhd.h
include_HEADERS += include/page_table.h
nodist_include_HEADERS += $(top_srcdir)/../shared/mvme/mvme16x_hw.h
noinst_LIBRARIES = libbspstart.a
libbspstart_a_SOURCES = ../../m68k/shared/start.S
project_lib_DATA = start.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
noinst_LIBRARIES += libbsp.a
libbsp_a_SOURCES =
# startup
libbsp_a_SOURCES += startup/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppredriverhook.c ../../shared/bsppost.c \
startup/bspstart.c ../../shared/bootcard.c \
../../shared/bsppretaskinghook.c startup/page_table.c \
../../shared/bspgetworkarea.c startup/page_table.c \
../../shared/sbrk.c ../../m68k/shared/setvec.c \
../../shared/gnatinstallhandler.c
# clock
libbsp_a_SOURCES += clock/ckinit.c
# console
libbsp_a_SOURCES += console/console.c ../../shared/dummy_printk_support.c
# timer
libbsp_a_SOURCES += timer/timer.c timer/timerisr.S
# ADCDAC
libbsp_a_SOURCES += adcdac/adcdrv.c adcdac/dacdrv.c adcdac/optodrv.c
adcdac/relaydrv.c
# tod
libbsp_a_SOURCES += tod/tod.c
if HAS_NETWORKING
network_CPPFLAGS = -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
noinst_PROGRAMS += network.rel
network_rel_SOURCES = ../mvme167/network/network.c
network_rel_CPPFLAGS = $(AM_CPPFLAGS) $(network_CPPFLAGS)
network_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif
libbsp_a_LIBADD = \
../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
../../../libcpu/@RTEMS_CPU@/shared/misc.rel
if HAS_NETWORKING
libbsp_a_LIBADD += network.rel
endif
if HAS_FPSP
libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/@RTEMS_CPU_MODEL@/fpsp.rel
endif
EXTRA_DIST = times
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am
------------------------------------------------------------------------------
4. I have included Header files in Drivers C Files (ADC.c, DAC.c etc)
With
#include <ADC.h> [ in adc.c ]
#include <DAC.h> [ in dac.c ]
#include <OPTO.h> [ in opto.c ]
#include <RELAY.h> [ in relay.c ]
Also modified ..\RTEMS\rtems-4.10.2\cpukit\sapi\include\condefs.h
To include ADC /DAC Device Driver Header files and Driver Table entries
just
(like CONSOLE AND CLOCK DRIVER TABLE ENTRY points :
/* Default Device Driver Table. Each driver needed by the test is
explicitly
* choosen by that test. There is always a null driver entry.
*/
The relevant part of this condefs.h file is as given below :
#define NULL_DRIVER_TABLE_ENTRY \
{ NULL, NULL, NULL, NULL, NULL, NULL }
#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#include <rtems/console.h>
#endif
.
.
.
/******** ADDED BY MEDHAVI ***********************************/
#ifdef CONFIGURE_APPLICATION_NEEDS_ADC_DRIVER
#include <adc.h>
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_DAC_DRIVER
#include <dac.h>
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_OPTO_DRIVER
#include <opto.h>
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_RELAY_DRIVER
#include <relay.h>
#endif
/******** END OF ADDITION MEDHAVI ***********************/
#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
/* the ide driver needs the ATA driver */
#ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
#endif
#include <libchip/ide_ctrl.h>
#endif
And
#ifdef CONFIGURE_INIT
rtems_driver_address_table Device_drivers[] = {
#ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
CONFIGURE_BSP_PREREQUISITE_DRIVERS,
#endif
#ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
CONSOLE_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
CLOCK_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
RTC_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
WATCHDOG_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
DEVNULL_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
ATA_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
FRAME_BUFFER_DRIVER_TABLE_ENTRY,
#endif
/*----- BEGINING : ADDED BY MEDHAVI ----------*/
#ifdef CONFIGURE_APPLICATION_NEEDS_ADC_DRIVER
ADC_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_DAC_DRIVER
DAC_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_OPTO_DRIVER
OPTO_DRIVER_TABLE_ENTRY,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_RELAY_DRIVER
RELAY_DRIVER_TABLE_ENTRY,
#endif
/*----- END : ADDED BY MEDHAVI --------------*/
#ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
CONFIGURE_APPLICATION_EXTRA_DRIVERS,
#endif
#ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
NULL_DRIVER_TABLE_ENTRY
#elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \
!defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \
!defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
NULL_DRIVER_TABLE_ENTRY
#endif
};
#endif
5. Then I have defined following in samples\hello\init.c :
#define CONFIGURE_APPLICATION_NEEDS_ADC_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_DAC_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_OPTO_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_RELAY_DRIVER
just to include ADC /DAC Header files and
6. Then after running configuration with following options :
When I run make w all,I have observed following ERRORs in
..\rtems-4.10.2\
Testsuites\samples\hello\init.c
I. ../../../../../mvme162/lib/include/rtems/confdefs.h Error : adc.h
: No
such file or directory
II. ../../../../../mvme162/lib/include/rtems/confdefs.h Error : dac.h
:No
such file or directory
III. ../../../../../mvme162/lib/include/rtems/confdefs.h Error : opto.h :
No such file or directory
IV. ../../../../../mvme162/lib/include/rtems/confdefs.h Error : relay.h :
:No such file or directory
I have also found that makmefile.in and preinstall.am
..\rtems-4.10.2\c\src\lib\libbsp\ m68k\mvme162
Have not been updated though I have modified makefile.am (in same
m68k]mvme162).
My drivers source files like adcdrv.c and adc.h are not appearing in
makefile.in
Though I have included ADC / DAC Device Driver C and Header files and
included
these in relevant makefile.am just like CONSOLE and CLOCK Driver, I am
not sure why
header files like adc.h are not included in makefile.in
I have following queries regarding this problem :
1.why makmefile.in and preinstall.am are not updating (by generating
automatically by automake) as per modifications done in makefile.am
I believe that makefile.in and preinstall.am have to be automatically
get modified once we build RTEMS with modified makefile.am
2. What to do to get modified makefile.in and preinstall.am
3. Whether I have to modify some other makefiles / configuration files
Kindly provide your suggestions and solution to resolve the problem at the
earliest.
Further The Prototype Application for Testing ADC / DAC driver on
MVME162-522A is ready for Integration with RTEMS-4.10.2 and then testing
ADC/DAC Device Driver.
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