summaryrefslogtreecommitdiff
path: root/nuttx/arch/mips/src/pic32mz/pic32mz-config.h
blob: fee82077370320883c81e1b4c09b73aa0ffa7af9 (plain) (blame)
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
/************************************************************************************
 * arch/mips/src/pic32mz/pic32mz-config.h
 *
 *   Copyright (C) 2015 Gregory Nutt. All rights reserved.
 *   Author: Gregory Nutt <gnutt@nuttx.org>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name NuttX nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "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 THE
 * COPYRIGHT OWNER OR CONTRIBUTORS 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.
 *
 ************************************************************************************/

#ifndef __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_CONFIG_H
#define __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_CONFIG_H

/************************************************************************************
 * Included Files
 ************************************************************************************/

#include <nuttx/config.h>
#include <arch/board/board.h>

/************************************************************************************
 * Pre-processor Definitions
 ************************************************************************************/
/* Interrupt Priorities *************************************************************/

#ifndef CONFIG_PIC32MZ_CTPRIO         /* Core Timer Interrupt */
#  define CONFIG_PIC32MZ_CTPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CTPRIO < 4
#  error "CONFIG_PIC32MZ_CTPRIO is too small"
#endif
#if CONFIG_PIC32MZ_CTPRIO > 31
#  error "CONFIG_PIC32MZ_CTPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_CS0PRIO       /* Core Software Interrupt 0 */
#  define CONFIG_PIC32MZ_CS0PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CS0PRIO < 4
#  error "CONFIG_PIC32MZ_CS0PRIO is too small"
#endif
#if CONFIG_PIC32MZ_CS0PRIO > 31
#  error "CONFIG_PIC32MZ_CS0PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_CS1PRIO      /* Core Software Interrupt 1 */
#  define CONFIG_PIC32MZ_CS1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CS1PRIO < 4
#  error "CONFIG_PIC32MZ_CS1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_CS1PRIO > 31
#  error "CONFIG_PIC32MZ_CS1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_INT0PRIO      /* External interrupt 0 */
#  define CONFIG_PIC32MZ_INT0PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_INT0PRIO < 4
#  error "CONFIG_PIC32MZ_INT0PRIO is too small"
#endif
#if CONFIG_PIC32MZ_INT0PRIO > 31
#  error "CONFIG_PIC32MZ_INT0PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_INT1PRIO      /* External interrupt 1 */
#  define CONFIG_PIC32MZ_INT1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_INT1PRIO < 4
#  error "CONFIG_PIC32MZ_INT1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_INT1PRIO > 31
#  error "CONFIG_PIC32MZ_INT1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_INT2PRIO      /* External interrupt 2 */
#  define CONFIG_PIC32MZ_INT2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_INT2PRIO < 4
#  error "CONFIG_PIC32MZ_INT2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_INT2PRIO > 31
#  error "CONFIG_PIC32MZ_INT2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_INT3PRIO      /* External interrupt 3 */
#  define CONFIG_PIC32MZ_INT3PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_INT3PRIO < 4
#  error "CONFIG_PIC32MZ_INT3PRIO is too small"
#endif
#if CONFIG_PIC32MZ_INT3PRIO > 31
#  error "CONFIG_PIC32MZ_INT3PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_INT4PRIO      /* External interrupt 4 */
#  define CONFIG_PIC32MZ_INT4PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_INT4PRIO < 4
#  error "CONFIG_PIC32MZ_INT4PRIO is too small"
#endif
#if CONFIG_PIC32MZ_INT4PRIO > 31
#  error "CONFIG_PIC32MZ_INT4PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_FSCMPRIO      /* Fail-Safe Clock Monitor */
#  define CONFIG_PIC32MZ_FSCMPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_FSCMPRIO < 4
#  error "CONFIG_PIC32MZ_FSCMPRIO is too small"
#endif
#if CONFIG_PIC32MZ_FSCMPRIO > 31
#  error "CONFIG_PIC32MZ_FSCMPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_T1PRIO        /* Timer 1 (System timer) priority */
#  define CONFIG_PIC32MZ_T1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_T1PRIO < 4
#  error "CONFIG_PIC32MZ_T1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_T1PRIO > 31
#  error "CONFIG_PIC32MZ_T1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_T2PRIO        /* Timer 2 priority */
#  define CONFIG_PIC32MZ_T2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_T2PRIO < 4
#  error "CONFIG_PIC32MZ_T2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_T2PRIO > 31
#  error "CONFIG_PIC32MZ_T2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_T3PRIO        /* Timer 3 priority */
#  define CONFIG_PIC32MZ_T3PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_T3PRIO < 4
#  error "CONFIG_PIC32MZ_T3PRIO is too small"
#endif
#if CONFIG_PIC32MZ_T3PRIO > 31
#  error "CONFIG_PIC32MZ_T3PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_T4PRIO        /* Timer 4 priority */
#  define CONFIG_PIC32MZ_T4PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_T4PRIO < 4
#  error "CONFIG_PIC32MZ_T4PRIO is too small"
#endif
#if CONFIG_PIC32MZ_T4PRIO > 31
#  error "CONFIG_PIC32MZ_T4PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_T5PRIO        /* Timer 5 priority */
#  define CONFIG_PIC32MZ_T5PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_T5PRIO < 4
#  error "CONFIG_PIC32MZ_T5PRIO is too small"
#endif
#if CONFIG_PIC32MZ_T5PRIO > 31
#  error "CONFIG_PIC32MZ_T5PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_IC1PRIO       /* Input Capture 1 */
#  define CONFIG_PIC32MZ_IC1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_IC1PRIO < 4
#  error "CONFIG_PIC32MZ_IC1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_IC1PRIO > 31
#  error "CONFIG_PIC32MZ_IC1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_IC2PRIO       /* Input Capture 2 */
#  define CONFIG_PIC32MZ_IC2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_IC2PRIO < 4
#  error "CONFIG_PIC32MZ_IC2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_IC2PRIO > 31
#  error "CONFIG_PIC32MZ_IC2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_IC3PRIO       /* Input Capture 3 */
#  define CONFIG_PIC32MZ_IC3PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_IC3PRIO < 4
#  error "CONFIG_PIC32MZ_IC3PRIO is too small"
#endif
#if CONFIG_PIC32MZ_IC3PRIO > 31
#  error "CONFIG_PIC32MZ_IC3PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_IC4PRIO       /* Input Capture 4 */
#  define CONFIG_PIC32MZ_IC4PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_IC4PRIO < 4
#  error "CONFIG_PIC32MZ_IC4PRIO is too small"
#endif
#if CONFIG_PIC32MZ_IC4PRIO > 31
#  error "CONFIG_PIC32MZ_IC4PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_IC5PRIO       /* Input Capture 5 */
#  define CONFIG_PIC32MZ_IC5PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_IC5PRIO < 4
#  error "CONFIG_PIC32MZ_IC5PRIO is too small"
#endif
#if CONFIG_PIC32MZ_IC5PRIO > 31
#  error "CONFIG_PIC32MZ_IC5PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_OC1PRIO       /* Output Compare 1 */
#  define CONFIG_PIC32MZ_OC1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_OC1PRIO < 4
#  error "CONFIG_PIC32MZ_OC1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_OC1PRIO > 31
#  error "CONFIG_PIC32MZ_OC1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_OC2PRIO       /* Output Compare 2 */
#  define CONFIG_PIC32MZ_OC2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_OC2PRIO < 4
#  error "CONFIG_PIC32MZ_OC2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_OC2PRIO > 31
#  error "CONFIG_PIC32MZ_OC2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_OC3PRIO       /* Output Compare 3 */
#  define CONFIG_PIC32MZ_OC3PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_OC3PRIO < 4
#  error "CONFIG_PIC32MZ_OC3PRIO is too small"
#endif
#if CONFIG_PIC32MZ_OC3PRIO > 31
#  error "CONFIG_PIC32MZ_OC3PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_OC4PRIO       /* Output Compare 4 */
#  define CONFIG_PIC32MZ_OC4PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_OC4PRIO < 4
#  error "CONFIG_PIC32MZ_OC4PRIO is too small"
#endif
#if CONFIG_PIC32MZ_OC4PRIO > 31
#  error "CONFIG_PIC32MZ_OC4PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_OC5PRIO       /* Output Compare 5 */
#  define CONFIG_PIC32MZ_OC5PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_OC5PRIO < 4
#  error "CONFIG_PIC32MZ_OC5PRIO is too small"
#endif
#if CONFIG_PIC32MZ_OC5PRIO > 31
#  error "CONFIG_PIC32MZ_OC5PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_I2C1PRIO      /* I2C 1 */
#  define CONFIG_PIC32MZ_I2C1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_I2C1PRIO < 4
#  error "CONFIG_PIC32MZ_I2C1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_I2C1PRIO > 31
#  error "CONFIG_PIC32MZ_I2C1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_I2C2PRIO      /* I2C 2 */
#  define CONFIG_PIC32MZ_I2C2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_I2C2PRIO < 4
#  error "CONFIG_PIC32MZ_I2C2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_I2C2PRIO > 31
#  error "CONFIG_PIC32MZ_I2C2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_SPI1PRIO      /* SPI 1 */
#  define CONFIG_PIC32MZ_SPI1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_SPI1PRIO < 4
#  error "CONFIG_PIC32MZ_SPI1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_SPI1PRIO > 31
#  error "CONFIG_PIC32MZ_SPI1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_SPI2PRIO      /* SPI 2 */
#  define CONFIG_PIC32MZ_SPI2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_SPI2PRIO < 4
#  error "CONFIG_PIC32MZ_SPI2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_SPI2PRIO > 31
#  error "CONFIG_PIC32MZ_SPI2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_UART1PRIO      /* UART 1 */
#  define CONFIG_PIC32MZ_UART1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_UART1PRIO < 4
#  error "CONFIG_PIC32MZ_UART1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_UART1PRIO > 31
#  error "CONFIG_PIC32MZ_UART1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_UART2PRIO      /* UART 2 */
#  define CONFIG_PIC32MZ_UART2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_UART2PRIO < 4
#  error "CONFIG_PIC32MZ_UART2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_UART2PRIO > 31
#  error "CONFIG_PIC32MZ_UART2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_CNPRIO            /* Input Change Interrupt */
#  define CONFIG_PIC32MZ_CNPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CNPRIO < 4
#  error "CONFIG_PIC32MZ_CNPRIO is too small"
#endif
#if CONFIG_PIC32MZ_CNPRIO > 31
#  error "CONFIG_PIC32MZ_CNPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_ADCPRIO       /* ADC1 Convert Done */
#  define CONFIG_PIC32MZ_ADCPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_ADCPRIO < 4
#  error "CONFIG_PIC32MZ_ADCPRIO is too small"
#endif
#if CONFIG_PIC32MZ_ADCPRIO > 31
#  error "CONFIG_PIC32MZ_ADCPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_PMPPRIO       /* Parallel Master Port */
#  define CONFIG_PIC32MZ_PMPPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_PMPPRIO < 4
#  error "CONFIG_PIC32MZ_PMPPRIO is too small"
#endif
#if CONFIG_PIC32MZ_PMPPRIO > 31
#  error "CONFIG_PIC32MZ_PMPPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_CM1PRIO       /* Comparator 1 */
#  define CONFIG_PIC32MZ_CM1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CM1PRIO < 4
#  error "CONFIG_PIC32MZ_CM1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_CM1PRIO > 31
#  error "CONFIG_PIC32MZ_CM1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_CM2PRIO       /* Comparator 2 */
#  define CONFIG_PIC32MZ_CM2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_CM2PRIO < 4
#  error "CONFIG_PIC32MZ_CM2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_CM2PRIO > 31
#  error "CONFIG_PIC32MZ_CM2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_FSCMPRIO      /* Fail-Safe Clock Monitor */
#  define CONFIG_PIC32MZ_FSCMPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_FSCMPRIO < 4
#  error "CONFIG_PIC32MZ_FSCMPRIO is too small"
#endif
#if CONFIG_PIC32MZ_FSCMPRIO > 31
#  error "CONFIG_PIC32MZ_FSCMPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_RTCCPRIO      /* Real-Time Clock and Calendar */
#  define CONFIG_PIC32MZ_RTCCPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_RTCCPRIO < 4
#  error "CONFIG_PIC32MZ_RTCCPRIO is too small"
#endif
#if CONFIG_PIC32MZ_RTCCPRIO > 31
#  error "CONFIG_PIC32MZ_RTCCPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_DMA0PRIO      /* DMA Channel 0 */
#  define CONFIG_PIC32MZ_DMA0PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_DMA0PRIO < 4
#  error "CONFIG_PIC32MZ_DMA0PRIO is too small"
#endif
#if CONFIG_PIC32MZ_DMA0PRIO > 31
#  error "CONFIG_PIC32MZ_DMA0PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_DMA1PRIO      /* DMA Channel 1 */
#  define CONFIG_PIC32MZ_DMA1PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_DMA1PRIO < 4
#  error "CONFIG_PIC32MZ_DMA1PRIO is too small"
#endif
#if CONFIG_PIC32MZ_DMA1PRIO > 31
#  error "CONFIG_PIC32MZ_DMA1PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_DMA2PRIO      /* DMA Channel 2 */
#  define CONFIG_PIC32MZ_DMA2PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_DMA2PRIO < 4
#  error "CONFIG_PIC32MZ_DMA2PRIO is too small"
#endif
#if CONFIG_PIC32MZ_DMA2PRIO > 31
#  error "CONFIG_PIC32MZ_DMA2PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_DMA3PRIO      /* DMA Channel 3 */
#  define CONFIG_PIC32MZ_DMA3PRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_DMA3PRIO < 4
#  error "CONFIG_PIC32MZ_DMA3PRIO is too small"
#endif
#if CONFIG_PIC32MZ_DMA3PRIO > 31
#  error "CONFIG_PIC32MZ_DMA3PRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_FCEPRIO       /* Flash Control Event */
#  define CONFIG_PIC32MZ_FCEPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_FCEPRIO < 4
#  error "CONFIG_PIC32MZ_FCEPRIO is too small"
#endif
#if CONFIG_PIC32MZ_FCEPRIO > 31
#  error "CONFIG_PIC32MZ_FCEPRIO is too large"
#endif

#ifndef CONFIG_PIC32MZ_USBPRIO       /* USB */
#  define CONFIG_PIC32MZ_USBPRIO (INT_IPC_MID_PRIORITY << 2)
#endif
#if CONFIG_PIC32MZ_USBPRIO < 4
#  error "CONFIG_PIC32MZ_USBPRIO is too small"
#endif
#if CONFIG_PIC32MZ_USBPRIO > 31
#  error "CONFIG_PIC32MZ_USBPRIO is too large"
#endif

/* SYS calls ************************************************************************/
/* SYS call 1 and 2 are defined for internal use by the PIC32MZ port (see
 * arch/mips/include/mips32/syscall.h).  In addition, SYS call 3 is the return from
 * a SYS call in kernel mode.  The first four syscall values must, therefore, be
 * reserved (0 is not used).
 */

#ifdef CONFIG_BUILD_KERNEL
#  if !defined(CONFIG_SYS_RESERVED) || CONFIG_SYS_RESERVED < 4
#    error "CONFIG_SYS_RESERVED must be defined to be 4 for a kernel build"
#  elif CONFIG_SYS_RESERVED > 4
#    warning "CONFIG_SYS_RESERVED should be defined to be 4 for a kernel build"
#  endif
#endif

/* UARTs ****************************************************************************/
/* Don't enable UARTs not supported by the chip. */

