Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
  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
;============================================================================
;
; translate this with 
; 	cat pseudocode | sed -f act2num |  awk -f compile.awk >pseudocode.h
;
; actionname	pseudocode
;
;============================================================================
ADM1		SEND_SABME_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=0
		S_FLAG:=0
;
; instructions in ADM2 have been changed:
; 1. 	P_FLAG:=P is probably wrong in doc...
; 	I think it should be F_FLAG:=P the way it is in CONN3
; 2.	CONNECT_RESPONSE has been wired in here,
;	CONN1 is no longer referenced
;
ADM2		F_FLAG:=P
		SEND_UA_RSP(F=X)
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		P_FLAG:=0
		REMOTE_BUSY:=0
		CONNECT_INDICATION
ADM3		SEND_DM_RSP(F=X)
ADM4		SEND_DM_RSP(F=X)
ADM5		NOP
;============================================================================
;CONN1		SEND_UA_RSP(F=X)
;		V(S):=0
;		V(R):=0
;		RETRY_COUNT:=0
;		P_FLAG:=0
;		REMOTE_BUSY:=0
CONN2		SEND_DM_RSP(F=X)
CONN3		F_FLAG:=P
CONN4		DISCONNECT_INDICATION
CONN5		NOP
;============================================================================
RESWAIT1	SEND_SABME_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=0
RESWAIT2	SEND_UA_RSP(F=X)
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		P_FLAG:=0
		REMOTE_BUSY:=0
		RESET_CONFIRM
RESWAIT3	SEND_DISC_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=0
RESWAIT4	SEND_DM_RSP(F=X)		
RESWAIT5	DISCONNECT_INDICATION
RESWAIT6	S_FLAG:=1
		F_FLAG:=P
RESWAIT7	SEND_DM_RSP(F=X)
		DISCONNECT_INDICATION
RESWAIT8	NOP
;============================================================================
RESCHK1		SEND_UA_RSP(F=X)
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		P_FLAG:=0
		REMOTE_BUSY:=0
RESCHK2		SEND_DM_RSP(F=X)
RESCHK3		DISCONNECT_INDICATION
RESCHK4		F_FLAG:=P
RESCHK5		SEND_DM_RSP(F=X)
		DISCONNECT_INDICATION
RESCHK6		NOP
;============================================================================
SETUP1		SEND_UA_RSP(F=X)
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		S_FLAG:=1
SETUP2		STOP_ACK_TIMER
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		UPDATE_P_FLAG
		CONNECT_CONFIRM
		REMOTE_BUSY:=0
SETUP3		P_FLAG:=0
		CONNECT_CONFIRM
		REMOTE_BUSY:=0
SETUP4		SEND_DM_RSP(F=X)
		DISCONNECT_INDICATION
		STOP_ACK_TIMER
SETUP5		DISCONNECT_INDICATION
		STOP_ACK_TIMER
SETUP6		NOP
SETUP7		SEND_SABME_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
SETUP8		DISCONNECT_INDICATION
;============================================================================
RESET1		SEND_UA_RSP(F=X)
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		S_FLAG:=1
RESET2		STOP_ACK_TIMER
		V(S):=0
		V(R):=0
		RETRY_COUNT:=0
		UPDATE_P_FLAG
		RESET_CONFIRM
		REMOTE_BUSY:=0
RESET3		P_FLAG:=0
		RESET_CONFIRM
		REMOTE_BUSY:=0
RESET4		SEND_DM_RSP(F=X)
		DISCONNECT_INDICATION
		STOP_ACK_TIMER
RESET5		DISCONNECT_INDICATION
		STOP_ACK_TIMER
RESET6		NOP
RESET7		SEND_SABME_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
RESET8		DISCONNECT_INDICATION
;============================================================================
D_CONN1		SEND_DM_RSP(F=X)
		STOP_ACK_TIMER
D_CONN2		STOP_ACK_TIMER
D_CONN3		SEND_UA_RSP(F=X)
D_CONN4		STOP_ACK_TIMER
D_CONN5		NOP
D_CONN6		SEND_DISC_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
D_CONN7		NOP
;============================================================================
ERR1		RESET_INDICATION(REMOTE)
		STOP_ACK_TIMER
		F_FLAG:=P
ERR2		SEND_UA_RSP(F=X)
		DISCONNECT_INDICATION
		STOP_ACK_TIMER
ERR3		DISCONNECT_INDICATION
		STOP_ACK_TIMER
ERR4		RESET_INDICATION(LOCAL)
		STOP_ACK_TIMER
		REPORT_STATUS(FRMR_RECEIVED)
		S_FLAG:=0
