ok
This commit is contained in:
@@ -16,3 +16,6 @@
|
||||
[submodule "Ubiquitous/Nuttx_Fusion_XiUOS/apps"]
|
||||
path = Ubiquitous/Nuttx_Fusion_XiUOS/apps
|
||||
url = https://code.gitlink.org.cn/wgzAIIT/incubator-nuttx-apps.git
|
||||
[submodule "APP_Framework/Applications/webnet/WebNet_XiUOS"]
|
||||
path = APP_Framework/Applications/webnet/WebNet_XiUOS
|
||||
url = https://gitlink.org.cn/xuos/WebNet_XiUOS.git
|
||||
|
||||
@@ -19,4 +19,5 @@ menu "Applications"
|
||||
source "$APP_DIR/Applications/knowing_app/Kconfig"
|
||||
source "$APP_DIR/Applications/sensor_app/Kconfig"
|
||||
source "$APP_DIR/Applications/embedded_database_app/Kconfig"
|
||||
source "$APP_DIR/Applications/webnet/Kconfig"
|
||||
endmenu
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
menuconfig APP_USING_WEBNET
|
||||
bool "WebNet: A lightweight, customizable, embeddable Web Server for RT-Thread"
|
||||
default n
|
||||
if APP_USING_WEBNET
|
||||
|
||||
config PKG_WEBNET_PATH
|
||||
string
|
||||
default "/packages/iot/webnet"
|
||||
|
||||
config WEBNET_PORT
|
||||
int "Server listen port"
|
||||
default 80
|
||||
range 0 65535
|
||||
|
||||
config WEBNET_CONN_MAX
|
||||
int "Maximum number of server connections"
|
||||
default 16
|
||||
range 1 100
|
||||
|
||||
config WEBNET_ROOT
|
||||
string "Server root directory"
|
||||
default "/webnet"
|
||||
|
||||
menu "Select supported modules"
|
||||
|
||||
config WEBNET_USING_LOG
|
||||
bool "LOG: Enable output log support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_AUTH
|
||||
bool "AUTH: Enable basic HTTP authentication support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_CGI
|
||||
bool "CGI: Enable Common Gateway Interface support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_ASP
|
||||
bool "ASP: Enable Active Server Pages support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_SSI
|
||||
bool "SSI: Enable Server Side Includes support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_INDEX
|
||||
bool "INDEX: Enable list all the file in the directory support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_ALIAS
|
||||
bool "ALIAS: Enable alias support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_DAV
|
||||
bool "DAV: Enable Web-based Distributed Authoring and Versioning support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_UPLOAD
|
||||
bool "UPLOAD: Enable upload file support"
|
||||
default n
|
||||
|
||||
config WEBNET_USING_GZIP
|
||||
bool "GZIP: Enable compressed file support by GZIP"
|
||||
default n
|
||||
|
||||
config WEBNET_CACHE_LEVEL
|
||||
int "CACHE: Configure cache level(0:disable 1:use Last-Modified 2:use Cache-Control)"
|
||||
default 0
|
||||
range 0 2
|
||||
|
||||
if WEBNET_CACHE_LEVEL = 2
|
||||
|
||||
config WEBNET_CACHE_MAX_AGE
|
||||
int "Cache-Control time in seconds"
|
||||
default 1800
|
||||
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
config WEBNET_USING_SAMPLES
|
||||
bool "Enable webnet samples"
|
||||
default n
|
||||
select WEBNET_USING_ASP
|
||||
select WEBNET_USING_AUTH
|
||||
select WEBNET_USING_CGI
|
||||
select WEBNET_USING_INDEX
|
||||
select WEBNET_USING_ALIAS
|
||||
select WEBNET_USING_SSI
|
||||
select WEBNET_USING_UPLOAD
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(path, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
+1
Submodule APP_Framework/Applications/webnet/WebNet_XiUOS added at d7ac9f2711
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
SOURCES = []
|
||||
SOURCES = ['adapter_4g.c'] + SOURCES
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
path = [cwd]
|
||||
group = DefineGroup('4g', SOURCES, depend = [], CPPPATH = [cwd])
|
||||
objs = objs + group
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(path, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
@@ -111,3 +111,6 @@ int Adapter4GTest(void)
|
||||
return 0;
|
||||
}
|
||||
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, Adapter4GTest, Adapter4GTest, show adapter 4G information);
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
MSH_CMD_EXPORT(Adapter4GTestRTThread,a 4G adpter sample);
|
||||
#endif
|
||||
@@ -39,5 +39,31 @@ if ADD_NUTTX_FETURES
|
||||
endif
|
||||
|
||||
if ADD_RTTHREAD_FETURES
|
||||
config ADAPTER_EC200T_PWRKEY
|
||||
int "EC200T PWRKEY pin number"
|
||||
default "97"
|
||||
config ADAPTER_EC200T_PIN_DRIVER
|
||||
string "EC200T device pin driver path"
|
||||
default "/dev/pin_dev"
|
||||
|
||||
config ADAPTER_EC200T_DRIVER_EXTUART
|
||||
bool "Using extra uart to support 4G"
|
||||
default n
|
||||
|
||||
config ADAPTER_EC200T_DRIVER
|
||||
string "EC200T device uart driver path"
|
||||
default "/dev/usart8"
|
||||
depends on !ADAPTER_EC200T_DRIVER_EXTUART
|
||||
|
||||
if ADAPTER_EC200T_DRIVER_EXTUART
|
||||
config ADAPTER_EC200T_DRIVER
|
||||
string "EC200T device extra uart driver path"
|
||||
default "/dev/extuart_dev5"
|
||||
|
||||
config ADAPTER_EC200T_DRIVER_EXT_PORT
|
||||
int "if EC200T device using extuart, choose port"
|
||||
default "5"
|
||||
endif
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
if GetDepend(['ADAPTER_EC200T']):
|
||||
src += ['ec200t.c']
|
||||
group = DefineGroup('connection 4g ec200t', src, depend = [], CPPPATH = [cwd])
|
||||
|
||||
Return('group')
|
||||
@@ -40,9 +40,12 @@
|
||||
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static void Ec200tPowerSet(void){ return; }
|
||||
#else
|
||||
static void Ec200tPowerSet(void)
|
||||
{
|
||||
#else
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
static void Ec200tPowerSet(void){ return; }
|
||||
#else
|
||||
static void Ec200tPowerSet(void)
|
||||
{
|
||||
int pin_fd;
|
||||
pin_fd = PrivOpen(ADAPTER_EC200T_PIN_DRIVER, O_RDWR);
|
||||
if (pin_fd < 0) {
|
||||
@@ -73,7 +76,8 @@ static void Ec200tPowerSet(void)
|
||||
PrivClose(pin_fd);
|
||||
|
||||
PrivTaskDelay(10000);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int Ec200tOpen(struct Adapter *adapter)
|
||||
@@ -148,6 +152,9 @@ out:
|
||||
#ifdef ADD_NUTTX_FETURES
|
||||
static int Ec200tIoctl(struct Adapter *adapter, int cmd, void *args){ return 0;}
|
||||
#else
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
static int Ec200tIoctl(struct Adapter *adapter, int cmd, void *args){ return 0;}
|
||||
#else
|
||||
static int Ec200tIoctl(struct Adapter *adapter, int cmd, void *args)
|
||||
{
|
||||
if (OPE_INT != cmd) {
|
||||
@@ -175,12 +182,14 @@ static int Ec200tIoctl(struct Adapter *adapter, int cmd, void *args)
|
||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||
ioctl_cfg.args = &serial_cfg;
|
||||
PrivIoctl(adapter->fd, OPE_INT, &ioctl_cfg);
|
||||
|
||||
|
||||
Ec200tPowerSet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int Ec200tConnect(struct Adapter *adapter, enum NetRoleType net_role, const char *ip, const char *port, enum IpType ip_type)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,6 @@ int ATOrderSend(ATAgentType agent, uint32_t timeout_s, ATReplyType reply, const
|
||||
}
|
||||
|
||||
__out:
|
||||
// agent->reply = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -306,7 +305,6 @@ int EntmRecv(ATAgentType agent, char *rev_buffer, int buffer_len, int timeout_s)
|
||||
}
|
||||
PrivMutexObtain(&agent->lock);
|
||||
|
||||
|
||||
printf("EntmRecv once len %d.\n", agent->entm_recv_len);
|
||||
|
||||
memcpy(rev_buffer, agent->entm_recv_buf, agent->entm_recv_len);
|
||||
@@ -335,29 +333,24 @@ static int GetCompleteATReply(ATAgentType agent)
|
||||
|
||||
PrivMutexAbandon(&agent->lock);
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
PrivRead(agent->fd, &ch, 1);
|
||||
#ifdef CONNECTION_FRAMEWORK_DEBUG
|
||||
if(ch != 0){
|
||||
if(ch != 0) {
|
||||
printf(" %c (0x%x)\n", ch, ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
PrivMutexObtain(&agent->lock);
|
||||
if (agent->receive_mode == ENTM_MODE)
|
||||
{
|
||||
if (agent->entm_recv_len < ENTM_RECV_MAX)
|
||||
{
|
||||
if (agent->receive_mode == ENTM_MODE) {
|
||||
if (agent->entm_recv_len < ENTM_RECV_MAX) {
|
||||
agent->entm_recv_buf[agent->entm_recv_len] = ch;
|
||||
agent->entm_recv_len++;
|
||||
|
||||
if(agent->entm_recv_len < agent->read_len){
|
||||
if(agent->entm_recv_len < agent->read_len) {
|
||||
PrivMutexAbandon(&agent->lock);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
printf("ENTM_MODE recv %d Bytes done.\n",agent->entm_recv_len);
|
||||
agent->receive_mode = DEFAULT_MODE;
|
||||
PrivSemaphoreAbandon(&agent->entm_rx_notice);
|
||||
@@ -367,12 +360,9 @@ static int GetCompleteATReply(ATAgentType agent)
|
||||
printf("entm_recv_buf is_full ...\n");
|
||||
}
|
||||
}
|
||||
else if (agent->receive_mode == AT_MODE)
|
||||
{
|
||||
if (read_len < agent->maintain_max)
|
||||
{
|
||||
if(ch != 0) ///< if the char is null then do not save it to the buff
|
||||
{
|
||||
else if (agent->receive_mode == AT_MODE) {
|
||||
if (read_len < agent->maintain_max) {
|
||||
if(ch != 0) { ///< if the char is null then do not save it to the buff
|
||||
agent->maintain_buffer[read_len] = ch;
|
||||
read_len++;
|
||||
agent->maintain_len = read_len;
|
||||
@@ -386,7 +376,7 @@ static int GetCompleteATReply(ATAgentType agent)
|
||||
if (((ch == '\n') && (last_ch == '\r') && (agent->reply_lr_end)) ||
|
||||
((ch == agent->reply_end_char) && (agent->reply_end_char) &&
|
||||
(last_ch == agent->reply_end_last_char) && (agent->reply_end_last_char)) ||
|
||||
((read_len == agent->reply_char_num) && (agent->reply_char_num))){
|
||||
((read_len == agent->reply_char_num) && (agent->reply_char_num))) {
|
||||
if (is_full) {
|
||||
printf("read line failed. The line data length is out of buffer size(%d)!", agent->maintain_max);
|
||||
memset(agent->maintain_buffer, 0x00, agent->maintain_max);
|
||||
@@ -446,11 +436,13 @@ int DeleteATAgent(ATAgentType agent)
|
||||
PrivMutexDelete(&agent->lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
if (agent->entm_rx_notice) {
|
||||
printf("delete agent entm_rx_notice = %d\n",agent->entm_rx_notice);
|
||||
PrivSemaphoreDelete(&agent->entm_rx_notice);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
if (agent->rsp_sem) {
|
||||
printf("delete agent rsp_sem = %d\n",agent->rsp_sem);
|
||||
@@ -471,10 +463,9 @@ static void *ATAgentReceiveProcess(void *param)
|
||||
const struct at_urc *urc;
|
||||
|
||||
while (1) {
|
||||
if (GetCompleteATReply(agent) > 0)
|
||||
{
|
||||
if (GetCompleteATReply(agent) > 0) {
|
||||
PrivMutexObtain(&agent->lock);
|
||||
if (agent->reply != NULL){
|
||||
if (agent->reply != NULL) {
|
||||
ATReplyType reply = agent->reply;
|
||||
|
||||
agent->maintain_buffer[agent->maintain_len] = '\0';
|
||||
@@ -513,13 +504,13 @@ static int ATAgentInit(ATAgentType agent)
|
||||
printf("ATAgentInit create entm sem error\n");
|
||||
goto __out;
|
||||
}
|
||||
printf("create entm_rx_notice_sem %d\n ",agent->entm_rx_notice);
|
||||
|
||||
result = PrivSemaphoreCreate(&agent->rsp_sem, 0, 0);
|
||||
if (result < 0) {
|
||||
printf("ATAgentInit create rsp sem error\n");
|
||||
goto __out;
|
||||
}
|
||||
printf("create rsp_sem %d\n ",agent->rsp_sem);
|
||||
|
||||
if(PrivMutexCreate(&agent->lock, 0) < 0) {
|
||||
printf("AdapterFrameworkInit mutex create failed.\n");
|
||||
goto __out;
|
||||
@@ -539,7 +530,7 @@ static int ATAgentInit(ATAgentType agent)
|
||||
#endif
|
||||
|
||||
PrivTaskCreate(&agent->at_handler, &attr, ATAgentReceiveProcess, agent);
|
||||
printf("create agent->at_handler = %d\n",agent->at_handler);
|
||||
|
||||
return result;
|
||||
|
||||
__out:
|
||||
|
||||
@@ -74,7 +74,11 @@ struct ATAgent
|
||||
char entm_recv_buf[ENTM_RECV_MAX];
|
||||
uint32 entm_recv_len;
|
||||
enum ReceiveMode receive_mode;
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
int entm_rx_notice;
|
||||
#else
|
||||
sem_t entm_rx_notice;
|
||||
#endif
|
||||
};
|
||||
typedef struct ATAgent *ATAgentType;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
SOURCES = []
|
||||
SOURCES = ['adapter_bluetooth.c'] + SOURCES
|
||||
if GetDepend(['CONNECTION_ADAPTER_BLUETOOTH']):
|
||||
SOURCES = ['adapter_bluetooth.c'] + SOURCES
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
path = [cwd]
|
||||
|
||||
@@ -90,12 +90,15 @@ int AdapterBlueToothTest(void)
|
||||
|
||||
#ifdef ADAPTER_HC08
|
||||
AdapterDeviceOpen(adapter);
|
||||
|
||||
//if bluetooth master and slave have already match, no need to AdapterDeviceControl and AdapterDeviceConnect
|
||||
AdapterDeviceControl(adapter, OPE_INT, &baud_rate);
|
||||
//AdapterDeviceConnect(adapter, adapter->net_role, NULL, NULL, 0);
|
||||
|
||||
len = strlen(bluetooth_msg);
|
||||
|
||||
while (1) {
|
||||
AdapterDeviceRecv(adapter, bluetooth_recv_msg, 128);
|
||||
AdapterDeviceRecv(adapter, bluetooth_recv_msg, 8);
|
||||
printf("bluetooth_recv_msg %s\n", bluetooth_recv_msg);
|
||||
AdapterDeviceSend(adapter, bluetooth_msg, len);
|
||||
printf("send %s after recv\n", bluetooth_msg);
|
||||
@@ -111,5 +114,5 @@ int AdapterBlueToothTest(void)
|
||||
MSH_CMD_EXPORT(AdapterBlueToothTest,a bt adpter sample);
|
||||
#endif
|
||||
#ifdef ADD_XIZI_FETURES
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterWifiTest, AdapterWifiTest, show adapter wifi information);
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterBlueToothTest, AdapterBlueToothTest, show adapter bluetooth information);
|
||||
#endif
|
||||
@@ -37,6 +37,12 @@
|
||||
#define HC08_SET_ADDR_CMD "AT+ADDR=%s"
|
||||
#define HC08_GET_NAME_CMD "AT+NAME=%s"
|
||||
#define HC08_SET_NAME_CMD "AT+NAME=?"
|
||||
#define HC08_GET_LUUID_CMD "AT+LUUID=?"
|
||||
#define HC08_SET_LUUID_CMD "AT+LUUID=%u"
|
||||
#define HC08_GET_SUUID_CMD "AT+SUUID=?"
|
||||
#define HC08_SET_SUUID_CMD "AT+SUUID=%u"
|
||||
#define HC08_GET_TUUID_CMD "AT+TUUID=?"
|
||||
#define HC08_SET_TUUID_CMD "AT+TUUID=%u"
|
||||
|
||||
#define HC08_OK_RESP "OK"
|
||||
|
||||
@@ -60,6 +66,12 @@ enum Hc08AtCmd
|
||||
HC08_AT_CMD_GET_ADDR,
|
||||
HC08_AT_CMD_SET_NAME,
|
||||
HC08_AT_CMD_GET_NAME,
|
||||
HC08_AT_CMD_SET_LUUID,
|
||||
HC08_AT_CMD_GET_LUUID,
|
||||
HC08_AT_CMD_SET_SUUID,
|
||||
HC08_AT_CMD_GET_SUUID,
|
||||
HC08_AT_CMD_SET_TUUID,
|
||||
HC08_AT_CMD_GET_TUUID,
|
||||
HC08_AT_CMD_END,
|
||||
};
|
||||
|
||||
@@ -85,7 +97,7 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
||||
{
|
||||
const char *result_buf;
|
||||
char *connectable, *role;
|
||||
unsigned int baudrate;
|
||||
unsigned int baudrate, luuid;
|
||||
char reply_ok_flag = 1;
|
||||
char cmd_str[HC08_CMD_STR_DEFAULT_SIZE] = {0};
|
||||
|
||||
@@ -166,6 +178,18 @@ static int Hc08AtConfigure(ATAgentType agent, enum Hc08AtCmd hc08_at_cmd, void *
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_NAME_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_GET_LUUID:
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, HC08_GET_LUUID_CMD);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
case HC08_AT_CMD_SET_LUUID:
|
||||
luuid = *(unsigned int *)param;
|
||||
sprintf(cmd_str, HC08_SET_LUUID_CMD, luuid);
|
||||
AtSetReplyCharNum(agent, 13);
|
||||
ATOrderSend(agent, REPLY_TIME_OUT, reply, cmd_str);
|
||||
reply_ok_flag = 0;
|
||||
break;
|
||||
default:
|
||||
printf("hc08 do not support no.%d cmd\n", hc08_at_cmd);
|
||||
DeleteATReply(reply);
|
||||
@@ -205,10 +229,29 @@ static int Hc08Open(struct Adapter *adapter)
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct SerialDataCfg serial_cfg;
|
||||
memset(&serial_cfg, 0 ,sizeof(struct SerialDataCfg));
|
||||
serial_cfg.serial_baud_rate = 9600;
|
||||
serial_cfg.serial_data_bits = DATA_BITS_8;
|
||||
serial_cfg.serial_stop_bits = STOP_BITS_1;
|
||||
serial_cfg.serial_buffer_size = SERIAL_RB_BUFSZ;
|
||||
serial_cfg.serial_parity_mode = PARITY_NONE;
|
||||
serial_cfg.serial_bit_order = STOP_BITS_1;
|
||||
serial_cfg.serial_invert_mode = NRZ_NORMAL;
|
||||
#ifdef ADAPTER_HC08_DRIVER_EXT_PORT
|
||||
serial_cfg.ext_uart_no = ADAPTER_HC08_DRIVER_EXT_PORT;
|
||||
serial_cfg.port_configure = PORT_CFG_INIT;
|
||||
#endif
|
||||
|
||||
struct PrivIoctlCfg ioctl_cfg;
|
||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||
ioctl_cfg.args = &serial_cfg;
|
||||
PrivIoctl(adapter->fd, OPE_INT, &ioctl_cfg);
|
||||
|
||||
//step2: init AT agent
|
||||
if (!adapter->agent) {
|
||||
char *agent_name = "bluetooth_uart_client";
|
||||
printf("InitATAgent agent_name %s fd %u\n", agent_name, adapter->fd);
|
||||
|
||||
if (0 != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
printf("at agent init failed !\n");
|
||||
return -1;
|
||||
@@ -274,8 +317,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
||||
return -1;
|
||||
}
|
||||
|
||||
char hc08_baudrate[HC08_RESP_DEFAULT_SIZE] = {0};
|
||||
uint32_t baud_rate = *((uint32_t *)args);
|
||||
uint32_t luuid;
|
||||
|
||||
struct SerialDataCfg serial_cfg;
|
||||
memset(&serial_cfg, 0 ,sizeof(struct SerialDataCfg));
|
||||
@@ -291,6 +334,8 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
||||
serial_cfg.port_configure = PORT_CFG_INIT;
|
||||
#endif
|
||||
|
||||
serial_cfg.serial_timeout = -1;
|
||||
|
||||
struct PrivIoctlCfg ioctl_cfg;
|
||||
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
|
||||
ioctl_cfg.args = &serial_cfg;
|
||||
@@ -306,11 +351,29 @@ static int Hc08Ioctl(struct Adapter *adapter, int cmd, void *args)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PrivTaskDelay(200);
|
||||
//Step3 : clear hc08 configure
|
||||
if (MASTER == adapter->net_role) {
|
||||
PrivTaskDelay(300);
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_CLEAR, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
PrivTaskDelay(500);
|
||||
|
||||
//Step3 : show hc08 device info, hc08_get send "AT+RX" response device info
|
||||
char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
|
||||
// char device_info[HC08_RESP_DEFAULT_SIZE * 2] = {0};
|
||||
// if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_DEVICE_INFO, NULL, device_info) < 0) {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
//Step4 : set LUUID、SUUID、TUUID, slave and master need to have same uuid param
|
||||
luuid = 1234;
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_SET_LUUID, &luuid, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (Hc08AtConfigure(adapter->agent, HC08_AT_CMD_GET_LUUID, NULL, NULL) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
from building import *
|
||||
SOURCES = []
|
||||
if GetDepend(['CONNECTION_ADAPTER_ETHERNET']):
|
||||
SOURCES = ['adapter_ethernet.c'] + SOURCES
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
path = [cwd]
|
||||
group = DefineGroup('ethernet', SOURCES, depend = [], CPPPATH = [cwd])
|
||||
objs = objs + group
|
||||
list = os.listdir(cwd)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(path, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
@@ -97,28 +97,33 @@ int AdapterEthernetTest(void)
|
||||
|
||||
AdapterDeviceSetUp(adapter);
|
||||
|
||||
const char *ip = "10.10.100.50";
|
||||
const char *port = "12345";
|
||||
const char *ip = "192.168.131.26";
|
||||
const char *port = "9999";
|
||||
enum NetRoleType net_role = CLIENT;//SERVER
|
||||
enum IpType ip_type = IPV4;
|
||||
AdapterDeviceConnect(adapter, net_role, ip, port, ip_type);
|
||||
|
||||
printf("ready to test data transfer\n");
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
len = strlen(ethernet_msg);
|
||||
for (i = 0;i < 10; i ++) {
|
||||
printf("AdapterEthernetTest send %s\n", ethernet_msg);
|
||||
AdapterDeviceSend(adapter, ethernet_msg, len);
|
||||
PrivTaskDelay(4000);
|
||||
}
|
||||
|
||||
|
||||
while (1) {
|
||||
AdapterDeviceRecv(adapter, ethernet_recv_msg, 128);
|
||||
printf("AdapterEthernetTest recv %s\n", ethernet_recv_msg);
|
||||
memset(ethernet_recv_msg, 0, 128);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef ADD_RTTHREAD_FETURES
|
||||
MSH_CMD_EXPORT(AdapterEthernetTest,a ethernet adpter sample);
|
||||
#elif definded ADD_XIZI_FETURES
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, AdapterEthernetTest, AdapterEthernetTest, show adapter ethernet information);
|
||||
#endif
|
||||
|
||||
@@ -29,5 +29,7 @@ if ADD_NUTTX_FETURES
|
||||
endif
|
||||
|
||||
if ADD_RTTHREAD_FETURES
|
||||
|
||||
config ADAPTER_HFA21_DRIVER
|
||||
string "HFA21 device uart driver path"
|
||||
default "/dev/uart3"
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
if GetDepend(['ADAPTER_HFA21_ETHERNET']):
|
||||
src += ['hfa21_ethernet.c']
|
||||
group = DefineGroup('connection ethernet hfa21', src, depend = [], CPPPATH = [cwd])
|
||||
|
||||
Return('group')
|
||||
@@ -72,7 +72,7 @@ static int Hfa21EthernetOpen(struct Adapter *adapter)
|
||||
/*step2: init AT agent*/
|
||||
if (!adapter->agent) {
|
||||
char *agent_name = "ethernet_uart_client";
|
||||
if (EOK != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
if (0 != InitATAgent(agent_name, adapter->fd, 512)) {
|
||||
printf("at agent init failed !\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -168,19 +168,20 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
|
||||
Hfa21EthernetInitAtCmd(adapter->agent);
|
||||
|
||||
/*Step3 : FEPHY enable phy function*/
|
||||
/*Step3 : FEPHY enable phy function*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_FEPHY_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step4 : FVEW disable WANN function, ethernet work at LANN mode*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_DISABLE_WANN_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
/*Step5 : RELD enable F-AT cmd*/
|
||||
PrivTaskDelay(2000);
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_RELD_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
@@ -195,13 +196,13 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step7 : AT+WANN check if get ip、netmask、gateway*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_WANN_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
PrivTaskDelay(2000);
|
||||
/*Step8 : AT+Z reboot hfa21 device*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_REBOOT_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
if (ret < 0) {
|
||||
@@ -209,7 +210,6 @@ static int Hfa21EthernetSetUp(struct Adapter *adapter)
|
||||
}
|
||||
|
||||
PrivTaskDelay(10000);
|
||||
|
||||
return ret;
|
||||
|
||||
__exit:
|
||||
@@ -365,6 +365,7 @@ static int Hfa21EthernetConnect(struct Adapter *adapter, enum NetRoleType net_ro
|
||||
}
|
||||
|
||||
adapter->net_role = net_role;
|
||||
PrivTaskDelay(2000);
|
||||
|
||||
/*Step3 : AT+Z reboot hfa21 device*/
|
||||
ret = AtCmdConfigAndCheck(adapter->agent, HFA21_ETHERNET_AT_REBOOT_CMD, HFA21_ETHERNET_OK_REPLY);
|
||||
|
||||
@@ -5,3 +5,11 @@ config CONNECTION_ADAPTER_ETHERCAT
|
||||
if CONNECTION_ADAPTER_ETHERCAT
|
||||
source "$APP_DIR/Framework/connection/industrial_ethernet/ethercat/Kconfig"
|
||||
endif
|
||||
|
||||
menuconfig POWERLINK_MN
|
||||
bool "Using powerlink MN"
|
||||
default n
|
||||
|
||||
menuconfig POWERLINK_CN
|
||||
bool "Using powerlink CN"
|
||||
default n
|
||||
|
||||
@@ -1,3 +1,55 @@
|
||||
include $(KERNEL_ROOT)/.config
|
||||
|
||||
all: COMPILER
|
||||
|
||||
CUR_DIR := $(shell pwd)
|
||||
OPLK_ROOT := $(CUR_DIR)/openPOWERLINK
|
||||
LIBOPLKMN := $(OPLK_ROOT)/stack/lib/xiuos/arm/liboplkmn.a
|
||||
LIBOPLKCN := $(OPLK_ROOT)/stack/lib/xiuos/arm/liboplkcn.a
|
||||
LIBOPLK_BUILD_DIR := $(OPLK_ROOT)/stack/build/xiuos
|
||||
OPLK_DEMO_MN_CONSOLE := $(OPLK_ROOT)/bin/xiuos/arm/demo_mn_console/libdemo_mn_console.a
|
||||
OPLK_DEMO_CN_CONSOLE := $(OPLK_ROOT)/bin/xiuos/arm/demo_cn_console/libdemo_cn_console.a
|
||||
OPLK_DEMO_MN_CONSOLE_BUILD_DIR := $(OPLK_ROOT)/apps/demo_mn_console/build/xiuos
|
||||
OPLK_DEMO_CN_CONSOLE_BUILD_DIR := $(OPLK_ROOT)/apps/demo_cn_console/build/xiuos
|
||||
OPLK_TOOLCHAIN := $(OPLK_ROOT)/cmake/toolchain-xiuos-arm-none-eabi-gnu.cmake
|
||||
|
||||
define oplk_build
|
||||
cd $(1) && \
|
||||
find . ! -name '.' ! -name '.gitignore' -exec rm -rf {} + && \
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=$(OPLK_TOOLCHAIN) ../.. && \
|
||||
cmake --build . --target install
|
||||
endef
|
||||
|
||||
.PHONY: $(LIBOPLKMN) $(LIBOPLKCN)
|
||||
$(LIBOPLKMN) $(LIBOPLKCN)&:
|
||||
$(call oplk_build,$(LIBOPLK_BUILD_DIR))
|
||||
$(LIBOPLKMN):
|
||||
$(call oplk_build,$(LIBOPLK_BUILD_DIR))
|
||||
$(LIBOPLKCN):
|
||||
$(call oplk_build,$(LIBOPLK_BUILD_DIR))
|
||||
|
||||
.PHONY: $(OPLK_DEMO_MN_CONSOLE)
|
||||
$(OPLK_DEMO_MN_CONSOLE): ${LIBOPLKMN}
|
||||
$(call oplk_build,$(OPLK_DEMO_MN_CONSOLE_BUILD_DIR))
|
||||
|
||||
.PHONY: $(OPLK_DEMO_CN_CONSOLE)
|
||||
$(OPLK_DEMO_CN_CONSOLE): ${LIBOPLKCN}
|
||||
$(call oplk_build,$(OPLK_DEMO_CN_CONSOLE_BUILD_DIR))
|
||||
|
||||
LIBOPLKMN := $(LIBOPLKMN:$(CUR_DIR)/%=%)
|
||||
LIBOPLKCN := $(LIBOPLKCN:$(CUR_DIR)/%=%)
|
||||
OPLK_DEMO_MN_CONSOLE := $(OPLK_DEMO_MN_CONSOLE:$(CUR_DIR)/%=%)
|
||||
OPLK_DEMO_CN_CONSOLE := $(OPLK_DEMO_CN_CONSOLE:$(CUR_DIR)/%=%)
|
||||
|
||||
SRC_FILES := powerlink_demo.c
|
||||
ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),y_)
|
||||
SRC_FILES += $(OPLK_DEMO_MN_CONSOLE) $(LIBOPLKMN)
|
||||
else ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),_y)
|
||||
SRC_FILES += $(OPLK_DEMO_CN_CONSOLE) $(LIBOPLKCN)
|
||||
else ifeq ($(CONFIG_POWERLINK_MN)_$(CONFIG_POWERLINK_CN),y_y)
|
||||
$(error CONFIG_POWERLINK_MN and CONFIG_POWERLINK_CN cannot be enabled simultaneously due to name conflict)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CONNECTION_ADAPTER_ETHERCAT),y)
|
||||
SRC_DIR += ethercat
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
.gitreview
|
||||
.metadata/
|
||||
.settings
|
||||
.project
|
||||
.cproject
|
||||
*~
|
||||
*.orig
|
||||
*.bak
|
||||
@@ -0,0 +1,89 @@
|
||||
################################################################################
|
||||
#
|
||||
# \file .travis.yml
|
||||
#
|
||||
# \brief Configuration file for Travis continuous integration
|
||||
#
|
||||
# Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
################################################################################
|
||||
language: c
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
env:
|
||||
global:
|
||||
- GIT_COMMIT=$TRAVIS_COMMIT
|
||||
- VERA_ROOT=/home/travis/build/OpenAutomationTechnologies/openPOWERLINK_V2/tools/checkstyle/.vera++/
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- cmake-data
|
||||
- cmake
|
||||
- qtbase5-dev
|
||||
- libtcl8.5
|
||||
- vera++
|
||||
|
||||
before_install:
|
||||
# Execute commit message guidelines check
|
||||
- chmod +x tools/checkstyle/checkcommit.sh
|
||||
- ./tools/checkstyle/checkcommit.sh
|
||||
|
||||
before_script:
|
||||
# Print build info that binary is compiled with
|
||||
- echo $TRAVIS_COMMIT
|
||||
- echo $TRAVIS_COMMIT_MESSAGE
|
||||
- echo $TRAVIS_COMMIT_RANGE
|
||||
- echo $TRAVIS_TAG
|
||||
- echo $TRAVIS_BRANCH
|
||||
- echo $TRAVIS_BUILD_NUMBER
|
||||
- echo $TRAVIS_REPO_SLUG
|
||||
|
||||
# Run vera++ coding guidelines check
|
||||
- cp -r /usr/lib/vera++ tools/checkstyle/.vera++
|
||||
- cp /usr/bin/vera++ tools/checkstyle/.vera++/vera++
|
||||
- chmod +x tools/checkstyle/checkoplkstyle.sh
|
||||
- ./tools/checkstyle/checkoplkstyle.sh
|
||||
|
||||
script:
|
||||
- cd drivers/linux/drv_kernelmod_edrv/build/
|
||||
- cmake ..
|
||||
- cd ../../../../stack/build/linux
|
||||
- cmake ../..
|
||||
- make install
|
||||
- cd ../../../apps/demo_mn_console/build/linux
|
||||
- cmake ../..
|
||||
- make install
|
||||
- cd ../../../demo_mn_qt/build/linux
|
||||
- cmake ../..
|
||||
- make install
|
||||
- cd ../../../demo_cn_console/build/linux
|
||||
- cmake ../..
|
||||
- make install
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
################################################################################
|
||||
#
|
||||
# Altera Cyclone V ARM configuration options for openPOWERLINK stack
|
||||
#
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2015, Kalycito Infotech Private Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Handle includes
|
||||
SET(CMAKE_MODULE_PATH "${OPLK_BASE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
INCLUDE(setalteraarmboardconfig)
|
||||
INCLUDE(listdir)
|
||||
INCLUDE(geneclipsefilelist)
|
||||
INCLUDE(geneclipseincludelist)
|
||||
INCLUDE(geneclipseflaglist)
|
||||
INCLUDE(geneclipselibrarylist)
|
||||
|
||||
################################################################################
|
||||
# Path to the hardware library folder of your board example
|
||||
SET(CFG_HW_LIB_PATH ${OPLK_BASE_DIR}/hardware/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR}
|
||||
CACHE PATH "Path to the hardware library folder")
|
||||
|
||||
SET(CPU_INST_NAME HOST)
|
||||
# Get subdirectories (board/demo)
|
||||
LIST_SUBDIRECTORIES(HW_BOARD_DEMOS ${CFG_HW_LIB_PATH} 2)
|
||||
|
||||
SET(CFG_HW_LIB altera-c5soc/mn-soc-shmem-gpio CACHE STRING
|
||||
"Subfolder of hardware board demo")
|
||||
SET_PROPERTY(CACHE CFG_HW_LIB PROPERTY STRINGS ${HW_BOARD_DEMOS})
|
||||
|
||||
SET(CFG_HW_LIB_DIR ${CFG_HW_LIB_PATH}/${CFG_HW_LIB})
|
||||
|
||||
################################################################################
|
||||
# Include board specific settings file
|
||||
# TODO Only source the options set during hardware build
|
||||
SET_BOARD_CONFIGURATION(${CFG_HW_LIB_DIR})
|
||||
################################################################################
|
||||
# Get the driver binary and fpga bitstream files for booting from SD card
|
||||
IF (DEFINED CFG_${CPU_INST_NAME}_BOOT_FROM_SDCARD AND CFG_${CPU_INST_NAME}_BOOT_FROM_SDCARD)
|
||||
SET(CFG_DRV_BLD_PATH ${OPLK_BASE_DIR}/drivers/altera-nios2/drv_daemon/build
|
||||
CACHE STRING "openPOWERLINK driver build path")
|
||||
SET(CFG_DRV_BIN ${CFG_DRV_BLD_PATH}/drv_daemon.bin
|
||||
CACHE STRING "openPOWERLINK driver executable")
|
||||
SET(CFG_FPGA_RBF ${CFG_DRV_BLD_PATH}/fpga.rbf
|
||||
CACHE STRING "Cylone V FPGA configuration(rbf) file")
|
||||
ELSE()
|
||||
UNSET(CFG_DRV_BLD_PATH CACHE)
|
||||
UNSET(CFG_DRV_BIN CACHE)
|
||||
UNSET(CFG_FPGA_RBF CACHE)
|
||||
ENDIF ()
|
||||
|
||||
# Set variables
|
||||
SET(ARCH_EXE_SUFFIX ".axf")
|
||||
SET(ARCH_INSTALL_POSTFIX ${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
|
||||
SET(ALT_TOOLS_DIR ${TOOLS_DIR}/altera-arm)
|
||||
|
||||
################################################################################
|
||||
# Stack configuration
|
||||
SET(CFG_BUILD_KERNEL_STACK "PCP Daemon Shared Memory Interface"
|
||||
CACHE STRING "Configure how to build the kernel stack")
|
||||
|
||||
SET(KernelStackBuildTypes
|
||||
"PCP Daemon Shared Memory Interface;None"
|
||||
CACHE INTERNAL
|
||||
"List of possible kernel stack build types")
|
||||
|
||||
SET_PROPERTY(CACHE CFG_BUILD_KERNEL_STACK
|
||||
PROPERTY STRINGS ${KernelStackBuildTypes})
|
||||
|
||||
IF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
SET(CFG_KERNEL_STACK_DIRECTLINK ON CACHE INTERNAL
|
||||
"Link kernel stack directly into application (Single process solution)")
|
||||
UNSET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE CACHE)
|
||||
UNSET(CFG_KERNEL_DUALPROCSHM CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "PCP Daemon Host-Interface")
|
||||
|
||||
SET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE ON CACHE INTERNAL
|
||||
"Build kernel stack as PCP daemon (dual processor)")
|
||||
UNSET(CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET(CFG_KERNEL_DUALPROCSHM CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "PCP Daemon Shared Memory Interface")
|
||||
|
||||
SET(CFG_KERNEL_DUALPROCSHM ON CACHE INTERNAL
|
||||
"Build kernel stack as PCP daemon (dual processor)")
|
||||
UNSET(CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "None")
|
||||
UNSET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE CACHE)
|
||||
UNSET(CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET(CFG_KERNEL_DUALPROCSHM CACHE)
|
||||
|
||||
ENDIF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
################################################################################
|
||||
#
|
||||
# Linux configuration options for openPOWERLINK demo applications
|
||||
#
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2016, kalycito Infotech Private Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
SET(CFG_BUILD_KERNEL_STACK "Link to Application"
|
||||
CACHE STRING "Configure how to build the kernel stack")
|
||||
|
||||
SET(KernelStackBuildTypes
|
||||
"Link to Application;Linux Userspace Daemon;Linux Kernel Module;Kernel stack on PCIe card;Kernel stack on Zynq PCP;None"
|
||||
CACHE INTERNAL
|
||||
"List of possible kernel stack build types")
|
||||
|
||||
SET_PROPERTY(CACHE CFG_BUILD_KERNEL_STACK
|
||||
PROPERTY STRINGS ${KernelStackBuildTypes})
|
||||
|
||||
IF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
SET (CFG_KERNEL_STACK_DIRECTLINK ON CACHE INTERNAL
|
||||
"Link kernel stack directly into application (Single process solution)")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Linux Userspace Daemon")
|
||||
|
||||
SET (CFG_KERNEL_STACK_USERSPACE_DAEMON ON CACHE INTERNAL
|
||||
"Build kernel stack as Linux userspace daemon")
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Linux Kernel Module")
|
||||
|
||||
SET (CFG_KERNEL_STACK_KERNEL_MODULE ON CACHE INTERNAL
|
||||
"Build kernel stack as Linux kernelspace module")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Kernel stack on PCIe card")
|
||||
|
||||
SET (CFG_KERNEL_STACK_PCIE_INTF ON CACHE INTERNAL
|
||||
"Build kernel stack on an external PCIe device")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Kernel stack on Zynq PCP")
|
||||
|
||||
SET (CFG_KERNEL_STACK_ZYNQ_INTF ON CACHE INTERNAL
|
||||
"Build kernel stack on an external zynq PCP device")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "None")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ENDIF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
################################################################################
|
||||
#
|
||||
# Microblaze ISE configuration options for openPOWERLINK stack
|
||||
#
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2016, Kalycito Infotech Private Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Handle includes
|
||||
SET(CMAKE_MODULE_PATH "${OPLK_BASE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
INCLUDE(geneclipsefilelist)
|
||||
INCLUDE(geneclipseincludelist)
|
||||
INCLUDE(setmicroblazeiseboardconfig)
|
||||
INCLUDE(listdir)
|
||||
|
||||
################################################################################
|
||||
# Path to the hardware library folder of your board example
|
||||
SET(CFG_HW_LIB_PATH ${OPLK_BASE_DIR}/hardware/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR}
|
||||
CACHE PATH "Path to the hardware library folder")
|
||||
|
||||
# Get subdirectories (board/demo)
|
||||
LIST_SUBDIRECTORIES(HW_BOARD_DEMOS ${CFG_HW_LIB_PATH} 2)
|
||||
|
||||
SET(CFG_HW_LIB avnet-s6plkeb/cn-single-gpio CACHE STRING
|
||||
"Subfolder of hardware board demo")
|
||||
SET_PROPERTY(CACHE CFG_HW_LIB PROPERTY STRINGS ${HW_BOARD_DEMOS})
|
||||
|
||||
SET(CFG_HW_LIB_DIR ${CFG_HW_LIB_PATH}/${CFG_HW_LIB})
|
||||
|
||||
################################################################################
|
||||
# Include board specific settings file
|
||||
SET_BOARD_CONFIGURATION(${CFG_HW_LIB_DIR})
|
||||
|
||||
################################################################################
|
||||
# Set variables
|
||||
SET(ARCH_EXE_SUFFIX ".elf")
|
||||
SET(ARCH_INSTALL_POSTFIX ${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
|
||||
SET(XIL_TOOLS_DIR ${TOOLS_DIR}/xilinx-microblaze)
|
||||
|
||||
################################################################################
|
||||
# Stack configuration
|
||||
SET(CFG_BUILD_KERNEL_STACK "Link to Application"
|
||||
CACHE STRING "Configure how to build the kernel stack")
|
||||
|
||||
SET(KernelStackBuildTypes
|
||||
"Link to Application;PCP Daemon Host-Interface;None"
|
||||
CACHE INTERNAL
|
||||
"List of possible kernel stack build types")
|
||||
|
||||
SET_PROPERTY(CACHE CFG_BUILD_KERNEL_STACK
|
||||
PROPERTY STRINGS ${KernelStackBuildTypes})
|
||||
|
||||
IF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
SET(CFG_KERNEL_STACK_DIRECTLINK ON CACHE INTERNAL
|
||||
"Link kernel stack directly into application (Single process solution)")
|
||||
UNSET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "PCP Daemon Host-Interface")
|
||||
|
||||
SET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE ON CACHE INTERNAL
|
||||
"Build kernel stack as PCP daemon (dual processor)")
|
||||
UNSET(CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "None")
|
||||
UNSET(CFG_KERNEL_STACK_PCP_HOSTIF_MODULE CACHE)
|
||||
UNSET(CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
|
||||
ENDIF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
################################################################################
|
||||
#
|
||||
# Windows configuration options for openPOWERLINK stack
|
||||
#
|
||||
# Copyright (c) 2015, Kalycito Infotech Private Limited
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
SET (CFG_BUILD_KERNEL_STACK "Link to Application"
|
||||
CACHE STRING "Configure how to build the kernel stack")
|
||||
|
||||
SET (KernelStackBuildTypes
|
||||
"Link to Application;Kernel stack on PCIe card;Windows Kernel Module;None"
|
||||
CACHE INTERNAL
|
||||
"List of possible kernel stack build types")
|
||||
|
||||
SET_PROPERTY(CACHE CFG_BUILD_KERNEL_STACK
|
||||
PROPERTY STRINGS ${KernelStackBuildTypes})
|
||||
|
||||
IF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
SET (CFG_KERNEL_STACK_DIRECTLINK ON CACHE INTERNAL
|
||||
"Link kernel stack directly into application (Single process solution)")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Kernel stack on PCIe card")
|
||||
SET (CFG_KERNEL_STACK_PCIE ON CACHE INTERNAL
|
||||
"Build kernel stack on PCIe card")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Windows Kernel Module")
|
||||
|
||||
SET (CFG_KERNEL_STACK_KERNEL_MODULE ON CACHE INTERNAL
|
||||
"Build kernel stack as Windows kernelspace driver")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "None")
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
|
||||
ENDIF ()
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
################################################################################
|
||||
#
|
||||
# XiUOS configuration options for openPOWERLINK demo applications
|
||||
#
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2016, kalycito Infotech Private Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
SET(CFG_BUILD_KERNEL_STACK "Link to Application"
|
||||
CACHE STRING "Configure how to build the kernel stack")
|
||||
|
||||
SET(KernelStackBuildTypes
|
||||
"Link to Application;Linux Userspace Daemon;Linux Kernel Module;Kernel stack on PCIe card;Kernel stack on Zynq PCP;None"
|
||||
CACHE INTERNAL
|
||||
"List of possible kernel stack build types")
|
||||
|
||||
SET_PROPERTY(CACHE CFG_BUILD_KERNEL_STACK
|
||||
PROPERTY STRINGS ${KernelStackBuildTypes})
|
||||
|
||||
IF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
SET (CFG_KERNEL_STACK_DIRECTLINK ON CACHE INTERNAL
|
||||
"Link kernel stack directly into application (Single process solution)")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Linux Userspace Daemon")
|
||||
|
||||
SET (CFG_KERNEL_STACK_USERSPACE_DAEMON ON CACHE INTERNAL
|
||||
"Build kernel stack as Linux userspace daemon")
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Linux Kernel Module")
|
||||
|
||||
SET (CFG_KERNEL_STACK_KERNEL_MODULE ON CACHE INTERNAL
|
||||
"Build kernel stack as Linux kernelspace module")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Kernel stack on PCIe card")
|
||||
|
||||
SET (CFG_KERNEL_STACK_PCIE_INTF ON CACHE INTERNAL
|
||||
"Build kernel stack on an external PCIe device")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "Kernel stack on Zynq PCP")
|
||||
|
||||
SET (CFG_KERNEL_STACK_ZYNQ_INTF ON CACHE INTERNAL
|
||||
"Build kernel stack on an external zynq PCP device")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
|
||||
ELSEIF (CFG_BUILD_KERNEL_STACK STREQUAL "None")
|
||||
UNSET (CFG_KERNEL_STACK_USERSPACE_DAEMON CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_KERNEL_MODULE CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_DIRECTLINK CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_PCIE_INTF CACHE)
|
||||
UNSET (CFG_KERNEL_STACK_ZYNQ_INTF CACHE)
|
||||
|
||||
ENDIF (CFG_BUILD_KERNEL_STACK STREQUAL "Link to Application")
|
||||
|
||||
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
################################################################################
|
||||
#
|
||||
# CMake script for finding the openPOWERLINK library
|
||||
#
|
||||
# Copyright (c) 2014, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2016, Kalycito Infotech Private Limited
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
MACRO(FIND_OPLK_LIBRARY OPLK_NODE_TYPE)
|
||||
|
||||
UNSET(OPLKLIB CACHE)
|
||||
UNSET(OPLKLIB_DEBUG CACHE)
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
IF(CFG_KERNEL_STACK_DIRECTLINK)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE})
|
||||
ELSEIF (CFG_KERNEL_STACK_USERSPACE_DAEMON)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-userintf)
|
||||
ELSEIF (CFG_KERNEL_STACK_KERNEL_MODULE)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-kernelintf)
|
||||
ELSEIF ((CFG_KERNEL_STACK_PCIE_INTF) OR (CFG_KERNEL_STACK_ZYNQ_INTF))
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-kernelpcp)
|
||||
ENDIF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
|
||||
IF(CFG_KERNEL_STACK_DIRECTLINK)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE})
|
||||
ELSEIF (CFG_KERNEL_STACK_PCIE)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-pcieintf)
|
||||
ELSEIF (CFG_KERNEL_STACK_KERNEL_MODULE)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-kernelintf)
|
||||
ENDIF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "XiUOS")
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE})
|
||||
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Generic" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "Microblazeise")
|
||||
IF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE})
|
||||
ELSEIF (CFG_KERNEL_STACK_PCP_HOSTIF_MODULE)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-hostif)
|
||||
ENDIF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
|
||||
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Generic" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "alterac5arm")
|
||||
IF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE})
|
||||
ELSEIF (CFG_KERNEL_STACK_PCP_HOSTIF_MODULE)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-hostif)
|
||||
ELSEIF(CFG_KERNEL_DUALPROCSHM)
|
||||
SET(OPLKLIB_NAME oplk${OPLK_NODE_TYPE}app-dualprocshm)
|
||||
ELSE()
|
||||
MESSAGE("No configuration selected for ${CMAKE_SYSTEM_PROCESSOR}!!")
|
||||
ENDIF (CFG_KERNEL_STACK_DIRECTLINK)
|
||||
|
||||
ELSE ()
|
||||
|
||||
MESSAGE(FATAL_ERROR "Unsupported CMAKE_SYSTEM_NAME ${CMAKE_SYSTEM_NAME} or CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
ENDIF()
|
||||
|
||||
SET(OPLKLIB_DEBUG_NAME "${OPLKLIB_NAME}_d")
|
||||
|
||||
# Set oplk library directory
|
||||
SET(OPLKLIB_DIR ${OPLK_BASE_DIR}/stack/lib/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR})
|
||||
|
||||
IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Release"))
|
||||
# Search for release library
|
||||
UNSET(OPLKLIB CACHE)
|
||||
MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_NAME} in ${OPLKLIB_DIR}")
|
||||
FIND_LIBRARY(OPLKLIB NAME ${OPLKLIB_NAME}
|
||||
HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
|
||||
UNSET(OPLKDLL CACHE)
|
||||
FIND_PROGRAM(OPLKDLL NAME ${OPLKLIB_NAME}.dll
|
||||
HINTS ${OPLKLIB_DIR})
|
||||
|
||||
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
ENDIF()
|
||||
|
||||
IF((CMAKE_GENERATOR MATCHES "Visual Studio") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||
# Search for debug library
|
||||
UNSET(OPLKLIB_DEBUG CACHE)
|
||||
MESSAGE(STATUS "Searching for LIBRARY ${OPLKLIB_DEBUG_NAME} in ${OPLKLIB_DIR}")
|
||||
FIND_LIBRARY(OPLKLIB_DEBUG NAME ${OPLKLIB_DEBUG_NAME}
|
||||
HINTS ${OPLKLIB_DIR} ${OPLKLIB_DIR}/${CFG_DEMO_BOARD_NAME}/${CFG_DEMO_NAME})
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
|
||||
UNSET(OPLKDLL_DEBUG CACHE)
|
||||
FIND_PROGRAM(OPLKDLL_DEBUG NAME ${OPLKLIB_DEBUG_NAME}.dll
|
||||
HINTS ${OPLKLIB_DIR})
|
||||
|
||||
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
ENDIF()
|
||||
|
||||
ENDMACRO(FIND_OPLK_LIBRARY)
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
################################################################################
|
||||
#
|
||||
# CMake file for the firmware manager module.
|
||||
#
|
||||
# Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Setup module directory
|
||||
|
||||
SET(FIRMWARE_MANAGER_SOURCE_DIR ${COMMON_SOURCE_DIR}/firmwaremanager)
|
||||
|
||||
################################################################################
|
||||
# Setup module sources
|
||||
|
||||
SET(FIRMWARE_MANAGER_SOURCES
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwarestore-file.c
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwareinfodecode-ascii.c
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwareinfo.c
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwareupdate.c
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwarecheck.c
|
||||
${FIRMWARE_MANAGER_SOURCE_DIR}/firmwaremanager.c
|
||||
)
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
#
|
||||
# CMake script for linking with the openPOWERLINK library
|
||||
#
|
||||
# Copyright (c) 2015, B&R Industrial Automation GmbH
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
MACRO(OPLK_LINK_LIBRARIES EXECUTABLE_NAME)
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB} debug ${OPLKLIB_DEBUG})
|
||||
ELSE()
|
||||
IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} debug ${OPLKLIB_DEBUG})
|
||||
ELSE ()
|
||||
TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} optimized ${OPLKLIB})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO(OPLK_LINK_LIBRARIES)
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
################################################################################
|
||||
#
|
||||
# Generic CMake options openPOWERLINK demo applications
|
||||
#
|
||||
# Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
# Copyright (c) 2016, Kalycito Infotech Private Limited
|
||||
# Copyright (c) 2020, AIIT XUOS Lab
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holders nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
################################################################################
|
||||
|
||||
MESSAGE(STATUS "CMAKE_SYSTEM_NAME is ${CMAKE_SYSTEM_NAME}")
|
||||
MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR is ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
################################################################################
|
||||
# Set global directories
|
||||
################################################################################
|
||||
SET(OPLK_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
SET(DEMO_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
SET(DEMO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
SET(COMMON_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common/src)
|
||||
SET(OPENCONFIG_PROJ_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common/openCONFIGURATOR_projects)
|
||||
SET(CONTRIB_SOURCE_DIR ${OPLK_BASE_DIR}/contrib)
|
||||
SET(OPLK_INCLUDE_DIR ${OPLK_BASE_DIR}/stack/include)
|
||||
SET(TOOLS_DIR ${OPLK_BASE_DIR}/tools)
|
||||
SET(BOARDS_DIR ${OPLK_BASE_DIR}/hardware/boards)
|
||||
SET(OBJDICT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../common/objdicts)
|
||||
|
||||
################################################################################
|
||||
# Include CMake Modules
|
||||
################################################################################
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../common/cmake ${CMAKE_MODULE_PATH})
|
||||
|
||||
# include standard cmake modules
|
||||
INCLUDE(CMakeDependentOption)
|
||||
|
||||
# include project specific modules
|
||||
INCLUDE(findoplklib)
|
||||
INCLUDE(linkoplklib)
|
||||
|
||||
################################################################################
|
||||
# Set options
|
||||
################################################################################
|
||||
|
||||
STRING(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME_DIR)
|
||||
STRING(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_PROCESSOR_DIR)
|
||||
|
||||
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
SET(CMAKE_INSTALL_PREFIX
|
||||
${OPLK_BASE_DIR}/bin/${SYSTEM_NAME_DIR}/${SYSTEM_PROCESSOR_DIR} CACHE PATH "openPOWERLINK apps install prefix" FORCE
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE INTERNAL "Available Build Configurations" FORCE)
|
||||
|
||||
IF(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE Release CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release"
|
||||
FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(CFG_DEBUG_LVL "0xC0000000L" CACHE STRING "Debug Level for debug output")
|
||||
|
||||
# set global include directories
|
||||
INCLUDE_DIRECTORIES (
|
||||
${OPLK_INCLUDE_DIR}
|
||||
${CONTRIB_SOURCE_DIR}
|
||||
${COMMON_SOURCE_DIR}
|
||||
${OBJDICT_DIR}
|
||||
)
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
INCLUDE(configure-linux)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
INCLUDE(configure-windows)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "XiUOS")
|
||||
INCLUDE(configure-xiuos)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Generic" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "Microblazeise")
|
||||
INCLUDE(configure-microblazeise)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Generic" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "alterac5arm")
|
||||
INCLUDE(configure-c5socarm)
|
||||
ENDIF()
|
||||
+25756
File diff suppressed because it is too large
Load Diff
+25758
File diff suppressed because it is too large
Load Diff
+218
@@ -0,0 +1,218 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file obdpi.c
|
||||
|
||||
\brief Process image setup function for CiA302-4
|
||||
|
||||
This file contains the implementation of the process image setup functions
|
||||
for the CiA profile 302-4.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include "obdpi.h"
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#define PI_SUBINDEX_COUNT 252
|
||||
|
||||
#ifndef tabentries
|
||||
#define tabentries(aVar_p) (sizeof(aVar_p) / sizeof(*(aVar_p)))
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Structure describing the object linking for the process image
|
||||
|
||||
This structure describes the object index range and its data type that shall be
|
||||
linked into the process image.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT objIndexStart; ///< Start index of a range
|
||||
UINT objIndexEnd; ///< End index of a range
|
||||
size_t offsetPI; ///< Starting offset within the process image
|
||||
BOOL fOutputPI; ///< Describes whether the objects are linked into an output process image
|
||||
tObdSize entrySize; ///< Size in Bytes of a single entry in the process image
|
||||
UINT subindexCountPerIndex; ///< Number of subindexes for each index
|
||||
} tProcessImageLink;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
tProcessImageLink processImageLink_l[] =
|
||||
{
|
||||
// IndexStart IndexEnd OffsetPI OutputPI EntrySize SubindexCount
|
||||
{ 0xA000, 0xA00F, 0, FALSE, 1, PI_SUBINDEX_COUNT },
|
||||
{ 0xA040, 0xA04F, 0, FALSE, 1, PI_SUBINDEX_COUNT },
|
||||
{ 0xA0C0, 0xA0C7, 0, FALSE, 2, PI_SUBINDEX_COUNT },
|
||||
{ 0xA100, 0xA107, 0, FALSE, 2, PI_SUBINDEX_COUNT },
|
||||
{ 0xA1C0, 0xA1C3, 0, FALSE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA200, 0xA203, 0, FALSE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA240, 0xA247, 0, FALSE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA400, 0xA401, 0, FALSE, 8, PI_SUBINDEX_COUNT },
|
||||
{ 0xA440, 0xA441, 0, FALSE, 8, PI_SUBINDEX_COUNT },
|
||||
{ 0xA480, 0xA48F, 0, TRUE, 1, PI_SUBINDEX_COUNT },
|
||||
{ 0xA4C0, 0xA4CF, 0, TRUE, 1, PI_SUBINDEX_COUNT },
|
||||
{ 0xA540, 0xA547, 0, TRUE, 2, PI_SUBINDEX_COUNT },
|
||||
{ 0xA580, 0xA587, 0, TRUE, 2, PI_SUBINDEX_COUNT },
|
||||
{ 0xA640, 0xA643, 0, TRUE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA680, 0xA683, 0, TRUE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA6C0, 0xA6C7, 0, TRUE, 4, PI_SUBINDEX_COUNT },
|
||||
{ 0xA880, 0xA881, 0, TRUE, 8, PI_SUBINDEX_COUNT },
|
||||
{ 0xA8C0, 0xA8C1, 0, TRUE, 8, PI_SUBINDEX_COUNT }
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
static UINT linkProcessImageRange(UINT objIndexStart_p, UINT objIndexEnd_p,
|
||||
size_t offsetPI_p, BOOL fOutputPI_p, tObdSize entrySize_p,
|
||||
UINT subindexCountPerIndex_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Setup process image
|
||||
|
||||
The function sets up a process image according to the CiA profile 302-4.
|
||||
|
||||
\return The function returns the number of the index that failed to link or 0,
|
||||
if no error occurred.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT obdpi_setupProcessImage(void)
|
||||
{
|
||||
UINT errorIndex = 0;
|
||||
size_t i;
|
||||
tProcessImageLink* pLink;
|
||||
|
||||
pLink = processImageLink_l;
|
||||
|
||||
for (i = 0; i < tabentries(processImageLink_l); i++, pLink++)
|
||||
{
|
||||
errorIndex = linkProcessImageRange(pLink->objIndexStart, pLink->objIndexEnd,
|
||||
pLink->offsetPI, pLink->fOutputPI,
|
||||
pLink->entrySize, pLink->subindexCountPerIndex);
|
||||
if (errorIndex != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return errorIndex;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Link process image range
|
||||
|
||||
The function links a range of variables to the object dictionary.
|
||||
|
||||
\param objIndexStart_p Start index of range to link.
|
||||
\param objIndexEnd_p End index of range to link.
|
||||
\param offsetPI_p Offset of range in the process image.
|
||||
\param fOutputPI_p Determines if input image or output image should
|
||||
be used: TRUE = output image, FALSE = imput image
|
||||
\param entrySize_p The size of one process variable.
|
||||
\param subindexCountPerIndex_p Number of subindexes per index to be linked.
|
||||
|
||||
\return The function returns the number of the index that failed to link or 0,
|
||||
if no error occurred.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static UINT linkProcessImageRange(UINT objIndexStart_p, UINT objIndexEnd_p,
|
||||
size_t offsetPI_p, BOOL fOutputPI_p,
|
||||
tObdSize entrySize_p, UINT subindexCountPerIndex_p)
|
||||
{
|
||||
tOplkError ret = kErrorOk;
|
||||
UINT errorIndex = 0;
|
||||
UINT varEntries;
|
||||
|
||||
for (; objIndexStart_p <= objIndexEnd_p; objIndexStart_p++,
|
||||
offsetPI_p += entrySize_p * subindexCountPerIndex_p)
|
||||
{
|
||||
varEntries = subindexCountPerIndex_p;
|
||||
ret = oplk_linkProcessImageObject(objIndexStart_p, 1, offsetPI_p,
|
||||
fOutputPI_p, entrySize_p, &varEntries);
|
||||
if (((ret == kErrorOk) && (varEntries < subindexCountPerIndex_p)) ||
|
||||
(ret == kErrorApiPISizeExceeded))
|
||||
{
|
||||
errorIndex = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret != kErrorOk)
|
||||
{
|
||||
errorIndex = objIndexStart_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return errorIndex;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file obdpi.h
|
||||
|
||||
\brief Process image setup function for CiA302-4
|
||||
|
||||
This file contains the definition of the process image setup functions
|
||||
for the CiA profile 302-4.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _INC_obdpi_H_
|
||||
#define _INC_obdpi_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
UINT obdpi_setupProcessImage(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_obdpi_H_ */
|
||||
+1345
File diff suppressed because it is too large
Load Diff
+1571
File diff suppressed because it is too large
Load Diff
+1566
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
+506
@@ -0,0 +1,506 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file objdicts/CiA401_CN/objdict.h
|
||||
|
||||
\brief Object dictionary according to CiA401
|
||||
|
||||
This file contains the object dictionary definition for the CANopen CiA401
|
||||
device profile.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#define OBD_DEFINE_MACRO
|
||||
#include <obdcreate/obdmacro.h>
|
||||
#undef OBD_DEFINE_MACRO
|
||||
#include <limits.h>
|
||||
|
||||
OBD_BEGIN()
|
||||
/*************************************************************************
|
||||
* Communication Profile Area (0x1000 - 0x1FFF)
|
||||
*************************************************************************/
|
||||
OBD_BEGIN_PART_GENERIC()
|
||||
|
||||
// Object 1000h: NMT_DeviceType_U32
|
||||
OBD_BEGIN_INDEX_RAM(0x1000, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1000, 0x00, kObdTypeUInt32, kObdAccR, tObdUnsigned32, NMT_DeviceType_U32, 0x000F0191)
|
||||
OBD_END_INDEX(0x1000)
|
||||
|
||||
// Object 1001h: ERR_ErrorRegister_U8
|
||||
OBD_BEGIN_INDEX_RAM(0x1001, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1001, 0x00, kObdTypeUInt8, kObdAccR, tObdUnsigned8, ERR_ErrorRegister_U8, 0x00)
|
||||
OBD_END_INDEX(0x1001)
|
||||
|
||||
/*
|
||||
// Object 1003h: ERR_History_ADOM
|
||||
OBD_RAM_INDEX_RAM_VARARRAY_NOINIT(0x1003, 10, FALSE, tObdDomain, kObdAccR, tObdDomain, ERR_History_ADOM)
|
||||
*/
|
||||
|
||||
// Object 1006h: NMT_CycleLen_U32 in [us]
|
||||
OBD_BEGIN_INDEX_RAM(0x1006, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1006, 0x00, kObdTypeUInt32, kObdAccSGRW, tObdUnsigned32, NMT_CycleLen_U32, 0x00000000, 400, UINT_MAX) // in [us]
|
||||
OBD_END_INDEX(0x1006)
|
||||
|
||||
// Object 1008h: NMT_ManufactDevName_VS
|
||||
OBD_BEGIN_INDEX_RAM(0x1008, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x1008, 0x00, kObdAccR, device_name, OBD_MAX_STRING_SIZE, "openPOWERLINK device")
|
||||
OBD_END_INDEX(0x1008)
|
||||
|
||||
// Object 1009h: NMT_ManufactHwVers_VS
|
||||
OBD_BEGIN_INDEX_RAM(0x1009, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x1009, 0x00, kObdAccR, hardware_version, OBD_MAX_STRING_SIZE, "1.00")
|
||||
OBD_END_INDEX(0x1009)
|
||||
|
||||
// Object 100Ah: NMT_ManufactSwVers_VS
|
||||
OBD_BEGIN_INDEX_RAM(0x100A, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x100A, 0x00, kObdAccR, software_version, OBD_MAX_STRING_SIZE, PLK_PRODUCT_NAME" "PLK_PRODUCT_VERSION)
|
||||
OBD_END_INDEX(0x100A)
|
||||
|
||||
#if defined(CONFIG_APP_STORE_RESTORE)
|
||||
// Object 1010h: NMT_StoreParam_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1010, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1010, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1010, 0x01, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, AllParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1010, 0x02, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, CommunicationParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1010, 0x03, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, ApplicationParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1010, 0x04, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, ManufacturerParam_04h_U32)
|
||||
OBD_END_INDEX(0x1010)
|
||||
|
||||
// Object 1011h: NMT_RestoreDefParam_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1011, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1011, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1011, 0x01, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, AllParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1011, 0x02, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, CommunicationParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1011, 0x03, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, ApplicationParam_U32)
|
||||
OBD_SUBINDEX_RAM_VAR_NOINIT(0x1011, 0x04, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, ManufacturerParam_04h_U32)
|
||||
OBD_END_INDEX(0x1011)
|
||||
#endif
|
||||
|
||||
// Object 1018h: NMT_IdentityObject_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1018, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1018, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1018, 0x01, kObdTypeUInt32, kObdAccR, tObdUnsigned32, VendorId_U32, 0x00000000)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1018, 0x02, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ProductCode_U32, 0x00000000)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1018, 0x03, kObdTypeUInt32, kObdAccR, tObdUnsigned32, RevisionNo_U32, PLK_DEFINED_OBJ1018_VERSION)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1018, 0x04, kObdTypeUInt32, kObdAccR, tObdUnsigned32, SerialNo_U32, 0x00000000)
|
||||
OBD_END_INDEX(0x1018)
|
||||
|
||||
// Object 1020h: CFM_VerifyConfiguration_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1020, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1020, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1020, 0x01, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, ConfDate_U32, 0x00000000)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1020, 0x02, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, ConfTime_U32, 0x00000000)
|
||||
// OBD_SUBINDEX_RAM_VAR(0x1020, 0x03, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, ConfId_U32, 0x00000000)
|
||||
// OBD_SUBINDEX_RAM_VAR(0x1020, 0x04, kObdTypeBool, kObdAccR, tObdBoolean, VerifyConfInvalid_BOOL, 0x01)
|
||||
OBD_END_INDEX(0x1020)
|
||||
|
||||
// Object 1030h: NMT_InterfaceGroup_Xh_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1030, 0x0A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1030, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x09)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1030, 0x01, kObdTypeUInt16, kObdAccR, tObdUnsigned16, InterfaceIndex_U16, 0x01, 0x00, 0x0A)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x1030, 0x02, kObdAccR, InterfaceDescription_VSTR, 0x20, "Interface 1")
|
||||
OBD_SUBINDEX_RAM_VAR(0x1030, 0x03, kObdTypeUInt8, kObdAccR, tObdUnsigned8, InterfaceType_U8, 0x06)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1030, 0x04, kObdTypeUInt16, kObdAccR, tObdUnsigned16, InterfaceMtu_U16, 1518)
|
||||
OBD_SUBINDEX_RAM_OSTRING(0x1030, 0x05, kObdAccR, InterfacePhysAddress_OSTR, 0x06)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x1030, 0x06, kObdAccR, InterfaceName_VSTR, 0x20, "Interface 1")
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1030, 0x07, kObdTypeUInt8, kObdAccR, tObdUnsigned8, InterfaceOperStatus_U8, 0x01, 0x00, 0x01)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1030, 0x08, kObdTypeUInt8, kObdAccGRW, tObdUnsigned8, InterfaceAdminState_U8, 0x01, 0x00, 0x01)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1030, 0x09, kObdTypeBool, kObdAccRW, tObdBoolean, Valid_BOOL, 0x01)
|
||||
OBD_END_INDEX(0x1030)
|
||||
|
||||
#if (defined(CONFIG_DLL_PRES_CHAINING_CN) && (NMT_MAX_NODE_ID > 0))
|
||||
// Object 1050h: NMT_RelativeLatencyDiff_AU32
|
||||
OBD_RAM_INDEX_RAM_ARRAY(0x1050, NMT_MAX_NODE_ID, FALSE, kObdTypeUInt32, kObdAccR, tObdUnsigned32, NMT_RelativeLatencyDiff_AU32, 0)
|
||||
#endif
|
||||
|
||||
// Object 1300h: SDO_SequLayerTimeout_U32 in [ms]
|
||||
OBD_BEGIN_INDEX_RAM(0x1300, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1300, 0x00, kObdTypeUInt32, kObdAccSGRW, tObdUnsigned32, SDO_SequLayerTimeout_U32, 15000, 100, 0xFFFFFFFF)
|
||||
OBD_END_INDEX(0x1300)
|
||||
|
||||
// Object 1400h: PDO_RxCommParam_00h_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1400, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1400, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1400, 0x01, kObdTypeUInt8, kObdAccSGRW, tObdUnsigned8, NodeID_U8, 0, 0, 254)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1400, 0x02, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, MappingVersion_U8, 0x00)
|
||||
OBD_END_INDEX(0x1400)
|
||||
|
||||
// Object 1401h: PDO_RxCommParam_01h_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1401, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1401, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1401, 0x01, kObdTypeUInt8, kObdAccSGRW, tObdUnsigned8, NodeID_U8, 0, 0, 254)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1401, 0x02, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, MappingVersion_U8, 0x00)
|
||||
OBD_END_INDEX(0x1401)
|
||||
|
||||
// Object 1402h: PDO_RxCommParam_02h_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1402, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1402, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1402, 0x01, kObdTypeUInt8, kObdAccSGRW, tObdUnsigned8, NodeID_U8, 0, 0, 254)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1402, 0x02, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, MappingVersion_U8, 0x00)
|
||||
OBD_END_INDEX(0x1402)
|
||||
|
||||
// Object 1600h: PDO_RxMappParam_00h_AU64
|
||||
OBD_BEGIN_INDEX_RAM(0x1600, 0x1A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x00, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, NumberOfEntries, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x01, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x02, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x03, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x04, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x05, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x06, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x07, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x08, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x09, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0A, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0B, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0C, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0D, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0E, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x0F, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x10, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x11, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x12, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x13, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x14, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x15, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x16, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x17, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x18, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1600, 0x19, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_END_INDEX(0x1600)
|
||||
|
||||
// Object 1601h: PDO_RxMappParam_01h_AU64
|
||||
OBD_BEGIN_INDEX_RAM(0x1601, 0x1A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x00, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, NumberOfEntries, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x01, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x02, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x03, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x04, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x05, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x06, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x07, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x08, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x09, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0A, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0B, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0C, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0D, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0E, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x0F, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x10, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x11, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x12, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x13, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x14, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x15, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x16, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x17, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x18, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1601, 0x19, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_END_INDEX(0x1601)
|
||||
|
||||
// Object 1602h: PDO_RxMappParam_02h_AU64
|
||||
OBD_BEGIN_INDEX_RAM(0x1602, 0x1A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x00, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, NumberOfEntries, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x01, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x02, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x03, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x04, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x05, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x06, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x07, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x08, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x09, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0A, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0B, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0C, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0D, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0E, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x0F, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x10, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x11, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x12, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x13, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x14, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x15, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x16, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x17, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x18, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1602, 0x19, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_END_INDEX(0x1602)
|
||||
|
||||
// Object 1800h: PDO_TxCommParam_00h_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1800, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1800, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1800, 0x01, kObdTypeUInt8, kObdAccSGRW, tObdUnsigned8, NodeID_U8, 0, 0, 254)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1800, 0x02, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, MappingVersion_U8, 0x00)
|
||||
OBD_END_INDEX(0x1800)
|
||||
|
||||
// Object 1A00h: PDO_TxMappParam_00h_AU64
|
||||
OBD_BEGIN_INDEX_RAM(0x1A00, 0x1A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x00, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, NumberOfEntries, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x01, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x02, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x03, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x04, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x05, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x06, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x07, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x08, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x09, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0A, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0B, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0C, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0D, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0E, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x0F, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x10, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x11, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x12, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x13, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x14, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x15, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x16, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x17, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x18, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1A00, 0x19, kObdTypeUInt64, kObdAccSRW, tObdUnsigned64, ObjectMapping, 0x0000000000000000LL)
|
||||
OBD_END_INDEX(0x1A00)
|
||||
|
||||
// Object 1C0Bh: DLL_CNLossSoC_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1C0B, 0x04, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1C0B, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 3)
|
||||
OBD_SUBINDEX_RAM_USERDEF_NOINIT(0x1C0B, 0x01, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, CumulativeCnt_U32)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0B, 0x02, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ThresholdCnt_U32, 0)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0B, 0x03, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, Threshold_U32, 15)
|
||||
OBD_END_INDEX(0x1C0B)
|
||||
|
||||
// Object 1C0Dh: DLL_CNLossPReq_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1C0D, 0x04, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1C0D, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 3)
|
||||
OBD_SUBINDEX_RAM_USERDEF_NOINIT(0x1C0D, 0x01, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, CumulativeCnt_U32)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0D, 0x02, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ThresholdCnt_U32, 0)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0D, 0x03, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, Threshold_U32, 15)
|
||||
OBD_END_INDEX(0x1C0D)
|
||||
|
||||
// Object 1C0Fh: DLL_CNCRCError_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1C0F, 0x04, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1C0F, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 3)
|
||||
OBD_SUBINDEX_RAM_USERDEF_NOINIT(0x1C0F, 0x01, kObdTypeUInt32, kObdAccRW, tObdUnsigned32, CumulativeCnt_U32)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0F, 0x02, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ThresholdCnt_U32, 0)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x1C0F, 0x03, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, Threshold_U32, 15)
|
||||
OBD_END_INDEX(0x1C0F)
|
||||
|
||||
// Object 1C14h: DLL_LossOfSocTolerance_U32 in [ns]
|
||||
OBD_BEGIN_INDEX_RAM(0x1C14, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1C14, 0x00, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, LossOfSocTolerance, 100000)
|
||||
OBD_END_INDEX(0x1C14)
|
||||
|
||||
#if defined(CONFIG_INCLUDE_IP)
|
||||
// Object 1E40h: NWL_IpAddrTable_0h_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1E40, 0x06, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x05)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x01, kObdTypeUInt16, kObdAccR, tObdUnsigned16, IfIndex_U16, 0x01)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x02, kObdTypeUInt32, kObdAccR, tObdUnsigned32, Addr_IPAD, 0xC0A86401)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x03, kObdTypeUInt32, kObdAccR, tObdUnsigned32, NetMask_IPAD, 0xFFFFFF00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x04, kObdTypeUInt16, kObdAccR, tObdUnsigned16, ReasmMaxSize_U16, 50000)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E40, 0x05, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, DefaultGateway_IPAD, 0xC0A864FE)
|
||||
OBD_END_INDEX(0x1E40)
|
||||
|
||||
// Object 1E4Ah: NWL_IpGroup_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1E4A, 0x06, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E4A, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x03)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E4A, 0x01, kObdTypeBool, kObdAccSRW, tObdBoolean, Forwarding_BOOL, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E4A, 0x02, kObdTypeUInt16, kObdAccSRW, tObdUnsigned16, DefaultTTL_U16, 64)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1E4A, 0x03, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ForwardDatagrams_U32, 0x00000000)
|
||||
OBD_END_INDEX(0x1E4A)
|
||||
#endif
|
||||
|
||||
#if NMT_MAX_NODE_ID > 0
|
||||
// Object 1F81h: NMT_NodeAssignment_AU32
|
||||
OBD_RAM_INDEX_RAM_ARRAY_ALT(0x1F81, NMT_MAX_NODE_ID, FALSE, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, NMT_NodeAssignment_AU32, 0)
|
||||
#endif
|
||||
|
||||
// Object 1F82h: NMT_FeatureFlags_U32
|
||||
OBD_BEGIN_INDEX_RAM(0x1F82, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F82, 0x00, kObdTypeUInt32, kObdAccR, tObdUnsigned32, NMT_FeatureFlags_U32, PLK_DEF_FEATURE_FLAGS)
|
||||
OBD_END_INDEX(0x1F82)
|
||||
|
||||
// Object 1F83h: NMT_EPLVersion_U8
|
||||
OBD_BEGIN_INDEX_RAM(0x1F83, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F83, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NMT_EPLVersion_U8, 0x20)
|
||||
OBD_END_INDEX(0x1F83)
|
||||
|
||||
// Object 1F8Ch: NMT_CurrNMTState_U8
|
||||
OBD_BEGIN_INDEX_RAM(0x1F8C, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F8C, 0x00, kObdTypeUInt8, kObdAccR, tObdUnsigned8, NMT_CurrNMTState_U8, 0x1C)
|
||||
OBD_END_INDEX(0x1F8C)
|
||||
|
||||
#if NMT_MAX_NODE_ID > 0
|
||||
// Object 1F8Dh: NMT_PResPayloadLimitList_AU16
|
||||
OBD_RAM_INDEX_RAM_ARRAY_ALT(0x1F8D, NMT_MAX_NODE_ID, FALSE, kObdTypeUInt16, kObdAccSRW, tObdUnsigned16, NMT_PResPayloadLimitList_AU16, 36)
|
||||
#endif
|
||||
|
||||
// Object 1F93h: NMT_EPLNodeID_REC
|
||||
OBD_BEGIN_INDEX_RAM(0x1F93, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F93, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F93, 0x01, kObdTypeUInt8, kObdAccR, tObdUnsigned8, NodeID_U8, 0)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F93, 0x02, kObdTypeBool, kObdAccR, tObdBoolean, NodeIDByHW_BOOL, 0x00)
|
||||
OBD_END_INDEX(0x1F93)
|
||||
|
||||
// Object 1F98h: NMT_CycleTiming_REC
|
||||
#if !defined(CONFIG_DLL_PRES_CHAINING_CN)
|
||||
OBD_BEGIN_INDEX_RAM(0x1F98, 0x0A, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x09)
|
||||
#else
|
||||
OBD_BEGIN_INDEX_RAM(0x1F98, 0x0F, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x0E)
|
||||
#endif
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x01, kObdTypeUInt16, kObdAccR, tObdUnsigned16, IsochrTxMaxPayload_U16, 0)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x02, kObdTypeUInt16, kObdAccR, tObdUnsigned16, IsochrRxMaxPayload_U16, 0)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x03, kObdTypeUInt32, kObdAccR, tObdUnsigned32, PResMaxLatency_U32, 0) // in [ns]
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1F98, 0x04, kObdTypeUInt16, kObdAccSGRW, tObdUnsigned16, PReqActPayloadLimit_U16, 36, 36, C_DLL_ISOCHR_MAX_PAYL)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1F98, 0x05, kObdTypeUInt16, kObdAccSGRW, tObdUnsigned16, PResActPayloadLimit_U16, 36, 36, C_DLL_ISOCHR_MAX_PAYL)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x06, kObdTypeUInt32, kObdAccR, tObdUnsigned32, ASndMaxLatency_U32, 0) // in [ns]
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x07, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, MultiplCycleCnt_U8, 0x00)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1F98, 0x08, kObdTypeUInt16, kObdAccSGRW, tObdUnsigned16, AsyncMTU_U16, C_DLL_MIN_ASYNC_MTU, C_DLL_MIN_ASYNC_MTU, C_DLL_MAX_ASYNC_MTU)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1F98, 0x09, kObdTypeUInt16, kObdAccSRW, tObdUnsigned16, Prescaler_U16, 2, 0, 1000)
|
||||
#if defined(CONFIG_DLL_PRES_CHAINING_CN)
|
||||
OBD_SUBINDEX_RAM_VAR_RG(0x1F98, 0x0A, kObdTypeUInt8, kObdAccGR, tObdUnsigned8, PResMode_U8, 0x00, 0x00, 0x01)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x0B, kObdTypeUInt32, kObdAccR, tObdUnsigned32, PResTimeFirst_U32, 0) // in [ns]
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x0C, kObdTypeUInt32, kObdAccR, tObdUnsigned32, PResTimeSecond_U32, 0) // in [ns]
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x0D, kObdTypeUInt32, kObdAccR, tObdUnsigned32, SyncMNDelayFirst_U32, 0) // in [ns]
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F98, 0x0E, kObdTypeUInt32, kObdAccR, tObdUnsigned32, SyncMNDelaySecond_U32, 0) // in [ns]
|
||||
#endif
|
||||
OBD_END_INDEX(0x1F98)
|
||||
|
||||
// Object 1F99h: NMT_CNBasicEthernetTimeout_U32 in [us]
|
||||
OBD_BEGIN_INDEX_RAM(0x1F99, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F99, 0x00, kObdTypeUInt32, kObdAccSRW, tObdUnsigned32, NMT_CNBasicEthernetTimeout_U32, 5000000) // in [us]
|
||||
OBD_END_INDEX(0x1F99)
|
||||
|
||||
#if defined(CONFIG_INCLUDE_IP)
|
||||
// Object 1F9Ah: NMT_HostName_VSTR
|
||||
OBD_BEGIN_INDEX_RAM(0x1F9A, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VSTRING(0x1F9A, 0x00, kObdAccSRW, NMT_HostName_VSTR, 34, "")
|
||||
OBD_END_INDEX(0x1F9A)
|
||||
#endif
|
||||
|
||||
#if NMT_MAX_NODE_ID > 0
|
||||
// Object 1F9Bh: NMT_MultiplCycleAssign_AU8
|
||||
OBD_RAM_INDEX_RAM_ARRAY_ALT(0x1F9B, NMT_MAX_NODE_ID, FALSE, kObdTypeUInt8, kObdAccSRW, tObdUnsigned8, NMT_MultiplCycleAssign_AU8, 0)
|
||||
#endif
|
||||
|
||||
// Object 1F9Eh: NMT_ResetCmd_U8
|
||||
OBD_BEGIN_INDEX_RAM(0x1F9E, 0x01, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x1F9E, 0x00, kObdTypeUInt8, kObdAccRW, tObdUnsigned8, NMT_ResetCmd_U8, 0xFF)
|
||||
OBD_END_INDEX(0x1F9E)
|
||||
|
||||
OBD_END_PART()
|
||||
|
||||
/*************************************************************************
|
||||
* Manufacturer Specific Profile Area (0x2000 - 0x5FFF)
|
||||
*************************************************************************/
|
||||
OBD_BEGIN_PART_MANUFACTURER()
|
||||
|
||||
OBD_END_PART()
|
||||
|
||||
/*************************************************************************
|
||||
* Standardised Device Profile Area (0x6000 - 0x9FFF)
|
||||
*************************************************************************/
|
||||
OBD_BEGIN_PART_DEVICE()
|
||||
|
||||
// DigitalInput_00h_AU8
|
||||
OBD_BEGIN_INDEX_RAM(0x6000, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6000, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6000, 0x01, kObdTypeUInt8, kObdAccVPR, tObdUnsigned8, DigitalInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6000, 0x02, kObdTypeUInt8, kObdAccVPR, tObdUnsigned8, DigitalInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6000, 0x03, kObdTypeUInt8, kObdAccVPR, tObdUnsigned8, DigitalInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6000, 0x04, kObdTypeUInt8, kObdAccVPR, tObdUnsigned8, DigitalInput, 0x00)
|
||||
OBD_END_INDEX(0x6000)
|
||||
|
||||
// DigitalOutput_00h_AU8
|
||||
OBD_BEGIN_INDEX_RAM(0x6200, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6200, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6200, 0x01, kObdTypeUInt8, kObdAccVPRW, tObdUnsigned8, DigitalOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6200, 0x02, kObdTypeUInt8, kObdAccVPRW, tObdUnsigned8, DigitalOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6200, 0x03, kObdTypeUInt8, kObdAccVPRW, tObdUnsigned8, DigitalOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6200, 0x04, kObdTypeUInt8, kObdAccVPRW, tObdUnsigned8, DigitalOutput, 0x00)
|
||||
OBD_END_INDEX(0x6200)
|
||||
|
||||
// AnalogueInput_00h_AI8
|
||||
OBD_BEGIN_INDEX_RAM(0x6400, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6400, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6400, 0x01, kObdTypeInt8, kObdAccVPR, tObdInteger8, AnalogueInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6400, 0x02, kObdTypeInt8, kObdAccVPR, tObdInteger8, AnalogueInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6400, 0x03, kObdTypeInt8, kObdAccVPR, tObdInteger8, AnalogueInput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6400, 0x04, kObdTypeInt8, kObdAccVPR, tObdInteger8, AnalogueInput, 0x00)
|
||||
OBD_END_INDEX(0x6400)
|
||||
|
||||
// AnalogueInput_00h_AI16
|
||||
OBD_BEGIN_INDEX_RAM(0x6401, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6401, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6401, 0x01, kObdTypeInt16, kObdAccVPR, tObdInteger16, AnalogueInput, 0x0000)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6401, 0x02, kObdTypeInt16, kObdAccVPR, tObdInteger16, AnalogueInput, 0x0000)
|
||||
OBD_END_INDEX(0x6401)
|
||||
|
||||
// AnalogueInput_00h_AI32
|
||||
OBD_BEGIN_INDEX_RAM(0x6402, 0x02, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6402, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x01)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6402, 0x01, kObdTypeInt32, kObdAccVPR, tObdInteger32, AnalogueInput, 0x00000000)
|
||||
OBD_END_INDEX(0x6402)
|
||||
|
||||
// AnalogueOutput_00h_AI8
|
||||
OBD_BEGIN_INDEX_RAM(0x6410, 0x05, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6410, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x04)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6410, 0x01, kObdTypeInt8, kObdAccVPRW, tObdInteger8, AnalogueOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6410, 0x02, kObdTypeInt8, kObdAccVPRW, tObdInteger8, AnalogueOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6410, 0x03, kObdTypeInt8, kObdAccVPRW, tObdInteger8, AnalogueOutput, 0x00)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6410, 0x04, kObdTypeInt8, kObdAccVPRW, tObdInteger8, AnalogueOutput, 0x00)
|
||||
OBD_END_INDEX(0x6410)
|
||||
|
||||
// AnalogueOutput_00h_AI16
|
||||
OBD_BEGIN_INDEX_RAM(0x6411, 0x03, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6411, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x02)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6411, 0x01, kObdTypeInt16, kObdAccVPRW, tObdInteger16, AnalogueOutput, 0x0000)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6411, 0x02, kObdTypeInt16, kObdAccVPRW, tObdInteger16, AnalogueOutput, 0x0000)
|
||||
OBD_END_INDEX(0x6411)
|
||||
|
||||
// AnalogueOutput_00h_AI32
|
||||
OBD_BEGIN_INDEX_RAM(0x6412, 0x02, FALSE)
|
||||
OBD_SUBINDEX_RAM_VAR(0x6412, 0x00, kObdTypeUInt8, kObdAccConst, tObdUnsigned8, NumberOfEntries, 0x01)
|
||||
OBD_SUBINDEX_RAM_USERDEF(0x6412, 0x01, kObdTypeInt32, kObdAccVPRW, tObdInteger32, AnalogueOutput, 0x00000000)
|
||||
OBD_END_INDEX(0x6412)
|
||||
|
||||
OBD_END_PART()
|
||||
|
||||
OBD_END()
|
||||
|
||||
#define OBD_UNDEFINE_MACRO
|
||||
#include <obdcreate/obdmacro.h>
|
||||
#undef OBD_UNDEFINE_MACRO
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openCONFIGURATORProject xmlns="http://sourceforge.net/projects/openconf/configuration" xmlns:ns2="http://ethernet-powerlink.org/POWERLINK" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sourceforge.net/projects/openconf/configuration openCONFIGURATOR.xsd">
|
||||
<Generator vendor="Kalycito Infotech Private Limited & B&R Industrial Automation GmbH" toolName="Ethernet POWERLINK openCONFIGURATOR" toolVersion="2.2.1" createdBy="Priyadharshini" createdOn="2018-06-07T17:16:06.918+05:30" modifiedBy="Priyadharshini" modifiedOn="2018-06-11T16:04:52.706+05:30" />
|
||||
<ProjectConfiguration activeAutoGenerationSetting="custom" activePathSetting="default">
|
||||
<PathSettings id="default">
|
||||
<Path id="CONFIG_TEXT" path="output" />
|
||||
<Path id="CONFIG_BINARY" path="output" />
|
||||
<Path id="CONFIG_CHAR_ARRAY" path="output" />
|
||||
<Path id="XML_PROCESS_IMAGE" path="output" />
|
||||
<Path id="C_PROCESS_IMAGE" path="output" />
|
||||
<Path id="CSHARP_PROCESS_IMAGE" path="output" />
|
||||
</PathSettings>
|
||||
<AutoGenerationSettings id="all">
|
||||
<Setting name="GENERATE_MN_MAPPING_FOR_NODES" value="" enabled="true" />
|
||||
</AutoGenerationSettings>
|
||||
<AutoGenerationSettings id="none" />
|
||||
<AutoGenerationSettings id="custom">
|
||||
<Setting name="GENERATE_MN_MAPPING_FOR_NODES" value="1;32;110" enabled="true" />
|
||||
</AutoGenerationSettings>
|
||||
</ProjectConfiguration>
|
||||
<NetworkConfiguration lossOfSocTolerance="50000000">
|
||||
<NodeCollection>
|
||||
<MN name="openPOWERLINK_MN" nodeID="240" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA302-4_MN.xdc" isAsyncOnly="false" isType1Router="false" isType2Router="false" transmitsPRes="false" />
|
||||
<CN name="CN_1" nodeID="1" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_1.xdc" isMultiplexed="false" isChained="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" isAsyncOnly="false" isType1Router="false" isType2Router="false">
|
||||
<ForcedObjects>
|
||||
<Object index="1F8D" subindex="F0" />
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
<CN nodeID="32" name="CN_2" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_32.xdc" forcedMultiplexedCycle="0" isMultiplexed="false" isChained="false" isAsyncOnly="false" isType1Router="false" isType2Router="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" verifyDeviceType="true" verifyVendorId="false" verifyRevisionNumber="false" verifyProductCode="false" verifySerialNumber="false" enabled="true">
|
||||
<ForcedObjects>
|
||||
<Object index="1F8D" subindex="F0" />
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
<CN nodeID="110" name="CN_3" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_110.xdc" forcedMultiplexedCycle="0" isMultiplexed="false" isChained="false" isAsyncOnly="false" isType1Router="false" isType2Router="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" verifyDeviceType="true" verifyVendorId="false" verifyRevisionNumber="false" verifyProductCode="false" verifySerialNumber="false" enabled="true">
|
||||
<ForcedObjects>
|
||||
<Object index="1F8D" subindex="F0" />
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
</NodeCollection>
|
||||
</NetworkConfiguration>
|
||||
</openCONFIGURATORProject>
|
||||
+25634
File diff suppressed because it is too large
Load Diff
+1514
File diff suppressed because it is too large
Load Diff
+1514
File diff suppressed because it is too large
Load Diff
+1514
File diff suppressed because it is too large
Load Diff
+25701
File diff suppressed because it is too large
Load Diff
+1568
File diff suppressed because it is too large
Load Diff
+45
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This file was autogenerated by openCONFIGURATOR-2.2.1_release on 11-Jun-2018 16:04:51
|
||||
/// Project: Demo_3CN
|
||||
/// Application process for openPOWERLINK_MN(240)
|
||||
/// </summary>
|
||||
|
||||
namespace openPOWERLINK
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Struct : ProcessImage Out
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
public struct AppProcessImageOut
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte CN1_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(1)]
|
||||
public byte CN32_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(2)]
|
||||
public byte CN110_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(3)]
|
||||
public byte PADDING_VAR_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Struct : ProcessImage In
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
public struct AppProcessImageIn
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte CN1_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(1)]
|
||||
public byte CN32_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(2)]
|
||||
public byte CN110_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(3)]
|
||||
public byte PADDING_VAR_1;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Binary file not shown.
+114
@@ -0,0 +1,114 @@
|
||||
////
|
||||
//// This file was autogenerated by openCONFIGURATOR-2.2.1_release on 11-Jun-2018 16:04:51
|
||||
//// Project: Demo_3CN
|
||||
//// NodeCount: 3
|
||||
////
|
||||
00000031
|
||||
//// NodeId Assignment
|
||||
1F81 01 00000004 00000007
|
||||
//// NodeId Assignment
|
||||
1F81 20 00000004 00000007
|
||||
//// NodeId Assignment
|
||||
1F81 6E 00000004 00000007
|
||||
|
||||
1600 00 00000001 00
|
||||
1601 00 00000001 00
|
||||
1602 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1A01 00 00000001 00
|
||||
1A02 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1C02 03 00000004 00000028
|
||||
1C09 01 00000004 00000028
|
||||
1C09 20 00000004 00000028
|
||||
1C09 6E 00000004 00000028
|
||||
1C14 00 00000004 02FAF080
|
||||
1F26 01 00000004 00003124
|
||||
1F26 20 00000004 00003124
|
||||
1F26 6E 00000004 00003124
|
||||
1F27 01 00000004 03735955
|
||||
1F27 20 00000004 03735955
|
||||
1F27 6E 00000004 03735955
|
||||
1F8A 02 00000004 0007A120
|
||||
1F92 01 00000004 00030D40
|
||||
1F92 20 00000004 00030D40
|
||||
1F92 6E 00000004 00030D40
|
||||
1400 01 00000001 01
|
||||
1401 01 00000001 20
|
||||
1402 01 00000001 6E
|
||||
1600 01 00000008 000800000001A4C0
|
||||
1601 01 00000008 000800000002A4C0
|
||||
1602 01 00000008 000800000003A4C0
|
||||
1800 01 00000001 01
|
||||
1801 01 00000001 20
|
||||
1802 01 00000001 6E
|
||||
1A00 01 00000008 000800000001A040
|
||||
1A01 01 00000008 000800000002A040
|
||||
1A02 01 00000008 000800000003A040
|
||||
1600 00 00000001 01
|
||||
1601 00 00000001 01
|
||||
1602 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
1A01 00 00000001 01
|
||||
1A02 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_1(1)
|
||||
1F22 01 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 00003124
|
||||
1020 02 00000004 03735955
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_2(32)
|
||||
1F22 20 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 00003124
|
||||
1020 02 00000004 03735955
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_3(110)
|
||||
1F22 6E 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 00003124
|
||||
1020 02 00000004 03735955
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
//// NodeId Reassignment
|
||||
1F81 01 00000004 80000007
|
||||
//// NodeId Reassignment
|
||||
1F81 20 00000004 80000007
|
||||
//// NodeId Reassignment
|
||||
1F81 6E 00000004 80000007
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
0x31, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81,
|
||||
0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00, 0x00,
|
||||
0x02, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x01, 0x04, 0x00,
|
||||
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x20, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
|
||||
0x00, 0x09, 0x1C, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x26, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x24, 0x31,
|
||||
0x00, 0x00, 0x26, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x24, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x6E,
|
||||
0x04, 0x00, 0x00, 0x00, 0x24, 0x31, 0x00, 0x00, 0x27, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x55,
|
||||
0x59, 0x73, 0x03, 0x27, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x55, 0x59, 0x73, 0x03, 0x27, 0x1F,
|
||||
0x6E, 0x04, 0x00, 0x00, 0x00, 0x55, 0x59, 0x73, 0x03, 0x8A, 0x1F, 0x02, 0x04, 0x00, 0x00, 0x00,
|
||||
0x20, 0xA1, 0x07, 0x00, 0x92, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92,
|
||||
0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x6E, 0x04, 0x00, 0x00,
|
||||
0x00, 0x40, 0x0D, 0x03, 0x00, 0x00, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x14, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x16, 0x01,
|
||||
0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x16, 0x01, 0x08,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xA4, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x16, 0x01, 0x08, 0x00,
|
||||
0x00, 0x00, 0xC0, 0xA4, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x18, 0x01, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x01, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x18, 0x01, 0x01, 0x00, 0x00,
|
||||
0x00, 0x6E, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x01, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x02, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
||||
0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
|
||||
0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
|
||||
0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22,
|
||||
0x1F, 0x01, 0x96, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00,
|
||||
0x00, 0x50, 0xC3, 0x00, 0x00, 0x20, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x24, 0x31, 0x00, 0x00,
|
||||
0x20, 0x10, 0x02, 0x04, 0x00, 0x00, 0x00, 0x55, 0x59, 0x73, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00,
|
||||
0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00,
|
||||
0x00, 0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02,
|
||||
0x00, 0x00, 0x00, 0x24, 0x00, 0x98, 0x1F, 0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16,
|
||||
0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x62, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01,
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F, 0x20, 0x96,
|
||||
0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3,
|
||||
0x00, 0x00, 0x20, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x24, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02,
|
||||
0x04, 0x00, 0x00, 0x00, 0x55, 0x59, 0x73, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50,
|
||||
0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x14, 0x1C,
|
||||
0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02, 0x00, 0x00, 0x00,
|
||||
0x24, 0x00, 0x98, 0x1F, 0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16, 0x01, 0x08, 0x00,
|
||||
0x00, 0x00, 0x00, 0x62, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00,
|
||||
0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F, 0x6E, 0x96, 0x00, 0x00, 0x00,
|
||||
0x0E, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00, 0x00, 0x20,
|
||||
0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x24, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04, 0x00, 0x00,
|
||||
0x00, 0x55, 0x59, 0x73, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00, 0x04, 0x00,
|
||||
0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x98,
|
||||
0x1F, 0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x62, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x60,
|
||||
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
|
||||
0x80, 0x81, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x6E, 0x04,
|
||||
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file was autogenerated by openCONFIGURATOR-2.2.1_release on 11-Jun-2018 16:04:51
|
||||
* Project: Demo_3CN
|
||||
* Application process for openPOWERLINK_MN(240)
|
||||
*/
|
||||
#ifndef XAP_h
|
||||
#define XAP_h
|
||||
|
||||
#define COMPUTED_PI_OUT_SIZE 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned CN1_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned CN32_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned CN110_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned PADDING_VAR_1:8;
|
||||
} PI_OUT;
|
||||
|
||||
#define COMPUTED_PI_IN_SIZE 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned CN1_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned CN32_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned CN110_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned PADDING_VAR_1:8;
|
||||
} PI_IN;
|
||||
|
||||
#endif
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file was autogenerated by openCONFIGURATOR-2.2.1_release on 11-Jun-2018 16:04:51 -->
|
||||
<!-- Project: Demo_3CN -->
|
||||
<!-- Application process for openPOWERLINK_MN(240) -->
|
||||
<ApplicationProcess xmlns="http://ethernet-powerlink.org/POWERLINK/PI">
|
||||
<ProcessImage type="output" size="3">
|
||||
<Channel Name="CN1.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0000"/>
|
||||
<Channel Name="CN32.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0001"/>
|
||||
<Channel Name="CN110.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0002"/>
|
||||
</ProcessImage>
|
||||
<ProcessImage type="input" size="3">
|
||||
<Channel Name="CN1.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0000"/>
|
||||
<Channel Name="CN32.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0001"/>
|
||||
<Channel Name="CN110.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0002"/>
|
||||
</ProcessImage>
|
||||
</ApplicationProcess>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openCONFIGURATORProject xmlns="http://sourceforge.net/projects/openconf/configuration" xmlns:ns2="http://ethernet-powerlink.org/POWERLINK" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://sourceforge.net/projects/openconf/configuration openCONFIGURATOR.xsd">
|
||||
<Generator vendor="Kalycito Infotech Private Limited & B&R Industrial Automation GmbH" toolName="Ethernet POWERLINK openCONFIGURATOR" toolVersion="2.2.1" createdBy="Priyadharshini" createdOn="2018-06-08T18:29:49.694+05:30" modifiedBy="Priyadharshini" modifiedOn="2018-09-06T14:40:34.446+05:30" />
|
||||
<ProjectConfiguration activeAutoGenerationSetting="all" activePathSetting="default">
|
||||
<PathSettings id="default">
|
||||
<Path id="CONFIG_TEXT" path="output" />
|
||||
<Path id="CONFIG_BINARY" path="output" />
|
||||
<Path id="CONFIG_CHAR_ARRAY" path="output" />
|
||||
<Path id="XML_PROCESS_IMAGE" path="output" />
|
||||
<Path id="C_PROCESS_IMAGE" path="output" />
|
||||
<Path id="CSHARP_PROCESS_IMAGE" path="output" />
|
||||
</PathSettings>
|
||||
<AutoGenerationSettings id="all">
|
||||
<Setting name="GENERATE_MN_MAPPING_FOR_NODES" value="" enabled="true" />
|
||||
</AutoGenerationSettings>
|
||||
<AutoGenerationSettings id="none" />
|
||||
<AutoGenerationSettings id="custom" />
|
||||
</ProjectConfiguration>
|
||||
<NetworkConfiguration lossOfSocTolerance="50000000">
|
||||
<NodeCollection>
|
||||
<MN name="openPOWERLINK_MN" nodeID="240" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA302-4_MN.xdc" isAsyncOnly="false" isType1Router="false" isType2Router="false" transmitsPRes="false" />
|
||||
<RMN nodeID="243" name="RMN 3" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA302-4_MN_243.xdc" isAsyncOnly="false" isType1Router="false" isType2Router="false" />
|
||||
<RMN nodeID="242" name="RMN 2" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA302-4_MN_242.xdc" isAsyncOnly="false" isType1Router="false" isType2Router="false" />
|
||||
<RMN nodeID="241" name="RMN 1" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA302-4_MN_241.xdc" isAsyncOnly="false" isType1Router="false" isType2Router="false" />
|
||||
<CN nodeID="1" name="CN_1" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_1.xdc" forcedMultiplexedCycle="0" isMultiplexed="false" isChained="false" isAsyncOnly="false" isType1Router="false" isType2Router="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" verifyDeviceType="true" verifyVendorId="false" verifyRevisionNumber="false" verifyProductCode="false" verifySerialNumber="false" enabled="true">
|
||||
<ForcedObjects>
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
<CN nodeID="32" name="CN_2" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_32.xdc" forcedMultiplexedCycle="0" isMultiplexed="false" isChained="false" isAsyncOnly="false" isType1Router="false" isType2Router="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" verifyDeviceType="true" verifyVendorId="false" verifyRevisionNumber="false" verifyProductCode="false" verifySerialNumber="false" enabled="true">
|
||||
<ForcedObjects>
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
<CN nodeID="110" name="CN_3" pathToXDC="deviceConfiguration/00000000_POWERLINK_CiA401_CN_110.xdc" forcedMultiplexedCycle="0" isMultiplexed="false" isChained="false" isAsyncOnly="false" isType1Router="false" isType2Router="false" isMandatory="false" autostartNode="true" resetInOperational="false" verifyAppSwVersion="false" autoAppSwUpdateAllowed="false" verifyDeviceType="true" verifyVendorId="false" verifyRevisionNumber="false" verifyProductCode="false" verifySerialNumber="false" enabled="true">
|
||||
<ForcedObjects>
|
||||
<Object index="1F98" subindex="05" />
|
||||
<Object index="1F98" subindex="04" />
|
||||
</ForcedObjects>
|
||||
</CN>
|
||||
</NodeCollection>
|
||||
</NetworkConfiguration>
|
||||
</openCONFIGURATORProject>
|
||||
+25635
File diff suppressed because it is too large
Load Diff
+25635
File diff suppressed because it is too large
Load Diff
+25635
File diff suppressed because it is too large
Load Diff
+25635
File diff suppressed because it is too large
Load Diff
+1517
File diff suppressed because it is too large
Load Diff
+1517
File diff suppressed because it is too large
Load Diff
+1517
File diff suppressed because it is too large
Load Diff
+25703
File diff suppressed because it is too large
Load Diff
+1571
File diff suppressed because it is too large
Load Diff
+45
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// This file was autogenerated by openCONFIGURATOR-2.2.1_release on 06-Sep-2018 14:40:27
|
||||
/// Project: Demo_RMN_3CN
|
||||
/// Application process for openPOWERLINK_MN(240)
|
||||
/// </summary>
|
||||
|
||||
namespace openPOWERLINK
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Struct : ProcessImage Out
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
public struct AppProcessImageOut
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte CN1_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(1)]
|
||||
public byte CN32_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(2)]
|
||||
public byte CN110_DigitalInput_00h_AU8_DigitalInput;
|
||||
[FieldOffset(3)]
|
||||
public byte PADDING_VAR_1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Struct : ProcessImage In
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||
public struct AppProcessImageIn
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte CN1_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(1)]
|
||||
public byte CN32_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(2)]
|
||||
public byte CN110_DigitalOutput_00h_AU8_DigitalOutput;
|
||||
[FieldOffset(3)]
|
||||
public byte PADDING_VAR_1;
|
||||
}
|
||||
|
||||
}
|
||||
BIN
Binary file not shown.
+331
@@ -0,0 +1,331 @@
|
||||
////
|
||||
//// This file was autogenerated by openCONFIGURATOR-2.2.1_release on 06-Sep-2018 14:40:27
|
||||
//// Project: Demo_RMN_3CN
|
||||
//// NodeCount: 6
|
||||
////
|
||||
00000041
|
||||
//// NodeId Assignment
|
||||
1F81 01 00000004 00000007
|
||||
//// NodeId Assignment
|
||||
1F81 20 00000004 00000007
|
||||
//// NodeId Assignment
|
||||
1F81 6E 00000004 00000007
|
||||
//// NodeId Assignment
|
||||
1F81 F1 00000004 00000003
|
||||
//// NodeId Assignment
|
||||
1F81 F2 00000004 00000003
|
||||
//// NodeId Assignment
|
||||
1F81 F3 00000004 00000003
|
||||
|
||||
1600 00 00000001 00
|
||||
1601 00 00000001 00
|
||||
1602 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1A01 00 00000001 00
|
||||
1A02 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1C02 01 00000004 00000028
|
||||
1C02 03 00000004 00000028
|
||||
1C09 01 00000004 00000028
|
||||
1C09 20 00000004 00000028
|
||||
1C09 6E 00000004 00000028
|
||||
1C14 00 00000004 02FAF080
|
||||
1F26 01 00000004 0000317B
|
||||
1F26 20 00000004 0000317B
|
||||
1F26 6E 00000004 0000317B
|
||||
1F26 F1 00000004 0000317B
|
||||
1F26 F2 00000004 0000317B
|
||||
1F26 F3 00000004 0000317B
|
||||
1F27 01 00000004 03261416
|
||||
1F27 20 00000004 03261416
|
||||
1F27 6E 00000004 03261416
|
||||
1F27 F1 00000004 03261416
|
||||
1F27 F2 00000004 03261416
|
||||
1F27 F3 00000004 03261416
|
||||
1F80 00 00000004 00004800
|
||||
1F92 01 00000004 00030D40
|
||||
1F92 20 00000004 00030D40
|
||||
1F92 6E 00000004 00030D40
|
||||
1F92 F1 00000004 00006978
|
||||
1F92 F2 00000004 00006978
|
||||
1F92 F3 00000004 00006978
|
||||
1400 01 00000001 01
|
||||
1401 01 00000001 20
|
||||
1402 01 00000001 6E
|
||||
1600 01 00000008 000800000001A4C0
|
||||
1601 01 00000008 000800000002A4C0
|
||||
1602 01 00000008 000800000003A4C0
|
||||
1800 01 00000001 01
|
||||
1801 01 00000001 20
|
||||
1802 01 00000001 6E
|
||||
1A00 01 00000008 000800000001A040
|
||||
1A01 01 00000008 000800000002A040
|
||||
1A02 01 00000008 000800000003A040
|
||||
1600 00 00000001 01
|
||||
1601 00 00000001 01
|
||||
1602 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
1A01 00 00000001 01
|
||||
1A02 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_1(1)
|
||||
1F22 01 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_2(32)
|
||||
1F22 20 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
////Configuration Data for CN: CN_3(110)
|
||||
1F22 6E 00000096
|
||||
0000000E
|
||||
1600 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F98 04 00000002 0024
|
||||
1F98 05 00000002 0024
|
||||
1600 01 00000008 0008000000016200
|
||||
1A00 01 00000008 0008000000016000
|
||||
1600 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
|
||||
////Configuration Data for RMN: RMN 1(241)
|
||||
1F22 F1 0000029B
|
||||
0000003F
|
||||
1F81 01 00000004 00000007
|
||||
1F81 20 00000004 00000007
|
||||
1F81 6E 00000004 00000007
|
||||
1F81 F1 00000004 00000003
|
||||
1F81 F2 00000004 00000003
|
||||
1F81 F3 00000004 00000003
|
||||
1600 00 00000001 00
|
||||
1601 00 00000001 00
|
||||
1602 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1A01 00 00000001 00
|
||||
1A02 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C02 01 00000004 00000028
|
||||
1C02 03 00000004 00000028
|
||||
1C09 01 00000004 00000028
|
||||
1C09 20 00000004 00000028
|
||||
1C09 6E 00000004 00000028
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F26 01 00000004 0000317B
|
||||
1F26 20 00000004 0000317B
|
||||
1F26 6E 00000004 0000317B
|
||||
1F26 F1 00000004 0000317B
|
||||
1F26 F2 00000004 0000317B
|
||||
1F26 F3 00000004 0000317B
|
||||
1F27 01 00000004 03261416
|
||||
1F27 20 00000004 03261416
|
||||
1F27 6E 00000004 03261416
|
||||
1F27 F1 00000004 03261416
|
||||
1F27 F2 00000004 03261416
|
||||
1F27 F3 00000004 03261416
|
||||
1F80 00 00000004 00004800
|
||||
1F92 01 00000004 00030D40
|
||||
1F92 20 00000004 00030D40
|
||||
1F92 6E 00000004 00030D40
|
||||
1F92 F1 00000004 00006978
|
||||
1F92 F2 00000004 00006978
|
||||
1F92 F3 00000004 00006978
|
||||
1400 01 00000001 01
|
||||
1401 01 00000001 20
|
||||
1402 01 00000001 6E
|
||||
1600 01 00000008 000800000001A4C0
|
||||
1601 01 00000008 000800000002A4C0
|
||||
1602 01 00000008 000800000003A4C0
|
||||
1800 01 00000001 01
|
||||
1801 01 00000001 20
|
||||
1802 01 00000001 6E
|
||||
1A00 01 00000008 000800000001A040
|
||||
1A01 01 00000008 000800000002A040
|
||||
1A02 01 00000008 000800000003A040
|
||||
1600 00 00000001 01
|
||||
1601 00 00000001 01
|
||||
1602 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
1A01 00 00000001 01
|
||||
1A02 00 00000001 01
|
||||
1F81 01 00000004 80000007
|
||||
1F81 20 00000004 80000007
|
||||
1F81 6E 00000004 80000007
|
||||
|
||||
////Configuration Data for RMN: RMN 2(242)
|
||||
1F22 F2 0000029B
|
||||
0000003F
|
||||
1F81 01 00000004 00000007
|
||||
1F81 20 00000004 00000007
|
||||
1F81 6E 00000004 00000007
|
||||
1F81 F1 00000004 00000003
|
||||
1F81 F2 00000004 00000003
|
||||
1F81 F3 00000004 00000003
|
||||
1600 00 00000001 00
|
||||
1601 00 00000001 00
|
||||
1602 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1A01 00 00000001 00
|
||||
1A02 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C02 01 00000004 00000028
|
||||
1C02 03 00000004 00000028
|
||||
1C09 01 00000004 00000028
|
||||
1C09 20 00000004 00000028
|
||||
1C09 6E 00000004 00000028
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F26 01 00000004 0000317B
|
||||
1F26 20 00000004 0000317B
|
||||
1F26 6E 00000004 0000317B
|
||||
1F26 F1 00000004 0000317B
|
||||
1F26 F2 00000004 0000317B
|
||||
1F26 F3 00000004 0000317B
|
||||
1F27 01 00000004 03261416
|
||||
1F27 20 00000004 03261416
|
||||
1F27 6E 00000004 03261416
|
||||
1F27 F1 00000004 03261416
|
||||
1F27 F2 00000004 03261416
|
||||
1F27 F3 00000004 03261416
|
||||
1F80 00 00000004 00004800
|
||||
1F92 01 00000004 00030D40
|
||||
1F92 20 00000004 00030D40
|
||||
1F92 6E 00000004 00030D40
|
||||
1F92 F1 00000004 00006978
|
||||
1F92 F2 00000004 00006978
|
||||
1F92 F3 00000004 00006978
|
||||
1400 01 00000001 01
|
||||
1401 01 00000001 20
|
||||
1402 01 00000001 6E
|
||||
1600 01 00000008 000800000001A4C0
|
||||
1601 01 00000008 000800000002A4C0
|
||||
1602 01 00000008 000800000003A4C0
|
||||
1800 01 00000001 01
|
||||
1801 01 00000001 20
|
||||
1802 01 00000001 6E
|
||||
1A00 01 00000008 000800000001A040
|
||||
1A01 01 00000008 000800000002A040
|
||||
1A02 01 00000008 000800000003A040
|
||||
1600 00 00000001 01
|
||||
1601 00 00000001 01
|
||||
1602 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
1A01 00 00000001 01
|
||||
1A02 00 00000001 01
|
||||
1F81 01 00000004 80000007
|
||||
1F81 20 00000004 80000007
|
||||
1F81 6E 00000004 80000007
|
||||
|
||||
////Configuration Data for RMN: RMN 3(243)
|
||||
1F22 F3 0000029B
|
||||
0000003F
|
||||
1F81 01 00000004 00000007
|
||||
1F81 20 00000004 00000007
|
||||
1F81 6E 00000004 00000007
|
||||
1F81 F1 00000004 00000003
|
||||
1F81 F2 00000004 00000003
|
||||
1F81 F3 00000004 00000003
|
||||
1600 00 00000001 00
|
||||
1601 00 00000001 00
|
||||
1602 00 00000001 00
|
||||
1A00 00 00000001 00
|
||||
1A01 00 00000001 00
|
||||
1A02 00 00000001 00
|
||||
1006 00 00000004 0000C350
|
||||
1020 01 00000004 0000317B
|
||||
1020 02 00000004 03261416
|
||||
1C02 01 00000004 00000028
|
||||
1C02 03 00000004 00000028
|
||||
1C09 01 00000004 00000028
|
||||
1C09 20 00000004 00000028
|
||||
1C09 6E 00000004 00000028
|
||||
1C0B 03 00000004 00000050
|
||||
1C0D 03 00000004 00000050
|
||||
1C14 00 00000004 02FAF080
|
||||
1F26 01 00000004 0000317B
|
||||
1F26 20 00000004 0000317B
|
||||
1F26 6E 00000004 0000317B
|
||||
1F26 F1 00000004 0000317B
|
||||
1F26 F2 00000004 0000317B
|
||||
1F26 F3 00000004 0000317B
|
||||
1F27 01 00000004 03261416
|
||||
1F27 20 00000004 03261416
|
||||
1F27 6E 00000004 03261416
|
||||
1F27 F1 00000004 03261416
|
||||
1F27 F2 00000004 03261416
|
||||
1F27 F3 00000004 03261416
|
||||
1F80 00 00000004 00004800
|
||||
1F92 01 00000004 00030D40
|
||||
1F92 20 00000004 00030D40
|
||||
1F92 6E 00000004 00030D40
|
||||
1F92 F1 00000004 00006978
|
||||
1F92 F2 00000004 00006978
|
||||
1F92 F3 00000004 00006978
|
||||
1400 01 00000001 01
|
||||
1401 01 00000001 20
|
||||
1402 01 00000001 6E
|
||||
1600 01 00000008 000800000001A4C0
|
||||
1601 01 00000008 000800000002A4C0
|
||||
1602 01 00000008 000800000003A4C0
|
||||
1800 01 00000001 01
|
||||
1801 01 00000001 20
|
||||
1802 01 00000001 6E
|
||||
1A00 01 00000008 000800000001A040
|
||||
1A01 01 00000008 000800000002A040
|
||||
1A02 01 00000008 000800000003A040
|
||||
1600 00 00000001 01
|
||||
1601 00 00000001 01
|
||||
1602 00 00000001 01
|
||||
1A00 00 00000001 01
|
||||
1A01 00 00000001 01
|
||||
1A02 00 00000001 01
|
||||
1F81 01 00000004 80000007
|
||||
1F81 20 00000004 80000007
|
||||
1F81 6E 00000004 80000007
|
||||
|
||||
//// NodeId Reassignment
|
||||
1F81 01 00000004 80000007
|
||||
//// NodeId Reassignment
|
||||
1F81 20 00000004 80000007
|
||||
//// NodeId Reassignment
|
||||
1F81 6E 00000004 80000007
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
0x41, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81,
|
||||
0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x81, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF3, 0x04, 0x00,
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00,
|
||||
0x00, 0x02, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x1C, 0x03, 0x04,
|
||||
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00,
|
||||
0x00, 0x00, 0x09, 0x1C, 0x20, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x6E,
|
||||
0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80,
|
||||
0xF0, 0xFA, 0x02, 0x26, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F,
|
||||
0x20, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00,
|
||||
0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26,
|
||||
0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF3, 0x04, 0x00, 0x00,
|
||||
0x00, 0x7B, 0x31, 0x00, 0x00, 0x27, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03,
|
||||
0x27, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x6E, 0x04, 0x00,
|
||||
0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26,
|
||||
0x03, 0x27, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF3, 0x04,
|
||||
0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x80, 0x1F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x48,
|
||||
0x00, 0x00, 0x92, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x20,
|
||||
0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x40,
|
||||
0x0D, 0x03, 0x00, 0x92, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F,
|
||||
0xF2, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00,
|
||||
0x78, 0x69, 0x00, 0x00, 0x00, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x14, 0x01, 0x01,
|
||||
0x00, 0x00, 0x00, 0x20, 0x02, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x16, 0x01, 0x08,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xA4, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x16, 0x01, 0x08, 0x00,
|
||||
0x00, 0x00, 0xC0, 0xA4, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x16, 0x01, 0x08, 0x00, 0x00,
|
||||
0x00, 0xC0, 0xA4, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00,
|
||||
0x6E, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x01, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02,
|
||||
0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x16,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F,
|
||||
0x01, 0x96, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x50, 0xC3, 0x00, 0x00, 0x20, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20,
|
||||
0x10, 0x02, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00,
|
||||
0x00, 0x50, 0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02, 0x00,
|
||||
0x00, 0x00, 0x24, 0x00, 0x98, 0x1F, 0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16, 0x01,
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x62, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01, 0x08,
|
||||
0x00, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F, 0x20, 0x96, 0x00,
|
||||
0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00,
|
||||
0x00, 0x20, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04,
|
||||
0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00,
|
||||
0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02, 0x00, 0x00, 0x00, 0x24,
|
||||
0x00, 0x98, 0x1F, 0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00,
|
||||
0x00, 0x00, 0x62, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x60, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F, 0x6E, 0x96, 0x00, 0x00, 0x00, 0x0E,
|
||||
0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00, 0x00, 0x20, 0x10,
|
||||
0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04, 0x00, 0x00, 0x00,
|
||||
0x16, 0x14, 0x26, 0x03, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0D,
|
||||
0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00, 0x04, 0x00, 0x00,
|
||||
0x00, 0x80, 0xF0, 0xFA, 0x02, 0x98, 0x1F, 0x04, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x98, 0x1F,
|
||||
0x05, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x62,
|
||||
0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x60, 0x01,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1A, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x01, 0x22, 0x1F, 0xF1, 0x9B, 0x02, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00,
|
||||
0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x20, 0x04, 0x00,
|
||||
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
|
||||
0x00, 0x81, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF2, 0x04,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00,
|
||||
0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00, 0x00, 0x20, 0x10, 0x01,
|
||||
0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04, 0x00, 0x00, 0x00, 0x16,
|
||||
0x14, 0x26, 0x03, 0x02, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x1C,
|
||||
0x03, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00,
|
||||
0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x20, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09,
|
||||
0x1C, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0B, 0x1C, 0x03, 0x04, 0x00, 0x00,
|
||||
0x00, 0x50, 0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x26, 0x1F, 0x01, 0x04, 0x00,
|
||||
0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00,
|
||||
0x00, 0x26, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF1, 0x04,
|
||||
0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31,
|
||||
0x00, 0x00, 0x26, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x27, 0x1F, 0x01,
|
||||
0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x16,
|
||||
0x14, 0x26, 0x03, 0x27, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F,
|
||||
0xF1, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00,
|
||||
0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x80,
|
||||
0x1F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x92, 0x1F, 0x01, 0x04, 0x00, 0x00,
|
||||
0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00,
|
||||
0x92, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0xF1, 0x04, 0x00,
|
||||
0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00,
|
||||
0x00, 0x92, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x00, 0x14, 0x01, 0x01,
|
||||
0x00, 0x00, 0x00, 0x01, 0x01, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x14, 0x01, 0x01,
|
||||
0x00, 0x00, 0x00, 0x6E, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x01, 0x00, 0x00,
|
||||
0x00, 0x08, 0x00, 0x01, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x02, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x02, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x03, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x00, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00,
|
||||
0x20, 0x02, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00,
|
||||
0x40, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40,
|
||||
0xA0, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x40, 0xA0,
|
||||
0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x16,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
|
||||
0x80, 0x81, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x6E, 0x04,
|
||||
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x22, 0x1F, 0xF2, 0x9B, 0x02, 0x00, 0x00, 0x3F, 0x00,
|
||||
0x00, 0x00, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x20,
|
||||
0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x07,
|
||||
0x00, 0x00, 0x00, 0x81, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F,
|
||||
0xF2, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00, 0x00, 0x20,
|
||||
0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04, 0x00, 0x00,
|
||||
0x00, 0x16, 0x14, 0x26, 0x03, 0x02, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
|
||||
0x02, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x01, 0x04, 0x00,
|
||||
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x20, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
|
||||
0x00, 0x09, 0x1C, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0B, 0x1C, 0x03, 0x04,
|
||||
0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00,
|
||||
0x00, 0x00, 0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x26, 0x1F, 0x01,
|
||||
0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x7B,
|
||||
0x31, 0x00, 0x00, 0x26, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F,
|
||||
0xF1, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00,
|
||||
0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x27,
|
||||
0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x20, 0x04, 0x00, 0x00,
|
||||
0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03,
|
||||
0x27, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF2, 0x04, 0x00,
|
||||
0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26,
|
||||
0x03, 0x80, 0x1F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x92, 0x1F, 0x01, 0x04,
|
||||
0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D,
|
||||
0x03, 0x00, 0x92, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0xF1,
|
||||
0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x78,
|
||||
0x69, 0x00, 0x00, 0x92, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x00, 0x14,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x14,
|
||||
0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x01,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x02, 0x00,
|
||||
0x00, 0x00, 0x08, 0x00, 0x02, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x03, 0x00, 0x00,
|
||||
0x00, 0x08, 0x00, 0x00, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x18, 0x01, 0x01, 0x00,
|
||||
0x00, 0x00, 0x20, 0x02, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x1A, 0x01, 0x08, 0x00,
|
||||
0x00, 0x00, 0x40, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x1A, 0x01, 0x08, 0x00, 0x00,
|
||||
0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x1A, 0x01, 0x08, 0x00, 0x00, 0x00,
|
||||
0x40, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x01, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
||||
0x02, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07,
|
||||
0x00, 0x00, 0x80, 0x81, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F,
|
||||
0x6E, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x22, 0x1F, 0xF3, 0x9B, 0x02, 0x00, 0x00,
|
||||
0x3F, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81,
|
||||
0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
0x81, 0x1F, 0xF2, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x81, 0x1F, 0xF3, 0x04, 0x00,
|
||||
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x16,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1A,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x50, 0xC3, 0x00,
|
||||
0x00, 0x20, 0x10, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x20, 0x10, 0x02, 0x04,
|
||||
0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x02, 0x1C, 0x01, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00,
|
||||
0x00, 0x00, 0x02, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x01,
|
||||
0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x09, 0x1C, 0x20, 0x04, 0x00, 0x00, 0x00, 0x28,
|
||||
0x00, 0x00, 0x00, 0x09, 0x1C, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0B, 0x1C,
|
||||
0x03, 0x04, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x0D, 0x1C, 0x03, 0x04, 0x00, 0x00, 0x00,
|
||||
0x50, 0x00, 0x00, 0x00, 0x14, 0x1C, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFA, 0x02, 0x26,
|
||||
0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x20, 0x04, 0x00, 0x00,
|
||||
0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00,
|
||||
0x26, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF2, 0x04, 0x00,
|
||||
0x00, 0x00, 0x7B, 0x31, 0x00, 0x00, 0x26, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x7B, 0x31, 0x00,
|
||||
0x00, 0x27, 0x1F, 0x01, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x20, 0x04,
|
||||
0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14,
|
||||
0x26, 0x03, 0x27, 0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF2,
|
||||
0x04, 0x00, 0x00, 0x00, 0x16, 0x14, 0x26, 0x03, 0x27, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x16,
|
||||
0x14, 0x26, 0x03, 0x80, 0x1F, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x92, 0x1F,
|
||||
0x01, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00,
|
||||
0x40, 0x0D, 0x03, 0x00, 0x92, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x40, 0x0D, 0x03, 0x00, 0x92,
|
||||
0x1F, 0xF1, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F, 0xF2, 0x04, 0x00, 0x00,
|
||||
0x00, 0x78, 0x69, 0x00, 0x00, 0x92, 0x1F, 0xF3, 0x04, 0x00, 0x00, 0x00, 0x78, 0x69, 0x00, 0x00,
|
||||
0x00, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20,
|
||||
0x02, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0,
|
||||
0xA4, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4,
|
||||
0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x16, 0x01, 0x08, 0x00, 0x00, 0x00, 0xC0, 0xA4, 0x03,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x18, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x20, 0x02, 0x18, 0x01, 0x01, 0x00, 0x00, 0x00, 0x6E, 0x00, 0x1A, 0x01,
|
||||
0x08, 0x00, 0x00, 0x00, 0x40, 0xA0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x1A, 0x01, 0x08,
|
||||
0x00, 0x00, 0x00, 0x40, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x1A, 0x01, 0x08, 0x00,
|
||||
0x00, 0x00, 0x40, 0xA0, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x16, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x01, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x16, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1A, 0x00, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x02, 0x1A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x81, 0x1F, 0x01, 0x04, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80,
|
||||
0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x01, 0x04, 0x00,
|
||||
0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x20, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
|
||||
0x80, 0x81, 0x1F, 0x6E, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file was autogenerated by openCONFIGURATOR-2.2.1_release on 06-Sep-2018 14:40:27
|
||||
* Project: Demo_RMN_3CN
|
||||
* Application process for openPOWERLINK_MN(240)
|
||||
*/
|
||||
#ifndef XAP_h
|
||||
#define XAP_h
|
||||
|
||||
#define COMPUTED_PI_OUT_SIZE 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned CN1_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned CN32_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned CN110_DigitalInput_00h_AU8_DigitalInput:8;
|
||||
unsigned PADDING_VAR_1:8;
|
||||
} PI_OUT;
|
||||
|
||||
#define COMPUTED_PI_IN_SIZE 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned CN1_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned CN32_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned CN110_DigitalOutput_00h_AU8_DigitalOutput:8;
|
||||
unsigned PADDING_VAR_1:8;
|
||||
} PI_IN;
|
||||
|
||||
#endif
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This file was autogenerated by openCONFIGURATOR-2.2.1_release on 06-Sep-2018 14:40:27 -->
|
||||
<!-- Project: Demo_RMN_3CN -->
|
||||
<!-- Application process for openPOWERLINK_MN(240) -->
|
||||
<ApplicationProcess xmlns="http://ethernet-powerlink.org/POWERLINK/PI">
|
||||
<ProcessImage type="output" size="3">
|
||||
<Channel Name="CN1.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0000"/>
|
||||
<Channel Name="CN32.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0001"/>
|
||||
<Channel Name="CN110.DigitalInput.00h.AU8.DigitalInput" dataType="Unsigned8" dataSize="8" PIOffset="0x0002"/>
|
||||
</ProcessImage>
|
||||
<ProcessImage type="input" size="3">
|
||||
<Channel Name="CN1.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0000"/>
|
||||
<Channel Name="CN32.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0001"/>
|
||||
<Channel Name="CN110.DigitalOutput.00h.AU8.DigitalOutput" dataType="Unsigned8" dataSize="8" PIOffset="0x0002"/>
|
||||
</ProcessImage>
|
||||
</ApplicationProcess>
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file arp-target.h
|
||||
|
||||
\brief ARP demo target header
|
||||
|
||||
This file contains the target specific definitions like endian conversion.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_arp_target_H_
|
||||
#define _INC_arp_target_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#if (TARGET_SYSTEM == _LINUX_)
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#if CHECK_IF_BIG_ENDIAN()
|
||||
// Big endian => no swap needed
|
||||
#define htons(x) (x)
|
||||
#define htonl(x) (x)
|
||||
#define ntohs(x) (x)
|
||||
#define ntohl(x) (x)
|
||||
#else
|
||||
// Little endian => swap needed
|
||||
// Swap long: 0x00C0FFEE --> 0xEEFFC000
|
||||
#define ARP_SWAPL(x) ((((x) >> 24) & 0x000000FF) | \
|
||||
(((x) >> 8) & 0x0000FF00) | \
|
||||
(((x) & 0x000000FF) << 24) | \
|
||||
(((x) & 0x0000FF00) << 8))
|
||||
|
||||
// Swap short: 0xC0FE --> 0xFEC0
|
||||
#define ARP_SWAPS(x) ((((x) >> 8) & 0x00FF) | \
|
||||
(((x) << 8) & 0xFF00))
|
||||
|
||||
#define htons(x) ARP_SWAPS(x)
|
||||
#define htonl(x) ARP_SWAPL(x)
|
||||
#define ntohs(x) ARP_SWAPS(x)
|
||||
#define ntohl(x) ARP_SWAPL(x)
|
||||
#endif //CHECK_IF_BIG_ENDIAN
|
||||
#endif //DEV_SYSTEM
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_arp_target_H_ */
|
||||
+426
@@ -0,0 +1,426 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file arp.c
|
||||
|
||||
\brief ARP demo implementation
|
||||
|
||||
This file implements an ARP demo for demo targets that have no IP stack.
|
||||
|
||||
\ingroup module_app_common
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include "arp.h"
|
||||
#include "arp-target.h"
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#define ARP_ETHERTYPE 0x0806 ///< ARP "EtherType"
|
||||
#define ARP_HWTYPE_ETHERNET 1 ///< ARP hardware type Ethernet
|
||||
#define ARP_PROTYPE_IPV4 0x0800 ///< ARP protocol type IP V4
|
||||
#define ARP_HWADDR_LENGTH 6 ///< ARP hardware address length Ethernet
|
||||
#define ARP_PROADDR_LENGTH 4 ///< ARP protocol address length IP V4
|
||||
#define ARP_OP_REQUEST 1 ///< ARP operation request
|
||||
#define ARP_OP_REPLY 2 ///< ARP operation reply
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* \brief Ethernet with ARP message
|
||||
*
|
||||
* This struct defines an Ethernet frame with ARP message payload.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT8 aDstMac[ARP_HWADDR_LENGTH]; ///< Ethernet destination MAC address
|
||||
UINT8 aSrcMac[ARP_HWADDR_LENGTH]; ///< Ethernet source MAC address
|
||||
UINT16 etherType; ///< Ethernet "etherType"
|
||||
UINT16 hardwareType; ///< ARP network protocol type
|
||||
UINT16 protocolType; ///< ARP internetwork protocol type
|
||||
UINT8 hardwareAddressLength; ///< ARP length of hardware address [octets]
|
||||
UINT8 protocolAddressLength; ///< ARP length of internetwork address [octets]
|
||||
UINT16 operation; ///< ARP operation
|
||||
UINT8 aSenderHardwareAddress[ARP_HWADDR_LENGTH]; ///< ARP sender hardware address
|
||||
UINT8 aSenderProtocolAddress[ARP_PROADDR_LENGTH]; ///< ARP sender internetwork address
|
||||
UINT8 aTargetHardwareAddress[ARP_HWADDR_LENGTH]; ///< ARP target hardware address
|
||||
UINT8 aTargetProtocolAddress[ARP_PROADDR_LENGTH]; ///< ARP target internetwork address
|
||||
} tArpFrame;
|
||||
|
||||
/**
|
||||
* \brief ARP instance
|
||||
*
|
||||
* This struct defines the ARP instance.
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tArpFrame frameTemplate; ///< ARP frame template
|
||||
UINT8 nodeId; ///< The local node ID
|
||||
UINT8 aMacAddr[ARP_HWADDR_LENGTH]; ///< The local node's MAC address in network order
|
||||
UINT8 aIpAddr[ARP_PROADDR_LENGTH]; ///< The local node's IP address in network order
|
||||
UINT8 aDefaultGwIp[ARP_PROADDR_LENGTH]; ///< Default gateway IP address in network order
|
||||
UINT8 aDefaultGwMac[ARP_HWADDR_LENGTH]; ///< Default gateway MAC address in network order
|
||||
} tArpInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
static tArpInstance arpInstance_l;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
static void handleReply(const tArpFrame* pFrame_p);
|
||||
static int handleRequest(const tArpFrame* pFrame_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize ARP module
|
||||
|
||||
The function initializes the ARP module before being used.
|
||||
|
||||
\param[in] nodeId_p The local node ID
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void arp_init(UINT8 nodeId_p)
|
||||
{
|
||||
tArpFrame* pFrame;
|
||||
|
||||
memset(&arpInstance_l, 0, sizeof(tArpInstance));
|
||||
|
||||
arpInstance_l.nodeId = nodeId_p;
|
||||
|
||||
pFrame = &arpInstance_l.frameTemplate; // Set ARP frame template
|
||||
pFrame->etherType = htons(ARP_ETHERTYPE); // EtherType: ARP
|
||||
pFrame->hardwareType = htons(ARP_HWTYPE_ETHERNET); // Hardware Type: Ethernet
|
||||
pFrame->protocolType = htons(ARP_PROTYPE_IPV4); // Protocol Type: IP V4
|
||||
pFrame->hardwareAddressLength = ARP_HWADDR_LENGTH; // Hardware Address Length
|
||||
pFrame->protocolAddressLength = ARP_PROADDR_LENGTH; // Protocol Address Length
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown ARP module
|
||||
|
||||
The function shuts down the ARP module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void arp_exit(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Set local node MAC address
|
||||
|
||||
The function sets the local node's MAC address.
|
||||
|
||||
\param[in] pMacAddr_p Pointer to buffer that holds the MAC address to be set
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void arp_setMacAddr(const UINT8* pMacAddr_p)
|
||||
{
|
||||
memcpy(&arpInstance_l.aMacAddr, pMacAddr_p, ARP_HWADDR_LENGTH);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Set local node IP address
|
||||
|
||||
The function sets the local node's IP address.
|
||||
|
||||
\param[in] ipAddr_p IP address to be set
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void arp_setIpAddr(UINT32 ipAddr_p)
|
||||
{
|
||||
UINT32 ipAddr = htonl(ipAddr_p); // Swap to get network order
|
||||
|
||||
memcpy(arpInstance_l.aIpAddr, &ipAddr, ARP_PROADDR_LENGTH);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Set default gateway address
|
||||
|
||||
The function sets the default gateway's IP address.
|
||||
|
||||
\param[in] defGateway_p Default gateway IP address
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void arp_setDefGateway(UINT32 defGateway_p)
|
||||
{
|
||||
UINT32 defGateway = htonl(defGateway_p); // Swap to get network order
|
||||
|
||||
memcpy(arpInstance_l.aDefaultGwIp, &defGateway, ARP_PROADDR_LENGTH);
|
||||
|
||||
// Invalidate default gateway's MAC address
|
||||
memset(arpInstance_l.aDefaultGwMac, 0, ARP_HWADDR_LENGTH);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Send ARP request to POWERLINK node
|
||||
|
||||
The function sends an ARP request to the given POWERLINK node.
|
||||
|
||||
\param[in] ipAddr_p IP address to destination node
|
||||
|
||||
\return The function returns 0 if the ARP request has been sent, otherwise -1.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
int arp_sendRequest(UINT32 ipAddr_p)
|
||||
{
|
||||
tArpFrame frameBuffer;
|
||||
tArpFrame* pFrame = &frameBuffer;
|
||||
UINT32 ipAddr = htonl(ipAddr_p); // Swap to get network order
|
||||
|
||||
// Copy ARP frame template to frame buffer
|
||||
memcpy(pFrame, &arpInstance_l.frameTemplate, sizeof(tArpFrame));
|
||||
|
||||
// Set Destination MAC address (broadcast)
|
||||
memset(pFrame->aDstMac, 0xFF, ARP_HWADDR_LENGTH);
|
||||
|
||||
// Set ARP operation
|
||||
pFrame->operation = htons(ARP_OP_REQUEST);
|
||||
|
||||
// Sender IP Address
|
||||
memcpy(pFrame->aSenderProtocolAddress, arpInstance_l.aIpAddr, ARP_PROADDR_LENGTH);
|
||||
|
||||
// Overwrite last byte with node ID
|
||||
pFrame->aSenderProtocolAddress[3] = arpInstance_l.nodeId;
|
||||
|
||||
// Sender MAC Address
|
||||
memcpy(pFrame->aSenderHardwareAddress, &arpInstance_l.aMacAddr[0], ARP_HWADDR_LENGTH);
|
||||
|
||||
// Target IP Address
|
||||
memcpy(pFrame->aTargetProtocolAddress, &ipAddr, ARP_PROADDR_LENGTH);
|
||||
|
||||
if (oplk_sendEthFrame((tPlkFrame*)pFrame, sizeof(tArpFrame)) == kErrorOk)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Process Ethernet ARP frames
|
||||
|
||||
The function processes a received Ethernet frame for ARP handling.
|
||||
|
||||
\param[in] pFrame_p Pointer to ARP frame
|
||||
\param[in] size_p Size of the frame
|
||||
|
||||
\return The function returns 0 if an ARP frame has been received and handled
|
||||
successfully, otherwise -1.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
int arp_processReceive(const tPlkFrame* pFrame_p,
|
||||
UINT size_p)
|
||||
{
|
||||
int ret = 0;
|
||||
tArpFrame* pFrame = (tArpFrame*)pFrame_p;
|
||||
|
||||
// Handle ARP frames: Check etherType and frame size
|
||||
if ((ntohs(pFrame->etherType) == ARP_ETHERTYPE) &&
|
||||
(size_p >= sizeof(tArpFrame)))
|
||||
{
|
||||
//Check for correct hardware, protocol type and length fields
|
||||
if ((ntohs(pFrame->hardwareType) == ARP_HWTYPE_ETHERNET) &&
|
||||
(ntohs(pFrame->protocolType) == ARP_PROTYPE_IPV4) &&
|
||||
(pFrame->hardwareAddressLength == ARP_HWADDR_LENGTH) &&
|
||||
(pFrame->protocolAddressLength == ARP_PROADDR_LENGTH))
|
||||
{
|
||||
switch (ntohs(pFrame->operation))
|
||||
{
|
||||
case ARP_OP_REPLY:
|
||||
handleReply(pFrame);
|
||||
break;
|
||||
|
||||
case ARP_OP_REQUEST:
|
||||
handleRequest(pFrame);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is no ARP frame => other protocol shall try...
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Handle ARP Reply frame
|
||||
|
||||
The function handles an ARP Reply frame.
|
||||
|
||||
\param[in] pFrame_p Pointer to ARP frame
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void handleReply(const tArpFrame* pFrame_p)
|
||||
{
|
||||
PRINTF("ARP: Node with IP Address %d.%d.%d.%d ",
|
||||
pFrame_p->aSenderProtocolAddress[0],
|
||||
pFrame_p->aSenderProtocolAddress[1],
|
||||
pFrame_p->aSenderProtocolAddress[2],
|
||||
pFrame_p->aSenderProtocolAddress[3]);
|
||||
PRINTF("has MAC Address %02X:%02X:%02X:%02X:%02X:%02X ",
|
||||
pFrame_p->aSenderHardwareAddress[0],
|
||||
pFrame_p->aSenderHardwareAddress[1],
|
||||
pFrame_p->aSenderHardwareAddress[2],
|
||||
pFrame_p->aSenderHardwareAddress[3],
|
||||
pFrame_p->aSenderHardwareAddress[4],
|
||||
pFrame_p->aSenderHardwareAddress[5]);
|
||||
|
||||
if (memcmp(pFrame_p->aSenderProtocolAddress, arpInstance_l.aDefaultGwIp, ARP_PROADDR_LENGTH) == 0)
|
||||
{
|
||||
PRINTF("(default gateway)");
|
||||
|
||||
// Store default gateway's MAC address
|
||||
memcpy(arpInstance_l.aDefaultGwMac, pFrame_p->aSenderHardwareAddress, ARP_HWADDR_LENGTH);
|
||||
}
|
||||
|
||||
PRINTF("\n");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Handle ARP Request frame
|
||||
|
||||
The function handles an ARP Request frame by sending the corresponding ARP reply.
|
||||
|
||||
\param[in] pFrame_p Pointer to ARP frame
|
||||
|
||||
\return The function returns 0 if the ARP request has been answered successfully,
|
||||
otherwise -1.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static int handleRequest(const tArpFrame* pFrame_p)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
// Reply if the request is addressing us
|
||||
if (memcmp(pFrame_p->aTargetProtocolAddress, arpInstance_l.aIpAddr, ARP_PROADDR_LENGTH) == 0)
|
||||
{
|
||||
tArpFrame frameBuffer;
|
||||
tArpFrame* pFrame = &frameBuffer;
|
||||
const tArpFrame* pRxFrame = pFrame_p;
|
||||
|
||||
// Copy ARP frame template to frame buffer
|
||||
memcpy(pFrame, &arpInstance_l.frameTemplate, sizeof(tArpFrame));
|
||||
|
||||
// Copy Destination MAC address to received Source MAC
|
||||
memcpy(pFrame->aDstMac, pRxFrame->aSrcMac, ARP_HWADDR_LENGTH);
|
||||
|
||||
// Set ARP operation
|
||||
pFrame->operation = htons(ARP_OP_REPLY);
|
||||
|
||||
// Sender IP Address
|
||||
memcpy(pFrame->aSenderProtocolAddress, arpInstance_l.aIpAddr, ARP_PROADDR_LENGTH);
|
||||
|
||||
// Overwrite last byte with node ID
|
||||
pFrame->aSenderProtocolAddress[3] = arpInstance_l.nodeId;
|
||||
|
||||
// Sender MAC Address
|
||||
memcpy(pFrame->aSenderHardwareAddress, &arpInstance_l.aMacAddr[0], ARP_HWADDR_LENGTH);
|
||||
|
||||
// Copy received sender info to target info
|
||||
memcpy(pFrame->aTargetHardwareAddress, pRxFrame->aSenderHardwareAddress, ARP_HWADDR_LENGTH);
|
||||
memcpy(pFrame->aTargetProtocolAddress, pRxFrame->aSenderProtocolAddress, ARP_PROADDR_LENGTH);
|
||||
|
||||
if (oplk_sendEthFrame((tPlkFrame*)pFrame, sizeof(tArpFrame)) == kErrorOk)
|
||||
ret = 0;
|
||||
else
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file arp.h
|
||||
|
||||
\brief ARP demo implementation
|
||||
|
||||
This file contains the definitions for the ARP demo.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_arp_H_
|
||||
#define _INC_arp_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void arp_init(UINT8 nodeId_p);
|
||||
void arp_exit(void);
|
||||
void arp_setMacAddr(const UINT8* pMacAddr_p);
|
||||
void arp_setIpAddr(UINT32 ipAddr_p);
|
||||
void arp_setDefGateway(UINT32 defGateway_p);
|
||||
|
||||
int arp_sendRequest(UINT32 ipAddr_p);
|
||||
int arp_processReceive(const tPlkFrame* pFrame_p,
|
||||
UINT size_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_arp_H_ */
|
||||
+422
@@ -0,0 +1,422 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file eventlog.c
|
||||
|
||||
\brief openPOWERLIK application event logger
|
||||
|
||||
This module implements an event logger for openPOWERLINK applications. It can
|
||||
print system events in a defined format. It allows filtering of events via
|
||||
categories and levels.
|
||||
|
||||
The module is intended to be used by openPOWERLINK C applications to print
|
||||
uniform log output. The module uses the eventlog string module to generate the
|
||||
log message strings.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include "eventlog.h"
|
||||
#include <oplk/debugstr.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#define EVENTLOG_MAX_LENGTH 256 ///< Maximum log message length
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Instance of event log module
|
||||
*
|
||||
* This structure contains all valid information of an event log instance.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tEventlogFormat format; ///< The format of the log output
|
||||
///< (kEventlogFormatReadable or kEventlogFormatParsable)
|
||||
tEventlogOutputCb pfnOutput; ///< Function pointer to the output function
|
||||
UINT32 filterLevel; ///< The level filter. It contains a bitmask with all
|
||||
///< levels to be printed.
|
||||
UINT32 filterCategory; ///< The category filter. It contains a bitmask with all
|
||||
///< categories to be printed.
|
||||
} tEventlogInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
static tEventlogInstance eventlogInstance_l;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
static void printMessage(const char* message_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize event logger
|
||||
|
||||
The function initializes the event logger. It sets up the logging filter and
|
||||
the logging format. A callback function that is used by the logger for
|
||||
printing log messages must be provided.
|
||||
|
||||
\param[in] format_p Specifies the logging format.
|
||||
\param[in] filterLevel_p Sets the filter for the logging level.
|
||||
\param[in] filterCategory_p Sets the filter for the logging category.
|
||||
\param[in] pfnOutput_p A callback function to be provided to the logger
|
||||
for printing log messages.
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_init(tEventlogFormat format_p,
|
||||
UINT32 filterLevel_p,
|
||||
UINT32 filterCategory_p,
|
||||
tEventlogOutputCb pfnOutput_p)
|
||||
{
|
||||
eventlogInstance_l.format = format_p;
|
||||
eventlogInstance_l.pfnOutput = pfnOutput_p;
|
||||
eventlogInstance_l.filterLevel = filterLevel_p;
|
||||
eventlogInstance_l.filterCategory = filterCategory_p;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a generic log message
|
||||
|
||||
The function can be used to print a generic log message. You can specify a
|
||||
printf style format string for printing.
|
||||
|
||||
\param[in] level_p The log level to be used for the output.
|
||||
\param[in] category_p The log category to be used for the output.
|
||||
\param[in] fmt_p The printf style format string which specifies the
|
||||
message.
|
||||
\param[in] ... Required arguments according to the format string.
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printMessage(tEventlogLevel level_p,
|
||||
tEventlogCategory category_p,
|
||||
const char* fmt_p,
|
||||
...)
|
||||
{
|
||||
va_list arglist;
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << level_p)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << category_p))))
|
||||
return;
|
||||
|
||||
va_start(arglist, fmt_p);
|
||||
eventlog_createMessageString(logMsg,
|
||||
EVENTLOG_MAX_LENGTH,
|
||||
level_p,
|
||||
category_p,
|
||||
fmt_p,
|
||||
arglist);
|
||||
va_end(arglist);
|
||||
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a node event
|
||||
|
||||
The function is used to log openPOWERLINK node events.
|
||||
|
||||
\param[in] pNodeEvent_p The node event information to be logged.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printNodeEvent(const tOplkApiEventNode* pNodeEvent_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryNodeEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createNodeEventString(pNodeEvent_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a state change event
|
||||
|
||||
The function is used to log openPOWERLINK state change events.
|
||||
|
||||
\param[in] pStateChangeEvent_p The state change event information to be logged.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printStateEvent(const tEventNmtStateChange* pStateChangeEvent_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryStateChangeEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createStateEventString(pStateChangeEvent_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a CFM result event
|
||||
|
||||
The function is used to log openPOWERLINK CFM result events.
|
||||
|
||||
\param[in] nodeId_p The node ID of the node specified in the received
|
||||
event.
|
||||
\param[in] nodeCommand_p The nodeCommand of the received CFM result event.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printCfmResultEvent(UINT8 nodeId_p,
|
||||
tNmtNodeCommand nodeCommand_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryCfmResultEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createCfmResultEventString(nodeId_p,
|
||||
nodeCommand_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a CFM progress event
|
||||
|
||||
The function is used to log openPOWERLINK CFM progress events.
|
||||
|
||||
\param[in] pProgress_p The information about the received event.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printCfmProgressEvent(const tCfmEventCnProgress* pProgress_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryCfmProgressEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createCfmProgressEventString(pProgress_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a PDO change event
|
||||
|
||||
The function is used to log openPOWERLINK PDO change events.
|
||||
|
||||
\param[in] pPdoChange_p The information about the received event.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printPdoEvent(const tOplkApiEventPdoChange* pPdoChange_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryPdoEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createPdoEventString(pPdoChange_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Log a PDO mapping information
|
||||
|
||||
The function is used to log openPOWERLINK PDO mappings.
|
||||
|
||||
\param[in] mapObject_p The object index of the mapping object.
|
||||
\param[in] subIndex_p The sub-index of the mapping object.
|
||||
\param[in] mapping_p The 64bit mapping information.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printPdoMap(UINT16 mapObject_p,
|
||||
UINT8 subIndex_p,
|
||||
UINT64 mapping_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelInfo)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryPdoMap))))
|
||||
return;
|
||||
|
||||
eventlog_createPdoMapString(mapObject_p,
|
||||
subIndex_p,
|
||||
mapping_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Log a history event
|
||||
|
||||
The function is used to log openPOWERLINK history events.
|
||||
|
||||
\param[in] pHistory_p The information about the history event to log.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printHistoryEvent(const tErrHistoryEntry* pHistory_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryHistoryEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createHistoryEventString(pHistory_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Log an error event
|
||||
|
||||
The function is used to log openPOWERLINK error/warning events.
|
||||
|
||||
\param[in] pError_p The information about the error event to log.
|
||||
|
||||
\ingroup module_app_eventlog
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_printErrorEvent(const tEventError* pError_p)
|
||||
{
|
||||
char logMsg[EVENTLOG_MAX_LENGTH];
|
||||
|
||||
if (!((eventlogInstance_l.filterLevel & (1 << kEventlogLevelEvent)) &&
|
||||
(eventlogInstance_l.filterCategory & (1 << kEventlogCategoryErrorEvent))))
|
||||
return;
|
||||
|
||||
eventlog_createErrorEventString(pError_p,
|
||||
eventlogInstance_l.format,
|
||||
logMsg,
|
||||
EVENTLOG_MAX_LENGTH);
|
||||
printMessage(logMsg);
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print event log message
|
||||
|
||||
The function prints the eventlog message by calling the registered printing
|
||||
callback function.
|
||||
|
||||
\param[in] message_p Event log message to be printed.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void printMessage(const char* message_p)
|
||||
{
|
||||
if (eventlogInstance_l.pfnOutput != NULL)
|
||||
{
|
||||
eventlogInstance_l.pfnOutput(message_p);
|
||||
eventlogInstance_l.pfnOutput("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/// \}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file eventlog.h
|
||||
|
||||
\brief Definitions for event log module
|
||||
|
||||
This file contains definitions for the eventlog module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_eventlog_H_
|
||||
#define _INC_eventlog_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
#include <oplk/nmt.h>
|
||||
#include "eventlogstring.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
typedef int (*tEventlogOutputCb)(const char* fmt_p, ...);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void eventlog_init(tEventlogFormat format_p,
|
||||
UINT32 filterLevel,
|
||||
UINT32 filterCategory,
|
||||
tEventlogOutputCb pfnOutput_p);
|
||||
void eventlog_printMessage(tEventlogLevel level_p,
|
||||
tEventlogCategory category_p,
|
||||
const char* fmt_p,
|
||||
...);
|
||||
void eventlog_printNodeEvent(const tOplkApiEventNode* pNodeEvent_p);
|
||||
void eventlog_printStateEvent(const tEventNmtStateChange* pStateChangeEvent_p);
|
||||
void eventlog_printCfmResultEvent(UINT8 nodeId_p,
|
||||
tNmtNodeCommand nodeCommand_p);
|
||||
void eventlog_printCfmProgressEvent(const tCfmEventCnProgress* pProgress_p);
|
||||
void eventlog_printPdoEvent(const tOplkApiEventPdoChange* pPdoChange_p);
|
||||
void eventlog_printHistoryEvent(const tErrHistoryEntry* pHistory_p);
|
||||
void eventlog_printErrorEvent(const tEventError* pError_p);
|
||||
void eventlog_printPdoMap(UINT16 mapObject_p,
|
||||
UINT8 subIndex_p,
|
||||
UINT64 mapping_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_eventlog_H_ */
|
||||
+782
@@ -0,0 +1,782 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file eventlogstring.c
|
||||
|
||||
\brief openPOWERLIK application event logger - string functions
|
||||
|
||||
This module implements the string functions for the event logger. It creates
|
||||
the output strings for the miscellaneous events which can be printed by the
|
||||
event logger. The strings can be created according to the specified output
|
||||
format. Two output formats are available. kEventlogFormatParsable specifies
|
||||
a format that's intended to be parsed by evaluation and test tools.
|
||||
kEventlogFormatReadable is intended to be read by humans.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2017, Kalycito Infotech Private Limited
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include "eventlogstring.h"
|
||||
#include <oplk/debugstr.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* String values for log levels
|
||||
*
|
||||
* The variable contains an array with all log level strings.
|
||||
*/
|
||||
static const char* const sEventlogLevel_l[] =
|
||||
{
|
||||
"FATAL ",
|
||||
"ERROR ",
|
||||
"WARNING ",
|
||||
"INFO ",
|
||||
"DEBUG ",
|
||||
"EVENT ",
|
||||
};
|
||||
|
||||
/**
|
||||
* String values for log categories
|
||||
*
|
||||
* The variable contains an array with all log category strings.
|
||||
*/
|
||||
static const char* const sEventlogCategory_l[] =
|
||||
{
|
||||
// Generic
|
||||
"GENERIC ",
|
||||
"CONTROL ",
|
||||
"APP ",
|
||||
"PDOMAP ",
|
||||
"OBDICT ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
//Events
|
||||
"NODE ",
|
||||
"CFM_RESULT ",
|
||||
"CFM_PROGRESS ",
|
||||
"STATE_CHANGE ",
|
||||
"PDO_CHANGE ",
|
||||
"HISTORY ",
|
||||
"ERROR ",
|
||||
"SDO ",
|
||||
"USER ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
};
|
||||
|
||||
/**
|
||||
* String values for node events
|
||||
*
|
||||
* The variable contains an array with all node event strings.
|
||||
*/
|
||||
static const char* const sLogEventNodeEvent_l[] =
|
||||
{
|
||||
"NmtNodeEventFound",
|
||||
"NmtNodeEventUpdateSw",
|
||||
"NmtNodeEventCheckConf",
|
||||
"NmtNodeEventUpdateConf",
|
||||
"NmtNodeEventVerifyConf",
|
||||
"NmtNodeEventReadyToStart",
|
||||
"NmtNodeEventNmtState",
|
||||
"NmtNodeEventError",
|
||||
"NmtNodeEventAmniReceived",
|
||||
"NmtNodeEventConfDone"
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
static size_t createTimeString(char* string_p,
|
||||
size_t strlen_p);
|
||||
static size_t createLogLevelString(char* string_p,
|
||||
size_t strlen_p,
|
||||
tEventlogLevel logLevel_p);
|
||||
static size_t createLogCategoryString(char* string_p,
|
||||
size_t strlen_p,
|
||||
tEventlogCategory logCategory_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a generic log message
|
||||
|
||||
The function can be used to print a generic log message. You can specify a
|
||||
printf style format string for printing.
|
||||
|
||||
\param[out] message_p Pointer to the message which should be printed.
|
||||
\param[in] messageSize_p Size of the message string to be printed.
|
||||
\param[in] level_p The log level to be used for the output.
|
||||
\param[in] category_p The log category to be used for the output.
|
||||
\param[in] fmt_p The printf style format string which specifies the
|
||||
message.
|
||||
\param[in] arg_p Required arguments according to the format string.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createMessageString(char* message_p,
|
||||
size_t messageSize_p,
|
||||
tEventlogLevel level_p,
|
||||
tEventlogCategory category_p,
|
||||
const char* fmt_p,
|
||||
va_list arg_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, level_p);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, category_p);
|
||||
|
||||
len += vsnprintf(message_p + len, messageSize_p - len, fmt_p, arg_p);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a node event string
|
||||
|
||||
The function is used to log openPOWERLINK node events.
|
||||
|
||||
\param[in] pNodeEvent_p The node event information to be logged.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createNodeEventString(const tOplkApiEventNode* pNodeEvent_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryNodeEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"%03d ",
|
||||
pNodeEvent_p->nodeId);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"EVENT:0x%02X ",
|
||||
pNodeEvent_p->nodeEvent);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"STATE:0x%02X ",
|
||||
pNodeEvent_p->nmtState);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"ERROR:0x%04X MANDATORY:%d",
|
||||
pNodeEvent_p->errorCode,
|
||||
pNodeEvent_p->fMandatory);
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len = snprintf(message_p + len,
|
||||
messageSize_p,
|
||||
"Node=%3u, %s State:%s",
|
||||
pNodeEvent_p->nodeId,
|
||||
sLogEventNodeEvent_l[pNodeEvent_p->nodeEvent],
|
||||
debugstr_getNmtStateStr(pNodeEvent_p->nmtState));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print a state change event
|
||||
|
||||
The function is used to log openPOWERLINK state change events.
|
||||
|
||||
\param[in] pStateChangeEvent_p The state change event information to be logged.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createStateEventString(const tEventNmtStateChange* pStateChangeEvent_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryStateChangeEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"OLDSTATE:0x%03X NEWSTATE:0x%03X EVENT:0x%02X",
|
||||
pStateChangeEvent_p->oldNmtState,
|
||||
pStateChangeEvent_p->newNmtState,
|
||||
pStateChangeEvent_p->nmtEvent);
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"%s->%s Originating event:%s",
|
||||
debugstr_getNmtStateStr(pStateChangeEvent_p->oldNmtState),
|
||||
debugstr_getNmtStateStr(pStateChangeEvent_p->newNmtState),
|
||||
debugstr_getNmtEventStr(pStateChangeEvent_p->nmtEvent));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a CFM result event string
|
||||
|
||||
The function is used to log openPOWERLINK CFM result events.
|
||||
|
||||
\param[in] nodeId_p The node ID of the node specified in the received
|
||||
event.
|
||||
\param[in] nodeCommand_p The nodeCommand of the received CFM result event.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createCfmResultEventString(UINT8 nodeId_p,
|
||||
tNmtNodeCommand nodeCommand_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryCfmResultEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len, messageSize_p - len, "%03d ", nodeId_p);
|
||||
len += snprintf(message_p + len, messageSize_p - len, "0x%02X ", nodeCommand_p);
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"Node=%3d, %s", nodeId_p,
|
||||
debugstr_getNmtNodeCommandTypeStr(nodeCommand_p));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a CFM progress event
|
||||
|
||||
The function is used to log openPOWERLINK CFM progress events.
|
||||
|
||||
\param[in] pProgress_p The information about the CFM progress event.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createCfmProgressEventString(const tCfmEventCnProgress* pProgress_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryCfmProgressEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"%03d ",
|
||||
pProgress_p->nodeId);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"OBJECT:0x%04X/%03d ",
|
||||
pProgress_p->objectIndex,
|
||||
pProgress_p->objectSubIndex);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"SIZE:%05lu DOWNLOADED:%04lu ",
|
||||
(ULONG)pProgress_p->totalNumberOfBytes,
|
||||
(ULONG)pProgress_p->bytesDownloaded);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"ABORTCODE:0x%08X ERROR:0x%04X ",
|
||||
pProgress_p->sdoAbortCode,
|
||||
pProgress_p->error);
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"Node=%3u, Object 0x%X/%03u, ",
|
||||
pProgress_p->nodeId,
|
||||
pProgress_p->objectIndex,
|
||||
pProgress_p->objectSubIndex);
|
||||
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"%4lu/%4lu Bytes",
|
||||
(ULONG)pProgress_p->bytesDownloaded,
|
||||
(ULONG)pProgress_p->totalNumberOfBytes);
|
||||
|
||||
if ((pProgress_p->sdoAbortCode != 0) ||
|
||||
(pProgress_p->error != kErrorOk))
|
||||
{
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
" -> SDO Abort=%s(0x%08X), Error=0x%04X",
|
||||
debugstr_getAbortCodeStr(pProgress_p->sdoAbortCode),
|
||||
pProgress_p->sdoAbortCode,
|
||||
pProgress_p->error);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a PDO change event string
|
||||
|
||||
The function creates a PDO change event string.
|
||||
|
||||
\param[in] pPdoChange_p The information about the PDO change event.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createPdoEventString(const tOplkApiEventPdoChange* pPdoChange_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryPdoEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
(pPdoChange_p->fTx ? "TPDO " : "RPDO "));
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"MAPOBJ:0x%04x NODE:%03d NUM:%d ",
|
||||
pPdoChange_p->mappParamIndex,
|
||||
pPdoChange_p->nodeId,
|
||||
pPdoChange_p->mappObjectCount);
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
(pPdoChange_p->fActivated ? "ACTIVATE" : "DELETE"));
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"%sPDO = 0x%X to node %d with %d objects %s",
|
||||
(pPdoChange_p->fTx ? "T" : "R"),
|
||||
pPdoChange_p->mappParamIndex,
|
||||
pPdoChange_p->nodeId,
|
||||
pPdoChange_p->mappObjectCount,
|
||||
(pPdoChange_p->fActivated ? "activated" : "deleted"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a PDO mapping information string
|
||||
|
||||
The function creates a PDO mapping information string.
|
||||
|
||||
\param[in] mapObject_p The object index of the mapping object.
|
||||
\param[in] subIndex_p The sub-index of the mapping object.
|
||||
\param[in] mapping_p The 64 bit mapping information.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createPdoMapString(UINT16 mapObject_p,
|
||||
UINT8 subIndex_p,
|
||||
UINT64 mapping_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelInfo);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryPdoMap);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"MAPOBJ:0x%04x/%d OBJECT:0x%04x/%d OFFSET:%d LEN:%d",
|
||||
mapObject_p,
|
||||
subIndex_p,
|
||||
(UINT32)(mapping_p & 0x000000000000FFFFULL),
|
||||
(UINT32)((mapping_p & 0x0000000000FF0000ULL) >> 16),
|
||||
(UINT16)((mapping_p & 0x0000FFFF00000000ULL) >> 32),
|
||||
(UINT16)((mapping_p & 0xFFFF000000000000ULL) >> 48));
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
" 0x%04x/%d Mapped object 0x%X/%3d", mapObject_p, subIndex_p,
|
||||
(UINT32)(mapping_p & 0x000000000000FFFFULL),
|
||||
(UINT32)((mapping_p & 0x0000000000FF0000ULL) >> 16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a history event string
|
||||
|
||||
The function creates a history event string.
|
||||
|
||||
\param[in] pHistory_p The information about the history event.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createHistoryEventString(const tErrHistoryEntry* pHistory_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryHistoryEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"TYPE:0x%04X CODE:0x%04X INFO:0x%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
pHistory_p->entryType,
|
||||
pHistory_p->errorCode,
|
||||
(UINT16)pHistory_p->aAddInfo[0],
|
||||
(UINT16)pHistory_p->aAddInfo[1],
|
||||
(UINT16)pHistory_p->aAddInfo[2],
|
||||
(UINT16)pHistory_p->aAddInfo[3],
|
||||
(UINT16)pHistory_p->aAddInfo[4],
|
||||
(UINT16)pHistory_p->aAddInfo[5],
|
||||
(UINT16)pHistory_p->aAddInfo[6],
|
||||
(UINT16)pHistory_p->aAddInfo[7]);
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"HistoryEntry: Type=0x%04X Code=0x%04X (0x%02X %02X %02X %02X %02X %02X %02X %02X)",
|
||||
pHistory_p->entryType,
|
||||
pHistory_p->errorCode,
|
||||
(UINT16)pHistory_p->aAddInfo[0],
|
||||
(UINT16)pHistory_p->aAddInfo[1],
|
||||
(UINT16)pHistory_p->aAddInfo[2],
|
||||
(UINT16)pHistory_p->aAddInfo[3],
|
||||
(UINT16)pHistory_p->aAddInfo[4],
|
||||
(UINT16)pHistory_p->aAddInfo[5],
|
||||
(UINT16)pHistory_p->aAddInfo[6],
|
||||
(UINT16)pHistory_p->aAddInfo[7]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create an error event string
|
||||
|
||||
The function creates a string for openPOWERLINK error/warning events.
|
||||
|
||||
\param[in] pError_p The information about the error event.
|
||||
\param[in] format_p The format of the created string (kEventlogFormatParsable
|
||||
or kEventlogFormatReadable).
|
||||
\param[out] message_p Buffer to store the created message string.
|
||||
\param[in] messageSize_p Size of the message buffer.
|
||||
|
||||
\ingroup module_app_eventlogstring
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void eventlog_createErrorEventString(const tEventError* pError_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p)
|
||||
{
|
||||
size_t len;
|
||||
UINT i;
|
||||
|
||||
len = createTimeString(message_p, messageSize_p);
|
||||
len += createLogLevelString(message_p + len, messageSize_p - len, kEventlogLevelEvent);
|
||||
len += createLogCategoryString(message_p + len, messageSize_p - len, kEventlogCategoryHistoryEvent);
|
||||
|
||||
switch (format_p)
|
||||
{
|
||||
case kEventlogFormatParsable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"SOURCE:0x%02X ERROR:0x%03X ARG",
|
||||
pError_p->eventSource,
|
||||
pError_p->oplkError);
|
||||
|
||||
for (i = 0; i < sizeof(pError_p->errorArg); ++i)
|
||||
{
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
":0x%02X",
|
||||
*((UINT8*)&pError_p->errorArg + i));
|
||||
}
|
||||
break;
|
||||
|
||||
case kEventlogFormatReadable:
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"Source = %s (0x%02X) OplkError = %s (0x%03X) ",
|
||||
debugstr_getEventSourceStr(pError_p->eventSource),
|
||||
pError_p->eventSource,
|
||||
debugstr_getRetValStr(pError_p->oplkError),
|
||||
pError_p->oplkError);
|
||||
|
||||
// check additional argument
|
||||
switch (pError_p->eventSource)
|
||||
{
|
||||
case kEventSourceEventk:
|
||||
case kEventSourceEventu:
|
||||
// error occurred within event processing
|
||||
// either in kernel or in user part
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"OrgSource = %s 0x%02X",
|
||||
debugstr_getEventSourceStr(pError_p->errorArg.eventSource),
|
||||
pError_p->errorArg.eventSource);
|
||||
break;
|
||||
|
||||
case kEventSourceDllk:
|
||||
// error occurred within the data link layer (e.g. interrupt processing)
|
||||
// the DWORD argument contains the DLL state and the NMT event
|
||||
len += snprintf(message_p + len,
|
||||
messageSize_p - len,
|
||||
"Val = 0x%X",
|
||||
pError_p->errorArg.uintArg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create timestamp string
|
||||
|
||||
The function creates the timestamp string.
|
||||
|
||||
\param[out] string_p String buffer to print to.
|
||||
\param[in] strlen_p Length of string buffer.
|
||||
|
||||
\return The function returns the number of characters printed to the log string.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static size_t createTimeString(char* string_p,
|
||||
size_t strlen_p)
|
||||
{
|
||||
time_t timeStamp;
|
||||
struct tm* p_timeVal;
|
||||
size_t len;
|
||||
|
||||
time(&timeStamp);
|
||||
p_timeVal = localtime(&timeStamp);
|
||||
len = strftime(string_p, strlen_p, "%Y/%m/%d-%H:%M:%S ", p_timeVal);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create log level string
|
||||
|
||||
The function creates the log level string.
|
||||
|
||||
\param[out] string_p String buffer to print to.
|
||||
\param[in] strlen_p Length of string buffer.
|
||||
\param[in] logLevel_p The log level to print.
|
||||
|
||||
\return The function returns the number of characters printed to the log string.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static size_t createLogLevelString(char* string_p,
|
||||
size_t strlen_p,
|
||||
tEventlogLevel logLevel_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = snprintf(string_p,
|
||||
strlen_p,
|
||||
"%s ",
|
||||
sEventlogLevel_l[logLevel_p]);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create log category string
|
||||
|
||||
The function creates the log category string.
|
||||
|
||||
\param[out] string_p String buffer to print to.
|
||||
\param[in] strlen_p Length of string buffer.
|
||||
\param[in] logCategory_p The log category to print.
|
||||
|
||||
\return The function returns the number of characters printed to the log string.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static size_t createLogCategoryString(char* string_p,
|
||||
size_t strlen_p,
|
||||
tEventlogCategory logCategory_p)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = snprintf(string_p,
|
||||
strlen_p,
|
||||
"%s ",
|
||||
sEventlogCategory_l[logCategory_p]);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file eventlogstring.h
|
||||
|
||||
\brief Definitions for eventlog string functions
|
||||
|
||||
This file contains the definitions for the string functions of the eventlog
|
||||
module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_eventlogstring_H_
|
||||
#define _INC_eventlogstring_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
#include <oplk/nmt.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// unfortunately older windows compilers don't support snprintf and vsnprintf
|
||||
#if (TARGET_SYSTEM == _WIN32_)
|
||||
#if (_MSC_VER < 1900)
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Enumeration for eventlog levels
|
||||
*
|
||||
* This enumeration specifies the valid eventlog levels. The eventlog levels
|
||||
* are used to filter the eventlog output.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kEventlogLevelFatal = 0, ///< Fatal errors
|
||||
kEventlogLevelError, ///< Errors
|
||||
kEventlogLevelWarning, ///< Warnings
|
||||
kEventlogLevelInfo, ///< Information
|
||||
kEventlogLevelDebug, ///< Debug information
|
||||
kEventlogLevelEvent, ///< Events
|
||||
} eEventlogLevel;
|
||||
|
||||
typedef UINT32 tEventlogLevel;
|
||||
|
||||
/**
|
||||
* Enumeration for eventlog categories
|
||||
*
|
||||
* The eventlog is separated in different output categories. This enumeration
|
||||
* lists the valid categories. The categories are used to filter the eventlog
|
||||
* output.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kEventlogCategoryGeneric = 0, ///< Generic information
|
||||
kEventlogCategoryControl, ///< Control information
|
||||
kEventlogCategoryApplication, ///< Information of the Application
|
||||
kEventlogCategoryPdoMap, ///< PDO mapping information
|
||||
kEventlogCategoryObjectDictionary, ///< Object dictionary information
|
||||
|
||||
kEventlogCategoryNodeEvent = 15, ///< Node events
|
||||
kEventlogCategoryCfmResultEvent, ///< CfmResult events
|
||||
kEventlogCategoryCfmProgressEvent, ///< CfmProgress events
|
||||
kEventlogCategoryStateChangeEvent, ///< StateChange events
|
||||
kEventlogCategoryPdoEvent, ///< Pdo events
|
||||
kEventlogCategoryHistoryEvent, ///< History events
|
||||
kEventlogCategoryErrorEvent, ///< Error events
|
||||
kEventlogCategorySdoEvent, ///< Sdo events
|
||||
kEventlogCategoryUserEvent, ///< User event
|
||||
} eEventlogCategory;
|
||||
|
||||
typedef UINT32 tEventlogCategory;
|
||||
|
||||
/**
|
||||
* Enumeration for CFM events
|
||||
*
|
||||
* This enumeration lists the valid CFM events.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kLogEventCfmProgress = 0, ///< CFM progress event
|
||||
kLogEventCfmResult ///< CFM result event
|
||||
} eEventlogEventCfmType;
|
||||
|
||||
typedef UINT32 tEventlogEventCfmType;
|
||||
|
||||
/**
|
||||
* Enumeration for eventlog output format
|
||||
*
|
||||
* This enumeration lists the valid eventlog output formats.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kEventlogFormatParsable, ///< Parsable format. Intended for further processing.
|
||||
kEventlogFormatReadable ///< Readable format. Optimized for easy reading by humans.
|
||||
} eEventlogFormat;
|
||||
|
||||
typedef UINT32 tEventlogFormat;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void eventlog_createMessageString(char* message_p,
|
||||
size_t messageSize_p,
|
||||
tEventlogLevel level_p,
|
||||
tEventlogCategory category_p,
|
||||
const char* fmt_p,
|
||||
va_list arg_p);
|
||||
void eventlog_createNodeEventString(const tOplkApiEventNode* pNodeEvent_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createStateEventString(const tEventNmtStateChange* pStateChangeEvent_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createCfmResultEventString(UINT8 nodeId_p,
|
||||
tNmtNodeCommand nodeCommand_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createCfmProgressEventString(const tCfmEventCnProgress* pProgress_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createPdoEventString(const tOplkApiEventPdoChange* pPdoChange_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createHistoryEventString(const tErrHistoryEntry* pHistory_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createErrorEventString(const tEventError* pError_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
void eventlog_createPdoMapString(UINT16 mapObject_p,
|
||||
UINT8 subIndex_p,
|
||||
UINT64 mapping_p,
|
||||
tEventlogFormat format_p,
|
||||
char* message_p,
|
||||
size_t messageSize_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_eventlogstring_H_ */
|
||||
+1558
File diff suppressed because it is too large
Load Diff
+106
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwarecheck.h
|
||||
|
||||
\brief Header file of the firmware check module
|
||||
|
||||
This header file contains the definitions of the firware check module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwarecheck_H_
|
||||
#define _INC_firmwarecheck_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
#include <firmwaremanager/firmwareinfo.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FIRMWARECHECK_INVALID_NODEID C_ADR_INVALID
|
||||
#define FIRMWARECHECK_MAX_NODEID C_ADR_BROADCAST
|
||||
#define FIRMWARECHECK_INVALID_SDO ((UINT)-1)
|
||||
|
||||
#ifndef tabentries
|
||||
#define tabentries(aVar_p) (sizeof(aVar_p) / sizeof(*(aVar_p)))
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief No firmware update required
|
||||
|
||||
This function is called if a firmware update is not required for a certain node.
|
||||
|
||||
\param nodeId_p [in] ID of the already up-to-date node
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
typedef tFirmwareRet (*tNoFirmwareCheckNodeCb)(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
|
||||
/**
|
||||
\brief Firmware check configuration
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tFirmwareInfoHandle pFwInfo; ///< Handle of the firmware store instance
|
||||
///< for accessing the firmware configuration
|
||||
tNoFirmwareCheckNodeCb pfnNoUpdateRequired; ///< No update required callback
|
||||
} tFirmwareCheckConfig;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwarecheck_init(const tFirmwareCheckConfig* pConfig_p);
|
||||
void firmwarecheck_exit(void);
|
||||
tFirmwareRet firmwarecheck_processNodeEvent(UINT nodeId_p);
|
||||
tFirmwareRet firmwarecheck_processSdoEvent(const tSdoComFinished* pSdoComFinished_p);
|
||||
tFirmwareRet firmwarecheck_checkModulesOfNextNode(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwareinfo_H_ */
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareinfo.c
|
||||
|
||||
\brief Source file of the firmware info module
|
||||
|
||||
This module implements an access to firmware information generated by the
|
||||
openCONFIGURATOR.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwareinfo.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Firmware info instance
|
||||
*/
|
||||
typedef struct tFirmwareInfoInstance
|
||||
{
|
||||
tFirmwareInfoConfig config; ///< Firmware info configuration
|
||||
tFirmwareInfoList pInfoList; ///< Firmware info list
|
||||
} tFirmwareInfoInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareRet initInfoList(tFirmwareInfoInstance* pHandle_p);
|
||||
static tFirmwareInfo* findModuleInInfoList(tFirmwareInfoInstance* pHandle_p,
|
||||
const tFirmwareModuleInfo * pModuleInfo_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a firmware info instance
|
||||
|
||||
This function creates an instance of the firmware info module.
|
||||
|
||||
\param pConfig_p [in] Pointer to the configuration structure for instance
|
||||
creation.
|
||||
\param ppHandle_p [out] Pointer to a firmware info handle which is filled if
|
||||
creation was successful.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareinfo_create(const tFirmwareInfoConfig* pConfig_p,
|
||||
tFirmwareInfoHandle* ppHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareInfoInstance* instance = NULL;
|
||||
|
||||
if ((pConfig_p == NULL) || (ppHandle_p == NULL))
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
instance = (tFirmwareInfoInstance*)malloc(sizeof(tFirmwareInfoInstance));
|
||||
if (instance == NULL)
|
||||
{
|
||||
ret = kFwReturnNoResource;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(instance, 0, sizeof(tFirmwareInfoInstance));
|
||||
memcpy(&instance->config, pConfig_p, sizeof(tFirmwareInfoConfig));
|
||||
|
||||
ret = initInfoList(instance);
|
||||
|
||||
EXIT:
|
||||
if (ret == kFwReturnOk)
|
||||
{
|
||||
*ppHandle_p = instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(instance);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Destroy a firmware info instance
|
||||
|
||||
This function destroys an instance of the firmware info module.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware info instance which shall be
|
||||
destroyed.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareinfo_destroy(tFirmwareInfoHandle pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p != NULL)
|
||||
{
|
||||
firmwareinfodecode_freeInfo(pHandle_p->pInfoList);
|
||||
free(pHandle_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Get the firmware info a specific module
|
||||
|
||||
This function gets the available firmware information for a specified module.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware info instance
|
||||
\param pModuleInfo_p [in] Pointer to the module info specifying the requested
|
||||
module.
|
||||
\param ppFwInfo_p [out] Pointer to a firmware info pointer which is filled
|
||||
if an associated firmware info is available for
|
||||
the specified module.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareinfo_getInfoForNode(tFirmwareInfoHandle pHandle_p,
|
||||
const tFirmwareModuleInfo * pModuleInfo_p,
|
||||
tFirmwareInfo** ppFwInfo_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareInfo* pInfo = NULL;
|
||||
|
||||
if (pHandle_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if ((pModuleInfo_p == NULL) || (ppFwInfo_p == NULL))
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pInfo = findModuleInInfoList(pHandle_p, pModuleInfo_p);
|
||||
|
||||
if (pInfo != NULL)
|
||||
{
|
||||
*ppFwInfo_p = pInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kFwReturnModuleNotFound;
|
||||
}
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize firmware info list
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware info instance
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet initInfoList(tFirmwareInfoInstance* pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
ret = firmwareinfodecode_decodeInfo(pHandle_p->config.pFwStore,
|
||||
&pHandle_p->pInfoList);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Find module in firmware info list
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware info instance
|
||||
\param pModuleInfo_p [in] Pointer to module info
|
||||
|
||||
\return This functions returns a pointer to the firmware info list.
|
||||
\retval NULL No firmware info is found
|
||||
\retval !NULL Pointer to the found firmware info
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareInfo* findModuleInInfoList(tFirmwareInfoInstance* pHandle_p,
|
||||
const tFirmwareModuleInfo * pModuleInfo_p)
|
||||
{
|
||||
tFirmwareInfo* pInfo = NULL;
|
||||
tFirmwareInfoEntry* pIter = pHandle_p->pInfoList;
|
||||
|
||||
while (pIter != NULL)
|
||||
{
|
||||
if (memcmp(pModuleInfo_p, &pIter->fwInfo.moduleInfo,
|
||||
sizeof(tFirmwareModuleInfo)) == 0)
|
||||
{
|
||||
pInfo = &pIter->fwInfo;
|
||||
break;
|
||||
}
|
||||
|
||||
pIter = pIter->pNext;
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareinfo.h
|
||||
|
||||
\brief Header file of the firmware info module
|
||||
|
||||
This header file contains the definitions of the firware info module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwareinfo_H_
|
||||
#define _INC_firmwareinfo_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
#include <firmwaremanager/firmwareinfodecode.h>
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \brief Handle to a firmware info instance
|
||||
*/
|
||||
typedef struct tFirmwareInfoInstance* tFirmwareInfoHandle;
|
||||
|
||||
/**
|
||||
* \brief Configuration structure for a firmware info instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tFirmwareStoreHandle pFwStore; ///< Handle of the firmware store instance
|
||||
///< for accessing the firmware configuration
|
||||
} tFirmwareInfoConfig;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwareinfo_create(const tFirmwareInfoConfig* pConfig_p,
|
||||
tFirmwareInfoHandle* ppHandle_p);
|
||||
tFirmwareRet firmwareinfo_destroy(tFirmwareInfoHandle pHandle_p);
|
||||
tFirmwareRet firmwareinfo_getInfoForNode(tFirmwareInfoHandle pHandle_p,
|
||||
const tFirmwareModuleInfo * pModuleInfo_p,
|
||||
tFirmwareInfo** ppFwInfo_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwareinfo_H_ */
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareinfodecode-ascii.c
|
||||
|
||||
\brief Source file of the firmware info decode module for ASCII format
|
||||
|
||||
This module implements the decoding of the firmware informations stored as
|
||||
ASCII information.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwareinfodecode.h>
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FIRMWAREINFO_ASCII_LINE_SEPERATOR "\n"
|
||||
#define FIRMWAREINFO_LINE_FORMAT "%x\t%x\t%x\t%x\t%x\t%x\t%x\t%255s"
|
||||
#define FIRMWAREINFO_FW_IMAGE_PATH_LENGTH 256u
|
||||
#define FIRMWAREINFO_NUMBER_OF_VALUES_PER_LINE 8
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareRet parseLine(tFirmwareStoreHandle pFwStore_p, char* pLine_p,
|
||||
tFirmwareInfo* pInfo_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Decode the firmware information
|
||||
|
||||
This function decodes the information contained in the passed storage. The
|
||||
resulting information will be stored in a list returned via \ref ppInfoList_p.
|
||||
The memory required for the firmware informations is allocated and must be freed
|
||||
by calling \ref firmwareinfodecode_freeInfo.
|
||||
|
||||
\param pStore_p [in] Handle of the firmware store module accessing the
|
||||
information storage.
|
||||
\param ppInfoList_p [out] Pointer to a list of firmware infos which will be
|
||||
filled with the decoded information.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareinfodecode_decodeInfo(tFirmwareStoreHandle pStore_p,
|
||||
tFirmwareInfoList* ppInfoList_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
size_t dataSize;
|
||||
void* pData;
|
||||
char* pFileString;
|
||||
char* pLine;
|
||||
tFirmwareInfoList pList = NULL;
|
||||
tFirmwareInfoEntry** ppInsertIter = &pList;
|
||||
tFirmwareInfoEntry* pEntry = NULL;
|
||||
|
||||
if (ppInfoList_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
ret = firmwarestore_loadData(pStore_p);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
ret = firmwarestore_getData(pStore_p, &pData, &dataSize);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pFileString = pData;
|
||||
|
||||
pLine = strtok(pFileString, FIRMWAREINFO_ASCII_LINE_SEPERATOR);
|
||||
|
||||
while (pLine != NULL)
|
||||
{
|
||||
pEntry = (tFirmwareInfoEntry*)malloc(sizeof(tFirmwareInfoEntry));
|
||||
if (pEntry == NULL)
|
||||
{
|
||||
ret = kFwReturnNoResource;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(pEntry, 0, sizeof(tFirmwareInfoEntry));
|
||||
|
||||
ret = parseLine(pStore_p, pLine, &pEntry->fwInfo);
|
||||
if (ret == kFwReturnOk)
|
||||
{
|
||||
if (*ppInsertIter != NULL)
|
||||
{
|
||||
(*ppInsertIter)->pNext = pEntry;
|
||||
}
|
||||
*ppInsertIter = pEntry;
|
||||
ppInsertIter = &pEntry->pNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(pEntry);
|
||||
|
||||
if (ret == kFwReturnIgnoreInfoFileLine)
|
||||
{
|
||||
ret = kFwReturnOk;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pLine = strtok(NULL, FIRMWAREINFO_ASCII_LINE_SEPERATOR);
|
||||
}
|
||||
|
||||
*ppInfoList_p = pList;
|
||||
|
||||
EXIT:
|
||||
(void)firmwarestore_flushData(pStore_p);
|
||||
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
while (pList != NULL)
|
||||
{
|
||||
pEntry = pList;
|
||||
pList = pEntry->pNext;
|
||||
free(pEntry);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Free the decoded firmware information
|
||||
|
||||
This function frees the by \ref firmwareinfodecode_decodeInfo previously
|
||||
allocated resources.
|
||||
|
||||
\param pInfoList_p [int] List of firmware informations which shall be freed
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareinfodecode_freeInfo(tFirmwareInfoList pInfoList_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareInfoEntry* rem;
|
||||
tFirmwareInfoList pInfoList = pInfoList_p;
|
||||
|
||||
if (pInfoList_p != NULL)
|
||||
{
|
||||
while (pInfoList != NULL)
|
||||
{
|
||||
rem = pInfoList;
|
||||
pInfoList = rem->pNext;
|
||||
free(rem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Parse line of firmware info file
|
||||
|
||||
This function parses the given line of a firmware info file and returns the
|
||||
firmware information.
|
||||
|
||||
\param pStore_p [in] Handle of the firmware store module accessing the
|
||||
information storage.
|
||||
\param pLine_p [in] Line to be parsed
|
||||
\param pInfo_p [out] Pointer used to return the firmware information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet parseLine(tFirmwareStoreHandle pFwStore_p, char* pLine_p,
|
||||
tFirmwareInfo* pInfo_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareInfo info;
|
||||
int result;
|
||||
tFirmwareStoreConfig storeConfig;
|
||||
char imagePath[FIRMWAREINFO_FW_IMAGE_PATH_LENGTH];
|
||||
char completePath[FIRMWAREINFO_FW_IMAGE_PATH_LENGTH];
|
||||
void* baseInfo;
|
||||
|
||||
memset(imagePath, 0, FIRMWAREINFO_FW_IMAGE_PATH_LENGTH);
|
||||
|
||||
result = sscanf(pLine_p, FIRMWAREINFO_LINE_FORMAT, (unsigned int*)&info.moduleInfo.nodeId,
|
||||
&info.moduleInfo.vendorId, &info.moduleInfo.productId,
|
||||
&info.moduleInfo.hwVariant, &info.appSwDate,
|
||||
&info.appSwTime, (unsigned int*)&info.fFirmwareLocked, imagePath);
|
||||
|
||||
if (result != FIRMWAREINFO_NUMBER_OF_VALUES_PER_LINE)
|
||||
{
|
||||
ret = kFwReturnIgnoreInfoFileLine;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(&storeConfig, 0, sizeof(tFirmwareStoreConfig));
|
||||
|
||||
ret = firmwarestore_getBase(pFwStore_p, &baseInfo);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
sprintf(completePath, "%s%c%s", (char*)baseInfo, FIRMWARESTORE_PATH_DIR_SEP, imagePath);
|
||||
|
||||
storeConfig.pFilename = completePath;
|
||||
|
||||
ret = firmwarestore_create(&storeConfig, &info.pFwImage);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memcpy(pInfo_p, &info, sizeof(tFirmwareInfo));
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareinfodecode.h
|
||||
|
||||
\brief Header file of the firmware info decode module
|
||||
|
||||
This header file contains the definitions of the firware info decoe module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwareinfodecode_H_
|
||||
#define _INC_firmwareinfodecode_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Information structure representing a module
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT8 nodeId; ///< ID of the node
|
||||
UINT32 vendorId; ///< Vendor ID of the module
|
||||
UINT32 productId; ///< Product ID of the module
|
||||
UINT32 hwVariant; ///< Hardware variant of the module
|
||||
} tFirmwareModuleInfo;
|
||||
|
||||
/**
|
||||
\brief Structure containing information about the configured firmware
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tFirmwareModuleInfo moduleInfo; ///< Info of the associated module
|
||||
UINT32 appSwDate; ///< Software date of the configured firmware
|
||||
UINT32 appSwTime; ///< Software time of the configured firmware
|
||||
BOOL fFirmwareLocked; ///< Flag for representation if the firmware
|
||||
///< should be locked, this functionality is
|
||||
///< currently not supported.
|
||||
tFirmwareStoreHandle pFwImage; ///< Handle of the firmware store instance for
|
||||
///< accessing the firmware
|
||||
} tFirmwareInfo;
|
||||
|
||||
/**
|
||||
\brief List entry for a firmware info
|
||||
*/
|
||||
typedef struct tFirmwareInfoEntry
|
||||
{
|
||||
tFirmwareInfo fwInfo; ///< Firmware info structure
|
||||
struct tFirmwareInfoEntry* pNext; ///< Pointer to the next entry within list
|
||||
} tFirmwareInfoEntry;
|
||||
|
||||
/**
|
||||
\brief List of firmware info entries
|
||||
*/
|
||||
typedef tFirmwareInfoEntry* tFirmwareInfoList;
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwareinfodecode_decodeInfo(tFirmwareStoreHandle pStore_p,
|
||||
tFirmwareInfoList* ppInfoList_p);
|
||||
tFirmwareRet firmwareinfodecode_freeInfo(tFirmwareInfoList pInfoList_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwareinfodecode_H_ */
|
||||
+541
@@ -0,0 +1,541 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwaremanager.c
|
||||
|
||||
\brief Source file of the firmware manager
|
||||
|
||||
This module implements the firmware manager.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
#include <firmwaremanager/firmwaretrace.h>
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
#include <firmwaremanager/firmwareinfo.h>
|
||||
#include <firmwaremanager/firmwarecheck.h>
|
||||
#include <firmwaremanager/firmwareupdate.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
#include <oplk/debugstr.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef tabentries
|
||||
#define tabentries(aVar_p) (sizeof(aVar_p) / sizeof(*(aVar_p)))
|
||||
#endif
|
||||
|
||||
#define FIRMWARE_MANAGER_MAX_NODE_ID C_ADR_BROADCAST
|
||||
|
||||
#define FIRMWARE_MANAGER_PRINT_LINE_LENGTH 80
|
||||
#define FIRMWARE_MANAGER_PRINT_NODE_LENGTH 6
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Process SDO finished event
|
||||
|
||||
This function is called to process an SDO finish event triggered by openPOWERLINK.
|
||||
|
||||
\param pSdoComFinished_p [in] Pointer to SDO finished
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
typedef tFirmwareRet (*tFirmwareProcessSdoEvent)(const tSdoComFinished* pSdoComFinished_p);
|
||||
|
||||
/**
|
||||
\brief Firmware manager instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
BOOL fInitialized; ///< Instance initialized flag
|
||||
tFirmwareStoreHandle firmwareStore; ///< Firmware store handle
|
||||
tFirmwareInfoHandle firmwareInfo; ///< Firmware info handle
|
||||
BOOL fCheckModules; ///< Check modular devices (triggered by periodic thread)
|
||||
} tFirmwareManagerInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareManagerInstance instance_l;
|
||||
|
||||
static tFirmwareProcessSdoEvent apfnProcessSdoEvent_l[] =
|
||||
{
|
||||
firmwarecheck_processSdoEvent,
|
||||
firmwareupdate_processSdoEvent
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareRet firmwareUpdateNotRequired(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
static tFirmwareRet nodeUpdateCompleteCb(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
static tFirmwareRet moduleUpdateCompleteCb(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
static tFirmwareRet errorDuringUpdate(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
|
||||
static void cleanupSdo(tSdoComConHdl* pSdoConnection_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize the firmware manager
|
||||
|
||||
This function initializes the firmware manager.
|
||||
|
||||
\param fwInfoFileName_p [in] Firmware info file created by openCONFIGURATOR
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwaremanager_init(const char* fwInfoFileName_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareStoreConfig storeConfig;
|
||||
tFirmwareInfoConfig infoConfig;
|
||||
tFirmwareCheckConfig checkConfig;
|
||||
tFirmwareUpdateConfig updateConfig;
|
||||
|
||||
if (instance_l.fInitialized)
|
||||
{
|
||||
ret = kFwReturnAlreadyInitialized;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(&instance_l, 0, sizeof(tFirmwareManagerInstance));
|
||||
|
||||
memset(&storeConfig, 0, sizeof(tFirmwareStoreConfig));
|
||||
|
||||
storeConfig.pFilename = fwInfoFileName_p;
|
||||
|
||||
ret = firmwarestore_create(&storeConfig, &instance_l.firmwareStore);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(&infoConfig, 0, sizeof(infoConfig));
|
||||
|
||||
infoConfig.pFwStore = instance_l.firmwareStore;
|
||||
|
||||
firmwareinfo_create(&infoConfig, &instance_l.firmwareInfo);
|
||||
|
||||
memset(&checkConfig, 0, sizeof(tFirmwareCheckConfig));
|
||||
|
||||
checkConfig.pFwInfo = instance_l.firmwareInfo;
|
||||
checkConfig.pfnNoUpdateRequired = firmwareUpdateNotRequired;
|
||||
|
||||
ret = firmwarecheck_init(&checkConfig);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(&updateConfig, 0, sizeof(tFirmwareUpdateConfig));
|
||||
|
||||
updateConfig.pfnNodeUpdateComplete = nodeUpdateCompleteCb;
|
||||
updateConfig.pfnModuleUpdateComplete = moduleUpdateCompleteCb;
|
||||
updateConfig.pfnError = errorDuringUpdate;
|
||||
|
||||
ret = firmwareupdate_init(&updateConfig);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
instance_l.fInitialized = TRUE;
|
||||
|
||||
EXIT:
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
firmwareupdate_exit();
|
||||
firmwarecheck_exit();
|
||||
firmwareinfo_destroy(instance_l.firmwareInfo);
|
||||
firmwarestore_destroy(instance_l.firmwareStore);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Deinitialize the firmware manager
|
||||
|
||||
This function deinitializes the firmware manager.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void firmwaremanager_exit(void)
|
||||
{
|
||||
firmwareupdate_exit();
|
||||
firmwarecheck_exit();
|
||||
firmwareinfo_destroy(instance_l.firmwareInfo);
|
||||
firmwarestore_destroy(instance_l.firmwareStore);
|
||||
|
||||
instance_l.fInitialized = FALSE;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Firmware manager thread
|
||||
|
||||
This function implements the firmware manager thread. It shall be called regularly
|
||||
(e.g. every 5 seconds) to trigger checking the firmware of modular devices.
|
||||
The function also polls the firmware update transmission status to trace the
|
||||
firmware manager activity.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tOplkError firmwaremanager_thread(void)
|
||||
{
|
||||
tOplkError ret = kErrorOk;
|
||||
UINT nodeId;
|
||||
tFirmwareRet fwReturn;
|
||||
tFirmwareUpdateTransmissionStatus status;
|
||||
char line[FIRMWARE_MANAGER_PRINT_LINE_LENGTH];
|
||||
char node[FIRMWARE_MANAGER_PRINT_NODE_LENGTH];
|
||||
BOOL fFinalPrint = FALSE;
|
||||
|
||||
ret = oplk_postUserEvent((void*)&instance_l);
|
||||
|
||||
memset(line, 0, FIRMWARE_MANAGER_PRINT_LINE_LENGTH);
|
||||
strcpy(line, "Updating node");
|
||||
|
||||
for (nodeId = 0u; nodeId < FIRMWARE_MANAGER_MAX_NODE_ID; nodeId++)
|
||||
{
|
||||
fwReturn = firmwareupdate_getTransmissionStatus(nodeId, &status);
|
||||
if ((fwReturn == kFwReturnOk) && status.fTransmissionActive)
|
||||
{
|
||||
fFinalPrint = TRUE;
|
||||
sprintf(node, " 0x%02X", (UINT8)(nodeId & 0xFF));
|
||||
strcat(line, node);
|
||||
|
||||
if (strlen(line) > FIRMWARE_MANAGER_PRINT_LINE_LENGTH - FIRMWARE_MANAGER_PRINT_NODE_LENGTH)
|
||||
{
|
||||
FWM_TRACE("%s\n", line);
|
||||
memset(line, 0, FIRMWARE_MANAGER_PRINT_LINE_LENGTH);
|
||||
strcpy(line, "Updating node");
|
||||
fFinalPrint = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fFinalPrint)
|
||||
{
|
||||
FWM_TRACE("%s\n", line);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Process openPOWERLINK events
|
||||
|
||||
This function processes openPOWERLINK events.
|
||||
|
||||
\param eventType_p [in] Event type
|
||||
\param pEventArg_p [in] Pointer to event argument
|
||||
\param pUserArg_p [in] User argument
|
||||
|
||||
\return This functions returns a value of \ref tOplkError.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tOplkError firmwaremanager_processEvent(tOplkApiEventType eventType_p,
|
||||
const tOplkApiEventArg* pEventArg_p,
|
||||
void* pUserArg_p)
|
||||
{
|
||||
tOplkError ret = kErrorOk;
|
||||
tFirmwareRet fwRet;
|
||||
size_t iter;
|
||||
|
||||
UNUSED_PARAMETER(pUserArg_p);
|
||||
|
||||
switch (eventType_p)
|
||||
{
|
||||
case kOplkApiEventUserDef:
|
||||
if ((pEventArg_p->pUserArg == &instance_l) && instance_l.fCheckModules)
|
||||
{
|
||||
fwRet = firmwarecheck_checkModulesOfNextNode();
|
||||
|
||||
if (fwRet != kFwReturnOk)
|
||||
{
|
||||
ret = kErrorGeneralError;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kErrorOk;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case kOplkApiEventSdo:
|
||||
for (iter = 0; iter < tabentries(apfnProcessSdoEvent_l); iter++)
|
||||
{
|
||||
fwRet = apfnProcessSdoEvent_l[iter](&pEventArg_p->sdoInfo);
|
||||
if (fwRet != kFwReturnInvalidSdoEvent)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fwRet == kFwReturnInvalidSdoEvent)
|
||||
{
|
||||
// Event is ignored because no firmware module felt responsible for it.
|
||||
ret = kErrorOk;
|
||||
}
|
||||
else if (fwRet != kFwReturnOk)
|
||||
{
|
||||
ret = kErrorGeneralError;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kErrorOk;
|
||||
}
|
||||
break;
|
||||
|
||||
case kOplkApiEventNode:
|
||||
if ((eventType_p == kOplkApiEventNode))
|
||||
{
|
||||
if (pEventArg_p->nodeEvent.nodeEvent == kNmtNodeEventUpdateSw)
|
||||
{
|
||||
fwRet = firmwarecheck_processNodeEvent(pEventArg_p->nodeEvent.nodeId);
|
||||
if (fwRet == kFwReturnInterruptBoot)
|
||||
{
|
||||
ret = kErrorReject;
|
||||
}
|
||||
else if (fwRet != kFwReturnOk)
|
||||
{
|
||||
ret = kErrorGeneralError;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kErrorOk;
|
||||
}
|
||||
}
|
||||
else if (pEventArg_p->nodeEvent.nodeEvent == kNmtNodeEventConfDone)
|
||||
{
|
||||
instance_l.fCheckModules = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Firmware update not required callback
|
||||
|
||||
This function is called if a firmware update is not required for the given
|
||||
node.
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet firmwareUpdateNotRequired(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tOplkError result;
|
||||
|
||||
cleanupSdo(pSdoConnection_p);
|
||||
|
||||
FWM_TRACE("No firmware update required for node %d, continuing boot/operation\n",
|
||||
nodeId_p);
|
||||
|
||||
result = oplk_triggerMnStateChange(nodeId_p, kNmtNodeCommandSwOk);
|
||||
if (result != kErrorOk)
|
||||
{
|
||||
FWM_ERROR("(%s) - Triggering MN state change failed with %d\n",
|
||||
__func__, result);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Modular firmware update completed
|
||||
|
||||
This function is called if a modular firmware update is completed for the given
|
||||
node.
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet moduleUpdateCompleteCb(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
cleanupSdo(pSdoConnection_p);
|
||||
|
||||
FWM_TRACE("Firmware update of modules complete for node %d\n", nodeId_p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Node firmware update completed
|
||||
|
||||
This function is called if a firmware update is completed for the given node.
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet nodeUpdateCompleteCb(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tOplkError result;
|
||||
|
||||
cleanupSdo(pSdoConnection_p);
|
||||
|
||||
FWM_TRACE("Firmware update of node %d complete\n", nodeId_p);
|
||||
|
||||
result = oplk_triggerMnStateChange(nodeId_p, kNmtNodeCommandSwUpdated);
|
||||
if (result != kErrorOk)
|
||||
{
|
||||
FWM_ERROR("(%s) - Triggering MN state change failed with %d\n",
|
||||
__func__, result);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Firmware update error
|
||||
|
||||
This function is called if an error happend during a firmware update for the
|
||||
given node.
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet errorDuringUpdate(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tOplkError result;
|
||||
|
||||
cleanupSdo(pSdoConnection_p);
|
||||
|
||||
FWM_TRACE("An error occurred during check/update for node %d\n", nodeId_p);
|
||||
|
||||
result = oplk_triggerMnStateChange(nodeId_p, kNmtNodeCommandSwErr);
|
||||
if (result != kErrorOk)
|
||||
{
|
||||
FWM_ERROR("(%s) - Triggering MN state change failed with %d\n",
|
||||
__func__, result);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void cleanupSdo(tSdoComConHdl* pSdoConnection_p)
|
||||
{
|
||||
oplk_freeSdoChannel(*pSdoConnection_p);
|
||||
*pSdoConnection_p = FIRMWARECHECK_INVALID_SDO;
|
||||
}
|
||||
|
||||
/// \}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwaremanager.h
|
||||
|
||||
\brief Header file for the firmware manager modules
|
||||
|
||||
This header file contains the general definitions for all firmware manager
|
||||
modules.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwaremanager_H_
|
||||
#define _INC_firmwaremanager_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Enum with return values used by the firmware manager modules
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
kFwReturnOk = 0, ///< Function call was successful
|
||||
kFwReturnInvalidParameter, ///< An invalid parameter was passed
|
||||
kFwReturnInvalidInstance, ///< An invalid instance was passed
|
||||
kFwReturnNoResource, ///< The allocation of required resources failed
|
||||
kFwReturnFileOperationFailed, ///< A File operation failed
|
||||
kFwReturnInfoFormatError, ///< The supplied fw.info file in formated invalid
|
||||
kFwReturnModuleNotFound, ///< The requested module was not found
|
||||
kFwReturnAlreadyInitialized, ///< Firmware manager is already initialized
|
||||
kFwReturnInvalidNodeId, ///< An invalid node ID was passed
|
||||
kFwReturnSdoWriteFailed, ///< A SDO write command failed
|
||||
kFwReturnInvalidSdoSize, ///< A SDO event returned an invalid number of transferred bytes
|
||||
kFwReturnInvalidSdoEvent, ///< An invalid SDO finished event was passed
|
||||
kFwReturnNoIdent, ///< Failed to get ident for node
|
||||
kFwReturnOdError, ///< Failed to access local OD
|
||||
kFwReturnInterruptBoot, ///< Signalize interruption of boot process
|
||||
kFwReturnSdoWriteError, ///< Failed to issue an SDO write
|
||||
kFwReturnSdoReadError, ///< Failed to issue an SDO read
|
||||
kFwReturnInvalidNodeInfo, ///< An invalid node info was passed
|
||||
kFwReturnResetNodeFailed, ///< Failed to send reset node
|
||||
kFwReturnInvalidCheckState, ///< Invalid state in firmware check module
|
||||
kFwReturnIgnoreInfoFileLine, ///< Ignore the current info file line
|
||||
} tFirmwareRet;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwaremanager_init(const char* fwInfoFileName_p);
|
||||
void firmwaremanager_exit(void);
|
||||
|
||||
tOplkError firmwaremanager_thread(void);
|
||||
|
||||
tOplkError firmwaremanager_processEvent(tOplkApiEventType eventType_p,
|
||||
const tOplkApiEventArg* pEventArg_p,
|
||||
void* pUserArg_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwaremanager_H_ */
|
||||
+467
@@ -0,0 +1,467 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwarestore-file.c
|
||||
|
||||
\brief Source file of the firmware store module using a file system
|
||||
|
||||
This module implements an access to stored informations and firmware images
|
||||
provided by the openCONFIGURATOR.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FWSTORE_READ_MODE "rb"
|
||||
#define FWSTORE_FILEPATH_LENGTH 256u
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Firmware store instance
|
||||
*/
|
||||
typedef struct tFirmwareStoreInstance
|
||||
{
|
||||
char aFilename[FWSTORE_FILEPATH_LENGTH]; ///< File name
|
||||
char aPathToFile[FWSTORE_FILEPATH_LENGTH]; ///< Path to file
|
||||
FILE* pStorageFd; ///< File descriptor
|
||||
void* pData; ///< File data pointer
|
||||
size_t dataSize; ///< File data size
|
||||
} tFirmwareStoreInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareRet allocAndReadData(FILE* pFile_p,
|
||||
void** ppBuffer_p, size_t* pDataSize_p);
|
||||
static tFirmwareRet flushData(tFirmwareStoreHandle pHandle_p);
|
||||
static void getPathToFile(const char* pFilename_p, char* aPath_p);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Create a firmware store instance
|
||||
|
||||
This function creates an instance of the firmware store module.
|
||||
|
||||
\param pConfig_p [in] Pointer to the configuration structure for the created
|
||||
instance.
|
||||
\param ppHandle_p [out] Pointer to an instance handle which is filled if
|
||||
creation was successful.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_create(const tFirmwareStoreConfig* pConfig_p,
|
||||
tFirmwareStoreHandle* ppHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareStoreInstance* instance;
|
||||
|
||||
if ((pConfig_p == NULL) || (ppHandle_p == NULL))
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
}
|
||||
|
||||
instance = (tFirmwareStoreInstance*)malloc(sizeof(tFirmwareStoreInstance));
|
||||
if (instance == NULL)
|
||||
{
|
||||
ret = kFwReturnNoResource;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(instance, 0, sizeof(tFirmwareStoreInstance));
|
||||
strncpy(instance->aFilename, pConfig_p->pFilename, FWSTORE_FILEPATH_LENGTH);
|
||||
|
||||
getPathToFile(instance->aFilename, instance->aPathToFile);
|
||||
|
||||
*ppHandle_p = instance;
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Destroy a firmware store instance
|
||||
|
||||
This function destroys an instance of the firmware store module.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware store module which shall be
|
||||
destroyed.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_destroy (tFirmwareStoreHandle pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
}
|
||||
|
||||
ret = flushData(pHandle_p);
|
||||
|
||||
if (ret == kFwReturnOk)
|
||||
{
|
||||
free (pHandle_p);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Load data represented by the firmware store instance
|
||||
|
||||
This function acquires necessary resources and frees the data. All
|
||||
acquired resources can be flushed manually by calling
|
||||
\ref firmwarestore_flushData, unflushed resources will be freed within
|
||||
\ref firmwarestore_destroy.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware store module
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_loadData(tFirmwareStoreHandle pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pHandle_p->pStorageFd = fopen(pHandle_p->aFilename, FWSTORE_READ_MODE);
|
||||
if (pHandle_p->pStorageFd == NULL)
|
||||
{
|
||||
ret = kFwReturnFileOperationFailed;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
ret = allocAndReadData(pHandle_p->pStorageFd, &pHandle_p->pData, &pHandle_p->dataSize);
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Flush data represented by the firmware store instance
|
||||
|
||||
This function frees necessary resources and frees the data.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware store module
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_flushData(tFirmwareStoreHandle pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p != NULL)
|
||||
{
|
||||
ret = flushData(pHandle_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Access the data provided by the firmware store instance
|
||||
|
||||
This function provides access to the data represented by the firmware store
|
||||
module.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware store module
|
||||
\param ppData_p [out] Pointer which will be filled with the data buffer
|
||||
\param pDataSize_p [out] Pointer which will be filled with the available datasize
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_getData(tFirmwareStoreHandle pHandle_p,
|
||||
void** ppData_p, size_t* pDataSize_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if ((ppData_p == NULL) || (pDataSize_p == NULL))
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (pHandle_p->pData == NULL)
|
||||
{
|
||||
ret = allocAndReadData(pHandle_p->pStorageFd, &pHandle_p->pData, &pHandle_p->dataSize);
|
||||
}
|
||||
|
||||
if (ret == kFwReturnOk)
|
||||
{
|
||||
*ppData_p = pHandle_p->pData;
|
||||
*pDataSize_p = pHandle_p->dataSize;
|
||||
}
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Get the base of the represented storage
|
||||
|
||||
This function provides the base information of the storage, i.e. the base
|
||||
address of a memory storage or the containing directory of a file.
|
||||
|
||||
\param pHandle_p [in] Handle of the firmware store module
|
||||
\param ppData_p [out] Pointer which will be filled with the base information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwarestore_getBase(tFirmwareStoreHandle pHandle_p,
|
||||
void** ppBase_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (pHandle_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (ppBase_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
*ppBase_p = pHandle_p->aPathToFile;
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Allocate buffer and read data from file
|
||||
|
||||
\param pFile_p [in] File handle to be read
|
||||
\param ppBuffer_p [out] Pointer to buffer allocated and filled with the read data
|
||||
\param pDataSize [out] Pointer filled with the allocated buffer size
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet allocAndReadData(FILE* pFile_p,
|
||||
void** ppBuffer_p, size_t* pDataSize_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
UINT8* pBuffer = NULL;
|
||||
size_t fileSize;
|
||||
size_t readBytes;
|
||||
int result;
|
||||
long tellResult;
|
||||
|
||||
result = fseek(pFile_p, 0, SEEK_END);
|
||||
if (result < 0)
|
||||
{
|
||||
ret = kFwReturnFileOperationFailed;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
tellResult = ftell(pFile_p);
|
||||
if (tellResult < 0)
|
||||
{
|
||||
ret = kFwReturnFileOperationFailed;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
fileSize = (size_t)tellResult;
|
||||
|
||||
pBuffer = (UINT8*)malloc(fileSize);
|
||||
if (pBuffer == NULL)
|
||||
{
|
||||
ret = kFwReturnNoResource;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
rewind(pFile_p);
|
||||
|
||||
readBytes = fread(pBuffer, 1u, fileSize, pFile_p);
|
||||
if (readBytes != fileSize)
|
||||
{
|
||||
ret = kFwReturnFileOperationFailed;
|
||||
}
|
||||
|
||||
*ppBuffer_p = pBuffer;
|
||||
pBuffer = NULL;
|
||||
*pDataSize_p = fileSize;
|
||||
|
||||
EXIT:
|
||||
free(pBuffer);
|
||||
rewind(pFile_p);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Flush firmware store data
|
||||
|
||||
\param pHandle_p [in] Store handle
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet flushData(tFirmwareStoreHandle pHandle_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
int result;
|
||||
|
||||
if (pHandle_p->pStorageFd != NULL)
|
||||
{
|
||||
result = fclose(pHandle_p->pStorageFd);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
pHandle_p->pStorageFd = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = kFwReturnFileOperationFailed;
|
||||
}
|
||||
}
|
||||
|
||||
free(pHandle_p->pData);
|
||||
pHandle_p->pData = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Get path to file
|
||||
|
||||
\param pFilename_p [in] File name
|
||||
\param pPath_p [out] Pointer which will be filled with the path
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void getPathToFile(const char* pFilename_p, char* pPath_p)
|
||||
{
|
||||
char* pPos;
|
||||
|
||||
pPos = strrchr(pFilename_p, FIRMWARESTORE_PATH_DIR_SEP);
|
||||
|
||||
memset(pPath_p, 0, FWSTORE_FILEPATH_LENGTH);
|
||||
|
||||
if (pPos != NULL)
|
||||
{
|
||||
memcpy(pPath_p, pFilename_p, (pPos - pFilename_p));
|
||||
}
|
||||
else
|
||||
{
|
||||
pPath_p[0] = '.';
|
||||
}
|
||||
}
|
||||
|
||||
/// \}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwarestore.h
|
||||
|
||||
\brief Header file of the firmware store module
|
||||
|
||||
This header file contains the definitions of the firware store module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwarestore_H_
|
||||
#define _INC_firmwarestore_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define FIRMWARESTORE_PATH_DIR_SEP '\\'
|
||||
#else
|
||||
#define FIRMWARESTORE_PATH_DIR_SEP '/'
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \brief Handle to a firmware store instance
|
||||
*/
|
||||
typedef struct tFirmwareStoreInstance* tFirmwareStoreHandle;
|
||||
|
||||
/**
|
||||
* \brief Configuration structure for a firmware store instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const char* pFilename; ///< Filename of the accessed file.
|
||||
///< This member is only used by the file
|
||||
///< system based implementation.
|
||||
const void* pStorageBuffer; ///< Pointer to the memory holding the
|
||||
///< accessed information. This member is
|
||||
///< only used by the non file system
|
||||
///< implementation.
|
||||
} tFirmwareStoreConfig;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwarestore_create (const tFirmwareStoreConfig* pConfig_p,
|
||||
tFirmwareStoreHandle* pHandle_p);
|
||||
tFirmwareRet firmwarestore_destroy (tFirmwareStoreHandle pHandle_p);
|
||||
tFirmwareRet firmwarestore_loadData(tFirmwareStoreHandle pHandle_p);
|
||||
tFirmwareRet firmwarestore_flushData(tFirmwareStoreHandle pHandle_p);
|
||||
tFirmwareRet firmwarestore_getData(tFirmwareStoreHandle pHandle_p,
|
||||
void** ppData_p, size_t* pDataSize_p);
|
||||
tFirmwareRet firmwarestore_getBase(tFirmwareStoreHandle pHandle_p,
|
||||
void** ppBase_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwarestore_H_ */
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwaretrace.h
|
||||
|
||||
\brief Header file for trace macros used within firmware manager modules
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwaretrace_H_
|
||||
#define _INC_firmwaretrace_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FWM_TRACE_ENABLE
|
||||
|
||||
#if !defined(FWM_TRACE_PREFIX)
|
||||
#define FWM_TRACE_PREFIX "FWM: "
|
||||
#endif
|
||||
|
||||
#if !defined(FWM_ERROR_PREFIX)
|
||||
#define FWM_ERROR_PREFIX "FWM-ERROR: "
|
||||
#endif
|
||||
|
||||
#if defined(FWM_TRACE_ENABLE)
|
||||
#define FWM_TRACE(...) printf(FWM_TRACE_PREFIX __VA_ARGS__)
|
||||
#else
|
||||
#define FWM_TRACE(...)
|
||||
#endif
|
||||
|
||||
#if defined(FWM_TRACE_ENABLE)
|
||||
#define FWM_ERROR(...) fprintf(stderr, FWM_ERROR_PREFIX __VA_ARGS__)
|
||||
#else
|
||||
#define FWM_ERROR(...)
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwaretrace_H_ */
|
||||
+715
@@ -0,0 +1,715 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareupdate.c
|
||||
|
||||
\brief Source file of the firmware update module
|
||||
|
||||
This module implements firmware updates of a node with wrong version.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaretrace.h>
|
||||
#include <firmwaremanager/firmwareupdate.h>
|
||||
#include <firmwaremanager/firmwarestore.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define FIRMWARE_UPDATE_MAX_NODE_ID C_ADR_BROADCAST ///< Maximum value of a node ID
|
||||
|
||||
#define FIRMWARE_UPDATE_SDO_TYPE kSdoTypeAsnd ///< SDO type used for firmware update
|
||||
#define FIRMWARE_UPDATE_INVALID_SDO ((tSdoComConHdl)-1) ///< Invalid SDO handle
|
||||
|
||||
#if !defined(FIRMWARE_UPDATE_MAX_PARALLEL_TRANSMISSIONS)
|
||||
#define FIRMWARE_UPDATE_MAX_PARALLEL_TRANSMISSIONS 5 ///< Number of parallel transmissions of firmware images
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
\brief Firmware update transmission information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
BOOL fTranmissionActive; ///< Active transmission
|
||||
tFirmwareUpdateList pUpdateList; ///< Firmware update list
|
||||
void* pFirmwareImage; ///< Firmware image in progress
|
||||
size_t firmwareSize; ///< Size of firmware image in progress
|
||||
tSdoComConHdl sdoComCon; ///< SDO handle
|
||||
} tFirmwareUpdateTransmissionInfo;
|
||||
|
||||
/**
|
||||
\brief Firmware update instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
BOOL fInitialized; ///< Instance initialized flag
|
||||
tFirmwareUpdateConfig config; ///< Instance configuration
|
||||
tFirmwareUpdateTransmissionInfo aTransmissions[FIRMWARE_UPDATE_MAX_NODE_ID]; ///< Node transmission array
|
||||
size_t numberOfStartedTransmissions; ///< Number of started transmissions
|
||||
size_t numberOfFinishedTransmissions; ///< Number of finished/aborted transmissions
|
||||
} tFirmwareUpdateInstance;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareUpdateInstance instance_l;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static tFirmwareRet checkPointerAndInstance(const void* pCheck_p);
|
||||
static tFirmwareUpdateTransmissionInfo* getInfo(UINT nodeId_p);
|
||||
static BOOL isExpectedSdoCompleteEvent(tFirmwareUpdateTransmissionInfo* pInfo_p,
|
||||
const tSdoComFinished* pSdoComFinished_p);
|
||||
static tFirmwareRet transmitFirmware(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
static tFirmwareRet startTransmission(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
|
||||
static void transmissionFailed(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
static tFirmwareRet transmissionSucceeded(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
static void cleanupTransmission(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
static void cleanupInstance(void);
|
||||
static BOOL isTransmissionAllowed(tFirmwareUpdateTransmissionInfo* pInfo_p);
|
||||
|
||||
static tFirmwareUpdateTransmissionInfo* getNextPendingTransmission(void);
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize the firmware update module
|
||||
|
||||
This function initializes the firmware update module.
|
||||
|
||||
\param pConfig_p [in] Pointer to the configuration structure for the
|
||||
firmware update module.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareupdate_init(const tFirmwareUpdateConfig* pConfig_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (instance_l.fInitialized)
|
||||
{
|
||||
ret = kFwReturnAlreadyInitialized;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
memset(&instance_l, 0, sizeof(tFirmwareUpdateInstance));
|
||||
|
||||
memcpy(&instance_l.config, pConfig_p, sizeof(tFirmwareUpdateConfig));
|
||||
|
||||
instance_l.fInitialized = TRUE;
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Deinitialize the firmware update module
|
||||
|
||||
This function deinitializes the firmware update module.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void firmwareupdate_exit(void)
|
||||
{
|
||||
instance_l.fInitialized = FALSE;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Process the given list of firmware updates
|
||||
|
||||
This function processes the required firmware updates defined by the given list.
|
||||
|
||||
\param ppList_p [in, out] Pointer to List of required firmware updates, when
|
||||
an error occurs the returned list contains entries
|
||||
which were not freed.
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareupdate_processUpdateList(tFirmwareUpdateList* ppList_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareUpdateEntry** ppInsertIter;
|
||||
tFirmwareUpdateTransmissionInfo* pInfo;
|
||||
|
||||
ret = checkPointerAndInstance(ppList_p);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pInfo = &instance_l.aTransmissions[(*ppList_p)->nodeId];
|
||||
|
||||
ppInsertIter = &pInfo->pUpdateList;
|
||||
|
||||
while (*ppInsertIter != NULL)
|
||||
{
|
||||
ppInsertIter = &(*ppInsertIter)->pNext;
|
||||
}
|
||||
|
||||
*ppInsertIter = (*ppList_p);
|
||||
|
||||
*ppList_p = NULL;
|
||||
|
||||
if (!pInfo->fTranmissionActive)
|
||||
{
|
||||
pInfo->sdoComCon = FIRMWARE_UPDATE_INVALID_SDO;
|
||||
}
|
||||
|
||||
ret = startTransmission(pInfo);
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Process an SDO event
|
||||
|
||||
This function processes SDO events given by the passed \ref tSdoComFinished
|
||||
structure. By processing the according events this module checks the result of
|
||||
firmware transmissions and proceeds for further required updates.
|
||||
|
||||
\param pSdoComFinished_p [in] Structure of the SDO event
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareupdate_processSdoEvent(const tSdoComFinished* pSdoComFinished_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareUpdateTransmissionInfo* pInfo = NULL;
|
||||
BOOL fSucceeded = TRUE;
|
||||
|
||||
ret = checkPointerAndInstance(pSdoComFinished_p);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pInfo = &instance_l.aTransmissions[pSdoComFinished_p->nodeId];
|
||||
|
||||
if (!isExpectedSdoCompleteEvent(pInfo, pSdoComFinished_p))
|
||||
{
|
||||
ret = kFwReturnInvalidSdoEvent;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (pSdoComFinished_p->sdoComConState != kSdoComTransferFinished)
|
||||
{
|
||||
FWM_ERROR("SDO write failed for node 0x%X with state: 0x%x and abort code 0x%x\n",
|
||||
pSdoComFinished_p->nodeId, pSdoComFinished_p->sdoComConState, pSdoComFinished_p->abortCode);
|
||||
|
||||
fSucceeded = FALSE;
|
||||
}
|
||||
|
||||
if (pSdoComFinished_p->transferredBytes != pInfo->firmwareSize)
|
||||
{
|
||||
FWM_ERROR("SDO written number of bytes does not match for node 0x%X: %lu - %lu\n",
|
||||
pSdoComFinished_p->nodeId, (ULONG)pSdoComFinished_p->transferredBytes, (ULONG)pInfo->firmwareSize);
|
||||
|
||||
fSucceeded = FALSE;
|
||||
}
|
||||
|
||||
if (pSdoComFinished_p->abortCode != 0)
|
||||
{
|
||||
FWM_ERROR("SDO event with abort code: 0x%x for node 0x%X\n", pSdoComFinished_p->abortCode, pSdoComFinished_p->nodeId);
|
||||
|
||||
fSucceeded = FALSE;
|
||||
}
|
||||
|
||||
if (fSucceeded)
|
||||
{
|
||||
ret = transmissionSucceeded(pInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
transmissionFailed(pInfo);
|
||||
}
|
||||
|
||||
ret = startTransmission(pInfo);
|
||||
|
||||
EXIT:
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
cleanupInstance();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Get update transmission status
|
||||
|
||||
This function returns the node's update transmission status.
|
||||
|
||||
\param pConfig_p [in] Pointer to the configuration structure for the
|
||||
firmware update module.
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pStatus_p [in] Pointer used to return the transmission status
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
|
||||
\ingroup module_app_firmwaremanager
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
tFirmwareRet firmwareupdate_getTransmissionStatus(UINT nodeId_p,
|
||||
tFirmwareUpdateTransmissionStatus* pStatus_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareUpdateTransmissionInfo* pInfo;
|
||||
tFirmwareUpdateEntry* pIter;
|
||||
UINT count = 0u;
|
||||
|
||||
ret = checkPointerAndInstance(pStatus_p);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pInfo = getInfo(nodeId_p);
|
||||
if (pInfo == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidNodeId;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
pIter = pInfo->pUpdateList;
|
||||
|
||||
while (pIter != NULL)
|
||||
{
|
||||
count++;
|
||||
pIter = pIter->pNext;
|
||||
}
|
||||
|
||||
pStatus_p->fTransmissionActive = pInfo->fTranmissionActive;
|
||||
pStatus_p->numberOfPendingTransmissions = count;
|
||||
|
||||
EXIT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Check pointer and instance
|
||||
|
||||
\param pCheck_p [in] Pointer checked
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet checkPointerAndInstance(const void* pCheck_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
if (!instance_l.fInitialized)
|
||||
{
|
||||
ret = kFwReturnInvalidInstance;
|
||||
}
|
||||
else if (pCheck_p == NULL)
|
||||
{
|
||||
ret = kFwReturnInvalidParameter;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Get transmission information
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
|
||||
\return This functions returns a pointer to the transmission information.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareUpdateTransmissionInfo* getInfo(UINT nodeId_p)
|
||||
{
|
||||
tFirmwareUpdateTransmissionInfo* pInfo = NULL;
|
||||
|
||||
if (nodeId_p <= FIRMWARE_UPDATE_MAX_NODE_ID)
|
||||
{
|
||||
pInfo = &instance_l.aTransmissions[nodeId_p];
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Check SDO complete event's validity
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
\param pSdoComFinished_p [in] Pointer to SDO finish
|
||||
|
||||
\return This functions returns a \ref BOOL.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static BOOL isExpectedSdoCompleteEvent(tFirmwareUpdateTransmissionInfo* pInfo_p,
|
||||
const tSdoComFinished* pSdoComFinished_p)
|
||||
{
|
||||
return ((pSdoComFinished_p->pUserArg == &instance_l) &&
|
||||
pInfo_p->fTranmissionActive &&
|
||||
(pInfo_p->pUpdateList != NULL) &&
|
||||
(pSdoComFinished_p->targetIndex == pInfo_p->pUpdateList->index) &&
|
||||
(pSdoComFinished_p->targetSubIndex == pInfo_p->pUpdateList->subindex) &&
|
||||
(pSdoComFinished_p->sdoComConHdl == pInfo_p->sdoComCon));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Transmit firmware update image
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet transmitFirmware(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tOplkError oplkRet;
|
||||
|
||||
if (pInfo_p->fTranmissionActive)
|
||||
{
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (!isTransmissionAllowed(pInfo_p))
|
||||
{
|
||||
FWM_TRACE("Postpone update for node: %u index: 0x%x subindex: 0x%x\n",
|
||||
pInfo_p->pUpdateList->nodeId, pInfo_p->pUpdateList->index,
|
||||
pInfo_p->pUpdateList->subindex);
|
||||
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
FWM_TRACE("Start update for node: %u index: 0x%x subindex: 0x%x\n",
|
||||
pInfo_p->pUpdateList->nodeId, pInfo_p->pUpdateList->index,
|
||||
pInfo_p->pUpdateList->subindex);
|
||||
|
||||
ret = firmwarestore_loadData(pInfo_p->pUpdateList->pStoreHandle);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
FWM_ERROR("Loading image for transmission failed with %d and errno %d\n",
|
||||
ret, errno);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
ret = firmwarestore_getData(pInfo_p->pUpdateList->pStoreHandle,
|
||||
&pInfo_p->pFirmwareImage,
|
||||
&pInfo_p->firmwareSize);
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
FWM_ERROR("Getting the image for transmission failed with %d and errno %d\n",
|
||||
ret, errno);
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
oplkRet = oplk_writeObject(&pInfo_p->sdoComCon,
|
||||
pInfo_p->pUpdateList->nodeId,
|
||||
pInfo_p->pUpdateList->index,
|
||||
pInfo_p->pUpdateList->subindex,
|
||||
pInfo_p->pFirmwareImage,
|
||||
(UINT)pInfo_p->firmwareSize,
|
||||
FIRMWARE_UPDATE_SDO_TYPE,
|
||||
&instance_l);
|
||||
|
||||
if ((oplkRet != kErrorApiTaskDeferred) && (pInfo_p->sdoComCon != FIRMWARE_UPDATE_INVALID_SDO))
|
||||
{
|
||||
FWM_ERROR("Writing the firmware object failed with 0x%X\n", oplkRet);
|
||||
ret = kFwReturnSdoWriteFailed;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
instance_l.numberOfStartedTransmissions++;
|
||||
pInfo_p->fTranmissionActive = TRUE;
|
||||
|
||||
EXIT:
|
||||
if (ret != kFwReturnOk)
|
||||
{
|
||||
firmwarestore_flushData(pInfo_p->pUpdateList->pStoreHandle);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Start firmware update image transmission
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet startTransmission(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
|
||||
while (pInfo_p->pUpdateList != NULL)
|
||||
{
|
||||
ret = transmitFirmware(pInfo_p);
|
||||
if (ret == kFwReturnOk)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
FWM_ERROR("Transmission of the firmware failed with %d\n", ret);
|
||||
transmissionFailed(pInfo_p);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Handle firmware update transmission failed
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void transmissionFailed(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
pInfo_p->fTranmissionActive = FALSE;
|
||||
instance_l.numberOfFinishedTransmissions++;
|
||||
|
||||
if (pInfo_p->pUpdateList->fIsNode)
|
||||
{
|
||||
if (instance_l.config.pfnError != NULL)
|
||||
{
|
||||
instance_l.config.pfnError(pInfo_p->pUpdateList->nodeId,
|
||||
&pInfo_p->sdoComCon);
|
||||
}
|
||||
}
|
||||
|
||||
cleanupTransmission(pInfo_p);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Handle firmware update transmission succeeded
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static tFirmwareRet transmissionSucceeded(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
tFirmwareRet ret = kFwReturnOk;
|
||||
tFirmwareUpdateTransmissionInfo* pNextInfo;
|
||||
|
||||
FWM_TRACE("Update finished for node: %u index: 0x%x subindex: 0x%x\n",
|
||||
pInfo_p->pUpdateList->nodeId, pInfo_p->pUpdateList->index,
|
||||
pInfo_p->pUpdateList->subindex);
|
||||
|
||||
|
||||
if (pInfo_p->pUpdateList->fIsNode)
|
||||
{
|
||||
// Node callback
|
||||
if (instance_l.config.pfnNodeUpdateComplete != NULL)
|
||||
{
|
||||
ret = instance_l.config.pfnNodeUpdateComplete(pInfo_p->pUpdateList->nodeId,
|
||||
&pInfo_p->sdoComCon);
|
||||
}
|
||||
}
|
||||
else if (pInfo_p->pUpdateList->pNext == NULL)
|
||||
{
|
||||
// Module callback
|
||||
if (instance_l.config.pfnModuleUpdateComplete != NULL)
|
||||
{
|
||||
ret = instance_l.config.pfnModuleUpdateComplete(pInfo_p->pUpdateList->nodeId,
|
||||
&pInfo_p->sdoComCon);
|
||||
}
|
||||
}
|
||||
|
||||
instance_l.numberOfFinishedTransmissions++;
|
||||
|
||||
if (pInfo_p->pUpdateList->pNext == NULL)
|
||||
{
|
||||
pNextInfo = getNextPendingTransmission();
|
||||
|
||||
if (pNextInfo != NULL)
|
||||
{
|
||||
FWM_TRACE("Start next pending transmission for node 0x%X\n",
|
||||
pNextInfo->pUpdateList->nodeId);
|
||||
startTransmission(pNextInfo);
|
||||
}
|
||||
}
|
||||
|
||||
cleanupTransmission(pInfo_p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Clean up firmware update transmission
|
||||
|
||||
\param pInfo_p [in] Pointer to transmission information
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void cleanupTransmission(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
tFirmwareUpdateEntry* pRem;
|
||||
tFirmwareStoreHandle pFwStore;
|
||||
|
||||
pInfo_p->fTranmissionActive = FALSE;
|
||||
pFwStore = pInfo_p->pUpdateList->pStoreHandle;
|
||||
|
||||
pRem = pInfo_p->pUpdateList;
|
||||
pInfo_p->pUpdateList = pInfo_p->pUpdateList->pNext;
|
||||
free(pRem);
|
||||
|
||||
firmwarestore_flushData(pFwStore);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Clean up firmware update instance
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static void cleanupInstance(void)
|
||||
{
|
||||
tFirmwareUpdateEntry* pRem;
|
||||
size_t iter;
|
||||
|
||||
for (iter = 0u; iter < FIRMWARE_UPDATE_MAX_NODE_ID; iter++)
|
||||
{
|
||||
pRem = instance_l.aTransmissions[iter].pUpdateList;
|
||||
while (pRem != NULL)
|
||||
{
|
||||
instance_l.aTransmissions[iter].pUpdateList = pRem->pNext;
|
||||
free(pRem);
|
||||
pRem = instance_l.aTransmissions[iter].pUpdateList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static tFirmwareUpdateTransmissionInfo* getNextPendingTransmission(void)
|
||||
{
|
||||
tFirmwareUpdateTransmissionInfo* pInfo = NULL;
|
||||
size_t i;
|
||||
|
||||
for (i = 0U; i < FIRMWARE_UPDATE_MAX_NODE_ID; i++)
|
||||
{
|
||||
|
||||
if (!instance_l.aTransmissions[i].fTranmissionActive &&
|
||||
(instance_l.aTransmissions[i].pUpdateList != NULL))
|
||||
{
|
||||
pInfo = &instance_l.aTransmissions[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Check if the start of the given transmission is allowed
|
||||
|
||||
\return This functions returns a boolean value, which is true if the
|
||||
transmission is allowed.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static BOOL isTransmissionAllowed(tFirmwareUpdateTransmissionInfo* pInfo_p)
|
||||
{
|
||||
size_t numberOfActiveTransmissions = instance_l.numberOfStartedTransmissions -
|
||||
instance_l.numberOfFinishedTransmissions;
|
||||
|
||||
UNUSED_PARAMETER(pInfo_p);
|
||||
|
||||
return (numberOfActiveTransmissions < FIRMWARE_UPDATE_MAX_PARALLEL_TRANSMISSIONS);
|
||||
|
||||
}
|
||||
|
||||
/// \}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file firmwareupdate.h
|
||||
|
||||
\brief Header file of the firmware update module
|
||||
|
||||
This header file contains the definitions of the firware update module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2017, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_firmwareupdate_H_
|
||||
#define _INC_firmwareupdate_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <firmwaremanager/firmwaremanager.h>
|
||||
#include <firmwaremanager/firmwareinfodecode.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Firmware update node callback
|
||||
|
||||
This function is called by the firmware update module to inform about a node's
|
||||
update completion.
|
||||
|
||||
\param nodeId_p [in] Node ID
|
||||
\param pSdoConnection_p [in] Pointer to SDO connection used for this node
|
||||
|
||||
\return This functions returns a value of \ref tFirmwareRet.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
typedef tFirmwareRet (*tFirmwareUpdateNodeCb)(UINT nodeId_p,
|
||||
tSdoComConHdl* pSdoConnection_p);
|
||||
|
||||
/**
|
||||
\brief Firmware update transmission status
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT numberOfPendingTransmissions; ///< Number of pending transmissions
|
||||
BOOL fTransmissionActive; ///< Active transmission flag
|
||||
} tFirmwareUpdateTransmissionStatus;
|
||||
|
||||
/**
|
||||
\brief Firmware update configuration
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tFirmwareUpdateNodeCb pfnNodeUpdateComplete; ///< Node update complete callback
|
||||
tFirmwareUpdateNodeCb pfnModuleUpdateComplete; ///< Modules of a node update complete callback
|
||||
tFirmwareUpdateNodeCb pfnError; ///< Node update error callback
|
||||
} tFirmwareUpdateConfig;
|
||||
|
||||
/**
|
||||
\brief Firmware update entry
|
||||
*/
|
||||
typedef struct tFirmwareUpdateEntry
|
||||
{
|
||||
UINT nodeId; ///< Node ID
|
||||
UINT index; ///< Index of remote domain object
|
||||
UINT subindex; ///< Subindex of remote domain object
|
||||
tFirmwareStoreHandle pStoreHandle; ///< Handle to firmware update file
|
||||
BOOL fIsNode; ///< Flag for identification of node (Head) update
|
||||
struct tFirmwareUpdateEntry* pNext; ///< Pointer to next update entry
|
||||
} tFirmwareUpdateEntry;
|
||||
|
||||
/**
|
||||
\brief Firmware update list
|
||||
*/
|
||||
typedef tFirmwareUpdateEntry* tFirmwareUpdateList;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
tFirmwareRet firmwareupdate_init(const tFirmwareUpdateConfig* pConfig_p);
|
||||
void firmwareupdate_exit(void);
|
||||
tFirmwareRet firmwareupdate_processUpdateList(tFirmwareUpdateList* ppList_p);
|
||||
tFirmwareRet firmwareupdate_processSdoEvent(const tSdoComFinished* pSdoComFinished_p);
|
||||
tFirmwareRet firmwareupdate_getTransmissionStatus(UINT nodeId_p,
|
||||
tFirmwareUpdateTransmissionStatus* pStatus_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_firmwareinfo_H_ */
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file gpio-c5socarm.c
|
||||
|
||||
\brief GPIOs for Altera Cyclone-V ARM
|
||||
|
||||
The file implements the GPIOs on Altera Cyclone-V ARM core used by
|
||||
openPOWERLINK demo applications.
|
||||
|
||||
\ingroup module_app_common
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2015, Kalycito Infotech Private Limited
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <alt_generalpurpose_io.h>
|
||||
|
||||
#include <oplk/oplk.h>
|
||||
#include "gpio.h"
|
||||
|
||||
#include <system.h>
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define LED_OUTPUT_DELAY_US 500000 // 500ms
|
||||
|
||||
#define HPS_LED_ALL_BIT_MASK 0x0000F000
|
||||
#define HPS_LED_ALL_TURN_ON 0x00000000
|
||||
#define HPS_LED_ALL_TURN_OFF 0x0000F000
|
||||
#define HPS_LED_0_TURN_ON 0x00007000 // GPIO[44] (HPS_LED_0) --> Error Led
|
||||
#define HPS_LED_1_TURN_ON 0x0000B000 // GPIO[43] (HPS_LED_1) --> Status Led
|
||||
#define HPS_LED_2_TURN_ON 0x0000D000 // GPIO[42] (HPS_LED_2)
|
||||
#define HPS_LED_3_TURN_ON 0x0000E000 // GPIO[41] (HPS_LED_3)
|
||||
|
||||
#define HPS_LED_0_TURN_OFF 0x00008000
|
||||
#define HPS_LED_1_TURN_OFF 0x00004000
|
||||
#define HPS_LED_2_TURN_OFF 0x00002000
|
||||
#define HPS_LED_3_TURN_OFF 0x00001000
|
||||
|
||||
#define HPS_PB_INT_ALL_BIT_MASK 0x01E00000 // Interrupt bits for GPIO2
|
||||
|
||||
#define HPS_PB_0_ASSERT 0x01C00000 // GPIO[8] (HPS_PB_0)
|
||||
#define HPS_PB_1_ASSERT 0x01A00000 // GPIO[9] (HPS_PB_1)
|
||||
#define HPS_PB_2_ASSERT 0x01600000 // GPIO[10](HPS_PB_2)
|
||||
#define HPS_PB_3_ASSERT 0x00E00000 // GPIO[11](HPS_PB_3)
|
||||
|
||||
#define HPS_PB_ALL_BIT_MASK 0x01E00000
|
||||
|
||||
#define HPS_PB_0_BIT_MASK 0x01000000 // GPIO[8] (HPS_PB_0)
|
||||
#define HPS_PB_1_BIT_MASK 0x00800000 // GPIO[9] (HPS_PB_1)
|
||||
#define HPS_PB_2_BIT_MASK 0x00400000 // GPIO[10](HPS_PB_2)
|
||||
#define HPS_PB_3_BIT_MASK 0x00200000 // GPIO[11](HPS_PB_3)
|
||||
|
||||
#define HPS_DIPSW_ALL_BIT_MASK 0x001E0000
|
||||
#define HPS_DIPSW_NET_VAL(portVal) ((portVal >> 17) & 0xF)
|
||||
|
||||
#define HPS_DIPSW_0_BIT_MASK 0x00100000 // GPIO[4] (HPS_DIPSW_0)
|
||||
#define HPS_DIPSW_1_BIT_MASK 0x00080000 // GPIO[5] (HPS_DIPSW_1)
|
||||
#define HPS_DIPSW_2_BIT_MASK 0x00040000 // GPIO[6](HPS_DIPSW_2)
|
||||
#define HPS_DIPSW_3_BIT_MASK 0x00020000 // GPIO[7](HPS_DIPSW_3)
|
||||
|
||||
#define FPGA_PB_ALL_BIT_MASK 0x00000003
|
||||
|
||||
#define FPGA_PB_1_BIT_MASK 0x00000002
|
||||
#define FPGA_PB_0_BIT_MASK 0x00000001
|
||||
|
||||
#define FPGA_DIPSW_ALL_BIT_MASK 0x0000000F
|
||||
|
||||
#define FPGA_DIPSW_0_BIT_MASK 0x00000001
|
||||
#define FPGA_DIPSW_1_BIT_MASK 0x00000002
|
||||
#define FPGA_DIPSW_3_BIT_MASK 0x00000001
|
||||
#define FPGA_DIPSW_4_BIT_MASK 0x00000002
|
||||
|
||||
#define FPGA_DIPSW_NET_VAL(portVal) (portVal & FPGA_DIPSW_ALL_BIT_MASK)
|
||||
|
||||
// Determine size of an array
|
||||
#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
ALT_GPIO_CONFIG_RECORD_t cfgHpsGPI[] =
|
||||
{
|
||||
{ ALT_HLGPI_4, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_DIPSW_0
|
||||
{ ALT_HLGPI_5, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_DIPSW_1
|
||||
{ ALT_HLGPI_6, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_DIPSW_2
|
||||
{ ALT_HLGPI_7, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_DIPSW_3
|
||||
{ ALT_HLGPI_8, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_PB_0
|
||||
{ ALT_HLGPI_9, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_PB_1
|
||||
{ ALT_HLGPI_10, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 }, // HPS_PB_2
|
||||
{ ALT_HLGPI_11, ALT_GPIO_PIN_INPUT, 0, 0, 0, 0 } // HPS_PB_3
|
||||
};
|
||||
|
||||
ALT_GPIO_CONFIG_RECORD_t cfgHpsGPO[] =
|
||||
{
|
||||
{ ALT_GPIO_1BIT_44, ALT_GPIO_PIN_OUTPUT, 0, 0, 0, ALT_GPIO_PIN_DATAZERO }, // HPS_LED_0
|
||||
{ ALT_GPIO_1BIT_43, ALT_GPIO_PIN_OUTPUT, 0, 0, 0, ALT_GPIO_PIN_DATAZERO }, // HPS_LED_1
|
||||
{ ALT_GPIO_1BIT_42, ALT_GPIO_PIN_OUTPUT, 0, 0, 0, ALT_GPIO_PIN_DATAZERO }, // HPS_LED_2
|
||||
{ ALT_GPIO_1BIT_41, ALT_GPIO_PIN_OUTPUT, 0, 0, 0, ALT_GPIO_PIN_DATAZERO } // HPS_LED_3
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize GPIO module
|
||||
|
||||
The function initializes the GPIO module before being used.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_init(void)
|
||||
{
|
||||
ALT_STATUS_CODE halRet = ALT_E_SUCCESS;
|
||||
|
||||
/* Initialize HPS GPIO */
|
||||
|
||||
// Initialize GPIO module
|
||||
halRet = alt_gpio_init();
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
goto Exit;
|
||||
|
||||
halRet = alt_gpio_group_config(cfgHpsGPO, ARRAY_COUNT(cfgHpsGPO)); // Setup GPIO LED
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
goto Exit;
|
||||
|
||||
halRet = alt_gpio_port_data_write(ALT_GPIO_PORTB,
|
||||
HPS_LED_ALL_BIT_MASK,
|
||||
HPS_LED_ALL_TURN_OFF); // clear the Leds
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
goto Exit;
|
||||
|
||||
halRet = alt_gpio_group_config(cfgHpsGPI, ARRAY_COUNT(cfgHpsGPI)); // Setup GPIO PUSHBUTTON
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
goto Exit;
|
||||
|
||||
halRet = alt_gpio_port_int_disable(ALT_GPIO_PORTC, HPS_PB_INT_ALL_BIT_MASK); // Enable GPIO interrupts
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
goto Exit;
|
||||
|
||||
/* Initialize FPGA GPIO */
|
||||
|
||||
// will be initialized in target initialization
|
||||
|
||||
// Clear the dip switch and push button interrupt status registers
|
||||
#if defined(HOST_0_BUTTON_PIO_BASE)
|
||||
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(HOST_0_BUTTON_PIO_BASE, 0x0);
|
||||
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_BUTTON_PIO_BASE, FPGA_PB_ALL_BIT_MASK);
|
||||
#endif
|
||||
|
||||
#if defined(HOST_0_DIPSW_PIO_BASE)
|
||||
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(HOST_0_DIPSW_PIO_BASE, 0x0);
|
||||
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_DIPSW_PIO_BASE, FPGA_DIPSW_ALL_BIT_MASK);
|
||||
#endif
|
||||
|
||||
Exit:
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown GPIO module
|
||||
|
||||
The function shuts down the GPIO module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_exit(void)
|
||||
{
|
||||
/* Uninitialize HPS GPIO */
|
||||
alt_gpio_uninit();
|
||||
|
||||
/* Uninitialize FPGA GPIO */
|
||||
|
||||
// will be handled by target module
|
||||
#if defined(HOST_0_BUTTON_PIO_BASE)
|
||||
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(HOST_0_BUTTON_PIO_BASE, 0x0);
|
||||
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_BUTTON_PIO_BASE, FPGA_PB_ALL_BIT_MASK);
|
||||
#endif
|
||||
#if defined(HOST_0_DIPSW_PIO_BASE)
|
||||
IOWR_ALTERA_AVALON_PIO_IRQ_MASK(HOST_0_DIPSW_PIO_BASE, 0x0);
|
||||
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_DIPSW_PIO_BASE, FPGA_DIPSW_ALL_BIT_MASK);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the node switch value
|
||||
|
||||
The function returns the node ID set by the node switches.
|
||||
|
||||
\return Returns the set node ID
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT8 gpio_getNodeid(void)
|
||||
{
|
||||
UINT8 nodeId;
|
||||
UINT32 hpsSwStatus = 0;
|
||||
UINT32 fpgaSwStatus = 0;
|
||||
|
||||
hpsSwStatus = alt_gpio_port_data_read(ALT_GPIO_PORTC, HPS_DIPSW_ALL_BIT_MASK);
|
||||
|
||||
#if defined(HOST_0_DIPSW_PIO_BASE)
|
||||
fpgaSwStatus = IORD_ALTERA_AVALON_PIO_DATA(HOST_0_DIPSW_PIO_BASE);
|
||||
#endif
|
||||
|
||||
nodeId = (UINT8)((FPGA_DIPSW_NET_VAL(fpgaSwStatus) << HOST_0_DIPSW_PIO_DATA_WIDTH) | HPS_DIPSW_NET_VAL(hpsSwStatus));
|
||||
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the application input
|
||||
|
||||
The function returns application inputs.
|
||||
|
||||
\return Returns the application inputs.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT32 gpio_getAppInput(void)
|
||||
{
|
||||
UINT32 input;
|
||||
|
||||
#if defined(HOST_0_BUTTON_PIO_BASE)
|
||||
input = (UINT32)IORD_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_BUTTON_PIO_BASE);
|
||||
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(HOST_0_BUTTON_PIO_BASE, FPGA_PB_ALL_BIT_MASK);
|
||||
#else
|
||||
input = 0;
|
||||
#endif
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Sets the application output
|
||||
|
||||
The function sets the application outputs.
|
||||
|
||||
\param[in] val_p Determines the value to be set to the output
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_setAppOutputs(UINT32 val_p)
|
||||
{
|
||||
ALT_STATUS_CODE halRet = ALT_E_SUCCESS;
|
||||
|
||||
halRet = alt_gpio_port_data_write(ALT_GPIO_PORTB, HPS_LED_ALL_BIT_MASK, ~val_p);
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
/// \}
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file gpio-microblaze.c
|
||||
|
||||
\brief GPIOs for Xilinx microblaze
|
||||
|
||||
The file implements the GPIOs on Xilinx microblaze used by openPOWERLINK demo
|
||||
applications.
|
||||
|
||||
\ingroup module_app_common
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <xparameters.h>
|
||||
#include <xgpio_l.h>
|
||||
#include <oplk/oplk.h>
|
||||
#include "gpio.h"
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef XPAR_NODE_SWITCHES_BASEADDR
|
||||
#define NODE_SWITCH_BASE XPAR_NODE_SWITCHES_BASEADDR
|
||||
#endif // XPAR_NODE_SWITCHES_BASEADDR
|
||||
|
||||
#ifdef XPAR_GPIO_INPUTS_BASEADDR
|
||||
#define GPIO_INPUTS_BASE XPAR_GPIO_INPUTS_BASEADDR
|
||||
#endif // XPAR_GPIO_INPUTS_BASEADDR
|
||||
|
||||
#ifdef XPAR_GPIO_OUTPUTS_BASEADDR
|
||||
#define GPIO_OUTPUTS_BASE XPAR_GPIO_OUTPUTS_BASEADDR
|
||||
#endif // XPAR_GPIO_OUTPUTS_BASEADDR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize GPIO module
|
||||
|
||||
The function initializes the GPIO module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown GPIO module
|
||||
|
||||
The function shuts down the GPIO module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_exit(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the node switch value
|
||||
|
||||
The function returns the node ID set by the node switches.
|
||||
|
||||
\return Returns the set node ID
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT8 gpio_getNodeid(void)
|
||||
{
|
||||
UINT8 nodeid;
|
||||
|
||||
#if defined(NODE_SWITCH_BASE)
|
||||
nodeid = XGpio_ReadReg(NODE_SWITCH_BASE, 0);
|
||||
#else
|
||||
nodeid = 0;
|
||||
#endif
|
||||
|
||||
return nodeid;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the application input
|
||||
|
||||
The function returns application inputs.
|
||||
|
||||
\return Returns the application inputs.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT32 gpio_getAppInput(void)
|
||||
{
|
||||
UINT32 input;
|
||||
|
||||
#if defined(GPIO_INPUTS_BASE)
|
||||
input = XGpio_ReadReg(GPIO_INPUTS_BASE, 0);
|
||||
#else
|
||||
input = 0;
|
||||
#endif
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Sets the application output
|
||||
|
||||
The function sets the application outputs.
|
||||
|
||||
\param[in] val_p Determines the value to be set to the output
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_setAppOutputs(UINT32 val_p)
|
||||
{
|
||||
#if defined(GPIO_OUTPUTS_BASE)
|
||||
XGpio_WriteReg(GPIO_OUTPUTS_BASE, XGPIO_DATA_OFFSET, val_p);
|
||||
#else
|
||||
UNUSED_PARAMETER(val_p);
|
||||
#endif
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
/// \}
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file gpio-nios2.c
|
||||
|
||||
\brief GPIOs for Altera Nios II
|
||||
|
||||
The file implements the GPIOs on Altera Nios II used by openPOWERLINK demo
|
||||
applications.
|
||||
|
||||
\ingroup module_app_common
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2013, Kalycito Infotech Private Ltd.All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <system.h>
|
||||
#include <altera_avalon_pio_regs.h>
|
||||
#include <oplk/oplk.h>
|
||||
#include "gpio.h"
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize GPIO module
|
||||
|
||||
The function initializes the GPIO module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown GPIO module
|
||||
|
||||
The function shuts down the GPIO module.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_exit(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the node switch value
|
||||
|
||||
The function returns the node ID set by the node switches.
|
||||
|
||||
\return Returns the set node ID
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT8 gpio_getNodeid(void)
|
||||
{
|
||||
UINT8 nodeid;
|
||||
|
||||
#if defined(NODE_SWITCH_PIO_BASE)
|
||||
nodeid = IORD_ALTERA_AVALON_PIO_DATA(NODE_SWITCH_PIO_BASE);
|
||||
#else
|
||||
nodeid = 0;
|
||||
#endif
|
||||
|
||||
return nodeid;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Gets the application input
|
||||
|
||||
The function returns application inputs.
|
||||
|
||||
\return Returns the application inputs.
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
UINT32 gpio_getAppInput(void)
|
||||
{
|
||||
UINT32 input;
|
||||
|
||||
#if defined(APP_PIO_BASE)
|
||||
input = IORD_ALTERA_AVALON_PIO_DATA(APP_PIO_BASE);
|
||||
#else
|
||||
input = 0;
|
||||
#endif
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Sets the application output
|
||||
|
||||
The function sets the application outputs.
|
||||
|
||||
\param[in] val_p Determines the value to be set to the output
|
||||
|
||||
\ingroup module_app_common
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void gpio_setAppOutputs(UINT32 val_p)
|
||||
{
|
||||
#if defined(APP_PIO_BASE)
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(APP_PIO_BASE, val_p);
|
||||
#else
|
||||
UNUSED_PARAMETER(val_p);
|
||||
#endif
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
/// \}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file gpio.h
|
||||
|
||||
\brief Definitions for GPIOs
|
||||
|
||||
This header file provides the definitions for GPIOs used by the openPOWERLINK
|
||||
examples.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2013, Kalycito Infotech Private Ltd.All rights reserved.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_gpio_H_
|
||||
#define _INC_gpio_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void gpio_init(void);
|
||||
void gpio_exit(void);
|
||||
UINT8 gpio_getNodeid(void);
|
||||
UINT32 gpio_getAppInput(void);
|
||||
void gpio_setAppOutputs(UINT32 val_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_gpio_H_ */
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file lcd.c
|
||||
|
||||
\brief Generic LCD interface
|
||||
|
||||
The generic LCD interface module enables to control any LCD.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2013, Kalycito Infotech Private Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <string.h>
|
||||
#include <oplk/oplk.h>
|
||||
#include "lcd.h"
|
||||
#include "lcdl.h"
|
||||
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#define LCD_COLUMN 16 ///< Minimum line size needed
|
||||
|
||||
static const char aStrNmtState_l[10][LCD_COLUMN + 1] =
|
||||
{
|
||||
"INVALID ",
|
||||
"OFF ",
|
||||
"INITIALISATION ",
|
||||
"NOT ACTIVE ",
|
||||
"BASIC ETHERNET ",
|
||||
"PRE_OP1 ",
|
||||
"PRE_OP2 ",
|
||||
"READY_TO_OP ",
|
||||
"OPERATIONAL ",
|
||||
"STOPPED "
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize the LCD
|
||||
|
||||
The function initializes the generic LCD instance.
|
||||
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_init(void)
|
||||
{
|
||||
// Initialize low-level module
|
||||
lcdl_init();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown the LCD
|
||||
|
||||
The function exits the generic LCD instance.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_exit(void)
|
||||
{
|
||||
// Shutdown low-level module
|
||||
lcdl_exit();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Clear the LCD
|
||||
|
||||
The function clears the display.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_clear(void)
|
||||
{
|
||||
lcdl_clear();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print text to LCD
|
||||
|
||||
The function prints the provided text to the specified line in the LCD.
|
||||
|
||||
\param[in] sText_p Text to be printed
|
||||
\param[in] line_p Line to print the text in
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_printText(const char* sText_p,
|
||||
UINT line_p)
|
||||
{
|
||||
if (lcdl_changeToLine(line_p) != 0)
|
||||
return;
|
||||
|
||||
lcdl_printText(sText_p);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print NMT state to LCD
|
||||
|
||||
The function prints the NMT state to the second line of the display.
|
||||
|
||||
\param[in] nmtState_p NMT state to be written
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_printNmtState(tNmtState nmtState_p)
|
||||
{
|
||||
if (lcdl_changeToLine(2) != 0)
|
||||
return;
|
||||
|
||||
switch (nmtState_p)
|
||||
{
|
||||
case kNmtGsOff:
|
||||
lcdl_printText(aStrNmtState_l[1]);
|
||||
break;
|
||||
|
||||
case kNmtGsInitialising:
|
||||
case kNmtGsResetApplication:
|
||||
case kNmtGsResetCommunication:
|
||||
case kNmtGsResetConfiguration:
|
||||
lcdl_printText(aStrNmtState_l[2]);
|
||||
break;
|
||||
|
||||
case kNmtCsNotActive:
|
||||
case kNmtMsNotActive:
|
||||
lcdl_printText(aStrNmtState_l[3]);
|
||||
break;
|
||||
|
||||
case kNmtCsBasicEthernet:
|
||||
case kNmtMsBasicEthernet:
|
||||
lcdl_printText(aStrNmtState_l[4]);
|
||||
break;
|
||||
|
||||
case kNmtCsPreOperational1:
|
||||
case kNmtMsPreOperational1:
|
||||
lcdl_printText(aStrNmtState_l[5]);
|
||||
break;
|
||||
|
||||
case kNmtCsPreOperational2:
|
||||
case kNmtMsPreOperational2:
|
||||
lcdl_printText(aStrNmtState_l[6]);
|
||||
break;
|
||||
|
||||
case kNmtCsReadyToOperate:
|
||||
case kNmtMsReadyToOperate:
|
||||
lcdl_printText(aStrNmtState_l[7]);
|
||||
break;
|
||||
|
||||
case kNmtCsOperational:
|
||||
case kNmtMsOperational:
|
||||
lcdl_printText(aStrNmtState_l[8]);
|
||||
break;
|
||||
|
||||
case kNmtCsStopped:
|
||||
lcdl_printText(aStrNmtState_l[9]);
|
||||
break;
|
||||
|
||||
default:
|
||||
lcdl_printText(aStrNmtState_l[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print node ID to LCD
|
||||
|
||||
The function prints the provided node ID to the first line of the display.
|
||||
In addition to the printed node ID 'MN' (=0xF0) or 'CN' is added.
|
||||
|
||||
\param[in] nodeId_p node ID to be written
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_printNodeId(UINT8 nodeId_p)
|
||||
{
|
||||
char textNodeID[LCD_COLUMN+1];
|
||||
|
||||
sprintf(textNodeID,
|
||||
"NodeID=0x%02X (%s)",
|
||||
nodeId_p,
|
||||
(nodeId_p == C_ADR_MN_DEF_NODE_ID) ? "MN" : "CN");
|
||||
|
||||
if (lcdl_changeToLine(1) != 0)
|
||||
return;
|
||||
|
||||
lcdl_printText(textNodeID);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print error code to LCD
|
||||
|
||||
The function prints the provided error code to the second line of the display.
|
||||
|
||||
\param[in] error_p error code
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcd_printError(tOplkError error_p)
|
||||
{
|
||||
char textError[LCD_COLUMN+1];
|
||||
|
||||
sprintf(textError, "ERROR=0x%04X", error_p);
|
||||
|
||||
if (lcdl_changeToLine(2) != 0)
|
||||
return;
|
||||
|
||||
lcdl_printText(textError);
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
/// \}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file lcd.h
|
||||
|
||||
\brief Generic LCD interface
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2013, Kalycito Infotech Private Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef _INC_lcd_H_
|
||||
#define _INC_lcd_H_
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <oplk/oplk.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// typedef
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void lcd_init(void);
|
||||
void lcd_exit(void);
|
||||
|
||||
void lcd_clear(void);
|
||||
void lcd_printText(const char* sText_p,
|
||||
UINT line_p);
|
||||
void lcd_printNmtState(tNmtState nmtState_p);
|
||||
void lcd_printNodeId(UINT8 nodeId_p);
|
||||
void lcd_printError(tOplkError error_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INC_lcd_H_ */
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file lcdl-16207.c
|
||||
|
||||
\brief Low-level LCD functions for Altera Avalon LCD IP-Core with HD44780
|
||||
|
||||
This implementation uses the Altera Avalon LCD 16207 IP-Core to handle the
|
||||
display controller HD44780 - available e.g. on the Terasic DE2-115 board.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2013, Kalycito Infotech Private Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <unistd.h> // for usleep()
|
||||
#include <string.h>
|
||||
|
||||
#include <system.h>
|
||||
#include <altera_avalon_lcd_16207_regs.h>
|
||||
|
||||
#include "lcdl.h"
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#if !defined(LCD_BASE)
|
||||
#error "Rename the LCD component in QSYS/SOPC to 'lcd'!"
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
#define LCDL_COLUMN 16 ///< Column count
|
||||
#define LCDL_LINE 2 ///< Line count
|
||||
|
||||
#define LCDL_WRCMD(data) IOWR_ALTERA_AVALON_LCD_16207_COMMAND(LCD_BASE, data)
|
||||
#define LCDL_RDCMD() IORD_ALTERA_AVALON_LCD_16207_STATUS(LCD_BASE)
|
||||
#define LCDL_WRDATA(data) IOWR_ALTERA_AVALON_LCD_16207_DATA(LCD_BASE, data)
|
||||
#define LCDL_RDDATA() IORD_ALTERA_AVALON_LCD_16207_DATA(LCD_BASE)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize the low-level LCD module
|
||||
|
||||
This function writes a sequence of initialization parameters to the LCD.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_init(void)
|
||||
{
|
||||
LCDL_WRCMD(0x38);
|
||||
usleep(2000);
|
||||
LCDL_WRCMD(0x0C);
|
||||
usleep(2000);
|
||||
LCDL_WRCMD(0x01);
|
||||
usleep(2000);
|
||||
LCDL_WRCMD(0x06);
|
||||
usleep(2000);
|
||||
LCDL_WRCMD(0x80);
|
||||
usleep(2000);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Shutdown the low-level LCD module
|
||||
|
||||
This function exits the LCD instance.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_exit(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Clear the LCD
|
||||
|
||||
This function clears all lines of the display.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_clear(void)
|
||||
{
|
||||
LCDL_WRCMD(0x01);
|
||||
usleep(2000);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Change to specified line
|
||||
|
||||
Changes to specified line of the LCD
|
||||
|
||||
\param[in] line_p Specifies the line
|
||||
|
||||
\return The function returns 0 if the line is changed successfully,
|
||||
otherwise -1.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
int lcdl_changeToLine(unsigned int line_p)
|
||||
{
|
||||
if (line_p > LCDL_LINE)
|
||||
return -1;
|
||||
|
||||
switch (line_p)
|
||||
{
|
||||
case 1:
|
||||
LCDL_WRCMD(0x80);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
LCDL_WRCMD(0xC0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
usleep(2000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print text to the LCD
|
||||
|
||||
Writes text to the LCD currently selected.
|
||||
|
||||
\param[in] sText_p The text to print
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_printText(const char* sText_p)
|
||||
{
|
||||
int i;
|
||||
int length = strlen(sText_p);
|
||||
|
||||
// Longer text is cut due to column limitation!
|
||||
for (i = 0; i < LCDL_COLUMN; i++)
|
||||
{
|
||||
// Write blank if provided text is shorter than column count.
|
||||
if (i < length)
|
||||
LCDL_WRDATA(sText_p[i]);
|
||||
else
|
||||
LCDL_WRDATA(' ');
|
||||
|
||||
usleep(2000);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
/// \}
|
||||
+409
@@ -0,0 +1,409 @@
|
||||
/**
|
||||
********************************************************************************
|
||||
\file lcd-c5socarm.c
|
||||
|
||||
\brief LCD functions for Altera Cyclone-V HPS LCD
|
||||
|
||||
This implementation uses the Altera Cyclone-V HPS LCD available on
|
||||
Altera Cyclone-V development board(D) for handling LCD module.
|
||||
*******************************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright (c) 2016, B&R Industrial Automation GmbH
|
||||
Copyright (c) 2013, SYSTEC electronic GmbH
|
||||
Copyright (c) 2015, Kalycito Infotech Private Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// includes
|
||||
//------------------------------------------------------------------------------
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <alt_cache.h>
|
||||
#include <alt_interrupt.h>
|
||||
#include <alt_i2c.h>
|
||||
#include <alt_globaltmr.h>
|
||||
#include <alt_timers.h>
|
||||
#include <socal/hps.h>
|
||||
#include <socal/socal.h>
|
||||
|
||||
#include <system.h>
|
||||
#include <sleep.h>
|
||||
#include <trace/trace.h>
|
||||
#include "lcdl.h"
|
||||
|
||||
//============================================================================//
|
||||
// G L O B A L D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// module global vars
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// global function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E D E F I N I T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// const defines
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//TODO Replace the I2C address from system.h
|
||||
#define LCD_I2C_ADDRESS (0x50 >> 1) // I2C address of LCD module
|
||||
#define LCD_I2C_SPEED 40000 // I2C bus speed for accessing LCD module
|
||||
#define LCD_ESCAPE_CHAR 0xfe // Escape character used to prefix commands
|
||||
#define LCD_POS_1ST_LINE 0x00 // LCD cursor position for 1st line
|
||||
#define LCD_POS_2ND_LINE 0x40 // LCD cursor position for 2nd line
|
||||
#define LCD_PRINT_DELAY_US 500 // Delay in us after printing text on LCD
|
||||
#define LCDL_COLUMN 16 // Maximum Column length
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local types
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Commands supported by the LCD display
|
||||
typedef enum
|
||||
{
|
||||
kLcdCmdDisplayOn = 0,
|
||||
kLcdCmdDisplayOff,
|
||||
kLcdCmdSetCursor,
|
||||
kLcdCmdCursorHome,
|
||||
kLcdCmdUnderlineCursorOn,
|
||||
kLcdCmdUnderlineCursorOff,
|
||||
kLcdCmdMoveCursorLeftOnePlace,
|
||||
kLcdCmdMoveCursorRightOnePlace,
|
||||
kLcdCmdBlinkingCursorOn,
|
||||
kLcdCmdBlinkingCursorOff,
|
||||
kLcdCmdBackspace,
|
||||
kLcdCmdClearScreen,
|
||||
kLcdCmdSetContrast,
|
||||
kLcdCmdSetBacklightBrightness,
|
||||
kLcdCmdLoadCustomCharacter,
|
||||
kLcdCmdMoveDisplayOnePlaceToTheLeft,
|
||||
kLcdCmdMoveDisplayOnePlaceToTheRight,
|
||||
kLcdCmdChangeRS232BaudRate,
|
||||
kLcdCmdChangeI2CAddress,
|
||||
kLcdCmdDisplayFirmwareVersionNumber,
|
||||
kLcdCmdDisplayRS232BaudRate,
|
||||
kLcdCmdDisplayI2CAddress,
|
||||
} tLcdCmd;
|
||||
|
||||
// Command description
|
||||
typedef struct
|
||||
{
|
||||
uint8_t command;
|
||||
uint8_t padding;
|
||||
uint16_t executionDuration;
|
||||
} tLcdCmdDesc;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local vars
|
||||
//------------------------------------------------------------------------------
|
||||
ALT_I2C_DEV_t* deviceHandle_l;
|
||||
|
||||
// Descriptions for all supported commands
|
||||
static tLcdCmdDesc lcdCommands_l[] =
|
||||
{
|
||||
{0x41, 0, 100}, // LCD_COMMAND_DISPLAY_ON,
|
||||
{0x42, 0, 100}, // LCD_COMMAND_DISPLAY_OFF,
|
||||
{0x45, 1, 100}, // LCD_COMMAND_SET_CURSOR,
|
||||
{0x46, 0, 1500}, // LCD_COMMAND_CURSOR_HOME,
|
||||
{0x47, 0, 1500}, // LCD_COMMAND_UNDERLINE_CURSOR_ON,
|
||||
{0x48, 0, 1500}, // LCD_COMMAND_UNDERLINE_CURSOR_OFF,
|
||||
{0x49, 0, 100}, // LCD_COMMAND_MOVE_CURSOR_LEFT_ONE_PLACE,
|
||||
{0x4A, 0, 100}, // LCD_COMMAND_MOVE_CURSOR_RIGHT_ONE_PLACE,
|
||||
{0x4B, 0, 100}, // LCD_COMMAND_BLINKING_CURSOR_ON,
|
||||
{0x4C, 0, 100}, // LCD_COMMAND_BLINKING_CURSOR_OFF,
|
||||
{0x4E, 0, 100}, // LCD_COMMAND_BACKSPACE,
|
||||
{0x51, 0, 1500}, // LCD_COMMAND_CLEAR_SCREEN,
|
||||
{0x52, 1, 500}, // LCD_COMMAND_SET_CONTRAST,
|
||||
{0x53, 1, 100}, // LCD_COMMAND_SET_BACKLIGHT_BRIGHTNESS,
|
||||
{0x54, 9, 200}, // LCD_COMMAND_LOAD_CUSTOM_CHARACTER,
|
||||
{0x55, 0, 100}, // LCD_COMMAND_MOVE_DISPLAY_ONE_PLACE_TO_THE_LEFT,
|
||||
{0x56, 0, 100}, // LCD_COMMAND_MOVE_DISPLAY_ONE_PLACE_TO_THE_RIGHT,
|
||||
{0x61, 1, 3000}, // LCD_COMMAND_CHANGE_RS_232_BAUD_RATE,
|
||||
{0x62, 1, 3000}, // LCD_COMMAND_CHANGE_I2C_ADDRESS,
|
||||
{0x70, 0, 4000}, // LCD_COMMAND_DISPLAY_FIRMWARE_VERSION_NUMBER,
|
||||
{0x71, 0, 10000}, // LCD_COMMAND_DISPLAY_RS_232_BAUD_RATE,
|
||||
{0x72, 0, 4000}, // LCD_COMMAND_DISPLAY_I2C_ADDRESS,
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// local function prototypes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static inline ALT_STATUS_CODE sendLcdCommand(ALT_I2C_DEV_t* deviceHdl_p,
|
||||
tLcdCmd command_p,
|
||||
const uint8_t* pArg_p);
|
||||
//============================================================================//
|
||||
// P U B L I C F U N C T I O N S //
|
||||
//============================================================================//
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Initialize the LCD
|
||||
|
||||
This function writes a sequence of initialization parameters to the LCD.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
ALT_I2C_MASTER_CONFIG_t cfg;
|
||||
uint32_t speed;
|
||||
|
||||
// Init I2C module
|
||||
if (alt_i2c_init(ALT_I2C_I2C0, deviceHandle_l) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_enable(deviceHandle_l) != ALT_E_SUCCESS) // Enable I2C module
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_master_config_get(deviceHandle_l, &cfg) != ALT_E_SUCCESS) // Configure I2C module
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_master_config_speed_get(deviceHandle_l, &cfg, (uint32_t*)&speed) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
TRACE("LCD INFO: Current I2C speed = %d Hz.\n", (int)speed);
|
||||
|
||||
if (alt_i2c_master_config_speed_set(deviceHandle_l, &cfg, LCD_I2C_SPEED) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_master_config_speed_get(deviceHandle_l, &cfg, (uint32_t*)&speed) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("LCD INFO: New I2C speed = %d Hz.\n", (int)speed);
|
||||
cfg.addr_mode = ALT_I2C_ADDR_MODE_7_BIT;
|
||||
cfg.restart_enable = ALT_E_TRUE;
|
||||
|
||||
if (alt_i2c_master_config_set(deviceHandle_l, &cfg) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_sda_hold_time_set(deviceHandle_l, 8) != ALT_E_SUCCESS)
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (alt_i2c_master_target_set(deviceHandle_l, LCD_I2C_ADDRESS) != ALT_E_SUCCESS) // Set target display I2C address
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (sendLcdCommand(deviceHandle_l, kLcdCmdDisplayOn, NULL) != ALT_E_SUCCESS) // Turn display on
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (sendLcdCommand(deviceHandle_l, kLcdCmdBlinkingCursorOn, NULL) != ALT_E_SUCCESS) // Turn cursor on
|
||||
{
|
||||
ret = -1;
|
||||
goto Exit;
|
||||
}
|
||||
else
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
Exit:
|
||||
if (ret != 0)
|
||||
{
|
||||
TRACE("LCD ERR: Initialization failed!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Exit the LCD instance
|
||||
|
||||
This function exits the LCD instance.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_exit(void)
|
||||
{
|
||||
lcdl_clear();
|
||||
sendLcdCommand(deviceHandle_l, kLcdCmdDisplayOff, NULL);
|
||||
sendLcdCommand(deviceHandle_l, kLcdCmdBlinkingCursorOff, NULL);
|
||||
alt_i2c_disable(deviceHandle_l);
|
||||
alt_i2c_uninit(deviceHandle_l);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Clear the LCD
|
||||
|
||||
This function clears all lines of the display.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_clear(void)
|
||||
{
|
||||
// Clear screen
|
||||
if (sendLcdCommand(deviceHandle_l, kLcdCmdClearScreen, NULL) != ALT_E_SUCCESS)
|
||||
{
|
||||
TRACE("LCD ERR: Failed to clear screen\n");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Change to specified line
|
||||
|
||||
Changes to specified line of the LCD.
|
||||
|
||||
\param[in] line_p Specifies the line
|
||||
|
||||
\return The function returns 0 if the line is changed successfully, -1 otherwise.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
int lcdl_changeToLine(unsigned int line_p)
|
||||
{
|
||||
uint8_t param;
|
||||
|
||||
if (line_p < 2)
|
||||
param = LCD_POS_1ST_LINE;
|
||||
else
|
||||
param = LCD_POS_2ND_LINE;
|
||||
|
||||
if (sendLcdCommand(deviceHandle_l, kLcdCmdSetCursor, ¶m) != ALT_E_SUCCESS)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Print text to the LCD
|
||||
|
||||
Writes text to the LCD currently selected.
|
||||
|
||||
\param[in] sText_p The text to print
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
void lcdl_printText(const char* sText_p)
|
||||
{
|
||||
ALT_STATUS_CODE halRet = ALT_E_SUCCESS;
|
||||
size_t txtLen = strlen(sText_p);
|
||||
const char padTxt = ' ';
|
||||
|
||||
for (size_t i = 0; i < LCDL_COLUMN; i++)
|
||||
{
|
||||
if (i < txtLen)
|
||||
halRet = alt_i2c_master_transmit(deviceHandle_l,
|
||||
&sText_p[i],
|
||||
1,
|
||||
ALT_E_FALSE,
|
||||
ALT_E_TRUE);
|
||||
else
|
||||
halRet = alt_i2c_master_transmit(deviceHandle_l,
|
||||
&padTxt,
|
||||
1,
|
||||
ALT_E_FALSE,
|
||||
ALT_E_TRUE);
|
||||
|
||||
if (halRet != ALT_E_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================//
|
||||
// P R I V A T E F U N C T I O N S //
|
||||
//============================================================================//
|
||||
/// \name Private Functions
|
||||
/// \{
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
\brief Send command to LCD display
|
||||
|
||||
The function sends a I2C command to the LCD module.
|
||||
|
||||
\param[in,out] deviceHdl_p I2C device
|
||||
\param[in] command_p Opcode of command to be sent
|
||||
\param[in] pArg_p Command parameters or NULL for no parameters
|
||||
|
||||
\return Returns an ALT_STATUS_CODE error code.
|
||||
*/
|
||||
//------------------------------------------------------------------------------
|
||||
static inline ALT_STATUS_CODE sendLcdCommand(ALT_I2C_DEV_t* deviceHdl_p,
|
||||
tLcdCmd command_p,
|
||||
const uint8_t* pArg_p)
|
||||
{
|
||||
ALT_STATUS_CODE halRet = ALT_E_SUCCESS;
|
||||
tLcdCmdDesc lcdCommandDesc = lcdCommands_l[(int)command_p];
|
||||
uint8_t data[10];
|
||||
uint8_t dataLen = 0;
|
||||
|
||||
data[dataLen++] = LCD_ESCAPE_CHAR;
|
||||
data[dataLen++] = lcdCommandDesc.command;
|
||||
for (uint8_t i = 0; i < lcdCommandDesc.padding; i++)
|
||||
data[dataLen++] = pArg_p[i];
|
||||
|
||||
halRet = alt_i2c_master_transmit(deviceHdl_p,
|
||||
data,
|
||||
dataLen,
|
||||
ALT_E_FALSE,
|
||||
ALT_E_TRUE);
|
||||
|
||||
return halRet;
|
||||
}
|
||||
|
||||
/// \}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user