pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS

Difference between
modified post e1896bc660 by Anonymous on Wed 13th Mar 2019 11:41
original post 6dad3 by Anonymous on Tue 12th Mar 2019 12:31
Download diff
Show old version | new version | both versions

    
11
diff --git a/ptxdist/local_src/ecu01-codesys/linbus/Linbus.c b/ptxdist/local_src/ecu01-codesys/linbus/Linbus.c
22
index 822d132..96e2d73 100755
33
--- a/ptxdist/local_src/ecu01-codesys/linbus/Linbus.c
44
+++ b/ptxdist/local_src/ecu01-codesys/linbus/Linbus.c
55
@@ -1,10 +1,13 @@
66
 /******************************************************************************/
77
-/*!
88
-\brief             Library for Linbus Protocol
99
+/*!
1010
+\file              $URL: https://subversion.eckelmann.local/svn/max/quantron_a/trunk/src/codesys/qa/QA.c $
1111
+
1212
+\brief             Schnittstellenmodul Quantron-A Funktionsbibliothek
1313
1414
-\author            $Author: Gudert
1515
+\author            $Author: HILTENKA $
1616
+\date              $Date: 2011-11-24 12:26:30 +0100 (Do, 24 Nov 2011) $
1717
1818
-\version           $Rev: $
1919
+\version           $Rev: 2090 $
2020
2121
 \b                 ECKELMANN INDUSTRIEAUTOMATION, WIESBADEN\n
2222
                    © Copyright 2009
2323
@@ -15,30 +18,150 @@
2424
 @Includes
2525
 *******************************************************************************/
2626
2727
+#include <string.h>
2828
+#include <sys/mount.h>
2929
+#include <linux/fs.h>
3030
+#include <stdio.h>
3131
+#include <stdlib.h>
3232
+
3333
+#include <time.h>
3434
+#include <fcntl.h>
3535
+#include <unistd.h>
3636
+#include <sys/time.h>
3737
+#include <sys/types.h>
3838
+#include <sys/stat.h>
3939
+#include <termios.h>
4040
+
4141
+/* Headerfiles Codesys-Componenten-Lib */
4242
 #include "CmpStd.h"
4343
 #include "CmpErrors.h"
4444
 #include "CmpItf.h"
4545
-#include "LinbusDep.h"
4646
4747
+/* Headerfile Dependend */
4848
+#include "LinbusDep.h"
4949
 #include "linbus_imp.h"
5050
5151
5252
+/*******************************************************************************
5353
+@Konstanten (modullokal)
5454
+*******************************************************************************/
5555
+
5656
+#define DEBUG_FUNC                 DEBUG_PRINT
5757
+#ifndef DEBUG_FUNC
5858
+   #define DEBUG_FUNC(a...)
5959
+#endif
6060
+#ifndef DEBUG_ITF_FUNC
6161
+   #define DEBUG_ITF_FUNC(a...)
6262
+#endif
6363
+#ifndef DEBUG_INTERLAL_FUNC
6464
+   #define DEBUG_INTERLAL_FUNC(a...)
6565
+#endif
6666
+
6767
+
6868
+
6969
+
7070
+/*******************************************************************************
7171
+@Typdefinitionen (modullokal)
7272
+*******************************************************************************/
7373
+
7474
+
7575
+typedef struct LIN_SLAVE_DATA_R {
7676
+    LIN_SLAVE_VERSION_TR tVers;		/* Version */
7777
+    LIN_SLAVE_VALUE_TR   tValue;		/* FaceValue */
7878
+    unsigned char  ucSlaveOnline;		/* Verbindungsstatus */
7979
+    unsigned char  ucSetNewValue;   	/* Flag fuer neuen Sollwert */
8080
+    unsigned short usSetValue;      	/* Sollwert */
8181
+    unsigned char  ucSetControl;    	/* Steuerbits fuer Sollwert */
8282
+}  LIN_SLAVE_DATA_TR;
8383
+/*******************************************************************************
8484
+@Konstanten (modullokal)
8585
+*******************************************************************************/
8686
+
8787
+#define DEBUG_FUNC                 DEBUG_PRINT
8888
+#ifndef DEBUG_FUNC
8989
+   #define DEBUG_FUNC(a...)
9090
+#endif
9191
+#ifndef DEBUG_ITF_FUNC
9292
+   #define DEBUG_ITF_FUNC(a...)
9393
+#endif
9494
+#ifndef DEBUG_INTERLAL_FUNC
9595
+   #define DEBUG_INTERLAL_FUNC(a...)
9696
+#endif
9797
+
9898
+#define WORKING_DIR_LEN            100
9999
+#define STORAGE_NAME_LEN            40
100100
+#define MNT_POINT_NAME_LEN          40
101101
+#define MNT_DEV_CNT                  4
102102
+#define MNT_DEV_NAME_LEN            40
103103
+#define FILENAME_LEN                40
104104
+
105105
+#define QADRV_VERSION_LEN           20
106106
+
107107
+/*******************************************************************************
108108
+@Variablen (modullokal)
109109
+*******************************************************************************/
110110
+
111111
+
112112
+/*******************************************************************************
113113
+@Makros (modullokal)
114114
+*******************************************************************************/
115115
+
116116
+/*******************************************************************************
117117
+@Prototypen der lokalen Funktionen
118118
+*******************************************************************************/
119119
+static int lin_getslaveversion( void );
120120
+static int lin_getslavefacevalue( void );
121121
+static int lin_setslavevalue( void );
122122
+static int lin_clrslaveaddr( void );
123123
+static int lin_setslaveaddr( int iSlave );
124124
+static void lin_master_thread(SYS_TASK_PARAM *ptp);
125125
+static int lin_missing_slave( void );
126126
+static void lin_rx_thread(SYS_TASK_PARAM *ptp);
127127
+static int lin_recv( unsigned char *pucLinData, int iLinByteCnt, int iTimeout );
128128
+static int lin_recv_message( unsigned char *pucLinMsgData, int iLinMsgLen ) ;
129129
+static int lin_send( unsigned char *pucLinData, int iLinBytesCnt );
130130
+static int lin_send_breakbyte( void );
131131
+static int lin_send_message( unsigned char *pucLinMsgData, int iLinMsgLen );
132132
+static unsigned char lin_pidbyte( unsigned char ucVal );
133133
+static unsigned char lin_checksum( unsigned char *pucData, int iDataLen );
134134
+static int lin_master_alive( unsigned char ucNextFreeAdr, unsigned char ucSlaves, unsigned char ucAliveFlags );
135135
+static int lin_reset_all( void );
136136
+static int lin_set_value( unsigned char ucAdr, unsigned short usSollPos, unsigned char ucControlFlags );
137137
+static int lin_face_value( unsigned char ucAdr, LIN_SLAVE_DATA_TR *ptLinSlaveData  );
138138
+static int lin_get_version( unsigned char ucAdr, LIN_SLAVE_DATA_TR *ptLinSlaveData  );
139139
 static IBase* CDECL CreateInstance(CLASSID cid, RTS_RESULT *pResult);
