Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/hw_struct/queue_head.h

    r9d2d444 r1e70157  
    3434#ifndef DRV_UHCI_QH_H
    3535#define DRV_UHCI_QH_H
     36
     37/* libc */
    3638#include <assert.h>
    3739
    3840#include "link_pointer.h"
    39 #include "transfer_descriptor.h"
    40 #include "utils/malloc32.h"
    4141
    42 /** This structure is defined in UHCI design guide p. 31 */
    4342typedef struct queue_head {
    44         /** Pointer to the next entity (another QH or TD */
    4543        volatile link_pointer_t next;
    46         /** Pointer to the contained entities (execution controlled by vertical flag*/
    4744        volatile link_pointer_t element;
    4845} __attribute__((packed)) qh_t;
     
    6764 * @param[in] pa Physical address of the next queue head.
    6865 *
    69  * Adds proper flag. If the pointer is NULL, sets next to terminal NULL.
     66 * Adds proper flag. If the pointer is NULL or terminal, sets next to terminal
     67 * NULL.
    7068 */
    71 static inline void qh_set_next_qh(qh_t *instance, qh_t *next)
     69static inline void qh_set_next_qh(qh_t *instance, uint32_t pa)
    7270{
    73         uint32_t pa = addr_to_phys(next);
    74         if (pa) {
     71        /* Address is valid and not terminal */
     72        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
    7573                instance->next = LINK_POINTER_QH(pa);
    7674        } else {
     
    8280 *
    8381 * @param[in] instance qh_t structure to initialize.
     82 * @param[in] pa Physical address of the next queue head.
     83 *
     84 * Adds proper flag. If the pointer is NULL or terminal, sets element
     85 * to terminal NULL.
     86 */
     87static inline void qh_set_element_qh(qh_t *instance, uint32_t pa)
     88{
     89        /* Address is valid and not terminal */
     90        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
     91                instance->element = LINK_POINTER_QH(pa);
     92        } else {
     93                instance->element = LINK_POINTER_TERM;
     94        }
     95}
     96/*----------------------------------------------------------------------------*/
     97/** Set queue head element pointer
     98 *
     99 * @param[in] instance qh_t structure to initialize.
    84100 * @param[in] pa Physical address of the TD structure.
    85101 *
    86  * Adds proper flag. If the pointer is NULL, sets element to terminal NULL.
     102 * Adds proper flag. If the pointer is NULL or terminal, sets element
     103 * to terminal NULL.
    87104 */
    88 static inline void qh_set_element_td(qh_t *instance, td_t *td)
     105static inline void qh_set_element_td(qh_t *instance, uint32_t pa)
    89106{
    90         uint32_t pa = addr_to_phys(td);
    91         if (pa) {
     107        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
    92108                instance->element = LINK_POINTER_TD(pa);
    93109        } else {
     
    95111        }
    96112}
     113
    97114#endif
    98115/**
Note: See TracChangeset for help on using the changeset viewer.