XMC_pau_c

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1 /**

2 * @file xmc_pau.c
3 * @date 2015-06-20
4 *
5 * @cond
6 *****************************************************************************
7 * XMClib v2.2.0 - XMC Peripheral Driver Library
8 *
9 * Copyright (c) 2015-2020, Infineon Technologies AG
10 * All rights reserved.
11 *
12 * Boost Software License - Version 1.0 - August 17th, 2003
13 *
14 * Permission is hereby granted, free of charge, to any person or organization
15 * obtaining a copy of the software and accompanying documentation covered by
16 * this license (the "Software") to use, reproduce, display, distribute,
17 * execute, and transmit the Software, and to prepare derivative works of the
18 * Software, and to permit third-parties to whom the Software is furnished to
19 * do so, all subject to the following:
20 *
21 * The copyright notices in the Software and this entire statement, including
22 * the above license grant, this restriction and the following disclaimer,
23 * must be included in all copies of the Software, in whole or in part, and
24 * all derivative works of the Software, unless such copies or derivative
25 * works are solely in the form of machine-executable object code generated by
26 * a source language processor.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
31 * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
32 * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
33 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34 * DEALINGS IN THE SOFTWARE.
35 *
36 * To improve the quality of the software, users are encouraged to share
37 * modifications, enhancements or bug fixes with Infineon Technologies AG
38 * at XMCSupport@infineon.com.
39 *****************************************************************************
40 *
41 * Change History
42 * --------------
43 *
44 * 2015-02-20:
45 * - Initial <br>
46 *
47 * 2015-06-20:
48 * - Removed GetDriverVersion API
49 * @endcond
50 *
51 */
52
53 /**
54 *
55 * @brief PAU driver for XMC1 microcontroller family.
56 *
57 */
58
59 /*************************************************************************************
********************************
60 * HEADER FILES
61
*************************************************************************************
********************************/
62 #include "xmc_pau.h"
63
64 #if defined(PAU)
65
66 /*************************************************************************************
*********************************
67 * API IMPLEMENTATION
68
*************************************************************************************
********************************/
69
70 /*
71 * Enable peripheral access
72 */
73 void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral)
74 {
75 uint32_t reg_num;
76
77 reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
78 XMC_PAU->PRIVDIS[reg_num] &= (uint32_t)~((uint32_t)peripheral & 0x0fffffffUL);
79 }
80
81 /*
82 * Disable peripheral access
83 */
84 void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral)
85 {
86 uint32_t reg_num;
87
88 reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
89 XMC_PAU->PRIVDIS[reg_num] |= (uint32_t)((uint32_t)peripheral & 0x0fffffffUL);
90 }
91
92 /*
93 * Check if peripheral access is enabled
94 */
95 bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral)
96 {
97 uint32_t reg_num;
98
99 reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
100 return (bool)(XMC_PAU->PRIVDIS[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL));
101 }
102
103 /*
104 * Check if peripheral is available
105 */
106 bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral)
107 {
108 uint32_t reg_num;
109
110 reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
111 return (bool)(XMC_PAU->AVAIL[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL));
112 }
113
114 #endif /* defined(PAU) */
115

You might also like