Changes in / [7102aa5:c92c13f] in mainline
- Location:
- uspace/drv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
r7102aa5 rc92c13f 45 45 #include "hc.h" 46 46 47 static int dummy_reset(int foo, void *arg); 48 static int interrupt_emulator(hc_t *instance); 47 static int dummy_reset(int foo, void *arg) 48 { 49 hc_t *hc = (hc_t*)arg; 50 assert(hc); 51 hc->rh.address = 0; 52 return EOK; 53 } 49 54 /*----------------------------------------------------------------------------*/ 50 55 int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev, … … 61 66 instance->ddf_instance = fun; 62 67 usb_device_keeper_init(&instance->manager); 63 64 if (!interrupts) {65 instance->interrupt_emulator =66 fibril_create((int(*)(void*))interrupt_emulator, instance);67 fibril_add_ready(instance->interrupt_emulator);68 }69 68 70 69 … … 100 99 ret = usb_hc_new_device_wrapper(dev, &conn, USB_SPEED_FULL, dummy_reset, 101 100 0, instance, &address, &handle, NULL, NULL, NULL); 102 if (ret != EOK) { 103 usb_log_error("Failed to add rh device.\n"); 104 instance->rh.address = -1; 105 return ret; 106 } 101 CHECK_RET_RETURN(ret, "Failed to add rh device.\n"); 107 102 108 103 ret = usb_hc_connection_close(&conn); … … 122 117 } 123 118 /*----------------------------------------------------------------------------*/ 124 void hc_interrupt(hc_t *instance, uint 32_t status)119 void hc_interrupt(hc_t *instance, uint16_t status) 125 120 { 126 121 assert(instance); 127 if (status == 0) 128 return; 129 if (status & IS_RHSC) 130 rh_interrupt(&instance->rh); 131 132 /* TODO: Check for further interrupt causes */ 122 /* TODO: Check for interrupt cause */ 123 rh_interrupt(&instance->rh); 133 124 /* TODO: implement */ 134 }135 /*----------------------------------------------------------------------------*/136 static int dummy_reset(int foo, void *arg)137 {138 hc_t *hc = (hc_t*)arg;139 assert(hc);140 hc->rh.address = 0;141 return EOK;142 }143 /*----------------------------------------------------------------------------*/144 static int interrupt_emulator(hc_t *instance)145 {146 assert(instance);147 usb_log_info("Started interrupt emulator.\n");148 while (1) {149 uint32_t status = instance->registers->interrupt_status;150 instance->registers->interrupt_status = status;151 hc_interrupt(instance, status);152 async_usleep(1000);153 }154 return EOK;155 125 } 156 126 /** -
uspace/drv/ohci/hc.h
r7102aa5 rc92c13f 54 54 ddf_fun_t *ddf_instance; 55 55 usb_device_keeper_t manager; 56 fid_t interrupt_emulator;57 56 } hc_t; 58 57 … … 64 63 int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch); 65 64 66 void hc_interrupt(hc_t *instance, uint 32_t status);65 void hc_interrupt(hc_t *instance, uint16_t status); 67 66 68 67 /** Safely dispose host controller internal structures -
uspace/drv/ohci/ohci_regs.h
r7102aa5 rc92c13f 43 43 volatile uint32_t command_status; 44 44 volatile uint32_t interrupt_status; 45 #define IS_SO (1 << 0)46 #define IS_WDH (1 << 1)47 #define IS_SF (1 << 2)48 #define IS_RD (1 << 3)49 #define IS_UE (1 << 4)50 #define IS_FNO (1 << 5)51 #define IS_RHSC (1 << 6)52 #define IS_OC (1 << 30)53 45 volatile uint32_t interupt_enable; 54 46 #define IE_SO (1 << 0) -
uspace/drv/uhci-hcd/uhci_hc.c
r7102aa5 rc92c13f 121 121 fibril_create(uhci_hc_interrupt_emulator, instance); 122 122 fibril_add_ready(instance->cleaner); 123 } else {124 /* TODO: enable interrupts here */125 123 } 126 124
Note:
See TracChangeset
for help on using the changeset viewer.