Mouse code for the MacroRat
mbed-dev/targets/TARGET_ARM_SSG/TARGET_BEETLE/device/system_core_beetle.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /* |
sahilmgandhi | 18:6a4db94011d3 | 2 | * PackageLicenseDeclared: Apache-2.0 |
sahilmgandhi | 18:6a4db94011d3 | 3 | * Copyright (c) 2015 ARM Limited |
sahilmgandhi | 18:6a4db94011d3 | 4 | * |
sahilmgandhi | 18:6a4db94011d3 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
sahilmgandhi | 18:6a4db94011d3 | 6 | * you may not use this file except in compliance with the License. |
sahilmgandhi | 18:6a4db94011d3 | 7 | * You may obtain a copy of the License at |
sahilmgandhi | 18:6a4db94011d3 | 8 | * |
sahilmgandhi | 18:6a4db94011d3 | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
sahilmgandhi | 18:6a4db94011d3 | 10 | * |
sahilmgandhi | 18:6a4db94011d3 | 11 | * Unless required by applicable law or agreed to in writing, software |
sahilmgandhi | 18:6a4db94011d3 | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
sahilmgandhi | 18:6a4db94011d3 | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
sahilmgandhi | 18:6a4db94011d3 | 14 | * See the License for the specific language governing permissions and |
sahilmgandhi | 18:6a4db94011d3 | 15 | * limitations under the License. |
sahilmgandhi | 18:6a4db94011d3 | 16 | */ |
sahilmgandhi | 18:6a4db94011d3 | 17 | |
sahilmgandhi | 18:6a4db94011d3 | 18 | #ifndef SYSTEM_CORE_BEETLE_H |
sahilmgandhi | 18:6a4db94011d3 | 19 | #define SYSTEM_CORE_BEETLE_H |
sahilmgandhi | 18:6a4db94011d3 | 20 | |
sahilmgandhi | 18:6a4db94011d3 | 21 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 22 | extern "C" { |
sahilmgandhi | 18:6a4db94011d3 | 23 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 24 | |
sahilmgandhi | 18:6a4db94011d3 | 25 | /* |
sahilmgandhi | 18:6a4db94011d3 | 26 | * SystemCoreConfig(): Configure the System Core |
sahilmgandhi | 18:6a4db94011d3 | 27 | */ |
sahilmgandhi | 18:6a4db94011d3 | 28 | void SystemCoreConfig(void); |
sahilmgandhi | 18:6a4db94011d3 | 29 | |
sahilmgandhi | 18:6a4db94011d3 | 30 | /* POWER MANAGEMENT */ |
sahilmgandhi | 18:6a4db94011d3 | 31 | /* Power Mode Type Definition */ |
sahilmgandhi | 18:6a4db94011d3 | 32 | typedef enum { |
sahilmgandhi | 18:6a4db94011d3 | 33 | /* Sleep Power Mode */ |
sahilmgandhi | 18:6a4db94011d3 | 34 | POWER_MODE_SLEEP = 0, |
sahilmgandhi | 18:6a4db94011d3 | 35 | /* Deep Sleep Power Mode */ |
sahilmgandhi | 18:6a4db94011d3 | 36 | POWER_MODE_DEEP_SLEEP = 1 |
sahilmgandhi | 18:6a4db94011d3 | 37 | } power_mode_t; |
sahilmgandhi | 18:6a4db94011d3 | 38 | |
sahilmgandhi | 18:6a4db94011d3 | 39 | /* APB System Core Clocks */ |
sahilmgandhi | 18:6a4db94011d3 | 40 | #define SYSTEM_CORE_TIMER0 (1 << 0) |
sahilmgandhi | 18:6a4db94011d3 | 41 | #define SYSTEM_CORE_TIMER1 (1 << 1) |
sahilmgandhi | 18:6a4db94011d3 | 42 | #define SYSTEM_CORE_DUALTIMER0 (1 << 2) |
sahilmgandhi | 18:6a4db94011d3 | 43 | #define SYSTEM_CORE_UART0 (1 << 4) |
sahilmgandhi | 18:6a4db94011d3 | 44 | #define SYSTEM_CORE_UART1 (1 << 5) |
sahilmgandhi | 18:6a4db94011d3 | 45 | #define SYSTEM_CORE_I2C0 (1 << 7) |
sahilmgandhi | 18:6a4db94011d3 | 46 | #define SYSTEM_CORE_WDOG (1 << 8) |
sahilmgandhi | 18:6a4db94011d3 | 47 | #define SYSTEM_CORE_QSPI (1 << 11) |
sahilmgandhi | 18:6a4db94011d3 | 48 | #define SYSTEM_CORE_SPI0 (1 << 12) |
sahilmgandhi | 18:6a4db94011d3 | 49 | #define SYSTEM_CORE_SPI1 (1 << 13) |
sahilmgandhi | 18:6a4db94011d3 | 50 | #define SYSTEM_CORE_I2C1 (1 << 14) |
sahilmgandhi | 18:6a4db94011d3 | 51 | #define SYSTEM_CORE_TRNG (1 << 15) /* TRNG can not be a wakeup source */ |
sahilmgandhi | 18:6a4db94011d3 | 52 | |
sahilmgandhi | 18:6a4db94011d3 | 53 | /* |
sahilmgandhi | 18:6a4db94011d3 | 54 | * SystemPowerConfig(): Configures the System Power Modes |
sahilmgandhi | 18:6a4db94011d3 | 55 | */ |
sahilmgandhi | 18:6a4db94011d3 | 56 | void SystemPowerConfig(void); |
sahilmgandhi | 18:6a4db94011d3 | 57 | |
sahilmgandhi | 18:6a4db94011d3 | 58 | /* |
sahilmgandhi | 18:6a4db94011d3 | 59 | * SystemPowerSuspend(): Enters in System Suspend |
sahilmgandhi | 18:6a4db94011d3 | 60 | */ |
sahilmgandhi | 18:6a4db94011d3 | 61 | void SystemPowerSuspend(power_mode_t mode); |
sahilmgandhi | 18:6a4db94011d3 | 62 | |
sahilmgandhi | 18:6a4db94011d3 | 63 | /* |
sahilmgandhi | 18:6a4db94011d3 | 64 | * SystemPowerResume(): Returns from System Suspend |
sahilmgandhi | 18:6a4db94011d3 | 65 | */ |
sahilmgandhi | 18:6a4db94011d3 | 66 | void SystemPowerResume(power_mode_t mode); |
sahilmgandhi | 18:6a4db94011d3 | 67 | |
sahilmgandhi | 18:6a4db94011d3 | 68 | /* |
sahilmgandhi | 18:6a4db94011d3 | 69 | * Definitions for storing static configuration data in Beetle |
sahilmgandhi | 18:6a4db94011d3 | 70 | * This is not strictly persistent data as it will get wiped out on chip erase. |
sahilmgandhi | 18:6a4db94011d3 | 71 | * |
sahilmgandhi | 18:6a4db94011d3 | 72 | * There are only read functions provided. |
sahilmgandhi | 18:6a4db94011d3 | 73 | * No Write function to prevent accidental writes resulting in |
sahilmgandhi | 18:6a4db94011d3 | 74 | * the system being non responsive. |
sahilmgandhi | 18:6a4db94011d3 | 75 | * Use the Flash manual before trying to write anything in the last 4k. |
sahilmgandhi | 18:6a4db94011d3 | 76 | */ |
sahilmgandhi | 18:6a4db94011d3 | 77 | #define SYSTEM_CORE_CONFIG_DATA_SIZE (0x200) /* 512 bytes*/ |
sahilmgandhi | 18:6a4db94011d3 | 78 | |
sahilmgandhi | 18:6a4db94011d3 | 79 | typedef struct { |
sahilmgandhi | 18:6a4db94011d3 | 80 | uint32_t BD_ADDR[2]; |
sahilmgandhi | 18:6a4db94011d3 | 81 | |
sahilmgandhi | 18:6a4db94011d3 | 82 | /*rest reserved*/ |
sahilmgandhi | 18:6a4db94011d3 | 83 | uint32_t reserved[SYSTEM_CORE_CONFIG_DATA_SIZE - 2]; |
sahilmgandhi | 18:6a4db94011d3 | 84 | } SystemCoreConfigData; |
sahilmgandhi | 18:6a4db94011d3 | 85 | |
sahilmgandhi | 18:6a4db94011d3 | 86 | /* |
sahilmgandhi | 18:6a4db94011d3 | 87 | * __System_Config_GetBDAddr(): Address for the BLE device on the air. |
sahilmgandhi | 18:6a4db94011d3 | 88 | */ |
sahilmgandhi | 18:6a4db94011d3 | 89 | void __System_Config_GetBDAddr(uint8_t *addr, uint8_t len); |
sahilmgandhi | 18:6a4db94011d3 | 90 | |
sahilmgandhi | 18:6a4db94011d3 | 91 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 92 | } |
sahilmgandhi | 18:6a4db94011d3 | 93 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 94 | #endif /* SYSTEM_CORE_BEETLE_H */ |