#if CHIP_NUARTS < 1
#  undef CONFIG_PIC32MZ_UART1
#  undef CONFIG_PIC32MZ_UART2
#  undef CONFIG_PIC32MZ_UART3
#  undef CONFIG_PIC32MZ_UART4
#  undef CONFIG_PIC32MZ_UART5
#  undef CONFIG_PIC32MZ_UART6
#elif CHIP_NUARTS < 2
#  undef CONFIG_PIC32MZ_UART2
#  undef CONFIG_PIC32MZ_UART3
#  undef CONFIG_PIC32MZ_UART4
#  undef CONFIG_PIC32MZ_UART5
#  undef CONFIG_PIC32MZ_UART6
#elif CHIP_NUARTS < 3
#  undef CONFIG_PIC32MZ_UART3
#  undef CONFIG_PIC32MZ_UART4
#  undef CONFIG_PIC32MZ_UART5
#  undef CONFIG_PIC32MZ_UART6
#elif CHIP_NUARTS < 4
#  undef CONFIG_PIC32MZ_UART4
#  undef CONFIG_PIC32MZ_UART5
#  undef CONFIG_PIC32MZ_UART6
#elif CHIP_NUARTS < 5
#  undef CONFIG_PIC32MZ_UART5
#  undef CONFIG_PIC32MZ_UART6
#elif CHIP_NUARTS < 6
#  undef CONFIG_PIC32MZ_UART6
#endif

