Ignore:
Timestamp:
2011-03-21T14:23:15Z (13 years ago)
Author:
Matej Klonfar <maklf@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
55e388a1
Parents:
c32688d (diff), 48fe0c9 (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 with development

File:
1 edited

Legend:

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

    rc32688d r361e61b  
    1 
    21/*
    32 * Copyright (c) 2010 Jan Vesely
     
    2726 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2827 */
    29 /** @addtogroup usb
     28/** @addtogroup drv usbuhcihc
    3029 * @{
    3130 */
     
    4342
    4443typedef struct queue_head {
    45         volatile link_pointer_t next_queue;
     44        volatile link_pointer_t next;
    4645        volatile link_pointer_t element;
    47 } __attribute__((packed)) queue_head_t;
    48 
    49 static inline void queue_head_init(queue_head_t *instance)
     46} __attribute__((packed)) qh_t;
     47/*----------------------------------------------------------------------------*/
     48/** Initialize queue head structure
     49 *
     50 * @param[in] instance qh_t structure to initialize.
     51 *
     52 * Sets both pointer to terminal NULL.
     53 */
     54static inline void qh_init(qh_t *instance)
    5055{
    5156        assert(instance);
    5257
    5358        instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
    54         instance->next_queue = 0 | LINK_POINTER_TERMINATE_FLAG;
     59        instance->next = 0 | LINK_POINTER_TERMINATE_FLAG;
    5560}
    56 
    57 static inline void queue_head_append_qh(queue_head_t *instance, uint32_t pa)
     61/*----------------------------------------------------------------------------*/
     62/** Set queue head next pointer
     63 *
     64 * @param[in] instance qh_t structure to use.
     65 * @param[in] pa Physical address of the next queue head.
     66 *
     67 * Adds proper flag. If the pointer is NULL or terminal, sets next to terminal
     68 * NULL.
     69 */
     70static inline void qh_set_next_qh(qh_t *instance, uint32_t pa)
    5871{
    59         if (pa) {
    60                 instance->next_queue = (pa & LINK_POINTER_ADDRESS_MASK)
     72        /* Address is valid and not terminal */
     73        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
     74                instance->next = (pa & LINK_POINTER_ADDRESS_MASK)
    6175                    | LINK_POINTER_QUEUE_HEAD_FLAG;
     76        } else {
     77                instance->next = 0 | LINK_POINTER_TERMINATE_FLAG;
    6278        }
    6379}
    64 
    65 static inline void queue_head_element_qh(queue_head_t *instance, uint32_t pa)
     80/*----------------------------------------------------------------------------*/
     81/** Set queue head element pointer
     82 *
     83 * @param[in] instance qh_t structure to initialize.
     84 * @param[in] pa Physical address of the next queue head.
     85 *
     86 * Adds proper flag. If the pointer is NULL or terminal, sets element
     87 * to terminal NULL.
     88 */
     89static inline void qh_set_element_qh(qh_t *instance, uint32_t pa)
    6690{
    67         if (pa) {
    68                 instance->next_queue = (pa & LINK_POINTER_ADDRESS_MASK)
     91        /* Address is valid and not terminal */
     92        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
     93                instance->element = (pa & LINK_POINTER_ADDRESS_MASK)
    6994                    | LINK_POINTER_QUEUE_HEAD_FLAG;
     95        } else {
     96                instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
    7097        }
    7198}
    72 
    73 static inline void queue_head_set_element_td(queue_head_t *instance, uint32_t pa)
     99/*----------------------------------------------------------------------------*/
     100/** Set queue head element pointer
     101 *
     102 * @param[in] instance qh_t structure to initialize.
     103 * @param[in] pa Physical address of the TD structure.
     104 *
     105 * Adds proper flag. If the pointer is NULL or terminal, sets element
     106 * to terminal NULL.
     107 */
     108static inline void qh_set_element_td(qh_t *instance, uint32_t pa)
    74109{
    75         if (pa) {
     110        if (pa && ((pa & LINK_POINTER_TERMINATE_FLAG) == 0)) {
    76111                instance->element = (pa & LINK_POINTER_ADDRESS_MASK);
     112        } else {
     113                instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
    77114        }
    78115}
Note: See TracChangeset for help on using the changeset viewer.