• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
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 _STM32_PLAT_H_
18 #define _STM32_PLAT_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #include <stdint.h>
25 #include <stdbool.h>
26 #include <seos.h>
27 
28 
29 enum PlatSleepDevID
30 {
31     Stm32sleepDevTim2, /* we use this for short sleeps in WFI mode */
32     Stm32sleepDevTim4, /* input capture uses this, potentially */
33     Stm32sleepDevTim5, /* input capture uses this, potentially */
34     Stm32sleepDevTim9, /* input capture uses this, potentially */
35     Stm32sleepWakeup,  /* we use this to wakeup from AP */
36     Stm32sleepDevSpi2, /* we use this to prevent stop mode during spi2 xfers */
37     Stm32sleepDevSpi3, /* we use this to prevent stop mode during spi3 xfers */
38     Stm32sleepDevI2c1, /* we use this to prevent stop mode during i2c1 xfers */
39 
40     Stm32sleepDevNum,  //must be last always, and must be <= PLAT_MAX_SLEEP_DEVS
41 };
42 
platGetInternalAppList(uint32_t * numAppsP)43 static inline const struct AppHdr* platGetInternalAppList(uint32_t *numAppsP)
44 {
45     extern const struct AppHdr __internal_app_start, __internal_app_end;
46 
47     *numAppsP = &__internal_app_end - &__internal_app_start;
48     return &__internal_app_start;
49 }
50 
platGetSharedAreaInfo(uint32_t * areaSzP)51 static inline uint8_t* platGetSharedAreaInfo(uint32_t *areaSzP)
52 {
53     extern uint8_t __shared_start[];
54     extern uint8_t __shared_end[];
55 
56     *areaSzP = __shared_end - __shared_start;
57     return __shared_start;
58 }
59 
60 //used for dropbox
61 void* platGetPersistentRamStore(uint32_t *bytes);
62 
platWake(void)63 static inline void platWake(void)
64 {
65 }
66 
67 // GCC aligns 64-bit types on an 8-byte boundary, but Cortex-M4 only requires
68 // 4-byte alignment for these types. So limit the return value, as we're
69 // interested in the minimum alignment requirement.
70 #if defined(__GNUC__) && !defined(alignof)
71 #define alignof(type) ((__alignof__(type) > 4) ? 4 : __alignof__(type))
72 #endif
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
79