/* Are any UARTs enabled? */

#undef HAVE_UART_DEVICE
#if defined(CONFIG_PIC32MZ_UART1) || defined(CONFIG_PIC32MZ_UART2) || \
    defined(CONFIG_PIC32MZ_UART4) || defined(CONFIG_PIC32MZ_UART4) || \
    defined(CONFIG_PIC32MZ_UART5) || defined(CONFIG_PIC32MZ_UART6)
#  define HAVE_UART_DEVICE 1
#endif

/* Is there a serial console?  There should be no more than one defined.  It
 * could be on any UARTn, n=1,.. CHIP_NUARTS
 */

#if defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART1)
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART2)
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART3)
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART4)
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#elif defined(CONFIG_UART5_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART5)
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#elif defined(CONFIG_UART6_SERIAL_CONSOLE) && defined(CONFIG_PIC32MZ_UART6)
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  define HAVE_SERIAL_CONSOLE 1
#else
#  undef CONFIG_UART1_SERIAL_CONSOLE
#  undef CONFIG_UART2_SERIAL_CONSOLE
#  undef CONFIG_UART3_SERIAL_CONSOLE
#  undef CONFIG_UART4_SERIAL_CONSOLE
#  undef CONFIG_UART5_SERIAL_CONSOLE
#  undef CONFIG_UART6_SERIAL_CONSOLE
#  undef HAVE_SERIAL_CONSOLE
#endif