140140
 static RTS_RESULT CDECL DeleteInstance(IBase *pIBase);
141141
 static int CDECL ExportFunctions(void);
142142
 static int CDECL ImportFunctions(void);
143143
 static RTS_UI32 CDECL CmpGetVersion(void);
144144
 static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_UINTPTR ulParam2);
145145
-static void GetSettings( void );
146146
+static void GetQASettings( void );
147147
148148
 USE_STMT
149149
150150
+USE_SysSemCreate
151151
+USE_SysSemDelete
152152
+USE_SysSemEnter
153153
+USE_SysSemLeave
154154
+USE_SysTaskCreate
155155
+USE_SysTaskResume
156156
+USE_SysTaskSetExit
157157
+USE_SysTaskJoin
158158
+USE_SysTaskExit
159159
+USE_SysTaskWaitSleep
160160
+USE_SysTaskDestroy
161161
+USE_SysTaskEnter
162162
+USE_SysTaskLeave
163163
+USE_SysTaskEnd
164164
+
165165
+
166166
+
167167
 /******************************************************************************/
168168
 /*!
169169
 \fn            ComponentEntry
170170
171171
 \brief         Used to exchange function pointers between component manager and components.\n
172172
-               Called at startup for each component.
173173
+               Called at startup for each component.
174174
175175
 \return        Return  ERR_OK if library could be initialized, else error code
176176
177177
@@ -71,8 +194,7 @@ DLL_DECL int CDECL ComponentEntry(INIT_STRUCT *pInitStruct)
178178
179179
    return ERR_OK;
180180
181181
-}  /* eofn: ComponentEntry */
182182
-
183183
+}  /* eofn: ComponentEntry */
184184
185185
 /******************************************************************************/
186186
 /*!
187187
@@ -89,7 +211,7 @@ DLL_DECL int CDECL ComponentEntry(INIT_STRUCT *pInitStruct)
188188
 static IBase* CDECL CreateInstance(CLASSID cid, RTS_RESULT *pResult)
189189
 {
190190
    return NULL;
191191
-}  /* eofn: CreateInstance */
192192
+}  /* eofn: CreateInstance */
193193
194194
 /******************************************************************************/
195195
 /*!
196196
@@ -99,20 +221,20 @@ static IBase* CDECL CreateInstance(CLASSID cid, RTS_RESULT *pResult)
197197
198198
 \return        ERR_NOTIMPLEMENTED
199199
200200
-\param         pIBase   -
201201
+\param         pIBase   -
202202
203203
 *******************************************************************************/
204204
 static RTS_RESULT CDECL DeleteInstance(IBase *pIBase)
205205
 {
206206
    return ERR_NOTIMPLEMENTED;
207207
208208
-}  /* eofn: DeleteInstance */
209209
+}  /* eofn: DeleteInstance */
210210
211211
 /******************************************************************************/
212212
 /*!
213213
 \fn            ExportFunctions
214214
215215
-\brief         Export function pointers as api
216216
+\brief         Export function pointers as api
217217
218218
 \return        ERR_OK = successfull
219219
220220
@@ -124,15 +246,15 @@ static int CDECL ExportFunctions(void)
221221
    /* Macro to export functions */
222222
    EXPORT_STMT;
223223
224224
-    return ERR_OK;
225225
+	return ERR_OK;
226226
227227
-}  /* eofn: ExportFunctions */
228228
+}  /* eofn: ExportFunctions */
229229
230230
 /******************************************************************************/
