first commit

This commit is contained in:
2026-09-30 21:17:41 -06:00
commit 07244fc761
57 changed files with 30094 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
#include "../src/atom_bridge.h"
#include "CmpStd.h"
#include "CmpErrors.h"
#include "CmpItf.h"
#include "CmpAtomModbusDep.h"
void CDECL CDECL_EXT atmbcall_cext(atmbcall_cext_struct *p)
{
p->atMbCall_cext = ab_call(
p->command,
p->handle,
p->ipAddress,
p->port,
p->unitId,
p->functionCode,
p->startAddress,
p->quantity,
p->pData,
p->dataCapacity,
p->pStatus,
p->statusCapacity,
p->nowMs,
p->connectTimeoutMs,
p->responseTimeoutMs,
p->retryDelayMs);
}
#include "../src/atom_mb.c"
#include "../src/atom_bridge.c"
+70
View File
@@ -0,0 +1,70 @@
/**
* <interfacename>CmpAtomModbus</interfacename>
* <description></description>
*
* <copyright></copyright>
*/
SET_INTERFACE_NAME(`CmpAtomModbus')
/** EXTERN LIB SECTION BEGIN **/
/* Comments are ignored for m4 compiler so restructured text can be used. changecom(`/*', `*/') */
#ifdef __cplusplus
extern "C" {
#endif
/**
* <description>
* Create FUNCTION atMbCall_cext returning UDINT, paste this declaration.
* Properties > Build > External implementation must be selected.
* Library filename and Project Information title: CmpAtomModbus.
* This declaration is the SINGLE external entry point for the C engine.
* </description>
* <element name="atMbCall_cext" type=OUT></element>
* <element name="command" type=IN></element>
* <element name="handle" type=IN></element>
* <element name="ipAddress" type=IN></element>
* <element name="port" type=IN></element>
* <element name="unitId" type=IN></element>
* <element name="functionCode" type=IN></element>
* <element name="startAddress" type=IN></element>
* <element name="quantity" type=IN></element>
* <element name="pData" type=IN></element>
* <element name="dataCapacity" type=IN></element>
* <element name="pStatus" type=IN></element>
* <element name="statusCapacity" type=IN></element>
* <element name="nowMs" type=IN></element>
* <element name="connectTimeoutMs" type=IN></element>
* <element name="responseTimeoutMs" type=IN></element>
* <element name="retryDelayMs" type=IN></element>
*/
typedef struct tagatmbcall_cext_struct
{
RTS_IEC_UDINT command;
RTS_IEC_UDINT handle;
RTS_IEC_DWORD ipAddress;
RTS_IEC_UINT port;
RTS_IEC_BYTE unitId;
RTS_IEC_BYTE functionCode;
RTS_IEC_UINT startAddress;
RTS_IEC_UINT quantity;
RTS_IEC_WORD *pData;
RTS_IEC_UDINT dataCapacity;
RTS_IEC_UDINT *pStatus;
RTS_IEC_UDINT statusCapacity;
RTS_IEC_ULINT nowMs;
RTS_IEC_UDINT connectTimeoutMs;
RTS_IEC_UDINT responseTimeoutMs;
RTS_IEC_UDINT retryDelayMs;
RTS_IEC_UDINT atMbCall_cext;
} atmbcall_cext_struct;
DEF_API(`void',`CDECL',`atmbcall_cext',`(atmbcall_cext_struct *p)',1,0x709EE65B,0x00020000)
#ifdef __cplusplus
}
#endif
/** EXTERN LIB SECTION END **/
+81
View File
@@ -0,0 +1,81 @@
#include "../src/atom_bridge.h"
/*****************************************************************************
* Copyright: Copyright CODESYS Development GmbH
* Program: Extension API for the Linux SL products
******************************************************************************/
#include "CmpStd.h"
#include DEP_H
USE_STMT
DLL_DECL int CDECL ComponentEntry(INIT_STRUCT *pInitStruct)
/* Used to exchange function pointers between component manager and components.
Called at startup for each component.
pInitStruct: IN Pointer to structure with:
pfExportFunctions OUT Pointer to function that exports component functions
pfImportFunctions OUT Pointer to function that imports functions from other components
pfGetVersion OUT Pointer to function to get component version
pfRegisterAPI IN Pointer to component manager function to register a API function
pfGetAPI IN Pointer to component manager function to get a API function
pfCallHook IN Pointer to component manager function to call a hook function
Return ERR_OK if library could be initialized, else error code
*/
{
pInitStruct->CmpId = COMPONENT_ID;
pInitStruct->pfExportFunctions = ExportFunctions;
pInitStruct->pfImportFunctions = ImportFunctions;
pInitStruct->pfGetVersion = CmpGetVersion;
pInitStruct->pfHookFunction = HookFunction;
pInitStruct->pfCreateInstance = NULL;
pInitStruct->pfDeleteInstance = NULL;
s_pfCMRegisterAPI = pInitStruct->pfCMRegisterAPI;
s_pfCMRegisterAPI2 = pInitStruct->pfCMRegisterAPI2;
s_pfCMGetAPI = pInitStruct->pfCMGetAPI;
s_pfCMGetAPI2 = pInitStruct->pfCMGetAPI2;
s_pfCMCallHook = pInitStruct->pfCMCallHook;
s_pfCMRegisterClass = pInitStruct->pfCMRegisterClass;
s_pfCMCreateInstance = pInitStruct->pfCMCreateInstance;
return ERR_OK;
}
/**
* <description>Publish exported functions to the component manager, to make them available for other components.
* Use generated macro EXPORT_STMT.</description>
* <result>ERR_OK or error code in case of error</result>
*/
static int CDECL ExportFunctions(void)
{
/* Macro to export functions */
EXPORT_STMT;
return ERR_OK;
}
/**
* <description>Import function pointers from other components. Use generated macro IMPORT_STMT.</description>
* <result>ERR_OK or error code if function name could not be resolved</result>
*/
static int CDECL ImportFunctions(void)
{
/* Macro to import functions */
IMPORT_STMT;
return ERR_OK;
}
/**
* <description>Return the version of our component.</description>
* <result>Version as defined in dep file</result>
*/
static RTS_UI32 CDECL CmpGetVersion(void)
{
return CMP_VERSION;
}
static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_UINTPTR ulParam2)
{
if (ulHook == CH_EXIT) ab_shutdown();
return ERR_OK;
}
+13
View File
@@ -0,0 +1,13 @@
# Generated from supplied ExtensionSDK; native build on ARM64 Pi.
SDKDIR ?= ../sdk/ExtensionSDK
MAJORVER=0
MINORVER=2
CMPVERSION=0x00020000
# Local development ID; check no other component uses this ID.
CMPID=0x2001
DOS2UNIX=dos2unix
M4=m4
CC ?= gcc
# The SDK otherwise includes CmpFrame in its component identity wildcard.
override CSRC := CmpAtomModbus.c
include $(SDKDIR)/makefile