/* Device Configuration *************************************************************/
/* DEVCFG3 */

#ifndef CONFIG_PIC32MZ_USERID               /* User ID */
#  define CONFIG_PIC32MZ_USERID   0x584e    /* "NutX" */
#endif

#ifndef CONFIG_PIC32MZ_PMDL1WAY             /* Peripheral module disable configuration */
#  define CONFIG_PIC32MZ_PMDL1WAY 0
#endif

#ifndef CONFIG_PIC32MZ_IOL1WAY              /* Peripheral pin select configuration */
#  define CONFIG_PIC32MZ_IOL1WAY  0
#endif

#ifndef CONFIG_PIC32MZ_SRSSEL               /* Shadow register interrupt priority */
#  define CONFIG_PIC32MZ_SRSSEL   INT_IPC_MIN_PRIORITY
#endif

/* Unless overridden in the .config file, all pins are in the default setting */

#ifndef CONFIG_PIC32MZ_FMIIEN               /* Ethernet MII enable: 0=RMII 1=MII */
#  define CONFIG_PIC32MZ_FMIIEN   1         /* MII enabled */
#endif

#ifndef CONFIG_PIC32MZ_FETHIO               /* Ethernet I/O Pins 0=alternate 1=default */
#  define CONFIG_PIC32MZ_FETHIO   1         /* Default Ethernet I/O Pins */
#endif