231231
 /*!
232232
 \fn            ImportFunctions
233233
234234
-\brief         Get function pointers of other components
235235
+\brief         Get function pointers of other components
236236
237237
 \return        ERR_OK = successfull
238238
239239
@@ -146,13 +268,13 @@ static int CDECL ImportFunctions(void)
240240
241241
    return ERR_OK;
242242
243243
-}  /* eofn: ImportFunctions */
244244
+}  /* eofn: ImportFunctions */
245245
246246
 /******************************************************************************/
247247
 /*!
248248
 \fn            CmpGetVersion
249249
250250
-\brief         Get Versionnumber
251251
+\brief         Get Versionnumber
252252
253253
 \return        Versionnumber
254254
255255
@@ -163,27 +285,7 @@ static RTS_UI32 CDECL CmpGetVersion(void)
256256
 {
257257
    return CMP_VERSION;
258258
259259
-}  /* eofn: CmpGetVersion */
260260
-
261261
-/******************************************************************************/
262262
-
263263
-/******************************************************************************/
264264
-/*!
265265
-\fn            GetSettings
266266
-
267267
-\brief         Einlesen der Konfigurationseintrage
268268
-
269269
-\return        keine
270270
-
271271
-\param         keine
272272
-
273273
-*******************************************************************************/
274274
-static void GetSettings( void )
275275
-{
276276
-
277277
-    return;
278278
-
279279
-}	/* eofn: GetQASettings */
280280
+}  /* eofn: CmpGetVersion */
281281
282282
 /******************************************************************************/
283283
 /*!
284284
@@ -193,7 +295,7 @@ static void GetSettings( void )
285285
286286
 \return        0
287287
288288
-\param         ulHook   -\n
289289
+\param         ulHook   -\n
290290
                ulParam1 -\n
291291
                ulParam2 -\n
292292
293293
@@ -205,16 +307,11 @@ static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_
294294
       case CH_INIT_SYSTEM:
295295
          break;
296296
297297
-        case CH_INIT:
298298
-
299299
-       /********************************/
300300
-       /* Konfigurationsdaten einlesen */
301301
-       /********************************/
302302
-       GetSettings();
303303
+		case CH_INIT:
304304
305305
          break;
306306
307307
-       case CH_INIT2:
308308
+	   case CH_INIT2:
309309
          break;
310310
311311
       case CH_INIT3:
312312
@@ -228,23 +325,17 @@ static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_
313313
314314
       /* Cyclic */
315315
       case CH_COMM_CYCLE:
316316
-
317317
          break;
318318
319319
       case CH_EXIT_COMM:
320320
          break;
321321
       case CH_EXIT_TASKS:
322322
          break;
323323
-       case CH_EXIT3:
324324
-           break;
325325
+	   case CH_EXIT3:
326326
+		   break;
327327
       case CH_EXIT2:
328328
          break;
329329
-        case CH_EXIT:
330330
-
331331
-       /*******************************************************/
332332
-       /* LIN-Schnittstelle schliessen falls geoeffnet wurde */
333333
-       /*******************************************************/
334334
-       LIN_Close();
335335
+		case CH_EXIT:
336336
337337
          break;
338338
       case CH_EXIT_SYSTEM:
339339
@@ -254,90 +345,89 @@ static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_
340340
    }
341341
    return 0;
342342
343343
-}  /* eofn: HookFunction */
344344
+}  /* eofn: HookFunction */
345345
+
346346
+
347347
348348
-/***********************************/
349349
-/*! Funktionsschnittstelle LIN-BUS */
350350
-/***********************************/
351351
352352
 void CDECL CDECL_EXT lin_open(lin_open_struct *p)
353353
 {
354354
-	p->Lin_Open = LIN_Open( p->iSlaveCount, p->iIntervall );
355355
+    p->Lin_Open = LIN_Open( p->iSlaveCount, p->iIntervall );
356356
357357
 }  /* eofn: lin_open */
358358
359359
 void CDECL CDECL_EXT lin_close(lin_close_struct *p)
360360
 {
361361
-	p->Lin_Close = LIN_Close();
362362
+    p->Lin_Close = LIN_Close();
363363
364364
 }  /* eofn: lin_close */
365365
366366
 void CDECL CDECL_EXT lin_getmasterstate(lin_getmasterstate_struct *p)
367367
 {
368368
-	p->Lin_GetMasterState = LIN_GetMasterState();
369369
+    p->Lin_GetMasterState = LIN_GetMasterState();
370370
371371
 }  /* eofn: lin_getmasterstate */
372372
373373
 void CDECL CDECL_EXT lin_getslavestate(lin_getslavestate_struct *p)
374374
 {
375375
-	p->Lin_GetSlaveState = LIN_GetSlaveState( p->iSlave );
376376
+    p->Lin_GetSlaveState = LIN_GetSlaveState( p->iSlave );
377377
378378
 }  /* eofn: lin_getslavestate */
379379
380380
 void CDECL CDECL_EXT lin_resetaddress(lin_resetaddress_struct *p)
381381
 {
382382
-	p->Lin_ResetAddress = LIN_ResetAddress();
383383
+    p->Lin_ResetAddress = LIN_ResetAddress();
384384
385385
 }  /* eofn: lin_resetaddress */
