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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
|
/**************************************************************************//**
* @file nu_psio.h
* @version V3.00
* @brief M460 series PSIO driver header file
*
* @copyright SPDX-License-Identifier: Apache-2.0
* @copyright Copyright (C) 2021 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NU_PSIO_H__
#define __NU_PSIO_H__
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup Standard_Driver Standard Driver
@{
*/
/** @addtogroup PSIO_Driver PSIO Driver
@{
*/
/** @addtogroup PSIO_EXPORTED_CONSTANTS PSIO Exported Constants
@{
*/
/*---------------------------------------------------------------------------------------------------------*/
/* Operation Mode Constant Definitions */
/*---------------------------------------------------------------------------------------------------------*/
#define PSIO_SC0 0x00000000UL /*!<PSIO Slot Controller 0 \hideinitializer */
#define PSIO_SC1 0x00000001UL /*!<PSIO Slot Controller 1 \hideinitializer */
#define PSIO_SC2 0x00000002UL /*!<PSIO Slot Controller 2 \hideinitializer */
#define PSIO_SC3 0x00000003UL /*!<PSIO Slot Controller 3 \hideinitializer */
#define PSIO_INT0 0x00000000UL /*!<PSIO Interrupt 0 \hideinitializer */
#define PSIO_INT1 0x00000001UL /*!<PSIO Interrupt 1 \hideinitializer */
#define PSIO_SLOT_DISABLE 0x00000000UL /*!<PSIO Slot disable \hideinitializer */
#define PSIO_SLOT0 0x00000001UL /*!<PSIO Slot 0 \hideinitializer */
#define PSIO_SLOT1 0x00000002UL /*!<PSIO Slot 1 \hideinitializer */
#define PSIO_SLOT2 0x00000003UL /*!<PSIO Slot 2 \hideinitializer */
#define PSIO_SLOT3 0x00000004UL /*!<PSIO Slot 3 \hideinitializer */
#define PSIO_SLOT4 0x00000005UL /*!<PSIO Slot 4 \hideinitializer */
#define PSIO_SLOT5 0x00000006UL /*!<PSIO Slot 5 \hideinitializer */
#define PSIO_SLOT6 0x00000007UL /*!<PSIO Slot 6 \hideinitializer */
#define PSIO_SLOT7 0x00000008UL /*!<PSIO Slot 7 \hideinitializer */
#define PSIO_PIN0 0x00000000UL /*!<PSIO Pin 0 \hideinitializer */
#define PSIO_PIN1 0x00000001UL /*!<PSIO Pin 1 \hideinitializer */
#define PSIO_PIN2 0x00000002UL /*!<PSIO Pin 2 \hideinitializer */
#define PSIO_PIN3 0x00000003UL /*!<PSIO Pin 3 \hideinitializer */
#define PSIO_PIN4 0x00000004UL /*!<PSIO Pin 4 \hideinitializer */
#define PSIO_PIN5 0x00000005UL /*!<PSIO Pin 5 \hideinitializer */
#define PSIO_PIN6 0x00000006UL /*!<PSIO Pin 6 \hideinitializer */
#define PSIO_PIN7 0x00000007UL /*!<PSIO Pin 7 \hideinitializer */
#define PSIO_CP0 0x00000000UL /*!<PSIO Check Point 0 \hideinitializer */
#define PSIO_CP1 0x00000001UL /*!<PSIO Check Point 1 \hideinitializer */
#define PSIO_CP2 0x00000002UL /*!<PSIO Check Point 2 \hideinitializer */
#define PSIO_CP3 0x00000003UL /*!<PSIO Check Point 3 \hideinitializer */
#define PSIO_CP4 0x00000004UL /*!<PSIO Check Point 4 \hideinitializer */
#define PSIO_CP5 0x00000005UL /*!<PSIO Check Point 5 \hideinitializer */
#define PSIO_CP6 0x00000006UL /*!<PSIO Check Point 6 \hideinitializer */
#define PSIO_CP7 0x00000007UL /*!<PSIO Check Point 7 \hideinitializer */
#define PSIO_PIN_ENABLE 0x00000001UL /*!<PSIO Pin Enable \hideinitializer */
#define PSIO_PIN_DISABLE 0x00000000UL /*!<PSIO Pin Disable \hideinitializer */
#define PSIO_SW_TRIGGER (0x0UL<<PSIO_SCCT_SCCTL_TRIGSRC_Pos) /*!<PSIO Software Trigger \hideinitializer */
#define PSIO_FALLING_TRIGGER (0x1UL<<PSIO_SCCT_SCCTL_TRIGSRC_Pos) /*!<PSIO Falling Edge Trigger \hideinitializer */
#define PSIO_RISING_TRIGGER (0x2UL<<PSIO_SCCT_SCCTL_TRIGSRC_Pos) /*!<PSIO Rising Edge Trigger \hideinitializer */
#define PSIO_BOTH_EDGE_TRIGGER (0x3UL<<PSIO_SCCT_SCCTL_TRIGSRC_Pos) /*!<PSIO Both Edge Trigger \hideinitializer */
#define PSIO_REPEAT_ENABLE 0x00000001UL /*!<PSIO Repeat Mode Enable \hideinitializer */
#define PSIO_REPEAT_DISABLE 0x00000000UL /*!<PSIO Repeat Mode Disable \hideinitializer */
#define PSIO_INPUT_MODE 0x00000000UL /*!<PSIO Input Mode \hideinitializer */
#define PSIO_OUTPUT_MODE 0x00000001UL /*!<PSIO Output Mode \hideinitializer */
#define PSIO_OPENDRAIN_MODE 0x00000002UL /*!<PSIO Open-drain Mode \hideinitializer */
#define PSIO_QUASI_MODE 0x00000003UL /*!<PSIO Quasi Mode \hideinitializer */
#define PSIO_LOW_LEVEL 0x00000000UL /*!<PSIO Low Level \hideinitializer */
#define PSIO_HIGH_LEVEL 0x00000001UL /*!<PSIO High Level \hideinitializer */
#define PSIO_LAST_OUTPUT 0x00000002UL /*!<PSIO Last Output \hideinitializer */
#define PSIO_Toggle 0x00000003UL /*!<PSIO Toggle \hideinitializer */
#define PSIO_SWITCH_P0 0x00000000UL /*!<PSIO Switch Point 0 \hideinitializer */
#define PSIO_SWITCH_P1 0x00000001UL /*!<PSIO Switch Point 1 \hideinitializer */
#define PSIO_LSB (0x0UL<<PSIO_GNCT_DATCTL_ORDER_Pos) /*!<PSIO Data LSB \hideinitializer */
#define PSIO_MSB (0x1UL<<PSIO_GNCT_DATCTL_ORDER_Pos) /*!<PSIO Data MSB \hideinitializer */
#define PSIO_DEPTH1 0x00000000UL /*!<PSIO Data Depth 1 \hideinitializer */
#define PSIO_DEPTH2 0x00000001UL /*!<PSIO Data Depth 2 \hideinitializer */
#define PSIO_DEPTH3 0x00000002UL /*!<PSIO Data Depth 3 \hideinitializer */
#define PSIO_DEPTH4 0x00000003UL /*!<PSIO Data Depth 4 \hideinitializer */
#define PSIO_NO_ACTION 0x00000000UL /*!<PSIO no action \hideinitializer */
#define PSIO_OUT_LOW 0x00000000UL /*!<PSIO Output Low \hideinitializer */
#define PSIO_OUT_HIGH 0x00000001UL /*!<PSIO Output High \hideinitializer */
#define PSIO_OUT_BUFFER 0x00000002UL /*!<PSIO Output form Buffer \hideinitializer */
#define PSIO_OUT_TOGGLE 0x00000003UL /*!<PSIO Output Toggle \hideinitializer */
#define PSIO_IN_BUFFER 0x00000004UL /*!<PSIO Input to Buffer \hideinitializer */
#define PSIO_IN_STATUS 0x00000005UL /*!<PSIO Input to Status \hideinitializer */
#define PSIO_IN_STATUS_UPDATE 0x00000006UL /*!<PSIO Input to Status and Update \hideinitializer */
/*@}*/ /* end of group PSIO_EXPORTED_CONSTANTS */
/** @addtogroup PSIO_EXPORTED_STRUCTS PSIO Exported Structs
@{
*/
/**
* @brief A structure holds psio configuration
*/
typedef struct
{
unsigned CKPT0SLT: 4; ///< Link check point and slot controller slot. \ref PSIO_SLOT_DISABLE, \ref PSIO_SLOT0, \ref PSIO_SLOT1, \ref PSIO_SLOT2, \ref PSIO_SLOT3, \ref PSIO_SLOT4, \ref PSIO_SLOT5, \ref PSIO_SLOT6, \ref PSIO_SLOT7
unsigned CKPT1SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT2SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT3SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT4SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT5SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT6SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT7SLT: 4; ///< Link check point and slot controller slot. Reference to \ref S_PSIO_CP_CONFIG::CKPT0SLT
unsigned CKPT0ACT: 4; ///< Select action at check point0. \ref PSIO_NO_ACTION, \ref PSIO_OUT_LOW, \ref PSIO_OUT_HIGH, \ref PSIO_OUT_BUFFER, \ref PSIO_OUT_TOGGLE, \ref PSIO_IN_BUFFER, \ref PSIO_IN_STATUS, \ref PSIO_IN_STATUS_UPDATE
unsigned CKPT1ACT: 4; ///< Select action at check point1. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT2ACT: 4; ///< Select action at check point2. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT3ACT: 4; ///< Select action at check point3. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT4ACT: 4; ///< Select action at check point4. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT5ACT: 4; ///< Select action at check point5. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT6ACT: 4; ///< Select action at check point6. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
unsigned CKPT7ACT: 4; ///< Select action at check point7. Reference to \ref S_PSIO_CP_CONFIG::CKPT0ACT
} S_PSIO_CP_CONFIG;
/*@}*/ /* end of group PSIO_EXPORTED_STRUCTS */
/** @addtogroup PSIO_EXPORTED_FUNCTIONS PSIO Exported Functions
@{
*/
/**
* @brief Enable specified PSIO interrupt
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32IntSel Interrupt type select
* - \ref PSIO_INTEN_CON0IE_Msk
* - \ref PSIO_INTEN_CON1IE_Msk
* - \ref PSIO_INTEN_MISMATIE_Msk
* - \ref PSIO_INTEN_TERRIE_Msk
* - \ref PSIO_INTEN_SC0IE_Msk
* - \ref PSIO_INTEN_SC1IE_Msk
* - \ref PSIO_INTEN_SC2IE_Msk
* - \ref PSIO_INTEN_SC3IE_Msk
*
* @return None
*
* @details This macro enable specified PSIO interrupt.
* \hideinitializer
*/
#define PSIO_ENABLE_INT(psio, u32IntSel) ((psio)->INTEN |= (u32IntSel))
/**
* @brief Disable specified PSIO interrupt
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32IntSel Interrupt type select
* - \ref PSIO_INTEN_CON0IE_Msk
* - \ref PSIO_INTEN_CON1IE_Msk
* - \ref PSIO_INTEN_MISMATIE_Msk
* - \ref PSIO_INTEN_TERRIE_Msk
* - \ref PSIO_INTEN_SC0IE_Msk
* - \ref PSIO_INTEN_SC1IE_Msk
* - \ref PSIO_INTEN_SC2IE_Msk
* - \ref PSIO_INTEN_SC3IE_Msk
*
* @return None
*
* @details This macro disable specified PSIO interrupt.
* \hideinitializer
*/
#define PSIO_DISABLE_INT(psio, u32IntSel) ((psio)->INTEN &= ~(u32IntSel))
/**
* @brief Get specified interrupt flag/status
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32IntTypeFlag Interrupt Type Flag, Valid values are
* - \ref PSIO_INTSTS_CON0IF_Msk
* - \ref PSIO_INTSTS_CON1IF_Msk
* - \ref PSIO_INTSTS_MISMATIF_Msk
* - \ref PSIO_INTSTS_TERRIF_Msk
* - \ref PSIO_INTSTS_SC0IF_Msk
* - \ref PSIO_INTSTS_SC1IF_Msk
* - \ref PSIO_INTSTS_SC2IF_Msk
* - \ref PSIO_INTSTS_SC3IF_Msk
*
* @return 0 The specified interrupt is not happened.
* 1 The specified interrupt is happened.
*
* @details This macro get specified interrupt flag or interrupt indicator status.
* \hideinitializer
*/
#define PSIO_GET_INT_FLAG(psio, u32IntTypeFlag) (((psio)->INTSTS & (u32IntTypeFlag))?1:0)
/**
* @brief Clear specified interrupt flag/status
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32IntTypeFlag Interrupt Type Flag, Valid values are
* - \ref PSIO_INTSTS_CON0IF_Msk
* - \ref PSIO_INTSTS_CON1IF_Msk
* - \ref PSIO_INTSTS_MISMATIF_Msk
* - \ref PSIO_INTSTS_TERRIF_Msk
* - \ref PSIO_INTSTS_SC0IF_Msk
* - \ref PSIO_INTSTS_SC1IF_Msk
* - \ref PSIO_INTSTS_SC2IF_Msk
* - \ref PSIO_INTSTS_SC3IF_Msk
*
* @return None
*
* @details This macro clear specified interrupt flag or interrupt indicator status.
* \hideinitializer
*/
#define PSIO_CLEAR_INT_FLAG(psio, u32IntTypeFlag) ((psio)->INTSTS = u32IntTypeFlag)
/**
* @brief Get specified transfer status
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Status Transfer status, Valid values are
* - \ref PSIO_TRANSTS_INFULL0_Msk
* - \ref PSIO_TRANSTS_INOVER0_Msk
* - \ref PSIO_TRANSTS_OUTEPY0_Msk
* - \ref PSIO_TRANSTS_OUTUF0_Msk
* - \ref PSIO_TRANSTS_INFULL1_Msk
* - \ref PSIO_TRANSTS_INOVER1_Msk
* - \ref PSIO_TRANSTS_OUTEPY1_Msk
* - \ref PSIO_TRANSTS_OUTUF1_Msk
* - \ref PSIO_TRANSTS_INFULL2_Msk
* - \ref PSIO_TRANSTS_INOVER2_Msk
* - \ref PSIO_TRANSTS_OUTEPY2_Msk
* - \ref PSIO_TRANSTS_OUTUF2_Msk
* - \ref PSIO_TRANSTS_INFULL3_Msk
* - \ref PSIO_TRANSTS_INOVER3_Msk
* - \ref PSIO_TRANSTS_OUTEPY3_Msk
* - \ref PSIO_TRANSTS_OUTUF3_Msk
* - \ref PSIO_TRANSTS_INFULL4_Msk
* - \ref PSIO_TRANSTS_INOVER4_Msk
* - \ref PSIO_TRANSTS_OUTEPY4_Msk
* - \ref PSIO_TRANSTS_OUTUF4_Msk
* - \ref PSIO_TRANSTS_INFULL5_Msk
* - \ref PSIO_TRANSTS_INOVER5_Msk
* - \ref PSIO_TRANSTS_OUTEPY5_Msk
* - \ref PSIO_TRANSTS_OUTUF5_Msk
* - \ref PSIO_TRANSTS_INFULL6_Msk
* - \ref PSIO_TRANSTS_INOVER6_Msk
* - \ref PSIO_TRANSTS_OUTEPY6_Msk
* - \ref PSIO_TRANSTS_OUTUF6_Msk
* - \ref PSIO_TRANSTS_INFULL7_Msk
* - \ref PSIO_TRANSTS_INOVER7_Msk
* - \ref PSIO_TRANSTS_OUTEPY7_Msk
* - \ref PSIO_TRANSTS_OUTUF7_Msk
*
* @return 0 The specified status is not happened.
* 1 The specified status is happened.
*
* @details This macro get specified transfer status.
* \hideinitializer
*/
#define PSIO_GET_TRANSFER_STATUS(psio, u32Status) (((psio)->TRANSTS & (u32Status))?1:0)
/**
* @brief Clear specified transfer status
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Status Transfer status, Valid values are
* - \ref PSIO_TRANSTS_INOVER0_Msk
* - \ref PSIO_TRANSTS_OUTUF0_Msk
* - \ref PSIO_TRANSTS_INOVER1_Msk
* - \ref PSIO_TRANSTS_OUTUF1_Msk
* - \ref PSIO_TRANSTS_INOVER2_Msk
* - \ref PSIO_TRANSTS_OUTUF2_Msk
* - \ref PSIO_TRANSTS_INOVER3_Msk
* - \ref PSIO_TRANSTS_OUTUF3_Msk
* - \ref PSIO_TRANSTS_INOVER4_Msk
* - \ref PSIO_TRANSTS_OUTUF4_Msk
* - \ref PSIO_TRANSTS_INOVER5_Msk
* - \ref PSIO_TRANSTS_OUTUF5_Msk
* - \ref PSIO_TRANSTS_INOVER6_Msk
* - \ref PSIO_TRANSTS_OUTUF6_Msk
* - \ref PSIO_TRANSTS_INOVER7_Msk
* - \ref PSIO_TRANSTS_OUTUF7_Msk
*
* @return None
*
* @details This macro clear specified transfer status.
* \hideinitializer
*/
#define PSIO_CLEAR_TRANSFER_STATUS(psio, u32Status) ((psio)->TRANSTS = u32Status)
/**
* @brief Get specified input status state
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Status Transfer input status state, Valid values are
* - \ref PSIO_ISSTS_VALID0_Msk
* - \ref PSIO_ISSTS_INSTSOV0_Msk
* - \ref PSIO_ISSTS_VALID1_Msk
* - \ref PSIO_ISSTS_INSTSOV1_Msk
* - \ref PSIO_ISSTS_VALID2_Msk
* - \ref PSIO_ISSTS_INSTSOV2_Msk
* - \ref PSIO_ISSTS_VALID3_Msk
* - \ref PSIO_ISSTS_INSTSOV3_Msk
* - \ref PSIO_ISSTS_VALID4_Msk
* - \ref PSIO_ISSTS_INSTSOV4_Msk
* - \ref PSIO_ISSTS_VALID5_Msk
* - \ref PSIO_ISSTS_INSTSOV5_Msk
* - \ref PSIO_ISSTS_VALID6_Msk
* - \ref PSIO_ISSTS_INSTSOV6_Msk
* - \ref PSIO_ISSTS_VALID7_Msk
* - \ref PSIO_ISSTS_INSTSOV7_Msk
*
* @return 0 The specified status is not happened.
* 1 The specified status is happened.
*
* @details This macro get input status state.
* \hideinitializer
*/
#define PSIO_GET_INPUT_STATUS_STATE(psio, u32Status) (((psio)->ISSTS & (u32Status))?1:0)
/**
* @brief Clear specified input status state
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Status Transfer input status state, Valid values are
* - \ref PSIO_ISSTS_INSTSOV0_Msk
* - \ref PSIO_ISSTS_INSTSOV1_Msk
* - \ref PSIO_ISSTS_INSTSOV2_Msk
* - \ref PSIO_ISSTS_INSTSOV3_Msk
* - \ref PSIO_ISSTS_INSTSOV4_Msk
* - \ref PSIO_ISSTS_INSTSOV5_Msk
* - \ref PSIO_ISSTS_INSTSOV6_Msk
* - \ref PSIO_ISSTS_INSTSOV7_Msk
*
* @return None
*
* @details This macro clear input status state.
* \hideinitializer
*/
#define PSIO_CLEAR_INPUT_STATUS_STATE(psio, u32Status) ((psio)->ISSTS = u32Status)
/**
* @brief Set PSIO PDMA control input
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32InPin The selected input pin
* - \ref PSIO_PDMACTL_IPIN0EN_Msk
* - \ref PSIO_PDMACTL_IPIN1EN_Msk
* - \ref PSIO_PDMACTL_IPIN2EN_Msk
* - \ref PSIO_PDMACTL_IPIN3EN_Msk
* - \ref PSIO_PDMACTL_IPIN4EN_Msk
* - \ref PSIO_PDMACTL_IPIN5EN_Msk
* - \ref PSIO_PDMACTL_IPIN6EN_Msk
* - \ref PSIO_PDMACTL_IPIN7EN_Msk
*
* @return None
*
* @details This macro set PSIO input with PDMA.
* \hideinitializer
*/
#define PSIO_SET_PDMA_INPUT(psio, u32SC, u32InPin) ((psio)->PDMACTL = ((psio)->PDMACTL & ~PSIO_PDMACTL_INSCSEL_Msk) \
|((u32SC)<<PSIO_PDMACTL_INSCSEL_Pos)|(u32InPin))
/**
* @brief Clear PSIO PDMA control input
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32InPin The selected input pin
* - \ref PSIO_PDMACTL_IPIN0EN_Msk
* - \ref PSIO_PDMACTL_IPIN1EN_Msk
* - \ref PSIO_PDMACTL_IPIN2EN_Msk
* - \ref PSIO_PDMACTL_IPIN3EN_Msk
* - \ref PSIO_PDMACTL_IPIN4EN_Msk
* - \ref PSIO_PDMACTL_IPIN5EN_Msk
* - \ref PSIO_PDMACTL_IPIN6EN_Msk
* - \ref PSIO_PDMACTL_IPIN7EN_Msk
*
* @return None
*
* @details This macro clear PSIO input with PDMA.
* \hideinitializer
*/
#define PSIO_CLEAR_PDMA_INPUT(psio, u32InPin) ((psio)->PDMACTL = (psio)->PDMACTL & ~PSIO_PDMACTL_INSCSEL_Msk & ~(u32InPin))
/**
* @brief Set PSIO PDMA control output
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32OutPin The selected output pin
* - \ref PSIO_PDMACTL_OPIN0EN_Msk
* - \ref PSIO_PDMACTL_OPIN1EN_Msk
* - \ref PSIO_PDMACTL_OPIN2EN_Msk
* - \ref PSIO_PDMACTL_OPIN3EN_Msk
* - \ref PSIO_PDMACTL_OPIN4EN_Msk
* - \ref PSIO_PDMACTL_OPIN5EN_Msk
* - \ref PSIO_PDMACTL_OPIN6EN_Msk
* - \ref PSIO_PDMACTL_OPIN7EN_Msk
*
* @return None
*
* @details This macro set PSIO output with PDMA.
* \hideinitializer
*/
#define PSIO_SET_PDMA_OUTPUT(psio, u32SC, u32OutPin) ((psio)->PDMACTL = ((psio)->PDMACTL & ~PSIO_PDMACTL_OUTSCSEL_Msk) \
|((u32SC)<<PSIO_PDMACTL_OUTSCSEL_Pos)|(u32OutPin))
/**
* @brief Clear PSIO PDMA control output
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32OutPin The selected output pin
* - \ref PSIO_PDMACTL_OPIN0EN_Msk
* - \ref PSIO_PDMACTL_OPIN1EN_Msk
* - \ref PSIO_PDMACTL_OPIN2EN_Msk
* - \ref PSIO_PDMACTL_OPIN3EN_Msk
* - \ref PSIO_PDMACTL_OPIN4EN_Msk
* - \ref PSIO_PDMACTL_OPIN5EN_Msk
* - \ref PSIO_PDMACTL_OPIN6EN_Msk
* - \ref PSIO_PDMACTL_OPIN7EN_Msk
*
* @return None
*
* @details This macro clear PSIO output with PDMA.
* \hideinitializer
*/
#define PSIO_CLEAR_PDMA_OUTPUT(psio, u32OutPin) ((psio)->PDMACTL = (psio)->PDMACTL & ~PSIO_PDMACTL_OUTSCSEL_Msk & ~(u32OutPin))
/**
* @brief Set slot controller trigger source
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32SrcType The selected trigger source type
* - \ref PSIO_SW_TRIGGER
* - \ref PSIO_FALLING_TRIGGER
* - \ref PSIO_RISING_TRIGGER
* - \ref PSIO_BOTH_EDGE_TRIGGER
*
* @return None
*
* @details This macro set slot controller trigger source.
* \hideinitializer
*/
#define PSIO_SET_TRIGSRC(psio, u32SC, u32SrcType) ((psio)->SCCT[(u32SC)].SCCTL=((psio)->SCCT[(u32SC)].SCCTL & ~PSIO_SCCT_SCCTL_TRIGSRC_Msk)|(u32SrcType))
/**
* @brief Start PSIO slot controller
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
*
* @return None
*
* @details This macro start PSIO slot controller.
* \hideinitializer
*/
#define PSIO_START_SC(psio, u32SC) ((psio)->SCCT[(u32SC)].SCCTL |= PSIO_SCCT_SCCTL_START_Msk)
/**
* @brief Stop PSIO slot controller
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
*
* @return None
*
* @details This macro stop PSIO slot controller.
* \hideinitializer
*/
#define PSIO_STOP_SC(psio, u32SC) ((psio)->SCCT[(u32SC)].SCCTL |= PSIO_SCCT_SCCTL_STOP_Msk)
/**
* @brief Get PSIO busy flag
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
*
* @return 0 The busy flag is not happened.
* 1 The busy flag is happened.
*
* @details This macro get PSIO busy flag.
* \hideinitializer
*/
#define PSIO_GET_BUSY_FLAG(psio, u32SC) (((psio)->SCCT[(u32SC)].SCCTL & PSIO_SCCT_SCCTL_BUSY_Msk)?1:0)
/**
* @brief Get PSIO idle flag
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
*
* @return 0 The idle flag is not happened.
* 1 The idle flag is happened.
*
* @details This macro get PSIO idle flag.
* \hideinitializer
*/
#define PSIO_GET_IDLE_FLAG(psio, u32SC) (((psio)->SCCT[(u32SC)].SCCTL & PSIO_SCCT_SCCTL_IDLE_Msk)?1:0)
/**
* @brief Clear PSIO idle flag
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
*
* @return None
*
* @details This macro clear PSIO idle flag.
* \hideinitializer
*/
#define PSIO_SET_IDLE_FLAG(psio, u32SC) ((psio)->SCCT[(u32SC)].SCCTL |= PSIO_SCCT_SCCTL_IDLE_Msk)
/**
* @brief Set PSIO slot tick count
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32Slot The selected slot. Valid values are
* - \ref PSIO_SLOT0
* - \ref PSIO_SLOT1
* - \ref PSIO_SLOT2
* - \ref PSIO_SLOT3
* - \ref PSIO_SLOT4
* - \ref PSIO_SLOT5
* - \ref PSIO_SLOT6
* - \ref PSIO_SLOT7
* @param[in] u32Cnt The slot tick count. Valid values are 0x0~0xF
*
* @return None
*
* @details This macro set PSIO slot tick count.
* \hideinitializer
*/
#define PSIO_SCSLOT_SET_SLOT(psio, u32SC, u32Slot, u32Cnt) ((psio)->SCCT[(u32SC)].SCSLOT= \
((psio)->SCCT[(u32SC)].SCSLOT & ~(PSIO_SCCT_SCSLOT_SLOT0CNT_Msk<<((u32Slot-1)*PSIO_SCCT_SCSLOT_SLOT1CNT_Pos)))|((u32Cnt&0xF)<<((u32Slot-1)*PSIO_SCCT_SCSLOT_SLOT1CNT_Pos)))
/**
* @brief Set PSIO all slot tick count
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32Cnt The slot tick count. Valid values are 0x0~0xF
*
* @return None
*
* @details This macro set PSIO all slot tick count.
* \hideinitializer
*/
#define PSIO_SCSLOT_SET_ALL_SLOT(psio, u32SC, u32Cnt) ((psio)->SCCT[(u32SC)].SCSLOT= \
((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT0CNT_Pos)|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT1CNT_Pos)\
|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT2CNT_Pos)|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT3CNT_Pos)\
|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT4CNT_Pos)|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT5CNT_Pos)\
|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT6CNT_Pos)|((u32Cnt&0xF)<<PSIO_SCCT_SCSLOT_SLOT7CNT_Pos))
/**
* @brief Enable Pin function
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
*
* @return None
*
* @details This function is used to Enable this Pin.
* \hideinitializer
*/
#define PSIO_ENABLE_PIN(psio, u32Pin) ((psio)->GNCT[(u32Pin)].GENCTL = \
((psio)->GNCT[(u32Pin)].GENCTL & ~PSIO_GNCT_GENCTL_PINEN_Msk)|PSIO_GNCT_GENCTL_PINEN_Msk)
/**
* @brief Disable Pin function
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
*
* @return None
*
* @details This function is used to disable this Pin.
* \hideinitializer
*/
#define PSIO_DISABLE_PIN(psio, u32Pin) ((psio)->GNCT[(u32Pin)].GENCTL = \
((psio)->GNCT[(u32Pin)].GENCTL & ~PSIO_GNCT_GENCTL_PINEN_Msk))
/**
* @brief Set specified pin data width
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32InWidth The input data width. Valid values are 0~32
* @param[in] u32OutWidth The output data width. Valid values are 0~32
*
* @return None
*
* @details This macro set in/out data width.
* \hideinitializer
*/
#define PSIO_SET_WIDTH(psio, u32Pin, u32InWidth, u32OutWidth) (((psio)->GNCT[(u32Pin)].DATCTL)= \
((psio)->GNCT[(u32Pin)].DATCTL & ~PSIO_GNCT_DATCTL_INDATWD_Msk & ~PSIO_GNCT_DATCTL_OUTDATWD_Msk) \
|((u32InWidth==0?0:(u32InWidth-1))<<PSIO_GNCT_DATCTL_INDATWD_Pos)|((u32OutWidth==0?0:(u32OutWidth-1))<<PSIO_GNCT_DATCTL_OUTDATWD_Pos))
/**
* @brief Set specified pin data order
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32Order The data order. Valid values are
* - \ref PSIO_LSB
* - \ref PSIO_MSB
*
* @return None
*
* @details This macro set data order.
* \hideinitializer
*/
#define PSIO_SET_ORDER(psio, u32Pin, u32Order) (((psio)->GNCT[(u32Pin)].DATCTL)= \
(PSIO->GNCT[(u32Pin)].DATCTL & ~PSIO_GNCT_DATCTL_ORDER_Msk)|(u32Order))
/**
* @brief Set specified pin output data depth
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32Depth The data depth. Valid values are
* - \ref PSIO_DEPTH1
* - \ref PSIO_DEPTH2
* - \ref PSIO_DEPTH3
* - \ref PSIO_DEPTH4
*
* @return None
*
* @details This macro set output data order.
* \hideinitializer
*/
#define PSIO_SET_OUTPUT_DEPTH(psio, u32Pin, u32Depth) ((psio)->GNCT[(u32Pin)].DATCTL= \
(PSIO->GNCT[(u32Pin)].DATCTL & ~PSIO_GNCT_DATCTL_OUTDEPTH_Msk)|((u32Depth)<<PSIO_GNCT_DATCTL_OUTDEPTH_Pos))
/**
* @brief Set specified pin input data depth
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32Depth The data depth. Valid values are
* - \ref PSIO_DEPTH1
* - \ref PSIO_DEPTH2
* - \ref PSIO_DEPTH3
* - \ref PSIO_DEPTH4
*
* @return None
*
* @details This macro set input data order.
* \hideinitializer
*/
#define PSIO_SET_INPUT_DEPTH(psio, u32Pin, u32Depth) ((psio)->GNCT[(u32Pin)].DATCTL= \
(PSIO->GNCT[(u32Pin)].DATCTL & ~PSIO_GNCT_DATCTL_INDEPTH_Msk)|((u32Depth)<<PSIO_GNCT_DATCTL_INDEPTH_Pos))
/**
* @brief Get specified pin input status
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
*
* @return The specified pin input status
*
* @details This macro get specified pin input status.
* \hideinitializer
*/
#define PSIO_GET_INPUT_STATUS(psio, u32Pin) (psio->GNCT[u32Pin].INSTS&0xFF)
/**
* @brief Get specified pin input data
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
*
* @return The specified pin input data
*
* @details This macro get specified pin input data.
* \hideinitializer
*/
#define PSIO_GET_INPUT_DATA(psio, u32Pin) (psio->GNCT[u32Pin].INDAT)
/**
* @brief Set specified pin output data
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32Data The output data
*
* @return None
*
* @details This macro set specified pin output data.
* \hideinitializer
*/
#define PSIO_SET_OUTPUT_DATA(psio, u32Pin, u32Data) (psio->GNCT[u32Pin].OUTDAT = (u32Data))
/**
* @brief Set specified pin check point and slot link
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32CheckPoint The selected check point. Valid values are
* - \ref PSIO_CP0
* - \ref PSIO_CP1
* - \ref PSIO_CP2
* - \ref PSIO_CP3
* - \ref PSIO_CP4
* - \ref PSIO_CP5
* - \ref PSIO_CP6
* - \ref PSIO_CP7
* @param[in] u32Slot The selected slot. Valid values are
* - \ref PSIO_SLOT0
* - \ref PSIO_SLOT1
* - \ref PSIO_SLOT2
* - \ref PSIO_SLOT3
* - \ref PSIO_SLOT4
* - \ref PSIO_SLOT5
* - \ref PSIO_SLOT6
* - \ref PSIO_SLOT7
*
* @return None
*
* @details This macro used to link check point and slot.
* \hideinitializer
*/
#define PSIO_SET_CHECKPOINT(psio, u32Pin, u32CheckPoint, u32Slot) (psio->GNCT[(u32Pin)].CPCTL0= \
(psio->GNCT[(u32Pin)].CPCTL0 & ~(PSIO_GNCT_CPCTL0_CKPT0_Msk<<((u32CheckPoint)*PSIO_GNCT_CPCTL0_CKPT1_Pos))) \
|((u32Slot)<<((u32CheckPoint)*PSIO_GNCT_CPCTL0_CKPT1_Pos)))
/**
* @brief Clear specified pin check point and slot link
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32CheckPoint The selected check point. Valid values are
* - \ref PSIO_CP0
* - \ref PSIO_CP1
* - \ref PSIO_CP2
* - \ref PSIO_CP3
* - \ref PSIO_CP4
* - \ref PSIO_CP5
* - \ref PSIO_CP6
* - \ref PSIO_CP7
*
* @return None
*
* @details This macro used to clear the link of check point and slot.
* \hideinitializer
*/
#define PSIO_CLEAR_CHECKPOINT(psio, u32Pin, u32CheckPoint) (psio->GNCT[(u32Pin)].CPCTL0= \
psio->GNCT[(u32Pin)].CPCTL0 & ~(PSIO_GNCT_CPCTL0_CKPT0_Msk<<((u32CheckPoint)*PSIO_GNCT_CPCTL0_CKPT1_Pos)))
/**
* @brief Set specified pin action of check point
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32CheckPoint The selected check point. Valid values are
* - \ref PSIO_CP0
* - \ref PSIO_CP1
* - \ref PSIO_CP2
* - \ref PSIO_CP3
* - \ref PSIO_CP4
* - \ref PSIO_CP5
* - \ref PSIO_CP6
* - \ref PSIO_CP7
* @param[in] u32Action The selected action. Valid values are
* - \ref PSIO_OUT_LOW
* - \ref PSIO_OUT_HIGH
* - \ref PSIO_OUT_BUFFER
* - \ref PSIO_OUT_TOGGLE
* - \ref PSIO_IN_BUFFER
* - \ref PSIO_IN_STATUS
* - \ref PSIO_IN_STATUS_UPDATE
*
* @return None
*
* @details This macro used to set specified pin action of check point.
* \hideinitializer
*/
#define PSIO_SET_ACTION(psio, u32Pin, u32CheckPoint, u32Action) (psio->GNCT[(u32Pin)].CPCTL1= \
(psio->GNCT[(u32Pin)].CPCTL1 & ~(PSIO_GNCT_CPCTL1_CKPT0ACT_Msk<<((u32CheckPoint)*PSIO_GNCT_CPCTL1_CKPT1ACT_Pos))) \
|((u32Action)<<((u32CheckPoint)*PSIO_GNCT_CPCTL1_CKPT1ACT_Pos)))
/*---------------------------------------------------------------------------------------------------------*/
/* inline functions */
/*---------------------------------------------------------------------------------------------------------*/
/**
* @brief Set interrupt control
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller
* @param[in] u32Int The interrupt type. Valid values are
* - \ref PSIO_INT0
* - \ref PSIO_INT1
* @param[in] u32Slot The selected slot. Valid values are
* - \ref PSIO_SLOT0
* - \ref PSIO_SLOT1
* - \ref PSIO_SLOT2
* - \ref PSIO_SLOT3
* - \ref PSIO_SLOT4
* - \ref PSIO_SLOT5
* - \ref PSIO_SLOT6
* - \ref PSIO_SLOT7
*
* @return None
*
* @details This function is used to set the selected slot controller, interrupt type and slot.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_SET_INTCTL(PSIO_T *psio, uint32_t u32SC, uint32_t u32Int, uint32_t u32Slot)
{
if (u32Int == PSIO_INT0)
{
(psio)->INTCTL = (((psio)->INTCTL & ~PSIO_INTCTL_CONI0SS_Msk & ~PSIO_INTCTL_CONI0SCS_Msk)
| ((u32SC) << PSIO_INTCTL_CONI0SCS_Pos)
| ((u32Slot) << PSIO_INTCTL_CONI0SS_Pos));
}
else if (u32Int == PSIO_INT1)
{
(psio)->INTCTL = (((psio)->INTCTL & ~PSIO_INTCTL_CONI1SS_Msk & ~PSIO_INTCTL_CONI1SCS_Msk)
| ((u32SC) << PSIO_INTCTL_CONI1SCS_Pos)
| ((u32Slot) << PSIO_INTCTL_CONI1SS_Pos));
}
}
/**
* @brief Clear interrupt control setting
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Int The interrupt type. Valid values are
* - \ref PSIO_INT0
* - \ref PSIO_INT1
*
* @return None
*
* @details This function is used to clear the selected slot controller, interrupt type and slot.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_CLEAR_INTCTL(PSIO_T *psio, uint32_t u32Int)
{
if (u32Int == PSIO_INT0)
{
(psio)->INTCTL = ((psio)->INTCTL & ~PSIO_INTCTL_CONI0SS_Msk & ~PSIO_INTCTL_CONI0SCS_Msk);
}
else if (u32Int == PSIO_INT1)
{
(psio)->INTCTL = ((psio)->INTCTL & ~PSIO_INTCTL_CONI1SS_Msk & ~PSIO_INTCTL_CONI1SCS_Msk);
}
}
/**
* @brief Set Slot controller control
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32SC The selected slot controller
* @param[in] u32InitSlot The selected initial slot of the repeat period. Valid values are
* - \ref PSIO_SLOT0
* - \ref PSIO_SLOT1
* - \ref PSIO_SLOT2
* - \ref PSIO_SLOT3
* - \ref PSIO_SLOT4
* - \ref PSIO_SLOT5
* - \ref PSIO_SLOT6
* - \ref PSIO_SLOT7
* @param[in] u32EndSlot The selected end slot of the repeat period. Valid values are
* - \ref PSIO_SLOT0
* - \ref PSIO_SLOT1
* - \ref PSIO_SLOT2
* - \ref PSIO_SLOT3
* - \ref PSIO_SLOT4
* - \ref PSIO_SLOT5
* - \ref PSIO_SLOT6
* - \ref PSIO_SLOT7
* @param[in] u32LoopCnt The slot period loop count. Valid values are
* - 0x0 : Disable
* - 0x1~0x3E : Repeat slot 0x2~0x3F times
* - 0x3F : Loop until stop PSIO slot controller
* @param[in] u32Repeat Repeat mode Enable/Disable. Valid values are
* - \ref PSIO_REPEAT_ENABLE
* - \ref PSIO_REPEAT_DISABLE
*
* @return None
*
* @details This function is used to set the slot controller loop and repeat configuration.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_SET_SCCTL(PSIO_T *psio, uint32_t u32SC, uint32_t u32InitSlot, uint32_t u32EndSlot, uint32_t u32LoopCnt, uint32_t u32Repeat)
{
(psio)->SCCT[u32SC].SCCTL = ((psio)->SCCT[u32SC].SCCTL & ~PSIO_SCCT_SCCTL_INISLOT_Msk & ~PSIO_SCCT_SCCTL_ENDSLOT_Msk & ~PSIO_SCCT_SCCTL_SPLCNT_Msk)
| ((u32InitSlot) << PSIO_SCCT_SCCTL_INISLOT_Pos)
| ((u32EndSlot) << PSIO_SCCT_SCCTL_ENDSLOT_Pos)
| ((u32LoopCnt & 0x3F) << PSIO_SCCT_SCCTL_SPLCNT_Pos);
if (u32Repeat == PSIO_REPEAT_ENABLE)
(psio)->SCCT[u32SC].SCCTL |= PSIO_SCCT_SCCTL_REPEAT_Msk;
else if (u32Repeat == PSIO_REPEAT_DISABLE)
(psio)->SCCT[u32SC].SCCTL &= ~PSIO_SCCT_SCCTL_REPEAT_Msk;
}
/**
* @brief Set Pin general control
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32PinEn The selected Pin enable/disable. Valid values are
* - \ref PSIO_PIN_ENABLE
* - \ref PSIO_PIN_DISABLE
* @param[in] u32SC The selected slot controller for check point. Valid values are
* - \ref PSIO_SC0
* - \ref PSIO_SC1
* - \ref PSIO_SC2
* - \ref PSIO_SC3
* @param[in] u32IOMode The pin I/O mode. Valid values are
* - \ref PSIO_INPUT_MODE
* - \ref PSIO_OUTPUT_MODE
* - \ref PSIO_OPENDRAIN_MODE
* - \ref PSIO_QUASI_MODE
* @param[in] u32PinInit The pin initial status. Valid values are
* - \ref PSIO_LOW_LEVEL
* - \ref PSIO_HIGH_LEVEL
* - \ref PSIO_LAST_OUTPUT
* - \ref PSIO_Toggle
* @param[in] u32PinInterval The pin interval status. Valid values are
* - \ref PSIO_LOW_LEVEL
* - \ref PSIO_HIGH_LEVEL
* - \ref PSIO_LAST_OUTPUT
* - \ref PSIO_Toggle
*
* @return None
*
* @details This function is used to set the general control.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_SET_GENCTL(PSIO_T *psio, uint32_t u32Pin, uint32_t u32PinEn, uint32_t u32SC, uint32_t u32IOMode, uint32_t u32PinInit, uint32_t u32PinInterval)
{
(psio)->GNCT[u32Pin].GENCTL = ((psio)->GNCT[u32Pin].GENCTL & ~PSIO_GNCT_GENCTL_SCSEL_Msk & ~PSIO_GNCT_GENCTL_IOMODE_Msk
& ~PSIO_GNCT_GENCTL_INITIAL_Msk & ~PSIO_GNCT_GENCTL_INTERVAL_Msk)
| ((u32SC) << PSIO_GNCT_GENCTL_SCSEL_Pos) | ((u32IOMode) << PSIO_GNCT_GENCTL_IOMODE_Pos)
| ((u32PinInit) << PSIO_GNCT_GENCTL_INITIAL_Pos) | ((u32PinInterval) << PSIO_GNCT_GENCTL_INTERVAL_Pos);
if (u32PinEn == PSIO_PIN_ENABLE)
(psio)->GNCT[u32Pin].GENCTL |= PSIO_GNCT_GENCTL_PINEN_Msk;
else if (u32PinEn == PSIO_PIN_DISABLE)
(psio)->GNCT[u32Pin].GENCTL &= ~PSIO_GNCT_GENCTL_PINEN_Msk;
}
/**
* @brief Set Pin mode switch
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] u32SwPoint The switch point. Valid values are
* - \ref PSIO_SWITCH_P0
* - \ref PSIO_SWITCH_P1
* @param[in] u32SwMode The switch mode. Valid values are
* - \ref PSIO_INPUT_MODE
* - \ref PSIO_OUTPUT_MODE
* - \ref PSIO_OPENDRAIN_MODE
* - \ref PSIO_QUASI_MODE
* @param[in] u32SwCP The switch I/O mode at which point. Valid values are
* - \ref PSIO_CP0
* - \ref PSIO_CP1
* - \ref PSIO_CP2
* - \ref PSIO_CP3
* - \ref PSIO_CP4
* - \ref PSIO_CP5
* - \ref PSIO_CP6
* - \ref PSIO_CP7
* @return None
*
* @details This function is used to set the pin mode switch.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_SWITCH_MODE(PSIO_T *psio, uint32_t u32Pin, uint32_t u32SwPoint, uint32_t u32SwMode, uint32_t u32SwCP)
{
if (u32SwPoint == PSIO_SWITCH_P0)
{
(psio)->GNCT[u32Pin].GENCTL = ((psio)->GNCT[u32Pin].GENCTL & ~PSIO_GNCT_GENCTL_MODESW0_Msk & ~PSIO_GNCT_GENCTL_SW0CP_Msk)
| ((u32SwMode) << PSIO_GNCT_GENCTL_MODESW0_Pos) | ((u32SwCP + 1) << PSIO_GNCT_GENCTL_SW0CP_Pos);
}
else if (u32SwPoint == PSIO_SWITCH_P1)
{
(psio)->GNCT[u32Pin].GENCTL = ((psio)->GNCT[u32Pin].GENCTL & ~PSIO_GNCT_GENCTL_MODESW1_Msk & ~PSIO_GNCT_GENCTL_SW1CP_Msk)
| ((u32SwMode) << PSIO_GNCT_GENCTL_MODESW1_Pos) | ((u32SwCP + 1) << PSIO_GNCT_GENCTL_SW1CP_Pos);
}
}
/**
* @brief Set specified pin check point and slot link, and pin action of check point
*
* @param[in] psio The pointer of the specified PSIO module
* @param[in] u32Pin The selected Pin. Valid values are
* - \ref PSIO_PIN0
* - \ref PSIO_PIN1
* - \ref PSIO_PIN2
* - \ref PSIO_PIN3
* - \ref PSIO_PIN4
* - \ref PSIO_PIN5
* - \ref PSIO_PIN6
* - \ref PSIO_PIN7
* @param[in] sConfig The selected check point configurations.
*
* @return None
*
* @details This macro used to link check point and slot, and set pin action of check point.
* \hideinitializer
*/
__STATIC_INLINE void PSIO_SET_CP_CONFIG(PSIO_T *psio, uint32_t u32Pin, const S_PSIO_CP_CONFIG *sConfig)
{
psio->GNCT[u32Pin].CPCTL0 = *(uint32_t *)sConfig;
psio->GNCT[u32Pin].CPCTL1 = *((uint32_t *)sConfig + 1);
}
/*@}*/ /* end of group PSIO_EXPORTED_FUNCTIONS */
/*@}*/ /* end of group PSIO_Driver */
/*@}*/ /* end of group Standard_Driver */
#ifdef __cplusplus
}
#endif
#endif /* __NU_PSIO_H__ */
|