Changeset 113aef8 in mainline


Ignore:
Timestamp:
2011-01-29T08:58:46Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d956aa5
Parents:
245b56b5
Message:

TD debug messages refatoring

Location:
uspace/drv/uhci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/uhci_struct/transfer_descriptor.c

    r245b56b5 r113aef8  
    1010          0 | LINK_POINTER_TERMINATE_FLAG;
    1111
    12         uhci_print_verbose("Creating link field: %x.\n", instance->next);
    1312
    1413        assert(size < 1024);
     
    1615          | ((error_count & TD_STATUS_ERROR_COUNT_MASK) << TD_STATUS_ERROR_COUNT_POS)
    1716          | TD_STATUS_ERROR_ACTIVE;
    18 
    19         uhci_print_verbose("Creating status field: %x.\n", instance->status);
    2017
    2118        instance->device = 0
     
    2522                | ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
    2623
    27         uhci_print_verbose("Creating device field: %x.\n", instance->device);
     24        instance->buffer_ptr = 0;
     25
     26        instance->next_va = NULL;
     27        instance->callback = NULL;
    2828
    2929        if (size) {
    3030                instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer);
    31 
    32                 uhci_print_verbose("Creating buffer field: %p(%p).\n",
    33                         buffer, instance->buffer_ptr);
    34 
    35                 if (size >= 8) {
    36                         char * buff = buffer;
    37 
    38                         uhci_print_verbose("Buffer dump(8B): %x %x %x %x %x %x %x %x.\n",
    39                                 buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6], buff[7]);
    40                 }
    41         } else {
    42                 instance->buffer_ptr = 0;
    4331        }
    4432
    45         instance->next_va = NULL;
    46         instance->callback = NULL;
    47         uhci_print_info("Created a new TD.\n");
     33        uhci_print_info("Created TD: %X:%X:%X:%X(%p).\n",
     34                instance->next, instance->status, instance->device,
     35          instance->buffer_ptr, buffer);
     36
     37        if (size) {
     38                unsigned char * buff = buffer;
     39                uhci_print_verbose("TD Buffer dump(%p-%dB): ", buffer, size);
     40                unsigned i = 0;
     41                /* TODO: Verbose? */
     42                for (; i < size; ++i) {
     43                        printf((i & 1) ? "%x " : "%x", buff[i]);
     44                }
     45                printf("\n");
     46        }
    4847}
    4948
  • uspace/drv/uhci/utils/malloc32.h

    r245b56b5 r113aef8  
    4242#include <as.h>
    4343
     44#define UHCI_STRCUTURES_ALIGNMENT 16
     45#define UHCI_REQUIRED_PAGE_SIZE 4096
     46
    4447static inline void * addr_to_phys(void *addr)
    4548{
     
    5255
    5356static inline void * malloc32(size_t size)
    54 /* TODO: this is ugly */
    55         { return memalign(16, size); }
     57        { return memalign(UHCI_STRCUTURES_ALIGNMENT, size); }
    5658
    5759static inline void * get_page()
    5860{
    59         void * free_address = as_get_mappable_page(4096);
     61        void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
    6062        assert(free_address);
    6163        if (free_address == 0)
    6264                return 0;
    6365        void* ret =
    64           as_area_create(free_address, 4096, AS_AREA_READ | AS_AREA_WRITE |AS_AREA_CACHEABLE);
     66          as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
     67                  AS_AREA_READ | AS_AREA_WRITE);
    6568        if (ret != free_address)
    6669                return 0;
Note: See TracChangeset for help on using the changeset viewer.