Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
17cf3d21
Commit
17cf3d21
authored
Jan 22, 2012
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IO SPI update
parent
693f42fb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
otherio/lib/rt/src/os_linux/rt_io_m_spi_slave.c
otherio/lib/rt/src/os_linux/rt_io_m_spi_slave.c
+25
-8
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_spi_slave.c
View file @
17cf3d21
...
@@ -213,8 +213,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
...
@@ -213,8 +213,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
io_sLocalSPI_Slave
*
local
=
(
io_sLocalSPI_Slave
*
)
cp
->
Local
;
io_sLocalSPI_Slave
*
local
=
(
io_sLocalSPI_Slave
*
)
cp
->
Local
;
pwr_sClass_SPI_Slave
*
op
=
(
pwr_sClass_SPI_Slave
*
)
cp
->
op
;
pwr_sClass_SPI_Slave
*
op
=
(
pwr_sClass_SPI_Slave
*
)
cp
->
op
;
int
sts
;
int
sts
;
int
i
;
sts
=
read
(
local
->
fd
,
local
->
input_area
,
local
->
input_area_size
);
// sts = read( local->fd, local->input_area, local->input_area_size);
for
(
i
=
0
;
i
<
local
->
input_area_size
;
i
++
)
{
sts
=
read
(
local
->
fd
,
&
local
->
input_area
[
i
],
1
);
if
(
sts
!=
1
)
break
;
}
if
(
sts
<
0
)
{
if
(
sts
<
0
)
{
op
->
ErrorCount
++
;
op
->
ErrorCount
++
;
if
(
!
local
->
readerror_logged
)
{
if
(
!
local
->
readerror_logged
)
{
...
@@ -223,7 +229,8 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
...
@@ -223,7 +229,8 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
}
}
op
->
Status
=
IOM__SPI_READERROR
;
op
->
Status
=
IOM__SPI_READERROR
;
}
}
else
if
(
sts
<
local
->
input_area_size
)
{
//else if ( sts != local->input_area_size) {
else
if
(
sts
==
0
)
{
op
->
ErrorCount
++
;
op
->
ErrorCount
++
;
if
(
!
local
->
readerror_logged
)
{
if
(
!
local
->
readerror_logged
)
{
errh_Error
(
"SPI read buffer smaller than expected: %d, '%s'"
,
sts
,
cp
->
Name
);
errh_Error
(
"SPI read buffer smaller than expected: %d, '%s'"
,
sts
,
cp
->
Name
);
...
@@ -238,11 +245,13 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
...
@@ -238,11 +245,13 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
}
}
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
&&
!
local
->
softlimit_logged
)
{
if
(
op
->
ErrorSoftLimit
&&
op
->
ErrorCount
==
op
->
ErrorSoftLimit
&&
!
local
->
softlimit_logged
)
{
errh_Warning
(
"IO Card ErrorSoftLimit reached, '%s'"
,
cp
->
Name
);
errh_Warning
(
"IO Card ErrorSoftLimit reached, '%s'"
,
cp
->
Name
);
local
->
softlimit_logged
=
1
;
local
->
softlimit_logged
=
1
;
}
}
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
if
(
op
->
ErrorHardLimit
&&
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
errh_Error
(
"IO Card ErrorHardLimit reached '%s', IO stopped"
,
cp
->
Name
);
errh_Error
(
"IO Card ErrorHardLimit reached '%s', IO stopped"
,
cp
->
Name
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
return
IO__ERRDEVICE
;
...
@@ -259,11 +268,17 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
...
@@ -259,11 +268,17 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
io_sLocalSPI_Slave
*
local
=
(
io_sLocalSPI_Slave
*
)
cp
->
Local
;
io_sLocalSPI_Slave
*
local
=
(
io_sLocalSPI_Slave
*
)
cp
->
Local
;
pwr_sClass_SPI_Slave
*
op
=
(
pwr_sClass_SPI_Slave
*
)
cp
->
op
;
pwr_sClass_SPI_Slave
*
op
=
(
pwr_sClass_SPI_Slave
*
)
cp
->
op
;
int
sts
;
int
sts
;
int
i
;
io_bus_card_write
(
ctx
,
cp
,
local
->
output_area
,
io_bus_card_write
(
ctx
,
cp
,
local
->
output_area
,
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
local
->
byte_ordering
,
pwr_eFloatRepEnum_FloatIEEE
);
sts
=
write
(
local
->
fd
,
local
->
output_area
,
local
->
output_area_size
);
// sts = write( local->fd, local->output_area, local->output_area_size);
for
(
i
=
0
;
i
<
local
->
output_area_size
;
i
++
)
{
sts
=
write
(
local
->
fd
,
&
local
->
output_area
[
i
],
1
);
if
(
sts
!=
1
)
break
;
}
if
(
sts
<
0
)
{
if
(
sts
<
0
)
{
op
->
ErrorCount
++
;
op
->
ErrorCount
++
;
if
(
!
local
->
writeerror_logged
)
{
if
(
!
local
->
writeerror_logged
)
{
...
@@ -272,7 +287,8 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
...
@@ -272,7 +287,8 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
}
}
op
->
Status
=
IOM__SPI_WRITEERROR
;
op
->
Status
=
IOM__SPI_WRITEERROR
;
}
}
else
if
(
sts
!=
local
->
output_area_size
)
{
// else if ( sts != local->output_area_size) {
else
if
(
sts
==
0
)
{
op
->
ErrorCount
++
;
op
->
ErrorCount
++
;
if
(
!
local
->
writeerror_logged
)
{
if
(
!
local
->
writeerror_logged
)
{
errh_Error
(
"SPI write buffer unexpected size %d, '%s'"
,
sts
,
cp
->
Name
);
errh_Error
(
"SPI write buffer unexpected size %d, '%s'"
,
sts
,
cp
->
Name
);
...
@@ -285,11 +301,12 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
...
@@ -285,11 +301,12 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
op
->
Status
=
IOM__SPI_NORMAL
;
op
->
Status
=
IOM__SPI_NORMAL
;
}
}
if
(
op
->
ErrorCount
==
op
->
ErrorSoftLimit
&&
!
local
->
softlimit_logged
)
{
if
(
op
->
ErrorSoftLimit
&&
op
->
ErrorCount
==
op
->
ErrorSoftLimit
&&
!
local
->
softlimit_logged
)
{
errh_Warning
(
"IO Card ErrorSoftLimit reached, '%s'"
,
cp
->
Name
);
errh_Warning
(
"IO Card ErrorSoftLimit reached, '%s'"
,
cp
->
Name
);
local
->
softlimit_logged
=
1
;
local
->
softlimit_logged
=
1
;
}
}
if
(
op
->
ErrorCount
>=
op
->
ErrorHardLimit
)
{
if
(
op
->
Error
HardLimit
&&
op
->
Error
Count
>=
op
->
ErrorHardLimit
)
{
errh_Error
(
"IO Card ErrorHardLimit reached '%s', IO stopped"
,
cp
->
Name
);
errh_Error
(
"IO Card ErrorHardLimit reached '%s', IO stopped"
,
cp
->
Name
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
return
IO__ERRDEVICE
;
...
...
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