Ignore:
Timestamp:
2011-04-09T16:00:33Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5410c04
Parents:
8efafda (diff), 8e8b84f (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:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hw_struct/transfer_descriptor.h

    r8efafda r7b715892  
    3535#define DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
    3636
     37#include <bool.h>
    3738#include <stdint.h>
     39#include "utils/malloc32.h"
    3840
    3941#include "completion_codes.h"
     42
     43/* OHCI TDs can handle up to 8KB buffers */
     44#define OHCI_TD_MAX_TRANSFER (8 * 1024)
    4045
    4146typedef struct td {
     
    5257#define TD_STATUS_T_MASK (0x3)  /* data toggle 1x = use ED toggle carry */
    5358#define TD_STATUS_T_SHIFT (24)
     59#define TD_STATUS_T_0 (0x2)
     60#define TD_STATUS_T_1 (0x3)
    5461#define TD_STATUS_EC_MASK (0x3) /* error count */
    5562#define TD_STATUS_EC_SHIFT (26)
     
    6471        volatile uint32_t be; /* buffer end, address of the last byte */
    6572} __attribute__((packed)) td_t;
     73
     74void td_init(
     75    td_t *instance, usb_direction_t dir, void *buffer, size_t size, int toggle);
     76
     77inline static void td_set_next(td_t *instance, td_t *next)
     78{
     79        assert(instance);
     80        instance->next = addr_to_phys(next) & TD_NEXT_PTR_MASK;
     81}
     82
     83inline static bool td_is_finished(td_t *instance)
     84{
     85        assert(instance);
     86        int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK;
     87        /* something went wrong, error code is set */
     88        if (cc != CC_NOACCESS1 && cc != CC_NOACCESS2 && cc != CC_NOERROR) {
     89                return true;
     90        }
     91        /* everything done */
     92        if (cc == CC_NOERROR && instance->cbp == 0) {
     93                return true;
     94        }
     95        return false;
     96}
     97
     98static inline int td_error(td_t *instance)
     99{
     100        assert(instance);
     101        int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK;
     102        return cc_to_rc(cc);
     103}
    66104#endif
    67105/**
Note: See TracChangeset for help on using the changeset viewer.