ERR5		RE-SEND_FRMR_RSP(F=P)
		START_ACK_TIMER
ERR6		NOP
ERR7		RE-SEND_FRMR_RSP(F=0)
		START_ACK_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
ERR8		S_FLAG:=0
		RESET_INDICATION(LOCAL)
;============================================================================
; the shared actions are common to states NORMAL, BUSY, REJECT,
; AWAIT, AWAIT_BUSY and AWAIT_REJECT.
;============================================================================
SH1		SEND_DISC_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
SH2		SEND_SABME_CMD(P=X)
		P_FLAG:=P
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
		S_FLAG:=0
SH3		RESET_INDICATION(REMOTE)
		F_FLAG:=P
		STOP_ALL_TIMERS
SH4		SEND_UA_RSP(F=X)
		DISCONNECT_INDICATION
		STOP_ALL_TIMERS
SH5		STOP_ALL_TIMERS
		RESET_INDICATION(LOCAL)
		REPORT_STATUS(FRMR_RECEIVED)
		S_FLAG:=0
SH6		DISCONNECT_INDICATION
		STOP_ALL_TIMERS
SH7		SEND_FRMR_RSP(F=X)
		REPORT_STATUS(FRMR_SENT)
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
SH8		SEND_FRMR_RSP(F=0)
		REPORT_STATUS(FRMR_SENT)
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
SH9		SEND_FRMR_RSP(F=0)
		REPORT_STATUS(FRMR_SENT)
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
SH10		SEND_FRMR_RSP(F=X)
		REPORT_STATUS(FRMR_SENT)
		START_ACK_TIMER
		STOP_OTHER_TIMERS
		RETRY_COUNT:=0
SH11		STOP_ALL_TIMERS
		RESET_INDICATION(LOCAL)
		S_FLAG:=0
;============================================================================
NORMAL1		SEND_I_CMD(P=1)
		START_P_TIMER
		START_ACK_TIMER_IF_NOT_RUNNING
;		SEND_I_XXX(X=0)
;		START_ACK_TIMER_IF_NOT_RUNNING
NORMAL2		SEND_I_XXX(X=0)
		START_ACK_TIMER_IF_NOT_RUNNING
NORMAL3		SEND_RNR_CMD(F=1)
		START_P_TIMER
		DATA_FLAG:=0
;		SEND_RNR_XXX(X=0)
;		DATA_FLAG:=0
NORMAL4		SEND_RNR_XXX(X=0)
		DATA_FLAG:=0
NORMAL5		SEND_REJ_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		UPDATE_P_FLAG
		START_REJ_TIMER
		IF_F=1_CLEAR_REMOTE_BUSY
;		SEND_REJ_CMD(P=1)
;		UPDATE_N(R)_RECEIVED
;		START_P_TIMER
;		START_REJ_TIMER
;		IF_F=1_CLEAR_REMOTE_BUSY
NORMAL6		SEND_REJ_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		START_REJ_TIMER
NORMAL7		SEND_REJ_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		START_REJ_TIMER
;
; the order of opcodes in NORMAL8 is changed.
; the transition table will execute NORMAL8A for incoming pdus
; with p/f 1, pdus with pf 0 are treated in NORMAL8B.
;   
NORMAL8A	V(R):=V(R)+1
		SEND_ACKNOWLEDGE_CMD(P=1)
		START_P_TIMER
		UPDATE_N(R)_RECEIVED
		IF_F=1_CLEAR_REMOTE_BUSY
		DATA_INDICATION
;
NORMAL8B	V(R):=V(R)+1
		UPDATE_P_FLAG
		SEND_ACKNOWLEDGE_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		IF_F=1_CLEAR_REMOTE_BUSY
		DATA_INDICATION
;
; the order of opcodes in NORMAL9 is changed 
NORMAL9		V(R):=V(R)+1
		SEND_ACKNOWLEDGE_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
;
; the order of opcodes in NORMAL10 is changed 
NORMAL10	V(R):=V(R)+1
		SEND_ACKNOWLEDGE_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
NORMAL11	UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
NORMAL12	SEND_ACKNOWLEDGE_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
NORMAL13	UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
NORMAL14	SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
NORMAL15	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		UPDATE_P_FLAG
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		V(S):=N(R)
;		UPDATE_N(R)_RECEIVED
;		START_P_TIMER
;		RE-SEND_I_CMD(P=1)
;		CLEAR_REMOTE_BUSY
NORMAL16	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
NORMAL17	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		RE-SEND_I_RSP(F=1)
		CLEAR_REMOTE_BUSY
NORMAL18	SEND_RR_CMD(P=1)
		START_P_TIMER
NORMAL19	P_FLAG:=0
;		SEND_RR_CMD(P=1)
;		START_P_TIMER
;		RETRY_COUNT:=RETRY_COUNT+1
NORMAL20	SEND_RR_CMD(P=1)
		START_P_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
BUSY1		SEND_I_CMD(P=1)
		START_P_TIMER
		START_ACK_TIMER_IF_NOT_RUNNING
;		SEND_I_XXX(X=0)
;		START_ACK_TIMER_IF_NOT_RUNNING
BUSY2		SEND_I_XXX(X=0)
		START_ACK_TIMER_IF_NOT_RUNNING
BUSY3		SEND_REJ_CMD(P=1)
		START_REJ_TIMER
		START_P_TIMER
;		SEND_REJ_XXX(X=0)
;		START_REJ_TIMER
BUSY4		SEND_REJ_XXX(X=0)
		START_REJ_TIMER
BUSY5		SEND_RR_CMD(P=1)
		START_P_TIMER
		SEND_RR_XXX(X=0)
BUSY6		SEND_RR_XXX(X=0)
BUSY7		SEND_RR_CMD(P=1)
		START_P_TIMER
		SEND_RR_XXX(X=0)
BUSY8		SEND_RR_XXX(X=0)
BUSY9		OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
		IF_F=1_CLEAR_REMOTE_BUSY
;		SEND_RNR_CMD(P=1)
;		START_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
;		IF_F=1_CLEAR_REMOTE_BUSY
BUSY10		OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
BUSY11		SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG_=0_THEN_DATA_FLAG:=1
BUSY12		SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG=2_STOP_REJ_TIMER
		DATA_FLAG:=1
;		V(R):=V(R)+1
;		DATA_INDICATION
;		SEND_RNR_RSP(F=1)
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG=2_STOP_REJ_TIMER
;		DATA_FLAG:=0
BUSY13		OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG=2_STOP_REJ_TIMER
		DATA_FLAG:=1
		IF_F=1_CLEAR_REMOTE_BUSY
;		SEND_RNR_CMD(F=1)
;		START_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG=2_STOP_REJ_TIMER
;		DATA_FLAG:=1
;		IF_F=1_CLEAR_REMOTE_BUSY
;		V(R):=V(R)+1
;		DATA_INDICATION
;		SEND_RNR_CMD(F=1)
;		START_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG=2_STOP_REJ_TIMER
;		DATA_FLAG:=0
;		IF_F=1_CLEAR_REMOTE_BUSY
;		V(R):=V(R)+1
;		DATA_INDICATION
;		UPDATE_P_FLAG
;		OPTIONAL_SEND_RNR_XXX(X=0)
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG=2_STOP_REJ_TIMER
;		DATA_FLAG:=0
;		IF_F=1_CLEAR_REMOTE_BUSY
BUSY14		OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		IF_DATA_FLAG=2_STOP_REJ_TIMER
		DATA_FLAG:=1
;		V(R):=V(R)+1
;		DATA_INDICATION
;		OPTIONAL_SEND_RNR_XXX(X=0)
;		UPDATE_N(R)_RECEIVED
;		IF_DATA_FLAG=2_STOP_REJ_TIMER
;		DATA_FLAG:=0
BUSY15		UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
BUSY16		SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
BUSY17		UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
BUSY18		SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
BUSY19		V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		UPDATE_P_FLAG
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		V(S):=N(R)
;		UPDATE_N(R)_RECEIVED
;		RE-SEND_I_CMD(P=1)
;		CLEAR_REMOTE_BUSY
BUSY20		V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
BUSY21		V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		SEND_RNR_RSP(F=1)
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
BUSY22		SEND_RNR_CMD(F=1)
		START_P_TIMER
BUSY23		P_FLAG:=0
;		SEND_RNR_CMD(F=1)
;		START_P_TIMER
;		RETRY_COUNT:=RETRY_COUNT+1
BUSY24		SEND_RNR_CMD(F=1)
		START_P_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
BUSY25		DATA_FLAG:=1
;		SEND_RNR_CMD(F=1)
;		START_P_TIMER
;		RETRY_COUNT:=RETRY_COUNT+1
;		DATA_FLAG:=1
BUSY26		DATA_FLAG:=1
;============================================================================
REJECT1		SEND_I_CMD(P=1)
		START_P_TIMER
		START_ACK_TIMER_IF_NOT_RUNNING
