-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasctecCommIntfOnboard.lst
6365 lines (6364 loc) · 267 KB
/
asctecCommIntfOnboard.lst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1 .file "asctecCommIntfOnboard.c"
9 .Ltext0:
10 .align 2
11 .global aciInit
13 aciInit:
14 .LFB2:
15 .file 1 "asctecCommIntfOnboard.c"
1:asctecCommIntfOnboard.c **** /*
2:asctecCommIntfOnboard.c ****
3:asctecCommIntfOnboard.c **** Copyright (c) 2012, Ascending Technologies GmbH
4:asctecCommIntfOnboard.c **** All rights reserved.
5:asctecCommIntfOnboard.c ****
6:asctecCommIntfOnboard.c **** Redistribution and use in source and binary forms, with or without
7:asctecCommIntfOnboard.c **** modification, are permitted provided that the following conditions are met:
8:asctecCommIntfOnboard.c ****
9:asctecCommIntfOnboard.c **** * Redistributions of source code must retain the above copyright notice,
10:asctecCommIntfOnboard.c **** this list of conditions and the following disclaimer.
11:asctecCommIntfOnboard.c **** * Redistributions in binary form must reproduce the above copyright
12:asctecCommIntfOnboard.c **** notice, this list of conditions and the following disclaimer in the
13:asctecCommIntfOnboard.c **** documentation and/or other materials provided with the distribution.
14:asctecCommIntfOnboard.c ****
15:asctecCommIntfOnboard.c **** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16:asctecCommIntfOnboard.c **** EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17:asctecCommIntfOnboard.c **** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18:asctecCommIntfOnboard.c **** DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
19:asctecCommIntfOnboard.c **** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20:asctecCommIntfOnboard.c **** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21:asctecCommIntfOnboard.c **** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22:asctecCommIntfOnboard.c **** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23:asctecCommIntfOnboard.c **** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24:asctecCommIntfOnboard.c **** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25:asctecCommIntfOnboard.c **** DAMAGE.
26:asctecCommIntfOnboard.c ****
27:asctecCommIntfOnboard.c **** */
28:asctecCommIntfOnboard.c ****
29:asctecCommIntfOnboard.c **** #include "asctecCommIntfOnboard.h"
30:asctecCommIntfOnboard.c **** #include <string.h>
31:asctecCommIntfOnboard.c **** #include <stdlib.h>
32:asctecCommIntfOnboard.c ****
33:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY aciListVar[MAX_VARIABLE_LIST];
34:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY aciListCmd[MAX_COMMAND_LIST];
35:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY aciListPar[MAX_PARAMETER_LIST];
36:asctecCommIntfOnboard.c ****
37:asctecCommIntfOnboard.c **** int aciListVarCount = 0;
38:asctecCommIntfOnboard.c **** int aciListCmdCount = 0;
39:asctecCommIntfOnboard.c **** int aciListParCount = 0;
40:asctecCommIntfOnboard.c ****
41:asctecCommIntfOnboard.c **** // Variabeln
42:asctecCommIntfOnboard.c **** unsigned short aciVarPacketSelect[MAX_VAR_PACKETS][MEMPACKET_MAX_VARS];
43:asctecCommIntfOnboard.c **** unsigned char aciVarPacketSelectLength[MAX_VAR_PACKETS];
44:asctecCommIntfOnboard.c **** unsigned char aciVarPacketMagicCode[MAX_VAR_PACKETS]={0,0,0};
45:asctecCommIntfOnboard.c **** void * aciVarPacketPtrList[MAX_VAR_PACKETS][MEMPACKET_MAX_VARS];
46:asctecCommIntfOnboard.c **** unsigned char aciVarPacketTypeList[MAX_VAR_PACKETS][MEMPACKET_MAX_VARS];
47:asctecCommIntfOnboard.c ****
48:asctecCommIntfOnboard.c **** unsigned short aciVarPacketContentBufferLength[MAX_VAR_PACKETS];
49:asctecCommIntfOnboard.c **** unsigned char aciVarPacketContentBuffer[MAX_VAR_PACKETS][MAX_VARIABLE_LIST*8];
50:asctecCommIntfOnboard.c ****
51:asctecCommIntfOnboard.c **** unsigned short aciVarPacketTransmissionRate[MAX_VAR_PACKETS]={10,10,10};
52:asctecCommIntfOnboard.c **** unsigned short aciVarPacketCurrentSize[MAX_VAR_PACKETS]={0,0,0};
53:asctecCommIntfOnboard.c **** unsigned short aciVarPacketNumberOfVars[MAX_VAR_PACKETS]={0,0,0};
54:asctecCommIntfOnboard.c **** unsigned short aciVarPacketUpdated[MAX_VAR_PACKETS]={0,0,0};
55:asctecCommIntfOnboard.c ****
56:asctecCommIntfOnboard.c **** // Command
57:asctecCommIntfOnboard.c **** unsigned short aciCmdPacketSelect[MAX_VAR_PACKETS][MEMPACKET_MAX_VARS];
58:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketSelectLength[MAX_VAR_PACKETS];
59:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketMagicCode[MAX_VAR_PACKETS]={0,0,0};
60:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketWithACK[MAX_VAR_PACKETS]={0,0,0};
61:asctecCommIntfOnboard.c ****
62:asctecCommIntfOnboard.c **** unsigned short aciCmdPacketContentBufferLength[MAX_VAR_PACKETS];
63:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketContentBuffer[MAX_VAR_PACKETS][MAX_COMMAND_LIST*8];
64:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketContentBufferValid[MAX_VAR_PACKETS];
65:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketSendAck[MAX_VAR_PACKETS] = {0,0,0};
66:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketReceived[MAX_VAR_PACKETS] = {0,0,0};
67:asctecCommIntfOnboard.c **** unsigned char aciCmdPacketContentBufferInvalidCnt[MAX_VAR_PACKETS];
68:asctecCommIntfOnboard.c ****
69:asctecCommIntfOnboard.c **** // Parameter
70:asctecCommIntfOnboard.c **** unsigned short aciParPacketSelect[MAX_VAR_PACKETS][MEMPACKET_MAX_VARS];
71:asctecCommIntfOnboard.c **** unsigned char aciParPacketSelectLength[MAX_VAR_PACKETS];
72:asctecCommIntfOnboard.c **** unsigned char aciParPacketMagicCode[MAX_VAR_PACKETS]={0,0,0};
73:asctecCommIntfOnboard.c ****
74:asctecCommIntfOnboard.c **** unsigned short aciParPacketContentBufferLength[MAX_VAR_PACKETS];
75:asctecCommIntfOnboard.c **** unsigned char aciParPacketContentBuffer[MAX_VAR_PACKETS][MAX_PARAMETER_LIST*8];
76:asctecCommIntfOnboard.c **** unsigned char aciParPacketContentBufferValid[MAX_VAR_PACKETS];
77:asctecCommIntfOnboard.c **** unsigned char aciParPacketSendAck[MAX_VAR_PACKETS] = {0,0,0};
78:asctecCommIntfOnboard.c **** unsigned char aciParamPacketReceived[MAX_VAR_PACKETS] = {0,0,0};
79:asctecCommIntfOnboard.c **** unsigned char aciParPacketContentBufferInvalidCnt[MAX_VAR_PACKETS];
80:asctecCommIntfOnboard.c **** unsigned char aciParPacketRequest[MAX_VAR_PACKETS] = {0,0,0};
81:asctecCommIntfOnboard.c ****
82:asctecCommIntfOnboard.c **** unsigned char aciParamSaveIt=0;
83:asctecCommIntfOnboard.c **** unsigned char entry_exist = 1;
84:asctecCommIntfOnboard.c ****
85:asctecCommIntfOnboard.c **** //internal global vars
86:asctecCommIntfOnboard.c **** unsigned int aciEngineRate=1000;
87:asctecCommIntfOnboard.c **** unsigned int aciEngineRateCounter[MAX_VAR_PACKETS]= {0,0,0};
88:asctecCommIntfOnboard.c ****
89:asctecCommIntfOnboard.c ****
90:asctecCommIntfOnboard.c **** //aciTxRingbuffer global vars
91:asctecCommIntfOnboard.c **** unsigned char aciTxRingBuffer[ACI_TX_RINGBUFFER_SIZE];
92:asctecCommIntfOnboard.c **** unsigned short aciTxRingBufferWritePtr=0;
93:asctecCommIntfOnboard.c **** unsigned char aciTxRingBufferReadPtr=0;
94:asctecCommIntfOnboard.c ****
95:asctecCommIntfOnboard.c **** unsigned short aciHeartBeatCnt=0;
96:asctecCommIntfOnboard.c **** unsigned short aciHeartBeatTimeout=2000; // in ms. Default: 2s timeout
97:asctecCommIntfOnboard.c **** unsigned char aciInhibitPacketTransmission=0;
98:asctecCommIntfOnboard.c ****
99:asctecCommIntfOnboard.c **** //aciTxRingbuffer prototypes
100:asctecCommIntfOnboard.c **** void aciTxRingBufferReset(void);
101:asctecCommIntfOnboard.c **** unsigned short aciTxRingBufferGetFreeSpace(void);
102:asctecCommIntfOnboard.c **** void aciTxRingBufferAddData(void * ptr, unsigned short size);
103:asctecCommIntfOnboard.c **** void aciTxSendPacket(unsigned char aciMessageType, void * data, unsigned short cnt);
104:asctecCommIntfOnboard.c **** void (*aciStartTxCallback)(unsigned char byte);
105:asctecCommIntfOnboard.c **** unsigned char (*aciReadDatafromFlashCallback)(void * ptr, unsigned short cnt);
106:asctecCommIntfOnboard.c **** void (*aciReadWriteStartCallback)(void) = NULL;
107:asctecCommIntfOnboard.c **** void (*aciReadWriteEndCallback)(void) = NULL;
108:asctecCommIntfOnboard.c **** void (*aciAddDatatoFlashCallback)(void * ptr, unsigned short cnt) = NULL;
109:asctecCommIntfOnboard.c **** short (*aciReadParafromFlashCallback)(void) = NULL;
110:asctecCommIntfOnboard.c **** void (*aciSaveParaCallback)(void) = NULL;
111:asctecCommIntfOnboard.c **** short (*aciWriteParatoFlashCallback)(void) = NULL;
112:asctecCommIntfOnboard.c **** void aciSendVar(void);
113:asctecCommIntfOnboard.c **** void aciPublishVariableInt(void * ptr, unsigned char varType, unsigned short id, char * name, char
114:asctecCommIntfOnboard.c **** void aciPublishCommandInt(void * ptr, unsigned char varType, unsigned short id, char * name, char *
115:asctecCommIntfOnboard.c **** void aciPublishParameterInt(void * ptr, unsigned char varType, unsigned short id, char * name, char
116:asctecCommIntfOnboard.c **** void aciSendSingleWithAck(short i);
117:asctecCommIntfOnboard.c ****
118:asctecCommIntfOnboard.c **** //aciRxHandler prototypes
119:asctecCommIntfOnboard.c **** void aciRxHandleMessage(unsigned char messagetype, unsigned short length);
120:asctecCommIntfOnboard.c ****
121:asctecCommIntfOnboard.c ****
122:asctecCommIntfOnboard.c **** //aci helper prototypes
123:asctecCommIntfOnboard.c **** ///update CRC with 1 byte
124:asctecCommIntfOnboard.c **** unsigned short aciCrcUpdate (unsigned short crc, unsigned char data);
125:asctecCommIntfOnboard.c **** ///update crc with multiple bytes
126:asctecCommIntfOnboard.c **** unsigned short aciUpdateCrc16(unsigned short crc, void * data, unsigned short cnt);
127:asctecCommIntfOnboard.c ****
128:asctecCommIntfOnboard.c **** // ACI Send Single
129:asctecCommIntfOnboard.c **** unsigned short aciSendSingleCount = 0;
130:asctecCommIntfOnboard.c **** unsigned short aciSendSingleNextBufferCount = 0;
131:asctecCommIntfOnboard.c **** unsigned short aciSendSingleStatus[MAX_VARIABLE_LIST];
132:asctecCommIntfOnboard.c **** unsigned short aciSendSingleId[MAX_VARIABLE_LIST];
133:asctecCommIntfOnboard.c **** unsigned char aciSendSingleVarType[MAX_VARIABLE_LIST];
134:asctecCommIntfOnboard.c **** unsigned char aciSendSingleBuffer[MAX_VARIABLE_LIST*8];
135:asctecCommIntfOnboard.c **** unsigned short aciSendSingleBufferCnt[MAX_VARIABLE_LIST];
136:asctecCommIntfOnboard.c ****
137:asctecCommIntfOnboard.c **** unsigned short aciMagicCodeVar = 0x00FF;
138:asctecCommIntfOnboard.c **** unsigned short aciMagicCodeCmd = 0x00FF;
139:asctecCommIntfOnboard.c **** unsigned short aciMagicCodePar = 0x00FF;
140:asctecCommIntfOnboard.c ****
141:asctecCommIntfOnboard.c **** void aciInit(unsigned short callsPerSecond)
142:asctecCommIntfOnboard.c **** {
16 @ Function supports interworking.
17 @ args = 0, pretend = 0, frame = 0
18 @ frame_needed = 0, uses_anonymous_args = 0
19 .LVL0:
20 .loc 1 146 0
143:asctecCommIntfOnboard.c **** int i=0;
144:asctecCommIntfOnboard.c **** int z=0;
145:asctecCommIntfOnboard.c ****
146:asctecCommIntfOnboard.c **** aciListVarCount = 0;
21 r3, .L20
22 0000 F8309FE5 mov r1, #0
23 0004 0010A0E3 .loc 1 147 0
147:asctecCommIntfOnboard.c **** aciListCmdCount = 0;
24 r r2, .L20+4
25 0008 F4209FE5 .loc 1 146 0
26 str r1, [r3, #0]
27 000c 001083E5 .loc 1 148 0
148:asctecCommIntfOnboard.c **** aciListParCount = 0;
28 r3, .L20+8
29 0010 F0309FE5 .loc 1 142 0
30 stmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
31 0014 F04F2DE9 .LCFI0:
32 .loc 1 147 0
33 str r1, [r2, #0]
34 0018 001082E5 .loc 1 142 0
35 mov r0, r0, asl #16
36 001c 0008A0E1 .LVL1:
37 .loc 1 148 0
38 ldr r2, .L20+12
39 0020 E4209FE5 ldr r5, .L20+16
40 0024 E4509FE5 ldr r4, .L20+20
41 0028 E4409FE5 ldr lr, .L20+24
42 002c E4E09FE5 ldr ip, .L20+28
43 0030 E4C09FE5 str r1, [r3, #0]
44 0034 001083E5 .loc 1 142 0
45 mov fp, r0, lsr #16
46 0038 20B8A0E1 .LVL2:
47 .LVL3:
48 mov r3, r1
49 003c 0130A0E1 .LVL4:
50 .L2:
51 .loc 1 152 0
149:asctecCommIntfOnboard.c ****
150:asctecCommIntfOnboard.c **** for (i=0;i<MAX_VAR_PACKETS;i++)
151:asctecCommIntfOnboard.c **** {
152:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferValid[i]=0;
52 1 153 0
53 0040 0530C1E7 strb r3, [r1, r4]
153:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferInvalidCnt[i]=0;
54 loc 1 154 0
55 0044 0430C1E7 strb r3, [r1, lr]
154:asctecCommIntfOnboard.c **** aciParPacketContentBufferValid[i]=0;
56 loc 1 155 0
57 0048 0E30C1E7 strb r3, [r1, ip]
155:asctecCommIntfOnboard.c **** aciParPacketContentBufferInvalidCnt[i]=0;
58 loc 1 150 0
59 004c 0C30C1E7 add r1, r1, #1
60 .loc 1 156 0
61 0050 011081E2 mov r0, #0 @ movhi
156:asctecCommIntfOnboard.c **** aciVarPacketContentBufferLength[i] = 0;
62 c 1 150 0
63 0054 0000A0E3 cmp r1, #3
64 .loc 1 156 0
65 0058 030051E3 strh r0, [r2], #2 @ movhi
66 .loc 1 150 0
67 005c B200C2E0 bne .L2
68 .LVL5:
69 0060 F6FFFF1A ldr r9, .L20+32
70 ldr r8, .L20+36
71 0064 B4909FE5 ldr sl, .L20+40
72 0068 B4809FE5 ldr r7, .L20+44
73 006c B4A09FE5 ldr r5, .L20+48
74 0070 B4709FE5 ldr r6, .L20+52
75 0074 B4509FE5 .loc 1 181 0
76 0078 B4609FE5 mov r4, #0
157:asctecCommIntfOnboard.c **** }
158:asctecCommIntfOnboard.c ****
159:asctecCommIntfOnboard.c ****
160:asctecCommIntfOnboard.c **** for (z=0;z<MAX_VAR_PACKETS;z++)
161:asctecCommIntfOnboard.c **** {
162:asctecCommIntfOnboard.c **** for (i=0;i<MEMPACKET_MAX_VARS;i++)
163:asctecCommIntfOnboard.c **** {
164:asctecCommIntfOnboard.c **** aciVarPacketSelect[z][i]=ID_NONE;
165:asctecCommIntfOnboard.c **** aciVarPacketPtrList[z][i]=NULL;
166:asctecCommIntfOnboard.c **** aciVarPacketTypeList[z][i]=0;
167:asctecCommIntfOnboard.c **** }
168:asctecCommIntfOnboard.c **** aciVarPacketMagicCode[z]=0;
169:asctecCommIntfOnboard.c **** aciVarPacketSelectLength[z]=0;
170:asctecCommIntfOnboard.c **** aciCmdPacketMagicCode[z]=0;
171:asctecCommIntfOnboard.c **** }
172:asctecCommIntfOnboard.c ****
173:asctecCommIntfOnboard.c **** for (i=0;i<ACI_TX_RINGBUFFER_SIZE;i++) {
174:asctecCommIntfOnboard.c **** aciSendSingleBuffer[i] = 0;
175:asctecCommIntfOnboard.c **** aciSendSingleId[i] = 0;
176:asctecCommIntfOnboard.c **** aciSendSingleVarType[i] = 0;
177:asctecCommIntfOnboard.c **** }
178:asctecCommIntfOnboard.c ****
179:asctecCommIntfOnboard.c **** aciEngineRate = callsPerSecond;
180:asctecCommIntfOnboard.c ****
181:asctecCommIntfOnboard.c **** }
77 d r0, r7, r4, asl #7
78 007c 0040A0E3 add lr, r5, r4, asl #8
79 add ip, r6, r4, asl #6
80 mov r3, #0
81 0080 840387E0 .L4:
82 0084 04E485E0 .loc 1 162 0
83 0088 04C386E0 add r3, r3, #1
84 008c 0030A0E3 .loc 1 164 0
85 mov r2, #0
86 .loc 1 162 0
87 0090 013083E2 cmp r3, #64
88 .loc 1 164 0
89 0094 0020A0E3 strh r2, [r0], #2 @ movhi
90 .loc 1 165 0
91 0098 400053E3 str r2, [lr], #4
92 .loc 1 166 0
93 009c B220C0E0 strb r2, [ip], #1
94 .loc 1 162 0
95 00a0 04208EE4 bne .L4
96 .loc 1 170 0
97 00a4 0120CCE4 strb r2, [r4, sl]
98 .loc 1 168 0
99 00a8 F8FFFF1A strb r2, [r4, r9]
100 .loc 1 169 0
101 00ac 0A20C4E7 strb r2, [r4, r8]
102 .loc 1 160 0
103 00b0 0920C4E7 add r4, r4, #1
104 cmp r4, #3
105 00b4 0820C4E7 bne .L6
106 ldr r1, .L20+56
107 00b8 014084E2 .LVL7:
108 00bc 030054E3 ldr lr, .L20+60
109 00c0 EEFFFF1A ldr ip, .L20+64
110 00c4 6C109FE5 mov r3, r2
111 .LVL8:
112 00c8 6CE09FE5 .L8:
113 00cc 6CC09FE5 .loc 1 174 0
114 00d0 0230A0E1 strb r2, [r3, lr]
115 .loc 1 176 0
116 strb r2, [r3, ip]
117 .loc 1 173 0
118 00d4 0E20C3E7 add r3, r3, #1
119 .loc 1 175 0
120 00d8 0C20C3E7 mov r0, #0 @ movhi
121 .loc 1 173 0
122 00dc 013083E2 cmp r3, #160
123 .loc 1 175 0
124 00e0 0000A0E3 strh r0, [r1], #2 @ movhi
125 .loc 1 173 0
126 00e4 A00053E3 bne .L8
127 .loc 1 179 0
128 00e8 B200C1E0 ldr r3, .L20+68
129 .LVL9:
130 00ec F8FFFF1A str fp, [r3, #0]
131 .loc 1 181 0
132 00f0 4C309FE5 ldmfd sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
133 bx lr
134 00f4 00B083E5 .L21:
135 .align 2
136 00f8 F04FBDE8 .L20:
137 00fc 1EFF2FE1 .word aciListVarCount
138 .word aciListCmdCount
139 .word aciListParCount
140 .word aciVarPacketContentBufferLength
141 0100 00000000 .word aciCmdPacketContentBufferValid
142 0104 00000000 .word aciCmdPacketContentBufferInvalidCnt
143 0108 00000000 .word aciParPacketContentBufferValid
144 010c 00000000 .word aciParPacketContentBufferInvalidCnt
145 0110 00000000 .word aciVarPacketMagicCode
146 0114 00000000 .word aciVarPacketSelectLength
147 0118 00000000 .word aciCmdPacketMagicCode
148 011c 00000000 .word aciVarPacketSelect
149 0120 00000000 .word aciVarPacketPtrList
150 0124 00000000 .word aciVarPacketTypeList
151 0128 00000000 .word aciSendSingleId
152 012c 00000000 .word aciSendSingleBuffer
153 0130 00000000 .word aciSendSingleVarType
154 0134 00000000 .word aciEngineRate
155 0138 00000000 .LFE2:
157 0140 00000000 .align 2
158 0144 00000000 .global aciSetStartTxCallback
160 aciSetStartTxCallback:
161 .LFB15:
162 .loc 1 1100 0
163 @ Function supports interworking.
164 @ args = 0, pretend = 0, frame = 0
165 @ frame_needed = 0, uses_anonymous_args = 0
182:asctecCommIntfOnboard.c ****
183:asctecCommIntfOnboard.c **** void aciSendSingleWithAck(short i)
184:asctecCommIntfOnboard.c **** {
185:asctecCommIntfOnboard.c **** short notzero_i = i+1;
186:asctecCommIntfOnboard.c **** unsigned char varType = aciSendSingleVarType[i];
187:asctecCommIntfOnboard.c **** unsigned char buffer[5+(varType>>2)];
188:asctecCommIntfOnboard.c ****
189:asctecCommIntfOnboard.c **** memcpy(&buffer[0],¬zero_i,2);
190:asctecCommIntfOnboard.c **** memcpy(&buffer[2],&aciSendSingleId[i],2);
191:asctecCommIntfOnboard.c **** memcpy(&buffer[4],&varType,1);
192:asctecCommIntfOnboard.c **** memcpy(&buffer[5],&aciSendSingleBuffer[aciSendSingleBufferCnt[i]],varType>>2);
193:asctecCommIntfOnboard.c **** aciSendSingleStatus[i]++;
194:asctecCommIntfOnboard.c ****
195:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SINGLESEND,buffer,5+(varType>>2));
196:asctecCommIntfOnboard.c ****
197:asctecCommIntfOnboard.c **** }
198:asctecCommIntfOnboard.c ****
199:asctecCommIntfOnboard.c **** void aciSingleSend(void * ptr, unsigned char varType, unsigned short id, char with_ack) {
200:asctecCommIntfOnboard.c **** if(!varType || !id) return;
201:asctecCommIntfOnboard.c **** if((aciSendSingleNextBufferCount+(varType>>2))>MAX_VARIABLE_LIST*8) return;
202:asctecCommIntfOnboard.c ****
203:asctecCommIntfOnboard.c **** unsigned char buffer[5+(varType>>2)];
204:asctecCommIntfOnboard.c **** int i;
205:asctecCommIntfOnboard.c **** int use_i = -1;
206:asctecCommIntfOnboard.c **** short zero = 0;
207:asctecCommIntfOnboard.c ****
208:asctecCommIntfOnboard.c **** if(with_ack) {
209:asctecCommIntfOnboard.c **** for(i=0;i<MAX_VARIABLE_LIST;i++) {
210:asctecCommIntfOnboard.c **** if((use_i==-1) && (aciSendSingleStatus[i]==0)) use_i=i;
211:asctecCommIntfOnboard.c **** }
212:asctecCommIntfOnboard.c **** if(use_i==-1) return; // security-if
213:asctecCommIntfOnboard.c ****
214:asctecCommIntfOnboard.c **** aciSendSingleStatus[use_i] = 1;
215:asctecCommIntfOnboard.c **** aciSendSingleId[use_i] = id;
216:asctecCommIntfOnboard.c **** aciSendSingleVarType[use_i] = varType;
217:asctecCommIntfOnboard.c **** memcpy(&aciSendSingleBuffer[aciSendSingleNextBufferCount],ptr,varType>>2);
218:asctecCommIntfOnboard.c **** aciSendSingleBufferCnt[use_i]=aciSendSingleNextBufferCount;
219:asctecCommIntfOnboard.c **** aciSendSingleNextBufferCount+=varType>>2;
220:asctecCommIntfOnboard.c **** aciSendSingleCount++;
221:asctecCommIntfOnboard.c **** } else {
222:asctecCommIntfOnboard.c **** memcpy(&buffer[0],&zero,2);
223:asctecCommIntfOnboard.c **** memcpy(&buffer[2],&id,2);
224:asctecCommIntfOnboard.c **** memcpy(&buffer[4],&varType,1);
225:asctecCommIntfOnboard.c **** memcpy(&buffer[5],ptr,varType>>2);
226:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SINGLESEND,buffer,5+(varType>>2));
227:asctecCommIntfOnboard.c **** }
228:asctecCommIntfOnboard.c **** }
229:asctecCommIntfOnboard.c ****
230:asctecCommIntfOnboard.c **** /* published Variable. Variable has to be global! **/
231:asctecCommIntfOnboard.c **** void aciPublishVariableInt(void * ptr, unsigned char varType, unsigned short id, char * name, char
232:asctecCommIntfOnboard.c **** if (aciListVarCount==MAX_VARIABLE_LIST) return;
233:asctecCommIntfOnboard.c ****
234:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].id= id;
235:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].varType = varType;
236:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].name = name;
237:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].description = description;
238:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].unit = unit;
239:asctecCommIntfOnboard.c **** aciListVar[aciListVarCount].ptrToVar = (void*) ptr;
240:asctecCommIntfOnboard.c ****
241:asctecCommIntfOnboard.c **** aciMagicCodeVar = aciUpdateCrc16(aciMagicCodeVar,&id,2);
242:asctecCommIntfOnboard.c **** aciMagicCodeVar = aciUpdateCrc16(aciMagicCodeVar,&varType,1);
243:asctecCommIntfOnboard.c ****
244:asctecCommIntfOnboard.c **** aciListVarCount++;
245:asctecCommIntfOnboard.c **** }
246:asctecCommIntfOnboard.c ****
247:asctecCommIntfOnboard.c ****
248:asctecCommIntfOnboard.c **** /* published Command. Command has to be global! **/
249:asctecCommIntfOnboard.c **** void aciPublishCommandInt(void * ptr, unsigned char varType, unsigned short id, char * name, char *
250:asctecCommIntfOnboard.c **** {
251:asctecCommIntfOnboard.c **** if (aciListCmdCount==MAX_PARAMETER_LIST) return;
252:asctecCommIntfOnboard.c ****
253:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].id= id;
254:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].varType = varType;
255:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].name = name;
256:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].description = description;
257:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].unit = unit;
258:asctecCommIntfOnboard.c **** aciListCmd[aciListCmdCount].ptrToVar = (void*) ptr;
259:asctecCommIntfOnboard.c ****
260:asctecCommIntfOnboard.c **** aciMagicCodeCmd = aciUpdateCrc16(aciMagicCodeCmd,&id,2);
261:asctecCommIntfOnboard.c **** aciMagicCodeCmd = aciUpdateCrc16(aciMagicCodeCmd,&varType,1);
262:asctecCommIntfOnboard.c ****
263:asctecCommIntfOnboard.c **** aciListCmdCount++;
264:asctecCommIntfOnboard.c **** }
265:asctecCommIntfOnboard.c ****
266:asctecCommIntfOnboard.c **** /** published Parameter. Parameter has to be global! **/
267:asctecCommIntfOnboard.c **** void aciPublishParameterInt(void * ptr, unsigned char varType, unsigned short id, char * name, char
268:asctecCommIntfOnboard.c **** {
269:asctecCommIntfOnboard.c **** if (aciListParCount==MAX_PARAMETER_LIST) return;
270:asctecCommIntfOnboard.c ****
271:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].id= id;
272:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].varType = varType;
273:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].name = name;
274:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].description = description;
275:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].unit = unit;
276:asctecCommIntfOnboard.c **** aciListPar[aciListParCount].ptrToVar = (void*) ptr;
277:asctecCommIntfOnboard.c ****
278:asctecCommIntfOnboard.c **** aciMagicCodePar = aciUpdateCrc16(aciMagicCodePar,&id,2);
279:asctecCommIntfOnboard.c **** aciMagicCodePar = aciUpdateCrc16(aciMagicCodePar,&varType,1);
280:asctecCommIntfOnboard.c ****
281:asctecCommIntfOnboard.c **** aciListParCount++;
282:asctecCommIntfOnboard.c **** }
283:asctecCommIntfOnboard.c ****
284:asctecCommIntfOnboard.c **** void aciSendVar(void)
285:asctecCommIntfOnboard.c **** {
286:asctecCommIntfOnboard.c **** short i=0;
287:asctecCommIntfOnboard.c **** short j=0;
288:asctecCommIntfOnboard.c **** short ii=0;
289:asctecCommIntfOnboard.c **** short z = 0;
290:asctecCommIntfOnboard.c **** for (i=0;i<MAX_VAR_PACKETS;i++)
291:asctecCommIntfOnboard.c **** // short i=2;
292:asctecCommIntfOnboard.c **** {
293:asctecCommIntfOnboard.c ****
294:asctecCommIntfOnboard.c **** //handle variable packet generation and triggering
295:asctecCommIntfOnboard.c **** if (!aciVarPacketTransmissionRate[i]) {
296:asctecCommIntfOnboard.c **** // continue;
297:asctecCommIntfOnboard.c **** }
298:asctecCommIntfOnboard.c **** else {
299:asctecCommIntfOnboard.c **** unsigned short packetSize;
300:asctecCommIntfOnboard.c ****
301:asctecCommIntfOnboard.c **** //generate packet and send it
302:asctecCommIntfOnboard.c ****
303:asctecCommIntfOnboard.c **** //if packet was changed, update pointer table and size
304:asctecCommIntfOnboard.c **** if (aciVarPacketUpdated[i]) {
305:asctecCommIntfOnboard.c ****
306:asctecCommIntfOnboard.c **** unsigned short currentPos = 0;
307:asctecCommIntfOnboard.c ****
308:asctecCommIntfOnboard.c **** //reset update flag
309:asctecCommIntfOnboard.c **** aciVarPacketUpdated[i] = 0;
310:asctecCommIntfOnboard.c ****
311:asctecCommIntfOnboard.c **** for (j=0;j<aciVarPacketSelectLength[i];j++)
312:asctecCommIntfOnboard.c **** {
313:asctecCommIntfOnboard.c ****
314:asctecCommIntfOnboard.c **** unsigned short id;
315:asctecCommIntfOnboard.c ****
316:asctecCommIntfOnboard.c **** id=aciVarPacketSelect[i][j];
317:asctecCommIntfOnboard.c ****
318:asctecCommIntfOnboard.c **** for(ii=0;ii<aciListVarCount;ii++) {
319:asctecCommIntfOnboard.c **** if (aciListVar[ii].id==id)
320:asctecCommIntfOnboard.c **** {
321:asctecCommIntfOnboard.c **** aciVarPacketPtrList[i][currentPos] = aciListVar[ii].ptrToVar;
322:asctecCommIntfOnboard.c **** aciVarPacketTypeList[i][currentPos++] = aciListVar[ii].varType;
323:asctecCommIntfOnboard.c **** break;
324:asctecCommIntfOnboard.c **** }
325:asctecCommIntfOnboard.c **** }
326:asctecCommIntfOnboard.c **** }
327:asctecCommIntfOnboard.c **** aciVarPacketNumberOfVars[i] = currentPos;
328:asctecCommIntfOnboard.c ****
329:asctecCommIntfOnboard.c **** //get packet size
330:asctecCommIntfOnboard.c **** packetSize = 0;
331:asctecCommIntfOnboard.c **** for (z = 0; z < MEMPACKET_MAX_VARS; z++) {
332:asctecCommIntfOnboard.c **** if (aciVarPacketPtrList[i][z] == NULL
333:asctecCommIntfOnboard.c **** )
334:asctecCommIntfOnboard.c **** break;
335:asctecCommIntfOnboard.c **** packetSize += aciVarPacketTypeList[i][z] >> 2;
336:asctecCommIntfOnboard.c **** }
337:asctecCommIntfOnboard.c **** aciVarPacketCurrentSize[i] = packetSize;
338:asctecCommIntfOnboard.c **** aciVarPacketContentBufferLength[i] = packetSize;
339:asctecCommIntfOnboard.c **** }
340:asctecCommIntfOnboard.c ****
341:asctecCommIntfOnboard.c **** //check for free space in ring buffer
342:asctecCommIntfOnboard.c **** else if ((aciVarPacketNumberOfVars[i])&&(aciVarPacketCurrentSize[i] + 10 < aciTxRingBufferGetFre
343:asctecCommIntfOnboard.c ****
344:asctecCommIntfOnboard.c **** unsigned char startstring[3] = { '!', '#', '!' };
345:asctecCommIntfOnboard.c **** unsigned char messageType = ACIMT_VARPACKET+i;
346:asctecCommIntfOnboard.c **** unsigned short crc = 0xFF;
347:asctecCommIntfOnboard.c **** unsigned short psize=aciVarPacketCurrentSize[i]+1;
348:asctecCommIntfOnboard.c ****
349:asctecCommIntfOnboard.c **** aciEngineRateCounter[i]=1;
350:asctecCommIntfOnboard.c ****
351:asctecCommIntfOnboard.c **** //add header to ringbuffer
352:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(&startstring, 3);
353:asctecCommIntfOnboard.c ****
354:asctecCommIntfOnboard.c **** //add message type to ringbuffer
355:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(&messageType, 1);
356:asctecCommIntfOnboard.c **** crc=aciUpdateCrc16(crc,&messageType,1);
357:asctecCommIntfOnboard.c ****
358:asctecCommIntfOnboard.c ****
359:asctecCommIntfOnboard.c **** //add data size to ringbuffer
360:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(&psize, 2);
361:asctecCommIntfOnboard.c **** crc=aciUpdateCrc16(crc,&psize,2);
362:asctecCommIntfOnboard.c ****
363:asctecCommIntfOnboard.c ****
364:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(&aciVarPacketMagicCode[i],1);
365:asctecCommIntfOnboard.c **** crc=aciUpdateCrc16(crc,&aciVarPacketMagicCode[i],1);
366:asctecCommIntfOnboard.c ****
367:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(aciVarPacketContentBuffer[i],aciVarPacketContentBufferLength[i]);
368:asctecCommIntfOnboard.c **** crc=aciUpdateCrc16(crc,&aciVarPacketContentBuffer[i][0],aciVarPacketContentBufferLength[i]);
369:asctecCommIntfOnboard.c ****
370:asctecCommIntfOnboard.c **** //add CRC to ringbuffer
371:asctecCommIntfOnboard.c **** aciTxRingBufferAddData(&crc, 2);
372:asctecCommIntfOnboard.c ****
373:asctecCommIntfOnboard.c **** }
374:asctecCommIntfOnboard.c **** }
375:asctecCommIntfOnboard.c **** }
376:asctecCommIntfOnboard.c **** }
377:asctecCommIntfOnboard.c ****
378:asctecCommIntfOnboard.c **** void aciSyncVar(void) {
379:asctecCommIntfOnboard.c **** short i = 0;
380:asctecCommIntfOnboard.c **** int z = 0;
381:asctecCommIntfOnboard.c **** for (i = 0; i < MAX_VAR_PACKETS; i++)
382:asctecCommIntfOnboard.c **** if (aciVarPacketNumberOfVars[i]) {
383:asctecCommIntfOnboard.c **** short cnt = 0;
384:asctecCommIntfOnboard.c **** for (z = 0; z < aciVarPacketNumberOfVars[i]; z++) {
385:asctecCommIntfOnboard.c **** memcpy(&aciVarPacketContentBuffer[i][cnt], aciVarPacketPtrList[i][z], aciVarPacketTypeList[i][z
386:asctecCommIntfOnboard.c **** cnt += aciVarPacketTypeList[i][z] >> 2;
387:asctecCommIntfOnboard.c ****
388:asctecCommIntfOnboard.c **** }
389:asctecCommIntfOnboard.c **** }
390:asctecCommIntfOnboard.c **** }
391:asctecCommIntfOnboard.c ****
392:asctecCommIntfOnboard.c **** void aciSyncCmd(void) {
393:asctecCommIntfOnboard.c ****
394:asctecCommIntfOnboard.c **** short j = 0;
395:asctecCommIntfOnboard.c **** short i = 0;
396:asctecCommIntfOnboard.c **** short k = 0;
397:asctecCommIntfOnboard.c **** for (j = 0; j < MAX_VAR_PACKETS; j++)
398:asctecCommIntfOnboard.c **** if (aciCmdPacketReceived[j]) {
399:asctecCommIntfOnboard.c **** short cnt = 0;
400:asctecCommIntfOnboard.c **** for (i = 0; i < aciCmdPacketSelectLength[j]; i++) {
401:asctecCommIntfOnboard.c **** for (k =0; k < aciListCmdCount;k++) {
402:asctecCommIntfOnboard.c **** if (aciListCmd[k].id == aciCmdPacketSelect[j][i]) {
403:asctecCommIntfOnboard.c **** memcpy(aciListCmd[k].ptrToVar, &aciCmdPacketContentBuffer[j][cnt], aciListCmd[k].varType >> 2
404:asctecCommIntfOnboard.c **** cnt += aciListCmd[k].varType >> 2;
405:asctecCommIntfOnboard.c **** break;
406:asctecCommIntfOnboard.c **** }
407:asctecCommIntfOnboard.c **** }
408:asctecCommIntfOnboard.c **** }
409:asctecCommIntfOnboard.c **** aciCmdPacketReceived[j]=0;
410:asctecCommIntfOnboard.c **** }
411:asctecCommIntfOnboard.c **** }
412:asctecCommIntfOnboard.c ****
413:asctecCommIntfOnboard.c **** void aciSyncPar(void) {
414:asctecCommIntfOnboard.c ****
415:asctecCommIntfOnboard.c **** short j = 0;
416:asctecCommIntfOnboard.c **** short i = 0;
417:asctecCommIntfOnboard.c **** short k = 0;
418:asctecCommIntfOnboard.c **** for (j = 0; j < MAX_VAR_PACKETS; j++)
419:asctecCommIntfOnboard.c **** if (aciParamPacketReceived[j]) {
420:asctecCommIntfOnboard.c **** short cnt = 0;
421:asctecCommIntfOnboard.c **** for (i = 0; i < aciParPacketSelectLength[j]; i++) {
422:asctecCommIntfOnboard.c **** for (k =0; k < aciListParCount;k++) {
423:asctecCommIntfOnboard.c **** if (aciListPar[k].id == aciParPacketSelect[j][i]) {
424:asctecCommIntfOnboard.c **** memcpy(aciListPar[k].ptrToVar, &aciParPacketContentBuffer[j][cnt], aciListPar[k].varType >> 2
425:asctecCommIntfOnboard.c **** cnt += aciListPar[k].varType >> 2;
426:asctecCommIntfOnboard.c **** break;
427:asctecCommIntfOnboard.c **** }
428:asctecCommIntfOnboard.c **** }
429:asctecCommIntfOnboard.c **** }
430:asctecCommIntfOnboard.c **** aciParamPacketReceived[j]=0;
431:asctecCommIntfOnboard.c **** }
432:asctecCommIntfOnboard.c ****
433:asctecCommIntfOnboard.c **** }
434:asctecCommIntfOnboard.c ****
435:asctecCommIntfOnboard.c **** /** handles all data processing. Has to be called a specified number of times per second. See aciSe
436:asctecCommIntfOnboard.c **** void aciEngine(void)
437:asctecCommIntfOnboard.c **** {
438:asctecCommIntfOnboard.c **** int i=0;
439:asctecCommIntfOnboard.c ****
440:asctecCommIntfOnboard.c **** //handle heart beat
441:asctecCommIntfOnboard.c ****
442:asctecCommIntfOnboard.c **** aciHeartBeatCnt++;
443:asctecCommIntfOnboard.c ****
444:asctecCommIntfOnboard.c ****
445:asctecCommIntfOnboard.c **** if (aciHeartBeatCnt>=aciHeartBeatTimeout)
446:asctecCommIntfOnboard.c **** {
447:asctecCommIntfOnboard.c **** //stop transmitting packets
448:asctecCommIntfOnboard.c **** aciHeartBeatCnt=0;
449:asctecCommIntfOnboard.c **** aciInhibitPacketTransmission=1;
450:asctecCommIntfOnboard.c **** }
451:asctecCommIntfOnboard.c ****
452:asctecCommIntfOnboard.c **** if (!aciInhibitPacketTransmission)
453:asctecCommIntfOnboard.c **** {
454:asctecCommIntfOnboard.c **** aciSendVar();
455:asctecCommIntfOnboard.c **** }
456:asctecCommIntfOnboard.c ****
457:asctecCommIntfOnboard.c **** for(i=0;i<MAX_VAR_PACKETS;i++)
458:asctecCommIntfOnboard.c **** {
459:asctecCommIntfOnboard.c **** aciEngineRateCounter[i]++;
460:asctecCommIntfOnboard.c **** if(aciEngineRateCounter[i]>(5*aciEngineRate)) aciEngineRateCounter[i]=0;
461:asctecCommIntfOnboard.c **** }
462:asctecCommIntfOnboard.c ****
463:asctecCommIntfOnboard.c **** if (aciParamSaveIt && (aciWriteParatoFlashCallback)) {
464:asctecCommIntfOnboard.c **** short output;
465:asctecCommIntfOnboard.c **** output = aciWriteParatoFlashCallback();
466:asctecCommIntfOnboard.c **** aciParamSaveIt = 0;
467:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SAVEPARAM,&output,2);
468:asctecCommIntfOnboard.c **** }
469:asctecCommIntfOnboard.c ****
470:asctecCommIntfOnboard.c **** if(aciSendSingleCount) {
471:asctecCommIntfOnboard.c **** // unsigned short temp_singleCount = 0;
472:asctecCommIntfOnboard.c ****
473:asctecCommIntfOnboard.c **** for(i=0;i<MAX_VARIABLE_LIST;i++) {
474:asctecCommIntfOnboard.c **** if(aciSendSingleStatus[i]==0) continue;
475:asctecCommIntfOnboard.c **** else if(aciSendSingleStatus[i]==1) {
476:asctecCommIntfOnboard.c **** aciSendSingleWithAck(i);
477:asctecCommIntfOnboard.c **** } else {
478:asctecCommIntfOnboard.c **** if(aciSendSingleStatus[i]==(aciEngineRate+2)) {
479:asctecCommIntfOnboard.c **** aciSendSingleStatus[i]=1;
480:asctecCommIntfOnboard.c **** } else aciSendSingleStatus[i]++;
481:asctecCommIntfOnboard.c **** }
482:asctecCommIntfOnboard.c **** }
483:asctecCommIntfOnboard.c **** } else aciSendSingleNextBufferCount=0;
484:asctecCommIntfOnboard.c **** }
485:asctecCommIntfOnboard.c ****
486:asctecCommIntfOnboard.c **** /*
487:asctecCommIntfOnboard.c **** * ACI RX Part
488:asctecCommIntfOnboard.c **** *
489:asctecCommIntfOnboard.c **** *
490:asctecCommIntfOnboard.c **** *
491:asctecCommIntfOnboard.c **** */
492:asctecCommIntfOnboard.c ****
493:asctecCommIntfOnboard.c **** unsigned char aciRxDataBuffer[ACI_RX_BUFFER_SIZE];
494:asctecCommIntfOnboard.c **** unsigned short aciRxDataCnt;
495:asctecCommIntfOnboard.c ****
496:asctecCommIntfOnboard.c **** void aciRxHandleMessage(unsigned char messagetype, unsigned short length)
497:asctecCommIntfOnboard.c **** {
498:asctecCommIntfOnboard.c **** short i=0;
499:asctecCommIntfOnboard.c **** int z=0;
500:asctecCommIntfOnboard.c **** int k=0;
501:asctecCommIntfOnboard.c ****
502:asctecCommIntfOnboard.c **** unsigned char packetSelect;
503:asctecCommIntfOnboard.c **** short i_single ;
504:asctecCommIntfOnboard.c **** struct ACI_INFO aciInfo;
505:asctecCommIntfOnboard.c **** unsigned char c[2];
506:asctecCommIntfOnboard.c **** unsigned char switch_type;
507:asctecCommIntfOnboard.c **** short output;
508:asctecCommIntfOnboard.c **** if((messagetype>ACIMT_UPDATEVARPACKET) && (messagetype<ACIMT_UPDATEVARPACKET+0x0f)) switch_type =
509:asctecCommIntfOnboard.c **** else if((messagetype>ACIMT_UPDATECMDPACKET) && (messagetype<ACIMT_UPDATECMDPACKET+0x0f)) switch_ty
510:asctecCommIntfOnboard.c **** else if((messagetype>ACIMT_UPDATEPARAMPACKET) &&(messagetype<ACIMT_UPDATEPARAMPACKET+0x0f)) switch
511:asctecCommIntfOnboard.c **** else if((messagetype>ACIMT_CMDPACKET) && (messagetype<ACIMT_CMDPACKET+0x0f)) switch_type = ACIMT_C
512:asctecCommIntfOnboard.c **** else if((messagetype>ACIMT_PARAMPACKET) && (messagetype<ACIMT_PARAMPACKET+0x0f)) switch_type = ACI
513:asctecCommIntfOnboard.c **** else switch_type=messagetype;
514:asctecCommIntfOnboard.c ****
515:asctecCommIntfOnboard.c **** switch (switch_type)
516:asctecCommIntfOnboard.c **** {
517:asctecCommIntfOnboard.c **** case ACIMT_INFO_REQUEST:
518:asctecCommIntfOnboard.c **** aciInfo.verMajor=ACI_VER_MAJOR;
519:asctecCommIntfOnboard.c **** aciInfo.verMinor=ACI_VER_MINOR;
520:asctecCommIntfOnboard.c **** aciInfo.maxDescLength=MAX_DESC_LENGTH;
521:asctecCommIntfOnboard.c **** aciInfo.maxNameLength=MAX_NAME_LENGTH;
522:asctecCommIntfOnboard.c **** aciInfo.maxUnitLength=MAX_UNIT_LENGTH;
523:asctecCommIntfOnboard.c **** aciInfo.maxVarPackets=MAX_VAR_PACKETS;
524:asctecCommIntfOnboard.c **** aciInfo.memPacketMaxVars=MEMPACKET_MAX_VARS;
525:asctecCommIntfOnboard.c **** aciInfo.flags=0;
526:asctecCommIntfOnboard.c **** for (i=0;i<8;i++)
527:asctecCommIntfOnboard.c **** aciInfo.dummy[i]=0;
528:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_INFO_REPLY,&aciInfo,sizeof(aciInfo));
529:asctecCommIntfOnboard.c ****
530:asctecCommIntfOnboard.c **** break;
531:asctecCommIntfOnboard.c **** case ACIMT_REQUESTVARTABLEENTRIES:
532:asctecCommIntfOnboard.c **** for (i=0;i<length/2;i++)
533:asctecCommIntfOnboard.c **** {
534:asctecCommIntfOnboard.c **** unsigned short selectedId;
535:asctecCommIntfOnboard.c **** unsigned char idFound=0;
536:asctecCommIntfOnboard.c ****
537:asctecCommIntfOnboard.c **** selectedId=(aciRxDataBuffer[i*2+1]<<8)|aciRxDataBuffer[i*2];
538:asctecCommIntfOnboard.c **** //determine no of entries in var table
539:asctecCommIntfOnboard.c **** for(k=0;k<aciListVarCount;k++) {
540:asctecCommIntfOnboard.c **** if (selectedId==aciListVar[k].id)
541:asctecCommIntfOnboard.c **** {
542:asctecCommIntfOnboard.c **** idFound=1;
543:asctecCommIntfOnboard.c **** break;
544:asctecCommIntfOnboard.c **** }
545:asctecCommIntfOnboard.c **** }
546:asctecCommIntfOnboard.c **** if ((idFound))
547:asctecCommIntfOnboard.c **** {
548:asctecCommIntfOnboard.c **** //before we send the data, the strings have to be copied from flash to memory
549:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY_WITH_STRINGS tableEntry;
550:asctecCommIntfOnboard.c ****
551:asctecCommIntfOnboard.c **** if (strlen(aciListVar[k].name)>MAX_NAME_LENGTH)
552:asctecCommIntfOnboard.c **** {
553:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.name[0]),aciListVar[k].name,MAX_NAME_LENGTH);
554:asctecCommIntfOnboard.c **** tableEntry.name[MAX_NAME_LENGTH-1]=0;
555:asctecCommIntfOnboard.c **** }else
556:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.name[0]),aciListVar[k].name);
557:asctecCommIntfOnboard.c ****
558:asctecCommIntfOnboard.c **** if (strlen(aciListVar[k].description)>MAX_DESC_LENGTH)
559:asctecCommIntfOnboard.c **** {
560:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.description[0]),aciListVar[k].description,MAX_NAME_LENGTH);
561:asctecCommIntfOnboard.c **** tableEntry.description[MAX_DESC_LENGTH-1]=0;
562:asctecCommIntfOnboard.c **** }else
563:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.description[0]),aciListVar[k].description);
564:asctecCommIntfOnboard.c ****
565:asctecCommIntfOnboard.c **** if (strlen(aciListVar[k].unit)>MAX_UNIT_LENGTH)
566:asctecCommIntfOnboard.c **** {
567:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.unit[0]),aciListVar[k].unit,MAX_UNIT_LENGTH);
568:asctecCommIntfOnboard.c **** tableEntry.unit[MAX_UNIT_LENGTH-1]=0;
569:asctecCommIntfOnboard.c **** }else
570:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.unit[0]),aciListVar[k].unit);
571:asctecCommIntfOnboard.c ****
572:asctecCommIntfOnboard.c **** tableEntry.id=aciListVar[k].id;
573:asctecCommIntfOnboard.c **** tableEntry.varType=aciListVar[k].varType;
574:asctecCommIntfOnboard.c **** tableEntry.ptrToVar=NULL;
575:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDVARTABLEENTRY,&tableEntry,sizeof (struct ACI_MEM_TABLE_ENTRY_WITH_ST
576:asctecCommIntfOnboard.c ****
577:asctecCommIntfOnboard.c **** }else
578:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDVARTABLEENTRYINVALID,&selectedId,2);
579:asctecCommIntfOnboard.c ****
580:asctecCommIntfOnboard.c **** }
581:asctecCommIntfOnboard.c ****
582:asctecCommIntfOnboard.c **** break;
583:asctecCommIntfOnboard.c **** case ACIMT_GETVARTABLEINFO:
584:asctecCommIntfOnboard.c **** {
585:asctecCommIntfOnboard.c **** unsigned short idList[aciListVarCount*2+2];
586:asctecCommIntfOnboard.c **** unsigned short cnt=1;
587:asctecCommIntfOnboard.c ****
588:asctecCommIntfOnboard.c **** idList[0]=(unsigned short)aciListVarCount;
589:asctecCommIntfOnboard.c ****
590:asctecCommIntfOnboard.c **** for(k=0;k<aciListVarCount;k++)
591:asctecCommIntfOnboard.c **** idList[cnt++]=aciListVar[k].id;
592:asctecCommIntfOnboard.c ****
593:asctecCommIntfOnboard.c **** //send no of entries
594:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDVARTABLEINFO,&idList[0],aciListVarCount*2+2);
595:asctecCommIntfOnboard.c **** }
596:asctecCommIntfOnboard.c **** break;
597:asctecCommIntfOnboard.c **** case ACIMT_UPDATEVARPACKET:
598:asctecCommIntfOnboard.c **** packetSelect=messagetype-ACIMT_UPDATEVARPACKET;
599:asctecCommIntfOnboard.c **** aciInhibitPacketTransmission=0;
600:asctecCommIntfOnboard.c **** if (packetSelect>=MAX_VAR_PACKETS)
601:asctecCommIntfOnboard.c **** break;
602:asctecCommIntfOnboard.c **** if (length>MEMPACKET_MAX_VARS*2+1)
603:asctecCommIntfOnboard.c **** {
604:asctecCommIntfOnboard.c **** c[0]=ACIMT_UPDATEVARPACKET+packetSelect;
605:asctecCommIntfOnboard.c **** c[1]=ACI_ACK_PACKET_TOO_LONG;
606:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&c[0],2);
607:asctecCommIntfOnboard.c **** break;
608:asctecCommIntfOnboard.c **** }
609:asctecCommIntfOnboard.c ****
610:asctecCommIntfOnboard.c **** for (i=0;i<MEMPACKET_MAX_VARS;i++)
611:asctecCommIntfOnboard.c **** {
612:asctecCommIntfOnboard.c **** aciVarPacketSelect[packetSelect][i]=ID_NONE;
613:asctecCommIntfOnboard.c **** aciVarPacketPtrList[packetSelect][i]=NULL;
614:asctecCommIntfOnboard.c **** aciVarPacketTypeList[packetSelect][i]=0;
615:asctecCommIntfOnboard.c **** }
616:asctecCommIntfOnboard.c **** aciVarPacketMagicCode[packetSelect]=aciRxDataBuffer[0];
617:asctecCommIntfOnboard.c **** memcpy(&aciVarPacketSelect[packetSelect],&aciRxDataBuffer[1],length-1);
618:asctecCommIntfOnboard.c **** aciVarPacketSelectLength[packetSelect]=(length-1)/2;
619:asctecCommIntfOnboard.c **** aciVarPacketContentBufferLength[packetSelect] = aciVarPacketSelectLength[packetSelect];
620:asctecCommIntfOnboard.c **** aciVarPacketUpdated[packetSelect]=1;
621:asctecCommIntfOnboard.c **** c[0]=ACIMT_UPDATEVARPACKET+packetSelect;
622:asctecCommIntfOnboard.c **** c[1]=ACI_ACK_OK;
623:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&c[0],2);
624:asctecCommIntfOnboard.c ****
625:asctecCommIntfOnboard.c **** break;
626:asctecCommIntfOnboard.c ****
627:asctecCommIntfOnboard.c **** case ACIMT_REQUESTCMDTABLEENTRIES:
628:asctecCommIntfOnboard.c **** for (i=0;i<length/2;i++)
629:asctecCommIntfOnboard.c **** {
630:asctecCommIntfOnboard.c **** unsigned short selectedId;
631:asctecCommIntfOnboard.c **** unsigned char idFound=0;
632:asctecCommIntfOnboard.c ****
633:asctecCommIntfOnboard.c **** selectedId=(aciRxDataBuffer[i*2+1]<<8)|aciRxDataBuffer[i*2];
634:asctecCommIntfOnboard.c **** //determine no of entries in var table
635:asctecCommIntfOnboard.c **** for(k=0;k<aciListCmdCount;k++) {
636:asctecCommIntfOnboard.c **** if (selectedId==aciListCmd[k].id)
637:asctecCommIntfOnboard.c **** {
638:asctecCommIntfOnboard.c **** idFound=1;
639:asctecCommIntfOnboard.c **** break;
640:asctecCommIntfOnboard.c **** }
641:asctecCommIntfOnboard.c **** }
642:asctecCommIntfOnboard.c **** if ((idFound))
643:asctecCommIntfOnboard.c **** {
644:asctecCommIntfOnboard.c **** //before we send the data, the strings have to be copied from flash to memory
645:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY_WITH_STRINGS tableEntry;
646:asctecCommIntfOnboard.c ****
647:asctecCommIntfOnboard.c **** if (strlen(aciListCmd[k].name)>MAX_NAME_LENGTH)
648:asctecCommIntfOnboard.c **** {
649:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.name[0]),aciListCmd[k].name,MAX_NAME_LENGTH);
650:asctecCommIntfOnboard.c **** tableEntry.name[MAX_NAME_LENGTH-1]=0;
651:asctecCommIntfOnboard.c **** } else
652:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.name[0]),aciListCmd[k].name);
653:asctecCommIntfOnboard.c ****
654:asctecCommIntfOnboard.c **** if (strlen(aciListCmd[k].description)>MAX_DESC_LENGTH)
655:asctecCommIntfOnboard.c **** {
656:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.description[0]),aciListCmd[k].description,MAX_NAME_LENGTH);
657:asctecCommIntfOnboard.c **** tableEntry.description[MAX_DESC_LENGTH-1]=0;
658:asctecCommIntfOnboard.c **** }else
659:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.description[0]),aciListCmd[k].description);
660:asctecCommIntfOnboard.c ****
661:asctecCommIntfOnboard.c **** if (strlen(aciListCmd[k].unit)>MAX_UNIT_LENGTH)
662:asctecCommIntfOnboard.c **** {
663:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.unit[0]),aciListCmd[k].unit,MAX_UNIT_LENGTH);
664:asctecCommIntfOnboard.c **** tableEntry.unit[MAX_UNIT_LENGTH-1]=0;
665:asctecCommIntfOnboard.c **** }else
666:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.unit[0]),aciListCmd[k].unit);
667:asctecCommIntfOnboard.c ****
668:asctecCommIntfOnboard.c **** tableEntry.id=aciListCmd[k].id;
669:asctecCommIntfOnboard.c **** tableEntry.varType=aciListCmd[k].varType;
670:asctecCommIntfOnboard.c **** tableEntry.ptrToVar=NULL;
671:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDCMDTABLEENTRY,&tableEntry,sizeof (struct ACI_MEM_TABLE_ENTRY_WITH_ST
672:asctecCommIntfOnboard.c ****
673:asctecCommIntfOnboard.c **** }else
674:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDCMDTABLEENTRYINVALID,&selectedId,2);
675:asctecCommIntfOnboard.c ****
676:asctecCommIntfOnboard.c **** }
677:asctecCommIntfOnboard.c ****
678:asctecCommIntfOnboard.c **** break;
679:asctecCommIntfOnboard.c **** case ACIMT_GETCMDTABLEINFO:
680:asctecCommIntfOnboard.c **** {
681:asctecCommIntfOnboard.c **** unsigned short idList[aciListCmdCount*2+2];
682:asctecCommIntfOnboard.c **** unsigned short cnt=1;
683:asctecCommIntfOnboard.c ****
684:asctecCommIntfOnboard.c **** idList[0]=aciListCmdCount;
685:asctecCommIntfOnboard.c ****
686:asctecCommIntfOnboard.c **** for(k=0;k<aciListCmdCount;k++) {
687:asctecCommIntfOnboard.c **** idList[cnt++]=aciListCmd[k].id;
688:asctecCommIntfOnboard.c **** }
689:asctecCommIntfOnboard.c **** //send no of entries
690:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDCMDTABLEINFO,&idList[0],aciListCmdCount*2+2);
691:asctecCommIntfOnboard.c **** }
692:asctecCommIntfOnboard.c **** break;
693:asctecCommIntfOnboard.c **** case ACIMT_UPDATECMDPACKET:
694:asctecCommIntfOnboard.c **** packetSelect=messagetype-ACIMT_UPDATECMDPACKET;
695:asctecCommIntfOnboard.c **** if (packetSelect>=MAX_VAR_PACKETS)
696:asctecCommIntfOnboard.c **** break;
697:asctecCommIntfOnboard.c **** if (length>MEMPACKET_MAX_VARS*2+1)
698:asctecCommIntfOnboard.c **** {
699:asctecCommIntfOnboard.c **** c[0]=ACIMT_UPDATECMDPACKET+packetSelect;
700:asctecCommIntfOnboard.c **** c[1]=ACI_ACK_PACKET_TOO_LONG;
701:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&c[0],2);
702:asctecCommIntfOnboard.c **** break;
703:asctecCommIntfOnboard.c **** }
704:asctecCommIntfOnboard.c ****
705:asctecCommIntfOnboard.c **** aciCmdPacketMagicCode[packetSelect]=aciRxDataBuffer[0];
706:asctecCommIntfOnboard.c **** aciCmdPacketWithACK[packetSelect]=aciRxDataBuffer[1];
707:asctecCommIntfOnboard.c **** memcpy(&aciCmdPacketSelect[packetSelect], &aciRxDataBuffer[2],length - 2);
708:asctecCommIntfOnboard.c **** short cnta = 0;
709:asctecCommIntfOnboard.c **** for (i = 0; i < (length - 2) / 2; i++) {
710:asctecCommIntfOnboard.c **** for(k=0;k<aciListCmdCount;k++) {
711:asctecCommIntfOnboard.c **** if (aciListCmd[k].id
712:asctecCommIntfOnboard.c **** == aciCmdPacketSelect[packetSelect][i]) {
713:asctecCommIntfOnboard.c **** cnta += aciListCmd[k].varType >> 2;
714:asctecCommIntfOnboard.c **** break;
715:asctecCommIntfOnboard.c **** }
716:asctecCommIntfOnboard.c **** }
717:asctecCommIntfOnboard.c ****
718:asctecCommIntfOnboard.c **** }
719:asctecCommIntfOnboard.c **** if(cnta==0) break;
720:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferLength[packetSelect] = cnta;
721:asctecCommIntfOnboard.c **** aciCmdPacketSelectLength[packetSelect]=(length-2)/2;
722:asctecCommIntfOnboard.c **** c[0]=ACIMT_UPDATECMDPACKET+packetSelect;
723:asctecCommIntfOnboard.c **** c[1]=ACI_ACK_OK;
724:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&c[0],2);
725:asctecCommIntfOnboard.c ****
726:asctecCommIntfOnboard.c **** break;
727:asctecCommIntfOnboard.c **** case ACIMT_UPDATEPARAMPACKET:
728:asctecCommIntfOnboard.c ****
729:asctecCommIntfOnboard.c **** packetSelect=messagetype-ACIMT_UPDATEPARAMPACKET;
730:asctecCommIntfOnboard.c **** unsigned char temp_buffer[MEMPACKET_MAX_VARS*16];
731:asctecCommIntfOnboard.c **** if (packetSelect>=MAX_VAR_PACKETS)
732:asctecCommIntfOnboard.c **** break;
733:asctecCommIntfOnboard.c **** if (length>MEMPACKET_MAX_VARS*2+1)
734:asctecCommIntfOnboard.c **** {
735:asctecCommIntfOnboard.c **** c[0]=ACIMT_UPDATEPARAMPACKET+packetSelect;
736:asctecCommIntfOnboard.c **** c[1]=ACI_ACK_PACKET_TOO_LONG;
737:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&c[0],2);
738:asctecCommIntfOnboard.c **** break;
739:asctecCommIntfOnboard.c **** }
740:asctecCommIntfOnboard.c ****
741:asctecCommIntfOnboard.c **** aciParPacketMagicCode[packetSelect]=aciRxDataBuffer[0];
742:asctecCommIntfOnboard.c **** memcpy(&aciParPacketSelect[packetSelect],&aciRxDataBuffer[1],length-1);
743:asctecCommIntfOnboard.c ****
744:asctecCommIntfOnboard.c **** temp_buffer[0]=ACIMT_UPDATEPARAMPACKET+packetSelect;
745:asctecCommIntfOnboard.c **** temp_buffer[1]=ACI_ACK_OK;
746:asctecCommIntfOnboard.c **** short cunt = 0;
747:asctecCommIntfOnboard.c **** for (i = 0; i < (length - 1) / 2; i++) {
748:asctecCommIntfOnboard.c **** for (k=0;k<aciListParCount;k++) {
749:asctecCommIntfOnboard.c **** if (aciListPar[k].id == aciParPacketSelect[packetSelect][i]) {
750:asctecCommIntfOnboard.c **** memcpy(&temp_buffer[cunt+2],aciListPar[k].ptrToVar,aciListPar[k].varType >> 2);
751:asctecCommIntfOnboard.c **** cunt += aciListPar[k].varType >> 2;
752:asctecCommIntfOnboard.c **** break;
753:asctecCommIntfOnboard.c **** }
754:asctecCommIntfOnboard.c **** }
755:asctecCommIntfOnboard.c **** }
756:asctecCommIntfOnboard.c **** aciParPacketContentBufferLength[packetSelect]=cunt;
757:asctecCommIntfOnboard.c **** aciParPacketSelectLength[packetSelect]=(length-1)/2;
758:asctecCommIntfOnboard.c **** // c[0]=ACIMT_UPDATEPARAMPACKET+packetSelect;
759:asctecCommIntfOnboard.c **** // c[1]=ACI_ACK_OK;
760:asctecCommIntfOnboard.c **** // aciTxSendPacket(ACI_DBG,&temp_buffer[2],2);
761:asctecCommIntfOnboard.c **** // aciTxSendPacket(ACI_DBG,&temp_buffer[4],2);
762:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK,&temp_buffer[0],2+cunt);
763:asctecCommIntfOnboard.c ****
764:asctecCommIntfOnboard.c **** break;
765:asctecCommIntfOnboard.c ****
766:asctecCommIntfOnboard.c **** case ACIMT_CMDPACKET:
767:asctecCommIntfOnboard.c **** //check magic code to see that the packet fits the desired configuration
768:asctecCommIntfOnboard.c ****
769:asctecCommIntfOnboard.c **** packetSelect=messagetype-ACIMT_CMDPACKET;
770:asctecCommIntfOnboard.c **** // aciTxSendPacket(ACI_DBG, &aciCmdPacketContentBufferLength[packetSelect], 2);
771:asctecCommIntfOnboard.c **** // aciTxSendPacket(ACI_DBG, &length, 2);
772:asctecCommIntfOnboard.c **** if (packetSelect>=MAX_VAR_PACKETS)
773:asctecCommIntfOnboard.c **** break;
774:asctecCommIntfOnboard.c **** if (((aciCmdPacketContentBufferLength[packetSelect]==length-1))) //aciCmdPacketMagicCode[p
775:asctecCommIntfOnboard.c **** {
776:asctecCommIntfOnboard.c **** memcpy(&aciCmdPacketContentBuffer[packetSelect][0],&aciRxDataBuffer[1],length-1);
777:asctecCommIntfOnboard.c **** aciCmdPacketReceived[packetSelect]=1;
778:asctecCommIntfOnboard.c **** if (aciCmdPacketWithACK[packetSelect]) {
779:asctecCommIntfOnboard.c **** c[0] = ACIMT_CMDACK + packetSelect;
780:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_ACK, &c[0], 1);
781:asctecCommIntfOnboard.c **** }
782:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferValid[packetSelect] = 1;
783:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferInvalidCnt[packetSelect] = 0;
784:asctecCommIntfOnboard.c ****
785:asctecCommIntfOnboard.c **** } else {
786:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferValid[packetSelect] = 0;
787:asctecCommIntfOnboard.c **** aciCmdPacketContentBufferInvalidCnt[packetSelect]++;
788:asctecCommIntfOnboard.c **** }
789:asctecCommIntfOnboard.c **** break;
790:asctecCommIntfOnboard.c ****
791:asctecCommIntfOnboard.c **** // Parameter
792:asctecCommIntfOnboard.c **** case ACIMT_REQUESTPARAMTABLEENTRIES:
793:asctecCommIntfOnboard.c **** for (i=0;i<length/2;i++)
794:asctecCommIntfOnboard.c **** {
795:asctecCommIntfOnboard.c **** unsigned short selectedId;
796:asctecCommIntfOnboard.c **** unsigned char idFound=0;
797:asctecCommIntfOnboard.c **** k=0;
798:asctecCommIntfOnboard.c ****
799:asctecCommIntfOnboard.c **** selectedId=(aciRxDataBuffer[i*2+1]<<8)|aciRxDataBuffer[i*2];
800:asctecCommIntfOnboard.c **** //determine no of entries in param table
801:asctecCommIntfOnboard.c **** for(k=0;k<aciListParCount;k++) {
802:asctecCommIntfOnboard.c **** if (selectedId==aciListPar[k].id)
803:asctecCommIntfOnboard.c **** {
804:asctecCommIntfOnboard.c **** idFound=1;
805:asctecCommIntfOnboard.c **** break;
806:asctecCommIntfOnboard.c **** }
807:asctecCommIntfOnboard.c **** }
808:asctecCommIntfOnboard.c **** if ((idFound))
809:asctecCommIntfOnboard.c **** {
810:asctecCommIntfOnboard.c **** //before we send the data, the strings have to be copied from flash to memory
811:asctecCommIntfOnboard.c **** struct ACI_MEM_TABLE_ENTRY_WITH_STRINGS tableEntry;
812:asctecCommIntfOnboard.c ****
813:asctecCommIntfOnboard.c **** if (strlen(aciListPar[k].name)>MAX_NAME_LENGTH)
814:asctecCommIntfOnboard.c **** {
815:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.name[0]),aciListPar[k].name,MAX_NAME_LENGTH);
816:asctecCommIntfOnboard.c **** tableEntry.name[MAX_NAME_LENGTH-1]=0;
817:asctecCommIntfOnboard.c **** } else
818:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.name[0]),aciListPar[k].name);
819:asctecCommIntfOnboard.c ****
820:asctecCommIntfOnboard.c **** if (strlen(aciListPar[k].description)>MAX_DESC_LENGTH)
821:asctecCommIntfOnboard.c **** {
822:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.description[0]),aciListPar[k].description,MAX_NAME_LENGTH);
823:asctecCommIntfOnboard.c **** tableEntry.description[MAX_DESC_LENGTH-1]=0;
824:asctecCommIntfOnboard.c **** } else
825:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.description[0]),aciListPar[k].description);
826:asctecCommIntfOnboard.c ****
827:asctecCommIntfOnboard.c **** if (strlen(aciListPar[k].unit)>MAX_UNIT_LENGTH)
828:asctecCommIntfOnboard.c **** {
829:asctecCommIntfOnboard.c **** memcpy(&(tableEntry.unit[0]),aciListPar[k].unit,MAX_UNIT_LENGTH);
830:asctecCommIntfOnboard.c **** tableEntry.unit[MAX_UNIT_LENGTH-1]=0;
831:asctecCommIntfOnboard.c **** }else
832:asctecCommIntfOnboard.c **** strcpy(&(tableEntry.unit[0]),aciListPar[k].unit);
833:asctecCommIntfOnboard.c ****
834:asctecCommIntfOnboard.c **** tableEntry.id=aciListPar[k].id;
835:asctecCommIntfOnboard.c **** tableEntry.varType=aciListPar[k].varType;
836:asctecCommIntfOnboard.c **** tableEntry.ptrToVar=NULL;
837:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDPARAMTABLEENTRY,&tableEntry,sizeof (struct ACI_MEM_TABLE_ENTRY_W
838:asctecCommIntfOnboard.c ****
839:asctecCommIntfOnboard.c **** }else
840:asctecCommIntfOnboard.c **** aciTxSendPacket(ACIMT_SENDPARAMTABLEENTRYINVALID,&selectedId,2);
841:asctecCommIntfOnboard.c ****
842:asctecCommIntfOnboard.c **** }
843:asctecCommIntfOnboard.c ****
844:asctecCommIntfOnboard.c **** break;
845:asctecCommIntfOnboard.c **** case ACIMT_GETPARAMTABLEINFO: