summaryrefslogtreecommitdiff
path: root/bsp/imx6ul/platform/include/mx6ul/registers/regsecspi.h
blob: 24172aa575a9fae9750e837e939777ef3b518fcf (plain)
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
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
/*
 * Copyright (c) 2012, Freescale Semiconductor, Inc.
 * All rights reserved.
 *
 * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
 * SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 * OF SUCH DAMAGE.
 */
/*
 * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
 *
 * This file was generated automatically and any changes may be lost.
 */
#ifndef __HW_ECSPI_REGISTERS_H__
#define __HW_ECSPI_REGISTERS_H__

#include "regs.h"

/*
 * i.MX6UL ECSPI
 *
 * ECSPI
 *
 * Registers defined in this header file:
 * - HW_ECSPI_RXDATA - Receive Data Register
 * - HW_ECSPI_TXDATA - Transmit Data Register
 * - HW_ECSPI_CONREG - Control Register
 * - HW_ECSPI_CONFIGREG - Config Register
 * - HW_ECSPI_INTREG - Interrupt Control Register
 * - HW_ECSPI_DMAREG - DMA Control Register
 * - HW_ECSPI_STATREG - Status Register
 * - HW_ECSPI_PERIODREG - Sample Period Control Register
 * - HW_ECSPI_TESTREG - Test Control Register
 * - HW_ECSPI_MSGDATA - Message Data Register
 *
 * - hw_ecspi_t - Struct containing all module registers.
 */

//! @name Module base addresses
//@{
#ifndef REGS_ECSPI_BASE
#define HW_ECSPI_INSTANCE_COUNT (4) //!< Number of instances of the ECSPI module.
#define HW_ECSPI1 (1) //!< Instance number for ECSPI1.
#define HW_ECSPI2 (2) //!< Instance number for ECSPI2.
#define HW_ECSPI3 (3) //!< Instance number for ECSPI3.
#define HW_ECSPI4 (4) //!< Instance number for ECSPI4.
#define REGS_ECSPI1_BASE (0x02008000) //!< Base address for ECSPI instance number 1.
#define REGS_ECSPI2_BASE (0x0200c000) //!< Base address for ECSPI instance number 2.
#define REGS_ECSPI3_BASE (0x02010000) //!< Base address for ECSPI instance number 3.
#define REGS_ECSPI4_BASE (0x02014000) //!< Base address for ECSPI instance number 4.

//! @brief Get the base address of ECSPI by instance number.
//! @param x ECSPI instance number, from 1 through 4.
#define REGS_ECSPI_BASE(x) ( (x) == HW_ECSPI1 ? REGS_ECSPI1_BASE : (x) == HW_ECSPI2 ? REGS_ECSPI2_BASE : (x) == HW_ECSPI3 ? REGS_ECSPI3_BASE : (x) == HW_ECSPI4 ? REGS_ECSPI4_BASE : 0x00d00000)

//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of ECSPI.
#define REGS_ECSPI_INSTANCE(b) ( (b) == REGS_ECSPI1_BASE ? HW_ECSPI1 : (b) == REGS_ECSPI2_BASE ? HW_ECSPI2 : (b) == REGS_ECSPI3_BASE ? HW_ECSPI3 : (b) == REGS_ECSPI4_BASE ? HW_ECSPI4 : 0)
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_RXDATA - Receive Data Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_RXDATA - Receive Data Register (RO)
 *
 * Reset value: 0x00000000
 *
 * The Receive Data register (ECSPI_RXDATA) is a read-only register that forms the top word of the
 * 64 x 32 receive FIFO. This register holds the data received from an external SPI device during a
 * data transaction. Only word-sized read operations are allowed.
 */
typedef union _hw_ecspi_rxdata
{
    reg32_t U;
    struct _hw_ecspi_rxdata_bitfields
    {
        unsigned ECSPI_RXDATA : 32; //!< [31:0] Receive Data.
    } B;
} hw_ecspi_rxdata_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_RXDATA register
 */
//@{
#define HW_ECSPI_RXDATA_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x0)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_RXDATA(x)           (*(volatile hw_ecspi_rxdata_t *) HW_ECSPI_RXDATA_ADDR(x))
#define HW_ECSPI_RXDATA_RD(x)        (HW_ECSPI_RXDATA(x).U)
#endif
//@}

/*
 * constants & macros for individual ECSPI_RXDATA bitfields
 */

/*! @name Register ECSPI_RXDATA, field ECSPI_RXDATA[31:0] (RO)
 *
 * Receive Data. This register holds the top word of the receive data FIFO. The FIFO is advanced for
 * each read of this register. The data read is undefined when the Receive Data Ready (RR) bit in
 * the Interrupt Control/Status register is cleared. Zeros are read when ECSPI is disabled.
 */
//@{
#define BP_ECSPI_RXDATA_ECSPI_RXDATA      (0)      //!< Bit position for ECSPI_RXDATA_ECSPI_RXDATA.
#define BM_ECSPI_RXDATA_ECSPI_RXDATA      (0xffffffff)  //!< Bit mask for ECSPI_RXDATA_ECSPI_RXDATA.

//! @brief Get value of ECSPI_RXDATA_ECSPI_RXDATA from a register value.
#define BG_ECSPI_RXDATA_ECSPI_RXDATA(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_RXDATA_ECSPI_RXDATA) >> BP_ECSPI_RXDATA_ECSPI_RXDATA)
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_TXDATA - Transmit Data Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_TXDATA - Transmit Data Register (WO)
 *
 * Reset value: 0x00000000
 *
 * The Transmit Data (ECSPI_TXDATA) register is a write-only data register that forms the bottom
 * word of the 64 x 32 TXFIFO. The TXFIFO can be written to as long as it is not full, even when the
 * SPI Exchange bit (XCH) in ECSPI_CONREG is set. This allows software to write to the TXFIFO during
 * a SPI data exchange process. Writes to this register are ignored when the ECSPI is disabled
 * (ECSPI_CONREG[EN] bit is cleared).
 */
typedef union _hw_ecspi_txdata
{
    reg32_t U;
    struct _hw_ecspi_txdata_bitfields
    {
        unsigned ECSPI_TXDATA : 32; //!< [31:0] Transmit Data.
    } B;
} hw_ecspi_txdata_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_TXDATA register
 */
//@{
#define HW_ECSPI_TXDATA_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x4)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_TXDATA(x)           (*(volatile hw_ecspi_txdata_t *) HW_ECSPI_TXDATA_ADDR(x))
#define HW_ECSPI_TXDATA_WR(x, v)     (HW_ECSPI_TXDATA(x).U = (v))
#endif
//@}

/*
 * constants & macros for individual ECSPI_TXDATA bitfields
 */

/*! @name Register ECSPI_TXDATA, field ECSPI_TXDATA[31:0] (WO)
 *
 * Transmit Data. This register holds the top word of data loaded into the FIFO. Data written to
 * this register must be a word operation. The number of bits actually transmitted is determined by
 * the BIT_COUNT field of the corresponding SPI Control register. If this field contains more bits
 * than the number specified by BIT_COUNT, the extra bits are ignored. For example, to transfer 10
 * bits of data, a 32-bit word must be written to this register. Bits 9-0 are shifted out and bits
 * 31-10 are ignored. When the ECSPI is operating in Slave mode, zeros are shifted out when the FIFO
 * is empty. Zeros are read when ECSPI is disabled.
 */
//@{
#define BP_ECSPI_TXDATA_ECSPI_TXDATA      (0)      //!< Bit position for ECSPI_TXDATA_ECSPI_TXDATA.
#define BM_ECSPI_TXDATA_ECSPI_TXDATA      (0xffffffff)  //!< Bit mask for ECSPI_TXDATA_ECSPI_TXDATA.

//! @brief Get value of ECSPI_TXDATA_ECSPI_TXDATA from a register value.
#define BG_ECSPI_TXDATA_ECSPI_TXDATA(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TXDATA_ECSPI_TXDATA) >> BP_ECSPI_TXDATA_ECSPI_TXDATA)

//! @brief Format value for bitfield ECSPI_TXDATA_ECSPI_TXDATA.
#define BF_ECSPI_TXDATA_ECSPI_TXDATA(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TXDATA_ECSPI_TXDATA) & BM_ECSPI_TXDATA_ECSPI_TXDATA)
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_CONREG - Control Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_CONREG - Control Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Control Register (ECSPI_CONREG) allows software to enable the ECSPI , configure its operating
 * modes, specify the divider value, and SPI_RDY control signal, and define the transfer length.
 */
typedef union _hw_ecspi_conreg
{
    reg32_t U;
    struct _hw_ecspi_conreg_bitfields
    {
        unsigned EN : 1; //!< [0] SPI Block Enable Control.
        unsigned HT : 1; //!< [1] Hardware Trigger Enable.
        unsigned XCH : 1; //!< [2] SPI Exchange Bit.
        unsigned SMC : 1; //!< [3] Start Mode Control.
        unsigned CHANNEL_MODE : 4; //!< [7:4] SPI CHANNEL MODE selects the mode for each SPI channel.
        unsigned POST_DIVIDER : 4; //!< [11:8] SPI Post Divider.
        unsigned PRE_DIVIDER : 4; //!< [15:12] SPI Pre Divider.
        unsigned DRCTL : 2; //!< [17:16] SPI Data Ready Control.
        unsigned CHANNEL_SELECT : 2; //!< [19:18] SPI CHANNEL SELECT bits.
        unsigned BURST_LENGTH : 12; //!< [31:20] Burst Length.
    } B;
} hw_ecspi_conreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_CONREG register
 */
//@{
#define HW_ECSPI_CONREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x8)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_CONREG(x)           (*(volatile hw_ecspi_conreg_t *) HW_ECSPI_CONREG_ADDR(x))
#define HW_ECSPI_CONREG_RD(x)        (HW_ECSPI_CONREG(x).U)
#define HW_ECSPI_CONREG_WR(x, v)     (HW_ECSPI_CONREG(x).U = (v))
#define HW_ECSPI_CONREG_SET(x, v)    (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) |  (v)))
#define HW_ECSPI_CONREG_CLR(x, v)    (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) & ~(v)))
#define HW_ECSPI_CONREG_TOG(x, v)    (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_CONREG bitfields
 */