386386
387387
 void CDECL CDECL_EXT lin_setaddress(lin_setaddress_struct *p)
388388
 {
389389
-	p->Lin_SetAddress = LIN_SetAddress();
390390
+    p->Lin_SetAddress = LIN_SetAddress();
391391
392392
 }  /* eofn: lin_setaddress */
393393
394394
 void CDECL CDECL_EXT lin_getversion(lin_getversion_struct *p)
395395
 {
396396
-	LIN_SLAVE_VERSION_TR tLinSlaveVersion;
397397
+    LIN_SLAVE_VERSION_TR tLinSlaveVersion;
398398
399399
-	if (( p->Lin_GetVersion = LIN_GetVersion( p->iSlave,  &tLinSlaveVersion ) ) == 0 ) {
400400
+    if (( p->Lin_GetVersion = LIN_GetVersion( p->iSlave,  &tLinSlaveVersion ) ) == 0 ) {
401401
402402
 		/* Daten uebernehmen */
403403
-		p->ptVersion->bRelease   = tLinSlaveVersion.ucRelease;
404404
+        p->ptVersion->bRelease   = tLinSlaveVersion.ucRelease;
405405
 		p->ptVersion->bVersion   = tLinSlaveVersion.ucVersion;
406406
 		p->ptVersion->bVariant   = tLinSlaveVersion.ucVariant;
407407
 		p->ptVersion->bFormat    = tLinSlaveVersion.ucFormat;
408408
 		p->ptVersion->wManCode   = tLinSlaveVersion.usManCode;
409409
 		p->ptVersion->wFunction  = tLinSlaveVersion.usFunction;
410410
-	}
411411
+
412412
+    }
413413
414414
 }  /* eofn: lin_getversion */
415415
416416
 void CDECL CDECL_EXT lin_getfacevalue(lin_getfacevalue_struct *p)
417417
 {
418418
-	LIN_SLAVE_VALUE_TR tLinSlaveValue;
419419
+    LIN_SLAVE_VALUE_TR tLinSlaveValue;
420420
421421
-	if (( p->Lin_GetFaceValue = LIN_GetFaceValue( p->iSlave, &tLinSlaveValue ) ) == 0 ) {
422422
+    if (( p->Lin_GetFaceValue = LIN_GetFaceValue( p->iSlave, &tLinSlaveValue ) ) == 0 ) {
423423
424424
 		/* Daten uebernehmen */
425425
-		p->ptValue->bFormat   = tLinSlaveValue.ucFormat;
426426
+        p->ptValue->bFormat   = tLinSlaveValue.ucFormat;
427427
 		p->ptValue->wIstPos   = tLinSlaveValue.usIstPos;
428428
 		p->ptValue->bStatus   = tLinSlaveValue.ucStatus;
429429
 		p->ptValue->bErrorCnt = tLinSlaveValue.ucErrorCnt;
430430
-	}
431431
+
432432
+    }
433433
434434
 }  /* eofn: lin_getfacevalue */
435435
436436
 void CDECL CDECL_EXT lin_setvalue(lin_setvalue_struct *p)
437437
 {
438438
-	p->Lin_SetValue = LIN_SetValue( p->iSlave, p->wPosition, p->bPosFlags, p->bDeviceTyp );
439439
+   p->Lin_SetValue = LIN_SetValue( p->iSlave, p->wPosition, p->bPosFlags, p->bDeviceTyp );
440440
441441
-}  /* eofn: lin_setvalue */
442442
+}  /* eofn: lin_setvalue */
443443
444444
 void CDECL CDECL_EXT lin_mastersetvalue(lin_mastersetvalue_struct *p)
445445
 {
446446
-	p->Lin_MasterSetValue = LIN_MasterSetValue( p->wPosition, p->bPosFlags, p->bDeviceTyp );
447447
-
448448
-}  /* eofn: lin_mastersetvalue */
449449
+   p->Lin_MasterSetValue = LIN_MasterSetValue( p->wPosition, p->bPosFlags, p->bDeviceTyp );
450450
451451
-/*--- eof  ---*/
452452
+}  /* eofn: lin_mastersetvalue */
453453
diff --git a/ptxdist/local_src/ecu01-codesys/linbus/LinbusItf.m4 b/ptxdist/local_src/ecu01-codesys/linbus/LinbusItf.m4
454454
index b742b61..470b6af 100755
455455
--- a/ptxdist/local_src/ecu01-codesys/linbus/LinbusItf.m4
456456
+++ b/ptxdist/local_src/ecu01-codesys/linbus/LinbusItf.m4
457457
@@ -15,17 +15,6 @@ extern "C" {
458458
 #endif
459459
460460
 /**
461461
- * <description>T_LIN_SLAVE_VALUE</description>
462462
- */
463463
-typedef struct tagT_LIN_SLAVE_VALUE
464464
-{
465465
-	RTS_IEC_BYTE bFormat;
466466
-	RTS_IEC_WORD wIstPos;
467467
-	RTS_IEC_BYTE bStatus;
468468
-	RTS_IEC_BYTE bErrorCnt;
469469
-} T_LIN_SLAVE_VALUE;
470470
-
471471
-/**
472472
  * <description>T_LIN_SLAVE_VERSION</description>
473473
  */
474474
 typedef struct tagT_LIN_SLAVE_VERSION
475475
@@ -39,6 +28,17 @@ typedef struct tagT_LIN_SLAVE_VERSION
476476
 } T_LIN_SLAVE_VERSION;
