File tree Expand file tree Collapse file tree 9 files changed +142
-1
lines changed Expand file tree Collapse file tree 9 files changed +142
-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] QEMU 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_STATE_TX_BUF_FULL (1UL << 0)
10+ #define CMSDK_STATE_TX_BUF_OVERRUN (1UL << 2)
11+ #define CMSDK_STATE_RX_BUF_OVERRUN (1UL << 3)
12+ #define CMSDK_CTRL_TXEN (1UL << 0)
13+
14+ void uart_init (volatile struct cmsdk_uart_hw * ptr_uart )
15+ {
16+ ptr_uart -> state = CMSDK_STATE_TX_BUF_OVERRUN | CMSDK_STATE_RX_BUF_OVERRUN ;
17+ ptr_uart -> intstatus = 0xf ;
18+ }
19+
20+ void uart_enable (volatile struct cmsdk_uart_hw * ptr_uart )
21+ {
22+ ptr_uart -> ctrl = CMSDK_CTRL_TXEN ;
23+ }
24+
25+ void uart_putc (volatile struct cmsdk_uart_hw * ptr_uart , int8_t c )
26+ {
27+ while (ptr_uart -> state & CMSDK_STATE_TX_BUF_FULL ) { }
28+ ptr_uart -> data = (uint32_t )c ;
29+ }
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