Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
966756e1
Commit
966756e1
authored
Mar 15, 2024
by
Konstantinos Asteriou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed definitions from header file to avoid compiler error
parent
752e61f1
Pipeline
#5314
passed with stage
in 4 minutes and 31 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
80 deletions
+78
-80
board.c
boards/spec7/board.c
+75
-71
board.h
boards/spec7/board.h
+3
-6
snmp.c
lib/snmp.c
+0
-3
No files found.
boards/spec7/board.c
View file @
966756e1
...
...
@@ -39,6 +39,78 @@ static spll_gain_schedule_t spll_main_ocxo_gain_sched;
struct
spec7_board
board
;
#if defined(CONFIG_SNMP) && defined(SNMP_SET)
/* Functions and variables used by the SNMP protocol to control the timing output */
static
const
uint8_t
oid_wrpcSelGroup0
[]
=
{
1
,
0
};
static
const
uint8_t
oid_wrpcSelGroup1
[]
=
{
2
,
0
};
/* oid_wprcBoardSpecific*/
const
uint8_t
oid_wrpcBoardSpecificGroup
[]
=
{
0x2B
,
6
,
1
,
4
,
1
,
96
,
101
,
1
,
13
};
/* wrpcBoardSpecificGroup array */
const
struct
snmp_oid
oid_array_wrpcBoardSpecificGroup
[]
=
{
OID_FIELD_VAR
(
oid_wrpcSelGroup0
,
get_select_group
,
set_select_group
,
ASN_INTEGER
,
&
(
board
.
gpio_tim_main_board
)),
OID_FIELD_VAR
(
oid_wrpcSelGroup1
,
get_select_group
,
set_select_group
,
ASN_INTEGER
,
&
(
board
.
gpio_tim_main_board
)),
{
0
,
}
};
int
set_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
){
static
const
int
sel_group_offset
=
3
;
uint8_t
io_stat
;
uint8_t
len
=
buf
[
1
];
uint8_t
*
oid_data
=
buf
+
2
;
uint8_t
sel_group
=
*
(
buf
-
2
)
+
sel_group_offset
;
// add offset to get the appropriate value from board.h
uint8_t
sel_group_reg
=
WBGEN2_GEN_MASK
(
sel_group
,
1
);
uint8_t
asn_incoming
=
buf
[
0
];
uint8_t
asn_expected
=
obj
->
asn
;
uint32_t
tmp_u32
;
if
(
asn_incoming
!=
asn_expected
)
{
/* wrong data type */
snmp_verbose
(
"%s: wrong asn 0x%02x, expected 0x%02x
\n
"
,
__func__
,
asn_incoming
,
asn_expected
);
return
-
SNMP_ERR_BADVALUE
;
}
io_stat
=
pca9554_read_reg
(
obj
->
p
,
PCA9554_REG_OUT
);
memcpy
(
&
tmp_u32
,
oid_data
,
len
);
tmp_u32
=
ntohl
(
tmp_u32
);
/* move data when shorter than 4 bytes */
tmp_u32
=
tmp_u32
>>
((
4
-
len
)
*
8
);
if
(
tmp_u32
){
pca9554_write_reg
(
obj
->
p
,
PCA9554_REG_OUT
,
io_stat
|
sel_group_reg
);
}
else
{
pca9554_write_reg
(
obj
->
p
,
PCA9554_REG_OUT
,
io_stat
&
~
sel_group_reg
);
}
return
len
+
2
;
}
int
get_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
){
static
const
int
sel_group_offset
=
3
;
uint8_t
*
oid_data
=
buf
+
2
;
uint8_t
*
len
=
&
buf
[
1
];
uint32_t
on
=
htonl
(
1
);
uint32_t
off
=
htonl
(
0
);
uint8_t
sel_group
=
*
(
buf
-
2
)
+
sel_group_offset
;
// add offset to get the appropriate value from board.h
uint8_t
reg_stat
=
pca9554_read_reg
(
obj
->
p
,
PCA9554_REG_OUT
);
uint8_t
sel_group_reg
=
WBGEN2_GEN_MASK
(
sel_group
,
1
);
uint8_t
sel_group_status
=
reg_stat
&
sel_group_reg
;
*
len
=
sizeof
(
uint32_t
);
buf
[
0
]
=
obj
->
asn
;
if
(
sel_group_status
){
memcpy
((
char
*
)
oid_data
,
&
on
,
*
len
);
}
else
{
memcpy
((
char
*
)
oid_data
,
&
off
,
*
len
);
}
return
*
len
+
2
;
}
#endif
static
struct
gpio_pin
pin_pll_cs_n_o
=
{
&
board
.
gpio_aux
,
0
};
static
struct
gpio_pin
pin_pll_mosi_o
=
{
&
board
.
gpio_aux
,
1
};
static
struct
gpio_pin
pin_pll_miso_i
=
{
&
board
.
gpio_aux
,
2
};
...
...
@@ -72,8 +144,6 @@ timeout_t pll_sync_timeout;
//#define CONFIG_HPSEC_GM
#undef CONFIG_HPSEC_GM
//volatile struct softpll_state softpll;
static
void
spec7_spll_setup
(
void
)
{
...
...
@@ -164,12 +234,13 @@ void gpio_control_init()
board_dbg
(
"Initializing GPIO control...
\n
"
);
pca9554_write_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_CONFIG
,
0x00
);
// Configure all IO as output
pca9554_write_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_OUT
,
0x00
);
// LEDs, SEL_GROUP_0/1 and SEL_IRIG_B all '0'
for
(
i
=
0
;
i
<
5
;
i
++
)
{
{
io_stat
=
pca9554_read_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_OUT
);
pca9554_write_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_OUT
,
io_stat
|
TIM_MAIN_BOARD_LED_3
);
timer_delay_ms
(
100
);
io_stat
=
pca9554_read_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_OUT
);
pca9554_write_reg
(
&
board
.
gpio_tim_main_board
,
PCA9554_REG_OUT
,
io_stat
&
~
TIM_MAIN_BOARD_LED_3
);
timer_delay_ms
(
100
);
}
...
...
@@ -278,73 +349,6 @@ int pll_sync(void)
return
1
;
}
#if defined(CONFIG_SNMP) && defined(SNMP_SET)
/* Functions and struct used by the SNMP protocol to control the timing output */
const
struct
snmp_oid
oid_array_wrpcBoardSpecificGroup
[]
=
{
OID_FIELD_VAR
(
oid_wrpcSelGroup0
,
get_select_group
,
set_select_group
,
ASN_INTEGER
,
&
(
board
.
gpio_tim_main_board
)),
OID_FIELD_VAR
(
oid_wrpcSelGroup1
,
get_select_group
,
set_select_group
,
ASN_INTEGER
,
&
(
board
.
gpio_tim_main_board
)),
{
0
,
}
};
int
set_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
){
static
const
int
sel_group_offset
=
3
;
uint8_t
io_stat
;
uint8_t
len
=
buf
[
1
];
uint8_t
*
oid_data
=
buf
+
2
;
uint8_t
sel_group
=
*
(
buf
-
2
)
+
sel_group_offset
;
// add offset to get the appropriate value from board.h
uint8_t
sel_group_reg
=
WBGEN2_GEN_MASK
(
sel_group
,
1
);
uint8_t
asn_incoming
=
buf
[
0
];
uint8_t
asn_expected
=
obj
->
asn
;
uint32_t
tmp_u32
;
if
(
asn_incoming
!=
asn_expected
)
{
/* wrong data type */
snmp_verbose
(
"%s: wrong asn 0x%02x, expected 0x%02x
\n
"
,
__func__
,
asn_incoming
,
asn_expected
);
return
-
SNMP_ERR_BADVALUE
;
}
io_stat
=
pca9554_read_reg
(
obj
->
p
,
PCA9554_REG_OUT
);
memcpy
(
&
tmp_u32
,
oid_data
,
len
);
tmp_u32
=
ntohl
(
tmp_u32
);
/* move data when shorter than 4 bytes */
tmp_u32
=
tmp_u32
>>
((
4
-
len
)
*
8
);
if
(
tmp_u32
){
pca9554_write_reg
(
obj
->
p
,
PCA9554_REG_OUT
,
io_stat
|
sel_group_reg
);
}
else
{
pca9554_write_reg
(
obj
->
p
,
PCA9554_REG_OUT
,
io_stat
&
~
sel_group_reg
);
}
return
len
+
2
;
}
int
get_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
){
static
const
int
sel_group_offset
=
3
;
uint8_t
*
oid_data
=
buf
+
2
;
uint8_t
*
len
=
&
buf
[
1
];
uint32_t
on
=
htonl
(
1
);
uint32_t
off
=
htonl
(
0
);
uint8_t
sel_group
=
*
(
buf
-
2
)
+
sel_group_offset
;
// add offset to get the appropriate value from board.h
uint8_t
reg_stat
=
pca9554_read_reg
(
obj
->
p
,
PCA9554_REG_OUT
);
uint8_t
sel_group_reg
=
WBGEN2_GEN_MASK
(
sel_group
,
1
);
uint8_t
sel_group_status
=
reg_stat
&
sel_group_reg
;
*
len
=
sizeof
(
uint32_t
);
buf
[
0
]
=
obj
->
asn
;
if
(
sel_group_status
){
memcpy
((
char
*
)
oid_data
,
&
on
,
*
len
);
}
else
{
memcpy
((
char
*
)
oid_data
,
&
off
,
*
len
);
}
return
*
len
+
2
;
}
#endif
int
spec7_init
()
{
/* most of the I/Os of the slow peripherals (i2c, spi) are bitbanged. First, let's
...
...
boards/spec7/board.h
View file @
966756e1
...
...
@@ -116,15 +116,12 @@ void sdb_find_devices(void);
void
sdb_print_devices
(
void
);
#if defined(CONFIG_SNMP) && defined(SNMP_SET)
// size of oid_wrpcBoardSpecificGroup
#define BOARD_OID_LENGTH 9
int
set_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
);
int
get_select_group
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
);
/* wrpcSelGroup entries */
static
const
uint8_t
oid_wrpcSelGroup0
[]
=
{
1
,
0
};
static
const
uint8_t
oid_wrpcSelGroup1
[]
=
{
2
,
0
};
/* oid_wprcBoardSpecific*/
static
const
uint8_t
oid_wrpcBoardSpecificGroup
[]
=
{
0x2B
,
6
,
1
,
4
,
1
,
96
,
101
,
1
,
13
};
/* wrpcBoardSpecificGroup array */
extern
const
struct
snmp_oid
oid_array_wrpcBoardSpecificGroup
[];
extern
const
uint8_t
oid_wrpcBoardSpecificGroup
[
BOARD_OID_LENGTH
];
#endif
#endif
/* __BOARD_SPEC7_H */
lib/snmp.c
View file @
966756e1
...
...
@@ -353,7 +353,6 @@ static const struct snmp_oid oid_array_wrpcShellCmdGroup[] = {
{
0
,
}
};
static
const
struct
snmp_oid
oid_array_wrpcAuxRoTable
[]
=
{
OID_FIELD_VAR
(
NULL
,
get_aux_diag
,
NO_SET
,
ASN_UNSIGNED
,
AUX_DIAG_RO
),
{
0
,
}
...
...
@@ -784,8 +783,6 @@ static int func_aux_diag(uint8_t *buf, uint8_t in_oid_limb_matched_len,
return
return_len
;
}
static
int
get_servo
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
)
{
uint64_t
tmp_uint64
;
...
...
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