/*! @name Register ECSPI_CONREG, field EN[0] (RW)
 *
 * SPI Block Enable Control. This bit enables the ECSPI. This bit must be set before writing to
 * other registers or initiating an exchange. Writing zero to this bit disables the block and resets
 * the internal logic with the exception of the ECSPI_CONREG. The block's internal clocks are gated
 * off whenever the block is disabled.
 *
 * Values:
 * - 0 - Disable the block.
 * - 1 - Enable the block.
 */
//@{
#define BP_ECSPI_CONREG_EN      (0)      //!< Bit position for ECSPI_CONREG_EN.
#define BM_ECSPI_CONREG_EN      (0x00000001)  //!< Bit mask for ECSPI_CONREG_EN.

//! @brief Get value of ECSPI_CONREG_EN from a register value.
#define BG_ECSPI_CONREG_EN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_EN) >> BP_ECSPI_CONREG_EN)

//! @brief Format value for bitfield ECSPI_CONREG_EN.
#define BF_ECSPI_CONREG_EN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_EN) & BM_ECSPI_CONREG_EN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the EN field to a new value.
#define BW_ECSPI_CONREG_EN(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_EN) | BF_ECSPI_CONREG_EN(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field HT[1] (RW)
 *
 * Hardware Trigger Enable. This bit is used in master mode only. It enables hardware trigger (HT)
 * mode. Note, HT mode is not supported by this product.
 *
 * Values:
 * - 0 - Disable HT mode.
 * - 1 - Enable HT mode.
 */
//@{
#define BP_ECSPI_CONREG_HT      (1)      //!< Bit position for ECSPI_CONREG_HT.
#define BM_ECSPI_CONREG_HT      (0x00000002)  //!< Bit mask for ECSPI_CONREG_HT.

//! @brief Get value of ECSPI_CONREG_HT from a register value.
#define BG_ECSPI_CONREG_HT(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_HT) >> BP_ECSPI_CONREG_HT)

//! @brief Format value for bitfield ECSPI_CONREG_HT.
#define BF_ECSPI_CONREG_HT(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_HT) & BM_ECSPI_CONREG_HT)

#ifndef __LANGUAGE_ASM__
//! @brief Set the HT field to a new value.
#define BW_ECSPI_CONREG_HT(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_HT) | BF_ECSPI_CONREG_HT(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field XCH[2] (RW)
 *
 * SPI Exchange Bit. This bit applies only to channels configured in Master mode (CHANNEL MODE = 1).
 * If the Start Mode Control (SMC) bit is cleared, writing a 1 to this bit starts one SPI burst or
 * multiple SPI bursts according to the SPI SS Wave Form Select (SS_CTL). The XCH bit remains set
 * while either the data exchange is in progress, or when the ECSPI is waiting for an active input
 * if SPIRDY is enabled through DRCTL. This bit is cleared automatically when all data in the TXFIFO
 * and the shift register has been shifted out.
 *
 * Values:
 * - 0 - Idle.
 * - 1 - Initiates exchange (write) or busy (read).
 */
//@{
#define BP_ECSPI_CONREG_XCH      (2)      //!< Bit position for ECSPI_CONREG_XCH.
#define BM_ECSPI_CONREG_XCH      (0x00000004)  //!< Bit mask for ECSPI_CONREG_XCH.

//! @brief Get value of ECSPI_CONREG_XCH from a register value.
#define BG_ECSPI_CONREG_XCH(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_XCH) >> BP_ECSPI_CONREG_XCH)

//! @brief Format value for bitfield ECSPI_CONREG_XCH.
#define BF_ECSPI_CONREG_XCH(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_XCH) & BM_ECSPI_CONREG_XCH)

#ifndef __LANGUAGE_ASM__
//! @brief Set the XCH field to a new value.
#define BW_ECSPI_CONREG_XCH(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_XCH) | BF_ECSPI_CONREG_XCH(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field SMC[3] (RW)
 *
 * Start Mode Control. This bit applies only to channels configured in Master mode (CHANNEL MODE =
 * 1). It controls how the ECSPI starts a SPI burst, either through the SPI exchange bit, or
 * immediately when the TXFIFO is written to.
 *
 * Values:
 * - 0 - SPI Exchange Bit (XCH) controls when a SPI burst can start. Setting the XCH bit will start a SPI
 *     burst or multiple bursts. This is controlled by the SPI SS Wave Form Select (SS_CTL). Refer
 *     to XCH and SS_CTL descriptions.
 * - 1 - Immediately starts a SPI burst when data is written in TXFIFO.
 */
//@{
#define BP_ECSPI_CONREG_SMC      (3)      //!< Bit position for ECSPI_CONREG_SMC.
#define BM_ECSPI_CONREG_SMC      (0x00000008)  //!< Bit mask for ECSPI_CONREG_SMC.

//! @brief Get value of ECSPI_CONREG_SMC from a register value.
#define BG_ECSPI_CONREG_SMC(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_SMC) >> BP_ECSPI_CONREG_SMC)

//! @brief Format value for bitfield ECSPI_CONREG_SMC.
#define BF_ECSPI_CONREG_SMC(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_SMC) & BM_ECSPI_CONREG_SMC)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SMC field to a new value.
#define BW_ECSPI_CONREG_SMC(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_SMC) | BF_ECSPI_CONREG_SMC(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field CHANNEL_MODE[7:4] (RW)
 *
 * SPI CHANNEL MODE selects the mode for each SPI channel. CHANNEL MODE[3] is for SPI channel 3.
 * CHANNEL MODE[2] is for SPI channel 2. CHANNEL MODE[1] is for SPI channel 1. CHANNEL MODE[0] is
 * for SPI channel 0.
 *
 * Values:
 * - 0 - Slave mode.
 * - 1 - Master mode.
 */
//@{
#define BP_ECSPI_CONREG_CHANNEL_MODE      (4)      //!< Bit position for ECSPI_CONREG_CHANNEL_MODE.
#define BM_ECSPI_CONREG_CHANNEL_MODE      (0x000000f0)  //!< Bit mask for ECSPI_CONREG_CHANNEL_MODE.

//! @brief Get value of ECSPI_CONREG_CHANNEL_MODE from a register value.
#define BG_ECSPI_CONREG_CHANNEL_MODE(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_CHANNEL_MODE) >> BP_ECSPI_CONREG_CHANNEL_MODE)

//! @brief Format value for bitfield ECSPI_CONREG_CHANNEL_MODE.
#define BF_ECSPI_CONREG_CHANNEL_MODE(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_CHANNEL_MODE) & BM_ECSPI_CONREG_CHANNEL_MODE)

#ifndef __LANGUAGE_ASM__
//! @brief Set the CHANNEL_MODE field to a new value.
#define BW_ECSPI_CONREG_CHANNEL_MODE(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_CHANNEL_MODE) | BF_ECSPI_CONREG_CHANNEL_MODE(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field POST_DIVIDER[11:8] (RW)
 *
 * SPI Post Divider. ECSPI uses a two-stage divider to generate the SPI clock. This field defines
 * the post-divider of the reference clock using the equation: 2 n .
 *
 * Values:
 * - 0000 - Divide by 1.
 * - ... - 
 * - 0001 - Divide by 2.
 * - 0010 - Divide by 4.
 * - 1110 - Divide by 2 14 .
 * - 1111 - Divide by 2 15 .
 */
//@{
#define BP_ECSPI_CONREG_POST_DIVIDER      (8)      //!< Bit position for ECSPI_CONREG_POST_DIVIDER.
#define BM_ECSPI_CONREG_POST_DIVIDER      (0x00000f00)  //!< Bit mask for ECSPI_CONREG_POST_DIVIDER.

//! @brief Get value of ECSPI_CONREG_POST_DIVIDER from a register value.
#define BG_ECSPI_CONREG_POST_DIVIDER(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_POST_DIVIDER) >> BP_ECSPI_CONREG_POST_DIVIDER)

//! @brief Format value for bitfield ECSPI_CONREG_POST_DIVIDER.
#define BF_ECSPI_CONREG_POST_DIVIDER(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_POST_DIVIDER) & BM_ECSPI_CONREG_POST_DIVIDER)

#ifndef __LANGUAGE_ASM__
//! @brief Set the POST_DIVIDER field to a new value.
#define BW_ECSPI_CONREG_POST_DIVIDER(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_POST_DIVIDER) | BF_ECSPI_CONREG_POST_DIVIDER(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field PRE_DIVIDER[15:12] (RW)
 *
 * SPI Pre Divider. ECSPI uses a two-stage divider to generate the SPI clock. This field defines the
 * pre-divider of the reference clock.
 *
 * Values:
 * - 0000 - Divide by 1.
 * - ... - 
 * - 0001 - Divide by 2.
 * - 0010 - Divide by 3.
 * - 1101 - Divide by 14.
 * - 1110 - Divide by 15.
 * - 1111 - Divide by 16.
 */
//@{
#define BP_ECSPI_CONREG_PRE_DIVIDER      (12)      //!< Bit position for ECSPI_CONREG_PRE_DIVIDER.
#define BM_ECSPI_CONREG_PRE_DIVIDER      (0x0000f000)  //!< Bit mask for ECSPI_CONREG_PRE_DIVIDER.

//! @brief Get value of ECSPI_CONREG_PRE_DIVIDER from a register value.
#define BG_ECSPI_CONREG_PRE_DIVIDER(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_PRE_DIVIDER) >> BP_ECSPI_CONREG_PRE_DIVIDER)

//! @brief Format value for bitfield ECSPI_CONREG_PRE_DIVIDER.
#define BF_ECSPI_CONREG_PRE_DIVIDER(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_PRE_DIVIDER) & BM_ECSPI_CONREG_PRE_DIVIDER)

#ifndef __LANGUAGE_ASM__
//! @brief Set the PRE_DIVIDER field to a new value.
#define BW_ECSPI_CONREG_PRE_DIVIDER(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_PRE_DIVIDER) | BF_ECSPI_CONREG_PRE_DIVIDER(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field DRCTL[17:16] (RW)
 *
 * SPI Data Ready Control. This field selects the utilization of the SPI_RDY signal in master mode.
 * ECSPI checks this field before it starts an SPI burst.
 *
 * Values:
 * - 00 - The SPI_RDY signal is a don't care.
 * - 01 - Burst will be triggered by the falling edge of the SPI_RDY signal (edge-triggered).
 * - 10 - Burst will be triggered by a low level of the SPI_RDY signal (level-triggered).
 * - 11 - Reserved.
 */
//@{
#define BP_ECSPI_CONREG_DRCTL      (16)      //!< Bit position for ECSPI_CONREG_DRCTL.
#define BM_ECSPI_CONREG_DRCTL      (0x00030000)  //!< Bit mask for ECSPI_CONREG_DRCTL.