477477
478478
 /**
479479
+ * <description>T_LIN_SLAVE_VALUE</description>
480480
+ */
481481
+typedef struct tagT_LIN_SLAVE_VALUE
482482
+{
483483
+	RTS_IEC_BYTE bFormat;
484484
+	RTS_IEC_WORD wIstPos;
485485
+	RTS_IEC_BYTE bStatus;
486486
+	RTS_IEC_BYTE bErrorCnt;
487487
+} T_LIN_SLAVE_VALUE;
488488
+
489489
+/**
490490
  * Close Lin-Bus device
491491
  */
492492
 typedef struct taglin_close_struct
493493
@@ -46,7 +46,7 @@ typedef struct taglin_close_struct
494494
 	RTS_IEC_DINT Lin_Close;				/* VAR_OUTPUT */
495495
 } lin_close_struct;
496496
497497
-DEF_API(`void',`CDECL',`lin_close',`(lin_close_struct *p)',1,0x172A91EA,0x01000000)
498498
+DEF_API(`void',`CDECL',`lin_close',`(lin_close_struct *p)',1,RTSITF_GET_SIGNATURE(0x172A91EA, 0),0x01000000)
499499
500500
 /**
501501
  * Get face value for a slave
502502
@@ -58,7 +58,7 @@ typedef struct taglin_getfacevalue_struct
503503
 	RTS_IEC_DINT Lin_GetFaceValue;		/* VAR_OUTPUT */
504504
 } lin_getfacevalue_struct;
505505
506506
-DEF_API(`void',`CDECL',`lin_getfacevalue',`(lin_getfacevalue_struct *p)',1,0xF2C42FE1,0x01000000)
507507
+DEF_API(`void',`CDECL',`lin_getfacevalue',`(lin_getfacevalue_struct *p)',1,RTSITF_GET_SIGNATURE(0xF2C42FE1, 0),0x01000000)
508508
509509
 /**
510510
  * Get status of the master
511511
@@ -68,7 +68,7 @@ typedef struct taglin_getmasterstate_struct
512512
 	RTS_IEC_DINT Lin_GetMasterState;	/* VAR_OUTPUT */
513513
 } lin_getmasterstate_struct;
514514
515515
-DEF_API(`void',`CDECL',`lin_getmasterstate',`(lin_getmasterstate_struct *p)',1,0xD369816F,0x01000000)
516516
+DEF_API(`void',`CDECL',`lin_getmasterstate',`(lin_getmasterstate_struct *p)',1,RTSITF_GET_SIGNATURE(0xD369816F, 0),0x01000000)
517517
518518
 /**
519519
  * Get state of the slave
520520
@@ -79,7 +79,7 @@ typedef struct taglin_getslavestate_struct
521521
 	RTS_IEC_DINT Lin_GetSlaveState;		/* VAR_OUTPUT */
522522
 } lin_getslavestate_struct;
523523
524524
-DEF_API(`void',`CDECL',`lin_getslavestate',`(lin_getslavestate_struct *p)',1,0x5B508641,0x01000000)
525525
+DEF_API(`void',`CDECL',`lin_getslavestate',`(lin_getslavestate_struct *p)',1,RTSITF_GET_SIGNATURE(0x5B508641, 0),0x01000000)
526526
527527
 /**
528528
  * Get version of the slave
529529
@@ -91,7 +91,7 @@ typedef struct taglin_getversion_struct
530530
 	RTS_IEC_DINT Lin_GetVersion;		/* VAR_OUTPUT */
531531
 } lin_getversion_struct;
532532
533533
-DEF_API(`void',`CDECL',`lin_getversion',`(lin_getversion_struct *p)',1,0x8E7D4D48,0x01000000)
534534
+DEF_API(`void',`CDECL',`lin_getversion',`(lin_getversion_struct *p)',1,RTSITF_GET_SIGNATURE(0x8E7D4D48, 0),0x01000000)
535535
536536
 /**
537537
  * Set value for all clients
538538
@@ -100,11 +100,11 @@ typedef struct taglin_mastersetvalue_struct
539539
 {
540540
 	RTS_IEC_WORD wPosition;				/* VAR_INPUT */	/* new value */
541541
 	RTS_IEC_BYTE bPosFlags;				/* VAR_INPUT */	/* flags to set the new value */
542542
-	RTS_IEC_BYTE bDeviceTyp;			/* VAR_INPUT */	/* flags to set the new value */
543543
+	RTS_IEC_BYTE bDeviceTyp;			/* VAR_INPUT */	/* Device Type */
544544
 	RTS_IEC_DINT Lin_MasterSetValue;	/* VAR_OUTPUT */
545545
 } lin_mastersetvalue_struct;
546546
547547
-DEF_API(`void',`CDECL',`lin_mastersetvalue',`(lin_mastersetvalue_struct *p)',1,0xA5CE5514,0x01000000)
548548
+DEF_API(`void',`CDECL',`lin_mastersetvalue',`(lin_mastersetvalue_struct *p)',1,RTSITF_GET_SIGNATURE(0xA5CE5514, 0),0x01000000)
549549
550550
 /**
551551
  * Open Lin-Bus device
552552
@@ -116,7 +116,7 @@ typedef struct taglin_open_struct
553553
 	RTS_IEC_DINT Lin_Open;				/* VAR_OUTPUT */
554554
 } lin_open_struct;
