]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_IGLOO2_Creative_SoftConsole/Microsemi_Code/riscv_hal/sample_hw_platform.h
Microsemi RISC-V project:
[freertos] / FreeRTOS / Demo / RISC-V_IGLOO2_Creative_SoftConsole / Microsemi_Code / riscv_hal / sample_hw_platform.h
1 /*******************************************************************************\r
2  * (c) Copyright 2016-2018 Microsemi Corporation.  All rights reserved.\r
3  *\r
4  * Platform definitions\r
5  * Version based on requirements of RISCV-HAL\r
6  *\r
7  * SVN $Revision: 9946 $\r
8  * SVN $Date: 2018-04-30 20:26:55 +0530 (Mon, 30 Apr 2018) $\r
9  */\r
10  /*=========================================================================*//**\r
11   @mainpage Sample file detailing how hw_platform.h should be constructed for \r
12     the Mi-V processors.\r
13 \r
14     @section intro_sec Introduction\r
15     The hw_platform.h is to be located in the project root directory.\r
16     Currently this file must be hand crafted when using the Mi-V Soft Processor.\r
17     \r
18     You can use this file as sample.\r
19     Rename this file from sample_hw_platform.h to hw_platform.h and store it in\r
20     the root folder of your project. Then customize it per your HW design.\r
21 \r
22     @section driver_configuration Project configuration Instructions\r
23     1. Change SYS_CLK_FREQ define to frequency of Mi-V Soft processor clock\r
24     2  Add all other core BASE addresses\r
25     3. Add peripheral Core Interrupt to Mi-V Soft processor interrupt mappings\r
26     4. Define MSCC_STDIO_UART_BASE_ADDR if you want a CoreUARTapb mapped to STDIO\r
27 *//*=========================================================================*/\r
28 \r
29 #ifndef HW_PLATFORM_H\r
30 #define HW_PLATFORM_H\r
31 \r
32 /***************************************************************************//**\r
33  * Soft-processor clock definition\r
34  * This is the only clock brought over from the Mi-V Soft processor Libero design.\r
35  */\r
36 #ifndef SYS_CLK_FREQ\r
37 #define SYS_CLK_FREQ                    83000000UL\r
38 #endif\r
39 \r
40 \r
41 /***************************************************************************//**\r
42  * Non-memory Peripheral base addresses\r
43  * Format of define is:\r
44  * <corename>_<instance>_BASE_ADDR\r
45  */\r
46 #define COREUARTAPB0_BASE_ADDR          0x70001000UL\r
47 #define COREGPIO_BASE_ADDR              0x70002000UL\r
48 #define COREGPIO_IN_BASE_ADDR           0x70002000UL\r
49 #define CORETIMER0_BASE_ADDR            0x70003000UL\r
50 #define CORETIMER1_BASE_ADDR            0x70004000UL\r
51 #define COREGPIO_OUT_BASE_ADDR          0x70005000UL\r
52 #define FLASH_CORE_SPI_BASE             0x70006000UL\r
53 #define CORE16550_BASE_ADDR             0x70007000UL\r
54 \r
55 /***************************************************************************//**\r
56  * Peripheral Interrupts are mapped to the corresponding Mi-V Soft processor\r
57  * interrupt from the Libero design.\r
58  * There can be up to 31 external interrupts (IRQ[30:0] pins) on the Mi-V Soft\r
59  * processor.The Mi-V Soft processor external interrupts are defined in the\r
60  * riscv_plic.h\r
61  * These are of the form\r
62  * typedef enum\r
63 {\r
64     NoInterrupt_IRQn = 0,\r
65     External_1_IRQn  = 1,\r
66     External_2_IRQn  = 2,\r
67     .\r
68     .\r
69     .\r
70     External_31_IRQn = 31\r
71 } IRQn_Type;\r
72  \r
73  The interrupt 0 on RISC-V processor is not used. The pin IRQ[0] should map to\r
74  External_1_IRQn likewise IRQ[30] should map to External_31_IRQn\r
75  * Format of define is:\r
76  * <corename>_<instance>_<core interrupt name>\r
77  */\r
78 \r
79 #define TIMER0_IRQn                     External_30_IRQn\r
80 #define TIMER1_IRQn                     External_31_IRQn\r
81 \r
82 /****************************************************************************\r
83  * Baud value to achieve a 115200 baud rate with a 83MHz system clock.\r
84  * This value is calculated using the following equation:\r
85  *      BAUD_VALUE = (CLOCK / (16 * BAUD_RATE)) - 1\r
86  *****************************************************************************/\r
87 #define BAUD_VALUE_115200               (SYS_CLK_FREQ / (16 * 115200)) - 1\r
88 \r
89 /***************************************************************************//**\r
90  * User edit section- Edit sections below if required\r
91  */\r
92 #ifdef MSCC_STDIO_THRU_CORE_UART_APB\r
93 /*\r
94  * A base address mapping for the STDIO printf/scanf mapping to CortUARTapb\r
95  * must be provided if it is being used\r
96  *\r
97  * e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR\r
98  */\r
99 #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB0_BASE_ADDR\r
100 \r
101 #ifndef MSCC_STDIO_UART_BASE_ADDR\r
102 #error MSCC_STDIO_UART_BASE_ADDR not defined- e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR\r
103 #endif\r
104 \r
105 #ifndef MSCC_STDIO_BAUD_VALUE\r
106 /*\r
107  * The MSCC_STDIO_BAUD_VALUE define should be set in your project's settings to\r
108  * specify the baud value used by the standard output CoreUARTapb instance for\r
109  * generating the UART's baud rate if you want a different baud rate from the\r
110  * default of 115200 baud\r
111  */\r
112 #define MSCC_STDIO_BAUD_VALUE           115200\r
113 #endif  /*MSCC_STDIO_BAUD_VALUE*/\r
114 \r
115 #endif  /* end of MSCC_STDIO_THRU_CORE_UART_APB */\r
116 /*******************************************************************************\r
117  * End of user edit section\r
118  */\r
119 #endif /* HW_PLATFORM_H */\r
120 \r
121 \r