diff --git a/Kbuild b/Kbuild index 90fbd050995..4895b5ed1d4 100644 --- a/Kbuild +++ b/Kbuild @@ -1,11 +1,5 @@ # vim: filetype=make -ifneq ($(strip $(CONFIG_MAX_NUM_TASK_IRQS)),) -ifneq (${CONFIG_MAX_NUM_TASK_IRQS},0) -TASK_IRQS=y -endif -endif - ifneq ("$(wildcard $(MDEF_FILE))","") MDEF_FILE_PATH=$(strip $(MDEF_FILE)) else @@ -28,16 +22,6 @@ define filechk_prj.mdef echo " TASKGROUP FPU";\ echo " TASKGROUP SSE";\ echo; \ - if test "$(TASK_IRQS)" = "y"; then \ - echo "% Task IRQ objects";\ - echo "% EVENT NAME HANDLER"; \ - echo "% ======================================="; \ - i=0; \ - while [ $$i -lt $(CONFIG_MAX_NUM_TASK_IRQS) ]; do \ - echo " EVENT _TaskIrqEvt$$i NULL"; \ - i=$$(($$i+1));\ - done; \ - fi; \ if test -e "$(MDEF_FILE_PATH)"; then \ cat $(MDEF_FILE_PATH); \ fi;) diff --git a/doc/api/microkernel_api.rst b/doc/api/microkernel_api.rst index 8d9aeb1114f..4de0dda769f 100644 --- a/doc/api/microkernel_api.rst +++ b/doc/api/microkernel_api.rst @@ -29,13 +29,6 @@ Pipes :project: Zephyr :content-only: -Interrupt Services -****************** - -.. doxygengroup:: microkernel_irq - :project: Zephyr - :content-only: - Mailboxes ********* diff --git a/include/arch/x86/arch.h b/include/arch/x86/arch.h index 3dc261b88aa..6efc0ba8cc6 100644 --- a/include/arch/x86/arch.h +++ b/include/arch/x86/arch.h @@ -46,11 +46,7 @@ extern "C" { */ #define MK_ISR_NAME(x) __isr__##x -#ifdef CONFIG_MICROKERNEL -#define ALL_DYN_IRQ_STUBS (CONFIG_NUM_DYNAMIC_STUBS + CONFIG_MAX_NUM_TASK_IRQS) -#elif defined(CONFIG_NANOKERNEL) #define ALL_DYN_IRQ_STUBS (CONFIG_NUM_DYNAMIC_STUBS) -#endif #define ALL_DYN_EXC_STUBS (CONFIG_NUM_DYNAMIC_EXC_STUBS + \ CONFIG_NUM_DYNAMIC_EXC_NOERR_STUBS) diff --git a/include/microkernel.h b/include/microkernel.h index 7247baafe6a..2f0b9146abc 100644 --- a/include/microkernel.h +++ b/include/microkernel.h @@ -55,7 +55,6 @@ extern "C" { #include #include #include -#include /** * @} diff --git a/include/microkernel/task_irq.h b/include/microkernel/task_irq.h deleted file mode 100644 index b027dc7ac8e..00000000000 --- a/include/microkernel/task_irq.h +++ /dev/null @@ -1,102 +0,0 @@ -/* taskDevInt.h - APIs for managing task IRQ objects */ - -/* - * 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. - */ - -#ifndef TASK_IRQ_H -#define TASK_IRQ_H - - -/** - * @brief Microkernel Interrupt Services - * @defgroup microkernel_irq Microkernel Interrupt Services - * @ingroup microkernel_services - * @{ - */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define INVALID_VECTOR 0xFFFFFFFF - -/** - * @fn uint32_t task_irq_alloc(kirq_t irq_obj, uint32_t irq, - * uint32_t priority, uint32_t flags) - * @brief Register a task IRQ object. - * - * This routine connects a task IRQ object to a system interrupt based - * upon the specified IRQ and priority values. - * - * IRQ allocation is done via the microkernel server fiber, making simultaneous - * allocation requests single-threaded. - * - * @param irq_obj IRQ object identifier. - * @param irq Request IRQ. - * @param priority Requested interrupt priority. - * @param flags IRQ flags. - * - * @return assigned interrupt vector if successful, INVALID_VECTOR if not - */ -uint32_t __deprecated task_irq_alloc(kirq_t irq_obj, uint32_t irq, - uint32_t priority, uint32_t flags); - -/** - * - * @fn void task_irq_ack(kirq_t irq_obj) - * @brief Re-enable a task IRQ object's interrupt. - * - * This re-enables the interrupt for a task IRQ object. - * - * @param irq_obj IRQ object identifier. - * - * @return N/A - */ -void __deprecated task_irq_ack(kirq_t irq_obj); - -/** - * @fn int task_irq_wait(kirq_t irq_obj, int32_t timeout) - * @brief Wait for task IRQ to signal an interrupt. - * - * This routine waits up to @a timeout ticks for the IRQ object @a irq_obj - * to signal an interrupt. - * - * @param irq_obj IRQ object identifier. - * @param timeout Determines the action when task IRQ is not yet signaled. - * For TICKS_NONE, return immediately. - * For TICKS_UNLIMITED, wait as long as necessary. - * Otherwise, wait up to the specified number of ticks before timing out. - * - * @retval RC_OK Successfully detected signaled interrupt. - * @retval RC_TIME Timed out while waiting for interrupt. - * @retval RC_FAIL Failed to immediately detect signaled interrupt when - * @a timeout = TICKS_NONE. - * @sa TICKS_NONE, TICKS_UNLIMITED - */ -int __deprecated task_irq_wait(kirq_t irq_obj, int32_t timeout); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* TASK_IRQ_H */ diff --git a/kernel/microkernel/Kconfig b/kernel/microkernel/Kconfig index b5bb5725c9c..ad2a8630d00 100644 --- a/kernel/microkernel/Kconfig +++ b/kernel/microkernel/Kconfig @@ -101,16 +101,6 @@ config WORKLOAD_MONITOR This option instructs the kernel to record the percentage of time the system is doing useful work (i.e. is not idle). -config MAX_NUM_TASK_IRQS - int - prompt "Number of task IRQ objects" - default 0 - depends on MICROKERNEL - help - This option specifies the maximum number of IRQs that may be - utilized by task level device drivers. A value of zero disables - this feature. - menu "Timer API Options" config TIMESLICING diff --git a/kernel/microkernel/Makefile b/kernel/microkernel/Makefile index b6b130ab326..211c18253c6 100644 --- a/kernel/microkernel/Makefile +++ b/kernel/microkernel/Makefile @@ -9,7 +9,6 @@ obj-y += k_move_data.o obj-y += k_ticker.o obj-y += k_memory_map.o obj-y += k_memory_pool.o -obj-y += k_irq.o obj-y += k_nop.o obj-y += k_offload.o obj-y += k_event.o diff --git a/kernel/microkernel/k_irq.c b/kernel/microkernel/k_irq.c deleted file mode 100644 index a2012e01a72..00000000000 --- a/kernel/microkernel/k_irq.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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. - */ - -/** - * @brief Task IRQ kernel services - * - * This module manages the interrupt functionality between a task level device - * driver and the kernel. - * - * A task level device driver allocates a specific task IRQ object by providing - * an IRQ and priority level; the registration process allocates an interrupt - * vector, sets up an ISR, and enables the associated interrupt. When an - * interrupt occurs, the ISR handler signals an event specific to the IRQ object. - * The task level device driver tests/waits on this event number to determine - * if/when the interrupt has occurred. As the ISR also disables the interrupt, the - * task level device driver subsequently make a request to have the interrupt - * enabled again. - * - * These routines perform error checking to ensure that an IRQ object can only be - * allocated by a single task, and that subsequent operations on that IRQ object - * are only performed by that task. This checking is necessary to ensure that - * a task cannot impact the operation of an IRQ object it does not own. - * - */ - -#if (CONFIG_MAX_NUM_TASK_IRQS > 0) - -#include -#include -#include -#include - -#define MAX_TASK_IRQS CONFIG_MAX_NUM_TASK_IRQS - -#define INVALID_TASK -1 - -/* task IRQ object registration request */ - -struct irq_obj_reg_arg { - kirq_t irq_obj; /* IRQ object identifier */ - uint32_t irq; /* IRQ of device */ - ktask_t task_id; /* requesting task */ -}; - -/* task IRQ object type */ - -struct task_irq_info { - ktask_t task_id; /* task ID of task IRQ object's owner */ - uint32_t irq; /* IRQ used by task IRQ object */ - kevent_t event; /* event number assigned to task IRQ object */ - uint32_t vector; /* interrupt vector assigned to task IRQ object */ -}; - -/* task IRQ object array */ - -static struct task_irq_info task_irq_object[MAX_TASK_IRQS] = { - [0 ...(MAX_TASK_IRQS - 1)].task_id = INVALID_TASK -}; - -/* array of event id used by task IRQ objects */ -extern const kevent_t _TaskIrqEvt_objIds[]; - -/** - * - * @brief ISR for task IRQ objects - * - * This ISR handles interrupts generated by registered task IRQ objects. - * - * The ISR triggers an event signal specified by the event number associated - * with a particular task IRQ object; the interrupt for the task IRQ object - * is then disabled. The parameter provided to the ISR is a structure that - * contains information about the objects's vector, IRQ, and event number. - * - * This ISR does not facilitate an int acknowledgment as it presumes that an - * End of Interrupt (EOI) routine is provided by the interrupt controller that - * is being used. - * - * @param parameter Pointer to task IRQ object - * - * @return N/A - */ -static void task_irq_int_handler(void *parameter) -{ - struct task_irq_info *irq_obj_ptr = parameter; - - isr_event_send(irq_obj_ptr->event); - irq_disable(irq_obj_ptr->irq); -} - -/** - * - * @brief Re-enable a task IRQ object's interrupt - * - * This re-enables the interrupt for a task IRQ object. - * @param irq_obj IRQ object identifier - * - * @return N/A - */ -void task_irq_ack(kirq_t irq_obj) -{ - __ASSERT(irq_obj < MAX_TASK_IRQS, "Invalid IRQ object"); - __ASSERT(task_irq_object[irq_obj].task_id == task_id_get(), - "Incorrect Task ID"); - - irq_enable(task_irq_object[irq_obj].irq); -} - -int task_irq_wait(kirq_t irq_obj, int32_t timeout) -{ - __ASSERT(irq_obj < MAX_TASK_IRQS, "Invalid IRQ object"); - __ASSERT(task_irq_object[irq_obj].task_id == task_id_get(), - "Incorrect Task ID"); - - return task_event_recv(task_irq_object[irq_obj].event, timeout); -} - -/** - * - * @brief Allocate a task IRQ object - * - * This routine allocates a task IRQ object to a task. - * @param arg Pointer to registration request arguments - * - * @return ptr to allocated task IRQ object if successful, NULL if not - */ -static int _k_task_irq_alloc(void *arg) -{ - struct irq_obj_reg_arg *argp = (struct irq_obj_reg_arg *)arg; - struct task_irq_info *irq_obj_ptr; /* ptr to task IRQ object */ - int curr_irq_obj; /* IRQ object loop counter */ - - /* Fail if the requested IRQ object is already in use */ - - if (task_irq_object[argp->irq_obj].task_id != INVALID_TASK) { - return (int)NULL; - } - - /* Fail if the requested IRQ is already in use */ - - for (curr_irq_obj = 0; curr_irq_obj < MAX_TASK_IRQS; curr_irq_obj++) { - if ((task_irq_object[curr_irq_obj].irq == argp->irq) && - (task_irq_object[curr_irq_obj].task_id != INVALID_TASK)) { - return (int)NULL; - } - } - - /* Take ownership of specified IRQ object */ - - irq_obj_ptr = &task_irq_object[argp->irq_obj]; - irq_obj_ptr->task_id = argp->task_id; - irq_obj_ptr->irq = argp->irq; - irq_obj_ptr->event = _TaskIrqEvt_objIds[argp->irq_obj]; - irq_obj_ptr->vector = INVALID_VECTOR; - - return (int)irq_obj_ptr; -} - - -uint32_t task_irq_alloc(kirq_t irq_obj, uint32_t irq, uint32_t priority, - uint32_t flags) -{ - struct irq_obj_reg_arg arg; /* IRQ object registration request arguments */ - struct task_irq_info *irq_obj_ptr; /* ptr to task IRQ object */ - - /* Allocate the desired IRQ object and IRQ */ - - arg.irq_obj = irq_obj; - arg.irq = irq; - arg.task_id = task_id_get(); - - irq_obj_ptr = (struct task_irq_info *)task_offload_to_fiber(_k_task_irq_alloc, - (void *)&arg); - if (irq_obj_ptr == NULL) { - return INVALID_VECTOR; - } - - irq_obj_ptr->vector = irq_connect_dynamic( - irq, priority, task_irq_int_handler, (void *)irq_obj_ptr, - flags); - irq_enable(irq); - - return irq_obj_ptr->vector; -} - - -#endif /* (CONFIG_MAX_NUM_TASK_IRQS > 0) */ diff --git a/scripts/sysgen b/scripts/sysgen index ac003015f40..a31adbcb5a3 100755 --- a/scripts/sysgen +++ b/scripts/sysgen @@ -39,7 +39,6 @@ heap_pos_in_pool_list = -1 num_kargs = 0 num_timers = 0 num_prios = 0 -num_task_irqs = 0 task_list = [] event_list = [] @@ -439,8 +438,6 @@ def kernel_main_c_priorities(): def kernel_main_c_events(): """ Generate event variables """ - global num_task_irqs - # event descriptors # pre-defined event for timer @@ -462,20 +459,6 @@ def kernel_main_c_events(): kernel_main_c_out("DEFINE_EVENT(%s, %s);\n" % (event[0], event[1])) - if (event[0].startswith("_TaskIrqEvt")): - num_task_irqs += 1 - - if (num_task_irqs > 0): - kernel_main_c_out("const kevent_t _TaskIrqEvt_objIds[] = {\n") - - for i in range(0, num_task_irqs): - kernel_main_c_out( - " (kevent_t)&_k_event_obj__TaskIrqEvt%d,\n" % (i) - ) - - kernel_main_c_out("};\n") - - def kernel_main_c_mutexes(): """ Generate mutex variables """ @@ -905,7 +888,6 @@ def generate_obj_id_lines(obj_types): def generate_sysgen_h_obj_ids(): global sysgen_h_data - global num_task_irqs # mutex object ids