Changes in / [69b1f3d:d4ee4e2] in mainline


Ignore:
Location:
uspace
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/connhost.c

    r69b1f3d rd4ee4e2  
    6464
    6565static void universal_callback(void *buffer, size_t size,
    66     int outcome, void *arg)
     66    usb_transaction_outcome_t outcome, void *arg)
    6767{
    6868        transfer_info_t *transfer = (transfer_info_t *) arg;
     
    107107
    108108static void control_abort_prematurely(control_transfer_info_t *transfer,
    109     size_t size, int outcome)
     109    size_t size, usb_transaction_outcome_t outcome)
    110110{
    111111        switch (transfer->direction) {
     
    127127
    128128static void control_callback_two(void *buffer, size_t size,
    129     int outcome, void *arg)
     129    usb_transaction_outcome_t outcome, void *arg)
    130130{
    131131        control_transfer_info_t *ctrl_transfer = (control_transfer_info_t *) arg;
    132132
    133         if (outcome != EOK) {
     133        if (outcome != USB_OUTCOME_OK) {
    134134                control_abort_prematurely(ctrl_transfer, outcome, size);
    135135                free(ctrl_transfer);
     
    165165
    166166static void control_callback_one(void *buffer, size_t size,
    167     int outcome, void *arg)
     167    usb_transaction_outcome_t outcome, void *arg)
    168168{
    169169        control_transfer_info_t *transfer = (control_transfer_info_t *) arg;
    170170
    171         if (outcome != EOK) {
     171        if (outcome != USB_OUTCOME_OK) {
    172172                control_abort_prematurely(transfer, outcome, size);
    173173                free(transfer);
  • uspace/drv/vhc/devices.c

    r69b1f3d rd4ee4e2  
    112112 * @param transaction Transaction to be sent over the bus.
    113113 */
    114 int virtdev_send_to_all(transaction_t *transaction)
     114usb_transaction_outcome_t virtdev_send_to_all(transaction_t *transaction)
    115115{
    116116        /* For easier debugging. */
     
    126126                        assert(false && "unreachable branch in switch()");
    127127        }
    128         int outcome = EBADCHECKSUM;
     128        usb_transaction_outcome_t outcome = USB_OUTCOME_BABBLE;
    129129
    130130        link_t *pos;
     
    185185                 */
    186186                if (rc == EOK) {
    187                         outcome = EOK;
     187                        outcome = USB_OUTCOME_OK;
    188188                }
    189189        }
     
    221221                                break;
    222222                }
    223                 outcome = EOK;
     223                outcome = USB_OUTCOME_OK;
    224224        }
    225225       
  • uspace/drv/vhc/devices.h

    r69b1f3d rd4ee4e2  
    5454virtdev_connection_t *virtdev_find(sysarg_t);
    5555void virtdev_destroy_device(virtdev_connection_t *);
    56 int virtdev_send_to_all(transaction_t *);
     56usb_transaction_outcome_t virtdev_send_to_all(transaction_t *);
    5757
    5858#endif
  • uspace/drv/vhc/hc.c

    r69b1f3d rd4ee4e2  
    8989 */
    9090static void process_transaction_with_outcome(transaction_t * transaction,
    91     int outcome)
     91    usb_transaction_outcome_t outcome)
    9292{
    9393        usb_log_debug2("Transaction " TRANSACTION_FORMAT " done: %s.\n",
    9494            TRANSACTION_PRINTF(*transaction),
    95             str_error(outcome));
     95            usb_str_transaction_outcome(outcome));
    9696       
    9797        transaction->callback(transaction->buffer, transaction->actual_len,
     
    127127                    TRANSACTION_PRINTF(*transaction), ports);
    128128
    129                 int outcome;
     129                usb_transaction_outcome_t outcome;
    130130                outcome = virtdev_send_to_all(transaction);
    131131               
  • uspace/drv/vhc/hc.h

    r69b1f3d rd4ee4e2  
    4747 */
    4848typedef void (*hc_transaction_done_callback_t)(void *buffer, size_t size,
    49     int outcome, void *arg);
     49    usb_transaction_outcome_t outcome, void *arg);
    5050
    5151/** Pending transaction details. */
  • uspace/lib/c/generic/str_error.c

    r69b1f3d rd4ee4e2  
    3333 */
    3434
    35 #include <errno.h>
    3635#include <str_error.h>
    3736#include <stdio.h>
     
    6463static fibril_local char noerr[NOERR_LEN];
    6564
    66 const char *str_error(const int e)
     65const char *str_error(const int errno)
    6766{
    68         if ((e <= 0) && (e >= MIN_ERRNO))
    69                 return err_desc[-e];
     67        if ((errno <= 0) && (errno >= MIN_ERRNO))
     68                return err_desc[-errno];
    7069       
    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);
     70        snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno);
    8271        return noerr;
    8372}
  • uspace/lib/c/include/errno.h

    r69b1f3d rd4ee4e2  
    5656#define EMLINK        (-266)
    5757
    58 /** Bad checksum. */
    59 #define EBADCHECKSUM  (-300)
    60 
    6158/** An API function is called while another blocking function is in progress. */
    6259#define EINPROGRESS  (-10036)
  • uspace/lib/drv/generic/remote_usbhc.c

    r69b1f3d rd4ee4e2  
    240240
    241241static void callback_out(device_t *device,
    242     int outcome, void *arg)
     242    usb_transaction_outcome_t outcome, void *arg)
    243243{
    244244        async_transaction_t *trans = (async_transaction_t *)arg;
     
    250250
    251251static void callback_in(device_t *device,
    252     int outcome, size_t actual_size, void *arg)
     252    usb_transaction_outcome_t outcome, size_t actual_size, void *arg)
    253253{
    254254        async_transaction_t *trans = (async_transaction_t *)arg;
    255255
    256         if (outcome != EOK) {
     256        if (outcome != USB_OUTCOME_OK) {
    257257                async_answer_0(trans->caller, outcome);
    258258                if (trans->data_caller) {
     
    270270        }
    271271
    272         async_answer_0(trans->caller, EOK);
     272        async_answer_0(trans->caller, USB_OUTCOME_OK);
    273273
    274274        async_transaction_destroy(trans);
  • uspace/lib/drv/include/usbhc_iface.h

    r69b1f3d rd4ee4e2  
    207207/** Callback for outgoing transfer. */
    208208typedef void (*usbhc_iface_transfer_out_callback_t)(device_t *,
    209     int, void *);
     209    usb_transaction_outcome_t, void *);
    210210
    211211/** Callback for incoming transfer. */
    212212typedef void (*usbhc_iface_transfer_in_callback_t)(device_t *,
    213     int, size_t, void *);
     213    usb_transaction_outcome_t, size_t, void *);
    214214
    215215
  • uspace/lib/usb/include/usb/usb.h

    r69b1f3d rd4ee4e2  
    8383} usb_request_recipient_t;
    8484
     85/** USB transaction outcome. */
     86typedef enum {
     87        USB_OUTCOME_OK,
     88        USB_OUTCOME_CRCERROR,
     89        USB_OUTCOME_BABBLE
     90} usb_transaction_outcome_t;
     91
     92const char * usb_str_transaction_outcome(usb_transaction_outcome_t o);
     93
    8594/** USB address type.
    8695 * Negative values could be used to indicate error.
  • uspace/lib/usb/src/usb.c

    r69b1f3d rd4ee4e2  
    5454}
    5555
     56/** String representation of USB transaction outcome. */
     57const 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
    5672/**
    5773 * @}
Note: See TracChangeset for help on using the changeset viewer.