usb: add empty usb implementation

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-01-01 22:37:14 +08:00
parent ebed2b919f
commit b31c0213b5
3 changed files with 32 additions and 9 deletions

14
include/usb.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef __USB_H
#define __USB_H
#ifdef __cplusplus
extern "C" {
#endif
void usb_isr(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,17 +1,21 @@
#include <stdio.h>
#include <irq.h>
#include <printf.h>
#include <uart.h>
#include <irq.h>
#include <usb.h>
#include <generated/csr.h>
void isr(void) {
unsigned int irqs;
irqs = irq_pending() & irq_getmask();
if(irqs & (1 << UART_INTERRUPT))
uart_isr();
unsigned int irqs;
irqs = irq_pending() & irq_getmask();
if (irqs & (1 << USB_INTERRUPT))
usb_isr();
if (irqs & (1 << UART_INTERRUPT))
uart_isr();
}
static void rv_putchar(void *ignored, char c) {
@ -21,8 +25,8 @@ static void rv_putchar(void *ignored, char c) {
static void init(void) {
irq_setmask(0);
irq_setie(1);
uart_init();
irq_setie(1);
uart_init();
init_printf(NULL, rv_putchar);
}

5
src/usb.c Normal file
View File

@ -0,0 +1,5 @@
#include <usb.h>
void usb_isr(void) {
return;
}