//! @brief Get value of ECSPI_CONREG_DRCTL from a register value.
#define BG_ECSPI_CONREG_DRCTL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_DRCTL) >> BP_ECSPI_CONREG_DRCTL)

//! @brief Format value for bitfield ECSPI_CONREG_DRCTL.
#define BF_ECSPI_CONREG_DRCTL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_DRCTL) & BM_ECSPI_CONREG_DRCTL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the DRCTL field to a new value.
#define BW_ECSPI_CONREG_DRCTL(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_DRCTL) | BF_ECSPI_CONREG_DRCTL(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field CHANNEL_SELECT[19:18] (RW)
 *
 * SPI CHANNEL SELECT bits. Select one of four external SPI Master/Slave Devices. In master mode,
 * these two bits select the external slave devices by asserting the Chip Select (SSn) outputs. Only
 * the selected Chip Select (SSn) signal can be active at a given time; the remaining three signals
 * will be negated.
 *
 * Values:
 * - 00 - Channel 0 is selected. Chip Select 0 (SS0) will be asserted.
 * - 01 - Channel 1 is selected. Chip Select 1 (SS1) will be asserted.
 * - 10 - Channel 2 is selected. Chip Select 2 (SS2) will be asserted.
 * - 11 - Channel 3 is selected. Chip Select 3 (SS3) will be asserted.
 */
//@{
#define BP_ECSPI_CONREG_CHANNEL_SELECT      (18)      //!< Bit position for ECSPI_CONREG_CHANNEL_SELECT.
#define BM_ECSPI_CONREG_CHANNEL_SELECT      (0x000c0000)  //!< Bit mask for ECSPI_CONREG_CHANNEL_SELECT.

//! @brief Get value of ECSPI_CONREG_CHANNEL_SELECT from a register value.
#define BG_ECSPI_CONREG_CHANNEL_SELECT(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_CHANNEL_SELECT) >> BP_ECSPI_CONREG_CHANNEL_SELECT)

//! @brief Format value for bitfield ECSPI_CONREG_CHANNEL_SELECT.
#define BF_ECSPI_CONREG_CHANNEL_SELECT(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_CHANNEL_SELECT) & BM_ECSPI_CONREG_CHANNEL_SELECT)

#ifndef __LANGUAGE_ASM__
//! @brief Set the CHANNEL_SELECT field to a new value.
#define BW_ECSPI_CONREG_CHANNEL_SELECT(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_CHANNEL_SELECT) | BF_ECSPI_CONREG_CHANNEL_SELECT(v)))
#endif
//@}

/*! @name Register ECSPI_CONREG, field BURST_LENGTH[31:20] (RW)
 *
 * Burst Length. This field defines the length of a SPI burst to be transferred. The Chip Select
 * (SS) will remain asserted until all bits in a SPI burst are shifted out. A maximum of 2^12 bits
 * can be transferred in a single SPI burst. In master mode, it controls the number of bits per SPI
 * burst. Since the shift register always loads 32-bit data from transmit FIFO, only the n least-
 * significant (n = BURST LENGTH + 1) will be shifted out. The remaining bits will be ignored. In
 * slave mode, only when SS_CTL is cleared, this field will take effect in the transfer. Number of
 * Valid Bits in a SPI burst.
 *
 * Values:
 * - 0x000 - A SPI burst contains the 1 LSB in a word.
 * - ... - 
 * - ... - 
 * - 0x001 - A SPI burst contains the 2 LSB in a word.
 * - 0x002 - A SPI burst contains the 3 LSB in a word.
 * - 0x01F - A SPI burst contains all 32 bits in a word.
 * - 0x020 - A SPI burst contains the 1 LSB in first word and all 32 bits in second word.
 * - 0x021 - A SPI burst contains the 2 LSB in first word and all 32 bits in second word.
 * - 0xFFE - A SPI burst contains the 31 LSB in first word and 2^7 -1 words.
 * - 0xFFF - A SPI burst contains 2^7 words.
 */
//@{
#define BP_ECSPI_CONREG_BURST_LENGTH      (20)      //!< Bit position for ECSPI_CONREG_BURST_LENGTH.
#define BM_ECSPI_CONREG_BURST_LENGTH      (0xfff00000)  //!< Bit mask for ECSPI_CONREG_BURST_LENGTH.

//! @brief Get value of ECSPI_CONREG_BURST_LENGTH from a register value.
#define BG_ECSPI_CONREG_BURST_LENGTH(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_BURST_LENGTH) >> BP_ECSPI_CONREG_BURST_LENGTH)

//! @brief Format value for bitfield ECSPI_CONREG_BURST_LENGTH.
#define BF_ECSPI_CONREG_BURST_LENGTH(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_BURST_LENGTH) & BM_ECSPI_CONREG_BURST_LENGTH)

#ifndef __LANGUAGE_ASM__
//! @brief Set the BURST_LENGTH field to a new value.
#define BW_ECSPI_CONREG_BURST_LENGTH(x, v)   (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_BURST_LENGTH) | BF_ECSPI_CONREG_BURST_LENGTH(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_CONFIGREG - Config Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_CONFIGREG - Config Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Config Register (ECSPI_CONFIGREG) allows software to configure each SPI channel, configure
 * its operating modes, specify the phase and polarity of the clock, configure the Chip Select (SS),
 * and define the HT transfer length. Note, HT mode is not supported by this product.
 */
typedef union _hw_ecspi_configreg
{
    reg32_t U;
    struct _hw_ecspi_configreg_bitfields
    {
        unsigned SCLK_PHA : 4; //!< [3:0] SPI Clock/Data Phase Control.
        unsigned SCLK_POL : 4; //!< [7:4] SPI Clock Polarity Control.
        unsigned SS_CTL : 4; //!< [11:8] SPI SS Wave Form Select.
        unsigned SS_POL : 4; //!< [15:12] SPI SS Polarity Select.
        unsigned DATA_CTL : 4; //!< [19:16] DATA CTL.
        unsigned SCLK_CTL : 4; //!< [23:20] SCLK CTL.
        unsigned HT_LENGTH : 5; //!< [28:24] HT LENGTH.
        unsigned RESERVED0 : 3; //!< [31:29] Reserved
    } B;
} hw_ecspi_configreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_CONFIGREG register
 */
//@{
#define HW_ECSPI_CONFIGREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0xc)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_CONFIGREG(x)           (*(volatile hw_ecspi_configreg_t *) HW_ECSPI_CONFIGREG_ADDR(x))
#define HW_ECSPI_CONFIGREG_RD(x)        (HW_ECSPI_CONFIGREG(x).U)
#define HW_ECSPI_CONFIGREG_WR(x, v)     (HW_ECSPI_CONFIGREG(x).U = (v))
#define HW_ECSPI_CONFIGREG_SET(x, v)    (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) |  (v)))
#define HW_ECSPI_CONFIGREG_CLR(x, v)    (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) & ~(v)))
#define HW_ECSPI_CONFIGREG_TOG(x, v)    (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_CONFIGREG bitfields
 */

/*! @name Register ECSPI_CONFIGREG, field SCLK_PHA[3:0] (RW)
 *
 * SPI Clock/Data Phase Control. This field controls the clock/data phase relationship. See for more
 * information. SCLK PHA[3] is for SPI channel 3. SCLK PHA[2] is for SPI channel 2. SCLK PHA[1] is
 * for SPI channel 1. SCLK PHA[0] is for SPI channel 0.
 *
 * Values:
 * - 0 - Phase 0 operation.
 * - 1 - Phase 1 operation.
 */
//@{
#define BP_ECSPI_CONFIGREG_SCLK_PHA      (0)      //!< Bit position for ECSPI_CONFIGREG_SCLK_PHA.
#define BM_ECSPI_CONFIGREG_SCLK_PHA      (0x0000000f)  //!< Bit mask for ECSPI_CONFIGREG_SCLK_PHA.

//! @brief Get value of ECSPI_CONFIGREG_SCLK_PHA from a register value.
#define BG_ECSPI_CONFIGREG_SCLK_PHA(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_PHA) >> BP_ECSPI_CONFIGREG_SCLK_PHA)

//! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_PHA.
#define BF_ECSPI_CONFIGREG_SCLK_PHA(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_PHA) & BM_ECSPI_CONFIGREG_SCLK_PHA)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SCLK_PHA field to a new value.
#define BW_ECSPI_CONFIGREG_SCLK_PHA(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_PHA) | BF_ECSPI_CONFIGREG_SCLK_PHA(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field SCLK_POL[7:4] (RW)
 *
 * SPI Clock Polarity Control. This field controls the polarity of the SCLK signal. See for more
 * information. SCLK_POL[3] is for SPI channel 3. SCLK_POL[2] is for SPI channel 2. SCLK_POL[1] is
 * for SPI channel 1. SCLK_POL[0] is for SPI channel 0.
 *
 * Values:
 * - 0 - Active high polarity (0 = Idle).
 * - 1 - Active low polarity (1 = Idle).
 */
//@{
#define BP_ECSPI_CONFIGREG_SCLK_POL      (4)      //!< Bit position for ECSPI_CONFIGREG_SCLK_POL.
#define BM_ECSPI_CONFIGREG_SCLK_POL      (0x000000f0)  //!< Bit mask for ECSPI_CONFIGREG_SCLK_POL.

//! @brief Get value of ECSPI_CONFIGREG_SCLK_POL from a register value.
#define BG_ECSPI_CONFIGREG_SCLK_POL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_POL) >> BP_ECSPI_CONFIGREG_SCLK_POL)

//! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_POL.
#define BF_ECSPI_CONFIGREG_SCLK_POL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_POL) & BM_ECSPI_CONFIGREG_SCLK_POL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SCLK_POL field to a new value.
#define BW_ECSPI_CONFIGREG_SCLK_POL(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_POL) | BF_ECSPI_CONFIGREG_SCLK_POL(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field SS_CTL[11:8] (RW)
 *
 * SPI SS Wave Form Select. In master mode, this field controls the output wave form of the Chip
 * Select (SS) signal when the SMC (Start Mode Control) bit is cleared. The SS_CTL are ignored if
 * the SMC bit is set. SS CTL[3] is for SPI channel 3. SS CTL[2] is for SPI channel 2. SS CTL[1] is
 * for SPI channel 1. SS CTL[0] is for SPI channel 0. In slave mode, this bit controls when the SPI
 * burst is completed. An SPI burst is completed by the Chip Select (SS) signal edges. (SSPOL = 0:
 * rising edge; SSPOL = 1: falling edge) The RXFIFO is advanced whenever a Chip Select (SS) signal
 * edge is detected or the shift register contains 32-bits of valid data.
 *
 * Values:
 * - 0 - In master mode - only one SPI burst will be transmitted.
 * - 0 - In slave mode - an SPI burst is completed when the number of bits received in the shift register is
 *     equal to (BURST LENGTH + 1). Only the n least-significant bits (n = BURST LENGTH[4:0] + 1) of
 *     the first received word are valid. All bits subsequent to the first received word in RXFIFO
 *     are valid.
 * - 1 - In master mode - Negate Chip Select (SS) signal between SPI bursts. Multiple SPI bursts will be
 *     transmitted. The SPI transfer will automatically stop when the TXFIFO is empty.
 * - 1 - In slave mode - an SPI burst is completed by the Chip Select (SS) signal edges. (SSPOL = 0: rising
 *     edge; SSPOL = 1: falling edge) The RXFIFO is advanced whenever a Chip Select (SS) signal edge
 *     is detected or the shift register contains 32-bits of valid data.
 */
//@{
#define BP_ECSPI_CONFIGREG_SS_CTL      (8)      //!< Bit position for ECSPI_CONFIGREG_SS_CTL.
#define BM_ECSPI_CONFIGREG_SS_CTL      (0x00000f00)  //!< Bit mask for ECSPI_CONFIGREG_SS_CTL.

//! @brief Get value of ECSPI_CONFIGREG_SS_CTL from a register value.
#define BG_ECSPI_CONFIGREG_SS_CTL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SS_CTL) >> BP_ECSPI_CONFIGREG_SS_CTL)

//! @brief Format value for bitfield ECSPI_CONFIGREG_SS_CTL.
#define BF_ECSPI_CONFIGREG_SS_CTL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SS_CTL) & BM_ECSPI_CONFIGREG_SS_CTL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SS_CTL field to a new value.
#define BW_ECSPI_CONFIGREG_SS_CTL(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SS_CTL) | BF_ECSPI_CONFIGREG_SS_CTL(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field SS_POL[15:12] (RW)
 *
 * SPI SS Polarity Select. In both Master and Slave modes, this field selects the polarity of the
 * Chip Select (SS) signal. SS POL[3] is for SPI channel 3. SS POL[2] is for SPI channel 2. SS
 * POL[1] is for SPI channel 1. SS POL[0] is for SPI channel 0.
 *
 * Values:
 * - 0 - Active low.
 * - 1 - Active high.
 */
//@{
#define BP_ECSPI_CONFIGREG_SS_POL      (12)      //!< Bit position for ECSPI_CONFIGREG_SS_POL.
#define BM_ECSPI_CONFIGREG_SS_POL      (0x0000f000)  //!< Bit mask for ECSPI_CONFIGREG_SS_POL.

//! @brief Get value of ECSPI_CONFIGREG_SS_POL from a register value.
#define BG_ECSPI_CONFIGREG_SS_POL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SS_POL) >> BP_ECSPI_CONFIGREG_SS_POL)

//! @brief Format value for bitfield ECSPI_CONFIGREG_SS_POL.
#define BF_ECSPI_CONFIGREG_SS_POL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SS_POL) & BM_ECSPI_CONFIGREG_SS_POL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SS_POL field to a new value.
#define BW_ECSPI_CONFIGREG_SS_POL(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SS_POL) | BF_ECSPI_CONFIGREG_SS_POL(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field DATA_CTL[19:16] (RW)
 *
 * DATA CTL. This field controls inactive state of the data line for each SPI channel. DATA CTL[3]
 * is for SPI channel 3. DATA CTL[2] is for SPI channel 2. DATA CTL[1] is for SPI channel 1. DATA
 * CTL[0] is for SPI channel 0.
 *
 * Values:
 * - 0 - Stay high.
 * - 1 - Stay low.
 */
//@{
#define BP_ECSPI_CONFIGREG_DATA_CTL      (16)      //!< Bit position for ECSPI_CONFIGREG_DATA_CTL.
#define BM_ECSPI_CONFIGREG_DATA_CTL      (0x000f0000)  //!< Bit mask for ECSPI_CONFIGREG_DATA_CTL.

//! @brief Get value of ECSPI_CONFIGREG_DATA_CTL from a register value.
#define BG_ECSPI_CONFIGREG_DATA_CTL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_DATA_CTL) >> BP_ECSPI_CONFIGREG_DATA_CTL)

//! @brief Format value for bitfield ECSPI_CONFIGREG_DATA_CTL.
#define BF_ECSPI_CONFIGREG_DATA_CTL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_DATA_CTL) & BM_ECSPI_CONFIGREG_DATA_CTL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the DATA_CTL field to a new value.
#define BW_ECSPI_CONFIGREG_DATA_CTL(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_DATA_CTL) | BF_ECSPI_CONFIGREG_DATA_CTL(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field SCLK_CTL[23:20] (RW)
 *
 * SCLK CTL. This field controls the inactive state of SCLK for each SPI channel. SCLK CTL[3] is for
 * SPI channel 3. SCLK CTL[2] is for SPI channel 2. SCLK CTL[1] is for SPI channel 1. SCLK CTL[0] is
 * for SPI channel 0.
 *
 * Values:
 * - 0 - Stay low.
 * - 1 - Stay high.
 */
//@{
#define BP_ECSPI_CONFIGREG_SCLK_CTL      (20)      //!< Bit position for ECSPI_CONFIGREG_SCLK_CTL.
#define BM_ECSPI_CONFIGREG_SCLK_CTL      (0x00f00000)  //!< Bit mask for ECSPI_CONFIGREG_SCLK_CTL.

//! @brief Get value of ECSPI_CONFIGREG_SCLK_CTL from a register value.
#define BG_ECSPI_CONFIGREG_SCLK_CTL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_CTL) >> BP_ECSPI_CONFIGREG_SCLK_CTL)

//! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_CTL.
#define BF_ECSPI_CONFIGREG_SCLK_CTL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_CTL) & BM_ECSPI_CONFIGREG_SCLK_CTL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SCLK_CTL field to a new value.
#define BW_ECSPI_CONFIGREG_SCLK_CTL(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_CTL) | BF_ECSPI_CONFIGREG_SCLK_CTL(v)))
#endif
//@}

/*! @name Register ECSPI_CONFIGREG, field HT_LENGTH[28:24] (RW)
 *
 * HT LENGTH. This field defines the message length in HT Mode. Note, HT mode is not supported by
 * this product. The length in bits of one message is (HT LENGTH + 1).
 */
//@{
#define BP_ECSPI_CONFIGREG_HT_LENGTH      (24)      //!< Bit position for ECSPI_CONFIGREG_HT_LENGTH.
#define BM_ECSPI_CONFIGREG_HT_LENGTH      (0x1f000000)  //!< Bit mask for ECSPI_CONFIGREG_HT_LENGTH.

//! @brief Get value of ECSPI_CONFIGREG_HT_LENGTH from a register value.
#define BG_ECSPI_CONFIGREG_HT_LENGTH(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_HT_LENGTH) >> BP_ECSPI_CONFIGREG_HT_LENGTH)

//! @brief Format value for bitfield ECSPI_CONFIGREG_HT_LENGTH.
#define BF_ECSPI_CONFIGREG_HT_LENGTH(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_HT_LENGTH) & BM_ECSPI_CONFIGREG_HT_LENGTH)

#ifndef __LANGUAGE_ASM__
//! @brief Set the HT_LENGTH field to a new value.
#define BW_ECSPI_CONFIGREG_HT_LENGTH(x, v)   (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_HT_LENGTH) | BF_ECSPI_CONFIGREG_HT_LENGTH(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_INTREG - Interrupt Control Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_INTREG - Interrupt Control Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Interrupt Control Register (ECSPI_INTREG) enables the generation of interrupts to the host
 * processor. If the ECSPI is disabled, this register reads zero.
 */
typedef union _hw_ecspi_intreg
{
    reg32_t U;
    struct _hw_ecspi_intreg_bitfields
    {
        unsigned TEEN : 1; //!< [0] TXFIFO Empty Interrupt enable.
        unsigned TDREN : 1; //!< [1] TXFIFO Data Request Interrupt enable.
        unsigned TFEN : 1; //!< [2] TXFIFO Full Interrupt enable.
        unsigned RREN : 1; //!< [3] RXFIFO Ready Interrupt enable.
        unsigned RDREN : 1; //!< [4] RXFIFO Data Request Interrupt enable.
        unsigned RFEN : 1; //!< [5] RXFIFO Full Interrupt enable.
        unsigned ROEN : 1; //!< [6] RXFIFO Overflow Interrupt enable.
        unsigned TCEN : 1; //!< [7] Transfer Completed Interrupt enable.
        unsigned RESERVED0 : 24; //!< [31:8] Reserved
    } B;
} hw_ecspi_intreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_INTREG register
 */
//@{
#define HW_ECSPI_INTREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x10)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_INTREG(x)           (*(volatile hw_ecspi_intreg_t *) HW_ECSPI_INTREG_ADDR(x))
#define HW_ECSPI_INTREG_RD(x)        (HW_ECSPI_INTREG(x).U)
#define HW_ECSPI_INTREG_WR(x, v)     (HW_ECSPI_INTREG(x).U = (v))
#define HW_ECSPI_INTREG_SET(x, v)    (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) |  (v)))
#define HW_ECSPI_INTREG_CLR(x, v)    (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) & ~(v)))
#define HW_ECSPI_INTREG_TOG(x, v)    (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_INTREG bitfields
 */

