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