summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Cross <[email protected]>2019-10-31 08:34:35 +0800
committerSean Cross <[email protected]>2019-11-13 09:08:01 -0800
commit83bca4a74fce268082996ac098e998445a8a9987 (patch)
treef9b878574e31fded355a9631b7ed219389f760b2
parent843136d0e4467e1c554f246d1b69fed3172b6cc0 (diff)
fomu: semi-working commit
Signed-off-by: Sean Cross <[email protected]>
-rw-r--r--hw/bsp/fomu/bsp.c7
-rw-r--r--hw/bsp/fomu/include/csr.h187
2 files changed, 92 insertions, 102 deletions
diff --git a/hw/bsp/fomu/bsp.c b/hw/bsp/fomu/bsp.c
index 2bba0ce2c..3910cff44 100644
--- a/hw/bsp/fomu/bsp.c
+++ b/hw/bsp/fomu/bsp.c
@@ -39,8 +39,9 @@ void hal_dcd_isr(uint8_t rhport);
void mputs(const char *str) {
(void)str;
while (*str) {
- if (! (messible_status_read() & CSR_MESSIBLE_STATUS_FULL_OFFSET))
- messible_in_write(*str);
+ while ( (messible_status_read() & CSR_MESSIBLE_STATUS_FULL_OFFSET))
+ ;
+ messible_in_write(*str);
str++;
}
}
@@ -54,7 +55,7 @@ void fomu_error(uint32_t line)
{
(void)line;
TU_BREAKPOINT();
- while (1) {}
+ // while (1) {}
}
volatile uint32_t system_ticks = 0;
diff --git a/hw/bsp/fomu/include/csr.h b/hw/bsp/fomu/include/csr.h
index b9bffada3..bcd48eb42 100644
--- a/hw/bsp/fomu/include/csr.h
+++ b/hw/bsp/fomu/include/csr.h
@@ -1,5 +1,5 @@
//--------------------------------------------------------------------------------
-// Auto-generated by Migen (f4fcd10) & LiteX (1425a68d) on 2019-10-11 22:01:17
+// Auto-generated by Migen (f4fcd10) & LiteX (1425a68d) on 2019-10-30 21:48:57
//--------------------------------------------------------------------------------
#ifndef __GENERATED_CSR_H
#define __GENERATED_CSR_H
@@ -351,93 +351,92 @@ static inline unsigned char usb_pullup_out_read(void) {
static inline void usb_pullup_out_write(unsigned char value) {
csr_writel(value, 0xe0004800L);
}
-#define CSR_USB_SETUP_DATA_ADDR 0xe0004804L
+#define CSR_USB_ADDRESS_ADDR 0xe0004804L
+#define CSR_USB_ADDRESS_SIZE 1
+static inline unsigned char usb_address_read(void) {
+ unsigned char r = csr_readl(0xe0004804L);
+ return r;
+}
+static inline void usb_address_write(unsigned char value) {
+ csr_writel(value, 0xe0004804L);
+}
+#define CSR_USB_ADDRESS_ADDR_OFFSET 0
+#define CSR_USB_ADDRESS_ADDR_SIZE 7
+#define CSR_USB_SETUP_DATA_ADDR 0xe0004808L
#define CSR_USB_SETUP_DATA_SIZE 1
static inline unsigned char usb_setup_data_read(void) {
- unsigned char r = csr_readl(0xe0004804L);
+ unsigned char r = csr_readl(0xe0004808L);
return r;
}
#define CSR_USB_SETUP_DATA_DATA_OFFSET 0
#define CSR_USB_SETUP_DATA_DATA_SIZE 8
-#define CSR_USB_SETUP_CTRL_ADDR 0xe0004808L
+#define CSR_USB_SETUP_CTRL_ADDR 0xe000480cL
#define CSR_USB_SETUP_CTRL_SIZE 1
static inline unsigned char usb_setup_ctrl_read(void) {
- unsigned char r = csr_readl(0xe0004808L);
+ unsigned char r = csr_readl(0xe000480cL);
return r;
}
static inline void usb_setup_ctrl_write(unsigned char value) {
- csr_writel(value, 0xe0004808L);
+ csr_writel(value, 0xe000480cL);
}
-#define CSR_USB_SETUP_CTRL_HANDLED_OFFSET 1
-#define CSR_USB_SETUP_CTRL_HANDLED_SIZE 1
-#define CSR_USB_SETUP_CTRL_RESET_OFFSET 2
+#define CSR_USB_SETUP_CTRL_ACK_OFFSET 1
+#define CSR_USB_SETUP_CTRL_ACK_SIZE 1
+#define CSR_USB_SETUP_CTRL_RESET_OFFSET 5
#define CSR_USB_SETUP_CTRL_RESET_SIZE 1
-#define CSR_USB_SETUP_STATUS_ADDR 0xe000480cL
+#define CSR_USB_SETUP_STATUS_ADDR 0xe0004810L
#define CSR_USB_SETUP_STATUS_SIZE 1
static inline unsigned char usb_setup_status_read(void) {
- unsigned char r = csr_readl(0xe000480cL);
+ unsigned char r = csr_readl(0xe0004810L);
return r;
}
-#define CSR_USB_SETUP_STATUS_HAVE_OFFSET 0
-#define CSR_USB_SETUP_STATUS_HAVE_SIZE 1
-#define CSR_USB_SETUP_STATUS_IS_IN_OFFSET 1
-#define CSR_USB_SETUP_STATUS_IS_IN_SIZE 1
-#define CSR_USB_SETUP_STATUS_EPNO_OFFSET 2
+#define CSR_USB_SETUP_STATUS_EPNO_OFFSET 0
#define CSR_USB_SETUP_STATUS_EPNO_SIZE 4
-#define CSR_USB_SETUP_STATUS_PEND_OFFSET 6
+#define CSR_USB_SETUP_STATUS_HAVE_OFFSET 4
+#define CSR_USB_SETUP_STATUS_HAVE_SIZE 1
+#define CSR_USB_SETUP_STATUS_PEND_OFFSET 5
#define CSR_USB_SETUP_STATUS_PEND_SIZE 1
+#define CSR_USB_SETUP_STATUS_IS_IN_OFFSET 6
+#define CSR_USB_SETUP_STATUS_IS_IN_SIZE 1
#define CSR_USB_SETUP_STATUS_DATA_OFFSET 7
#define CSR_USB_SETUP_STATUS_DATA_SIZE 1
-#define CSR_USB_SETUP_EV_STATUS_ADDR 0xe0004810L
+#define CSR_USB_SETUP_EV_STATUS_ADDR 0xe0004814L
#define CSR_USB_SETUP_EV_STATUS_SIZE 1
static inline unsigned char usb_setup_ev_status_read(void) {
- unsigned char r = csr_readl(0xe0004810L);
+ unsigned char r = csr_readl(0xe0004814L);
return r;
}
static inline void usb_setup_ev_status_write(unsigned char value) {
- csr_writel(value, 0xe0004810L);
+ csr_writel(value, 0xe0004814L);
}
-#define CSR_USB_SETUP_EV_PENDING_ADDR 0xe0004814L
+#define CSR_USB_SETUP_EV_PENDING_ADDR 0xe0004818L
#define CSR_USB_SETUP_EV_PENDING_SIZE 1
static inline unsigned char usb_setup_ev_pending_read(void) {
- unsigned char r = csr_readl(0xe0004814L);
+ unsigned char r = csr_readl(0xe0004818L);
return r;
}
static inline void usb_setup_ev_pending_write(unsigned char value) {
- csr_writel(value, 0xe0004814L);
+ csr_writel(value, 0xe0004818L);
}
-#define CSR_USB_SETUP_EV_ENABLE_ADDR 0xe0004818L
+#define CSR_USB_SETUP_EV_ENABLE_ADDR 0xe000481cL
#define CSR_USB_SETUP_EV_ENABLE_SIZE 1
static inline unsigned char usb_setup_ev_enable_read(void) {
- unsigned char r = csr_readl(0xe0004818L);
+ unsigned char r = csr_readl(0xe000481cL);
return r;
}
static inline void usb_setup_ev_enable_write(unsigned char value) {
- csr_writel(value, 0xe0004818L);
+ csr_writel(value, 0xe000481cL);
}
-#define CSR_USB_IN_DATA_ADDR 0xe000481cL
+#define CSR_USB_IN_DATA_ADDR 0xe0004820L
#define CSR_USB_IN_DATA_SIZE 1
static inline unsigned char usb_in_data_read(void) {
- unsigned char r = csr_readl(0xe000481cL);
+ unsigned char r = csr_readl(0xe0004820L);
return r;
}
static inline void usb_in_data_write(unsigned char value) {
- csr_writel(value, 0xe000481cL);
+ csr_writel(value, 0xe0004820L);
}
#define CSR_USB_IN_DATA_DATA_OFFSET 0
#define CSR_USB_IN_DATA_DATA_SIZE 8
-#define CSR_USB_IN_STATUS_ADDR 0xe0004820L
-#define CSR_USB_IN_STATUS_SIZE 1
-static inline unsigned char usb_in_status_read(void) {
- unsigned char r = csr_readl(0xe0004820L);
- return r;
-}
-#define CSR_USB_IN_STATUS_HAVE_OFFSET 0
-#define CSR_USB_IN_STATUS_HAVE_SIZE 1
-#define CSR_USB_IN_STATUS_IDLE_OFFSET 1
-#define CSR_USB_IN_STATUS_IDLE_SIZE 1
-#define CSR_USB_IN_STATUS_PEND_OFFSET 6
-#define CSR_USB_IN_STATUS_PEND_SIZE 1
#define CSR_USB_IN_CTRL_ADDR 0xe0004824L
#define CSR_USB_IN_CTRL_SIZE 1
static inline unsigned char usb_in_ctrl_read(void) {
@@ -447,61 +446,59 @@ static inline unsigned char usb_in_ctrl_read(void) {
static inline void usb_in_ctrl_write(unsigned char value) {
csr_writel(value, 0xe0004824L);
}
-#define CSR_USB_IN_CTRL_EP_OFFSET 0
-#define CSR_USB_IN_CTRL_EP_SIZE 4
-#define CSR_USB_IN_CTRL_STALL_OFFSET 4
-#define CSR_USB_IN_CTRL_STALL_SIZE 1
+#define CSR_USB_IN_CTRL_EPNO_OFFSET 0
+#define CSR_USB_IN_CTRL_EPNO_SIZE 4
#define CSR_USB_IN_CTRL_RESET_OFFSET 5
#define CSR_USB_IN_CTRL_RESET_SIZE 1
-#define CSR_USB_IN_EV_STATUS_ADDR 0xe0004828L
+#define CSR_USB_IN_CTRL_STALL_OFFSET 6
+#define CSR_USB_IN_CTRL_STALL_SIZE 1
+#define CSR_USB_IN_STATUS_ADDR 0xe0004828L
+#define CSR_USB_IN_STATUS_SIZE 1
+static inline unsigned char usb_in_status_read(void) {
+ unsigned char r = csr_readl(0xe0004828L);
+ return r;
+}
+#define CSR_USB_IN_STATUS_IDLE_OFFSET 0
+#define CSR_USB_IN_STATUS_IDLE_SIZE 1
+#define CSR_USB_IN_STATUS_HAVE_OFFSET 4
+#define CSR_USB_IN_STATUS_HAVE_SIZE 1
+#define CSR_USB_IN_STATUS_PEND_OFFSET 5
+#define CSR_USB_IN_STATUS_PEND_SIZE 1
+#define CSR_USB_IN_EV_STATUS_ADDR 0xe000482cL
#define CSR_USB_IN_EV_STATUS_SIZE 1
static inline unsigned char usb_in_ev_status_read(void) {
- unsigned char r = csr_readl(0xe0004828L);
+ unsigned char r = csr_readl(0xe000482cL);
return r;
}
static inline void usb_in_ev_status_write(unsigned char value) {
- csr_writel(value, 0xe0004828L);
+ csr_writel(value, 0xe000482cL);
}
-#define CSR_USB_IN_EV_PENDING_ADDR 0xe000482cL
+#define CSR_USB_IN_EV_PENDING_ADDR 0xe0004830L
#define CSR_USB_IN_EV_PENDING_SIZE 1
static inline unsigned char usb_in_ev_pending_read(void) {
- unsigned char r = csr_readl(0xe000482cL);
+ unsigned char r = csr_readl(0xe0004830L);
return r;
}
static inline void usb_in_ev_pending_write(unsigned char value) {
- csr_writel(value, 0xe000482cL);
+ csr_writel(value, 0xe0004830L);
}
-#define CSR_USB_IN_EV_ENABLE_ADDR 0xe0004830L
+#define CSR_USB_IN_EV_ENABLE_ADDR 0xe0004834L
#define CSR_USB_IN_EV_ENABLE_SIZE 1
static inline unsigned char usb_in_ev_enable_read(void) {
- unsigned char r = csr_readl(0xe0004830L);
+ unsigned char r = csr_readl(0xe0004834L);
return r;
}
static inline void usb_in_ev_enable_write(unsigned char value) {
- csr_writel(value, 0xe0004830L);
+ csr_writel(value, 0xe0004834L);
}
-#define CSR_USB_OUT_DATA_ADDR 0xe0004834L
+#define CSR_USB_OUT_DATA_ADDR 0xe0004838L
#define CSR_USB_OUT_DATA_SIZE 1
static inline unsigned char usb_out_data_read(void) {
- unsigned char r = csr_readl(0xe0004834L);
+ unsigned char r = csr_readl(0xe0004838L);
return r;
}
#define CSR_USB_OUT_DATA_DATA_OFFSET 0
#define CSR_USB_OUT_DATA_DATA_SIZE 8
-#define CSR_USB_OUT_STATUS_ADDR 0xe0004838L
-#define CSR_USB_OUT_STATUS_SIZE 1
-static inline unsigned char usb_out_status_read(void) {
- unsigned char r = csr_readl(0xe0004838L);
- return r;
-}
-#define CSR_USB_OUT_STATUS_HAVE_OFFSET 0
-#define CSR_USB_OUT_STATUS_HAVE_SIZE 1
-#define CSR_USB_OUT_STATUS_IDLE_OFFSET 1
-#define CSR_USB_OUT_STATUS_IDLE_SIZE 1
-#define CSR_USB_OUT_STATUS_EPNO_OFFSET 2
-#define CSR_USB_OUT_STATUS_EPNO_SIZE 4
-#define CSR_USB_OUT_STATUS_PEND_OFFSET 6
-#define CSR_USB_OUT_STATUS_PEND_SIZE 1
#define CSR_USB_OUT_CTRL_ADDR 0xe000483cL
#define CSR_USB_OUT_CTRL_SIZE 1
static inline unsigned char usb_out_ctrl_read(void) {
@@ -511,23 +508,26 @@ static inline unsigned char usb_out_ctrl_read(void) {
static inline void usb_out_ctrl_write(unsigned char value) {
csr_writel(value, 0xe000483cL);
}
-#define CSR_USB_OUT_CTRL_ENABLE_OFFSET 1
+#define CSR_USB_OUT_CTRL_EPNO_OFFSET 0
+#define CSR_USB_OUT_CTRL_EPNO_SIZE 4
+#define CSR_USB_OUT_CTRL_ENABLE_OFFSET 4
#define CSR_USB_OUT_CTRL_ENABLE_SIZE 1
-#define CSR_USB_OUT_CTRL_RESET_OFFSET 2
+#define CSR_USB_OUT_CTRL_RESET_OFFSET 5
#define CSR_USB_OUT_CTRL_RESET_SIZE 1
-#define CSR_USB_OUT_STALL_ADDR 0xe0004840L
-#define CSR_USB_OUT_STALL_SIZE 1
-static inline unsigned char usb_out_stall_read(void) {
+#define CSR_USB_OUT_CTRL_STALL_OFFSET 6
+#define CSR_USB_OUT_CTRL_STALL_SIZE 1
+#define CSR_USB_OUT_STATUS_ADDR 0xe0004840L
+#define CSR_USB_OUT_STATUS_SIZE 1
+static inline unsigned char usb_out_status_read(void) {
unsigned char r = csr_readl(0xe0004840L);
return r;
}
-static inline void usb_out_stall_write(unsigned char value) {
- csr_writel(value, 0xe0004840L);
-}
-#define CSR_USB_OUT_STALL_EPNO_OFFSET 0
-#define CSR_USB_OUT_STALL_EPNO_SIZE 4
-#define CSR_USB_OUT_STALL_STALL_OFFSET 4
-#define CSR_USB_OUT_STALL_STALL_SIZE 1
+#define CSR_USB_OUT_STATUS_EPNO_OFFSET 0
+#define CSR_USB_OUT_STATUS_EPNO_SIZE 4
+#define CSR_USB_OUT_STATUS_HAVE_OFFSET 4
+#define CSR_USB_OUT_STATUS_HAVE_SIZE 1
+#define CSR_USB_OUT_STATUS_PEND_OFFSET 5
+#define CSR_USB_OUT_STATUS_PEND_SIZE 1
#define CSR_USB_OUT_EV_STATUS_ADDR 0xe0004844L
#define CSR_USB_OUT_EV_STATUS_SIZE 1
static inline unsigned char usb_out_ev_status_read(void) {
@@ -555,29 +555,18 @@ static inline unsigned char usb_out_ev_enable_read(void) {
static inline void usb_out_ev_enable_write(unsigned char value) {
csr_writel(value, 0xe000484cL);
}
-#define CSR_USB_ADDRESS_ADDR 0xe0004850L
-#define CSR_USB_ADDRESS_SIZE 1
-static inline unsigned char usb_address_read(void) {
+#define CSR_USB_OUT_ENABLE_STATUS_ADDR 0xe0004850L
+#define CSR_USB_OUT_ENABLE_STATUS_SIZE 1
+static inline unsigned char usb_out_enable_status_read(void) {
unsigned char r = csr_readl(0xe0004850L);
return r;
}
-static inline void usb_address_write(unsigned char value) {
- csr_writel(value, 0xe0004850L);
-}
-#define CSR_USB_ADDRESS_ADDR_OFFSET 0
-#define CSR_USB_ADDRESS_ADDR_SIZE 7
-#define CSR_USB_STAGE_NUM_ADDR 0xe0004854L
-#define CSR_USB_STAGE_NUM_SIZE 1
-static inline unsigned char usb_stage_num_read(void) {
+#define CSR_USB_OUT_STALL_STATUS_ADDR 0xe0004854L
+#define CSR_USB_OUT_STALL_STATUS_SIZE 1
+static inline unsigned char usb_out_stall_status_read(void) {
unsigned char r = csr_readl(0xe0004854L);
return r;
}
-#define CSR_USB_LAST_STAGE_NUM_ADDR 0xe0004858L
-#define CSR_USB_LAST_STAGE_NUM_SIZE 1
-static inline unsigned char usb_last_stage_num_read(void) {
- unsigned char r = csr_readl(0xe0004858L);
- return r;
-}
/* version */
#define CSR_VERSION_BASE 0xe0007000L