1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma once
14
15#include <autoconf.h>
16#include <sel4utils/gen_config.h>
17
18#include <sel4/sel4.h>
19#include <vka/vka.h>
20#include <vspace/vspace.h>
21#include <platsupport/io.h>
22
23/**
24 * Creates an implementation of a dma manager that is designed to allocate at page granularity. Due
25 * to implementation details it will round up all allocations to the next power of 2, or 4k (whichever
26 * is larger). This allocator will put mappings into the vspace with custom cookie values and you
27 * must free all dma allocations before tearing down the vspace
28 * @param vka Allocation interface for allocating untypeds (for frames) and slots
29 * @param vspace Virtual memory manager used for mapping frames
30 * @param dma_man Pointer to dma manager struct that will be filled out
31 * @return 0 on success
32 */
33int sel4utils_new_page_dma_alloc(vka_t *vka, vspace_t *vspace, ps_dma_man_t *dma_man);
34
35