/*! @name Register ECSPI_INTREG, field TEEN[0] (RW)
 *
 * TXFIFO Empty Interrupt enable. This bit enables the TXFIFO Empty Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_TEEN      (0)      //!< Bit position for ECSPI_INTREG_TEEN.
#define BM_ECSPI_INTREG_TEEN      (0x00000001)  //!< Bit mask for ECSPI_INTREG_TEEN.

//! @brief Get value of ECSPI_INTREG_TEEN from a register value.
#define BG_ECSPI_INTREG_TEEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TEEN) >> BP_ECSPI_INTREG_TEEN)

//! @brief Format value for bitfield ECSPI_INTREG_TEEN.
#define BF_ECSPI_INTREG_TEEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TEEN) & BM_ECSPI_INTREG_TEEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TEEN field to a new value.
#define BW_ECSPI_INTREG_TEEN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TEEN) | BF_ECSPI_INTREG_TEEN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field TDREN[1] (RW)
 *
 * TXFIFO Data Request Interrupt enable. This bit enables the TXFIFO Data Request Interrupt when the
 * number of data entries in the TXFIFO is less than or equal to TX_THRESHOLD.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_TDREN      (1)      //!< Bit position for ECSPI_INTREG_TDREN.
#define BM_ECSPI_INTREG_TDREN      (0x00000002)  //!< Bit mask for ECSPI_INTREG_TDREN.

//! @brief Get value of ECSPI_INTREG_TDREN from a register value.
#define BG_ECSPI_INTREG_TDREN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TDREN) >> BP_ECSPI_INTREG_TDREN)

//! @brief Format value for bitfield ECSPI_INTREG_TDREN.
#define BF_ECSPI_INTREG_TDREN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TDREN) & BM_ECSPI_INTREG_TDREN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TDREN field to a new value.
#define BW_ECSPI_INTREG_TDREN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TDREN) | BF_ECSPI_INTREG_TDREN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field TFEN[2] (RW)
 *
 * TXFIFO Full Interrupt enable. This bit enables the TXFIFO Full Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_TFEN      (2)      //!< Bit position for ECSPI_INTREG_TFEN.
#define BM_ECSPI_INTREG_TFEN      (0x00000004)  //!< Bit mask for ECSPI_INTREG_TFEN.

//! @brief Get value of ECSPI_INTREG_TFEN from a register value.
#define BG_ECSPI_INTREG_TFEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TFEN) >> BP_ECSPI_INTREG_TFEN)

//! @brief Format value for bitfield ECSPI_INTREG_TFEN.
#define BF_ECSPI_INTREG_TFEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TFEN) & BM_ECSPI_INTREG_TFEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TFEN field to a new value.
#define BW_ECSPI_INTREG_TFEN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TFEN) | BF_ECSPI_INTREG_TFEN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field RREN[3] (RW)
 *
 * RXFIFO Ready Interrupt enable. This bit enables the RXFIFO Ready Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_RREN      (3)      //!< Bit position for ECSPI_INTREG_RREN.
#define BM_ECSPI_INTREG_RREN      (0x00000008)  //!< Bit mask for ECSPI_INTREG_RREN.

//! @brief Get value of ECSPI_INTREG_RREN from a register value.
#define BG_ECSPI_INTREG_RREN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RREN) >> BP_ECSPI_INTREG_RREN)

//! @brief Format value for bitfield ECSPI_INTREG_RREN.
#define BF_ECSPI_INTREG_RREN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RREN) & BM_ECSPI_INTREG_RREN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RREN field to a new value.
#define BW_ECSPI_INTREG_RREN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RREN) | BF_ECSPI_INTREG_RREN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field RDREN[4] (RW)
 *
 * RXFIFO Data Request Interrupt enable. This bit enables the RXFIFO Data Request Interrupt when the
 * number of data entries in the RXFIFO is greater than RX_THRESHOLD.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_RDREN      (4)      //!< Bit position for ECSPI_INTREG_RDREN.
#define BM_ECSPI_INTREG_RDREN      (0x00000010)  //!< Bit mask for ECSPI_INTREG_RDREN.

//! @brief Get value of ECSPI_INTREG_RDREN from a register value.
#define BG_ECSPI_INTREG_RDREN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RDREN) >> BP_ECSPI_INTREG_RDREN)

//! @brief Format value for bitfield ECSPI_INTREG_RDREN.
#define BF_ECSPI_INTREG_RDREN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RDREN) & BM_ECSPI_INTREG_RDREN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RDREN field to a new value.
#define BW_ECSPI_INTREG_RDREN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RDREN) | BF_ECSPI_INTREG_RDREN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field RFEN[5] (RW)
 *
 * RXFIFO Full Interrupt enable. This bit enables the RXFIFO Full Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_RFEN      (5)      //!< Bit position for ECSPI_INTREG_RFEN.
#define BM_ECSPI_INTREG_RFEN      (0x00000020)  //!< Bit mask for ECSPI_INTREG_RFEN.

//! @brief Get value of ECSPI_INTREG_RFEN from a register value.
#define BG_ECSPI_INTREG_RFEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RFEN) >> BP_ECSPI_INTREG_RFEN)

//! @brief Format value for bitfield ECSPI_INTREG_RFEN.
#define BF_ECSPI_INTREG_RFEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RFEN) & BM_ECSPI_INTREG_RFEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RFEN field to a new value.
#define BW_ECSPI_INTREG_RFEN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RFEN) | BF_ECSPI_INTREG_RFEN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field ROEN[6] (RW)
 *
 * RXFIFO Overflow Interrupt enable. This bit enables the RXFIFO Overflow Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_ROEN      (6)      //!< Bit position for ECSPI_INTREG_ROEN.
#define BM_ECSPI_INTREG_ROEN      (0x00000040)  //!< Bit mask for ECSPI_INTREG_ROEN.

//! @brief Get value of ECSPI_INTREG_ROEN from a register value.
#define BG_ECSPI_INTREG_ROEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_ROEN) >> BP_ECSPI_INTREG_ROEN)

//! @brief Format value for bitfield ECSPI_INTREG_ROEN.
#define BF_ECSPI_INTREG_ROEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_ROEN) & BM_ECSPI_INTREG_ROEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the ROEN field to a new value.
#define BW_ECSPI_INTREG_ROEN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_ROEN) | BF_ECSPI_INTREG_ROEN(v)))
#endif
//@}

/*! @name Register ECSPI_INTREG, field TCEN[7] (RW)
 *
 * Transfer Completed Interrupt enable. This bit enables the Transfer Completed Interrupt.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_INTREG_TCEN      (7)      //!< Bit position for ECSPI_INTREG_TCEN.
#define BM_ECSPI_INTREG_TCEN      (0x00000080)  //!< Bit mask for ECSPI_INTREG_TCEN.

//! @brief Get value of ECSPI_INTREG_TCEN from a register value.
#define BG_ECSPI_INTREG_TCEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TCEN) >> BP_ECSPI_INTREG_TCEN)

//! @brief Format value for bitfield ECSPI_INTREG_TCEN.
#define BF_ECSPI_INTREG_TCEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TCEN) & BM_ECSPI_INTREG_TCEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TCEN field to a new value.
#define BW_ECSPI_INTREG_TCEN(x, v)   (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TCEN) | BF_ECSPI_INTREG_TCEN(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_DMAREG - DMA Control Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_DMAREG - DMA Control Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Direct Memory Access Control Register (ECSPI_DMAREG) provides software a way to use an on-
 * chip DMA controller for ECSPI data. Internal DMA request signals enable direct data transfers
 * between the ECSPI FIFOs and system memory. The ECSPI sends out DMA requests when the appropriate
 * FIFO conditions are matched. If the ECSPI is disabled, this register is read as 0.
 */
typedef union _hw_ecspi_dmareg
{
    reg32_t U;
    struct _hw_ecspi_dmareg_bitfields
    {
        unsigned TX_THRESHOLD : 6; //!< [5:0] TX THRESHOLD.
        unsigned RESERVED0 : 1; //!< [6] Reserved
        unsigned TEDEN : 1; //!< [7] TXFIFO Empty DMA Request Enable.
        unsigned RESERVED1 : 8; //!< [15:8] Reserved
        unsigned RX_THRESHOLD : 6; //!< [21:16] RX THRESHOLD.
        unsigned RESERVED2 : 1; //!< [22] Reserved
        unsigned RXDEN : 1; //!< [23] RXFIFO DMA Request Enable.
        unsigned RX_DMA_LENGTH : 6; //!< [29:24] RX DMA LENGTH.
        unsigned RESERVED3 : 1; //!< [30] Reserved
        unsigned RXTDEN : 1; //!< [31] RXFIFO TAIL DMA Request Enable.
    } B;
} hw_ecspi_dmareg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_DMAREG register
 */
//@{
#define HW_ECSPI_DMAREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x14)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_DMAREG(x)           (*(volatile hw_ecspi_dmareg_t *) HW_ECSPI_DMAREG_ADDR(x))
#define HW_ECSPI_DMAREG_RD(x)        (HW_ECSPI_DMAREG(x).U)
#define HW_ECSPI_DMAREG_WR(x, v)     (HW_ECSPI_DMAREG(x).U = (v))
#define HW_ECSPI_DMAREG_SET(x, v)    (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) |  (v)))
#define HW_ECSPI_DMAREG_CLR(x, v)    (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) & ~(v)))
#define HW_ECSPI_DMAREG_TOG(x, v)    (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_DMAREG bitfields
 */

/*! @name Register ECSPI_DMAREG, field TX_THRESHOLD[5:0] (RW)
 *
 * TX THRESHOLD. This field defines the FIFO threshold that triggers a TX DMA/INT request. A TX
 * DMA/INT request is issued when the number of data entries in the TXFIFO is greater than
 * TX_THRESHOLD.
 */
//@{
#define BP_ECSPI_DMAREG_TX_THRESHOLD      (0)      //!< Bit position for ECSPI_DMAREG_TX_THRESHOLD.
#define BM_ECSPI_DMAREG_TX_THRESHOLD      (0x0000003f)  //!< Bit mask for ECSPI_DMAREG_TX_THRESHOLD.

//! @brief Get value of ECSPI_DMAREG_TX_THRESHOLD from a register value.
#define BG_ECSPI_DMAREG_TX_THRESHOLD(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_TX_THRESHOLD) >> BP_ECSPI_DMAREG_TX_THRESHOLD)

//! @brief Format value for bitfield ECSPI_DMAREG_TX_THRESHOLD.
#define BF_ECSPI_DMAREG_TX_THRESHOLD(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_TX_THRESHOLD) & BM_ECSPI_DMAREG_TX_THRESHOLD)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TX_THRESHOLD field to a new value.
#define BW_ECSPI_DMAREG_TX_THRESHOLD(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_TX_THRESHOLD) | BF_ECSPI_DMAREG_TX_THRESHOLD(v)))
#endif
//@}

