blob: e689b2ebde7c0a4e3091beff32d224c6830f125b [file] [log] [blame]
Marc Moreno Berengue20dab392017-11-29 13:18:58 +00001/*
2 * Copyright (c) 2016 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef __CMSIS_PPC_DRV_H__
18#define __CMSIS_PPC_DRV_H__
19
20#include "Driver_Common.h"
21
22/* API version */
23#define ARM_PPC_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,0)
24
25/* Security attribute used to configure the peripheral */
26typedef enum _ARM_PPC_SecAttr {
27 ARM_PPC_SECURE_ONLY, ///< Secure access
28 ARM_PPC_NONSECURE_ONLY, ///< Non-secure access
29} ARM_PPC_SecAttr;
30
31/* Privilege attribute used to configure the peripheral */
32typedef enum _ARM_PPC_PrivAttr {
33 ARM_PPC_PRIV_AND_NONPRIV, ///< Privilege and non-privilege access
34 ARM_PPC_PRIV_ONLY, ///< Privilege only access
35} ARM_PPC_PrivAttr;
36
37/* Function documentation */
38/**
39 \fn ARM_DRIVER_VERSION ARM_PPC_GetVersion (void)
40 \brief Get driver version.
41 \return \ref ARM_DRIVER_VERSION
42
43 \fn int32_t ARM_PPC_Initialize (void)
44 \brief Initialize PPC Interface.
45 \return Returns ARM error code.
46
47 \fn int32_t ARM_PPC_Uninitialize (void)
48 \brief De-initialize MPC Interface.
49 \return Returns ARM error code.
50
51 \fn int32_t ARM_PPC_ConfigPeriph (uint8_t periph,
52 ARM_PPC_SecAttr sec_attr,
53 ARM_PPC_PrivAttr priv_attr)
54 \brief Configures a peripheral controlled by the given PPC.
55 \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers.
56 \param[in] sec_attr: Secure attribute value.
57 \param[in] priv_attr: Privilege attrivute value.
58
59 Secure Privilege Control Block ( SPCTRL )
60 Non-Secure Privilege Control Block ( NSPCTRL )
61
62 \return Returns ARM error code.
63
64 \fn int32_t ARM_PPC_IsPeriphSecure (uint8_t periph)
65 \brief Check if the peripheral is configured to be secure.
66 \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers.
67
68 Secure Privilege Control Block ( SPCTRL )
69 Non-Secure Privilege Control Block ( NSPCTRL )
70
71 \return Returns 1 if the peripheral is configured as secure,
72 0 for non-secure.
73
74 \fn uint32_t ARM_PPC_IsPeriphPrivOnly (uint8_t periph)
75 \brief Check if the peripheral is configured to be privilege only.
76 \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers.
77
78 Secure Privilege Control Block ( SPCTRL )
79 Non-Secure Privilege Control Block ( NSPCTRL )
80
81 \return Returns 1 if the peripheral is configured as privilege access
82 only, 0 for privilege and unprivilege access mode.
83
84 \fn int32_t ARM_PPC_EnableInterrupt (void)
85 \brief Enable PPC interrupt.
86 \return Returns ARM error code.
87
88 \fn void ARM_PPC_DisableInterrupt (void)
89 \brief Disable PPC interrupt.
90
91 \fn void ARM_PPC_ClearInterrupt (void)
92 \brief Clear PPC interrupt.
93
94 \fn int32_t ARM_PPC_InterruptState (void)
95 \brief PPC interrupt state.
96 \return Returns 1 if the interrupt is active, 0 otherwise.
97*/
98
99/**
100 * \brief Access structure of the MPC Driver.
101 */
102typedef struct _ARM_DRIVER_PPC {
103 ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_PPC_GetVersion : Get driver version.
104 int32_t (*Initialize) (void); ///< Pointer to \ref ARM_PPC_Initialize : Initialize the PPC Interface.
105 int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_PPC_Uninitialize : De-initialize the PPC Interface.
106 int32_t (*ConfigPeriph) (uint8_t periph, ARM_PPC_SecAttr sec_attr, ARM_PPC_PrivAttr priv_attr); ///< Pointer to \ref ARM_PPC_ConfigPeriph : Configure a peripheral controlled by the PPC.
107 uint32_t (*IsPeriphSecure) (uint8_t periph); ///< Pointer to \ref IsPeriphSecure : Check if the peripheral is configured to be secure.
108 uint32_t (*IsPeriphPrivOnly) (uint8_t periph); ///< Pointer to \ref IsPeriphPrivOnly : Check if the peripheral is configured to be privilege only.
109 int32_t (*EnableInterrupt) (void); ///< Pointer to \ref ARM_PPC_EnableInterrupt : Enable PPC interrupt.
110 void (*DisableInterrupt) (void); ///< Pointer to \ref ARM_PPC_DisableInterrupt : Disable PPC interrupt.
111 void (*ClearInterrupt) (void); ///< Pointer to \ref ARM_PPC_ClearInterrupt : Clear PPC interrupt.
112 uint32_t (*InterruptState) (void); ///< Pointer to \ref ARM_PPC_InterruptState : PPC interrupt State.
113} const ARM_DRIVER_PPC;
114
115#endif /* __CMSIS_PPC_DRV_H__ */
116