12 Commits
4.4.0 ... 4.4.2

Author SHA1 Message Date
Andrew Johnson
2715f585e0 Update version numbers to 4.4.2 for EPICS 7.0.2.2 release 2019-04-15 11:48:15 -05:00
mrkraimer
c2e3315f54 update RELEASE_NOTES 2019-04-11 13:59:57 -04:00
Marty Kraimer
d0ddcead24 Merge pull request #42 from mrkraimer/master
pvRequest - asking for subfield of non structure field crashes IOC; allow subfield of union
2019-04-04 05:27:41 -04:00
mrkraimer
5f42eec15a better exception messages 2019-03-31 15:38:13 -04:00
mrkraimer
20e55d5bca minor changes 2019-03-31 07:33:51 -04:00
mrkraimer
6d2d63621e address issue 41 2019-03-29 11:22:49 -04:00
Andrew Johnson
b3f96f730f SHRLIB_VERSION for 4.4.1 2019-03-20 15:10:43 -05:00
Andrew Johnson
02930b78a0 Release notes for 4.4.1 2019-03-20 15:10:09 -05:00
Heinz Junkes
68cc5e3b28 Merge pull request #40 from hjunkes/SimplificationsForRtems
Simplify rtemsTestHarness
2019-03-18 13:40:50 +01:00
Heinz Junkes
0c0a77def5 Simplify rtemsTestHarness 2019-03-18 12:05:56 +01:00
Marty Kraimer
79b05db5e2 Merge pull request #38 from mrkraimer/master
fix warning messages; at least on linux
2019-03-14 14:47:09 -04:00
mrkraimer
cd653a809f fix warning messages; at least on linux 2019-03-13 09:10:40 -04:00
12 changed files with 108 additions and 459 deletions

View File

@@ -2,6 +2,24 @@
This document summarizes the changes to the module between releases.
## Release 4.4.2 (EPICS 7.0.2.2, Apr 2019)
Formerly if a client makes a request for a subfield of a non structure field
it resulted in a crash.
Now if a request is made for a subfield of a non structure field
1) if the field is not a union an exception is thrown which is passed to the client.
2) if the field is a union
a) if more than one subfield is requested an exception is thrown
b) if the subfield is the type for the current union the request succeeds
c) if type is not the same an exception is thrown
## Release 4.4.1 (EPICS 7.0.2.1, Mar 2019)
* Cleaned up some build warnings.
* RTEMS test harness simplified.
## Release 4.4 (EPICS 7.0.2, Dec 2018)
@@ -30,5 +48,3 @@ The test is now a regression test which can be run using:
This is the first release of pvDatabaseCPP.
It provides functionality equivalent to pvDatabaseJava.

View File

@@ -8,7 +8,7 @@ PVDATABASE_SRC = $(TOP)/src
LIBRARY += pvDatabase
# shared library ABI version.
SHRLIB_VERSION ?= 4.4.0
SHRLIB_VERSION ?= 4.4.2
INC += pv/channelProviderLocal.h
INC += pv/pvDatabase.h

View File