/*! @name Register ECSPI_DMAREG, field TEDEN[7] (RW)
 *
 * TXFIFO Empty DMA Request Enable. This bit enables/disables the TXFIFO Empty DMA Request.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_DMAREG_TEDEN      (7)      //!< Bit position for ECSPI_DMAREG_TEDEN.
#define BM_ECSPI_DMAREG_TEDEN      (0x00000080)  //!< Bit mask for ECSPI_DMAREG_TEDEN.

//! @brief Get value of ECSPI_DMAREG_TEDEN from a register value.
#define BG_ECSPI_DMAREG_TEDEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_TEDEN) >> BP_ECSPI_DMAREG_TEDEN)

//! @brief Format value for bitfield ECSPI_DMAREG_TEDEN.
#define BF_ECSPI_DMAREG_TEDEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_TEDEN) & BM_ECSPI_DMAREG_TEDEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TEDEN field to a new value.
#define BW_ECSPI_DMAREG_TEDEN(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_TEDEN) | BF_ECSPI_DMAREG_TEDEN(v)))
#endif
//@}

/*! @name Register ECSPI_DMAREG, field RX_THRESHOLD[21:16] (RW)
 *
 * RX THRESHOLD. This field defines the FIFO threshold that triggers a RX DMA/INT request. A RX
 * DMA/INT request is issued when the number of data entries in the RXFIFO is greater than
 * RX_THRESHOLD.
 */
//@{
#define BP_ECSPI_DMAREG_RX_THRESHOLD      (16)      //!< Bit position for ECSPI_DMAREG_RX_THRESHOLD.
#define BM_ECSPI_DMAREG_RX_THRESHOLD      (0x003f0000)  //!< Bit mask for ECSPI_DMAREG_RX_THRESHOLD.

//! @brief Get value of ECSPI_DMAREG_RX_THRESHOLD from a register value.
#define BG_ECSPI_DMAREG_RX_THRESHOLD(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RX_THRESHOLD) >> BP_ECSPI_DMAREG_RX_THRESHOLD)

//! @brief Format value for bitfield ECSPI_DMAREG_RX_THRESHOLD.
#define BF_ECSPI_DMAREG_RX_THRESHOLD(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RX_THRESHOLD) & BM_ECSPI_DMAREG_RX_THRESHOLD)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RX_THRESHOLD field to a new value.
#define BW_ECSPI_DMAREG_RX_THRESHOLD(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RX_THRESHOLD) | BF_ECSPI_DMAREG_RX_THRESHOLD(v)))
#endif
//@}

/*! @name Register ECSPI_DMAREG, field RXDEN[23] (RW)
 *
 * RXFIFO DMA Request Enable. This bit enables/disables the RXFIFO DMA Request.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_DMAREG_RXDEN      (23)      //!< Bit position for ECSPI_DMAREG_RXDEN.
#define BM_ECSPI_DMAREG_RXDEN      (0x00800000)  //!< Bit mask for ECSPI_DMAREG_RXDEN.

//! @brief Get value of ECSPI_DMAREG_RXDEN from a register value.
#define BG_ECSPI_DMAREG_RXDEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RXDEN) >> BP_ECSPI_DMAREG_RXDEN)

//! @brief Format value for bitfield ECSPI_DMAREG_RXDEN.
#define BF_ECSPI_DMAREG_RXDEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RXDEN) & BM_ECSPI_DMAREG_RXDEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RXDEN field to a new value.
#define BW_ECSPI_DMAREG_RXDEN(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RXDEN) | BF_ECSPI_DMAREG_RXDEN(v)))
#endif
//@}

/*! @name Register ECSPI_DMAREG, field RX_DMA_LENGTH[29:24] (RW)
 *
 * RX DMA LENGTH. This field defines the burst length of a DMA operation. Applies only when RXTDEN
 * is set.
 */
//@{
#define BP_ECSPI_DMAREG_RX_DMA_LENGTH      (24)      //!< Bit position for ECSPI_DMAREG_RX_DMA_LENGTH.
#define BM_ECSPI_DMAREG_RX_DMA_LENGTH      (0x3f000000)  //!< Bit mask for ECSPI_DMAREG_RX_DMA_LENGTH.

//! @brief Get value of ECSPI_DMAREG_RX_DMA_LENGTH from a register value.
#define BG_ECSPI_DMAREG_RX_DMA_LENGTH(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RX_DMA_LENGTH) >> BP_ECSPI_DMAREG_RX_DMA_LENGTH)

//! @brief Format value for bitfield ECSPI_DMAREG_RX_DMA_LENGTH.
#define BF_ECSPI_DMAREG_RX_DMA_LENGTH(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RX_DMA_LENGTH) & BM_ECSPI_DMAREG_RX_DMA_LENGTH)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RX_DMA_LENGTH field to a new value.
#define BW_ECSPI_DMAREG_RX_DMA_LENGTH(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RX_DMA_LENGTH) | BF_ECSPI_DMAREG_RX_DMA_LENGTH(v)))
#endif
//@}

/*! @name Register ECSPI_DMAREG, field RXTDEN[31] (RW)
 *
 * RXFIFO TAIL DMA Request Enable. This bit enables an internal counter that is increased at each
 * read of the RXFIFO. This counter is cleared automatically when it reaches RX DMA LENGTH. If the
 * number of words remaining in the RXFIFO is greater than or equal to RX DMA LENGTH, a DMA request
 * is generated even if it is less than or equal to RX_THRESHOLD.
 *
 * Values:
 * - 0 - Disable
 * - 1 - Enable
 */
//@{
#define BP_ECSPI_DMAREG_RXTDEN      (31)      //!< Bit position for ECSPI_DMAREG_RXTDEN.
#define BM_ECSPI_DMAREG_RXTDEN      (0x80000000)  //!< Bit mask for ECSPI_DMAREG_RXTDEN.

//! @brief Get value of ECSPI_DMAREG_RXTDEN from a register value.
#define BG_ECSPI_DMAREG_RXTDEN(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RXTDEN) >> BP_ECSPI_DMAREG_RXTDEN)

//! @brief Format value for bitfield ECSPI_DMAREG_RXTDEN.
#define BF_ECSPI_DMAREG_RXTDEN(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RXTDEN) & BM_ECSPI_DMAREG_RXTDEN)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RXTDEN field to a new value.
#define BW_ECSPI_DMAREG_RXTDEN(x, v)   (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RXTDEN) | BF_ECSPI_DMAREG_RXTDEN(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_STATREG - Status Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_STATREG - Status Register (RW)
 *
 * Reset value: 0x00000003
 *
 * The ECSPI Status Register (ECSPI_STATREG) reflects the status of the ECSPI's operating condition.
 * If the ECSPI is disabled, this register reads 0x0000_0003.
 */
typedef union _hw_ecspi_statreg
{
    reg32_t U;
    struct _hw_ecspi_statreg_bitfields
    {
        unsigned TE : 1; //!< [0] TXFIFO Empty.
        unsigned TDR : 1; //!< [1] TXFIFO Data Request.
        unsigned TF : 1; //!< [2] TXFIFO Full.
        unsigned RR : 1; //!< [3] RXFIFO Ready.
        unsigned RDR : 1; //!< [4] RXFIFO Data Request.
        unsigned RF : 1; //!< [5] RXFIFO Full.
        unsigned RO : 1; //!< [6] RXFIFO Overflow.
        unsigned TC : 1; //!< [7] Transfer Completed Status bit.
        unsigned RESERVED0 : 24; //!< [31:8] Reserved
    } B;
} hw_ecspi_statreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_STATREG register
 */
//@{
#define HW_ECSPI_STATREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x18)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_STATREG(x)           (*(volatile hw_ecspi_statreg_t *) HW_ECSPI_STATREG_ADDR(x))
#define HW_ECSPI_STATREG_RD(x)        (HW_ECSPI_STATREG(x).U)
#define HW_ECSPI_STATREG_WR(x, v)     (HW_ECSPI_STATREG(x).U = (v))
#define HW_ECSPI_STATREG_SET(x, v)    (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) |  (v)))
#define HW_ECSPI_STATREG_CLR(x, v)    (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) & ~(v)))
#define HW_ECSPI_STATREG_TOG(x, v)    (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_STATREG bitfields
 */

/*! @name Register ECSPI_STATREG, field TE[0] (RO)
 *
 * TXFIFO Empty. This bit is set if the TXFIFO is empty.
 *
 * Values:
 * - 0 - TXFIFO contains one or more words.
 * - 1 - TXFIFO is empty.
 */
//@{
#define BP_ECSPI_STATREG_TE      (0)      //!< Bit position for ECSPI_STATREG_TE.
#define BM_ECSPI_STATREG_TE      (0x00000001)  //!< Bit mask for ECSPI_STATREG_TE.

//! @brief Get value of ECSPI_STATREG_TE from a register value.
#define BG_ECSPI_STATREG_TE(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TE) >> BP_ECSPI_STATREG_TE)
//@}

/*! @name Register ECSPI_STATREG, field TDR[1] (RO)
 *
 * TXFIFO Data Request.
 *
 * Values:
 * - 0 - Number of empty slots in TXFIFO is greater than TX_THRESHOLD.
 * - 1 - Number of empty slots in TXFIFO is not greater than TX_THRESHOLD.
 */
//@{
#define BP_ECSPI_STATREG_TDR      (1)      //!< Bit position for ECSPI_STATREG_TDR.
#define BM_ECSPI_STATREG_TDR      (0x00000002)  //!< Bit mask for ECSPI_STATREG_TDR.

//! @brief Get value of ECSPI_STATREG_TDR from a register value.
#define BG_ECSPI_STATREG_TDR(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TDR) >> BP_ECSPI_STATREG_TDR)
//@}

/*! @name Register ECSPI_STATREG, field TF[2] (RO)
 *
 * TXFIFO Full. This bit is set when if the TXFIFO is full.
 *
 * Values:
 * - 0 - TXFIFO is not Full.
 * - 1 - TXFIFO is Full.
 */
//@{
#define BP_ECSPI_STATREG_TF      (2)      //!< Bit position for ECSPI_STATREG_TF.
#define BM_ECSPI_STATREG_TF      (0x00000004)  //!< Bit mask for ECSPI_STATREG_TF.

//! @brief Get value of ECSPI_STATREG_TF from a register value.
#define BG_ECSPI_STATREG_TF(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TF) >> BP_ECSPI_STATREG_TF)
//@}

/*! @name Register ECSPI_STATREG, field RR[3] (RO)
 *
 * RXFIFO Ready. This bit is set when one or more words are stored in the RXFIFO.
 *
 * Values:
 * - 0 - No valid data in RXFIFO.
 * - 1 - More than 1 word in RXFIFO.
 */
