Changeset c6ae4c2 in mainline for uspace/lib/c/generic/as.c


Ignore:
Timestamp:
2011-12-16T21:12:52Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c8751452
Parents:
e2718e1
Message:

implement basic DMA memory mapping routines
no persistent locking (pinning) of the DMA memory is currently implemented (this can be dangerous)
no unmapping is implemented
special allocations (< 16 MB, < 4 GB) are not supported yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/as.c

    re2718e1 rc6ae4c2  
    117117/** Find mapping to physical address.
    118118 *
    119  * @param address Virtual address in question (virtual).
    120  * @param[out] frame Frame address (physical).
    121  * @return Error code.
    122  * @retval EOK No error, @p frame holds the translation.
    123  * @retval ENOENT Mapping not found.
     119 * @param      virt Virtual address to find mapping for.
     120 * @param[out] phys Physical adress.
     121 *
     122 * @return EOK on no error.
     123 * @retval ENOENT if no mapping was found.
     124 *
    124125 */
    125 int as_get_physical_mapping(const void *address, uintptr_t *frame)
     126int as_get_physical_mapping(const void *virt, uintptr_t *phys)
    126127{
    127         uintptr_t tmp_frame;
    128         uintptr_t virt = (uintptr_t) address;
    129        
    130         int rc = (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING,
    131             (sysarg_t) virt, (sysarg_t) &tmp_frame);
    132         if (rc != EOK) {
    133                 return rc;
    134         }
    135        
    136         if (frame != NULL) {
    137                 *frame = tmp_frame;
    138         }
    139        
    140         return EOK;
     128        return (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
     129            (sysarg_t) phys);
    141130}
    142131
Note: See TracChangeset for help on using the changeset viewer.