Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/utils/malloc32.h

    r17ceb72 r5d5f971  
    4343#define UHCI_REQUIRED_PAGE_SIZE 4096
    4444
    45 /** Get physical address translation
    46  *
    47  * @param[in] addr Virtual address to translate
    48  * @return Physical address if exists, NULL otherwise.
    49  */
    5045static inline uintptr_t addr_to_phys(void *addr)
    5146{
     
    5348        int ret = as_get_physical_mapping(addr, &result);
    5449
    55         if (ret != EOK)
    56                 return 0;
     50        assert(ret == 0);
    5751        return (result | ((uintptr_t)addr & 0xfff));
    5852}
    59 /*----------------------------------------------------------------------------*/
    60 /** Physical mallocator simulator
    61  *
    62  * @param[in] size Size of the required memory space
    63  * @return Address of the alligned and big enough memory place, NULL on failure.
    64  */
     53
    6554static inline void * malloc32(size_t size)
    6655        { return memalign(UHCI_STRCUTURES_ALIGNMENT, size); }
    67 /*----------------------------------------------------------------------------*/
    68 /** Physical mallocator simulator
    69  *
    70  * @param[in] addr Address of the place allocated by malloc32
    71  */
    72 static inline void free32(void *addr)
    73         { if (addr) free(addr); }
    74 /*----------------------------------------------------------------------------*/
    75 /** Create 4KB page mapping
    76  *
    77  * @return Address of the mapped page, NULL on failure.
    78  */
    79 static inline void * get_page(void)
     56
     57static inline void * get_page()
    8058{
    8159        void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
    8260        assert(free_address);
    8361        if (free_address == 0)
    84                 return NULL;
     62                return 0;
    8563        void* ret =
    8664          as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
    8765                  AS_AREA_READ | AS_AREA_WRITE);
    8866        if (ret != free_address)
    89                 return NULL;
     67                return 0;
    9068        return ret;
    9169}
     70
     71static inline void free32(void *addr)
     72        { if (addr) free(addr); }
    9273
    9374#endif
Note: See TracChangeset for help on using the changeset viewer.