//@{
#define BP_ECSPI_STATREG_RR      (3)      //!< Bit position for ECSPI_STATREG_RR.
#define BM_ECSPI_STATREG_RR      (0x00000008)  //!< Bit mask for ECSPI_STATREG_RR.

//! @brief Get value of ECSPI_STATREG_RR from a register value.
#define BG_ECSPI_STATREG_RR(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RR) >> BP_ECSPI_STATREG_RR)
//@}

/*! @name Register ECSPI_STATREG, field RDR[4] (RO)
 *
 * RXFIFO Data Request.
 *
 * Values:
 * - 0 - When RXTDE is set - Number of data entries in the RXFIFO is not greater than RX_THRESHOLD.
 * - 0 - When RXTDE is clear - Number of data entries in the RXFIFO is not greater than RX_THRESHOLD.
 * - 1 - When RXTDE is set - Number of data entries in the RXFIFO is greater than RX_THRESHOLD or a DMA TAIL
 *     DMA condition exists.
 * - 1 - When RXTDE is clear - Number of data entries in the RXFIFO is greater than RX_THRESHOLD.
 */
//@{
#define BP_ECSPI_STATREG_RDR      (4)      //!< Bit position for ECSPI_STATREG_RDR.
#define BM_ECSPI_STATREG_RDR      (0x00000010)  //!< Bit mask for ECSPI_STATREG_RDR.

//! @brief Get value of ECSPI_STATREG_RDR from a register value.
#define BG_ECSPI_STATREG_RDR(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RDR) >> BP_ECSPI_STATREG_RDR)
//@}

/*! @name Register ECSPI_STATREG, field RF[5] (RO)
 *
 * RXFIFO Full. This bit is set when the RXFIFO is full.
 *
 * Values:
 * - 0 - Not Full.
 * - 1 - Full.
 */
//@{
#define BP_ECSPI_STATREG_RF      (5)      //!< Bit position for ECSPI_STATREG_RF.
#define BM_ECSPI_STATREG_RF      (0x00000020)  //!< Bit mask for ECSPI_STATREG_RF.

//! @brief Get value of ECSPI_STATREG_RF from a register value.
#define BG_ECSPI_STATREG_RF(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RF) >> BP_ECSPI_STATREG_RF)
//@}

/*! @name Register ECSPI_STATREG, field RO[6] (W1C)
 *
 * RXFIFO Overflow. When set, this bit indicates that RXFIFO has overflowed. Writing 1 to this bit
 * clears it.
 *
 * Values:
 * - 0 - RXFIFO has no overflow.
 * - 1 - RXFIFO has overflowed.
 */
//@{
#define BP_ECSPI_STATREG_RO      (6)      //!< Bit position for ECSPI_STATREG_RO.
#define BM_ECSPI_STATREG_RO      (0x00000040)  //!< Bit mask for ECSPI_STATREG_RO.

//! @brief Get value of ECSPI_STATREG_RO from a register value.
#define BG_ECSPI_STATREG_RO(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RO) >> BP_ECSPI_STATREG_RO)

//! @brief Format value for bitfield ECSPI_STATREG_RO.
#define BF_ECSPI_STATREG_RO(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_STATREG_RO) & BM_ECSPI_STATREG_RO)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RO field to a new value.
#define BW_ECSPI_STATREG_RO(x, v)   (HW_ECSPI_STATREG_WR(x, (HW_ECSPI_STATREG_RD(x) & ~BM_ECSPI_STATREG_RO) | BF_ECSPI_STATREG_RO(v)))
#endif
//@}

/*! @name Register ECSPI_STATREG, field TC[7] (W1C)
 *
 * Transfer Completed Status bit. Writing 1 to this bit clears it.
 *
 * Values:
 * - 0 - Transfer in progress.
 * - 1 - Transfer completed.
 */
//@{
#define BP_ECSPI_STATREG_TC      (7)      //!< Bit position for ECSPI_STATREG_TC.
#define BM_ECSPI_STATREG_TC      (0x00000080)  //!< Bit mask for ECSPI_STATREG_TC.

//! @brief Get value of ECSPI_STATREG_TC from a register value.
#define BG_ECSPI_STATREG_TC(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TC) >> BP_ECSPI_STATREG_TC)

//! @brief Format value for bitfield ECSPI_STATREG_TC.
#define BF_ECSPI_STATREG_TC(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_STATREG_TC) & BM_ECSPI_STATREG_TC)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TC field to a new value.
#define BW_ECSPI_STATREG_TC(x, v)   (HW_ECSPI_STATREG_WR(x, (HW_ECSPI_STATREG_RD(x) & ~BM_ECSPI_STATREG_TC) | BF_ECSPI_STATREG_TC(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_PERIODREG - Sample Period Control Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_PERIODREG - Sample Period Control Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Sample Period Control Register (ECSPI_PERIODREG) provides software a way to insert delays
 * (wait states) between consecutive SPI transfers. Control bits in this register select the clock
 * source for the sample period counter and the delay count indicating the number of wait states to
 * be inserted between data transfers. The delay counts apply only when the current channel is
 * operating in Master mode (ECSPI_CONREG[CHANNEL MODE] = 1).ECSPI_PERIODREG also contains the CSD
 * CTRL field used to insert a delay between the Chip Select's active edge and the first SPI Clock
 * edge.
 */
typedef union _hw_ecspi_periodreg
{
    reg32_t U;
    struct _hw_ecspi_periodreg_bitfields
    {
        unsigned SAMPLE_PERIOD : 15; //!< [14:0] Sample Period Control.
        unsigned CSRC : 1; //!< [15] Clock Source Control.
        unsigned CSD_CTL : 6; //!< [21:16] Chip Select Delay Control bits.
        unsigned RESERVED0 : 10; //!< [31:22] Reserved
    } B;
} hw_ecspi_periodreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_PERIODREG register
 */
//@{
#define HW_ECSPI_PERIODREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x1c)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_PERIODREG(x)           (*(volatile hw_ecspi_periodreg_t *) HW_ECSPI_PERIODREG_ADDR(x))
#define HW_ECSPI_PERIODREG_RD(x)        (HW_ECSPI_PERIODREG(x).U)
#define HW_ECSPI_PERIODREG_WR(x, v)     (HW_ECSPI_PERIODREG(x).U = (v))
#define HW_ECSPI_PERIODREG_SET(x, v)    (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) |  (v)))
#define HW_ECSPI_PERIODREG_CLR(x, v)    (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) & ~(v)))
#define HW_ECSPI_PERIODREG_TOG(x, v)    (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_PERIODREG bitfields
 */

/*! @name Register ECSPI_PERIODREG, field SAMPLE_PERIOD[14:0] (RW)
 *
 * Sample Period Control. These bits control the number of wait states to be inserted in data
 * transfers. During the idle clocks, the state of the SS output will operate according to the
 * SS_CTL control field in the ECSPI_CONREG register.
 *
 * Values:
 * - 0x0000 - 0 wait states inserted
 * - ... - ...
 * - 0x0001 - 1 wait state inserted
 * - 0x7FFE - 32766 wait states inserted
 * - 0x7FFF - 32767 wait states inserted
 */
//@{
#define BP_ECSPI_PERIODREG_SAMPLE_PERIOD      (0)      //!< Bit position for ECSPI_PERIODREG_SAMPLE_PERIOD.
#define BM_ECSPI_PERIODREG_SAMPLE_PERIOD      (0x00007fff)  //!< Bit mask for ECSPI_PERIODREG_SAMPLE_PERIOD.

//! @brief Get value of ECSPI_PERIODREG_SAMPLE_PERIOD from a register value.
#define BG_ECSPI_PERIODREG_SAMPLE_PERIOD(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_SAMPLE_PERIOD) >> BP_ECSPI_PERIODREG_SAMPLE_PERIOD)

//! @brief Format value for bitfield ECSPI_PERIODREG_SAMPLE_PERIOD.
#define BF_ECSPI_PERIODREG_SAMPLE_PERIOD(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_SAMPLE_PERIOD) & BM_ECSPI_PERIODREG_SAMPLE_PERIOD)

#ifndef __LANGUAGE_ASM__
//! @brief Set the SAMPLE_PERIOD field to a new value.
#define BW_ECSPI_PERIODREG_SAMPLE_PERIOD(x, v)   (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_SAMPLE_PERIOD) | BF_ECSPI_PERIODREG_SAMPLE_PERIOD(v)))
#endif
//@}

/*! @name Register ECSPI_PERIODREG, field CSRC[15] (RW)
 *
 * Clock Source Control. This bit selects the clock source for the sample period counter.
 *
 * Values:
 * - 0 - SPI Clock (SCLK)
 * - 1 - Low-Frequency Reference Clock (32.768 KHz)
 */
//@{
#define BP_ECSPI_PERIODREG_CSRC      (15)      //!< Bit position for ECSPI_PERIODREG_CSRC.
#define BM_ECSPI_PERIODREG_CSRC      (0x00008000)  //!< Bit mask for ECSPI_PERIODREG_CSRC.

//! @brief Get value of ECSPI_PERIODREG_CSRC from a register value.
#define BG_ECSPI_PERIODREG_CSRC(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_CSRC) >> BP_ECSPI_PERIODREG_CSRC)

//! @brief Format value for bitfield ECSPI_PERIODREG_CSRC.
#define BF_ECSPI_PERIODREG_CSRC(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_CSRC) & BM_ECSPI_PERIODREG_CSRC)

#ifndef __LANGUAGE_ASM__
//! @brief Set the CSRC field to a new value.
#define BW_ECSPI_PERIODREG_CSRC(x, v)   (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_CSRC) | BF_ECSPI_PERIODREG_CSRC(v)))
#endif
//@}

/*! @name Register ECSPI_PERIODREG, field CSD_CTL[21:16] (RW)
 *
 * Chip Select Delay Control bits. This field defines how many SPI clocks will be inserted between
 * the chip select's active edge and the first SPI clock edge. The range is from 0 to 63.
 */
//@{
#define BP_ECSPI_PERIODREG_CSD_CTL      (16)      //!< Bit position for ECSPI_PERIODREG_CSD_CTL.
#define BM_ECSPI_PERIODREG_CSD_CTL      (0x003f0000)  //!< Bit mask for ECSPI_PERIODREG_CSD_CTL.

//! @brief Get value of ECSPI_PERIODREG_CSD_CTL from a register value.
#define BG_ECSPI_PERIODREG_CSD_CTL(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_CSD_CTL) >> BP_ECSPI_PERIODREG_CSD_CTL)

