Changeset 5d915b7 in mainline for uspace/drv/bus/usb/uhci/hw_struct


Ignore:
Timestamp:
2011-09-14T14:25:07Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e3d17f
Parents:
1e647c7d
Message:

uhci: Minor tweaks and comment fixes

Location:
uspace/drv/bus/usb/uhci/hw_struct
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hw_struct/link_pointer.h

    r1e647c7d r5d915b7  
    3535#define DRV_UHCI_HW_STRUCT_LINK_POINTER_H
    3636
    37 /* UHCI link pointer, used by many data structures */
     37/** UHCI link pointer, used by many data structures */
    3838typedef uint32_t link_pointer_t;
    3939
  • uspace/drv/bus/usb/uhci/hw_struct/queue_head.h

    r1e647c7d r5d915b7  
    5858        assert(instance);
    5959
    60         instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
    61         instance->next = 0 | LINK_POINTER_TERMINATE_FLAG;
     60        instance->element = LINK_POINTER_TERM;
     61        instance->next = LINK_POINTER_TERM;
    6262}
    6363/*----------------------------------------------------------------------------*/
     
    7171static inline void qh_set_next_qh(qh_t *instance, qh_t *next)
    7272{
    73         uint32_t pa = addr_to_phys(next);
     73        /* Physical address has to be below 4GB,
     74         * it is an UHCI limitation and malloc32
     75         * should guarantee this */
     76        const uint32_t pa = addr_to_phys(next);
    7477        if (pa) {
    7578                instance->next = LINK_POINTER_QH(pa);
     
    8891static inline void qh_set_element_td(qh_t *instance, td_t *td)
    8992{
    90         uint32_t pa = addr_to_phys(td);
     93        /* Physical address has to be below 4GB,
     94         * it is an UHCI limitation and malloc32
     95         * should guarantee this */
     96        const uint32_t pa = addr_to_phys(td);
    9197        if (pa) {
    9298                instance->element = LINK_POINTER_TD(pa);
  • uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c

    r1e647c7d r5d915b7  
    113113 * @return Error code.
    114114 */
    115 int td_status(td_t *instance)
     115int td_status(const td_t *instance)
    116116{
    117117        assert(instance);
     
    119119        /* This is hc internal error it should never be reported. */
    120120        if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0)
    121                 return EAGAIN;
     121                return EIO;
    122122
    123123        /* CRC or timeout error, like device not present or bad data,
     
    150150 * @param[in] instance TD structure to use.
    151151 */
    152 void td_print_status(td_t *instance)
     152void td_print_status(const td_t *instance)
    153153{
    154154        assert(instance);
  • uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h

    r1e647c7d r5d915b7  
    6969#define TD_STATUS_ACTLEN_MASK 0x7ff
    7070
    71         /* double word with USB device specific info */
     71        /** Double word with USB device specific info */
    7272        volatile uint32_t device;
    7373#define TD_DEVICE_MAXLEN_POS 21
     
    8787        /* According to UHCI design guide, there is 16 bytes of
    8888         * data available here.
    89          * According to linux kernel the hardware does not care,
    90          * it just needs to be aligned. We don't use it anyway.
     89         * According to Linux kernel the hardware does not care,
     90         * memory just needs to be aligned. We don't use it anyway.
    9191         */
    9292} __attribute__((packed)) td_t;
     
    9797    const void *buffer, const td_t *next);
    9898
    99 int td_status(td_t *instance);
     99int td_status(const td_t *instance);
    100100
    101 void td_print_status(td_t *instance);
     101void td_print_status(const td_t *instance);
    102102/*----------------------------------------------------------------------------*/
    103103/** Helper function for parsing actual size out of TD.
     
    106106 * @return Parsed actual size.
    107107 */
    108 static inline size_t td_act_size(td_t *instance)
     108static inline size_t td_act_size(const td_t *instance)
    109109{
    110110        assert(instance);
    111111        const uint32_t s = instance->status;
     112        /* Actual size is encoded as n-1 (UHCI design guide p. 23) */
    112113        return ((s >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK;
    113114}
     
    119120 * false otherwise.
    120121 */
    121 static inline bool td_is_short(td_t *instance)
     122static inline bool td_is_short(const td_t *instance)
    122123{
    123124        const size_t act_size = td_act_size(instance);
     
    134135 * @return Toggle bit value.
    135136 */
    136 static inline int td_toggle(td_t *instance)
     137static inline int td_toggle(const td_t *instance)
    137138{
    138139        assert(instance);
     
    145146 * @return Active bit value.
    146147 */
    147 static inline bool td_is_active(td_t *instance)
     148static inline bool td_is_active(const td_t *instance)
    148149{
    149150        assert(instance);
Note: See TracChangeset for help on using the changeset viewer.