File tree Expand file tree Collapse file tree 9 files changed +147
-1
lines changed Expand file tree Collapse file tree 9 files changed +147
-1
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,9 @@ platforms is presented below:
5656
5757** Armv8-R AArch32**
5858- [x] Arm Fixed Virtual Platforms
59+ - [x] Arm MPS3-AN536
5960- [ ] NXP S32Z/E
6061- [ ] Renesas RZT2M
61- - [ ] QEMU MPS3-AN536
6262
6363** RISC-V RV64**
6464- [x] QEMU virt
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright (c) Bao Project and Contributors. All rights reserved.
4+ */
5+
6+ #include <bao.h>
7+ #include <drivers/cmsdk_uart.h>
8+
9+ #define CMSDK_UART_STATE_TX_BUF_FULL (1UL << 0)
10+ #define CMSDK_UART_STATE_TX_BUF_OVERRUN (1UL << 2)
11+ #define CMSDK_UART_STATE_RX_BUF_OVERRUN (1UL << 3)
12+ #define CMSDK_UART_CTRL_TXEN (1UL << 0)
13+ #define CMSDK_UART_INTSTATUS_TX_IRQ (1UL << 0)
14+ #define CMSDK_UART_INTSTATUS_RX_IRQ (1UL << 1)
15+ #define CMSDK_UART_INTSTATUS_TX_OVERRUN_IRQ (1UL << 2)
16+ #define CMSDK_UART_INTSTATUS_RX_OVERRUN_IRQ (1UL << 3)
17+
18+ void uart_init (volatile struct cmsdk_uart_hw * ptr_uart )
19+ {
20+ ptr_uart -> state = CMSDK_UART_STATE_TX_BUF_OVERRUN | CMSDK_UART_STATE_RX_BUF_OVERRUN ;
21+ ptr_uart -> intstatus = CMSDK_UART_INTSTATUS_TX_IRQ | CMSDK_UART_INTSTATUS_RX_IRQ |
22+ CMSDK_UART_INTSTATUS_TX_OVERRUN_IRQ | CMSDK_UART_INTSTATUS_RX_OVERRUN_IRQ ;
23+ }
24+
25+ void uart_enable (volatile struct cmsdk_uart_hw * ptr_uart )
26+ {
27+ ptr_uart -> ctrl = CMSDK_UART_CTRL_TXEN ;
28+ }
29+
30+ void uart_putc (volatile struct cmsdk_uart_hw * ptr_uart , int8_t c )
31+ {
32+ while (ptr_uart -> state & CMSDK_UART_STATE_TX_BUF_FULL ) { }
33+ ptr_uart -> data = (uint32_t )c ;
34+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright (c) Bao Project and Contributors. All rights reserved.
4+ */
5+
6+ #ifndef __CMSDK_UART_H_
7+ #define __CMSDK_UART_H_
8+
9+ #include <stdint.h>
10+
11+ struct cmsdk_uart_hw {
12+ volatile uint32_t data ;
13+ volatile uint32_t state ;
14+ volatile uint32_t ctrl ;
15+ volatile uint32_t intstatus ;
16+ volatile uint32_t bauddiv ;
17+ } __attribute__((packed ));
18+
19+ typedef struct cmsdk_uart_hw bao_uart_t ;
20+
21+ void uart_enable (volatile struct cmsdk_uart_hw * ptr_uart );
22+ void uart_init (volatile struct cmsdk_uart_hw * ptr_uart );
23+ void uart_putc (volatile struct cmsdk_uart_hw * ptr_uart , int8_t c );
24+
25+ #endif /* __CMSDK_UART_H_ */
Original file line number Diff line number Diff line change 1+ # # SPDX-License-Identifier: Apache-2.0
2+ # # Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+ drivers-objs-y+ =cmsdk_uart/cmsdk_uart.o
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright (c) Bao Project and Contributors. All rights reserved.
4+ */
5+
6+ #ifndef __PLAT_PLATFORM_H__
7+ #define __PLAT_PLATFORM_H__
8+
9+ #include <drivers/cmsdk_uart.h>
10+
11+ #endif
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright (c) Bao Project and Contributors. All rights reserved.
4+ */
5+
6+ #ifndef __PLAT_PSCI_H__
7+ #define __PLAT_PSCI_H__
8+
9+ #define PSCI_POWER_STATE_LVL_0 0x0000000 // TBD
10+ #define PSCI_POWER_STATE_LVL_1 0x1000000 // TBD
11+ #define PSCI_POWER_STATE_LVL_2 0x2000000 // TBD
12+ #define PSCI_STATE_TYPE_STANDBY 0x00000 // TBD
13+ #define PSCI_STATE_TYPE_POWERDOWN (0UL << 30) // TBD
14+ #define PSCI_STATE_TYPE_BIT (0UL << 30) // TBD
15+
16+ #endif // __PLAT_PSCI_H__
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-License-Identifier: Apache-2.0
3+ * Copyright (c) Bao Project and Contributors. All rights reserved.
4+ */
5+
6+ #include <platform.h>
7+
8+ struct platform platform = {
9+
10+ .cpu_num = 2 ,
11+ .cpu_master_fixed = true,
12+ .cpu_master = 0 ,
13+
14+ .region_num = 1 ,
15+ .regions = (struct mem_region []) {
16+ {
17+ .base = 0x20000000 ,
18+ .size = 0x80000000 ,
19+ }
20+ },
21+
22+ .console = {
23+ .base = 0xE0205000 , // UART2
24+ },
25+
26+ .arch = {
27+ .gic = {
28+ .gicd_addr = 0xF0000000 ,
29+ .gicr_addr = 0xF0100000 ,
30+ .maintenance_id = 25 ,
31+ },
32+ },
33+
34+ };
Original file line number Diff line number Diff line change 1+ # # SPDX-License-Identifier: Apache-2.0
2+ # # Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+ boards-objs-y+ =mps3_desc.o
Original file line number Diff line number Diff line change 1+ # # SPDX-License-Identifier: Apache-2.0
2+ # # Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
5+ ARCH: =armv8
6+ ARCH_SUB: =aarch32
7+ ARCH_PROFILE: =armv8-r
8+
9+ GIC_VERSION: =GICV3
10+
11+ drivers = cmsdk_uart
12+
13+ platform_description: =mps3_desc.c
14+
15+ platform-cppflags =
16+ platform-cflags = -gdwarf-4
17+ platform-asflags =
18+ platform-ldflags =
You can’t perform that action at this time.
0 commit comments