@@ -168,7 +168,7 @@ PVFieldPtr PVCopy::getMasterPVField(size_t structureOffset)
node = getMasterNode(snode,structureOffset);
}
if(!node) {
throw std::invalid_argument(
throw std::logic_error(
"PVCopy::getMasterPVField: structureOffset not valid");
}
size_t diff = structureOffset - node->structureOffset;
@@ -248,7 +248,7 @@ PVStructurePtr PVCopy::getOptions(std::size_t fieldOffset)
}
}
if(okToContinue) continue;
throw std::invalid_argument("fieldOffset not valid");
throw std::logic_error("PVCopy logic error: fieldOffset not valid");
}
}
@@ -464,7 +464,13 @@ StructureConstPtr PVCopy::createStructure(
fields.push_back(field);
}
size_t numsubfields = fields.size();
if(numsubfields==0) return NULLStructure;
if(numsubfields==0) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("no fields from the following request were found\n");
val += ss.str();
throw std::invalid_argument(val);
}
return getFieldCreate()->createStructure(fieldNames, fields);
}
@@ -487,16 +493,65 @@ CopyNodePtr PVCopy::createStructureNodes(
requestPVStructure->getSubField<PVStructure>("_options");
PVFieldPtr pvMasterField = pvMasterStructure->getSubField(fieldName);
if(!pvMasterField) {
throw std::logic_error("did not find field in master");
throw std::logic_error("PVCopy logic error: did not find field in master");
}
size_t numberRequest = requestPVStructure->getPVFields().size();
if(pvSubFieldOptions) numberRequest--;
bool haveOptions = false;
if(pvSubFieldOptions) {
numberRequest--;
haveOptions = true;
}
if(numberRequest>0) {
nodes->push_back(createStructureNodes(
static_pointer_cast<PVStructure>(pvMasterField),
requestPVStructure,
static_pointer_cast<PVStructure>(copyPVField)));
continue;
Type copyType = copyPVField->getField()->getType();
if(copyType==epics::pvData::structure) {
nodes->push_back(createStructureNodes(
static_pointer_cast<PVStructure>(pvMasterField),
requestPVStructure,
static_pointer_cast<PVStructure>(copyPVField)));
continue;
}
if(copyType==epics::pvData::union_) {
if(numberRequest!=1) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("In the following request a union field has more than one subfield in\n");
val += ss.str();
throw std::invalid_argument(val);
}
PVUnionPtr pvUnion = static_pointer_cast<PVUnion>(pvMasterField);
std::string selectedName = pvUnion->getSelectedFieldName();
PVFieldPtrArray const & pvFields = requestPVStructure->getPVFields();
size_t len = pvFields.size();
if(len>2 || (haveOptions && len!=2)) {
std::stringstream ss;
ss << pvFromRequest << "\n";
string val("PVCopy logic error: pvRequest is\n");
val += ss.str();
throw std::logic_error(val);
}
size_t indRequestValue = 0;
if((pvFields[0]->getFieldName().compare("_options"))==0) indRequestValue = 1;
PVFieldPtr pvRequestValue = pvFields[indRequestValue];
if(pvRequestValue) {
string requestName = pvRequestValue->getFieldName();
if(requestName.compare(selectedName)!=0) {
std::stringstream ss;
ss << pvFromCopy << "\n";
string requestName = pvRequestValue->getFieldName();
string val("field ");
val += requestName + " does not match union type in\n";
val += ss.str();
throw std::invalid_argument(val);
}
}
} else {
std::stringstream ss;
ss << pvFromCopy << "\n";
string val("requested a subfield of field ");
val += fieldName + " which does not have type structure in\n";
val += ss.str();
throw std::invalid_argument(val);
}
}
CopyNodePtr node(new CopyNode());
node->options = pvSubFieldOptions;

View File