555555
556556
-DEF_API(`void',`CDECL',`lin_open',`(lin_open_struct *p)',1,0x97229571,0x01000000)
557557
+DEF_API(`void',`CDECL',`lin_open',`(lin_open_struct *p)',1,RTSITF_GET_SIGNATURE(0x97229571, 0),0x01000000)
558558
559559
 /**
560560
  * Reset slave adress
561561
@@ -126,7 +126,7 @@ typedef struct taglin_resetaddress_struct
562562
 	RTS_IEC_DINT Lin_ResetAddress;		/* VAR_OUTPUT */
563563
 } lin_resetaddress_struct;
564564
565565
-DEF_API(`void',`CDECL',`lin_resetaddress',`(lin_resetaddress_struct *p)',1,0x357557FD,0x01000000)
566566
+DEF_API(`void',`CDECL',`lin_resetaddress',`(lin_resetaddress_struct *p)',1,RTSITF_GET_SIGNATURE(0x357557FD, 0),0x01000000)
567567
568568
 /**
569569
  * Set slave adress
570570
@@ -136,7 +136,7 @@ typedef struct taglin_setaddress_struct
571571
 	RTS_IEC_DINT Lin_SetAddress;		/* VAR_OUTPUT */
572572
 } lin_setaddress_struct;
573573
574574
-DEF_API(`void',`CDECL',`lin_setaddress',`(lin_setaddress_struct *p)',1,0x2015BA0E,0x01000000)
575575
+DEF_API(`void',`CDECL',`lin_setaddress',`(lin_setaddress_struct *p)',1,RTSITF_GET_SIGNATURE(0x2015BA0E, 0),0x01000000)
576576
577577
 /**
578578
  * Set value for a slave
579579
@@ -146,11 +146,11 @@ typedef struct taglin_setvalue_struct
580580
 	RTS_IEC_INT iSlave;					/* VAR_INPUT */	/* Slavenumber */
581581
 	RTS_IEC_WORD wPosition;				/* VAR_INPUT */	/* new value */
582582
 	RTS_IEC_BYTE bPosFlags;				/* VAR_INPUT */	/* flags to set the new value */
583583
-	RTS_IEC_BYTE bDeviceTyp;			/* VAR_INPUT */	/* flags to set the new value */
584584
+	RTS_IEC_BYTE bDeviceTyp;			/* VAR_INPUT */	/* Device Type */
585585
 	RTS_IEC_DINT Lin_SetValue;			/* VAR_OUTPUT */
586586
 } lin_setvalue_struct;
587587
588588
-DEF_API(`void',`CDECL',`lin_setvalue',`(lin_setvalue_struct *p)',1,0xBEFBC8F0,0x01000000)
589589
+DEF_API(`void',`CDECL',`lin_setvalue',`(lin_setvalue_struct *p)',1,RTSITF_GET_SIGNATURE(0xBEFBC8F0, 0),0x01000000)
590590
591591
 #ifdef __cplusplus
592592
 }
