LPCBus' OnBoard and RightBus are now using headers from i2c_apf28_rtdm. Match 1fa3e3670c4e
--- a/LPCBus.py Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus.py Tue Feb 26 14:43:39 2019 +0100
@@ -11,18 +11,23 @@
+LPCBusSourcePath = os.path.join(modpath,"LPCBus") - return open(os.path.join(modpath,"LPCBus",fname)).read()
+ return open(os.path.join(LPCBusSourcePath,fname)).read() Busses = [ "Right", "On Board", "Devices" ]
+# This matches names of .h files in LPCBus with Arch from LPCArch bus_template_code = { plc:GetLocalCode(plc+".c") for plc in ["MC8", "MC9"] }
-bus_code = { "MC9:%s"%bus :
- GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section))
- for section in ["decl", "init", "retrieve", "publish", "cleanup"]}
# This is in case some bus has some special LDFLAGS
LPCBusLDFLAGS = {} # ex: { "MC9:On Board" : "-lonboard" }
@@ -217,30 +222,16 @@
- bus_code = { "MC9:%s"%bus :
- (GetLocalCode("%s.h"%("MC9"))) + GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section)) if section=="decl" else GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section))
- for section in ["decl", "init", "retrieve", "publish", "cleanup"]}
- bus_code = { "MC9:%s"%bus :
- (GetLocalCode("%s.h" % ("GOT"))) +GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section)) if section=="decl" else GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section))
- for section in ["decl", "init", "retrieve", "publish", "cleanup"]}
- elif (arch == "GOT_131" or arch == "GOT_111"):
- bus_code = { "MC9:%s"%bus :
- (GetLocalCode("%s.h" % ("GOT100"))) +GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section)) if section=="decl" else GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section))
- for section in ["decl", "init", "retrieve", "publish", "cleanup"]}
- bus_code = { "MC9:%s"%bus :
- GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section))
- for section in ["decl", "init", "retrieve", "publish", "cleanup"]}
+ bus_code = { "MC9:%s"%bus : + header + GetLocalCode("%s_%s_%s.c"%("MC9",''.join(bus.split()),section)) + for section, header in [ + ("decl",GetLocalCode("%s.h" % headernames[arch])), for module in GetModuleChildren(self):
@@ -313,6 +304,9 @@
module.write(bus_template_code[bus_template_name] % code_str)
- matiec_flags = '"-I%s" -Wno-unused-function'%os.path.abspath(self.GetCTRoot().GetIECLibPath())
- return [(Gen_Module_path, matiec_flags)], LPCBusLDFLAGS.get(BusName, ""), True
+ cflags = '"-I%s" "-I%s" -Wno-unused-function'%( + os.path.abspath(self.GetCTRoot().GetIECLibPath()), # is it still necessary ? + return [(Gen_Module_path, cflags)], LPCBusLDFLAGS.get(BusName, ""), True --- a/LPCBus/MC9_OnBoard_decl.c Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus/MC9_OnBoard_decl.c Tue Feb 26 14:43:39 2019 +0100
@@ -159,27 +159,12 @@
eMBSerialParity mbParity = MB_PAR_NONE; /**< Modbus parity setting: odd, even, none */
-#define MAX_ONBOARD_DEVICES 2
-#define ONBOARD_READ_BUFSIZE 30
-#define ONBOARD_WRITE_BUFSIZE 30
-typedef char onBoardReadBuf_t[MAX_ONBOARD_DEVICES][ONBOARD_READ_BUFSIZE];
-typedef char onBoardWriteBuf_t[MAX_ONBOARD_DEVICES][ONBOARD_WRITE_BUFSIZE];
-typedef char onBoardDev_t[MAX_ONBOARD_DEVICES][2];
+#include "rt_imx_smt_onboard.h"
- onBoardDev_t onBoardDev;
- unsigned long long common_ticktime__;
-#define RTIOC_TYPE_SMT_ONBOARD RTDM_CLASS_EXPERIMENTAL
-#define RTSMT_ONBOARD_RTIOC_INIT _IOR(RTIOC_TYPE_SMT_ONBOARD, 0x00, onBoardBusInit_t)
-#define RTSMT_ONBOARD_RTIOC_READ _IOR(RTIOC_TYPE_SMT_ONBOARD, 0x01, onBoardReadBuf_t)
-#define RTSMT_ONBOARD_RTIOC_WRITE _IOR(RTIOC_TYPE_SMT_ONBOARD, 0x02, onBoardWriteBuf_t)
-static onBoardReadBuf_t onBoardReadBuf;
-static onBoardWriteBuf_t onBoardWriteBuf;
-static onBoardBusInit_t onBoardBusInit;
+static rightReadBuf_t onBoardReadBuf; +static rightWriteBuf_t onBoardWriteBuf; +static rightBusInit_t onBoardBusInit; static int onboardbusfd = -1;
--- a/LPCBus/MC9_OnBoard_init.c Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus/MC9_OnBoard_init.c Tue Feb 26 14:43:39 2019 +0100
@@ -1,14 +1,14 @@
-#define ONBOARDDEVFILENAME "/dev/rtdm/onBoard"
+#define ONBOARDDEVFILENAME "/dev/rtdm/onboard" -bzero(&onBoardReadBuf , sizeof(onBoardReadBuf_t ));
-bzero(&onBoardWriteBuf , sizeof(onBoardWriteBuf_t ));
-bzero(&onBoardBusInit , sizeof(onBoardBusInit_t ));
+bzero(&onBoardReadBuf , sizeof(rightReadBuf_t )); +bzero(&onBoardWriteBuf , sizeof(rightWriteBuf_t )); +bzero(&onBoardBusInit , sizeof(rightBusInit_t )); onBoardBusInit.common_ticktime__ = common_ticktime__;
-#define onBoardDev (onBoardBusInit.onBoardDev)
+#define onBoardDev (onBoardBusInit.rightI2CMod) @@ -24,7 +24,7 @@
-for(i=0; i<MAX_ONBOARD_DEVICES; i++) {
+for(i=0; i<MAX_RIGHT_MODULES; i++) { switch(onBoardDev[i][1]) {
@@ -34,9 +34,9 @@
strerror(-onboardbusfd));
- err = ioctl(onboardbusfd, RTSMT_ONBOARD_RTIOC_INIT, &onBoardBusInit);
+ err = ioctl(onboardbusfd, RTSMT_RTIOC_INIT, &onBoardBusInit); - printf("error while RTSMT_ONBOARD_RTIOC_INIT, %%s\n", strerror(-err));
+ printf("error while RTSMT_RTIOC_INIT, %%s\n", strerror(-err)); --- a/LPCBus/MC9_OnBoard_publish.c Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus/MC9_OnBoard_publish.c Tue Feb 26 14:43:39 2019 +0100
@@ -2,5 +2,5 @@
- ioctl(onboardbusfd, RTSMT_ONBOARD_RTIOC_WRITE, &onBoardWriteBuf);
+ ioctl(onboardbusfd, RTSMT_RTIOC_WRITE, &onBoardWriteBuf); --- a/LPCBus/MC9_OnBoard_retrieve.c Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus/MC9_OnBoard_retrieve.c Tue Feb 26 14:43:39 2019 +0100
@@ -1,6 +1,6 @@
- ioctl(onboardbusfd, RTSMT_ONBOARD_RTIOC_READ, &onBoardReadBuf);
+ ioctl(onboardbusfd, RTSMT_RTIOC_READ, &onBoardReadBuf); --- a/LPCBus/MC9_Right_decl.c Fri Feb 22 10:01:28 2019 +0100
+++ b/LPCBus/MC9_Right_decl.c Tue Feb 26 14:43:39 2019 +0100
@@ -1,33 +1,7 @@
-/* LPCBus confnode includes */
-#define RIGHT_READ_BUFSIZE 30 /**< Right bus read buffer size */
-#define RIGHT_WRITE_BUFSIZE 30 /**< Right bus write buffer size */
-#define MAX_RIGHT_MODULES 8
-/**< Buffers for reading data from right bus modules */
-typedef char rightReadBuf_t[MAX_RIGHT_MODULES][RIGHT_READ_BUFSIZE];
-/**< Buffers for writing data to right bus modules */
-typedef char rightWriteBuf_t[MAX_RIGHT_MODULES][RIGHT_WRITE_BUFSIZE];
-/**< Tables containing information about connected modules
- on right bus (initialized by Composer) */
-typedef char rightI2CMod_t[MAX_RIGHT_MODULES][2];
- rightI2CMod_t rightI2CMod;
- unsigned long long common_ticktime__;
-#define RTIOC_TYPE_SMT RTDM_CLASS_EXPERIMENTAL
-#define RTSMT_RTIOC_INIT _IOR(RTIOC_TYPE_SMT, 0x00, rightBusInit_t)
-//#define RTSMT_RTIOC_CLEAN _IOR(RTIOC_TYPE_SMT, 0x01, int)
-#define RTSMT_RTIOC_READ _IOR(RTIOC_TYPE_SMT, 0x02, rightReadBuf_t)
-#define RTSMT_RTIOC_WRITE _IOR(RTIOC_TYPE_SMT, 0x03, rightWriteBuf_t)
+#include "rt_imx_smt_right.h" static rightReadBuf_t rightReadBuf;
static rightWriteBuf_t rightWriteBuf;