foboot: use endpoint-based csr files
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
		@@ -209,80 +209,146 @@ static inline void uart_phy_tuning_word_write(unsigned int value) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* usb */
 | 
					/* usb */
 | 
				
			||||||
#define CSR_USB_BASE 0xe0005000
 | 
					#define CSR_USB_BASE 0xe0005000
 | 
				
			||||||
#define CSR_USB_OBUF_HEAD_ADDR 0xe0005000
 | 
					#define CSR_USB_PULLUP_OUT_ADDR 0xe0005000
 | 
				
			||||||
#define CSR_USB_OBUF_HEAD_SIZE 1
 | 
					#define CSR_USB_PULLUP_OUT_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_obuf_head_read(void) {
 | 
					static inline unsigned char usb_pullup_out_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005000);
 | 
						unsigned char r = csr_readl(0xe0005000);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_obuf_head_write(unsigned char value) {
 | 
					static inline void usb_pullup_out_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe0005000);
 | 
						csr_writel(value, 0xe0005000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_OBUF_EMPTY_ADDR 0xe0005004
 | 
					#define CSR_USB_EP_0_OUT_EV_STATUS_ADDR 0xe0005004
 | 
				
			||||||
#define CSR_USB_OBUF_EMPTY_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_EV_STATUS_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_obuf_empty_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_ev_status_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005004);
 | 
						unsigned char r = csr_readl(0xe0005004);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_ARM_ADDR 0xe0005008
 | 
					static inline void usb_ep_0_out_ev_status_write(unsigned char value) {
 | 
				
			||||||
#define CSR_USB_ARM_SIZE 1
 | 
						csr_writel(value, 0xe0005004);
 | 
				
			||||||
static inline unsigned char usb_arm_read(void) {
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_OUT_EV_PENDING_ADDR 0xe0005008
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_OUT_EV_PENDING_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_out_ev_pending_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005008);
 | 
						unsigned char r = csr_readl(0xe0005008);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_arm_write(unsigned char value) {
 | 
					static inline void usb_ep_0_out_ev_pending_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe0005008);
 | 
						csr_writel(value, 0xe0005008);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_IBUF_HEAD_ADDR 0xe000500c
 | 
					#define CSR_USB_EP_0_OUT_EV_ENABLE_ADDR 0xe000500c
 | 
				
			||||||
#define CSR_USB_IBUF_HEAD_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_EV_ENABLE_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_ibuf_head_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_ev_enable_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe000500c);
 | 
						unsigned char r = csr_readl(0xe000500c);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_ibuf_head_write(unsigned char value) {
 | 
					static inline void usb_ep_0_out_ev_enable_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe000500c);
 | 
						csr_writel(value, 0xe000500c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_IBUF_EMPTY_ADDR 0xe0005010
 | 
					#define CSR_USB_EP_0_OUT_LAST_TOK_ADDR 0xe0005010
 | 
				
			||||||
#define CSR_USB_IBUF_EMPTY_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_LAST_TOK_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_ibuf_empty_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_last_tok_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005010);
 | 
						unsigned char r = csr_readl(0xe0005010);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_PULLUP_OUT_ADDR 0xe0005014
 | 
					#define CSR_USB_EP_0_OUT_RESPOND_ADDR 0xe0005014
 | 
				
			||||||
#define CSR_USB_PULLUP_OUT_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_RESPOND_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_pullup_out_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_respond_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005014);
 | 
						unsigned char r = csr_readl(0xe0005014);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_pullup_out_write(unsigned char value) {
 | 
					static inline void usb_ep_0_out_respond_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe0005014);
 | 
						csr_writel(value, 0xe0005014);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_EV_STATUS_ADDR 0xe0005018
 | 
					#define CSR_USB_EP_0_OUT_DTB_ADDR 0xe0005018
 | 
				
			||||||
#define CSR_USB_EV_STATUS_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_DTB_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_ev_status_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_dtb_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005018);
 | 
						unsigned char r = csr_readl(0xe0005018);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_ev_status_write(unsigned char value) {
 | 
					static inline void usb_ep_0_out_dtb_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe0005018);
 | 
						csr_writel(value, 0xe0005018);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_EV_PENDING_ADDR 0xe000501c
 | 
					#define CSR_USB_EP_0_OUT_OBUF_HEAD_ADDR 0xe000501c
 | 
				
			||||||
#define CSR_USB_EV_PENDING_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_OBUF_HEAD_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_ev_pending_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_obuf_head_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe000501c);
 | 
						unsigned char r = csr_readl(0xe000501c);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_ev_pending_write(unsigned char value) {
 | 
					static inline void usb_ep_0_out_obuf_head_write(unsigned char value) {
 | 
				
			||||||
	csr_writel(value, 0xe000501c);
 | 
						csr_writel(value, 0xe000501c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_USB_EV_ENABLE_ADDR 0xe0005020
 | 
					#define CSR_USB_EP_0_OUT_OBUF_EMPTY_ADDR 0xe0005020
 | 
				
			||||||
#define CSR_USB_EV_ENABLE_SIZE 1
 | 
					#define CSR_USB_EP_0_OUT_OBUF_EMPTY_SIZE 1
 | 
				
			||||||
static inline unsigned char usb_ev_enable_read(void) {
 | 
					static inline unsigned char usb_ep_0_out_obuf_empty_read(void) {
 | 
				
			||||||
	unsigned char r = csr_readl(0xe0005020);
 | 
						unsigned char r = csr_readl(0xe0005020);
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
static inline void usb_ev_enable_write(unsigned char value) {
 | 
					#define CSR_USB_EP_0_IN_EV_STATUS_ADDR 0xe0005024
 | 
				
			||||||
	csr_writel(value, 0xe0005020);
 | 
					#define CSR_USB_EP_0_IN_EV_STATUS_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_ev_status_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005024);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_ev_status_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe0005024);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_EV_PENDING_ADDR 0xe0005028
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_EV_PENDING_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_ev_pending_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005028);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_ev_pending_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe0005028);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_EV_ENABLE_ADDR 0xe000502c
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_EV_ENABLE_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_ev_enable_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe000502c);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_ev_enable_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe000502c);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_LAST_TOK_ADDR 0xe0005030
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_LAST_TOK_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_last_tok_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005030);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_RESPOND_ADDR 0xe0005034
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_RESPOND_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_respond_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005034);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_respond_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe0005034);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_DTB_ADDR 0xe0005038
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_DTB_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_dtb_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005038);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_dtb_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe0005038);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_IBUF_HEAD_ADDR 0xe000503c
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_IBUF_HEAD_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_ibuf_head_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe000503c);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					static inline void usb_ep_0_in_ibuf_head_write(unsigned char value) {
 | 
				
			||||||
 | 
						csr_writel(value, 0xe000503c);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_IBUF_EMPTY_ADDR 0xe0005040
 | 
				
			||||||
 | 
					#define CSR_USB_EP_0_IN_IBUF_EMPTY_SIZE 1
 | 
				
			||||||
 | 
					static inline unsigned char usb_ep_0_in_ibuf_empty_read(void) {
 | 
				
			||||||
 | 
						unsigned char r = csr_readl(0xe0005040);
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#define CSR_IDENTIFIER_MEM_BASE 0xe0002000
 | 
					#define CSR_IDENTIFIER_MEM_BASE 0xe0002000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								input/top.bin
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								input/top.bin
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -11,8 +11,8 @@ void isr(void) {
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    irqs = irq_pending() & irq_getmask();
 | 
					    irqs = irq_pending() & irq_getmask();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (irqs & (1 << USB_INTERRUPT))
 | 
					//    if (irqs & (1 << USB_INTERRUPT))
 | 
				
			||||||
        usb_isr();
 | 
					//        usb_isr();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (irqs & (1 << UART_INTERRUPT))
 | 
					    if (irqs & (1 << UART_INTERRUPT))
 | 
				
			||||||
        uart_isr();
 | 
					        uart_isr();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user