593593
diff --git a/ptxdist/local_src/ecu01-codesys/linbus/linbus_imp.c b/ptxdist/local_src/ecu01-codesys/linbus/linbus_imp.c
594-
index a111c56..65afec6 100755
594+
index a111c56..fe9d495 100755
595595
--- a/ptxdist/local_src/ecu01-codesys/linbus/linbus_imp.c
596596
+++ b/ptxdist/local_src/ecu01-codesys/linbus/linbus_imp.c
597-
@@ -1,1762 +1,1699 @@
597+
@@ -1,1762 +1,1702 @@
598598
-/******************************************************************************/
599599
600600
-/*!
601601
602602
-\file              $URL: https://svn.eckelmann.group/svn/max/quantron_a/trunk/src/codesys/qa/linbus.c $
603603
604604
-
605605
606606
-\brief             Modul fuer die LIN-Bus-Kommunikation
607607
608608
-
609609
610610
-\author            $Author: Strunck $
611611
612612
-\date              $Date: 2016-10-20 10:31:12 +0200 (Do, 20 Okt 2016) $
613613
614614
-
615615
616616
-\version           $Rev: 3796 $
617617
618618
-
619619
620620
-\b                 ECKELMANN INDUSTRIEAUTOMATION, WIESBADEN\n
621621
622622
-                   © Copyright 2010
623623
624624
-
625625
626626
-*******************************************************************************/
627627
628628
-
629629
630630
-/*******************************************************************************
631631
632632
-@Includes
633633
634634
-*******************************************************************************/
635635
636636
-
637637
638638
-#include <time.h>
639639
640640
-#include <fcntl.h>
641641
642642
-#include <unistd.h>
643643
644644
-#include <sys/time.h>
645645
646646
-#include <sys/types.h>
647647
648648
-#include <sys/stat.h>
649649
650650
-#include <termios.h>
651651
652652
-
653653
654654
-/* Headerfiles Codesys-Componenten-Lib */
655655
656656
-#include "CmpStd.h"
657657
658658
-#include "CmpErrors.h"
659659
660660
-#include "CmpItf.h"
661661
662662
-
663663
664664
-/* Headerfile Dependend */
665665
666666
-#include "LinbusDep.h"
667667
668668
-
669669
670670
-/* Sonstige Headerfiles */
671671
672672
-#include "linbus_imp.h"
673673
674674
-#include "debug.h"
675675
676676
-#include "log.h"
677677
678678
-
679679
680680
-/*******************************************************************************
681681
682682
-@Konstanten (modullokal)
683683
684684
-*******************************************************************************/
685685
686686
-
687687
688688
-#define DEBUG_FUNC                 DEBUG_PRINT
689689
690690
-#ifndef DEBUG_FUNC
691691
692692
-   #define DEBUG_FUNC(a...)
693693
694694
-#endif
695695
696696
-#ifndef DEBUG_ITF_FUNC
697697
698698
-   #define DEBUG_ITF_FUNC(a...)
699699
700700
-#endif
701701
702702
-#ifndef DEBUG_INTERLAL_FUNC
703703
704704
-   #define DEBUG_INTERLAL_FUNC(a...)
705705
706706
-#endif
707707
708708
-
709709
710710
-#define ISBITSET(val, bit)    ( ((val) & (1 << (bit)))? 1:0 )
711711
712712
-
713713
714714
-/**************************/
715715
716716
-/* LIN-Kommandos/Adressen */
717717
718718
-/**************************/
719719
720720
-#define  ADDR(x)        			(x << 2)
721721
722722
-#define  PID_PARITY(x)  			(x << 6)
723723
724724
-
725725
726726
-#define  LIN_SLAVE_1             0x0
727727
728728
-#define  LIN_SLAVE_2             0x1
729729
730730
-#define  LIN_SLAVE_3             0x2
731731
732732
-#define  LIN_SLAVE_4             0x3
733733
734734
-#define  LIN_SLAVE_5             0x4
735735
736736
-#define  LIN_SLAVE_6             0x5
737737
738738
-#define  LIN_SLAVE_7             0x6
739739
740740
-#define  LIN_SLAVE_8             0x7
741741
742742
-#define  LIN_SLAVE_9             0x8
743743
744744
-#define  LIN_SLAVE_10            0x9
745745
746746
-#define  LIN_SLAVE_11            0xA
747747
748748
-#define  LIN_SLAVE_12            0xB
749749
750750
-#define  LIN_SLAVE_13            0xC
751751
752752
-#define  LIN_SLAVE_14            0xD
753753
754754
-#define  LIN_MASTER 				   0xE
755755
756756
-#define  CMD_FACEVALUE(adr) 		(ADDR(adr) | 0x0 )
757757
758758
-#define  CMD_SETVALUE(adr)  		(ADDR(adr) | 0x1 )
759759
760760
-#define  CMD_RESERVED(adr)  		(ADDR(adr) | 0x2 )
761761
762762
-#define  CMD_VERSION(adr)   		(ADDR(adr) | 0x3 )
763763
764764
-
765765
766766
-#define  CMD_MASTER_ALIVE  		(ADDR(LIN_MASTER) | 0x0 )
767767
768768
-#define  CMD_MASTER_SETVALUE 		(ADDR(LIN_MASTER) | 0x1 )
769769
770770
-#define  CMD_RESET_ADDR    		(ADDR(LIN_MASTER) | 0x3 )
771771
772772
-
773773
774774
-/**************************/
775775
776776
-/* LIN-Steuerflags Master */
777777
778778
-/**************************/
779779
780780
-#define  LIN_MASTER_INITFLAG     0x02
781781
782782
-
783783
784784
-/***********************************/
785785
786786
-/* LIN-Steuerflags Sollwert setzen */
787787
788788
-/***********************************/
789789
790790
-#define  LIN_SET_SOLL_POS        0x01
791791
792792
-#define  LIN_SET_SLOW            0x02
793793
794794
-#define  LIN_SET_MANUAL_OU       0x04
795795
796796
-#define  LIN_SET_MANUAL_IN       0x08
797797
798798
-#define  LIN_SET_SELFTEST        0x80
799799
800800
-
801801
802802
-/*******************/
803803
804804
-/* LIN-Fehlercodes */
805805
806806
-/*******************/
807807
808808
-#define  ERR_LIN_DEVICE          (-1)
809809
810810
-#define  ERR_LIN_PORTSETTING     (-2)
811811
812812
-#define  ERR_LIN_BAUDRATE        (-3)
813813
814814
-#define  ERR_LIN_TIMEOUT         (-4)
815815
816816
-#define  ERR_LIN_TIMEOUT_ECHO    (-5)
817817
818818
-#define  ERR_LIN_TIMEOUT_MSG     (-6)
819819
820820
-#define  ERR_LIN_SEND_MESSAGE    (-7)
821821
822822
-#define  ERR_LIN_CHECKSUM        (-8)
823823
824824
-
825825
826826
-/***************/
827827
828828
-/* LIN-Timeout */
829829
830830
-/***************/
831831
832832
-#define  LIN_TIMEOUT_ECHO 			50         /* 50 ms  Timeoutzeit fuer Echobytes */
833833
834834
-#define  LIN_TIMEOUT_MESSAGE     100        /* 100 ms Timeoutzeit fuer Clientantwort */
835835
836836
-
837837
838838
-/*************************/
839839
840840
-/* Sonstige Definitionen */
841841
842842
-/*************************/
843843
844844
-#define  LIN_BAUD_RATE   			B9600
845845
846846
-#define  MAX_LIN_FRAME_BUFFER		30
847847
848848
-#define  MAX_LIN_SLAVE           14
849849
850850
-#define  LIN_SYNCBYTE      		0x55
851851
852852
-#define  LIN_TYP_MOTOR     		0
853853
854854
-#define  LIN_PROTOKOLL_VERS      0
855855
856856
-#define  DRV_NAME_LEN			   20
857857
858858
-#define  LIN_MSG_RETRY           3
859859
860860
-
861861
862862
-#ifndef x86
863863
864864
-#define LINTHREAD_PRIO           38     /* RT-Linux; SCHED_FIFO */
865865
866866
-#else
867867
868868
-#define LINTHREAD_PRIO           54    /* kein RT-Linux; SCHED_OTHER */
869869
870870
-#endif
871871
872872
-#define LINTHREAD_ZYKLUS         10    /* 10ms Zykluszeit */
873873
874874
-
875875
876876
-#ifndef x86
877877
878878
-#define RXTHREAD_PRIO            38     /* RT-Linux; SCHED_FIFO */
879879
880880
-#else
881881
882882
-#define RXTHREAD_PRIO            54    /* kein RT-Linux; SCHED_OTHER */
883883
884884
-#endif
885885
886886
-
887887
888888
-/**************/
889889
890890
-/* Tracetypen */
891891
892892
-/**************/
893893
894894
-#define MSG_TX_TRACE_DATA          0
895895
896896
-#define MSG_RX_TRACE_DATA          1
897897
898898
-
899899
900900
-//#define _DEBUG
901901
902902
-
903903
904904
-/*******************************************************************************
905905
906906
-@Typdefinitionen (modullokal)
907907
908908
-*******************************************************************************/
909909
910910
-
911911
912912
-typedef struct LIN_SLAVE_DATA_R {
913913
914914
-	LIN_SLAVE_VERSION_TR tVers;		/* Version */
915915
916916
-	LIN_SLAVE_VALUE_TR   tValue;		/* FaceValue */
917917
918918
-	unsigned char  ucSlaveOnline;		/* Verbindungsstatus */
919919
920920
-	unsigned char  ucSetNewValue;   	/* Flag fuer neuen Sollwert */
921921
922922
-	unsigned short usSetValue;      	/* Sollwert */
923923
924924
-	unsigned char  ucSetControl;    	/* Steuerbits fuer Sollwert */
925925
926926
-	unsigned char  ucDevice;
927927
928928
-
929929
930930
-}  LIN_SLAVE_DATA_TR;
931931
932932
-
933933
934934
-/*******************************************************************************
935935
936936
-@Konstanten (modullokal)
937937
938938
-*******************************************************************************/
939939
940940
-
941941
942942
-static const char cacDeviceName[DRV_NAME_LEN] = { "/dev/ttymxc1"};
943943
944944
-
945945
946946
-/*******************************************************************************
947947
948948
-@Variablen (modullokal)
949949
950950
-*******************************************************************************/
951951
952952
-
953953
954954
-/* Variablen Linbus-Schnittstellen */
955955
956956
-static int     iLinPort = -1;         						   /* Porthandle */
957957
958958
-static struct  termios initial_settings, new_settings;   /* Portsettings */
959959
960960
-static speed_t BaudRate;                                 /* Baudrate */
961961
962962
-
963963
964964
-/* Variablen Masterthread */
965965
966966
-static RTS_HANDLE rtsMasterThreadHandle = RTS_INVALID_HANDLE; /* Handle MasterThread */
967967
968968
-static char acMasterThreadName[15] = { "LinMasterThread" };
969969
970970
-static int  iLinMasterState;                             /* Zustand Master */
971971
972972
-
973973
974974
-/* Variablen Empfangsthread */
975975
976976
-static RTS_HANDLE rtsRxThreadHandle = RTS_INVALID_HANDLE;     /* Handle RxThread */
977977
978978
-static char acRxThreadName[15] = { "LinRxThread" };
979979
980980
-
981981
982982
-/* Variablen Empfang/Sendefunktion */
983983
984984
-static unsigned char  acLinMsgBuffer[MAX_LIN_FRAME_BUFFER];     /* Nachrichtenpuffer */
985985
986986
-static unsigned char  acLinRxBuffer[MAX_LIN_FRAME_BUFFER];      /* Empfangspuffer */
987987
988988
-static int            iLinRxWrIndex;                     /* Schreibzeiger Empfangspuffer */
989989
990990
-static int            iLinRxRdIndex;                     /* Lesezeiger Empfangspuffer */
991991
992992
-
993993
994994
-/* Zustaende von Master und Slaves */
995995
996996
-static LIN_SLAVE_DATA_TR atLinSlaveData[MAX_LIN_SLAVE];  /* Slavezustaende */
997997
998998
-static int            iLinSlaveCnt;                      /* Anzahl der konfigurieren Slaves */
999999
10001000
-static int            iLinIntervall;                     /* Intervall fuer die Bearbeitung des Linbus */

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at