Changeset fa2f79d in mainline for uspace/lib
- Timestamp:
- 2011-02-15T21:26:05Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 563fb40
- Parents:
- 47c573a (diff), f294926 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 4 added
- 9 edited
-
c/generic/str_error.c (modified) (2 diffs)
-
c/include/errno.h (modified) (1 diff)
-
drv/generic/remote_usbhc.c (modified) (3 diffs)
-
drv/include/usbhc_iface.h (modified) (1 diff)
-
usb/Makefile (modified) (2 diffs)
-
usb/include/usb/hub.h (added)
-
usb/include/usb/pipes.h (modified) (3 diffs)
-
usb/include/usb/usb.h (modified) (1 diff)
-
usb/include/usb/usbdevice.h (added)
-
usb/src/hub.c (added)
-
usb/src/pipes.c (modified) (1 diff)
-
usb/src/usb.c (modified) (1 diff)
-
usb/src/usbdevice.c (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/str_error.c
r47c573a rfa2f79d 33 33 */ 34 34 35 #include <errno.h> 35 36 #include <str_error.h> 36 37 #include <stdio.h> … … 63 64 static fibril_local char noerr[NOERR_LEN]; 64 65 65 const char *str_error(const int e rrno)66 const char *str_error(const int e) 66 67 { 67 if ((e rrno <= 0) && (errno>= MIN_ERRNO))68 return err_desc[-e rrno];68 if ((e <= 0) && (e >= MIN_ERRNO)) 69 return err_desc[-e]; 69 70 70 snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno); 71 /* Ad hoc descriptions of error codes interesting for USB. */ 72 switch (e) { 73 case EBADCHECKSUM: 74 return "Bad checksum"; 75 case EAGAIN: 76 return "Resource temporarily unavailable"; 77 default: 78 break; 79 } 80 81 snprintf(noerr, NOERR_LEN, "Unkown error code %d", e); 71 82 return noerr; 72 83 } -
uspace/lib/c/include/errno.h
r47c573a rfa2f79d 56 56 #define EMLINK (-266) 57 57 58 /** Bad checksum. */ 59 #define EBADCHECKSUM (-300) 60 58 61 /** An API function is called while another blocking function is in progress. */ 59 62 #define EINPROGRESS (-10036) -
uspace/lib/drv/generic/remote_usbhc.c
r47c573a rfa2f79d 240 240 241 241 static void callback_out(device_t *device, 242 usb_transaction_outcome_t outcome, void *arg)242 int outcome, void *arg) 243 243 { 244 244 async_transaction_t *trans = (async_transaction_t *)arg; … … 250 250 251 251 static void callback_in(device_t *device, 252 usb_transaction_outcome_t outcome, size_t actual_size, void *arg)252 int outcome, size_t actual_size, void *arg) 253 253 { 254 254 async_transaction_t *trans = (async_transaction_t *)arg; 255 255 256 if (outcome != USB_OUTCOME_OK) {256 if (outcome != EOK) { 257 257 async_answer_0(trans->caller, outcome); 258 258 if (trans->data_caller) { … … 270 270 } 271 271 272 async_answer_0(trans->caller, USB_OUTCOME_OK);272 async_answer_0(trans->caller, EOK); 273 273 274 274 async_transaction_destroy(trans); -
uspace/lib/drv/include/usbhc_iface.h
r47c573a rfa2f79d 207 207 /** Callback for outgoing transfer. */ 208 208 typedef void (*usbhc_iface_transfer_out_callback_t)(device_t *, 209 usb_transaction_outcome_t, void *);209 int, void *); 210 210 211 211 /** Callback for incoming transfer. */ 212 212 typedef void (*usbhc_iface_transfer_in_callback_t)(device_t *, 213 usb_transaction_outcome_t, size_t, void *);213 int, size_t, void *); 214 214 215 215 -
uspace/lib/usb/Makefile
r47c573a rfa2f79d 40 40 src/dump.c \ 41 41 src/hidparser.c \ 42 src/hub.c \ 42 43 src/pipes.c \ 43 44 src/pipesinit.c \ … … 46 47 src/request.c \ 47 48 src/usb.c \ 49 src/usbdevice.c \ 48 50 src/usbdrvreq.c \ 49 51 src/usbdrv.c \ -
uspace/lib/usb/include/usb/pipes.h
r47c573a rfa2f79d 31 31 */ 32 32 /** @file 33 * Communication between device drivers and host controller driver.33 * USB pipes representation. 34 34 */ 35 35 #ifndef LIBUSB_PIPES_H_ … … 38 38 #include <sys/types.h> 39 39 #include <usb/usb.h> 40 #include <usb/usbdevice.h> 40 41 #include <usb/descriptor.h> 41 42 #include <ipc/devman.h> … … 114 115 } usb_endpoint_mapping_t; 115 116 117 int usb_device_connection_initialize_on_default_address( 118 usb_device_connection_t *, usb_hc_connection_t *); 116 119 int usb_device_connection_initialize_from_device(usb_device_connection_t *, 117 120 device_t *); -
uspace/lib/usb/include/usb/usb.h
r47c573a rfa2f79d 83 83 } usb_request_recipient_t; 84 84 85 /** USB transaction outcome. */86 typedef enum {87 USB_OUTCOME_OK,88 USB_OUTCOME_CRCERROR,89 USB_OUTCOME_BABBLE90 } usb_transaction_outcome_t;91 92 const char * usb_str_transaction_outcome(usb_transaction_outcome_t o);93 94 85 /** USB address type. 95 86 * Negative values could be used to indicate error. -
uspace/lib/usb/src/pipes.c
r47c573a rfa2f79d 102 102 } 103 103 104 /** Initialize connection to USB device on default address. 105 * 106 * @param dev_connection Device connection structure to be initialized. 107 * @param hc_connection Initialized connection to host controller. 108 * @return Error code. 109 */ 110 int usb_device_connection_initialize_on_default_address( 111 usb_device_connection_t *dev_connection, 112 usb_hc_connection_t *hc_connection) 113 { 114 assert(dev_connection); 115 116 if (hc_connection == NULL) { 117 return EBADMEM; 118 } 119 120 return usb_device_connection_initialize(dev_connection, 121 hc_connection->hc_handle, (usb_address_t) 0); 122 } 123 104 124 105 125 /** Start a session on the endpoint pipe. -
uspace/lib/usb/src/usb.c
r47c573a rfa2f79d 54 54 } 55 55 56 /** String representation of USB transaction outcome. */57 const char * usb_str_transaction_outcome(usb_transaction_outcome_t o)58 {59 switch (o) {60 case USB_OUTCOME_OK:61 return "ok";62 case USB_OUTCOME_CRCERROR:63 return "CRC error";64 case USB_OUTCOME_BABBLE:65 return "babble";66 default:67 return "unknown";68 }69 }70 71 72 56 /** 73 57 * @}
Note:
See TracChangeset
for help on using the changeset viewer.
