Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/utils/malloc32.h

    r23f40280 rfd153d3  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup drvusbohci
     28/** @addtogroup usb
    2929 * @{
    3030 */
    3131/** @file
    32  * @brief OHCI driver
     32 * @brief UHCI driver
    3333 */
    34 #ifndef DRV_OHCI_UTILS_MALLOC32_H
    35 #define DRV_OHCI_UTILS_MALLOC32_H
     34#ifndef DRV_UHCI_TRANSLATOR_H
     35#define DRV_UHCI_TRANSLATOR_H
    3636
    3737#include <assert.h>
     
    4040#include <mem.h>
    4141#include <as.h>
     42
     43#define UHCI_REQUIRED_PAGE_SIZE 4096
    4244
    4345/** Get physical address translation
     
    5961 *
    6062 * @param[in] size Size of the required memory space
    61  * @return Address of the aligned and big enough memory place, NULL on failure.
     63 * @return Address of the alligned and big enough memory place, NULL on failure.
    6264 */
    6365static inline void * malloc32(size_t size)
     
    7072static inline void free32(void *addr)
    7173        { if (addr) free(addr); }
     74/*----------------------------------------------------------------------------*/
     75/** Create 4KB page mapping
     76 *
     77 * @return Address of the mapped page, NULL on failure.
     78 */
     79static inline void * get_page(void)
     80{
     81        void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
     82        assert(free_address);
     83        if (free_address == 0)
     84                return NULL;
     85        void* ret =
     86          as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
     87                  AS_AREA_READ | AS_AREA_WRITE);
     88        if (ret != free_address)
     89                return NULL;
     90        return ret;
     91}
     92
    7293#endif
    7394/**
Note: See TracChangeset for help on using the changeset viewer.