Debian Codegraph @

ports/renesas-ra/ra/ra_utils.c

raw
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2021 Renesas Electronics Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 #include "hal_data.h"
26 #include "ra_config.h"
27 #include "ra_utils.h"
28
29 static R_SYSTEM_Type *system_reg = (R_SYSTEM_Type *)0x4001E000;
30 static R_MSTP_Type *mstp_reg = R_MSTP;
31
32 void ra_mstpcra_stop(uint32_t mod_mask) {
33 system_reg->PRCR = 0xa502;
34 system_reg->MSTPCRA |= mod_mask;
35 system_reg->PRCR = 0xa500;
36 }
37
38 void ra_mstpcra_start(uint32_t mod_mask) {
39 system_reg->PRCR = 0xa502;
40 system_reg->MSTPCRA &= ~mod_mask;
41 system_reg->PRCR = 0xa500;
42 }
43
44 void ra_mstpcrb_stop(uint32_t mod_mask) {
45 system_reg->PRCR = 0xa502;
46 mstp_reg->MSTPCRB |= mod_mask;
47 system_reg->PRCR = 0xa500;
48 }
49
50 void ra_mstpcrb_start(uint32_t mod_mask) {
51 system_reg->PRCR = 0xa502;
52 mstp_reg->MSTPCRB &= ~mod_mask;
53 system_reg->PRCR = 0xa500;
54 }
55
56 void ra_mstpcrc_stop(uint32_t mod_mask) {
57 system_reg->PRCR = 0xa502;
58 mstp_reg->MSTPCRC |= mod_mask;
59 system_reg->PRCR = 0xa500;
60 }
61
62 void ra_mstpcrc_start(uint32_t mod_mask) {
63 system_reg->PRCR = 0xa502;
64 mstp_reg->MSTPCRC &= ~mod_mask;
65 system_reg->PRCR = 0xa500;
66 }
67
68 void ra_mstpcrd_stop(uint32_t mod_mask) {
69 system_reg->PRCR = 0xa502;
70 mstp_reg->MSTPCRD |= mod_mask;
71 system_reg->PRCR = 0xa500;
72 }
73
74 void ra_mstpcrd_start(uint32_t mod_mask) {
75 system_reg->PRCR = 0xa502;
76 mstp_reg->MSTPCRD &= ~mod_mask;
77 system_reg->PRCR = 0xa500;
78 }
79
80 void ra_mstpcre_stop(uint32_t mod_mask) {
81 system_reg->PRCR = 0xa502;
82 mstp_reg->MSTPCRE |= mod_mask;
83 system_reg->PRCR = 0xa500;
84 }
85
86 void ra_mstpcre_start(uint32_t mod_mask) {
87 system_reg->PRCR = 0xa502;
88 mstp_reg->MSTPCRE &= ~mod_mask;
89 system_reg->PRCR = 0xa500;
90 }
91
92 __WEAK void ctsu_write_isr(void) {
93 // dummy
94 }
95
96 __WEAK void ctsu_read_isr(void) {
97 // dummy
98 }
99
100 __WEAK void ctsu_end_isr(void) {
101 // dummy
102 }