1 /*******************************************************************************
\r
2 * (c) Copyright 2016-2018 Microsemi Corporation. All rights reserved.
\r
4 * Platform definitions
\r
5 * Version based on requirements of RISCV-HAL
\r
7 * SVN $Revision: 9946 $
\r
8 * SVN $Date: 2018-04-30 20:26:55 +0530 (Mon, 30 Apr 2018) $
\r
10 /*=========================================================================*//**
\r
11 @mainpage Sample file detailing how hw_platform.h should be constructed for
\r
12 the Mi-V processors.
\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
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
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
29 #ifndef HW_PLATFORM_H
\r
30 #define HW_PLATFORM_H
\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
36 #ifndef SYS_CLK_FREQ
\r
37 #define SYS_CLK_FREQ 83000000UL
\r
41 /***************************************************************************//**
\r
42 * Non-memory Peripheral base addresses
\r
43 * Format of define is:
\r
44 * <corename>_<instance>_BASE_ADDR
\r
46 #define COREUARTAPB0_BASE_ADDR 0x70001000UL
\r
47 #define COREGPIO_IN_BASE_ADDR 0x70002000UL
\r
48 #define CORETIMER0_BASE_ADDR 0x70003000UL
\r
49 #define CORETIMER1_BASE_ADDR 0x70004000UL
\r
50 #define COREGPIO_OUT_BASE_ADDR 0x70005000UL
\r
51 #define FLASH_CORE_SPI_BASE 0x70006000UL
\r
52 #define CORE16550_BASE_ADDR 0x70007000UL
\r
54 /***************************************************************************//**
\r
55 * Peripheral Interrupts are mapped to the corresponding Mi-V Soft processor
\r
56 * interrupt from the Libero design.
\r
57 * There can be up to 31 external interrupts (IRQ[30:0] pins) on the Mi-V Soft
\r
58 * processor.The Mi-V Soft processor external interrupts are defined in the
\r
60 * These are of the form
\r
63 NoInterrupt_IRQn = 0,
\r
64 External_1_IRQn = 1,
\r
65 External_2_IRQn = 2,
\r
69 External_31_IRQn = 31
\r
72 The interrupt 0 on RISC-V processor is not used. The pin IRQ[0] should map to
\r
73 External_1_IRQn likewise IRQ[30] should map to External_31_IRQn
\r
74 * Format of define is:
\r
75 * <corename>_<instance>_<core interrupt name>
\r
78 #define TIMER0_IRQn External_30_IRQn
\r
79 #define TIMER1_IRQn External_31_IRQn
\r
81 /****************************************************************************
\r
82 * Baud value to achieve a 115200 baud rate with a 83MHz system clock.
\r
83 * This value is calculated using the following equation:
\r
84 * BAUD_VALUE = (CLOCK / (16 * BAUD_RATE)) - 1
\r
85 *****************************************************************************/
\r
86 #define BAUD_VALUE_115200 (SYS_CLK_FREQ / (16 * 115200)) - 1
\r
88 /***************************************************************************//**
\r
89 * User edit section- Edit sections below if required
\r
91 #ifdef MSCC_STDIO_THRU_CORE_UART_APB
\r
93 * A base address mapping for the STDIO printf/scanf mapping to CortUARTapb
\r
94 * must be provided if it is being used
\r
96 * e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR
\r
98 #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB0_BASE_ADDR
\r
100 #ifndef MSCC_STDIO_UART_BASE_ADDR
\r
101 #error MSCC_STDIO_UART_BASE_ADDR not defined- e.g. #define MSCC_STDIO_UART_BASE_ADDR COREUARTAPB1_BASE_ADDR
\r
104 #ifndef MSCC_STDIO_BAUD_VALUE
\r
106 * The MSCC_STDIO_BAUD_VALUE define should be set in your project's settings to
\r
107 * specify the baud value used by the standard output CoreUARTapb instance for
\r
108 * generating the UART's baud rate if you want a different baud rate from the
\r
109 * default of 115200 baud
\r
111 #define MSCC_STDIO_BAUD_VALUE 115200
\r
112 #endif /*MSCC_STDIO_BAUD_VALUE*/
\r
114 #endif /* end of MSCC_STDIO_THRU_CORE_UART_APB */
\r
115 /*******************************************************************************
\r
116 * End of user edit section
\r
118 #endif /* HW_PLATFORM_H */
\r