Merge pull request #11494 from haslinghuis/dshot_gpio
[betaflight.git] / src / main / drivers / memprot_stm32g4xx.c
blobd8daae268240da0a5cebe0ef1c57522d655781e7
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #include "platform.h"
23 #include "memprot.h"
25 // Defined in linker script
26 extern uint8_t dma_ram_r_start;
27 extern uint8_t dma_ram_r_end;
29 extern uint8_t dma_ram_w_start;
30 extern uint8_t dma_ram_w_end;
32 extern uint8_t dma_ram_rw_start;
33 extern uint8_t dma_ram_rw_end;
35 mpuRegion_t mpuRegions[] = {
37 // DMA_RAM_R
38 // DMA receive buffer in SRAM
39 .start = (uint32_t)&dma_ram_r_start,
40 .end = (uint32_t)&dma_ram_r_end,
41 .size = 0, // Size determined by ".end"
42 .perm = MPU_REGION_FULL_ACCESS,
43 .exec = MPU_INSTRUCTION_ACCESS_ENABLE,
44 .shareable = MPU_ACCESS_SHAREABLE,
45 .cacheable = MPU_ACCESS_NOT_CACHEABLE,
46 .bufferable = MPU_ACCESS_BUFFERABLE,
49 // DMA_RAM_W
50 // DMA transmit buffer in SRAM
51 .start = (uint32_t)&dma_ram_w_start,
52 .end = (uint32_t)&dma_ram_w_end,
53 .size = 0, // Size determined by ".end"
54 .perm = MPU_REGION_FULL_ACCESS,
55 .exec = MPU_INSTRUCTION_ACCESS_ENABLE,
56 .shareable = MPU_ACCESS_SHAREABLE,
57 .cacheable = MPU_ACCESS_CACHEABLE,
58 .bufferable = MPU_ACCESS_NOT_BUFFERABLE,
61 // DMA_RAM_RW
62 // DMA transmit and receive buffer in SRAM
63 .start = (uint32_t)&dma_ram_rw_start,
64 .end = (uint32_t)&dma_ram_rw_end,
65 .size = 0, // Size determined by ".end"
66 .perm = MPU_REGION_FULL_ACCESS,
67 .exec = MPU_INSTRUCTION_ACCESS_ENABLE,
68 .shareable = MPU_ACCESS_SHAREABLE,
69 .cacheable = MPU_ACCESS_NOT_CACHEABLE,
70 .bufferable = MPU_ACCESS_NOT_BUFFERABLE,
74 unsigned mpuRegionCount = ARRAYLEN(mpuRegions);