1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*!
8  @addtogroup cc_pal_memmap
9  @{
10  */
11 
12 /*!
13  @file
14  @brief This file contains functions for memory mapping.
15 
16        \note None of the described functions validate the input parameters, so
17        that the behavior of the APIs in case of an illegal parameter is dependent
18        on the behavior of the operating system.
19  */
20 
21 #ifndef _CC_PAL_MEMMAP_H
22 #define _CC_PAL_MEMMAP_H
23 
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29 
30 
31 #include "cc_pal_types.h"
32 #include "cc_address_defs.h"
33 
34 
35 /*----------------------------
36       PUBLIC FUNCTIONS
37 -----------------------------------*/
38 
39 /*!
40   @brief This function returns the base virtual address that maps the base
41   physical address.
42 
43   @return \c 0 on success.
44   @return A non-zero value in case of failure.
45  */
46 uint32_t CC_PalMemMap(
47         /*! [in] The starting physical address of the I/O range to be mapped. */
48         CCDmaAddr_t physicalAddress,
49         /*! [in] The number of bytes that were mapped. */
50         uint32_t mapSize,
51         /*! [out] A pointer to the base virtual address to which the physical
52         pages were mapped. */
53         uint32_t **ppVirtBuffAddr);
54 
55 
56 /*!
57   @brief This function unmaps a specified address range that was previously
58   mapped by #CC_PalMemMap.
59 
60   @return \c 0 on success.
61   @return A non-zero value in case of failure.
62  */
63 uint32_t CC_PalMemUnMap(
64         /*! [in] A pointer to the base virtual address to which the physical
65         pages were mapped. */
66         uint32_t *pVirtBuffAddr,
67         /*! [in] The number of bytes that were mapped. */
68         uint32_t mapSize);
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 /*!
75  @}
76  */
77 
78 #endif
79