Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.

Dependents:   denki-yohou_b TestY201 Network-RTOS NTPClient_HelloWorld ... more

Deprecated

This is the mbed 2 rtos library. mbed OS 5 integrates the mbed library with mbed-rtos. With this, we have provided thread safety for all mbed APIs. If you'd like to learn about using mbed OS 5, please see the docs.

Committer:
Kojto
Date:
Tue Jul 04 13:32:20 2017 +0100
Revision:
125:5713cbbdb706
Parent:
118:6635230e06ba
replace mbed_rtx by mbed_rtx4

Not causing a conflict with mbed_rtx that is for newer rtos

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 118:6635230e06ba 1 /*----------------------------------------------------------------------------
Kojto 118:6635230e06ba 2 * CMSIS-RTOS - RTX
Kojto 118:6635230e06ba 3 *----------------------------------------------------------------------------
Kojto 118:6635230e06ba 4 * Name: rt_OsEventObserver.c
Kojto 118:6635230e06ba 5 * Purpose: OS Event Callbacks for CMSIS RTOS
Kojto 118:6635230e06ba 6 * Rev.: VX.XX
Kojto 118:6635230e06ba 7 *----------------------------------------------------------------------------
Kojto 118:6635230e06ba 8 *
Kojto 118:6635230e06ba 9 * Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
Kojto 118:6635230e06ba 10 * All rights reserved.
Kojto 118:6635230e06ba 11 * Redistribution and use in source and binary forms, with or without
Kojto 118:6635230e06ba 12 * modification, are permitted provided that the following conditions are met:
Kojto 118:6635230e06ba 13 * - Redistributions of source code must retain the above copyright
Kojto 118:6635230e06ba 14 * notice, this list of conditions and the following disclaimer.
Kojto 118:6635230e06ba 15 * - Redistributions in binary form must reproduce the above copyright
Kojto 118:6635230e06ba 16 * notice, this list of conditions and the following disclaimer in the
Kojto 118:6635230e06ba 17 * documentation and/or other materials provided with the distribution.
Kojto 118:6635230e06ba 18 * - Neither the name of ARM nor the names of its contributors may be used
Kojto 118:6635230e06ba 19 * to endorse or promote products derived from this software without
Kojto 118:6635230e06ba 20 * specific prior written permission.
Kojto 118:6635230e06ba 21 *
Kojto 118:6635230e06ba 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 118:6635230e06ba 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 118:6635230e06ba 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Kojto 118:6635230e06ba 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
Kojto 118:6635230e06ba 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Kojto 118:6635230e06ba 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Kojto 118:6635230e06ba 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Kojto 118:6635230e06ba 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Kojto 118:6635230e06ba 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Kojto 118:6635230e06ba 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Kojto 118:6635230e06ba 32 * POSSIBILITY OF SUCH DAMAGE.
Kojto 118:6635230e06ba 33 *---------------------------------------------------------------------------*/
Kojto 118:6635230e06ba 34
Kojto 118:6635230e06ba 35 #include "rt_OsEventObserver.h"
Kojto 118:6635230e06ba 36
Kojto 118:6635230e06ba 37 /*
Kojto 118:6635230e06ba 38 * _____ _____ ____ __ _____
Kojto 118:6635230e06ba 39 * | ___|_ _\ \/ / \/ | ____|
Kojto 118:6635230e06ba 40 * | |_ | | \ /| |\/| | _|
Kojto 118:6635230e06ba 41 * | _| | | / \| | | | |___
Kojto 118:6635230e06ba 42 * |_| |___/_/\_\_| |_|_____|
Kojto 118:6635230e06ba 43 *
Kojto 118:6635230e06ba 44 * FIXME:
Kojto 118:6635230e06ba 45 * The osEventObs variable must be in protected memory. If not every box
Kojto 118:6635230e06ba 46 * and box 0 can modify osEventObs to point to any handler to run code
Kojto 118:6635230e06ba 47 * privileged. This issue is tracked at
Kojto 118:6635230e06ba 48 * <https://github.com/ARMmbed/uvisor/issues/235>.
Kojto 118:6635230e06ba 49 */
Kojto 118:6635230e06ba 50 const OsEventObserver *osEventObs;
Kojto 118:6635230e06ba 51
Kojto 118:6635230e06ba 52 void osRegisterForOsEvents(const OsEventObserver *observer)
Kojto 118:6635230e06ba 53 {
Kojto 118:6635230e06ba 54 static uint8_t has_been_called = 0;
Kojto 118:6635230e06ba 55 if (has_been_called) {
Kojto 118:6635230e06ba 56 return;
Kojto 118:6635230e06ba 57 }
Kojto 118:6635230e06ba 58 has_been_called = 1;
Kojto 118:6635230e06ba 59
Kojto 118:6635230e06ba 60 osEventObs = observer;
Kojto 118:6635230e06ba 61 }