提交 94412784 编写于 作者: W William Wang

Merge remote-tracking branch 'origin/xs' into temp-auipc

......@@ -60,6 +60,10 @@ include Makefile.git
.DEFAULT_GOAL = app
ifdef XIANGSHAN
CFLAGS += -DXIANGSHAN=1
endif
# Compilation flags
CC = gcc
LD = gcc
......
......@@ -5,8 +5,6 @@
typedef void(*io_callback_t)(uint32_t, int, bool);
#define XIANGSHAN
#ifdef XIANGSHAN
// SD
......
......@@ -3,7 +3,11 @@
#include <common.h>
#define PMEM_SIZE (8 * 1024 * 1024 * 1024UL)
#ifdef _SHARE
#define PMEM_SIZE (8 * 1024 * 1024 * 1024UL)
#else
#define PMEM_SIZE (256 * 1024 * 1024UL)
#endif
void init_mem();
......@@ -16,7 +20,10 @@ word_t paddr_read(paddr_t addr, int len);
void paddr_write(paddr_t addr, word_t data, int len);
bool is_sfence_safe(paddr_t addr, int len);
#if _SHARE
#define DIFFTEST_STORE_COMMIT
#endif
#ifdef DIFFTEST_STORE_COMMIT
#define STORE_QUEUE_SIZE 48
......
......@@ -5,10 +5,9 @@
#include <device/alarm.h>
#include <SDL2/SDL.h>
#define XIANGSHAN
void init_alarm();
void init_serial();
void init_uartlite();
void init_timer();
void init_vga();
void init_i8042();
......@@ -56,9 +55,12 @@ void sdl_clear_event_queue() {
}
void init_device() {
init_serial();
#ifdef XIANGSHAN
init_vga();
#ifndef XIANGSHAN
init_uartlite();
#else
init_vga();
init_serial();
init_timer();
init_i8042();
init_audio();
......
#include <device/map.h>
#define CH_OFFSET 0
#define UARTLITE_RX_FIFO 0x0
#define UARTLITE_TX_FIFO 0x4
#define UARTLITE_STAT_REG 0x8
#define UARTLITE_CTRL_REG 0xc
#define UARTLITE_RST_FIFO 0x03
#define UARTLITE_TX_FULL 0x08
#define UARTLITE_RX_VALID 0x01
// #define QUEUE_SIZE 1024
// static char queue[QUEUE_SIZE] = {};
// static int f = 0, r = 0;
static uint8_t *serial_base = NULL;
// static void serial_enqueue(char ch) {
// int next = (r + 1) % QUEUE_SIZE;
// if (next != f) {
// // not full
// queue[r] = ch;
// r = next;
// }
// }
// static char serial_dequeue() {
// char ch = 0xff;
// extern uint32_t uptime();
// static uint32_t last = 0;
// uint32_t now = uptime();
// if (now > last) {
// Log("now = %d", now);
// last = now;
// }
// // 90s after starting
// if (now > 90) {
// if (f != r) {
// ch = queue[f];
// f = (f + 1) % QUEUE_SIZE;
// }
// }
// return ch;
// }
static void serial_io_handler(uint32_t offset, int len, bool is_write) {
assert(len == 1);
switch (offset) {
/* We bind the serial port with the host stdout in NEMU. */
case UARTLITE_TX_FIFO:
if (is_write) putc(serial_base[UARTLITE_TX_FIFO], stderr);
else panic("Cannot read UARTLITE_TX_FIFO");
break;
case UARTLITE_STAT_REG:
if (!is_write) serial_base[UARTLITE_STAT_REG] = 0x0;
break;
}
}
// static void preset_input() {
// char buf[] = debian_cmd;
// int i;
// for (i = 0; i < strlen(buf); i ++) {
// serial_enqueue(buf[i]);
// }
// }
void init_uartlite() {
serial_base = new_space(0xd);
add_pio_map("uartlite", SERIAL_PORT, serial_base, 0xd, serial_io_handler);
add_mmio_map("uartlite", SERIAL_MMIO, serial_base, 0xd, serial_io_handler);
// preset_input();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册