Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
EPICS support for Wishbone peripherals
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
EPICS support for Wishbone peripherals
Commits
5c217a8e
Commit
5c217a8e
authored
Aug 18, 2015
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: improve recursivity of isValid() function
parent
e3d669f5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
8 deletions
+43
-8
EWBField.cpp
src/ewbcore/EWBField.cpp
+18
-0
EWBField.h
src/ewbcore/EWBField.h
+1
-2
EWBParamStrCmd.cpp
src/ewbcore/EWBParamStrCmd.cpp
+2
-2
EWBParamStrCmd.h
src/ewbcore/EWBParamStrCmd.h
+1
-1
EWBPeriph.h
src/ewbcore/EWBPeriph.h
+1
-1
EWBReg.cpp
src/ewbcore/EWBReg.cpp
+18
-0
EWBReg.h
src/ewbcore/EWBReg.h
+1
-1
EWBSync.h
src/ewbcore/EWBSync.h
+1
-1
No files found.
src/ewbcore/EWBField.cpp
View file @
5c217a8e
...
...
@@ -429,6 +429,24 @@ bool EWBField::sync(EWBSync::AMode amode)
return
ret
;
}
/**
* Return @true if this EWBField is valid.
*
* @note To be fully valid the EWBField must be connected to
* EWBBridge in order to sync with the device, you can use level
* to check if it is valid.
* EWBBride (0) < EWBBus (1) < EWBPeriph (2) < EWBReg (3) < EWBField (4)
*
*
* @param[in] level check the validity in each level.
* This check is stopped when it reaches 0 (never when staring at -1)
*/
bool
EWBField
::
isValid
(
int
level
)
const
{
if
(
level
!=
0
)
return
(
pReg
&&
pReg
->
isValid
(
level
-
1
));
else
return
pReg
;
}
/**
* operator that print the data of the EWBField in a stream
*/
...
...
src/ewbcore/EWBField.h
View file @
5c217a8e
...
...
@@ -89,8 +89,7 @@ public:
const
EWBReg
*
getReg
()
const
{
return
pReg
;
}
//!< Get the linked register (RO)
EWBReg
*
getReg
()
{
return
pReg
;
}
//!< Get the linked register
bool
isOverflowPrevented
()
const
{
return
checkOverflow
;
}
//!< When true prevent overflow during FP conversion \ref regCvt(), \ ref convert()
bool
isValid
()
const
{
return
isValid
(
true
);
}
bool
isValid
(
bool
connected
)
const
{
return
(
pReg
&&
pReg
->
isValid
(
connected
));
}
bool
isValid
(
int
level
=-
1
)
const
;
protected
:
void
getLimit
(
float
&
fmin
,
float
&
fmax
);
...
...
src/ewbcore/EWBParamStrCmd.cpp
View file @
5c217a8e
...
...
@@ -45,9 +45,9 @@ EWBParamStrCmd::~EWBParamStrCmd()
}
bool
EWBParamStrCmd
::
isValid
()
const
bool
EWBParamStrCmd
::
isValid
(
int
level
)
const
{
return
(
pConsole
&&
pConsole
->
isValid
())
;
return
(
level
!=
0
)
?
(
pConsole
&&
pConsole
->
isValid
())
:
pConsole
!=
NULL
;
}
...
...
src/ewbcore/EWBParamStrCmd.h
View file @
5c217a8e
...
...
@@ -24,7 +24,7 @@ public:
virtual
~
EWBParamStrCmd
();
const
std
::
string
&
getValue
()
const
{
return
value
;
}
//!< Get the name
bool
sync
(
EWBSync
::
AMode
mode
);
bool
isValid
()
const
;
bool
isValid
(
int
level
=-
1
)
const
;
protected
:
...
...
src/ewbcore/EWBPeriph.h
View file @
5c217a8e
...
...
@@ -39,11 +39,11 @@ public:
// bool sync(uint32_t* pData32, uint32_t length, EWBSync::AMode amode, uint32_t doffset=0);
int
getID
()
const
{
return
this
->
ID
;
}
//!< Get ID of WBPeriph
bool
isValid
(
int
level
=-
1
)
const
{
return
(
level
!=
0
)
?
(
bus
&&
bus
->
isValid
(
level
-
1
))
:
bus
!=
NULL
;
}
//!< Return true when all pointers are defined
int
getIndex
()
const
{
return
this
->
index
;
}
//!< Get unique index of WBPeriph
const
std
::
string
&
getName
()
const
{
return
this
->
name
;
}
//!< Get the name
const
char
*
getCName
()
const
{
return
this
->
name
.
c_str
();
}
//!< Get the name in "C" format for printf function
const
std
::
string
&
getDesc
()
const
{
return
this
->
desc
;
}
//!< Get the description
bool
isValid
(
bool
connected
=
true
)
const
{
return
(
bus
&&
bus
->
isValid
(
connected
));
}
//!< Return true when all pointers are defined
const
EWBBridge
*
getBridge
()
const
{
return
(
bus
)
?
bus
->
getBridge
()
:
0
;
}
EWBBridge
*
getBridge
()
{
return
(
bus
)
?
bus
->
getBridge
()
:
0
;
}
...
...
src/ewbcore/EWBReg.cpp
View file @
5c217a8e
...
...
@@ -147,6 +147,24 @@ bool EWBReg::sync(EWBSync::AMode amode)
return
ret
;
}
/**
* Return @true if this EWBReg is valid.
*
* @note To be fully valid the register must be connected to
* EWBBridge in order to sync with the device, you can use level
* to check if it is valid.
* EWBBride (0) < EWBBus (1) < EWBPeriph (2) < EWBReg (3) < EWBField (4)
*
*
* @param[in] level check the validity in each level.
* This check is stopped when it reaches 0 (never when staring at -1)
*/
bool
EWBReg
::
isValid
(
int
level
)
const
{
if
(
level
!=
0
)
return
(
pPeriph
&&
pPeriph
->
isValid
(
level
-
1
));
else
return
pPeriph
;
}
/**
* Return the offset of the register
...
...
src/ewbcore/EWBReg.h
View file @
5c217a8e
...
...
@@ -48,7 +48,7 @@ public:
const
std
::
string
&
getName
()
const
{
return
this
->
name
;
}
//!< Get the name
const
char
*
getCName
()
const
{
return
this
->
name
.
c_str
();
}
//!< Get the name in "C" format for printf function
const
std
::
string
&
getDesc
()
const
{
return
this
->
desc
;
}
//!< Get the description
bool
isValid
(
bool
connected
=
true
)
const
{
return
(
pPeriph
&&
pPeriph
->
isValid
(
connected
));
}
bool
isValid
(
int
level
=-
1
)
const
;
protected
:
EWBPeriph
*
getPeriph
()
{
return
pPeriph
;
}
...
...
src/ewbcore/EWBSync.h
View file @
5c217a8e
...
...
@@ -24,7 +24,7 @@ public:
virtual
~
EWBSync
()
{};
virtual
bool
sync
(
EWBSync
::
AMode
mode
)
=
0
;
virtual
bool
isValid
()
const
=
0
;
virtual
bool
isValid
(
int
level
=-
1
)
const
=
0
;
void
setForceSync
(
bool
val
=
true
)
{
this
->
forceSync
=
val
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment