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 _CPU_H_
18 #define _CPU_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 
25 #include <seos.h>
26 #include <stdint.h>
27 #include <plat/app.h>
28 
29 
30 void cpuInit(void);
31 void cpuInitLate(void);  //console guaranted to be up by now
32 
33 uint64_t cpuIntsOff(void);
34 uint64_t cpuIntsOn(void);
35 void cpuIntsRestore(uint64_t state);
36 
37 /* app loading, unloading & calling */
38 bool cpuInternalAppLoad(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo);
39 bool cpuAppLoad(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo);
40 void cpuAppUnload(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo);
41 bool cpuAppInit(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo, uint32_t tid);
42 void cpuAppEnd(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo);
43 void cpuAppHandle(const struct AppHdr *appHdr, struct PlatAppInfo *platInfo, uint32_t evtType, const void* evtData);
44 void cpuAppInvoke(const struct AppHdr *app, struct PlatAppInfo *platInfo,
45                   void (*method)(uintptr_t, uintptr_t), uintptr_t arg1, uintptr_t arg2);
46 
47 /* these default to false, there is CPU_NUM_PERSISTENT_RAM_BITS of them */
48 bool cpuRamPersistentBitGet(uint32_t which);
49 void cpuRamPersistentBitSet(uint32_t which, bool on);
50 
51 
52 #ifdef __cplusplus
53 }
54 #endif
55 
56 #endif
57 
58