#ifndef CONFIG_PIC32MZ_FCANIO               /* SCM1 pin C selection */
#  define CONFIG_PIC32MZ_FCANIO   1         /* Default CAN I/O Pins */
#endif

#ifndef CONFIG_PIC32MZ_FSCM1IO              /* SCM1 pin C selection */
#  define CONFIG_PIC32MZ_FSCM1IO  1         /* Default pin for SCM1C */
#endif

/* USB or Ports? */

#ifdef CONFIG_PIC32MZ_USB
#  ifndef CONFIG_PIC32MZ_USBIDO            /* USB USBID Selection */
#    define CONFIG_PIC32MZ_USBIDO 1        /* USBID pin is controlled by the USB module */
#  endif
#  ifndef CONFIG_PIC32MZ_VBUSIO            /* USB VBUSON Selection */
#    define CONFIG_PIC32MZ_VBUSIO 1        /* VBUSON pin is controlled by the USB module */
#  endif
#else
#  ifndef CONFIG_PIC32MZ_USBIDO            /* USB USBID Selection */
#    define CONFIG_PIC32MZ_USBIDO 0        /* USBID pin is controlled by the Port function */
#  endif
#  ifndef CONFIG_PIC32MZ_VBUSIO            /* USB VBUSON Selection */
#    define CONFIG_PIC32MZ_VBUSIO 0        /* VBUSON pin is controlled by the Port function */
#  endif
#endif

/* DEVCFG2 */

#undef CONFIG_PIC32MZ_PLLIDIV
#if BOARD_PLL_IDIV == 1
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV1
#elif BOARD_PLL_IDIV == 2
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV2
#elif BOARD_PLL_IDIV == 3
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV3
#elif BOARD_PLL_IDIV == 4
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV4
#elif BOARD_PLL_IDIV == 5
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV5
#elif BOARD_PLL_IDIV == 6
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV6
#elif BOARD_PLL_IDIV == 10
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV10
#elif BOARD_PLL_IDIV == 12
#  define CONFIG_PIC32MZ_PLLIDIV  DEVCFG2_FPLLIDIV_DIV12
#else
#  error "Unsupported BOARD_PLL_IDIV"
#endif

#undef CONFIG_PIC32MZ_PLLMULT
#if BOARD_PLL_MULT == 15
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL15
#elif BOARD_PLL_MULT == 16
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL16
#elif BOARD_PLL_MULT == 17
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL17
#elif BOARD_PLL_MULT == 18
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL18
#elif BOARD_PLL_MULT == 19
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL19
#elif BOARD_PLL_MULT == 20
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL20
#elif BOARD_PLL_MULT == 21
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL21
#elif BOARD_PLL_MULT == 24
#  define CONFIG_PIC32MZ_PLLMULT  DEVCFG2_FPLLMULT_MUL24
#else
#  error "Unsupported BOARD_PLL_MULT"
#endif

#undef CONFIG_PIC32MZ_UPLLIDIV
#if BOARD_UPLL_IDIV == 1
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV1
#elif BOARD_UPLL_IDIV == 2
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV2
#elif BOARD_UPLL_IDIV == 3
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV3
#elif BOARD_UPLL_IDIV == 4
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV4
#elif BOARD_UPLL_IDIV == 5
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV5
#elif BOARD_UPLL_IDIV == 6
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV6
#elif BOARD_UPLL_IDIV == 10
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV10
#elif BOARD_UPLL_IDIV == 12
#  define CONFIG_PIC32MZ_UPLLIDIV DEVCFG2_FUPLLIDIV_DIV12
#else
#  error "Unsupported BOARD_UPLL_IDIV"
#endif

