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