Changeset 69b1f3d in mainline for uspace/lib


Ignore:
Timestamp:
2011-02-14T22:19:05Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f294926
Parents:
d4ee4e2 (diff), daec5e04 (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.
Message:

Merged removal of USB outcome type

Replaced with standard libc error codes.

See ticket 55 for discussion.

Location:
uspace/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str_error.c

    rd4ee4e2 r69b1f3d  
    3333 */
    3434
     35#include <errno.h>
    3536#include <str_error.h>
    3637#include <stdio.h>
     
    6364static fibril_local char noerr[NOERR_LEN];
    6465
    65 const char *str_error(const int errno)
     66const char *str_error(const int e)
    6667{
    67         if ((errno <= 0) && (errno >= MIN_ERRNO))
    68                 return err_desc[-errno];
     68        if ((e <= 0) && (e >= MIN_ERRNO))
     69                return err_desc[-e];
    6970       
    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);
    7182        return noerr;
    7283}
  • uspace/lib/c/include/errno.h

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

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

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

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

    rd4ee4e2 r69b1f3d  
    5454}
    5555
    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 
    7256/**
    7357 * @}
Note: See TracChangeset for help on using the changeset viewer.