#ifndef CONFIG_PIC32MZ_FUPLLEN
#  if defined(CONFIG_PIC32MZ_USBDEV) || defined(CONFIG_PIC32MZ_USBHOST)
#    define CONFIG_PIC32MZ_FUPLLEN 0 /* Enable */
#  else
#    define CONFIG_PIC32MZ_FUPLLEN 1 /* Bypass and disable */
#  endif
#endif

#undef CONFIG_PIC32MZ_PLLODIV
#if BOARD_PLL_ODIV == 1
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV1
#elif BOARD_PLL_ODIV == 2
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 4
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 8
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 16
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 32
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 64
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#elif BOARD_PLL_ODIV == 128
#  define CONFIG_PIC32MZ_PLLODIV  DEVCFG2_FPLLODIV_DIV2
#else
#  error "Unsupported BOARD_PLL_ODIV"
#endif

/* DEVCFG1 */

#ifdef BOARD_SOSC_ENABLE
#  define CONFIG_PIC32MZ_FSOSCEN DEVCFG1_FSOSCEN
#else
#  define CONFIG_PIC32MZ_FSOSCEN 0
#endif

#ifdef BOARD_SOSC_IESO
#  define CONFIG_PIC32MZ_IESO DEVCFG1_IESO
#else
#  define CONFIG_PIC32MZ_IESO 0
#endif

#undef CONFIG_PIC32MZ_PBDIV
#if BOARD_PBDIV == 1
#  define CONFIG_PIC32MZ_PBDIV DEVCFG1_FPBDIV_DIV1
#elif BOARD_PBDIV == 2
#  define CONFIG_PIC32MZ_PBDIV DEVCFG1_FPBDIV_DIV2
#elif BOARD_PBDIV == 4
#  define CONFIG_PIC32MZ_PBDIV DEVCFG1_FPBDIV_DIV4
#elif BOARD_PBDIV == 8
#  define CONFIG_PIC32MZ_PBDIV DEVCFG1_FPBDIV_DIV8
#else
#  error "Unsupported BOARD_PBDIV"
#endif

#undef CONFIG_PIC32MZ_POSCMOD
#if defined(BOARD_POSC_ECMODE)
#  define CONFIG_PIC32MZ_POSCMOD DEVCFG1_POSCMOD_EC
#elif defined(BOARD_POSC_XTMODE)
#  define CONFIG_PIC32MZ_POSCMOD DEVCFG1_POSCMOD_XT
#elif defined(BOARD_POSC_HSMODE)
#  define CONFIG_PIC32MZ_POSCMOD DEVCFG1_POSCMOD_HS
#elif defined(BOARD_POSC_DISABLED)
#  define CONFIG_PIC32MZ_POSCMOD DEVCFG1_POSCMOD_DIS
#else
#  error "Unknown board POSC mode"
#endif

#undef CONFIG_PIC32MZ_FNOSC
#if defined(BOARD_FNOSC_FRC)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_FRC
#elif defined(BOARD_FNOSC_FRCPLL)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_FRCPLL
#elif defined(BOARD_FNOSC_POSC)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_POSC
#elif defined(BOARD_FNOSC_POSCPLL)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_POSCPLL
#elif defined(BOARD_FNOSC_SOSC)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_SOSC
#elif defined(BOARD_FNOSC_LPRC)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_LPRC
#elif defined(BOARD_FNOSC_FRCDIV)
#  define CONFIG_PIC32MZ_FNOSC DEVCFG1_FNOSC_FRCDIV
#else
#  error "Unknown board FNOSC selection"
#endif

#undef CONFIG_PIC32MZ_FCKSM
#if defined(BOARD_POSC_SWITCH)
#  if defined(BOARD_POSC_FSCM)
#    define CONFIG_PIC32MZ_FCKSM DEVCFG1_FCKSM_BOTH
#  else
#    define CONFIG_PIC32MZ_FCKSM DEVCFG1_FCKSM_CSONLY
#  endif
#else
#  define CONFIG_PIC32MZ_FCKSM DEVCFG1_FCKSM_NONE
#endif

