Changeset 3e37964 in mainline
- Timestamp:
- 2011-03-06T17:39:23Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 98807e16
- Parents:
- edb5f837
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
redb5f837 r3e37964 49 49 static void batch_control(batch_t *instance, 50 50 usb_packet_id data_stage, usb_packet_id status_stage); 51 static void batch_data(batch_t *instance, usb_packet_id pid );51 static void batch_data(batch_t *instance, usb_packet_id pid, device_keeper_t *keeper); 52 52 static void batch_call_in(batch_t *instance); 53 53 static void batch_call_out(batch_t *instance); … … 194 194 } 195 195 /*----------------------------------------------------------------------------*/ 196 void batch_interrupt_in(batch_t *instance )197 { 198 assert(instance); 199 batch_data(instance, USB_PID_IN );196 void batch_interrupt_in(batch_t *instance, device_keeper_t *keeper) 197 { 198 assert(instance); 199 batch_data(instance, USB_PID_IN, keeper); 200 200 instance->next_step = batch_call_in_and_dispose; 201 201 usb_log_debug("Batch(%p) INTERRUPT IN initialized.\n", instance); … … 203 203 } 204 204 /*----------------------------------------------------------------------------*/ 205 void batch_interrupt_out(batch_t *instance )205 void batch_interrupt_out(batch_t *instance, device_keeper_t *keeper) 206 206 { 207 207 assert(instance); 208 208 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 209 batch_data(instance, USB_PID_OUT );209 batch_data(instance, USB_PID_OUT, keeper); 210 210 instance->next_step = batch_call_out_and_dispose; 211 211 usb_log_debug("Batch(%p) INTERRUPT OUT initialized.\n", instance); … … 213 213 } 214 214 /*----------------------------------------------------------------------------*/ 215 void batch_bulk_in(batch_t *instance )216 { 217 assert(instance); 218 batch_data(instance, USB_PID_IN );215 void batch_bulk_in(batch_t *instance, device_keeper_t *keeper) 216 { 217 assert(instance); 218 batch_data(instance, USB_PID_IN, keeper); 219 219 instance->next_step = batch_call_in_and_dispose; 220 220 usb_log_debug("Batch(%p) BULK IN initialized.\n", instance); … … 222 222 } 223 223 /*----------------------------------------------------------------------------*/ 224 void batch_bulk_out(batch_t *instance )224 void batch_bulk_out(batch_t *instance, device_keeper_t *keeper) 225 225 { 226 226 assert(instance); 227 227 memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size); 228 batch_data(instance, USB_PID_OUT );228 batch_data(instance, USB_PID_OUT, keeper); 229 229 instance->next_step = batch_call_out_and_dispose; 230 230 usb_log_debug("Batch(%p) BULK OUT initialized.\n", instance); … … 232 232 } 233 233 /*----------------------------------------------------------------------------*/ 234 static void batch_data(batch_t *instance, usb_packet_id pid)234 void batch_data(batch_t *instance, usb_packet_id pid, device_keeper_t *keeper) 235 235 { 236 236 assert(instance); 237 237 const bool low_speed = instance->speed == USB_SPEED_LOW; 238 int toggle = 1; 238 int toggle = device_keeper_get_toggle(keeper, instance->target); 239 assert(toggle == 0 || toggle == 1); 239 240 240 241 size_t packet = 0; … … 245 246 - remain_size; 246 247 247 toggle = 1 - toggle;248 248 249 249 const size_t packet_size = … … 256 256 &instance->tds[packet + 1]); 257 257 258 toggle = 1 - toggle; 258 259 ++packet; 259 260 assert(packet <= instance->packets); … … 261 262 remain_size -= packet_size; 262 263 } 264 device_keeper_set_toggle(keeper, instance->target, toggle); 263 265 264 266 instance->tds[packet - 1].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG; … … 266 268 } 267 269 /*----------------------------------------------------------------------------*/ 268 staticvoid batch_control(batch_t *instance,270 void batch_control(batch_t *instance, 269 271 usb_packet_id data_stage, usb_packet_id status_stage) 270 272 { -
uspace/drv/uhci-hcd/batch.h
redb5f837 r3e37964 42 42 #include "uhci_struct/transfer_descriptor.h" 43 43 #include "uhci_struct/queue_head.h" 44 #include "utils/device_keeper.h" 44 45 45 46 typedef struct batch … … 82 83 void batch_control_read(batch_t *instance); 83 84 84 void batch_interrupt_in(batch_t *instance );85 void batch_interrupt_in(batch_t *instance, device_keeper_t *keeper); 85 86 86 void batch_interrupt_out(batch_t *instance );87 void batch_interrupt_out(batch_t *instance, device_keeper_t *keeper); 87 88 88 void batch_bulk_in(batch_t *instance );89 void batch_bulk_in(batch_t *instance, device_keeper_t *keeper); 89 90 90 void batch_bulk_out(batch_t *instance );91 void batch_bulk_out(batch_t *instance, device_keeper_t *keeper); 91 92 #endif 92 93 /** -
uspace/drv/uhci-hcd/iface.c
redb5f837 r3e37964 117 117 if (!batch) 118 118 return ENOMEM; 119 batch_interrupt_out(batch );119 batch_interrupt_out(batch, &hc->device_manager); 120 120 return EOK; 121 121 } … … 136 136 if (!batch) 137 137 return ENOMEM; 138 batch_interrupt_in(batch );138 batch_interrupt_in(batch, &hc->device_manager); 139 139 return EOK; 140 140 } … … 156 156 if (!batch) 157 157 return ENOMEM; 158 batch_bulk_out(batch );158 batch_bulk_out(batch, &hc->device_manager); 159 159 return EOK; 160 160 } … … 175 175 if (!batch) 176 176 return ENOMEM; 177 batch_bulk_in(batch );177 batch_bulk_in(batch, &hc->device_manager); 178 178 return EOK; 179 179 }
Note:
See TracChangeset
for help on using the changeset viewer.