-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathusb.hpp
1449 lines (1211 loc) · 45.8 KB
/
usb.hpp
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
#pragma once
//=========================================================================//
/*! @file
@brief USB 2.0 FS Host/Function Module / USB2.0FS ホスト / ファンクションモジュール @n
USB[abcd] @n
RX111/RX113 @n
RX231 @n
RX261 @n
RX63T @n
RX66T/RX72T @n
RX64M/RX71M @n
RX651/RX65N
RX66N @n
RX671 @n
RX72N/RX72M
@author 平松邦仁 (hira@rvf-rc45.net)
@copyright Copyright (C) 2022, 2024 Kunihito Hiramatsu @n
Released under the MIT license @n
https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=========================================================================//
#include "common/device.hpp"
namespace device {
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
/*!
@brief USB core class
@param[in] base ベース・アドレス
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
template <uint32_t base>
struct usb_core_t {
//-----------------------------------------------------------------//
/*!
@brief システムコンフィギュレーションコントロールレジスタ(SYSCFG)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct syscfg_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t <io_, bitpos::B0> USBE;
bit_rw_t <io_, bitpos::B4> DPRPU;
bit_rw_t <io_, bitpos::B5> DRPD;
bit_rw_t <io_, bitpos::B6> DCFM;
bit_rw_t <io_, bitpos::B10> SCKE;
};
static inline syscfg_t<base + 0x00> SYSCFG;
//-----------------------------------------------------------------//
/*!
@brief システムコンフィギュレーションステータスレジスタ 0(SYSSTS0)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct syssts0_t : public ro16_t<ofs> {
typedef ro16_t<ofs> in_;
using in_::operator ();
bits_ro_t<in_, bitpos::B0, 2> LNST;
bit_ro_t <in_, bitpos::B2> IDMON;
bit_ro_t <in_, bitpos::B5> SOFEA;
bit_ro_t <in_, bitpos::B6> HTACT;
bits_ro_t<in_, bitpos::B14, 2> OVCMON;
};
static inline syssts0_t<base + 0x04> SYSSTS0;
//-----------------------------------------------------------------//
/*!
@brief デバイスステートコントロールレジスタ 0(DVSTCTR0)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dvstctr0_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 3> RHST;
bit_rw_t <io_, bitpos::B4> UACT;
bit_rw_t <io_, bitpos::B5> RESUME;
bit_rw_t <io_, bitpos::B6> USBRST;
bit_rw_t <io_, bitpos::B7> RWUPE;
bit_rw_t <io_, bitpos::B8> WKUP;
bit_rw_t <io_, bitpos::B9> VBUSEN;
bit_rw_t <io_, bitpos::B10> EXICEN;
bit_rw_t <io_, bitpos::B11> HNPBTOA;
};
static inline dvstctr0_t<base + 0x08> DVSTCTR0;
//-----------------------------------------------------------------//
/*!
@brief CFIFO ポートレジスタ(CFIFO)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
static inline rw16_t<base + 0x14> CFIFO; // MBW: 1
static inline rw8_t<base + 0x14> CFIFOL; // MBW: 0
//-----------------------------------------------------------------//
/*!
@brief D0FIFO ポートレジスタ(D0FIFO)
*/
//-----------------------------------------------------------------//
static inline rw16_t <base + 0x18> D0FIFO;
static inline rw8_t <base + 0x18> D0FIFOL;
//-----------------------------------------------------------------//
/*!
@brief D1FIFO ポートレジスタ(D1FIFO)
*/
//-----------------------------------------------------------------//
static inline rw16_t <base + 0x1C> D1FIFO;
static inline rw8_t <base + 0x1C> D1FIFOL;
//-----------------------------------------------------------------//
/*!
@brief CFIFO ポート選択レジスタ(CFIFOSEL)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct cfifosel_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 4> CURPIPE;
bit_rw_t <io_, bitpos::B5> ISEL;
bit_rw_t <io_, bitpos::B8> BIGEND;
bit_rw_t <io_, bitpos::B10> MBW;
bit_rw_t <io_, bitpos::B14> REW;
bit_rw_t <io_, bitpos::B15> RCNT;
};
static inline cfifosel_t<base + 0x20> CFIFOSEL;
//-----------------------------------------------------------------//
/*!
@brief CFIFO ポート選択レジスタ(D0FIFOSEL, D1FIFOSEL)
@param[in] ofs オフセット・アドレス
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dxfifosel_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 4> CURPIPE;
bit_rw_t <io_, bitpos::B8> BIGEND;
bit_rw_t <io_, bitpos::B10> MBW;
bit_rw_t <io_, bitpos::B12> DREQE;
bit_rw_t <io_, bitpos::B13> DCLRM;
bit_rw_t <io_, bitpos::B14> REW;
bit_rw_t <io_, bitpos::B15> RCNT;
};
static inline dxfifosel_t<base + 0x28> D0FIFOSEL;
static inline dxfifosel_t<base + 0x2C> D1FIFOSEL;
//-----------------------------------------------------------------//
/*!
@brief ポートコントロールレジスタ(CFIFOCTR, D0FIFOCTR, D1FIFOCTR)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct xfifoctr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 9> DTLN;
bit_rw_t <io_, bitpos::B13> FRDY;
bit_rw_t <io_, bitpos::B14> BCLR;
bit_rw_t <io_, bitpos::B15> BVAL;
};
static inline xfifoctr_t<base + 0x22> CFIFOCTR;
static inline xfifoctr_t<base + 0x2A> D0FIFOCTR;
static inline xfifoctr_t<base + 0x2E> D1FIFOCTR;
//-----------------------------------------------------------------//
/*!
@brief 割り込み許可レジスタ 0(INTENB0)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct intenb0_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B8> BRDYE;
bit_rw_t<io_, bitpos::B9> NRDYE;
bit_rw_t<io_, bitpos::B10> BEMPE;
bit_rw_t<io_, bitpos::B11> CTRE;
bit_rw_t<io_, bitpos::B12> DVSE;
bit_rw_t<io_, bitpos::B13> SOFE;
bit_rw_t<io_, bitpos::B14> RSME;
bit_rw_t<io_, bitpos::B15> VBSE;
};
static inline intenb0_t<base + 0x30> INTENB0;
//-----------------------------------------------------------------//
/*!
@brief 割り込み許可レジスタ 1(INTENB1)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct intenb1_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B4> SACKE;
bit_rw_t<io_, bitpos::B5> SIGNE;
bit_rw_t<io_, bitpos::B6> EOFERRE;
bit_rw_t<io_, bitpos::B11> ATTCHE;
bit_rw_t<io_, bitpos::B12> DTCHE;
bit_rw_t<io_, bitpos::B14> BCHGE;
bit_rw_t<io_, bitpos::B15> OVRCRE;
};
static inline intenb1_t<base + 0x32> INTENB1;
//-----------------------------------------------------------------//
/*!
@brief BRDY 割り込み許可レジスタ(BRDYENB)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct brdyenb_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0BRDYE;
bit_rw_t<io_, bitpos::B1> PIPE1BRDYE;
bit_rw_t<io_, bitpos::B2> PIPE2BRDYE;
bit_rw_t<io_, bitpos::B3> PIPE3BRDYE;
bit_rw_t<io_, bitpos::B4> PIPE4BRDYE;
bit_rw_t<io_, bitpos::B5> PIPE5BRDYE;
bit_rw_t<io_, bitpos::B6> PIPE6BRDYE;
bit_rw_t<io_, bitpos::B7> PIPE7BRDYE;
bit_rw_t<io_, bitpos::B8> PIPE8BRDYE;
bit_rw_t<io_, bitpos::B9> PIPE9BRDYE;
bits_rw_t<io_, bitpos::B0, 10> PIPEBRDYE;
};
static inline brdyenb_t<base + 0x36> BRDYENB;
//-----------------------------------------------------------------//
/*!
@brief NRDY 割り込み許可レジスタ(NRDYENB)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct nrdyenb_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0BNRDYE;
bit_rw_t<io_, bitpos::B1> PIPE1BNRDYE;
bit_rw_t<io_, bitpos::B2> PIPE2BNRDYE;
bit_rw_t<io_, bitpos::B3> PIPE3BNRDYE;
bit_rw_t<io_, bitpos::B4> PIPE4BNRDYE;
bit_rw_t<io_, bitpos::B5> PIPE5BNRDYE;
bit_rw_t<io_, bitpos::B6> PIPE6BNRDYE;
bit_rw_t<io_, bitpos::B7> PIPE7BNRDYE;
bit_rw_t<io_, bitpos::B8> PIPE8BNRDYE;
bit_rw_t<io_, bitpos::B9> PIPE9BNRDYE;
bits_rw_t<io_, bitpos::B0, 10> PIPEBNRDYE;
};
static inline nrdyenb_t<base + 0x38> NRDYENB;
//-----------------------------------------------------------------//
/*!
@brief BEMP 割り込み許可レジスタ(BEMPENB)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct bempenb_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0BEMPE;
bit_rw_t<io_, bitpos::B1> PIPE1BEMPE;
bit_rw_t<io_, bitpos::B2> PIPE2BEMPE;
bit_rw_t<io_, bitpos::B3> PIPE3BEMPE;
bit_rw_t<io_, bitpos::B4> PIPE4BEMPE;
bit_rw_t<io_, bitpos::B5> PIPE5BEMPE;
bit_rw_t<io_, bitpos::B6> PIPE6BEMPE;
bit_rw_t<io_, bitpos::B7> PIPE7BEMPE;
bit_rw_t<io_, bitpos::B8> PIPE8BEMPE;
bit_rw_t<io_, bitpos::B9> PIPE9BEMPE;
bits_rw_t<io_, bitpos::B0, 10> PIPEBEMPE;
};
static inline bempenb_t<base + 0x3A> BEMPENB;
//-----------------------------------------------------------------//
/*!
@brief 割り込みステータスレジスタ 0(INTSTS0)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct intsts0_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 3> CTSQ;
bit_rw_t <io_, bitpos::B3> VALID;
bits_rw_t<io_, bitpos::B4, 3> DVSQ;
bit_rw_t <io_, bitpos::B7> VBSTS;
bit_rw_t <io_, bitpos::B8> BRDY;
bit_rw_t <io_, bitpos::B9> NRDY;
bit_rw_t <io_, bitpos::B10> BEMP;
bit_rw_t <io_, bitpos::B11> CTRT;
bit_rw_t <io_, bitpos::B12> DVST;
bit_rw_t <io_, bitpos::B13> SOFR;
bit_rw_t <io_, bitpos::B14> RESM;
bit_rw_t <io_, bitpos::B15> VBINT;
};
static inline intsts0_t<base + 0x40> INTSTS0;
//-----------------------------------------------------------------//
/*!
@brief 割り込みステータスレジスタ 1(INTSTS1)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct intsts1_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t <io_, bitpos::B4> SACK;
bit_rw_t <io_, bitpos::B5> SIGN;
bit_rw_t <io_, bitpos::B6> EOFERR;
bit_rw_t <io_, bitpos::B11> ATTCH;
bit_rw_t <io_, bitpos::B12> DTCH;
bit_rw_t <io_, bitpos::B14> BCHG;
bit_rw_t <io_, bitpos::B15> OVRCR;
};
static inline intsts1_t<base + 0x42> INTSTS1;
//-----------------------------------------------------------------//
/*!
@brief BRDY 割り込みステータスレジスタ(BRDYSTS)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct brdysts_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0BRDY;
bit_rw_t<io_, bitpos::B1> PIPE1BRDY;
bit_rw_t<io_, bitpos::B2> PIPE2BRDY;
bit_rw_t<io_, bitpos::B3> PIPE3BRDY;
bit_rw_t<io_, bitpos::B4> PIPE4BRDY;
bit_rw_t<io_, bitpos::B5> PIPE5BRDY;
bit_rw_t<io_, bitpos::B6> PIPE6BRDY;
bit_rw_t<io_, bitpos::B7> PIPE7BRDY;
bit_rw_t<io_, bitpos::B8> PIPE8BRDY;
bit_rw_t<io_, bitpos::B9> PIPE9BRDY;
bits_rw_t<io_, bitpos::B0, 10> PIPEBRDY;
};
static inline brdysts_t<base + 0x46> BRDYSTS;
//-----------------------------------------------------------------//
/*!
@brief NRDY 割り込みステータスレジスタ(NRDYSTS)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct nrdysts_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0NRDY;
bit_rw_t<io_, bitpos::B1> PIPE1NRDY;
bit_rw_t<io_, bitpos::B2> PIPE2NRDY;
bit_rw_t<io_, bitpos::B3> PIPE3NRDY;
bit_rw_t<io_, bitpos::B4> PIPE4NRDY;
bit_rw_t<io_, bitpos::B5> PIPE5NRDY;
bit_rw_t<io_, bitpos::B6> PIPE6NRDY;
bit_rw_t<io_, bitpos::B7> PIPE7NRDY;
bit_rw_t<io_, bitpos::B8> PIPE8NRDY;
bit_rw_t<io_, bitpos::B9> PIPE9NRDY;
bits_rw_t<io_, bitpos::B0, 10> PIPENRDY;
};
static inline nrdysts_t<base + 0x48> NRDYSTS;
//-----------------------------------------------------------------//
/*!
@brief BEMP 割り込みステータスレジスタ(BEMPSTS)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct bempsts_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B0> PIPE0BEMP;
bit_rw_t<io_, bitpos::B1> PIPE1BEMP;
bit_rw_t<io_, bitpos::B2> PIPE2BEMP;
bit_rw_t<io_, bitpos::B3> PIPE3BEMP;
bit_rw_t<io_, bitpos::B4> PIPE4BEMP;
bit_rw_t<io_, bitpos::B5> PIPE5BEMP;
bit_rw_t<io_, bitpos::B6> PIPE6BEMP;
bit_rw_t<io_, bitpos::B7> PIPE7BEMP;
bit_rw_t<io_, bitpos::B8> PIPE8BEMP;
bit_rw_t<io_, bitpos::B9> PIPE9BEMP;
bits_rw_t<io_, bitpos::B0, 10> PIPEBEMP;
};
static inline bempsts_t<base + 0x4A> BEMPSTS;
//-----------------------------------------------------------------//
/*!
@brief フレームナンバレジスタ(FRMNUM)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct frmnum_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 11> FRNM;
bit_rw_t <io_, bitpos::B14> CRCE;
bit_rw_t <io_, bitpos::B15> OVRN;
};
static inline frmnum_t<base + 0x4C> FRMNUM;
#if defined(SIG_RX111)
#else
//-----------------------------------------------------------------//
/*!
@brief デバイスステート切り替えレジスタ(DVCHGR)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dvchgr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B15> DVCHG;
};
static inline dvchgr_t<base + 0x4E> DVCHGR;
//-----------------------------------------------------------------//
/*!
@brief USB アドレスレジスタ(USBADDR)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct usbaddr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 7> USBADDR;
bits_rw_t<io_, bitpos::B8, 4> STSRECOV;
};
static inline usbaddr_t<base + 0x50> USBADDR;
#endif
//-----------------------------------------------------------------//
/*!
@brief USB リクエストタイプレジスタ(USBREQ)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct usbreq_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 8> BMREQUESTTYPE;
bits_rw_t<io_, bitpos::B8, 8> BREQUEST;
};
static inline usbreq_t<base + 0x54> USBREQ;
//-----------------------------------------------------------------//
/*!
@brief USB リクエストバリューレジスタ(USBVAL)
*/
//-----------------------------------------------------------------//
static inline rw16_t<base + 0x56> USBVAL;
//-----------------------------------------------------------------//
/*!
@brief USB リクエストインデックスレジスタ(USBINDX)
*/
//-----------------------------------------------------------------//
static inline rw16_t<base + 0x58> USBINDX;
//-----------------------------------------------------------------//
/*!
@brief USB リクエストレングスレジスタ(USBLENG)
*/
//-----------------------------------------------------------------//
static inline rw16_t<base + 0x5A> USBLENG;
//-----------------------------------------------------------------//
/*!
@brief DCP コンフィギュレーションレジスタ(DCPCFG)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dcpcfg_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t<io_, bitpos::B4> DIR;
bit_rw_t<io_, bitpos::B7> SHTNAK;
};
static inline dcpcfg_t<base + 0x5C> DCPCFG;
//-----------------------------------------------------------------//
/*!
@brief DCP マックスパケットサイズレジスタ(DCPMAXP)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dcpmaxp_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 7> MXPS;
bits_rw_t<io_, bitpos::B12, 4> DEVSEL;
};
static inline dcpmaxp_t<base + 0x5E> DCPMAXP;
//-----------------------------------------------------------------//
/*!
@brief DCP コントロールレジスタ(DCPCTR)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct dcpctr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 2> PID;
bit_rw_t <io_, bitpos::B2> CCPL;
bit_rw_t <io_, bitpos::B5> PBUSY;
bit_rw_t <io_, bitpos::B6> SQMON;
bit_rw_t <io_, bitpos::B7> SQSET;
bit_rw_t <io_, bitpos::B8> SQCLR;
bit_rw_t <io_, bitpos::B11> SUREQCLR;
bit_rw_t <io_, bitpos::B14> SUREQ;
bit_rw_t <io_, bitpos::B15> BSTS;
};
static inline dcpctr_t<base + 0x60> DCPCTR;
//-----------------------------------------------------------------//
/*!
@brief パイプウィンドウ選択レジスタ(PIPESEL)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipesel_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 4> PIPESEL;
};
static inline pipesel_t<base + 0x64> PIPESEL;
//-----------------------------------------------------------------//
/*!
@brief パイプコンフィギュレーションレジスタ(PIPECFG)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipecfg_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 4> EPNUM;
bit_rw_t <io_, bitpos::B4> DIR;
bit_rw_t <io_, bitpos::B7> SHTNAK;
bit_rw_t <io_, bitpos::B9> DBLB;
bit_rw_t <io_, bitpos::B10> BFRE;
bits_rw_t<io_, bitpos::B14, 2> TYPE;
};
static inline pipecfg_t<base + 0x68> PIPECFG;
//-----------------------------------------------------------------//
/*!
@brief パイプマックスパケットサイズレジスタ(PIPEMAXP)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipemaxp_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 9> MXPS;
bits_rw_t<io_, bitpos::B12, 4> DEVSEL;
};
static inline pipemaxp_t<base + 0x6C> PIPEMAXP;
//-----------------------------------------------------------------//
/*!
@brief パイプ周期制御レジスタ(PIPEPERI)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipeperi_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 3> IITV;
bit_rw_t <io_, bitpos::B12> IFIS;
};
static inline pipeperi_t<base + 0x6E> PIPEPERI;
//-----------------------------------------------------------------//
/*!
@brief パイプ n コントロールレジスタ(PIPExCTR)(n = 1 ~ 5)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipexctr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 2> PID;
bit_rw_t <io_, bitpos::B5> PBUSY;
bit_rw_t <io_, bitpos::B6> SQMON;
bit_rw_t <io_, bitpos::B7> SQSET;
bit_rw_t <io_, bitpos::B8> SQCLR;
bit_rw_t <io_, bitpos::B9> ACLRM;
bit_rw_t <io_, bitpos::B10> ATREPM;
bit_rw_t <io_, bitpos::B14> INBUFM;
bit_rw_t <io_, bitpos::B15> BSTS;
};
static inline pipexctr_t<base + 0x70> PIPE1CTR;
static inline pipexctr_t<base + 0x72> PIPE2CTR;
static inline pipexctr_t<base + 0x74> PIPE3CTR;
static inline pipexctr_t<base + 0x76> PIPE4CTR;
static inline pipexctr_t<base + 0x78> PIPE5CTR;
//-----------------------------------------------------------------//
/*!
@brief パイプ n コントロールレジスタ(PIPEyCTR)(n = 6 ~ 9)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipeyctr_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B0, 2> PID;
bit_rw_t <io_, bitpos::B5> PBUSY;
bit_rw_t <io_, bitpos::B6> SQMON;
bit_rw_t <io_, bitpos::B7> SQSET;
bit_rw_t <io_, bitpos::B8> SQCLR;
bit_rw_t <io_, bitpos::B9> ACLRM;
bit_rw_t <io_, bitpos::B15> BSTS;
};
static inline pipeyctr_t<base + 0x7A> PIPE6CTR;
static inline pipeyctr_t<base + 0x7C> PIPE7CTR;
static inline pipeyctr_t<base + 0x7E> PIPE8CTR;
static inline pipeyctr_t<base + 0x80> PIPE9CTR;
//-----------------------------------------------------------------//
/*!
@brief パイプコントロールレジスタ(PIPECTR)([0 ~ 8])
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipectr_t : public rw16_index_t<ofs> {
typedef rw16_index_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
void set_index(uint32_t j) { if(j < 9) { io_::index = j * 2; } }
bits_rw_t<io_, bitpos::B0, 2> PID;
bit_rw_t <io_, bitpos::B5> PBUSY;
bit_rw_t <io_, bitpos::B6> SQMON;
bit_rw_t <io_, bitpos::B7> SQSET;
bit_rw_t <io_, bitpos::B8> SQCLR;
bit_rw_t <io_, bitpos::B9> ACLRM;
bit_rw_t <io_, bitpos::B10> ATREPM; ///< for 0 to 4
bit_rw_t <io_, bitpos::B14> INBUFM; ///< for 0 to 4
bit_rw_t <io_, bitpos::B15> BSTS;
pipectr_t& operator [] (uint32_t idx) {
set_index(idx);
return *this;
}
};
static inline pipectr_t<base + 0x70> PIPECTR;
//-----------------------------------------------------------------//
/*!
@brief パイプ n トランザクションカウンタイネーブルレジスタ(PIPEnTRE)(n = 1 ~ 5)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipentre_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bit_rw_t <io_, bitpos::B8> TRCLR;
bit_rw_t <io_, bitpos::B9> TRENB;
};
static inline pipentre_t<base + 0x90> PIPE1TRE;
static inline pipentre_t<base + 0x94> PIPE2TRE;
static inline pipentre_t<base + 0x98> PIPE3TRE;
static inline pipentre_t<base + 0x9C> PIPE4TRE;
static inline pipentre_t<base + 0xA0> PIPE5TRE;
//-----------------------------------------------------------------//
/*!
@brief パイプトランザクションカウンタイネーブルレジスタ(PIPETRE)(0 ~ 4)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipetre_t : public rw16_index_t<ofs> {
typedef rw16_index_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
void set_index(uint32_t j) { if(j < 5) { io_::index = j * 4; } }
bit_rw_t<io_, bitpos::B8> TRCLR;
bit_rw_t<io_, bitpos::B9> TRENB;
pipetre_t& operator [] (uint32_t idx) {
set_index(idx);
return *this;
}
};
static inline pipetre_t<base + 0x90> PIPETRE;
//-----------------------------------------------------------------//
/*!
@brief パイプ n トランザクションカウンタレジスタ(PIPEnTRN)(n = 1 ~ 5)
*/
//-----------------------------------------------------------------//
static inline rw16_t<base + 0x92> PIPE1TRN;
static inline rw16_t<base + 0x96> PIPE2TRN;
static inline rw16_t<base + 0x9A> PIPE3TRN;
static inline rw16_t<base + 0x9E> PIPE4TRN;
static inline rw16_t<base + 0xA2> PIPE5TRN;
//-----------------------------------------------------------------//
/*!
@brief パイプトランザクションカウンタレジスタ(PIPETRN)(0 ~ 4)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct pipetrn_t : public rw16_index_t<ofs> {
typedef rw16_index_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
void set_index(uint32_t j) { if(j < 5) { io_::index = j * 4; } }
pipetrn_t& operator [] (uint32_t idx) {
set_index(idx);
return *this;
}
};
static inline pipetrn_t<base + 0x92> PIPETRN;
//-----------------------------------------------------------------//
/*!
@brief デバイスアドレス n コンフィギュレーションレジスタ(DEVADDn)(n = 0 ~ 5)
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct devaddn_t : public rw16_t<ofs> {
typedef rw16_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;
bits_rw_t<io_, bitpos::B6, 2> USBSPD;
};
static inline devaddn_t<base + 0xD0> DEVADD0;
static inline devaddn_t<base + 0xD2> DEVADD1;
static inline devaddn_t<base + 0xD4> DEVADD2;
static inline devaddn_t<base + 0xD6> DEVADD3;
static inline devaddn_t<base + 0xD8> DEVADD4;
static inline devaddn_t<base + 0xDA> DEVADD5;
//-----------------------------------------------------------------//
/*!
@brief デバイスアドレスコンフィギュレーションレジスタ(DEVADD)([0 ~ 5])
@param[in] ofs オフセット
*/
//-----------------------------------------------------------------//
template <uint32_t ofs>
struct devadd_t : public rw16_index_t<ofs> {
typedef rw16_index_t<ofs> io_;
using io_::operator =;
using io_::operator ();
using io_::operator |=;
using io_::operator &=;