#ifndef CONFIG_PIC32MZ_OSCOUT
#  define CONFIG_PIC32MZ_OSCOUT 0
#endif

#undef CONFIG_PIC32MZ_WDPS
#if BOARD_WD_PRESCALER == 1
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_1
#elif BOARD_WD_PRESCALER == 2
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_2
#elif BOARD_WD_PRESCALER == 4
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_4
#elif BOARD_WD_PRESCALER == 8
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_8
#elif BOARD_WD_PRESCALER == 16
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_16
#elif BOARD_WD_PRESCALER == 32
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_32
#elif BOARD_WD_PRESCALER == 64
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_64
#elif BOARD_WD_PRESCALER == 128
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_128
#elif BOARD_WD_PRESCALER == 256
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_256
#elif BOARD_WD_PRESCALER == 512
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_512
#elif BOARD_WD_PRESCALER == 1024
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_1024
#elif BOARD_WD_PRESCALER == 2048
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_2048
#elif BOARD_WD_PRESCALER == 4096
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_4096
#elif BOARD_WD_PRESCALER == 8192
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_8192
#elif BOARD_WD_PRESCALER == 16384
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_16384
#elif BOARD_WD_PRESCALER == 32768
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_32768
#elif BOARD_WD_PRESCALER == 65536
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_65536
#elif BOARD_WD_PRESCALER == 131072
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_131072
#elif BOARD_WD_PRESCALER == 262144
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_262144
#elif BOARD_WD_PRESCALER == 524288
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_524288
#elif BOARD_WD_PRESCALER == 1048576
#  define CONFIG_PIC32MZ_WDPS DEVCFG1_WDTPS_1048576
#else
#  error "Unsupported BOARD_WD_PRESCALER"
#endif

#undef CONFIG_PIC32MZ_WDENABLE
#if BOARD_WD_ENABLE
#  define CONFIG_PIC32MZ_WDENABLE DEVCFG1_FWDTEN
#else
#  define CONFIG_PIC32MZ_WDENABLE 0
#endif

/* DEVCFG0 */

#ifndef CONFIG_PIC32MZ_DEBUGGER                 /* Background Debugger Enable */
#  define CONFIG_PIC32MZ_DEBUGGER         3     /* disabled */
#endif

#ifndef CONFIG_PIC32MZ_ICESEL                   /* In-Circuit Emulator/Debugger Communication Channel Select */
#  if defined(CHIP_PIC32MZ1) || defined(CHIP_PIC32MZ2)
#    define CONFIG_PIC32MZ_ICESEL         3     /* Default PGEC1/PGED1 */
#  else
#    define CONFIG_PIC32MZ_ICESEL         1     /* Default PGEC1/PGED1 */
#  endif
#endif

#ifndef CONFIG_PIC32MZ_PROGFLASHWP              /* Program FLASH write protect */
#  if defined(CHIP_PIC32MZ1) || defined(CHIP_PIC32MZ2)
#    define CONFIG_PIC32MZ_PROGFLASHWP    0x3ff /* Disabled */
#  else
#    define CONFIG_PIC32MZ_PROGFLASHWP    0xff  /* Disabled */
#  endif
#endif

#ifndef CONFIG_PIC32MZ_BOOTFLASHWP
#  define CONFIG_PIC32MZ_BOOTFLASHWP      1     /* Disabled */
#endif

#ifndef CONFIG_PIC32MZ_CODEWP
#  define CONFIG_PIC32MZ_CODEWP           1     /* Disabled */
#endif

/************************************************************************************
 * Public Types
 ************************************************************************************/

/************************************************************************************
 * Public Data
 ************************************************************************************/

/************************************************************************************
 * Inline Functions
 ************************************************************************************/

/************************************************************************************
 * Public Functions
 ************************************************************************************/

#endif /* __ARCH_MIPS_SRC_PIC32MZ_PIC32MZ_CONFIG_H */