Changeset bae9e76 in mainline


Ignore:
Timestamp:
2011-01-25T18:09:20Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d5f7a8ab
Parents:
643b983
Message:

Use uint32_t and cpp flags intead of bit structure for link_pointer_t

Location:
uspace/drv/uhci/uhci_struct
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/uhci_struct/link_pointer.h

    r643b983 rbae9e76  
    3636
    3737/* UHCI link pointer, used by many data structures */
    38 typedef struct link_pointer {
    39         uint32_t addr:28;
    40         uint8_t zero:1;
    41         uint8_t reserved:1;
    42         uint8_t qh:1;
    43         uint8_t terminate:1;
    44 } __attribute__((packed)) link_pointer_t;
     38typedef uint32_t link_pointer_t;
     39
     40#define LINK_POINTER_TERMINATE_FLAG (1 << 0);
     41#define LINK_POINTER_QUEUE_HEAD_FLAG (1 << 1);
     42#define LINK_POINTER_ZERO_BIT_FLAG (1 << 2);
     43#define LINK_POINTER_RESERVED_FLAG (1 << 3);
     44
     45#define LINK_POINTER_ADDRESS_MASK 0xfffffff0 /* upper 28 bits */
    4546
    4647#endif
  • uspace/drv/uhci/uhci_struct/queue_head.h

    r643b983 rbae9e76  
    3838#include <assert.h>
    3939
    40 #include "translating_malloc.h"
    4140#include "link_pointer.h"
    4241
     
    4645} __attribute__((packed)) queue_head_t;
    4746
    48 static inline void queue_head_init(queue_head_t *instance, uint32_t next_pa)
     47static inline void queue_head_init(queue_head_t *instance, uint32_t next_queue_pa)
    4948{
    5049        assert(instance);
    51         assert((next_pa & 0xf) == 0);
     50        assert((next_queue_pa & LINK_POINTER_ADDRESS_MASK) == next_queue_pa);
    5251
    53         memset(instance, 0, sizeof(*instance));
    54         instance->element.terminate = 1;
    55         if (next_pa) {
    56                 instance->next_queue.terminate = 0;
    57                 instance->next_queue.addr = next_pa >> 4;
     52        instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
     53        if (next_queue_pa) {
     54                instance->next_queue = (next_queue_pa & LINK_POINTER_ADDRESS_MASK)
     55                  | LINK_POINTER_QUEUE_HEAD_FLAG;
    5856        } else {
    59                 instance->element.terminate = 1;
     57                instance->next_queue = 0 | LINK_POINTER_TERMINATE_FLAG;
    6058        }
    6159}
Note: See TracChangeset for help on using the changeset viewer.