@@ -42,7 +42,6 @@ PVRecord::PVRecord(
pvStructure(pvStructure),
depthGroupPut(0),
traceLevel(0),
isDestroyed(false),
isAddListener(false)
{
}
@@ -53,13 +52,8 @@ void PVRecord::notifyClients()
epicsGuard<epics::pvData::Mutex> guard(mutex);
if(traceLevel>0) {
cout << "PVRecord::notifyClients() " << recordName
<< " isDestroyed " << (isDestroyed ? "true" : "false")
<< endl;
}
if(isDestroyed) {
return;
}
isDestroyed = true;
}
pvTimeStamp.detach();
for(std::list<PVListenerWPtr>::iterator iter = pvListenerList.begin();
@@ -115,13 +109,6 @@ void PVRecord::initPVRecord()
if(pvField) pvTimeStamp.attach(pvField);
}
void PVRecord::destroy()
{
PVDatabasePtr pvDatabase(PVDatabase::getMaster());
if(pvDatabase) pvDatabase->removeRecord(shared_from_this());
notifyClients();
}
void PVRecord::process()
{
if(traceLevel>2) {
@@ -207,9 +194,6 @@ bool PVRecord::addPVRecordClient(PVRecordClientPtr const & pvRecordClient)
cout << "PVRecord::addPVRecordClient() " << recordName << endl;
}
epicsGuard<epics::pvData::Mutex> guard(mutex);
if(isDestroyed) {
return false;
}
// clean clientList
bool clientListClean = false;
while(!clientListClean) {
@@ -243,9 +227,6 @@ bool PVRecord::addListener(
cout << "PVRecord::addListener() " << recordName << endl;
}
epicsGuard<epics::pvData::Mutex> guard(mutex);
if(isDestroyed) {
return false;
}
pvListenerList.push_back(pvListener);
this->pvListener = pvListener;
isAddListener = true;
@@ -274,9 +255,6 @@ bool PVRecord::removeListener(
cout << "PVRecord::removeListener() " << recordName << endl;
}
epicsGuard<epics::pvData::Mutex> guard(mutex);
if(isDestroyed) {
return false;
}
std::list<PVListenerWPtr>::iterator iter;
for (iter = pvListenerList.begin(); iter!=pvListenerList.end(); iter++ )
{

View File

@@ -78,10 +78,10 @@ public:
*/
virtual ~ChannelProviderLocal();
/**
* @brief Destroy the channel provider.
* @brief DEPRECATED
*
*/
virtual void destroy() EPICS_DEPRECATED {};
virtual void destroy(){};
/**
* @brief Returns the channel provider name.
*
@@ -202,10 +202,10 @@ public:
*/
virtual ~ChannelLocal();
/**
* @brief Destroy the channel.
* @brief DEPRECATED
*
*/
virtual void destroy() EPICS_DEPRECATED {};
virtual void destroy() {};
/**
* @brief Detach from the record.
*

View File

@@ -98,18 +98,9 @@ public:
*/
virtual void process();
/**
* @brief Destroy the record.
*
* Destroy the PVRecord. Release any resources used and
* get rid of listeners and requesters.
* If derived class overrides this then it must call PVRecord::destroy()
* after it has destroyed any resorces it uses.
*
* Note: for most classes destroy no longer exists or has been deprecated.
* This method makes it possible to remove a record from a database
* while the database is still running.
* @brief DEPRECATED
*/
virtual void destroy();
virtual void destroy() {}
/**
* @brief Optional method for derived class.
*
@@ -276,7 +267,6 @@ private:
epics::pvData::Mutex mutex;
std::size_t depthGroupPut;
int traceLevel;
bool isDestroyed;
// following only valid while addListener or removeListener is active.
bool isAddListener;
PVListenerWPtr pvListener;

View File

@@ -71,13 +71,13 @@ class ChannelProcessLocal :
public:
POINTER_DEFINITIONS(ChannelProcessLocal);
virtual ~ChannelProcessLocal();
virtual void destroy() {} // DEPRECATED
static ChannelProcessLocalPtr create(
ChannelLocalPtr const &channelLocal,
ChannelProcessRequester::shared_pointer const & channelProcessRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord);
virtual void process();
virtual void destroy() EPICS_DEPRECATED {};
virtual std::tr1::shared_ptr<Channel> getChannel();
virtual void cancel(){}
virtual void lock();
@@ -204,13 +204,13 @@ class ChannelGetLocal :
public:
POINTER_DEFINITIONS(ChannelGetLocal);
virtual ~ChannelGetLocal();
virtual void destroy() {} // DEPRECATED
static ChannelGetLocalPtr create(
ChannelLocalPtr const &channelLocal,
ChannelGetRequester::shared_pointer const & channelGetRequester,
PVStructurePtr const & pvRequest,
PVRecordPtr const &pvRecord);
virtual void get();
virtual void destroy() EPICS_DEPRECATED {};
virtual std::tr1::shared_ptr<Channel> getChannel();
virtual void cancel(){}
virtual void lock();
@@ -378,6 +378,7 @@ class ChannelPutLocal :
public:
POINTER_DEFINITIONS(ChannelPutLocal);
virtual ~ChannelPutLocal();
virtual void destroy() {} // DEPRECATED
static ChannelPutLocalPtr create(
ChannelLocalPtr const &channelLocal,
ChannelPutRequester::shared_pointer const & channelPutRequester,
@@ -385,7 +386,6 @@ public:
PVRecordPtr const &pvRecord);
virtual void put(PVStructurePtr const &pvStructure,BitSetPtr const &bitSet);
virtual void get();
virtual void destroy() EPICS_DEPRECATED {};
virtual std::tr1::shared_ptr<Channel> getChannel();
virtual void cancel(){}
virtual void lock();
@@ -551,6 +551,7 @@ class ChannelPutGetLocal :
public:
POINTER_DEFINITIONS(ChannelPutGetLocal);
virtual ~ChannelPutGetLocal();
virtual void destroy() {} // DEPRECATED
static ChannelPutGetLocalPtr create(
ChannelLocalPtr const &channelLocal,
ChannelPutGetRequester::shared_pointer const & channelPutGetRequester,
@@ -561,7 +562,6 @@ public:
BitSetPtr const &putBitSet);
virtual void getPut();
virtual void getGet();
virtual void destroy() EPICS_DEPRECATED {};
virtual std::tr1::shared_ptr<Channel> getChannel();
virtual void cancel(){}
virtual void lock();
@@ -769,6 +769,7 @@ class ChannelRPCLocal :
{
public:
POINTER_DEFINITIONS(ChannelRPCLocal);
virtual void destroy() {} // DEPRECATED
static ChannelRPCLocalPtr create(
ChannelLocalPtr const & channelLocal,
ChannelRPCRequester::shared_pointer const & channelRPCRequester,
@@ -805,7 +806,6 @@ public:
virtual void request(PVStructurePtr const & pvArgument);
virtual Channel::shared_pointer getChannel();
virtual void cancel() {}
virtual void destroy() EPICS_DEPRECATED {};
virtual void lock() {}
virtual void unlock() {}
virtual void lastRequest() {}
@@ -964,6 +964,7 @@ class ChannelArrayLocal :
public:
POINTER_DEFINITIONS(ChannelArrayLocal);
virtual ~ChannelArrayLocal();
virtual void destroy() {} // DEPRECATED
static ChannelArrayLocalPtr create(
ChannelLocalPtr const &channelLocal,
ChannelArrayRequester::shared_pointer const & channelArrayRequester,
@@ -975,7 +976,6 @@ public:
size_t offset, size_t count, size_t stride);
virtual void getLength();
virtual void setLength(size_t length);
virtual void destroy() EPICS_DEPRECATED {};
virtual std::tr1::shared_ptr<Channel> getChannel();
virtual void cancel(){}
virtual void lock();
@@ -1151,7 +1151,7 @@ void ChannelArrayLocal::getArray(size_t offset, size_t count, size_t stride)
pvCopy->setLength(count);
copy(pvArray,offset,stride,pvCopy,0,1,count);
}
} catch(std::exception e) {
} catch(std::exception& e) {
exceptionMessage = e.what();
}
Status status = Status::Ok;
@@ -1178,7 +1178,7 @@ void ChannelArrayLocal::putArray(
try {
epicsGuard <PVRecord> guard(*pvr);
copy(pvArray,0,1,this->pvArray,offset,stride,count);
} catch(std::exception e) {
} catch(std::exception& e) {
exceptionMessage = e.what();
}
Status status = Status::Ok;
@@ -1199,7 +1199,7 @@ void ChannelArrayLocal::getLength()
try {
epicsGuard <PVRecord> guard(*pvr);
length = pvArray->getLength();
} catch(std::exception e) {
} catch(std::exception& e) {
exceptionMessage = e.what();
}
Status status = Status::Ok;
@@ -1225,7 +1225,7 @@ void ChannelArrayLocal::setLength(size_t length)
if(pvArray->getLength()!=length) pvArray->setLength(length);
}
requester->setLengthDone(Status::Ok,getPtrSelf());
} catch(std::exception e) {
} catch(std::exception& e) {
string exceptionMessage = e.what();
Status status = Status(Status::STATUSTYPE_ERROR,exceptionMessage);
requester->setLengthDone(status,getPtrSelf());

View File

@@ -135,10 +135,10 @@ class MonitorLocal :
public:
POINTER_DEFINITIONS(MonitorLocal);
virtual ~MonitorLocal();
virtual void destroy() {} // DEPRECATED
virtual Status start();
virtual Status stop();
virtual MonitorElementPtr poll();
virtual void destroy() EPICS_DEPRECATED {};
virtual void detach(PVRecordPtr const & pvRecord){}
virtual void release(MonitorElementPtr const & monitorElement);
virtual void dataPut(PVRecordFieldPtr const & pvRecordField);

View File

@@ -23,7 +23,7 @@ TESTSPEC_vxWorks = pvDbTestHarness.$(MUNCH_SUFFIX); pvDatabaseAllTests
# Build for RTEMS, with harness code & configuration
PROD_RTEMS += pvDbTestHarness
pvDbTestHarness_SRCS_RTEMS += rtemsTestHarness.c rtemsConfig.c
pvDbTestHarness_SRCS_RTEMS += rtemsTestHarness.c
TESTSPEC_RTEMS = pvDbTestHarness.$(MUNCH_SUFFIX); pvDatabaseAllTests
# Build test scripts for hosts

View File

@@ -1,72 +0,0 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* RTEMS configuration for EPICS
* Revision-Id: anj@aps.anl.gov-20101005192737-disfz3vs0f3fiixd
* Author: W. Eric Norum
* norume@aps.anl.gov
* (630) 252-4793
*/
#include <rtems.h>
/*
***********************************************************************
* RTEMS CONFIGURATION *
***********************************************************************
*/
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#if __RTEMS_MAJOR__>4 || (__RTEMS_MAJOR__==4 && __RTEMS_MINOR__>9) || (__RTEMS_MAJOR__==4 && __RTEMS_MINOR__==9 && __RTEMS_REVISION__==99)
# define CONFIGURE_UNIFIED_WORK_AREAS
#else
# define CONFIGURE_EXECUTIVE_RAM_SIZE (2000*1024)
#endif
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(30)
#define CONFIGURE_MAXIMUM_SEMAPHORES rtems_resource_unlimited(500)
#define CONFIGURE_MAXIMUM_TIMERS rtems_resource_unlimited(20)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES rtems_resource_unlimited(5)
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 150
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_MAXIMUM_DRIVERS 8
#define CONFIGURE_MICROSECONDS_PER_TICK 20000
#define CONFIGURE_INIT_TASK_PRIORITY 80
#define CONFIGURE_MALLOC_STATISTICS 1
#define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
RTEMS_NO_TIMESLICE | \
RTEMS_NO_ASR | \
RTEMS_INTERRUPT_LEVEL(0))
#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_LOCAL)
#define CONFIGURE_INIT_TASK_STACK_SIZE (16*1024)
rtems_task Init (rtems_task_argument argument);
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_FILESYSTEM_NFS
#define CONFIGURE_FILESYSTEM_IMFS
/*
* This should be made BSP dependent, not CPU dependent but I know of no
* appropriate conditionals to use.
* The new general time support makes including the RTC driver less important.
*/
#if !defined(mpc604) && !defined(__mc68040__) && !defined(__mcf5200__) && !defined(mpc7455) && !defined(__arm__) /* don't have RTC code */
#define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
#endif
#include <bsp.h>
#include <rtems/confdefs.h>

View File

@@ -1,294 +0,0 @@
/*
* Network configuration -- QEMU NOT using DHCP
*
************************************************************
* EDIT THIS FILE TO REFLECT YOUR NETWORK CONFIGURATION *
* BEFORE RUNNING ANY RTEMS PROGRAMS WHICH USE THE NETWORK! *
************************************************************
*
* The dynamic probing is based upon the EPICS network
* configuration file written by:
* W. Eric Norum
* eric.norum@usask.ca
* (306) 966-5394
*/
#ifndef _RTEMS_NETWORKCONFIG_H_
#define _RTEMS_NETWORKCONFIG_H_
/* #define USE_LIBBSDPORT */
#if defined(USE_LIBBSDPORT)
#include <bsp/libbsdport_api.h>
#define CONFIGURE_MAXIMUM_TIMERS 10
#endif
/*
* For TFTP test application
*/
#if (defined (RTEMS_USE_BOOTP))
#define RTEMS_TFTP_TEST_HOST_NAME "BOOTP_HOST"
#define RTEMS_TFTP_TEST_FILE_NAME "BOOTP_FILE"
#else
#define RTEMS_TFTP_TEST_HOST_NAME "XXX.YYY.ZZZ.XYZ"
#define RTEMS_TFTP_TEST_FILE_NAME "tftptest"
#endif
/*
* For NFS test application
*
* NFS mount and a directory to ls once mounted
*/
#define RTEMS_NFS_SERVER "192.168.1.210"
#define RTEMS_NFS_SERVER_PATH "/home"
#define RTEMS_NFS_LS_PATH "/mnt/nfstest"
/*
* This file can be copied to an application source directory
* and modified to override the values shown below.
*
* The following CPP symbols may be passed from the Makefile:
*
* symbol default description
*
* NETWORK_TASK_PRIORITY 150 can be read by app from public
* var 'gesysNetworkTaskPriority'
* FIXED_IP_ADDR <undefined> hardcoded IP address (e.g.,
* "192.168.0.10"); disables BOOTP;
* must also define FIXED_NETMASK
* FIXED_NETMASK <undefined> IP netmask string
* (e.g. "255.255.255.0")
* MULTI_NETDRIVER <undefined> ugly hack; if defined try to probe
* a variety of PCI and ISA drivers
* (i386 ONLY) use is discouraged!
* NIC_NAME <undefined> Ethernet driver name (e.g. "pcn1");
* must also define NIC_ATTACH
* NIC_ATTACH <undefined> Ethernet driver attach function
* (e.g., rtems_fxp_attach).
* If these are undefined then
* a) MULTI_NETDRIVER is used
* (if defined)
* b) RTEMS_BSP_NETWORK_DRIVER_NAME/
* RTEMS_BSP_NETWORK_DRIVER_ATTACH
* are tried
* MEMORY_CUSTOM <undefined> Allocate the defined amount of
* memory for mbufs and mbuf clusters,
* respectively. Define to a comma ','
* separated pair of two numerical
* values, e.g: 100*1024,200*1024
* MEMORY_SCARCE <undefined> Allocate few memory for mbufs
* (hint for how much memory the
* board has)
* MEMORY_HUGE <undefined> Allocate a lot of memory for mbufs
* (hint for how much memory the
* board has)
* If none of MEMORY_CUSTOM/
* MEMORY_SCARCE/MEMORY_HUGE are
* defined then a medium amount of
* memory is allocated for mbufs.
*/
#include <rtems/bspIo.h>
#include <bsp.h>
#include <rtems/rtems_bsdnet.h>
#if 0
#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#include "verscheck.h"
#endif
#endif
//#define MULTI_NETDRIVER
//#define RTEMS_BSP_NETWORK_DRIVER_NAME 1
#define FIXED_IP_ADDR "192.168.1.249"
#define FIXED_NETMASK "255.255.255.0"
#ifndef NETWORK_TASK_PRIORITY
#define NETWORK_TASK_PRIORITY 150 /* within EPICS' range */
#endif
/* make publicly available for startup scripts... */
const int gesysNetworkTaskPriority = NETWORK_TASK_PRIORITY;
#ifdef FIXED_IP_ADDR
#define RTEMS_DO_BOOTP 0
#else
#define RTEMS_DO_BOOTP rtems_bsdnet_do_bootp
#define FIXED_IP_ADDR 0
#undef FIXED_NETMASK
#define FIXED_NETMASK 0
#endif
#if !defined(NIC_NAME)
#ifdef MULTI_NETDRIVER
#if 0
#if RTEMS_VERSION_ATLEAST(4,6,99)
#define pcib_init pci_initialize
#endif
#endif
extern int rtems_3c509_driver_attach (struct rtems_bsdnet_ifconfig *, int);
extern int rtems_fxp_attach (struct rtems_bsdnet_ifconfig *, int);
extern int rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *, int);
extern int rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *, int);
/* these don't probe and will be used even if there's no device :-( */
extern int rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *, int);
extern int rtems_wd_driver_attach (struct rtems_bsdnet_ifconfig *, int);
static struct rtems_bsdnet_ifconfig isa_netdriver_config[] = {
{
"ep0", rtems_3c509_driver_attach, isa_netdriver_config + 1,
},
{
"ne1", rtems_ne_driver_attach, 0, irno: 9 /* qemu cannot configure irq-no :-(; has it hardwired to 9 */
},
};
static struct rtems_bsdnet_ifconfig pci_netdriver_config[]={
{
"dc1", rtems_dec21140_driver_attach, pci_netdriver_config+1,
},
#if !defined(USE_LIBBSDPORT)
{
"fxp1", rtems_fxp_attach, pci_netdriver_config+2,
},
#else
{
"", libbsdport_netdriver_attach, pci_netdriver_config+2,
},
#endif
{
"elnk1", rtems_elnk_driver_attach, isa_netdriver_config,
},
};
static int pci_check(struct rtems_bsdnet_ifconfig *ocfg, int attaching)
{
struct rtems_bsdnet_ifconfig *cfg;
int if_index_pre;
extern int if_index;
if ( attaching ) {
cfg = pci_initialize() ?
isa_netdriver_config : pci_netdriver_config;
}
while ( cfg ) {
printk("Probing '%s'", cfg->name);
/* unfortunately, the return value is unreliable - some drivers report
* success even if they fail.
* Check if they chained an interface (ifnet) structure instead
*/
if_index_pre = if_index;
cfg->attach(cfg, attaching);
if ( if_index > if_index_pre ) {
/* assume success */
printk(" .. seemed to work\n");
ocfg->name = cfg->name;
ocfg->attach = cfg->attach;
return 0;
}
printk(" .. failed\n");
cfg = cfg->next;
}
return -1;
}
#define NIC_NAME "dummy"
#define NIC_ATTACH pci_check
#else
#if defined(RTEMS_BSP_NETWORK_DRIVER_NAME) /* Use NIC provided by BSP */
/* force ne2k_isa on i386 for qemu */
#if defined(__i386__)
# define NIC_NAME BSP_NE2000_NETWORK_DRIVER_NAME
# define NIC_ATTACH BSP_NE2000_NETWORK_DRIVER_ATTACH
#else
# define NIC_NAME RTEMS_BSP_NETWORK_DRIVER_NAME
# define NIC_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH
#endif
#endif
#endif /* ifdef MULTI_NETDRIVER */
#endif
#ifdef NIC_NAME
extern int NIC_ATTACH();
#if RTEMS_BSP_NETWORK_DRIVER_ATTACH == BSP_NE2000_NETWORK_DRIVER_ATTACH
static char ethernet_address[6] = { 0x00, 0xab, 0xcd, 0xef, 0x12, 0x34 };
#endif
static struct rtems_bsdnet_ifconfig netdriver_config[1] = {{
NIC_NAME, /* name */
(int (*)(struct rtems_bsdnet_ifconfig*,int))NIC_ATTACH, /* attach function */
0, /* link to next interface */
FIXED_IP_ADDR,
FIXED_NETMASK
#if RTEMS_BSP_NETWORK_DRIVER_ATTACH == BSP_NE2000_NETWORK_DRIVER_ATTACH
,
ethernet_address,
irno:9,
port:0xc100
#endif
}};
#else
#warning "NO KNOWN NETWORK DRIVER FOR THIS BSP -- YOU MAY HAVE TO EDIT networkconfig.h"
#endif
struct rtems_bsdnet_config rtems_bsdnet_config = {
#ifdef NIC_NAME
netdriver_config, /* link to next interface */
RTEMS_DO_BOOTP, /* Use BOOTP to get network configuration */
#else
0,
0,
#endif
NETWORK_TASK_PRIORITY, /* Network task priority */
#if defined(MEMORY_CUSTOM)
MEMORY_CUSTOM,
#elif defined(MEMORY_SCARCE)
100*1024, /* MBUF space */
200*1024, /* MBUF cluster space */
#elif defined(MEMORY_HUGE)
2*1024*1024, /* MBUF space */
5*1024*1024, /* MBUF cluster space */
#else
180*1024, /* MBUF space */
350*1024, /* MBUF cluster space */
#endif
#if (!defined (RTEMS_USE_BOOTP)) && defined(ON_RTEMS_LAB_WINSYSTEMS)
"rtems", /* Host name */
"nodomain.com", /* Domain name */
"192.168.1.14", /* Gateway */
"192.168.1.1", /* Log host */
{"89.212.75.6" }, /* Name server(s) */
{"192.168.1.1" }, /* NTP server(s) */
#else
NULL, /* Host name */
NULL, /* Domain name */
NULL, /* Gateway */
NULL, /* Log host */
{ NULL }, /* Name server(s) */
{ NULL }, /* NTP server(s) */
#endif /* !RTEMS_USE_BOOTP */
0, /* efficiency */
0, /* udp TX buffer */
0, /* udp RX buffer */
0, /* tcp TX buffer */
0, /* tcp RX buffer */
};
#endif /* _RTEMS_NETWORKCONFIG_H_ */

View File

@@ -1,36 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <rtems/rtems_bsdnet.h>
#include <rtems/error.h>
#include "rtemsNetworking.h"
#include <osdTime.h>
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
extern void pvDatabaseAllTests(void);
rtems_task
Init (rtems_task_argument ignored)
int main(int argc, char **argv)
{
rtems_bsdnet_initialize_network ();
//rtems_bsdnet_show_if_stats ();
rtems_time_of_day timeOfDay;
if (rtems_clock_get(RTEMS_CLOCK_GET_TOD,&timeOfDay) != RTEMS_SUCCESSFUL) {
timeOfDay.year = 2014;
timeOfDay.month = 1;
timeOfDay.day = 1;
timeOfDay.hour = 0;
timeOfDay.minute = 0;
timeOfDay.second = 0;
timeOfDay.ticks = 0;
rtems_status_code ret = rtems_clock_set(&timeOfDay);
if (ret != RTEMS_SUCCESSFUL) {
printf("**** Can't set time %s\n", rtems_status_text(ret));
}
}
osdTimeRegister();
pvDatabaseAllTests();
return 0;
}