1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
19 * Calls: GetResource()
\r
27 //#include <stdio.h>
\r
29 #include "os_test.h"
\r
40 /* Trigger higher prio interrupt */
\r
41 Irq_GenerateSoftInt(EXTI1_IRQn);
\r
42 TEST_ASSERT(test_nr==8);
\r
56 /* Trigger higher prio interrupt */
\r
57 Irq_GenerateSoftInt(EXTI2_IRQn);
\r
58 TEST_ASSERT(test_nr==7);
\r
69 void etask_sup_l_04( void ) {
\r
78 // test 01 ===============================================
\r
79 // Test: Grab and release the one and only standard resource.
\r
80 GetResource(RES_SCHEDULER);
\r
81 ReleaseResource(RES_SCHEDULER);
\r
87 // test 02 ===============================================
\r
88 // Test: Grab resource twice. Should result in E_OS_ACCESS
\r
89 GetResource(RES_SCHEDULER);
\r
90 GetResource(RES_SCHEDULER);
\r
91 ReleaseResource(RES_SCHEDULER);
\r
98 // test 03 ===============================================
\r
99 // Test: Check that the scheduler is locked when doing this.
\r
100 // SetEvent() on higher prio process.
\r
101 GetResource(RES_SCHEDULER);
\r
103 ReleaseResource(RES_SCHEDULER);
\r
108 // test 04 ===============================================
\r
109 // Test: Check that priority inversion works.
\r
110 // Allocate resource and check priority.
\r
111 GetResource(RES_ID_ext_prio_3);
\r
112 ReleaseResource(RES_ID_ext_prio_3);
\r
117 // test 05 ===============================================
\r
118 // Test: Attempt to get a resource which the statically assigned
\r
119 // priority of the calling task or interrupt routine is
\r
120 // higher than the calculated ceiling priority, E_OS_ACCESS
\r
121 TEST_ASSERT(test_nr==5);
\r
124 // test 06 ===============================================
\r
125 // Test: Nest resources
\r
126 GetResource(RES_ID_ext_prio_3);
\r
127 GetResource(RES_ID_ext_prio_4);
\r
128 ReleaseResource(RES_ID_ext_prio_4);
\r
129 ReleaseResource(RES_ID_ext_prio_3);
\r
142 void etask_sup_m_04( void ) {
\r
147 ChainTask(TASK_ID_etask_sup_l);
\r