;		SEND_I_XXX(X=0)
;		START_ACK_TIMER_IF_NOT_RUNNING
REJECT2		SEND_I_XXX(X=0)
		START_ACK_TIMER_IF_NOT_RUNNING
REJECT3		SEND_RNR_CMD(F=1)
		START_P_TIMER
		DATA_FLAG:=2
;		SEND_RNR_XXX(X=0)
;		DATA_FLAG:=2
REJECT4		SEND_RNR_XXX(X=0)
		DATA_FLAG:=2
REJECT5		UPDATE_N(R)_RECEIVED
		UPDATE_P_FLAG
		IF_F=1_CLEAR_REMOTE_BUSY
REJECT6		SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
;
; order of opcodes in REJECT7 is changed 
REJECT7		V(R):=V(R)+1
		SEND_ACKNOWLEDGE_CMD(P=1)
		START_P_TIMER
		UPDATE_N(R)_RECEIVED
		IF_F=1_CLEAR_REMOTE_BUSY
		STOP_REJ_TIMER
		DATA_INDICATION
;		V(R):=V(R)+1
;		DATA_INDICATION
;		UPDATE_P_FLAG
;		SEND_ACKNOWLEDGE_XXX(X=0)
;		UPDATE_N(R)_RECEIVED
;		IF_F=1_CLEAR_REMOTE_BUSY
;		STOP_REJ_TIMER
;
; order of opcodes in REJECT8 is changed 
REJECT8		V(R):=V(R)+1
		SEND_ACKNOWLEDGE_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		STOP_REJ_TIMER
		DATA_INDICATION
;
; order of opcodes in REJECT9 is changed 
REJECT9		V(R):=V(R)+1
		SEND_ACKNOWLEDGE_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		STOP_REJ_TIMER
		DATA_INDICATION
REJECT10	UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
REJECT11	SEND_ACKNOWLEDGE_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
REJECT12	UPDATE_P_FLAG
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
REJECT13	SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
REJECT14	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		UPDATE_P_FLAG
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		V(S):=N(R)
;		UPDATE_N(R)_RECEIVED
;		RE-SEND_I_CMD(P=1)
;		START_P_TIMER
;		CLEAR_REMOTE_BUSY
REJECT15	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
REJECT16	V(S):=N(R)
		UPDATE_N(R)_RECEIVED
		RE-SEND_I_RSP(F=1)
		CLEAR_REMOTE_BUSY
REJECT17	SEND_RR_CMD(P=1)
		START_P_TIMER
REJECT18	SEND_REJ_CMD(P=1)
		START_P_TIMER
		START_REJ_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
REJECT19	P_FLAG:=0
;		SEND_RR_CMD(P=1)
;		START_P_TIMER
;		START_REJ_TIMER
;		RETRY_COUNT:=RETRY_COUNT+1
REJECT20	SEND_RR_CMD(P=1)
		START_P_TIMER
		START_REJ_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT1		SEND_RNR_XXX(X=0)
		DATA_FLAG:=0
AWAIT2		SEND_REJ_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		RE-SEND_I_XXX(X=0)
		START_REJ_TIMER
		CLEAR_REMOTE_BUSY
;		SEND_REJ_CMD(P=1)
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_XXX(X=0)
;		START_P_TIMER
;		START_REJ_TIMER
;		CLEAR_REMOTE_BUSY
AWAIT3		SEND_REJ_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		START_REJ_TIMER
AWAIT4		SEND_REJ_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		START_REJ_TIMER
;
; order of opcode in AWAIT5 changed
AWAIT5		V(R):=V(R)+1
		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		RE-SEND_I_CMD(P=1)_OR_SEND_RR
		START_P_TIMER
		CLEAR_REMOTE_BUSY
		DATA_INDICATION
;		V(R):=V(R)+1
;		DATA_INDICATION
;		STOP_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_XXX(X=0)_OR_SEND_RR
;		CLEAR_REMOTE_BUSY
;
; order of opcode in AWAIT6 changed
AWAIT6		V(R):=V(R)+1
		SEND_RR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
;
; order of opcode in AWAIT7 changed
AWAIT7		V(R):=V(R)+1
		SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
AWAIT8		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_CMD(P=1)
;		START_P_TIMER
;		CLEAR_REMOTE_BUSY
AWAIT9		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT10		SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT11		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		SET_REMOTE_BUSY
AWAIT12		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT13		SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT14		SEND_RR_CMD(P=1)
		START_P_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT_BUSY1	SEND_REJ_XXX(X=0)
		START_REJ_TIMER		
