From a83f895dd5eb815cf254f699680c7ab1903f462b Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Mon, 28 Mar 2016 14:11:44 -0700 Subject: [PATCH] microkernel: deprecate task IRQs This mechanism does not add enough value to the kernel to be worth maintaining it. Drivers that need deferred processing of interrupts can simply define their own task and have the interrupt handler release an event that the task waits on. The API is marked as deprecated and it is removed from unit test coverage as well as the documentation. Change-Id: Ib87b91cb41e9b6d7fdf0dc62b240a531b6a8889f Signed-off-by: Andrew Boie --- doc/kernel/microkernel/microkernel.rst | 1 - .../microkernel/microkernel_task_irqs.rst | 115 -- include/microkernel/task_irq.h | 9 +- .../footprint/microkernel/float/arm.conf | 2 - .../footprint/microkernel/float/x86.conf | 4 +- .../footprint/microkernel/max/arm.conf | 1 - .../footprint/microkernel/max/x86.conf | 3 +- .../microkernel/src/microkernel_footprint.c | 4 - tests/kernel/test_task_irq/Makefile | 6 - tests/kernel/test_task_irq/README.txt | 58 - tests/kernel/test_task_irq/prj.mdef | 14 - tests/kernel/test_task_irq/prj_arm.conf | 6 - tests/kernel/test_task_irq/prj_x86.conf | 5 - tests/kernel/test_task_irq/src/Makefile | 3 - tests/kernel/test_task_irq/src/main.c | 147 -- tests/kernel/test_task_irq/src/raise_int.c | 1406 ----------------- tests/kernel/test_task_irq/src/test_device.c | 185 --- tests/kernel/test_task_irq/testcase.ini | 3 - 18 files changed, 7 insertions(+), 1965 deletions(-) delete mode 100644 doc/kernel/microkernel/microkernel_task_irqs.rst delete mode 100644 tests/kernel/test_task_irq/Makefile delete mode 100644 tests/kernel/test_task_irq/README.txt delete mode 100644 tests/kernel/test_task_irq/prj.mdef delete mode 100644 tests/kernel/test_task_irq/prj_arm.conf delete mode 100644 tests/kernel/test_task_irq/prj_x86.conf delete mode 100644 tests/kernel/test_task_irq/src/Makefile delete mode 100644 tests/kernel/test_task_irq/src/main.c delete mode 100644 tests/kernel/test_task_irq/src/raise_int.c delete mode 100644 tests/kernel/test_task_irq/src/test_device.c delete mode 100644 tests/kernel/test_task_irq/testcase.ini diff --git a/doc/kernel/microkernel/microkernel.rst b/doc/kernel/microkernel/microkernel.rst index aa1f10405e3..bebfb31d656 100644 --- a/doc/kernel/microkernel/microkernel.rst +++ b/doc/kernel/microkernel/microkernel.rst @@ -16,4 +16,3 @@ nanokernel applications. microkernel_memory microkernel_synchronization microkernel_data - microkernel_task_irqs.rst diff --git a/doc/kernel/microkernel/microkernel_task_irqs.rst b/doc/kernel/microkernel/microkernel_task_irqs.rst deleted file mode 100644 index 764c5b47ec9..00000000000 --- a/doc/kernel/microkernel/microkernel_task_irqs.rst +++ /dev/null @@ -1,115 +0,0 @@ -.. _microkernel_task_irqs: - -Interrupt Services -################## - -Concepts -******** - -The microkernel's :dfn:`task IRQ` objects allow interrupts to be serviced -by tasks, rather than only by interrupt service routines (ISRs). These allow -a microkernel project to have both task-level device drivers and interrupt-level -device drivers. - -Any number of task IRQs can be defined in a microkernel system. Each task IRQ -has a numeric identifier that uniquely identifies it. These identifiers range -from 0 to N-1, where N is the total number of task IRQs in the system. - -A task that wants to service interrupts from a device must first allocate a -task IRQ and bind it to the device's interrupt source by specifying the IRQ -and interrupt priority level assigned to that device by the system designer. -Once a task IRQ has been allocated by a task, it cannot be used by other -tasks; this prevents other tasks from interfering with the proper processing -of interrupts from that device. - -When an interrupt is generated by the device, the kernel runs an ISR that -masks the interrupt and signals the occurrence of the interrupt to the -associated task IRQ. The task can then use the task IRQ to recognize that -an interrupt has occurred and take action to service the interrupt. At some -point during interrupt servicing, the task must instruct the task IRQ to -acknowledge the interrupt; this causes the kernel to unmask the interrupt so -that future interrupts can be detected. - -Purpose -******* - -Use a task IRQ when the work required to process an interrupt cannot be done -in an ISR -- either because it takes a long time, or because it requires the -processing routine to block. - -Usage -***** - -Configuring Task IRQs -===================== - -Set the :option:`MAX_NUM_TASK_IRQS` configuration option to specify the number -of task IRQs allowed in the project. - -The default value of zero for this option disables task IRQs. - -.. note:: - Unlike most other microkernel object types, task-level IRQs are defined - as a group using a configuration option, rather than as individual - public objects in an MDEF or private objects in a source file. - - -Example: Allocating a Task IRQ -============================== - -This code associates a task IRQ with interrupts generated by a device. -Interrupts from that device are then enabled so they can be processed -using the task IRQ. - -.. code-block:: c - - #define FOO_DEVICE 2 /* device "foo" uses task IRQ object 2 */ - #define FOO_IRQ 37 /* device "foo" uses IRQ 37 */ - #define FOO_PRIO 3 /* device "foo" uses interrupt priority 3 */ - #define FOO_IRQ_FLAGS 0 /* device "foo" IRQ flags. Unused on non-x86 */ - - if (task_irq_alloc(FOO_DEVICE, FOO_IRQ, FOO_PRIO, FOO_IRQ_FLAGS) == - INVALID_VECTOR) { - /* The task IRQ or the interrupt source is not available */ - printf("Task IRQ allocation failed!"); - } - -Example: Servicing Interrupts using a Task IRQ -============================================== - -This code allows a task to wait for an interrupt from a device, -acknowledge the interrupt, and take the necessary steps to service it. - -.. code-block:: c - - task_irq_wait(FOO_DEVICE, TICKS_UNLIMITED); - - /* Device interrupt is now masked */ - /* Do pre-acknowledgement device processing (if any) */ - - task_irq_ack(FOO_DEVICE); - - /* Device interrupt is now unmasked */ - /* Do post-acknowledgement device processing (if any) */ - -The steps required to service a device are device-specific. In some cases -all processing may need to be completed before the interrupt is acknowledged, -while in other cases no processing at all should be done until the interrupt -is acknowledged. Some devices may require processing both before and after -acknowledgement. - - -APIs -**** - -Task IRQ APIs provided by :file:`microkernel.h` -=============================================== - -:cpp:func:`task_irq_alloc()` - Bind a task IRQ to a device and enable interrupts. - -:cpp:func:`task_irq_ack()` - Acknowledge an interrupt and re-enable the interrupt. - -:cpp:func:`task_irq_wait()` - Wait for an interrupt to occur within a specified time period. diff --git a/include/microkernel/task_irq.h b/include/microkernel/task_irq.h index 49acdb02ebd..5f099a56587 100644 --- a/include/microkernel/task_irq.h +++ b/include/microkernel/task_irq.h @@ -53,7 +53,7 @@ extern "C" { * @return assigned interrupt vector if successful, INVALID_VECTOR if not */ extern uint32_t task_irq_alloc(kirq_t irq_obj, uint32_t irq, uint32_t priority, - uint32_t flags); + uint32_t flags) __attribute__((deprecated)); /** * @@ -65,7 +65,7 @@ extern uint32_t task_irq_alloc(kirq_t irq_obj, uint32_t irq, uint32_t priority, * * @return N/A */ -extern void task_irq_ack(kirq_t irq_obj); +extern void task_irq_ack(kirq_t irq_obj) __attribute__((deprecated)); /** * @brief Wait for task IRQ to signal an interrupt. @@ -85,7 +85,8 @@ extern void task_irq_ack(kirq_t irq_obj); * @a timeout = TICKS_NONE. * @sa TICKS_NONE, TICKS_UNLIMITED */ -extern int task_irq_wait(kirq_t irq_obj, int32_t timeout); +extern int task_irq_wait(kirq_t irq_obj, int32_t timeout) + __attribute__((deprecated)); /** * @} @@ -95,4 +96,4 @@ extern int task_irq_wait(kirq_t irq_obj, int32_t timeout); } #endif -#endif /* TASK_IRQ_H */ \ No newline at end of file +#endif /* TASK_IRQ_H */ diff --git a/tests/benchmark/footprint/microkernel/float/arm.conf b/tests/benchmark/footprint/microkernel/float/arm.conf index c588f29d26b..732a483d85b 100644 --- a/tests/benchmark/footprint/microkernel/float/arm.conf +++ b/tests/benchmark/footprint/microkernel/float/arm.conf @@ -10,7 +10,5 @@ CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_MAX_NUM_TASK_IRQS=2 - CONFIG_NUM_IRQS=43 CONFIG_SW_ISR_TABLE_DYNAMIC=y diff --git a/tests/benchmark/footprint/microkernel/float/x86.conf b/tests/benchmark/footprint/microkernel/float/x86.conf index ba7965f31e1..fae43ac6ad6 100644 --- a/tests/benchmark/footprint/microkernel/float/x86.conf +++ b/tests/benchmark/footprint/microkernel/float/x86.conf @@ -10,9 +10,7 @@ CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y - -CONFIG_MAX_NUM_TASK_IRQS=2 - +CONFIG_NUM_DYNAMIC_STUBS=2 CONFIG_FLOAT=y CONFIG_SSE=y CONFIG_FP_SHARING=y diff --git a/tests/benchmark/footprint/microkernel/max/arm.conf b/tests/benchmark/footprint/microkernel/max/arm.conf index 0d50708754d..eb5d5dda968 100644 --- a/tests/benchmark/footprint/microkernel/max/arm.conf +++ b/tests/benchmark/footprint/microkernel/max/arm.conf @@ -8,6 +8,5 @@ CONFIG_NUM_COMMAND_PACKETS=64 CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_MAX_NUM_TASK_IRQS=2 CONFIG_NUM_IRQS=43 CONFIG_SW_ISR_TABLE_DYNAMIC=y diff --git a/tests/benchmark/footprint/microkernel/max/x86.conf b/tests/benchmark/footprint/microkernel/max/x86.conf index c9188800bd7..86f17fa9e84 100644 --- a/tests/benchmark/footprint/microkernel/max/x86.conf +++ b/tests/benchmark/footprint/microkernel/max/x86.conf @@ -9,5 +9,4 @@ CONFIG_NUM_COMMAND_PACKETS=64 CONFIG_NUM_TIMER_PACKETS=16 CONFIG_MICROKERNEL_SERVER_STACK_SIZE=4096 CONFIG_SYS_POWER_MANAGEMENT=y -CONFIG_MAX_NUM_TASK_IRQS=2 - +CONFIG_NUM_DYNAMIC_STUBS=2 diff --git a/tests/benchmark/footprint/microkernel/src/microkernel_footprint.c b/tests/benchmark/footprint/microkernel/src/microkernel_footprint.c index 56aa9390a9a..6ce40b05945 100644 --- a/tests/benchmark/footprint/microkernel/src/microkernel_footprint.c +++ b/tests/benchmark/footprint/microkernel/src/microkernel_footprint.c @@ -61,10 +61,6 @@ static pfunc func_array[] = { (pfunc)task_mem_map_alloc, (pfunc)_task_mem_map_free, #ifdef TEST_max - /* task device interrupt functions */ - (pfunc)task_irq_alloc, - (pfunc)task_irq_wait, - (pfunc)task_irq_ack, /* semaphore functions */ (pfunc)isr_sem_give, (pfunc)task_sem_give, diff --git a/tests/kernel/test_task_irq/Makefile b/tests/kernel/test_task_irq/Makefile deleted file mode 100644 index 01ab057b11b..00000000000 --- a/tests/kernel/test_task_irq/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -MDEF_FILE = prj.mdef -KERNEL_TYPE = micro -BOARD ?= qemu_x86 -CONF_FILE = prj_$(ARCH).conf - -include ${ZEPHYR_BASE}/Makefile.inc diff --git a/tests/kernel/test_task_irq/README.txt b/tests/kernel/test_task_irq/README.txt deleted file mode 100644 index caa6d5583a4..00000000000 --- a/tests/kernel/test_task_irq/README.txt +++ /dev/null @@ -1,58 +0,0 @@ -Title: Task Level Interrupt Handling - -Description: - -This test exercises the APIs of the task level interrupt handling feature. - --------------------------------------------------------------------------------- - -Building and Running Project: - -This microkernel project outputs to the console. It can be built and executed -on QEMU as follows: - - make qemu - --------------------------------------------------------------------------------- - -Troubleshooting: - -Problems caused by out-dated project information can be addressed by -issuing one of the following commands then rebuilding the project: - - make clean # discard results of previous builds - # but keep existing configuration info -or - make pristine # discard results of previous builds - # and restore pre-defined configuration info - --------------------------------------------------------------------------------- - -Sample Output: - -Starting task level interrupt handling tests -=================================================================== -IRQ object 0 using IRQ8 allocated -IRQ object 1 using IRQ14 allocated - -IRQ object 2 using IRQ32 allocated -IRQ object 3 using IRQ34 allocated - -Generating interrupts for all allocated IRQ objects... -Received event for IRQ object 0 -Received event for IRQ object 1 -Received event for IRQ object 2 -Received event for IRQ object 3 - -Attempt to allocate an IRQ object that -is already allocated by another task... -Re-allocation of IRQ object 3 prevented - -Attempt to allocate an IRQ that -is already allocated by another task... -Re-allocation of IRQ34 prevented - -Attempt to free an IRQ object... -IRQ object 2 freed -=================================================================== -PROJECT EXECUTION SUCCESSFUL diff --git a/tests/kernel/test_task_irq/prj.mdef b/tests/kernel/test_task_irq/prj.mdef deleted file mode 100644 index 413f26617bd..00000000000 --- a/tests/kernel/test_task_irq/prj.mdef +++ /dev/null @@ -1,14 +0,0 @@ -% Application : kernel task level device interrupt test - -% TASK NAME PRIO ENTRY STACK GROUPS -% =================================================== - TASK MONITORTASK 10 MonitorTaskEntry 1024 [EXE] - TASK tTaskAMain 11 taskAMain 1024 [EXE] - TASK tTaskBMain 12 taskBMain 1024 [EXE] - TASK tRegisterWait 13 registerWait 1024 [EXE] - -% SEMA NAME -% ================= - SEMA SEM_TASKDONE - SEMA SEM_TASKFAIL - SEMA SEM_RDY diff --git a/tests/kernel/test_task_irq/prj_arm.conf b/tests/kernel/test_task_irq/prj_arm.conf deleted file mode 100644 index 4b0a8064ab3..00000000000 --- a/tests/kernel/test_task_irq/prj_arm.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Let stack canaries use non-random number generator. -# This option is NOT to be used in production code. -CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_SW_ISR_TABLE_DYNAMIC=y -CONFIG_MAX_NUM_TASK_IRQS=5 -CONFIG_NUM_IRQS=4 diff --git a/tests/kernel/test_task_irq/prj_x86.conf b/tests/kernel/test_task_irq/prj_x86.conf deleted file mode 100644 index e6cc9e118ea..00000000000 --- a/tests/kernel/test_task_irq/prj_x86.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Let stack canaries use non-random number generator. -# This option is NOT to be used in production code. -CONFIG_TEST_RANDOM_GENERATOR=y - -CONFIG_MAX_NUM_TASK_IRQS=5 diff --git a/tests/kernel/test_task_irq/src/Makefile b/tests/kernel/test_task_irq/src/Makefile deleted file mode 100644 index f3bfeb01be3..00000000000 --- a/tests/kernel/test_task_irq/src/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ccflags-y += -I${srctree}/tests/include - -obj-y = main.o raise_int.o test_device.o diff --git a/tests/kernel/test_task_irq/src/main.c b/tests/kernel/test_task_irq/src/main.c deleted file mode 100644 index 58514127c3f..00000000000 --- a/tests/kernel/test_task_irq/src/main.c +++ /dev/null @@ -1,147 +0,0 @@ -/* main.c - main testing module */ - -/* - * Copyright (c) 2013-2014 Wind River Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * DESCRIPTION - * This file contains the main testing module that invokes all the tests. - */ - -#include -#include - -/* One of the task IRQ objects will not be allocated */ -#define NUM_TASK_IRQS CONFIG_MAX_NUM_TASK_IRQS - 1 - -#define NUM_TEST_TASKS 3 /* # of test tasks to monitor */ - -/* # ticks to wait for test completion */ -#define TIMEOUT (60 * sys_clock_ticks_per_sec) - -static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST }; -static ksem_t rdySem = SEM_RDY; - -#define NUM_OBJECTS 4 -extern uint32_t irq_vectors[NUM_OBJECTS]; - -/** - * - * @brief Entry point for taskA - * - * This routine signals "task done" or "task fail", based on the return code of - * taskA. - * - * @return N/A - */ - -void taskAMain(void) -{ - extern int taskA(ksem_t semRdy); - task_sem_give(resultSems[taskA(rdySem)]); -} - -/** - * - * @brief Entry point for taskB - * - * This routine signals "task done" or "task fail", based on the return code of - * taskB. - * - * @return N/A - */ - -void taskBMain(void) -{ - extern int taskB(ksem_t semRdy); - task_sem_give(resultSems[taskB(rdySem)]); -} - -/** - * - * @brief Wait for devices to be registered and generate SW ints - * - * This routine waits for the tasks to indicate the IRQ objects are allocated and - * then generates SW interrupts for all IRQs. Signals "task done" if all task - * indicated the IRQs are allocated or signals "task fail"if not. - * - * @return N/A - */ -void registerWait(void) -{ - extern void raiseInt(uint8_t id); - int tasksDone; - int irq_obj; - - /* Wait for the 2 tasks to finish registering their IRQ objects*/ - - for (tasksDone = 0; tasksDone < NUM_TEST_TASKS - 1; tasksDone++) { - if (task_sem_take(SEM_RDY, TIMEOUT) != RC_OK) { - TC_ERROR("Monitor task timed out\n"); - task_sem_give(resultSems[TC_FAIL]); - return; - } - } - - TC_PRINT("Generating interrupts for all allocated IRQ objects...\n"); - for (irq_obj = 0; irq_obj < NUM_OBJECTS; irq_obj++) { - if (irq_vectors[irq_obj] != INVALID_VECTOR) { - raiseInt((uint8_t)irq_vectors[irq_obj]); - } - } - - task_sem_give(resultSems[TC_PASS]); -} - -/** - * - * @brief Entry point for MonitorTask - * - * This routine keeps tabs on the progress of the tasks doing the actual testing - * and generates the final test case summary message. - * - * @return N/A - */ - -void MonitorTaskEntry(void) -{ - ksem_t result; - int tasksDone; - - PRINT_DATA("Starting task level interrupt handling tests\n"); - PRINT_LINE; - - /* - * the various test tasks start executing automatically; - * wait for all tasks to complete or a failure to occur, - * then issue the appropriate test case summary message - */ - - for (tasksDone = 0; tasksDone < NUM_TEST_TASKS; tasksDone++) { - result = task_sem_group_take(resultSems, TIMEOUT); - if (result != resultSems[TC_PASS]) { - if (result != resultSems[TC_FAIL]) { - TC_ERROR("Monitor task timed out\n"); - } - TC_END_RESULT(TC_FAIL); - TC_END_REPORT(TC_FAIL); - return; - } - } - - TC_END_RESULT(TC_PASS); - TC_END_REPORT(TC_PASS); -} diff --git a/tests/kernel/test_task_irq/src/raise_int.c b/tests/kernel/test_task_irq/src/raise_int.c deleted file mode 100644 index 25a20b7733e..00000000000 --- a/tests/kernel/test_task_irq/src/raise_int.c +++ /dev/null @@ -1,1406 +0,0 @@ -/* raise_int.c - utility functions for generating SW interrupt */ - -/* - * Copyright (c) 2013-2014 Wind River Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * DESCRIPTION - * This file implements raiseInt(), which generates the specified SW interrupt - * (in the range 0 to 255). - * This method is being used because the MM_POMS model prevents the - * execution of a dynamically generated stub. - */ - -#include - -#if defined(CONFIG_X86) - -static void genInt0(void) -{ - __asm__ volatile("int $0"); -} - -static void genInt1(void) -{ - __asm__ volatile("int $1"); -} - -static void genInt2(void) -{ - __asm__ volatile("int $2"); -} - -static void genInt3(void) -{ - __asm__ volatile("int $3"); -} - -static void genInt4(void) -{ - __asm__ volatile("int $4"); -} - -static void genInt5(void) -{ - __asm__ volatile("int $5"); -} - -static void genInt6(void) -{ - __asm__ volatile("int $6"); -} - -static void genInt7(void) -{ - __asm__ volatile("int $7"); -} - -static void genInt8(void) -{ - __asm__ volatile("int $8"); -} - -static void genInt9(void) -{ - __asm__ volatile("int $9"); -} - -static void genInt10(void) -{ - __asm__ volatile("int $10"); -} - -static void genInt11(void) -{ - __asm__ volatile("int $11"); -} - -static void genInt12(void) -{ - __asm__ volatile("int $12"); -} - -static void genInt13(void) -{ - __asm__ volatile("int $13"); -} - -static void genInt14(void) -{ - __asm__ volatile("int $14"); -} - -static void genInt15(void) -{ - __asm__ volatile("int $15"); -} - -static void genInt16(void) -{ - __asm__ volatile("int $16"); -} - -static void genInt17(void) -{ - __asm__ volatile("int $17"); -} - -static void genInt18(void) -{ - __asm__ volatile("int $18"); -} - -static void genInt19(void) -{ - __asm__ volatile("int $19"); -} - -static void genInt20(void) -{ - __asm__ volatile("int $20"); -} - -static void genInt21(void) -{ - __asm__ volatile("int $21"); -} - -static void genInt22(void) -{ - __asm__ volatile("int $22"); -} - -static void genInt23(void) -{ - __asm__ volatile("int $23"); -} - -static void genInt24(void) -{ - __asm__ volatile("int $24"); -} - -static void genInt25(void) -{ - __asm__ volatile("int $25"); -} - -static void genInt26(void) -{ - __asm__ volatile("int $26"); -} - -static void genInt27(void) -{ - __asm__ volatile("int $27"); -} - -static void genInt28(void) -{ - __asm__ volatile("int $28"); -} - -static void genInt29(void) -{ - __asm__ volatile("int $29"); -} - -static void genInt30(void) -{ - __asm__ volatile("int $30"); -} - -static void genInt31(void) -{ - __asm__ volatile("int $31"); -} - -static void genInt32(void) -{ - __asm__ volatile("int $32"); -} - -static void genInt33(void) -{ - __asm__ volatile("int $33"); -} - -static void genInt34(void) -{ - __asm__ volatile("int $34"); -} - -static void genInt35(void) -{ - __asm__ volatile("int $35"); -} - -static void genInt36(void) -{ - __asm__ volatile("int $36"); -} - -static void genInt37(void) -{ - __asm__ volatile("int $37"); -} - -static void genInt38(void) -{ - __asm__ volatile("int $38"); -} - -static void genInt39(void) -{ - __asm__ volatile("int $39"); -} - -static void genInt40(void) -{ - __asm__ volatile("int $40"); -} - -static void genInt41(void) -{ - __asm__ volatile("int $41"); -} - -static void genInt42(void) -{ - __asm__ volatile("int $42"); -} - -static void genInt43(void) -{ - __asm__ volatile("int $43"); -} - -static void genInt44(void) -{ - __asm__ volatile("int $44"); -} - -static void genInt45(void) -{ - __asm__ volatile("int $45"); -} - -static void genInt46(void) -{ - __asm__ volatile("int $46"); -} - -static void genInt47(void) -{ - __asm__ volatile("int $47"); -} - -static void genInt48(void) -{ - __asm__ volatile("int $48"); -} - -static void genInt49(void) -{ - __asm__ volatile("int $49"); -} - -static void genInt50(void) -{ - __asm__ volatile("int $50"); -} - -static void genInt51(void) -{ - __asm__ volatile("int $51"); -} - -static void genInt52(void) -{ - __asm__ volatile("int $52"); -} - -static void genInt53(void) -{ - __asm__ volatile("int $53"); -} - -static void genInt54(void) -{ - __asm__ volatile("int $54"); -} - -static void genInt55(void) -{ - __asm__ volatile("int $55"); -} - -static void genInt56(void) -{ - __asm__ volatile("int $56"); -} - -static void genInt57(void) -{ - __asm__ volatile("int $57"); -} - -static void genInt58(void) -{ - __asm__ volatile("int $58"); -} - -static void genInt59(void) -{ - __asm__ volatile("int $59"); -} - -static void genInt60(void) -{ - __asm__ volatile("int $60"); -} - -static void genInt61(void) -{ - __asm__ volatile("int $61"); -} - -static void genInt62(void) -{ - __asm__ volatile("int $62"); -} - -static void genInt63(void) -{ - __asm__ volatile("int $63"); -} - -static void genInt64(void) -{ - __asm__ volatile("int $64"); -} - -static void genInt65(void) -{ - __asm__ volatile("int $65"); -} - -static void genInt66(void) -{ - __asm__ volatile("int $66"); -} - -static void genInt67(void) -{ - __asm__ volatile("int $67"); -} - -static void genInt68(void) -{ - __asm__ volatile("int $68"); -} - -static void genInt69(void) -{ - __asm__ volatile("int $69"); -} - -static void genInt70(void) -{ - __asm__ volatile("int $70"); -} - -static void genInt71(void) -{ - __asm__ volatile("int $71"); -} - -static void genInt72(void) -{ - __asm__ volatile("int $72"); -} - -static void genInt73(void) -{ - __asm__ volatile("int $73"); -} - -static void genInt74(void) -{ - __asm__ volatile("int $74"); -} - -static void genInt75(void) -{ - __asm__ volatile("int $75"); -} - -static void genInt76(void) -{ - __asm__ volatile("int $76"); -} - -static void genInt77(void) -{ - __asm__ volatile("int $77"); -} - -static void genInt78(void) -{ - __asm__ volatile("int $78"); -} - -static void genInt79(void) -{ - __asm__ volatile("int $79"); -} - -static void genInt80(void) -{ - __asm__ volatile("int $80"); -} - -static void genInt81(void) -{ - __asm__ volatile("int $81"); -} - -static void genInt82(void) -{ - __asm__ volatile("int $82"); -} - -static void genInt83(void) -{ - __asm__ volatile("int $83"); -} - -static void genInt84(void) -{ - __asm__ volatile("int $84"); -} - -static void genInt85(void) -{ - __asm__ volatile("int $85"); -} - -static void genInt86(void) -{ - __asm__ volatile("int $86"); -} - -static void genInt87(void) -{ - __asm__ volatile("int $87"); -} - -static void genInt88(void) -{ - __asm__ volatile("int $88"); -} - -static void genInt89(void) -{ - __asm__ volatile("int $89"); -} - -static void genInt90(void) -{ - __asm__ volatile("int $90"); -} - -static void genInt91(void) -{ - __asm__ volatile("int $91"); -} - -static void genInt92(void) -{ - __asm__ volatile("int $92"); -} - -static void genInt93(void) -{ - __asm__ volatile("int $93"); -} - -static void genInt94(void) -{ - __asm__ volatile("int $94"); -} - -static void genInt95(void) -{ - __asm__ volatile("int $95"); -} - -static void genInt96(void) -{ - __asm__ volatile("int $96"); -} - -static void genInt97(void) -{ - __asm__ volatile("int $97"); -} - -static void genInt98(void) -{ - __asm__ volatile("int $98"); -} - -static void genInt99(void) -{ - __asm__ volatile("int $99"); -} - -static void genInt100(void) -{ - __asm__ volatile("int $100"); -} - -static void genInt101(void) -{ - __asm__ volatile("int $101"); -} - -static void genInt102(void) -{ - __asm__ volatile("int $102"); -} - -static void genInt103(void) -{ - __asm__ volatile("int $103"); -} - -static void genInt104(void) -{ - __asm__ volatile("int $104"); -} - -static void genInt105(void) -{ - __asm__ volatile("int $105"); -} - -static void genInt106(void) -{ - __asm__ volatile("int $106"); -} - -static void genInt107(void) -{ - __asm__ volatile("int $107"); -} - -static void genInt108(void) -{ - __asm__ volatile("int $108"); -} - -static void genInt109(void) -{ - __asm__ volatile("int $109"); -} - -static void genInt110(void) -{ - __asm__ volatile("int $110"); -} - -static void genInt111(void) -{ - __asm__ volatile("int $111"); -} - -static void genInt112(void) -{ - __asm__ volatile("int $112"); -} - -static void genInt113(void) -{ - __asm__ volatile("int $113"); -} - -static void genInt114(void) -{ - __asm__ volatile("int $114"); -} - -static void genInt115(void) -{ - __asm__ volatile("int $115"); -} - -static void genInt116(void) -{ - __asm__ volatile("int $116"); -} - -static void genInt117(void) -{ - __asm__ volatile("int $117"); -} - -static void genInt118(void) -{ - __asm__ volatile("int $118"); -} - -static void genInt119(void) -{ - __asm__ volatile("int $119"); -} - -static void genInt120(void) -{ - __asm__ volatile("int $120"); -} - -static void genInt121(void) -{ - __asm__ volatile("int $121"); -} - -static void genInt122(void) -{ - __asm__ volatile("int $122"); -} - -static void genInt123(void) -{ - __asm__ volatile("int $123"); -} - -static void genInt124(void) -{ - __asm__ volatile("int $124"); -} - -static void genInt125(void) -{ - __asm__ volatile("int $125"); -} - -static void genInt126(void) -{ - __asm__ volatile("int $126"); -} - -static void genInt127(void) -{ - __asm__ volatile("int $127"); -} - -static void genInt128(void) -{ - __asm__ volatile("int $128"); -} - -static void genInt129(void) -{ - __asm__ volatile("int $129"); -} - -static void genInt130(void) -{ - __asm__ volatile("int $130"); -} - -static void genInt131(void) -{ - __asm__ volatile("int $131"); -} - -static void genInt132(void) -{ - __asm__ volatile("int $132"); -} - -static void genInt133(void) -{ - __asm__ volatile("int $133"); -} - -static void genInt134(void) -{ - __asm__ volatile("int $134"); -} - -static void genInt135(void) -{ - __asm__ volatile("int $135"); -} - -static void genInt136(void) -{ - __asm__ volatile("int $136"); -} - -static void genInt137(void) -{ - __asm__ volatile("int $137"); -} - -static void genInt138(void) -{ - __asm__ volatile("int $138"); -} - -static void genInt139(void) -{ - __asm__ volatile("int $139"); -} - -static void genInt140(void) -{ - __asm__ volatile("int $140"); -} - -static void genInt141(void) -{ - __asm__ volatile("int $141"); -} - -static void genInt142(void) -{ - __asm__ volatile("int $142"); -} - -static void genInt143(void) -{ - __asm__ volatile("int $143"); -} - -static void genInt144(void) -{ - __asm__ volatile("int $144"); -} - -static void genInt145(void) -{ - __asm__ volatile("int $145"); -} - -static void genInt146(void) -{ - __asm__ volatile("int $146"); -} - -static void genInt147(void) -{ - __asm__ volatile("int $147"); -} - -static void genInt148(void) -{ - __asm__ volatile("int $148"); -} - -static void genInt149(void) -{ - __asm__ volatile("int $149"); -} - -static void genInt150(void) -{ - __asm__ volatile("int $150"); -} - -static void genInt151(void) -{ - __asm__ volatile("int $151"); -} - -static void genInt152(void) -{ - __asm__ volatile("int $152"); -} - -static void genInt153(void) -{ - __asm__ volatile("int $153"); -} - -static void genInt154(void) -{ - __asm__ volatile("int $154"); -} - -static void genInt155(void) -{ - __asm__ volatile("int $155"); -} - -static void genInt156(void) -{ - __asm__ volatile("int $156"); -} - -static void genInt157(void) -{ - __asm__ volatile("int $157"); -} - -static void genInt158(void) -{ - __asm__ volatile("int $158"); -} - -static void genInt159(void) -{ - __asm__ volatile("int $159"); -} - -static void genInt160(void) -{ - __asm__ volatile("int $160"); -} - -static void genInt161(void) -{ - __asm__ volatile("int $161"); -} - -static void genInt162(void) -{ - __asm__ volatile("int $162"); -} - -static void genInt163(void) -{ - __asm__ volatile("int $163"); -} - -static void genInt164(void) -{ - __asm__ volatile("int $164"); -} - -static void genInt165(void) -{ - __asm__ volatile("int $165"); -} - -static void genInt166(void) -{ - __asm__ volatile("int $166"); -} - -static void genInt167(void) -{ - __asm__ volatile("int $167"); -} - -static void genInt168(void) -{ - __asm__ volatile("int $168"); -} - -static void genInt169(void) -{ - __asm__ volatile("int $169"); -} - -static void genInt170(void) -{ - __asm__ volatile("int $170"); -} - -static void genInt171(void) -{ - __asm__ volatile("int $171"); -} - -static void genInt172(void) -{ - __asm__ volatile("int $172"); -} - -static void genInt173(void) -{ - __asm__ volatile("int $173"); -} - -static void genInt174(void) -{ - __asm__ volatile("int $174"); -} - -static void genInt175(void) -{ - __asm__ volatile("int $175"); -} - -static void genInt176(void) -{ - __asm__ volatile("int $176"); -} - -static void genInt177(void) -{ - __asm__ volatile("int $177"); -} - -static void genInt178(void) -{ - __asm__ volatile("int $178"); -} - -static void genInt179(void) -{ - __asm__ volatile("int $179"); -} - -static void genInt180(void) -{ - __asm__ volatile("int $180"); -} - -static void genInt181(void) -{ - __asm__ volatile("int $181"); -} - -static void genInt182(void) -{ - __asm__ volatile("int $182"); -} - -static void genInt183(void) -{ - __asm__ volatile("int $183"); -} - -static void genInt184(void) -{ - __asm__ volatile("int $184"); -} - -static void genInt185(void) -{ - __asm__ volatile("int $185"); -} - -static void genInt186(void) -{ - __asm__ volatile("int $186"); -} - -static void genInt187(void) -{ - __asm__ volatile("int $187"); -} - -static void genInt188(void) -{ - __asm__ volatile("int $188"); -} - -static void genInt189(void) -{ - __asm__ volatile("int $189"); -} - -static void genInt190(void) -{ - __asm__ volatile("int $190"); -} - -static void genInt191(void) -{ - __asm__ volatile("int $191"); -} - -static void genInt192(void) -{ - __asm__ volatile("int $192"); -} - -static void genInt193(void) -{ - __asm__ volatile("int $193"); -} - -static void genInt194(void) -{ - __asm__ volatile("int $194"); -} - -static void genInt195(void) -{ - __asm__ volatile("int $195"); -} - -static void genInt196(void) -{ - __asm__ volatile("int $196"); -} - -static void genInt197(void) -{ - __asm__ volatile("int $197"); -} - -static void genInt198(void) -{ - __asm__ volatile("int $198"); -} - -static void genInt199(void) -{ - __asm__ volatile("int $199"); -} - -static void genInt200(void) -{ - __asm__ volatile("int $200"); -} - -static void genInt201(void) -{ - __asm__ volatile("int $201"); -} - -static void genInt202(void) -{ - __asm__ volatile("int $202"); -} - -static void genInt203(void) -{ - __asm__ volatile("int $203"); -} - -static void genInt204(void) -{ - __asm__ volatile("int $204"); -} - -static void genInt205(void) -{ - __asm__ volatile("int $205"); -} - -static void genInt206(void) -{ - __asm__ volatile("int $206"); -} - -static void genInt207(void) -{ - __asm__ volatile("int $207"); -} - -static void genInt208(void) -{ - __asm__ volatile("int $208"); -} - -static void genInt209(void) -{ - __asm__ volatile("int $209"); -} - -static void genInt210(void) -{ - __asm__ volatile("int $210"); -} - -static void genInt211(void) -{ - __asm__ volatile("int $211"); -} - -static void genInt212(void) -{ - __asm__ volatile("int $212"); -} - -static void genInt213(void) -{ - __asm__ volatile("int $213"); -} - -static void genInt214(void) -{ - __asm__ volatile("int $214"); -} - -static void genInt215(void) -{ - __asm__ volatile("int $215"); -} - -static void genInt216(void) -{ - __asm__ volatile("int $216"); -} - -static void genInt217(void) -{ - __asm__ volatile("int $217"); -} - -static void genInt218(void) -{ - __asm__ volatile("int $218"); -} - -static void genInt219(void) -{ - __asm__ volatile("int $219"); -} - -static void genInt220(void) -{ - __asm__ volatile("int $220"); -} - -static void genInt221(void) -{ - __asm__ volatile("int $221"); -} - -static void genInt222(void) -{ - __asm__ volatile("int $222"); -} - -static void genInt223(void) -{ - __asm__ volatile("int $223"); -} - -static void genInt224(void) -{ - __asm__ volatile("int $224"); -} - -static void genInt225(void) -{ - __asm__ volatile("int $225"); -} - -static void genInt226(void) -{ - __asm__ volatile("int $226"); -} - -static void genInt227(void) -{ - __asm__ volatile("int $227"); -} - -static void genInt228(void) -{ - __asm__ volatile("int $228"); -} - -static void genInt229(void) -{ - __asm__ volatile("int $229"); -} - -static void genInt230(void) -{ - __asm__ volatile("int $230"); -} - -static void genInt231(void) -{ - __asm__ volatile("int $231"); -} - -static void genInt232(void) -{ - __asm__ volatile("int $232"); -} - -static void genInt233(void) -{ - __asm__ volatile("int $233"); -} - -static void genInt234(void) -{ - __asm__ volatile("int $234"); -} - -static void genInt235(void) -{ - __asm__ volatile("int $235"); -} - -static void genInt236(void) -{ - __asm__ volatile("int $236"); -} - -static void genInt237(void) -{ - __asm__ volatile("int $237"); -} - -static void genInt238(void) -{ - __asm__ volatile("int $238"); -} - -static void genInt239(void) -{ - __asm__ volatile("int $239"); -} - -static void genInt240(void) -{ - __asm__ volatile("int $240"); -} - -static void genInt241(void) -{ - __asm__ volatile("int $241"); -} - -static void genInt242(void) -{ - __asm__ volatile("int $242"); -} - -static void genInt243(void) -{ - __asm__ volatile("int $243"); -} - -static void genInt244(void) -{ - __asm__ volatile("int $244"); -} - -static void genInt245(void) -{ - __asm__ volatile("int $245"); -} - -static void genInt246(void) -{ - __asm__ volatile("int $246"); -} - -static void genInt247(void) -{ - __asm__ volatile("int $247"); -} - -static void genInt248(void) -{ - __asm__ volatile("int $248"); -} - -static void genInt249(void) -{ - __asm__ volatile("int $249"); -} - -static void genInt250(void) -{ - __asm__ volatile("int $250"); -} - -static void genInt251(void) -{ - __asm__ volatile("int $251"); -} - -static void genInt252(void) -{ - __asm__ volatile("int $252"); -} - -static void genInt253(void) -{ - __asm__ volatile("int $253"); -} - -static void genInt254(void) -{ - __asm__ volatile("int $254"); -} - -static void genInt255(void) -{ - __asm__ volatile("int $255"); -} - -static void (*intFPtr[256])(void) = { - genInt0, genInt1, genInt2, genInt3, - genInt4, genInt5, genInt6, genInt7, - genInt8, genInt9, genInt10, genInt11, - genInt12, genInt13, genInt14, genInt15, - genInt16, genInt17, genInt18, genInt19, - genInt20, genInt21, genInt22, genInt23, - genInt24, genInt25, genInt26, genInt27, - genInt28, genInt29, genInt30, genInt31, - genInt32, genInt33, genInt34, genInt35, - genInt36, genInt37, genInt38, genInt39, - genInt40, genInt41, genInt42, genInt43, - genInt44, genInt45, genInt46, genInt47, - genInt48, genInt49, genInt50, genInt51, - genInt52, genInt53, genInt54, genInt55, - genInt56, genInt57, genInt58, genInt59, - genInt60, genInt61, genInt62, genInt63, - genInt64, genInt65, genInt66, genInt67, - genInt68, genInt69, genInt70, genInt71, - genInt72, genInt73, genInt74, genInt75, - genInt76, genInt77, genInt78, genInt79, - genInt80, genInt81, genInt82, genInt83, - genInt84, genInt85, genInt86, genInt87, - genInt88, genInt89, genInt90, genInt91, - genInt92, genInt93, genInt94, genInt95, - genInt96, genInt97, genInt98, genInt99, - genInt100, genInt101, genInt102, genInt103, - genInt104, genInt105, genInt106, genInt107, - genInt108, genInt109, genInt110, genInt111, - genInt112, genInt113, genInt114, genInt115, - genInt116, genInt117, genInt118, genInt119, - genInt120, genInt121, genInt122, genInt123, - genInt124, genInt125, genInt126, genInt127, - genInt128, genInt129, genInt130, genInt131, - genInt132, genInt133, genInt134, genInt135, - genInt136, genInt137, genInt138, genInt139, - genInt140, genInt141, genInt142, genInt143, - genInt144, genInt145, genInt146, genInt147, - genInt148, genInt149, genInt150, genInt151, - genInt152, genInt153, genInt154, genInt155, - genInt156, genInt157, genInt158, genInt159, - genInt160, genInt161, genInt162, genInt163, - genInt164, genInt165, genInt166, genInt167, - genInt168, genInt169, genInt170, genInt171, - genInt172, genInt173, genInt174, genInt175, - genInt176, genInt177, genInt178, genInt179, - genInt180, genInt181, genInt182, genInt183, - genInt184, genInt185, genInt186, genInt187, - genInt188, genInt189, genInt190, genInt191, - genInt192, genInt193, genInt194, genInt195, - genInt196, genInt197, genInt198, genInt199, - genInt200, genInt201, genInt202, genInt203, - genInt204, genInt205, genInt206, genInt207, - genInt208, genInt209, genInt210, genInt211, - genInt212, genInt213, genInt214, genInt215, - genInt216, genInt217, genInt218, genInt219, - genInt220, genInt221, genInt222, genInt223, - genInt224, genInt225, genInt226, genInt227, - genInt228, genInt229, genInt230, genInt231, - genInt232, genInt233, genInt234, genInt235, - genInt236, genInt237, genInt238, genInt239, - genInt240, genInt241, genInt242, genInt243, - genInt244, genInt245, genInt246, genInt247, - genInt248, genInt249, genInt250, genInt251, - genInt252, genInt253, genInt254, genInt255}; - -/** - * - * @brief Generate a software interrupt - * - * This routine will call one of the genInt functions based upon the - * value passed to it (which is essentially the interrupt vector number). - * - * @return N/A - */ -void raiseInt(uint8_t id) -{ - (*intFPtr[id])(); -} -#endif /* Intel */ - -#if defined(CONFIG_CPU_CORTEX_M3_M4) -#include -/** - * - * @brief Generate a software interrupt - * - * Trigger via NVIC. is the IRQ number. - * - * @return N/A - */ -void raiseInt(uint8_t id) -{ - _NvicSwInterruptTrigger((unsigned int)id); -} -#endif diff --git a/tests/kernel/test_task_irq/src/test_device.c b/tests/kernel/test_task_irq/src/test_device.c deleted file mode 100644 index 12195ba39b3..00000000000 --- a/tests/kernel/test_task_irq/src/test_device.c +++ /dev/null @@ -1,185 +0,0 @@ -/* test_device.c - APIs for testing task level interrupts */ - -/* - * Copyright (c) 2013-2014 Wind River Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* -DESCRIPTION -This module exercises the task level interrupt handling feature. - -Each function allocates 2 IRQ objects and then tests for an event -associated with the IRQ. The taskA() function also attempts to allocate an IRQ -that has already been allocated by another task. - */ - -#include -#include - -#include - -#define DEV1_ID 0 -#define DEV2_ID 1 -#define DEV3_ID 2 -#define DEV4_ID 3 -#define DEV5_ID 4 - -#if defined(CONFIG_X86) - #define DEV1_IRQ 8 - #define DEV2_IRQ 14 - #define DEV3_IRQ 32 - #define DEV4_IRQ 34 -#elif defined(CONFIG_CPU_CORTEX_M3_M4) - #define DEV1_IRQ 0 - #define DEV2_IRQ 1 - #define DEV3_IRQ 2 - #define DEV4_IRQ 3 -#else - #error "Unknown target" -#endif - -#define NUM_OBJECTS 4 -uint32_t irq_vectors[NUM_OBJECTS] = {[0 ... (NUM_OBJECTS - 1)] = INVALID_VECTOR}; - -/** - * - * @brief First of 2 tasks to allocate IRQ objects and check for events - * - * This task allocates 2 IRQ objects with unique IRQs and then tests for an - * interrupt associated with those IRQs. The function then attempts to allocate - * a device that has already been allocate from taskB. - * - * @return TC_PASS, TC_FAIL - */ - -int taskA(ksem_t semRdy) -{ - irq_vectors[DEV1_ID] = task_irq_alloc(DEV1_ID, DEV1_IRQ, 1, 0); - if (irq_vectors[DEV1_ID] == INVALID_VECTOR) { - TC_ERROR("Not able to allocate IRQ object\n"); - return TC_FAIL; - } - TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV1_ID, DEV1_IRQ); - - irq_vectors[DEV2_ID] = task_irq_alloc(DEV2_ID, DEV2_IRQ, 2, 0); - if (irq_vectors[DEV2_ID] == INVALID_VECTOR) { - TC_ERROR("Not able to allocate IRQ object\n"); - return TC_FAIL; - } - TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV2_ID, DEV2_IRQ); - - /* Send semaphore to let loader know IRQ objects have been allocated */ - - task_sem_give(semRdy); - - if (task_irq_wait(DEV1_ID, TICKS_UNLIMITED) != RC_OK) { - TC_ERROR("Not able to test IRQ object event\n"); - return TC_FAIL; - } - TC_PRINT("Received event for IRQ object %d\n", DEV1_ID); - task_irq_ack(DEV1_ID); - - if (task_irq_wait(DEV2_ID, TICKS_UNLIMITED) != RC_OK) { - TC_ERROR("Not able to test IRQ object event\n"); - return TC_FAIL; - } - TC_PRINT("Received event for IRQ object %d\n", DEV2_ID); - task_irq_ack(DEV2_ID); - - /* Wait for other task to receive its events */ - - (void)task_sem_take(semRdy, TICKS_UNLIMITED); - - TC_PRINT("\nAttempt to allocate an IRQ object that\n"); - TC_PRINT("is already allocated by another task...\n"); - if (task_irq_alloc(DEV4_ID, DEV4_IRQ, 1, 0) != INVALID_VECTOR) { - TC_ERROR("Error: Was able to allocate\n\n"); - return TC_FAIL; - } - TC_PRINT("Re-allocation of IRQ object %d prevented\n", DEV4_ID); - - TC_PRINT("\nAttempt to allocate an IRQ that\n" - "is already allocated by another task...\n"); - if (task_irq_alloc(DEV5_ID, DEV4_IRQ, 1, 0) != INVALID_VECTOR) { - TC_ERROR("Error: Was able to allocate\n\n"); - return TC_FAIL; - } - TC_PRINT("Re-allocation of IRQ%d prevented\n\n", DEV4_IRQ); - - /* Signal other task that we are done processing */ - - task_sem_give(semRdy); - - return TC_PASS; -} - -/** - * - * @brief Second of 2 tasks to allocate IRQ objects and check for events - * - * This task allocates 2 IRQ objects with unique IRQs and then tests for an - * interrupt associated with those IRQs. The function then frees an IRQ object - * using task_irq_free(). - * - * @return TC_PASS, TC_FAIL - */ - -int taskB(ksem_t semRdy) -{ - irq_vectors[DEV3_ID] = task_irq_alloc(DEV3_ID, DEV3_IRQ, 1, 0); - if (irq_vectors[DEV3_ID] == INVALID_VECTOR) { - TC_ERROR("Not able to allocate IRQ object\n"); - return TC_FAIL; - } - TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV3_ID, DEV3_IRQ); - - irq_vectors[DEV4_ID] = task_irq_alloc(DEV4_ID, DEV4_IRQ, 1, 0); - if (irq_vectors[DEV4_ID] == INVALID_VECTOR) { - TC_ERROR("Not able to allocate IRQ object\n"); - return TC_FAIL; - } - TC_PRINT("IRQ object %d using IRQ%d allocated\n\n", DEV4_ID, DEV4_IRQ); - - /* Send semaphore to let loader/main know objects have been allocated */ - - task_sem_give(semRdy); - - if (task_irq_wait(DEV3_ID, TICKS_UNLIMITED) != RC_OK) { - TC_ERROR("Not able to test IRQ object event\n"); - return TC_FAIL; - } - TC_PRINT("Received event for IRQ object %d\n", DEV3_ID); - task_irq_ack(DEV3_ID); - - if (task_irq_wait(DEV4_ID, TICKS_UNLIMITED) != RC_OK) { - TC_ERROR("Not able to test IRQ object event\n"); - return TC_FAIL; - } - TC_PRINT("Received event for IRQ object %d\n", DEV4_ID); - task_irq_ack(DEV4_ID); - - /* Signal other task that we are done receiving events */ - - task_sem_give(semRdy); - - /* - * Wait for other task to finish processing. The signal just previously - * sent will not be seen here as the other task is a higher priority and - * will thus consume the signal first. - */ - - (void)task_sem_take(semRdy, TICKS_UNLIMITED); - return TC_PASS; -} diff --git a/tests/kernel/test_task_irq/testcase.ini b/tests/kernel/test_task_irq/testcase.ini deleted file mode 100644 index 2e4e8851815..00000000000 --- a/tests/kernel/test_task_irq/testcase.ini +++ /dev/null @@ -1,3 +0,0 @@ -[test] -tags = core -