board.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /****************************************************************************
  2. * boards/mips/pic32mx/sure-pic32mx/include/board.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H
  21. #define __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <nuttx/config.h>
  26. /****************************************************************************
  27. * Pre-processor Definitions
  28. ****************************************************************************/
  29. /* Configuration ************************************************************/
  30. /* Clocking *****************************************************************/
  31. /* Crystal frequencies */
  32. #define BOARD_POSC_FREQ 20000000 /* Primary OSC XTAL frequency (20MHz) */
  33. #define BOARD_SOSC_FREQ 32768 /* Secondary OSC XTAL frequency (32.768KHz) */
  34. /* Oscillator modes */
  35. #define BOARD_FNOSC_POSCPLL 1 /* Use primary oscillator w/PLL */
  36. #define BOARD_POSC_HSMODE 1 /* High-speed crystal (HS) mode */
  37. /* PLL configuration and resulting CPU clock.
  38. * CPU_CLOCK = ((POSC_FREQ / IDIV) * MULT) / ODIV
  39. */
  40. #define BOARD_PLL_INPUT BOARD_POSC_FREQ
  41. #define BOARD_PLL_IDIV 5 /* PLL input divider */
  42. #define BOARD_PLL_MULT 15 /* PLL multiplier */
  43. #define BOARD_PLL_ODIV 1 /* PLL output divider */
  44. #define BOARD_CPU_CLOCK 60000000 /* CPU clock (60MHz = (20MHz / 5) * 15 / 1) */
  45. /* USB PLL configuration.
  46. * USB_CLOCK = ((POSC_XTAL / IDIV) * 24) / 2
  47. */
  48. #define BOARD_UPLL_IDIV 5 /* USB PLL divider */
  49. #define BOARD_USB_CLOCK 48000000 /* USB clock ((20MHz / 5) * 24) / 2 */
  50. /* Peripheral clock is *not* divided down from CPU clock.
  51. * PBCLOCK = CPU_CLOCK / PBDIV
  52. */
  53. #define BOARD_PBDIV 1 /* Peripheral clock divisor (PBDIV) */
  54. #define BOARD_PBCLOCK 60000000 /* Peripheral clock (PBCLK = 60MHz/1) */
  55. /* Watchdog pre-scaler (re-visit) */
  56. #define BOARD_WD_ENABLE 0 /* Watchdog is disabled */
  57. #define BOARD_WD_PRESCALER 8 /* Watchdog pre-scaler */
  58. /* Timer 1 is a type A timer and is used as system clock. It can be clocked
  59. * with either the SOSC or the PBCLOCK. We will use the PBCLOCK because it
  60. * is much more accurate.
  61. */
  62. #undef BOARD_TIMER1_SOSC
  63. /* LED definitions **********************************************************/
  64. /* The Sure DB_DP11215 PIC32 Storage Demo Board board has five LEDs. One
  65. * (D4, lablel "Power") is not controllable by software. Four are
  66. * controllable by software:
  67. *
  68. * D7 "USB" Yellow RD7 Low illuminates
  69. * D8 "SD" Yellow RD6 Low illuminates
  70. * D9 "Flash" Yellow RF0 Low illuminates
  71. * D10 "Error" Red RF1 Low illuminates
  72. */
  73. /* ON OFF */
  74. /* USB SD FLASH ERROR USB SD FLASH ERROR */
  75. #define LED_STARTED 0 /* OFF OFF OFF OFF --- --- --- --- */
  76. #define LED_HEAPALLOCATE 1 /* ON OFF N/C N/C --- --- --- --- */
  77. #define LED_IRQSENABLED 2 /* OFF ON N/C N/C --- --- --- --- */
  78. #define LED_STACKCREATED 3 /* ON ON N/C N/C --- --- --- --- */
  79. #define LED_INIRQ 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
  80. #define LED_SIGNAL 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
  81. #define LED_ASSERTION 4 /* N/C N/C ON N/C N/C N/C OFF N/C */
  82. #define LED_PANIC 5 /* N/C N/C N/C ON N/C N/C N/C OFF */
  83. #define LED_NVALUES 6
  84. /* The Sure DB-DP11212 PIC32 General Purpose Demo Board does not have any
  85. * user controllable LEDs, but does does have a segment LED display.
  86. * That display is however, obscured by the larger segment display attached
  87. * to the board and, so, is not supported.
  88. */
  89. /* For distinguishing individual LEDs */
  90. #define LED_USB 0
  91. #define LED_SD 1
  92. #define LED_FLASH 2
  93. #define LED_ERROR 3
  94. /* Button Definitions *******************************************************/
  95. /* The Sure PIC32MX board has three buttons.
  96. *
  97. * SW1 (SW_UP, left arrow) RB3 Pulled high, GND/low when depressed
  98. * SW2 (SW_DOWN, down/right arrow) RB2 Pulled high, GND/low when depressed
  99. * SW3 (SW_OK, right arrow) RB4 Pulled high, GND/low when depressed
  100. */
  101. #define BUTTON_SW1 0
  102. #define BUTTON_SW2 1
  103. #define BUTTON_SW3 2
  104. #define NUM_BUTTONS 3
  105. #define BUTTON_SW1_BIT (1 << BUTTON_SW1)
  106. #define BUTTON_SW2_BIT (1 << BUTTON_SW2)
  107. #define BUTTON_SW3_BIT (1 << BUTTON_SW3)
  108. /****************************************************************************
  109. * Public Types
  110. ****************************************************************************/
  111. #ifndef __ASSEMBLY__
  112. /****************************************************************************
  113. * Inline Functions
  114. ****************************************************************************/
  115. /****************************************************************************
  116. * Public Function Prototypes
  117. ****************************************************************************/
  118. #ifdef __cplusplus
  119. #define EXTERN extern "C"
  120. extern "C"
  121. {
  122. #else
  123. #define EXTERN extern
  124. #endif
  125. #undef EXTERN
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif /* __ASSEMBLY__ */
  130. #endif /* __BOARDS_MIPS_PIC32MX_SURE_PIC32MX_INCLUDE_BOARD_H */