Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2014-01-25T07:07:54Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
23e5471
Parents:
6602e97
Message:

ehci: Implement batch error checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c

    r6602e97 ra752c78c  
    3434
    3535#include <assert.h>
     36#include <errno.h>
    3637#include <macros.h>
    3738#include <mem.h>
     
    4041
    4142#include "../utils/malloc32.h"
    42 //#include "completion_codes.h"
    4343#include "mem_access.h"
    4444#include "transfer_descriptor.h"
     45
     46
     47int td_error(const td_t *td)
     48{
     49        assert(td);
     50        const uint32_t status = EHCI_MEM32_RD(td->status);
     51        if (status & TD_STATUS_HALTED_FLAG) {
     52                if (status & TD_STATUS_TRANS_ERR_FLAG)
     53                        return EIO;
     54                if (status & TD_STATUS_BABBLE_FLAG)
     55                        return EIO;
     56                if (status & TD_STATUS_BUFF_ERROR_FLAG)
     57                        return EOVERFLOW;
     58                return ESTALL;
     59        }
     60        if (status & TD_STATUS_ACTIVE_FLAG)
     61                return EINPROGRESS;
     62        return EOK;
     63}
    4564
    4665/** USB direction to EHCI TD values translation table */
Note: See TracChangeset for help on using the changeset viewer.