AWAIT_BUSY2	SEND_RR_XXX(X=0)
AWAIT_BUSY3	SEND_RR_XXX(X=0)
AWAIT_BUSY4	OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		DATA_FLAG:=1
		CLEAR_REMOTE_BUSY
		RE-SEND_I_XXX(X=0)
;		SEND_RNR_CMD(F=1)
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		START_P_TIMER
;		DATA_FLAG:=1
;		CLEAR_REMOTE_BUSY
;		RE-SEND_I_XXX(X=0)
AWAIT_BUSY5	OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		DATA_FLAG:=1
AWAIT_BUSY6	SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		DATA_FLAG:=1
AWAIT_BUSY7	OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		DATA_FLAG:=1
		STOP_P_TIMER
		CLEAR_REMOTE_BUSY
		RE-SEND_I_XXX(X=0)
;		SEND_RNR_CMD(F=1)
;		V(R):=V(R)+1
;		DATA_INDICATION
;		START_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		DATA_FLAG:=0
;		CLEAR_REMOTE_BUSY
;		RE-SEND_I_XXX(X=0)
;		OPTIONAL_SEND_RNR_XXX(X=0)
;		V(R):=V(R)+1
;		DATA_INDICATION
;		STOP_P_TIMER
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		DATA_FLAG:=0
;		CLEAR_REMOTE_BUSY
;		RE-SEND_I_XXX(X=0)
AWAIT_BUSY8	OPTIONAL_SEND_RNR_XXX(X=0)
		UPDATE_N(R)_RECEIVED
		DATA_FLAG:=1
;		OPTIONAL_SEND_RNR_XXX(X=0)
;		V(R):=V(R)+1
;		DATA_INDICATION
;		UPDATE_N(R)_RECEIVED
;		DATA_FLAG:=0
AWAIT_BUSY9	SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		DATA_FLAG:=1
;		SEND_RNR_RSP(F=1)
;		V(R):=V(R)+1
;		DATA_INDICATION
;		UPDATE_N(R)_RECEIVED
;		DATA_FLAG:=0
AWAIT_BUSY10	UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_CMD(P=1)
;		START_P_TIMER
;		CLEAR_REMOTE_BUSY
AWAIT_BUSY11	UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT_BUSY12	SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT_BUSY13	UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		SET_REMOTE_BUSY
AWAIT_BUSY14	UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT_BUSY15	SEND_RNR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT_BUSY16	SEND_RNR_CMD(F=1)
		START_P_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
;============================================================================
AWAIT_REJECT1	SEND_RNR_XXX(X=0)
		DATA_FLAG:=2
AWAIT_REJECT2	UPDATE_N(R)_RECEIVED
AWAIT_REJECT3	SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
;
; order of opcodes in AWAIT_REJECT4 changed
AWAIT_REJECT4	V(R):=V(R)+1
		UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		RE-SEND_I_CMD(P=1)_OR_SEND_RR
		START_P_TIMER
		STOP_REJ_TIMER
		CLEAR_REMOTE_BUSY
		DATA_INDICATION
;		V(R):=V(R)+1
;		DATA_INDICATION
;		STOP_P_TIMER
;		STOP_REJ_TIMER
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_CMD(P=1)_OR_SEND_RR
;		CLEAR_REMOTE_BUSY
;
; order of opcodes in AWAIT_REJECT5 changed
AWAIT_REJECT5	V(R):=V(R)+1
		SEND_RR_XXX(X=0)
		STOP_REJ_TIMER
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
;
; order of opcodes in AWAIT_REJECT6 changed
AWAIT_REJECT6	V(R):=V(R)+1
		SEND_RR_RSP(F=1)
		STOP_REJ_TIMER
		UPDATE_N(R)_RECEIVED
		DATA_INDICATION
AWAIT_REJECT7	UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		RE-SEND_I_XXX(X=0)
		CLEAR_REMOTE_BUSY
;		UPDATE_N(R)_RECEIVED
;		V(S):=N(R)
;		RE-SEND_I_CMD(P=1)
;		START_P_TIMER
;		CLEAR_REMOTE_BUSY
AWAIT_REJECT8	UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT_REJECT9	SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		CLEAR_REMOTE_BUSY
AWAIT_REJECT10	UPDATE_N(R)_RECEIVED
		V(S):=N(R)
		STOP_P_TIMER
		SET_REMOTE_BUSY
AWAIT_REJECT11	UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT_REJECT12	SEND_RR_RSP(F=1)
		UPDATE_N(R)_RECEIVED
		SET_REMOTE_BUSY
AWAIT_REJECT13	SEND_REJ_CMD(P=1)
		START_P_TIMER
		RETRY_COUNT:=RETRY_COUNT+1
;============================================================================