]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_Renode_Emulator_SoftConsole/hw_platform.h
Retarget Softconsole RISC-V demo from IGLOO2 to Renode as it can have more RAM and...
[freertos] / FreeRTOS / Demo / RISC-V_Renode_Emulator_SoftConsole / hw_platform.h
1 /*******************************************************************************\r
2  * (c) Copyright 2016-2017 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: 9587 $\r
8  * SVN $Date: 2017-11-16 12:53:31 +0530 (Thu, 16 Nov 2017) $\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                    70000000UL\r
38 #endif\r
39 \r
40 /***************************************************************************//**\r
41  * Non-memory Peripheral base addresses\r
42  * Format of define is:\r
43  * <corename>_<instance>_BASE_ADDR\r
44  */\r
45 #define COREUARTAPB0_BASE_ADDR          0x70001000UL\r
46 #define COREGPIO_IN_BASE_ADDR           0x70002000UL\r
47 #define CORETIMER0_BASE_ADDR            0x70003000UL\r
48 #define CORETIMER1_BASE_ADDR            0x70004000UL\r
49 #define COREGPIO_OUT_BASE_ADDR          0x70005000UL\r
50 #define FLASH_CORE_SPI_BASE             0x70006000UL\r
51 #define CORE16550_BASE_ADDR             0x70007000UL\r
52 \r
53 /***************************************************************************//**\r
54  * Peripheral Interrupts are mapped to the corresponding Mi-V Soft processor\r
55  * interrupt from the Libero design.\r
56  * There can be up to 31 external interrupts (IRQ[30:0] pins) on the Mi-V Soft\r
57  * processor.The Mi-V Soft processor external interrupts are defined in the\r
58  * riscv_plic.h\r
59  * These are of the form\r
60  * typedef enum\r
61 {\r
62     NoInterrupt_IRQn = 0,\r
63     External_1_IRQn  = 1,\r
64     External_2_IRQn  = 2,\r
65     .\r
66     .\r
67     .\r
68     External_31_IRQn = 31\r
69 } IRQn_Type;\r
70  \r
71  The interrupt 0 on RISC-V processor is not used. The pin IRQ[0] should map to\r
72  External_1_IRQn likewise IRQ[30] should map to External_31_IRQn\r
73  * Format of define is:\r
74  * <corename>_<instance>_<core interrupt name>\r
75  */\r
76 \r
77 #define TIMER0_IRQn                     External_30_IRQn\r
78 #define TIMER1_IRQn                     External_31_IRQn\r
79 \r
80 /****************************************************************************\r
81  * Baud value to achieve a 115200 baud rate with a 83MHz system clock.\r
82  * This value is calculated using the following equation:\r
83  *      BAUD_VALUE = (CLOCK / (16 * BAUD_RATE)) - 1\r
84  *****************************************************************************/\r
85 #define BAUD_VALUE_115200               (SYS_CLK_FREQ / (16 * 115200)) - 1\r
86 \r
87 /***************************************************************************//**\r
88  * User edit section- Edit sections below if required\r
89  */\r
90 #ifdef MSCC_STDIO_THRU_CORE_UART_APB\r
91 /*\r
92  * A base address mapping for the STDIO printf/scanf mapping to CortUARTapb\r
93  * must be provided if it is being used\r
94  *\r
95  * e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR\r
96  */\r
97 #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB0_BASE_ADDR\r
98 \r
99 #ifndef MSCC_STDIO_UART_BASE_ADDR\r
100 #error MSCC_STDIO_UART_BASE_ADDR not defined- e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR\r
101 #endif\r
102 \r
103 #ifndef MSCC_STDIO_BAUD_VALUE\r
104 /*\r
105  * The MSCC_STDIO_BAUD_VALUE define should be set in your project's settings to\r
106  * specify the baud value used by the standard output CoreUARTapb instance for\r
107  * generating the UART's baud rate if you want a different baud rate from the\r
108  * default of 115200 baud\r
109  */\r
110 #define MSCC_STDIO_BAUD_VALUE           115200\r
111 #endif  /*MSCC_STDIO_BAUD_VALUE*/\r
112 \r
113 #endif  /* end of MSCC_STDIO_THRU_CORE_UART_APB */\r
114 /*******************************************************************************\r
115  * End of user edit section\r
116  */\r
117 #endif /* HW_PLATFORM_H */\r
118 \r
119 \r