Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/utils/malloc32.h

    rfbcdeb8 re3122b0  
    3535#define DRV_UHCI_UTILS_MALLOC32_H
    3636
     37#include <as.h>
    3738#include <assert.h>
     39#include <ddi.h>
    3840#include <errno.h>
    3941#include <malloc.h>
    4042#include <mem.h>
    41 #include <as.h>
     43#include <unistd.h>
    4244
    4345#define UHCI_STRCUTURES_ALIGNMENT 16
     
    6264        return result;
    6365}
    64 /*----------------------------------------------------------------------------*/
     66
    6567/** DMA malloc simulator
    6668 *
     
    8486        return memalign(alignment, size);
    8587}
    86 /*----------------------------------------------------------------------------*/
     88
    8789/** DMA malloc simulator
    8890 *
     
    9193static inline void free32(void *addr)
    9294        { free(addr); }
    93 /*----------------------------------------------------------------------------*/
     95
    9496/** Create 4KB page mapping
    9597 *
     
    98100static inline void * get_page(void)
    99101{
    100         void *address = as_area_create((void *) -1, UHCI_REQUIRED_PAGE_SIZE,
    101             AS_AREA_READ | AS_AREA_WRITE);
    102         if (address == (void *) -1)
    103                 return NULL;
    104        
    105         return address;
     102        void *address, *phys;
     103        const int ret = dmamem_map_anonymous(UHCI_REQUIRED_PAGE_SIZE,
     104            AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &address);
     105        return ret == EOK ? address : NULL;
    106106}
    107 /*----------------------------------------------------------------------------*/
     107
    108108static inline void return_page(void *page)
    109109{
    110         if (page)
    111                 as_area_destroy(page);
     110        dmamem_unmap_anonymous(page);
    112111}
    113112
Note: See TracChangeset for help on using the changeset viewer.