Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
176f16a7
Commit
176f16a7
authored
Mar 18, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/snmpd: add wrsOSStatus
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
e09b3e97
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
1 deletion
+69
-1
Makefile
userspace/snmpd/Makefile
+1
-1
init.c
userspace/snmpd/init.c
+2
-0
wrsOSStatus.c
userspace/snmpd/wrsOSStatus.c
+49
-0
wrsOSStatus.h
userspace/snmpd/wrsOSStatus.h
+17
-0
No files found.
userspace/snmpd/Makefile
View file @
176f16a7
...
...
@@ -24,7 +24,7 @@ CFLAGS += -I../include -I../libwr/include -I../ppsi/include -I../ppsi/arch-wrs/i
CFLAGS
+=
-DWRS_WITH_SNMP_HACKISH_LOG
=
0
SHLIB
=
wrsSnmp.so
SOURCES
=
init.c wrsScalar.c wrsPstats.c wrsPpsi.c wrsVersion.c wrsDate.c shmem.c wrsPtpData.c wrsTemperature.c
SOURCES
=
init.c wrsScalar.c wrsPstats.c wrsPpsi.c wrsVersion.c wrsDate.c shmem.c wrsPtpData.c wrsTemperature.c
wrsOSStatus.c
OBJECTS
=
$
(
SOURCES:.c
=
.o
)
all
:
$(SHLIB)
...
...
userspace/snmpd/init.c
View file @
176f16a7
...
...
@@ -8,6 +8,7 @@
/* The sub-init functions */
#include "wrsSnmp.h"
#include "wrsTemperature.h"
#include "wrsOSStatus.h"
FILE
*
wrs_logf
;
/* for the local-hack messages */
...
...
@@ -20,4 +21,5 @@ void init_wrsSnmp(void)
init_wrsDate
();
init_wrsPtpData
();
init_wrsTemperature
();
init_wrsOSStatus
();
}
userspace/snmpd/wrsOSStatus.c
0 → 100644
View file @
176f16a7
#include "wrsSnmp.h"
#include "wrsTemperature.h"
#include "wrsOSStatus.h"
static
struct
pickinfo
wrsOSStatus_pickinfo
[]
=
{
FIELD
(
wrsOSStatus_s
,
ASN_INTEGER
,
wrsBootSuccessful
),
FIELD
(
wrsOSStatus_s
,
ASN_INTEGER
,
wrsTemperatureWarning
),
};
struct
wrsOSStatus_s
wrsOSStatus_s
;
int
wrsOSStatus_data_fill
(
void
)
{
wrsTemperature_data_fill
();
memset
(
&
wrsOSStatus_s
,
0
,
sizeof
(
wrsOSStatus_s
));
/* wrsTemperatureWarning */
if
(
!
wrsTemperature_s
.
temp_fpga_thold
&&
!
wrsTemperature_s
.
temp_pll_thold
&&
!
wrsTemperature_s
.
temp_psl_thold
&&
!
wrsTemperature_s
.
temp_psr_thold
)
{
/* no threshold are set */
wrsOSStatus_s
.
wrsTemperatureWarning
=
WRS_TEMPERATURE_WARNING_THOLD_NOT_SET
;
}
else
{
/* rise warning when at least one threshold level
* is exceeded, add 2, since 0 is readings not available, 1 is
* no threshold set (WRS_TEMPERATURE_WARNING_THOLD_NOT_SET)
* 2 is ok (WRS_TEMPERATURE_WARNING_OK), 3 is temperature too
* high (WRS_TEMPERATURE_WARNING_TOO_HIGH) */
wrsOSStatus_s
.
wrsTemperatureWarning
=
2
+
((
wrsTemperature_s
.
temp_fpga
>
wrsTemperature_s
.
temp_fpga_thold
)
||
(
wrsTemperature_s
.
temp_pll
>
wrsTemperature_s
.
temp_pll_thold
)
||
(
wrsTemperature_s
.
temp_psl
>
wrsTemperature_s
.
temp_psl_thold
)
||
(
wrsTemperature_s
.
temp_psr
>
wrsTemperature_s
.
temp_psr_thold
));
}
/* there was an update, return 0 */
return
0
;
}
#define GT_OID WRS_OID, 6, 3
#define GT_PICKINFO wrsOSStatus_pickinfo
#define GT_DATA_FILL_FUNC wrsOSStatus_data_fill
#define GT_DATA_STRUCT wrsOSStatus_s
#define GT_GROUP_NAME "wrsOSStatus"
#define GT_INIT_FUNC init_wrsOSStatus
#include "wrsGroupTemplate.h"
userspace/snmpd/wrsOSStatus.h
0 → 100644
View file @
176f16a7
#ifndef WRS_WRS_OSSTATUS_H
#define WRS_WRS_OSSTATUS_H
#define WRS_TEMPERATURE_WARNING_THOLD_NOT_SET 1
/* warning */
#define WRS_TEMPERATURE_WARNING_OK 2
/* ok */
#define WRS_TEMPERATURE_WARNING_TOO_HIGH 3
/* warning */
struct
wrsOSStatus_s
{
int
wrsBootSuccessful
;
int
wrsTemperatureWarning
;
};
extern
struct
wrsOSStatus_s
wrsOSStatus_s
;
int
wrsOSStatus_data_fill
(
void
);
void
init_wrsOSStatus
(
void
);
#endif
/* WRS_WRS_OSSTATUS_H */
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