Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
LOFAR2.0
APS_M_and_C
Commits
0f9414c8
Commit
0f9414c8
authored
Oct 28, 2020
by
Taya Snijder
Committed by
Thomas Juerges
Oct 28, 2020
Browse files
improved software structuring, partially added paulus SPI code and general improvements
parent
7634d960
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
src/PCC/.settings/language.settings.xml
View file @
0f9414c8
...
...
@@ -4,7 +4,7 @@
<extension
point=
"org.eclipse.cdt.core.LanguageSettingsProvider"
>
<provider
copy-of=
"extension"
id=
"org.eclipse.cdt.ui.UserLanguageSettingsProvider"
/>
<provider
class=
"org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser"
id=
"com.crt.advproject.GCCBuildCommandParser"
keep-relative-paths=
"false"
name=
"MCU GCC Build Output Parser"
parameter=
"(arm-none-eabi-gcc)|(arm-none-eabi-[gc]\+\+)|(gcc)|([gc]\+\+)|(clang)"
prefer-non-shared=
"true"
/>
<provider
class=
"com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector"
console=
"false"
env-hash=
"
384598274688531566
"
id=
"com.crt.advproject.GCCBuildSpecCompilerParser"
keep-relative-paths=
"false"
name=
"MCU GCC Built-in Compiler Parser"
parameter=
"${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}""
prefer-non-shared=
"true"
>
<provider
class=
"com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector"
console=
"false"
env-hash=
"
193187301907095245
"
id=
"com.crt.advproject.GCCBuildSpecCompilerParser"
keep-relative-paths=
"false"
name=
"MCU GCC Built-in Compiler Parser"
parameter=
"${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}""
prefer-non-shared=
"true"
>
<language-scope
id=
"org.eclipse.cdt.core.gcc"
/>
<language-scope
id=
"org.eclipse.cdt.core.g++"
/>
</provider>
...
...
@@ -15,7 +15,7 @@
<extension
point=
"org.eclipse.cdt.core.LanguageSettingsProvider"
>
<provider
copy-of=
"extension"
id=
"org.eclipse.cdt.ui.UserLanguageSettingsProvider"
/>
<provider
copy-of=
"extension"
id=
"com.crt.advproject.GCCBuildCommandParser"
/>
<provider
class=
"com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector"
console=
"false"
env-hash=
"
349838533106952113
"
id=
"com.crt.advproject.GCCBuildSpecCompilerParser"
keep-relative-paths=
"false"
name=
"MCU GCC Built-in Compiler Parser"
parameter=
"${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}""
prefer-non-shared=
"true"
>
<provider
class=
"com.crt.advproject.specs.MCUGCCBuiltinSpecsDetector"
console=
"false"
env-hash=
"
158427560325515792
"
id=
"com.crt.advproject.GCCBuildSpecCompilerParser"
keep-relative-paths=
"false"
name=
"MCU GCC Built-in Compiler Parser"
parameter=
"${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}""
prefer-non-shared=
"true"
>
<language-scope
id=
"org.eclipse.cdt.core.gcc"
/>
<language-scope
id=
"org.eclipse.cdt.core.g++"
/>
</provider>
...
...
src/PCC/Debug/PCC.map
View file @
0f9414c8
This diff is collapsed.
Click to expand it.
src/PCC/Debug/PCC_Debug.ld
View file @
0f9414c8
...
...
@@ -6,7 +6,7 @@
* Generated linker script file for MIMXRT1062xxxxA
* Created from linkscript.ldt by FMCreateLinkLibraries
* Using Freemarker v2.3.23
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
19
-Oct-2020 1
2:01
:1
6
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
28
-Oct-2020 1
3:57
:1
2
*/
INCLUDE "PCC_Debug_library.ld"
...
...
src/PCC/Debug/PCC_Debug_library.ld
View file @
0f9414c8
...
...
@@ -6,7 +6,7 @@
* Generated linker script file for MIMXRT1062xxxxA
* Created from library.ldt by FMCreateLinkLibraries
* Using Freemarker v2.3.23
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
19
-Oct-2020 1
2:01
:1
6
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
28
-Oct-2020 1
3:57
:1
2
*/
GROUP (
...
...
src/PCC/Debug/PCC_Debug_memory.ld
View file @
0f9414c8
...
...
@@ -6,7 +6,7 @@
* Generated linker script file for MIMXRT1062xxxxA
* Created from memory.ldt by FMCreateLinkMemory
* Using Freemarker v2.3.23
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
19
-Oct-2020 1
2:01
:1
6
* MCUXpresso IDE v11.1.0 [Build 3209] [2019-12-12] on
28
-Oct-2020 1
3:57
:1
2
*/
MEMORY
...
...
src/PCC/Debug/source/commands.su
View file @
0f9414c8
...
...
@@ -12,28 +12,43 @@ gthr-default.h:229:1:int __gthread_key_delete(__gthread_key_t) 16 static
commands.cpp:23:16:const uint8_t* test_pb() 4 static
commands.cpp:89:11:UA_String UA_readable_time(UA_DateTime) 112 static
commands.cpp:103:6:void cmd_handler::check_commands() 64 static
commands.cpp:151:6:static void cmd_handler::new_deadline_unix(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 128 static
commands.cpp:179:6:void cmd_handler::cmd_handler_task() 16 static
commands.cpp:203:6:void cmd_handler::sync_loop() 144 dynamic
commands.cpp:260:6:static void cmd_handler::task_wrapper(void*) 16 static
commands.cpp:264:6:void cmd_handler::sync() 16 static
commands.cpp:269:6:void cmd_handler::add_base_node(base_node*, I2C_switch*, uint8_t, tskTaskControlBlock**) 24 static
commands.cpp:286:1:cmd_handler::cmd_handler(UA_Server*) 24 static
commands.cpp:292:7:void cmd_handler::get_RCU_config(I2C_config&) 11384 static
commands.cpp:333:6:void cmd_handler::add_OPCua_stuff() 704 static
commands.cpp:416:10:status_t cmd_handler::process_RCU_cmd(cmd*) 80 dynamic
commands.cpp:562:6:static void cmd_handler::set_RCU_read_interval(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
commands.cpp:565:6:static void cmd_handler::flush_cmd_queue(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
commands.cpp:569:1:RCU::RCU(I2C_config*, cmd_handler*, uint8_t) 376 static
commands.cpp:634:10:status_t RCU::setup_mode(bool) 48 static
commands.cpp:673:6:static void cmd_handler::beforeRead(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
commands.cpp:676:6:static void cmd_handler::set_deadline(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 128 static
commands.cpp:705:6:static void cmd_handler::afterWrite(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 72 static
commands.cpp:744:10:status_t cmd_handler::readout_loop() 168 static
commands.cpp:814:6:static bool RCU::variable_decode_pb(pb_istream_t*, const pb_field_t*, void**) 1080 static
commands.cpp:994:6:static bool RCU::mode_decode_pb(pb_istream_t*, const pb_field_t*, void**) 40 static
commands.cpp:1006:6:static bool RCU::spi_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1015:6:static bool RCU::input_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1024:6:static bool RCU::device_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1033:6:static bool RCU::name_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1052:10:status_t RCU::compose_command(cmd*, Vtable_entry*) 80 static
commands.cpp:150:6:static void cmd_handler::new_deadline_unix(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 128 static
commands.cpp:178:6:void cmd_handler::cmd_handler_task() 16 static
commands.cpp:202:6:void cmd_handler::sync_loop() 144 dynamic
commands.cpp:259:6:static void cmd_handler::task_wrapper(void*) 16 static
commands.cpp:263:6:void cmd_handler::sync() 16 static
commands.cpp:268:6:void cmd_handler::add_base_node(base_node*, I2C_switch*, uint8_t, tskTaskControlBlock**) 24 static
commands.cpp:285:1:cmd_handler::cmd_handler(UA_Server*) 24 static
commands.cpp:291:7:void cmd_handler::get_RCU_config(I2C_config&) 48360 static
commands.cpp:332:6:void cmd_handler::add_OPCua_stuff() 704 static
commands.cpp:415:10:status_t cmd_handler::process_RCU_cmd(cmd*) 88 dynamic
commands.cpp:563:6:static void cmd_handler::set_RCU_read_interval(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
commands.cpp:566:6:static void cmd_handler::flush_cmd_queue(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
commands.cpp:570:1:RCU::RCU(I2C_config*, cmd_handler*, uint8_t) 376 static
commands.cpp:635:6:void RCU::sync_vtable_registers(Vtable_entry*, uint64_t) 112 static
commands.cpp:666:10:status_t RCU::set_mode(bool, _Mode_Modes) 48 static
commands.cpp:712:6:static void cmd_handler::set_deadline(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 128 static
commands.cpp:740:6:bool cmd_handler::virtual_switch(I2C_config*, int8_t, bool) 40 static
commands.cpp:796:6:static void cmd_handler::read_point(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 168 static
commands.cpp:918:6:static void cmd_handler::afterWrite(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 64 static
commands.cpp:988:10:status_t cmd_handler::readout_loop() 208 dynamic
commands.cpp:1092:6:void devReg_to_table_entry(Vtable_entry&, device_register&) 16 static
commands.cpp:1115:6:static bool RCU::variable_decode_pb(pb_istream_t*, const pb_field_t*, void**) 1088 static
commands.cpp:1308:6:static bool RCU::mode_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1322:6:static bool RCU::spi_decode_pb(pb_istream_t*, const pb_field_t*, void**) 232 static
commands.cpp:1342:6:static bool RCU::input_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1353:6:static bool RCU::device_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1365:6:static bool RCU::name_decode_pb(pb_istream_t*, const pb_field_t*, void**) 32 static
commands.cpp:1386:10:status_t RCU::compose_command(cmd*, Vtable_entry*, uint64_t&) 136 static
commands.cpp:1460:6:static bool RCU::name2_decode_pb(pb_istream_t*, const pb_field_t*, void**) 112 static
commands.cpp:1479:6:bool doMask(Vtable_entry) 8 static
commands.cpp:1486:9:uint8_t RCU::get_stored_i2cregister(Vtable_entry) 24 static
commands.cpp:1494:6:void RCU::set_stored_i2cregister(Vtable_entry, uint8_t) 24 static
commands.cpp:1508:6:void RCU::set_I2Cregister(Vtable_entry, uint8_t*, uint8_t) 136 static
commands.cpp:1529:10:uint16_t RCU::get_I2Cregister(Vtable_entry) 144 static
commands.cpp:1545:6:void RCU::set_SPIregister(Vtable_entry, uint8_t*, uint8_t) 152 static
commands.cpp:1569:10:uint16_t RCU::get_SPIregister(Vtable_entry) 160 static
commands.cpp:1608:6:void RCU::set_register(Vtable_entry, uint8_t*, uint8_t) 128 static
commands.cpp:1614:10:uint16_t RCU::get_register(Vtable_entry) 120 static
commands.cpp:1621:6:void RCU::set_variable(uint8_t, uint8_t*, uint8_t) 144 static
commands.cpp:1627:10:uint16_t RCU::get_variable(uint8_t) 136 static
src/PCC/Debug/source/main_MandC.su
View file @
0f9414c8
...
...
@@ -19,31 +19,30 @@ fsl_gpio.h:101:20:void GPIO_WritePinOutput(GPIO_Type*, uint32_t, uint8_t) 24 sta
fsl_gpio.h:316:20:void GPIO_PortClearInterruptFlags(GPIO_Type*, uint32_t) 16 static
fsl_wdog.h:175:20:void WDOG_TriggerSystemSoftwareReset(WDOG_Type*) 16 static
fsl_iomuxc.h:1322:20:void IOMUXC_EnableMode(IOMUXC_GPR_Type*, uint32_t, bool) 24 static
OPCua_debug_redirect.h:39:13:void debug_msg_buff_init(UA_Server*) 1
112
static
OPCua_debug_redirect.h:39:13:void debug_msg_buff_init(UA_Server*) 1
368
static
OPCua_debug_redirect.h:78:20:void write_debug(int, char*, size_t) 128 static
OPCua_debug_redirect.h:135:27:int _write(int, char*, int) 24 static
gthr-default.h:229:1:int __gthread_key_delete(__gthread_key_t) 16 static
base_nodes_config.h:35:2:TEST_base_node::TEST_base_node(lpi2c_rtos_handle_t*, UA_Server*, uint8_t, cmd_handler*, std::__cxx11::string) 224 static
init_and_util.h:69:6:void WDOG1_IRQHandler() 8 static
init_and_util.h:100:6:static void opc_ua_time::set_unix_offset(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 128 static
init_and_util.h:136:6:static void opc_ua_time::beforeRead(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 24 static
init_and_util.h:140:1:opc_ua_time::opc_ua_time(UA_Server*) 640 static
init_and_util.h:207:10:uint8_t* get_ip_address(ip_type) 16 static
init_and_util.h:247:14:cmd_handler* set_get_cmd_handler_ptr(cmd_handler*) 16 static
init_and_util.h:261:6:void GPIO1_Combined_0_15_IRQHandler() 32 static
init_and_util.h:299:6:void BOARD_InitSEMC() 80 static
init_and_util.h:352:6:void delay() 16 static
init_and_util.h:362:6:void RTOS_heap_init() 24 static
init_and_util.h:405:6:void BOARD_Init_ETH_peripheral() 24 static
init_and_util.h:424:7:char* get_readable_runtime() 56 static
init_and_util.h:486:10:void vApplicationMallocFailedHook() 16 static
init_and_util.h:495:10:void vApplicationStackOverflowHook(TaskHandle_t, char*) 24 static
init_and_util.h:505:10:void vApplicationIdleHook() 4 static
init_and_util.h:512:6:void blinky() 8 static
init_and_util.h:98:6:static void opc_ua_time::set_unix_offset(UA_Server*, const UA_NodeId*, void*, const UA_NodeId*, void*, const UA_NumericRange*, const UA_DataValue*) 120 static
init_and_util.h:135:1:opc_ua_time::opc_ua_time(UA_Server*) 640 static
init_and_util.h:201:10:uint8_t* get_ip_address(ip_type) 16 static
init_and_util.h:241:14:cmd_handler* set_get_cmd_handler_ptr(cmd_handler*) 16 static
init_and_util.h:255:6:void GPIO1_Combined_0_15_IRQHandler() 32 static
init_and_util.h:293:6:void BOARD_InitSEMC() 80 static
init_and_util.h:346:6:void delay() 16 static
init_and_util.h:356:6:void RTOS_heap_init() 24 static
init_and_util.h:399:6:void BOARD_Init_ETH_peripheral() 24 static
init_and_util.h:418:7:char* get_readable_runtime() 56 static
init_and_util.h:480:10:void vApplicationMallocFailedHook() 16 static
init_and_util.h:489:10:void vApplicationStackOverflowHook(TaskHandle_t, char*) 24 static
init_and_util.h:499:10:void vApplicationIdleHook() 4 static
init_and_util.h:506:6:void blinky() 8 static
main_MandC.cpp:144:5:int main() 16 static
main_MandC.cpp:20
0
:13:void lwip_init(void*) 80 static
main_MandC.cpp:25
3
:13:void opcua_thread(void*) 88 static
main_MandC.cpp:29
5
:13:void timewaster_task(void*) 16 static
main_MandC.cpp:31
1
:13:void server_manager_thread(void*) 36
0
static
main_MandC.cpp:37
0
:13:void I2C_manager_task(void*) 712 static
main_MandC.cpp:39
4
:6:void status_node(UA_Server*) 1
200
static
main_MandC.cpp:20
4
:13:void lwip_init(void*) 80 static
main_MandC.cpp:25
7
:13:void opcua_thread(void*) 88 static
main_MandC.cpp:29
9
:13:void timewaster_task(void*) 16 static
main_MandC.cpp:31
5
:13:void server_manager_thread(void*) 36
8
static
main_MandC.cpp:37
4
:13:void I2C_manager_task(void*) 712 static
main_MandC.cpp:39
8
:6:void status_node(UA_Server*) 1
192
static
src/PCC/Debug/source/node.su
View file @
0f9414c8
...
...
@@ -35,7 +35,7 @@ node.cpp:509:6:void base_node::update_buffer() 24 static
node.cpp:556:6:void base_node::I2C_log_failure(type_of_device) 16 static
node.cpp:582:6:void base_node::process_I2C_logs() 176 static
node.cpp:644:6:void base_node::wait_remainder() 88 static
node.cpp:70
1
:6:void base_node::I2C_monitor_init() 1280 static
node.cpp:70
2
:6:void base_node::I2C_monitor_init() 1280 static
string_conversions.h:99:5:) [with _String = std::__cxx11::basic_string<char>; _CharT = char] 44 dynamic
basic_string.h:5964:5:std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] 24 static
basic_string.h:5992:5:std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>] 24 static
...
...
src/PCC/PCC LinkServer Debug.launch
View file @
0f9414c8
...
...
@@ -45,7 +45,7 @@
<booleanAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.doReset"
value=
"false"
/>
<stringAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.imageFileName"
value=
""
/>
<stringAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.imageOffset"
value=
""
/>
<stringAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.initCommands"
value=
" set remotetimeout 60000 ##target_extended_remote## set mem inaccessible-by-default ${mem.access} mon ondisconnect ${ondisconnect} set arm force-mode thumb ${load}"
/>
<stringAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.initCommands"
value=
"
set non-stop on set pagination off set mi-async
set remotetimeout 60000 ##target_extended_remote## set mem inaccessible-by-default ${mem.access} mon ondisconnect ${ondisconnect} set arm force-mode thumb ${load}"
/>
<booleanAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.loadImage"
value=
"true"
/>
<booleanAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.loadSymbols"
value=
"true"
/>
<stringAttribute
key=
"org.eclipse.cdt.debug.gdbjtag.core.pcRegister"
value=
""
/>
...
...
@@ -64,7 +64,7 @@
<booleanAttribute
key=
"org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK"
value=
"false"
/>
<booleanAttribute
key=
"org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE"
value=
"false"
/>
<stringAttribute
key=
"org.eclipse.cdt.dsf.gdb.GDB_INIT"
value=
""
/>
<booleanAttribute
key=
"org.eclipse.cdt.dsf.gdb.NON_STOP"
value=
"
fals
e"
/>
<booleanAttribute
key=
"org.eclipse.cdt.dsf.gdb.NON_STOP"
value=
"
tru
e"
/>
<booleanAttribute
key=
"org.eclipse.cdt.dsf.gdb.REVERSE"
value=
"false"
/>
<stringAttribute
key=
"org.eclipse.cdt.dsf.gdb.REVERSE_MODE"
value=
"UseSoftTrace"
/>
<stringAttribute
key=
"org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE"
value=
"TP_NORMAL_ONLY"
/>
...
...
src/PCC/source/OPCua_debug_redirect.h
View file @
0f9414c8
...
...
@@ -23,7 +23,7 @@
extern
"C"
{
#endif
#define DBG_BUF_LINES
32
//number of debug messages stored WARNING: too high can cause LWIP errors due to limited resources
#define DBG_BUF_LINES
64
//number of debug messages stored WARNING: too high can cause LWIP errors due to limited resources
#define DBG_MAX_LEN 256 //max length a message may hae. After which it wil be ignored
#define STORE_BEFORE_INIT //stores messages before the OPC ua server has been initialised and writes them after
#define SPLIT_WHEN_TOO_LARGE true
...
...
src/PCC/source/commands.cpp
View file @
0f9414c8
This diff is collapsed.
Click to expand it.
src/PCC/source/commands.h
View file @
0f9414c8
...
...
@@ -91,7 +91,7 @@ struct I2C_config{
struct
Vtable_entry
{
uint
32
_t
id
;
//ID of the command
uint
64
_t
id
;
//ID of the command
char
*
name
;
//name of the register
//device address / register
...
...
@@ -103,6 +103,7 @@ struct Vtable_entry {
//RCU device type
bool
has_d_type
;
device_register_device_type
d_type
;
//stores the current value
bool
has_value
;
uint32_t
value
;
...
...
@@ -127,6 +128,17 @@ struct Vtable_entry {
UA_NodeId
monitor_point_nodeID
;
};
typedef
struct
_SPI
{
Vtable_entry
CLK
;
Vtable_entry
SDO
;
Vtable_entry
SDI
;
Vtable_entry
DIR
;
bool
has_CS
;
Vtable_entry
CS
;
}
SPI
;
//struct cmd{ //commands that need to be propogated to the HBA's
// char cmd_type[4];
// uint8_t data_size; //the size of "cmd_data" in bytes
...
...
@@ -147,6 +159,13 @@ struct cmd{ //commands that need to be propogated to the HBA's
//example: { .type =1, .RCU_num =0, .HBA_num =0, .data_size =2, .command ="IO_extender" }
};
struct
Register_values
{
uint8_t
addr
;
uint8_t
reg
;
uint8_t
value
;
};
class
cmd_handler
{
public:
...
...
@@ -195,6 +214,7 @@ public:
void
new_deadline
(
UA_DateTime
dateTime
);
//void add_OPCua_func();
bool
virtual_switch
(
I2C_config
*
config
,
int8_t
channel
,
bool
includes_offset
=
true
);
static
void
new_deadline_unix
(
callback_func_inargs
);
//client function to set a new deadline
static
void
set_RCU_read_interval
(
callback_func_inargs
);
//adds a periodic RCU read command
...
...
@@ -202,7 +222,7 @@ public:
static
void
set_deadline
(
callback_func_inargs
);
static
void
beforeRead
(
callback_func_inargs
);
static
void
read_point
(
callback_func_inargs
);
static
void
afterWrite
(
callback_func_inargs
);
void
cmd_handler_task
();
...
...
@@ -215,23 +235,29 @@ public:
class
RCU
{
public:
uint16_t
version
;
//version number
I2C_config
*
config
;
cmd_handler
*
handler
;
UA_NodeId
RCU_nodeID
;
uint8_t
RCUnum
;
//rcunum of the base node
static
uint8_t
RCU_cnt
;
static
const
uint8_t
max_table_size
=
32
;
static
const
uint8_t
max_table_size
=
64
;
uint8_t
variable_table_entries
=
0
;
//counter, increments for each entry
Vtable_entry
variable_table
[
max_table_size
];
uint8_t
SPI_bridge_table_entries
=
0
;
//counter, increments for each entry
SPI
_bridge
SPI_bridge_table
[
max_table_size
];
SPI
SPI_bridge_table
[
max_table_size
];
uint8_t
Mode_table_entries
=
0
;
//counter, increments for each entry
device_register
Mode_table
[
max_table_size
];
uint8_t
Mode_number
=
0
;
device_register
Mode_table
[
max_table_size
];
//contains the entries
uint8_t
Mode_index
[
max_table_size
];
uint8_t
Mode_values
[
max_table_size
][
8
];
uint8_t
Mode_value_len
[
max_table_size
];
Mode
mode_table_entry_mode
[
max_table_size
];
// contains the mdoe of the entry
UA_String
Mode_names
[
max_table_size
];
uint8_t
ant_table_entries
=
0
;
//counter, increments for each entry
Ant_types
ant_table
[
max_table_size
];
...
...
@@ -239,10 +265,11 @@ public:
RCU
(
I2C_config
*
_config
,
cmd_handler
*
_handler
,
uint8_t
_RCUnum
);
status_t
compose_command
(
cmd
*
cmd
,
Vtable_entry
*
entry
);
status_t
set
up
_mode
(
bool
set_switches
=
false
);
status_t
compose_command
(
cmd
*
cmd
,
Vtable_entry
*
entry
,
uint64_t
&
value
);
status_t
set_mode
(
bool
set_switches
=
false
,
_Mode_Modes
Mode
=
Mode_Modes_Init
);
status_t
blink_led
();
void
add_OPC_ua_method
();
void
sync_vtable_registers
(
Vtable_entry
*
entry
,
uint64_t
value
);
static
bool
variable_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
static
bool
mode_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
...
...
@@ -250,20 +277,33 @@ public:
static
bool
input_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
static
bool
device_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
static
bool
name_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
static
bool
name2_decode_pb
(
pb_istream_t
*
istream
,
const
pb_field_t
*
field
,
void
**
arg
);
// NOTE: below copied from paulus
void
LoadPb
(
uint16_t
data_size
,
const
uint8_t
*
test_pb
);
uint8_t
get_stored_i2cregister
(
Vtable_entry
device
);
void
set_stored_i2cregister
(
Vtable_entry
device
,
uint8_t
value
);
uint8_t
register_values_entries
=
0
;
Register_values
register_values_table
[
max_table_size
];
void
set_register
(
Vtable_entry
device
,
uint8_t
*
bytes
,
uint8_t
length
);
uint16_t
get_register
(
Vtable_entry
device
);
void
set_I2Cregister
(
Vtable_entry
device
,
uint8_t
*
bytes
,
uint8_t
length
);
uint16_t
get_I2Cregister
(
Vtable_entry
device
);
void
set_SPIregister
(
Vtable_entry
device
,
uint8_t
*
bytes
,
uint8_t
length
);
uint16_t
get_SPIregister
(
Vtable_entry
device
);
void
set_variable
(
uint8_t
number
,
uint8_t
*
bytes
,
uint8_t
length
);
uint16_t
get_variable
(
uint8_t
number
);
void
set_method
(
uint8_t
number
);
uint16_t
i2c_writecount
=
0
;
//For debugging
uint16_t
i2c_readcount
=
0
;
//For debugging
// // NOTE: below copied from paulus
// uint8_t get_stored_i2cregister(device_register device);
// void set_stored_i2cregister(device_register device,uint8_t value);
//
// uint8_t register_values_entries = 0;
// Register_values register_values_table[max_table_size];
//
// void set_register( device_register device, uint8_t *bytes,uint8_t length);
// uint16_t get_register( device_register device);
// void set_I2Cregister( device_register device, uint8_t *bytes,uint8_t length);
// uint16_t get_I2Cregister( device_register device);
// void set_SPIregister( device_register device, uint8_t *bytes,uint8_t length);
// uint16_t get_SPIregister( device_register device);
};
...
...
src/PCC/source/init_and_util.h
View file @
0f9414c8
...
...
@@ -88,11 +88,9 @@ public:
UA_NodeId
monitor_nodeID
;
UA_NodeId
object_nodeID
;
static
opc_ua_time
*
self
;
UA_Server
*
server
;
opc_ua_time
(
UA_Server
*
_server
);
static
void
set_unix_offset
(
callback_func_inargs
);
static
void
beforeRead
(
callback_func_inargs
);
};
opc_ua_time
*
opc_ua_time
::
self
=
nullptr
;
...
...
@@ -126,23 +124,20 @@ void opc_ua_time::set_unix_offset(callback_func_inargs){
UA_Variant
value_var
;
UA_Variant_init
(
&
value_var
);
UA_Variant_setScalar
(
&
value_var
,
&
unix_offset
,
&
UA_TYPES
[
UA_TYPES_INT64
]);
status_t
status
=
UA_Server_writeValue
(
self
->
server
,
self
->
monitor_nodeID
,
value_var
);
status_t
status
=
UA_Server_writeValue
(
server
,
self
->
monitor_nodeID
,
value_var
);
if
(
status
)
{
printf
(
"couldn't time offset node
\r\n
"
);
}
printf
(
"changed time offset
\r\n
"
);
}
void
opc_ua_time
::
beforeRead
(
callback_func_inargs
)
{
return
;
}
opc_ua_time
::
opc_ua_time
(
UA_Server
*
_
server
){
opc_ua_time
::
opc_ua_time
(
UA_Server
*
server
){
self
=
this
;
server
=
_server
;
control_nodeID
=
UA_NODEID_STRING
(
2
,
"time_offset_control"
);
monitor_nodeID
=
UA_NODEID_STRING
(
2
,
"time_offset_monitor"
);
control_nodeID
=
UA_NODEID_STRING
(
2
,
"time_offset_RW"
);
monitor_nodeID
=
UA_NODEID_STRING
(
2
,
"time_offset_R"
);
object_nodeID
=
UA_NODEID_STRING
(
2
,
"time_offset_node"
);
//--------------------------------------------------------------------------------
//add object node
...
...
@@ -167,9 +162,9 @@ opc_ua_time::opc_ua_time(UA_Server *_server){
status
=
UA_Server_addVariableNode
(
server
,
UA_NODEID_NULL
,
//UA_NODEID_NULL
self
->
object_nodeID
,
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_ORGANIZES
),
UA_QUALIFIEDNAME
(
2
,
"
control_point
"
),
UA_QUALIFIEDNAME
(
2
,
"
time_offset_RW
"
),
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
vAttr
,
NULL
,
&
m
on
itor
_nodeID
);
vAttr
,
NULL
,
&
c
on
trol
_nodeID
);
if
(
status
)
printf
(
"couldn't add node
\r\n
"
);
//----------------------------------------------------------------------------------
...
...
@@ -182,7 +177,7 @@ opc_ua_time::opc_ua_time(UA_Server *_server){
status
=
UA_Server_addVariableNode
(
server
,
UA_NODEID_NULL
,
//UA_NODEID_NULL
object_nodeID
,
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_ORGANIZES
),
UA_QUALIFIEDNAME
(
2
,
"
monitor_point
"
),
UA_QUALIFIEDNAME
(
2
,
"
time_offset_R
"
),
UA_NODEID_NUMERIC
(
0
,
UA_NS0ID_BASEDATAVARIABLETYPE
),
vAttr
,
NULL
,
&
monitor_nodeID
);
if
(
status
)
printf
(
"couldn't add node
\r\n
"
);
...
...
@@ -190,7 +185,7 @@ opc_ua_time::opc_ua_time(UA_Server *_server){
vTaskDelay
(
pdMS_TO_TICKS
(
1
));
UA_ValueCallback
callback
;
callback
.
onRead
=
beforeRead
;
callback
.
onRead
=
nullptr
;
callback
.
onWrite
=
set_unix_offset
;
UA_StatusCode
UA_status
=
UA_Server_setVariableNode_valueCallback
(
server
,
control_nodeID
,
callback
);
}
...
...
src/PCC/source/main_MandC.cpp
View file @
0f9414c8
...
...
@@ -157,6 +157,10 @@ int main(void)
BOARD_Init_ETH_peripheral
();
//intialise part of the Ethernet pins and clocks
BOARD_InitBootPeripherals
();
//initialise all peripherals
// while(1){
// delay();
// }
//not used yet. probably needed later
// lpi2c_rtos_handle_t FLEXI2C2_masterHandle;
...
...
@@ -324,13 +328,13 @@ static void server_manager_thread(void *arg){
//create the commadn handler object
cmd_handler
cmd_handler_obj
=
cmd_handler
(
mUaServer
);
//creates an object and a task
//
//set a pointer to the command handler for the sync interrupt to get
//
set_get_cmd_handler_ptr(&cmd_handler_obj);
//
cmd_handler_obj.cmd_queue = I2C_command_queue;
//
//
//create the command handler task
//
TaskHandle_t cmd_task_handler = sys_thread_new("cmd_handler_task", cmd_handler_obj.task_wrapper, &cmd_handler_obj, 32*1024, I2C_control_task_prio);
//
if (cmd_task_handler == NULL) LWIP_ASSERT("cmd_handler_task(): Task creation failed.", 0);
//set a pointer to the command handler for the sync interrupt to get
set_get_cmd_handler_ptr
(
&
cmd_handler_obj
);
cmd_handler_obj
.
cmd_queue
=
I2C_command_queue
;
//create the command handler task
TaskHandle_t
cmd_task_handler
=
sys_thread_new
(
"cmd_handler_task"
,
cmd_handler_obj
.
task_wrapper
,
&
cmd_handler_obj
,
32
*
1024
,
I2C_control_task_prio
);
if
(
cmd_task_handler
==
NULL
)
LWIP_ASSERT
(
"cmd_handler_task(): Task creation failed."
,
0
);
//struct of input args for I2C manager tasks
struct
I2C_manager_args
I2C_args
=
{.
server
=
mUaServer
,
.
I2C_handle
=
&
LPI2C1_masterHandle
,
.
I2C_unit_nr
=
1
,
.
handler
=
&
cmd_handler_obj
};
...
...
@@ -424,7 +428,6 @@ void status_node(UA_Server *server){
UA_Float
readout_interval
=
1
;
volatile
opc_ua_time
OPCua_time
=
opc_ua_time
(
server
);
printf
(
"time_offset at: %d"
,
&
OPCua_time
);
//--------------------------------------------------------------------------------
//add status node
...
...
src/PCC/source/node.cpp
View file @
0f9414c8
...
...
@@ -646,9 +646,11 @@ void base_node::wait_remainder(){
static
const
uint32_t
command_interval
=
2
;
//check for new commands each this many ms
sleep_flag
=
true
;
uint32_t
wait_time
=
next_cycle
-
pdMS_TO_TICKS
(
xTaskGetTickCount
());
//calculate how long the task has to wait
// note, can overflow: ex with uint8_t wait_time = 250 - 266 = -10 ---> wait_time = 250 - 10 = 240
if
(
wait_time
>
readout_interval
){
//overflow protection
wait_time
=
readout_interval
;
}
//calculates how long th readout took
uint32_t
cycle_time
=
pdMS_TO_TICKS
(
xTaskGetTickCount
())
-
(
next_cycle
-
readout_interval
);
...
...
@@ -661,7 +663,6 @@ void base_node::wait_remainder(){
vTaskDelay
(
command_interval
);
wait_time
=
next_cycle
-
pdMS_TO_TICKS
(
xTaskGetTickCount
());
//TODO: do stuff, call command handler
}
vTaskDelay
(
wait_time
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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