Ignore:
Timestamp:
2014-01-22T00:00:18Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64c96b9
Parents:
bdddc9d
Message:

ehci: Initialize and start the HC

File:
1 edited

Legend:

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

    rbdddc9d r478e243  
    3636
    3737#include <as.h>
     38#include <ddi.h>
    3839#include <errno.h>
    3940#include <stdlib.h>
     
    4445 * buffers do not have to be aligned.
    4546 */
    46 #define EHCI_ALIGN 32
     47#define EHCI_ALIGN   32
     48
     49#define EHCI_REQUIRED_PAGE_SIZE   4096
    4750
    4851/** Get physical address translation
     
    7679static inline void free32(void *addr)
    7780        { free(addr); }
     81
     82/** Create 4KB page mapping
     83 *
     84 * @return Address of the mapped page, NULL on failure.
     85 */
     86static inline void *get_page(void)
     87{
     88        uintptr_t phys;
     89        void *address;
     90
     91        const int ret = dmamem_map_anonymous(EHCI_REQUIRED_PAGE_SIZE,
     92            DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
     93            &address);
     94
     95        return ((ret == EOK) ? address : NULL);
     96}
     97
     98static inline void return_page(void *page)
     99{
     100        dmamem_unmap_anonymous(page);
     101}
    78102#endif
    79103/**
Note: See TracChangeset for help on using the changeset viewer.