//! @brief Format value for bitfield ECSPI_PERIODREG_CSD_CTL.
#define BF_ECSPI_PERIODREG_CSD_CTL(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_CSD_CTL) & BM_ECSPI_PERIODREG_CSD_CTL)

#ifndef __LANGUAGE_ASM__
//! @brief Set the CSD_CTL field to a new value.
#define BW_ECSPI_PERIODREG_CSD_CTL(x, v)   (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_CSD_CTL) | BF_ECSPI_PERIODREG_CSD_CTL(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_TESTREG - Test Control Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_TESTREG - Test Control Register (RW)
 *
 * Reset value: 0x00000000
 *
 * The Test Control Register (ECSPI_TESTREG) provides software a mechanism to internally connect the
 * receive and transmit devices of the ECSPI , and monitor the contents of the receive and transmit
 * FIFOs.
 */
typedef union _hw_ecspi_testreg
{
    reg32_t U;
    struct _hw_ecspi_testreg_bitfields
    {
        unsigned TXCNT : 7; //!< [6:0] TXFIFO Counter.
        unsigned RESERVED0 : 1; //!< [7] Reserved
        unsigned RXCNT : 7; //!< [14:8] RXFIFO Counter.
        unsigned RESERVED1 : 16; //!< [30:15] Reserved.
        unsigned LBC : 1; //!< [31] Loop Back Control.
    } B;
} hw_ecspi_testreg_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_TESTREG register
 */
//@{
#define HW_ECSPI_TESTREG_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x20)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_TESTREG(x)           (*(volatile hw_ecspi_testreg_t *) HW_ECSPI_TESTREG_ADDR(x))
#define HW_ECSPI_TESTREG_RD(x)        (HW_ECSPI_TESTREG(x).U)
#define HW_ECSPI_TESTREG_WR(x, v)     (HW_ECSPI_TESTREG(x).U = (v))
#define HW_ECSPI_TESTREG_SET(x, v)    (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) |  (v)))
#define HW_ECSPI_TESTREG_CLR(x, v)    (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) & ~(v)))
#define HW_ECSPI_TESTREG_TOG(x, v)    (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) ^  (v)))
#endif
//@}

/*
 * constants & macros for individual ECSPI_TESTREG bitfields
 */

/*! @name Register ECSPI_TESTREG, field TXCNT[6:0] (RW)
 *
 * TXFIFO Counter. This field indicates the number of words in the TXFIFO.
 */
//@{
#define BP_ECSPI_TESTREG_TXCNT      (0)      //!< Bit position for ECSPI_TESTREG_TXCNT.
#define BM_ECSPI_TESTREG_TXCNT      (0x0000007f)  //!< Bit mask for ECSPI_TESTREG_TXCNT.

//! @brief Get value of ECSPI_TESTREG_TXCNT from a register value.
#define BG_ECSPI_TESTREG_TXCNT(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_TXCNT) >> BP_ECSPI_TESTREG_TXCNT)

//! @brief Format value for bitfield ECSPI_TESTREG_TXCNT.
#define BF_ECSPI_TESTREG_TXCNT(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_TXCNT) & BM_ECSPI_TESTREG_TXCNT)

#ifndef __LANGUAGE_ASM__
//! @brief Set the TXCNT field to a new value.
#define BW_ECSPI_TESTREG_TXCNT(x, v)   (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_TXCNT) | BF_ECSPI_TESTREG_TXCNT(v)))
#endif
//@}

/*! @name Register ECSPI_TESTREG, field RXCNT[14:8] (RW)
 *
 * RXFIFO Counter. This field indicates the number of words in the RXFIFO.
 */
//@{
#define BP_ECSPI_TESTREG_RXCNT      (8)      //!< Bit position for ECSPI_TESTREG_RXCNT.
#define BM_ECSPI_TESTREG_RXCNT      (0x00007f00)  //!< Bit mask for ECSPI_TESTREG_RXCNT.

//! @brief Get value of ECSPI_TESTREG_RXCNT from a register value.
#define BG_ECSPI_TESTREG_RXCNT(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_RXCNT) >> BP_ECSPI_TESTREG_RXCNT)

//! @brief Format value for bitfield ECSPI_TESTREG_RXCNT.
#define BF_ECSPI_TESTREG_RXCNT(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_RXCNT) & BM_ECSPI_TESTREG_RXCNT)

#ifndef __LANGUAGE_ASM__
//! @brief Set the RXCNT field to a new value.
#define BW_ECSPI_TESTREG_RXCNT(x, v)   (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_RXCNT) | BF_ECSPI_TESTREG_RXCNT(v)))
#endif
//@}

/*! @name Register ECSPI_TESTREG, field LBC[31] (RW)
 *
 * Loop Back Control. This bit is used in Master mode only. When this bit is set, the ECSPI connects
 * the transmitter and receiver sections internally, and the data shifted out from the most-
 * significant bit of the shift register is looped back into the least-significant bit of the Shift
 * register. In this way, a self-test of the complete transmit/receive path can be made. The output
 * pins are not affected, and the input pins are ignored.
 *
 * Values:
 * - 0 - Not connected.
 * - 1 - Transmitter and receiver sections internally connected for Loopback.
 */
//@{
#define BP_ECSPI_TESTREG_LBC      (31)      //!< Bit position for ECSPI_TESTREG_LBC.
#define BM_ECSPI_TESTREG_LBC      (0x80000000)  //!< Bit mask for ECSPI_TESTREG_LBC.

//! @brief Get value of ECSPI_TESTREG_LBC from a register value.
#define BG_ECSPI_TESTREG_LBC(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_LBC) >> BP_ECSPI_TESTREG_LBC)

//! @brief Format value for bitfield ECSPI_TESTREG_LBC.
#define BF_ECSPI_TESTREG_LBC(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_LBC) & BM_ECSPI_TESTREG_LBC)

#ifndef __LANGUAGE_ASM__
//! @brief Set the LBC field to a new value.
#define BW_ECSPI_TESTREG_LBC(x, v)   (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_LBC) | BF_ECSPI_TESTREG_LBC(v)))
#endif
//@}

//-------------------------------------------------------------------------------------------
// HW_ECSPI_MSGDATA - Message Data Register
//-------------------------------------------------------------------------------------------

#ifndef __LANGUAGE_ASM__
/*!
 * @brief HW_ECSPI_MSGDATA - Message Data Register (WO)
 *
 * Reset value: 0x00000000
 *
 * The Message Data Register (ECSPI_MSGDATA) forms the top word of the 16 x 32 MSG Data FIFO. Only
 * word-size accesses are allowed for this register. Reads to this register return zero, and writes
 * to this register store data in the MSG Data FIFO.
 */
typedef union _hw_ecspi_msgdata
{
    reg32_t U;
    struct _hw_ecspi_msgdata_bitfields
    {
        unsigned ECSPI_MSGDATA : 32; //!< [31:0] ECSPI_MSGDATA holds the top word of MSG Data FIFO.
    } B;
} hw_ecspi_msgdata_t;
#endif

/*!
 * @name Constants and macros for entire ECSPI_MSGDATA register
 */
//@{
#define HW_ECSPI_MSGDATA_ADDR(x)      (REGS_ECSPI_BASE(x) + 0x40)

#ifndef __LANGUAGE_ASM__
#define HW_ECSPI_MSGDATA(x)           (*(volatile hw_ecspi_msgdata_t *) HW_ECSPI_MSGDATA_ADDR(x))
#define HW_ECSPI_MSGDATA_WR(x, v)     (HW_ECSPI_MSGDATA(x).U = (v))
#endif
//@}

/*
 * constants & macros for individual ECSPI_MSGDATA bitfields
 */

/*! @name Register ECSPI_MSGDATA, field ECSPI_MSGDATA[31:0] (WO)
 *
 * ECSPI_MSGDATA holds the top word of MSG Data FIFO. The MSG Data FIFO is advanced for each write
 * of this register. The data read is zero. The data written to this register is stored in the MSG
 * Data FIFO.
 */
//@{
#define BP_ECSPI_MSGDATA_ECSPI_MSGDATA      (0)      //!< Bit position for ECSPI_MSGDATA_ECSPI_MSGDATA.
#define BM_ECSPI_MSGDATA_ECSPI_MSGDATA      (0xffffffff)  //!< Bit mask for ECSPI_MSGDATA_ECSPI_MSGDATA.

//! @brief Get value of ECSPI_MSGDATA_ECSPI_MSGDATA from a register value.
#define BG_ECSPI_MSGDATA_ECSPI_MSGDATA(r)   ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_MSGDATA_ECSPI_MSGDATA) >> BP_ECSPI_MSGDATA_ECSPI_MSGDATA)

//! @brief Format value for bitfield ECSPI_MSGDATA_ECSPI_MSGDATA.
#define BF_ECSPI_MSGDATA_ECSPI_MSGDATA(v)   ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_MSGDATA_ECSPI_MSGDATA) & BM_ECSPI_MSGDATA_ECSPI_MSGDATA)
//@}

//-------------------------------------------------------------------------------------------
// hw_ecspi_t - module struct
//-------------------------------------------------------------------------------------------
/*!
 * @brief All ECSPI module registers.
 */
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_ecspi
{
    volatile hw_ecspi_rxdata_t RXDATA; //!< Receive Data Register
    volatile hw_ecspi_txdata_t TXDATA; //!< Transmit Data Register
    volatile hw_ecspi_conreg_t CONREG; //!< Control Register
    volatile hw_ecspi_configreg_t CONFIGREG; //!< Config Register
    volatile hw_ecspi_intreg_t INTREG; //!< Interrupt Control Register
    volatile hw_ecspi_dmareg_t DMAREG; //!< DMA Control Register
    volatile hw_ecspi_statreg_t STATREG; //!< Status Register
    volatile hw_ecspi_periodreg_t PERIODREG; //!< Sample Period Control Register
    volatile hw_ecspi_testreg_t TESTREG; //!< Test Control Register
    reg32_t _reserved0[7];
    volatile hw_ecspi_msgdata_t MSGDATA; //!< Message Data Register
} hw_ecspi_t;
#pragma pack()

//! @brief Macro to access all ECSPI registers.
//! @param x ECSPI instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//!     use the '&' operator, like <code>&HW_ECSPI(0)</code>.
#define HW_ECSPI(x)     (*(hw_ecspi_t *) REGS_ECSPI_BASE(x))
#endif

#endif // __HW_ECSPI_REGISTERS_H__
// v18/121106/1.2.2
// EOF