Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers priv_sys_hooks_exports.h Source File

priv_sys_hooks_exports.h

00001 /*
00002  * Copyright (c) 2016, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
00018 #define __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
00019 
00020 /* Predeclaration */
00021 typedef struct uvisor_semaphore UvisorSemaphore;
00022 
00023 /*
00024  * Privileged system hooks
00025  *
00026  * In this version of uVisor, uVisor lives alongside an RTOS that requires
00027  * running privileged code. In order for the RTOS to run any privileged code,
00028  * uVisor must allow the RTOS to handle a subset of privileged system
00029  * interrupts or system calls. Only the following system interrupts and system
00030  * calls are hookable. Code called by these hooks circumvents uVisor security.
00031  * HANDLE WITH CARE. */
00032 typedef struct {
00033     void (*priv_svc_0)(void);
00034     void (*priv_pendsv)(void);
00035     void (*priv_systick)(void);
00036     int32_t (*priv_os_suspend)(void);
00037     int (*priv_uvisor_semaphore_post)(UvisorSemaphore * semaphore);
00038 } UvisorPrivSystemHooks;
00039 
00040 /* Use this macro to register privileged system IRQ hooks. If you don't want to
00041  * register a particular privileged system IRQ hook, you can supply NULL for
00042  * that hook parameter. */
00043 #define UVISOR_SET_PRIV_SYS_HOOKS(priv_svc_0_, priv_pendsv_, priv_systick_, priv_os_suspend_, priv_uvisor_semaphore_post_) \
00044     UVISOR_EXTERN_C_BEGIN \
00045     const UvisorPrivSystemHooks __uvisor_priv_sys_hooks = { \
00046         .priv_svc_0 = priv_svc_0_, \
00047         .priv_pendsv = priv_pendsv_, \
00048         .priv_systick = priv_systick_, \
00049         .priv_os_suspend = priv_os_suspend_, \
00050         .priv_uvisor_semaphore_post = priv_uvisor_semaphore_post_, \
00051     }; \
00052     UVISOR_EXTERN_C_END
00053 
00054 #endif