diff --git a/doc/api/kernel_api.rst b/doc/api/kernel_api.rst index eb925deb956..957567dbdfd 100644 --- a/doc/api/kernel_api.rst +++ b/doc/api/kernel_api.rst @@ -238,13 +238,3 @@ of variable-size data items. :project: Zephyr :content-only: - -Legacy APIs -*********** - -These APIs will be deprecated in an upcoming release so we recommend you avoid -using them in your applications. - -.. doxygengroup:: legacy_apis - :project: Zephyr - :content-only: diff --git a/doc/zephyr.doxyfile b/doc/zephyr.doxyfile index 38912f9b68e..5bca1ab9883 100644 --- a/doc/zephyr.doxyfile +++ b/doc/zephyr.doxyfile @@ -274,7 +274,6 @@ PREDEFINED = "CONFIG_SYS_CLOCK_EXISTS=y" \ "CONFIG_KERNEL_EVENT_LOGGER_DYNAMIC=y" \ "CONFIG_KERNEL_EVENT_LOGGER_CUSTOM_TIMESTAMP=y" \ "CONFIG_TASK_MONITOR=y" \ - "CONFIG_NANO_TIMEOUTS=y" \ "CONFIG_UART_INTERRUPT_DRIVEN=y" \ "CONFIG_UART_DRV_CMD=y" \ "CONFIG_SYS_POWER_MANAGEMENT=y" \ diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig index e96d380fe94..fd10da1d833 100644 --- a/drivers/adc/Kconfig +++ b/drivers/adc/Kconfig @@ -61,7 +61,6 @@ menuconfig ADC_TI_ADC108S102 bool "TI adc108s102 chip driver" depends on ADC select SPI - select NANO_TIMEOUTS default n help Enable support for TI's ADC chip adc108s102 driver. diff --git a/drivers/bluetooth/nble/Kconfig b/drivers/bluetooth/nble/Kconfig index 1d6439d5781..cc02f64531c 100644 --- a/drivers/bluetooth/nble/Kconfig +++ b/drivers/bluetooth/nble/Kconfig @@ -9,7 +9,6 @@ config NBLE bool "Support for custom non-HCI nRF51 firmware [DEPRECATED]" select UART_INTERRUPT_DRIVEN - select NANO_TIMEOUTS select NET_BUF depends on SERIAL help diff --git a/drivers/sensor/bmc150_magn/Kconfig b/drivers/sensor/bmc150_magn/Kconfig index 54840960a2f..390a154cfa9 100644 --- a/drivers/sensor/bmc150_magn/Kconfig +++ b/drivers/sensor/bmc150_magn/Kconfig @@ -8,7 +8,7 @@ menuconfig BMC150_MAGN bool "BMC150_MAGN I2C Magnetometer Chip" - depends on SENSOR && I2C && NANO_TIMEOUTS + depends on SENSOR && I2C default n help Enable driver for BMC150 I2C-based magnetometer sensor. diff --git a/drivers/sensor/lsm6ds0/Kconfig b/drivers/sensor/lsm6ds0/Kconfig index 8b7ba004693..ff1316c5fb7 100644 --- a/drivers/sensor/lsm6ds0/Kconfig +++ b/drivers/sensor/lsm6ds0/Kconfig @@ -9,7 +9,7 @@ menuconfig LSM6DS0 bool "LSM6DS0 I2C accelerometer and gyroscope Chip" - depends on SENSOR && I2C && NANO_TIMEOUTS + depends on SENSOR && I2C default n help Enable driver for LSM6DS0 I2C-based accelerometer and gyroscope diff --git a/drivers/sensor/lsm9ds0_gyro/Kconfig b/drivers/sensor/lsm9ds0_gyro/Kconfig index 7ed3805afb5..e1475c2ac17 100644 --- a/drivers/sensor/lsm9ds0_gyro/Kconfig +++ b/drivers/sensor/lsm9ds0_gyro/Kconfig @@ -8,7 +8,7 @@ menuconfig LSM9DS0_GYRO bool "LSM9DS0 I2C gyroscope Chip" - depends on SENSOR && I2C && NANO_TIMEOUTS + depends on SENSOR && I2C default n help Enable driver for LSM9DS0 I2C-based gyroscope sensor. diff --git a/drivers/sensor/lsm9ds0_mfd/Kconfig b/drivers/sensor/lsm9ds0_mfd/Kconfig index cb0851ac0bf..5f0230a8ed1 100644 --- a/drivers/sensor/lsm9ds0_mfd/Kconfig +++ b/drivers/sensor/lsm9ds0_mfd/Kconfig @@ -9,7 +9,7 @@ menuconfig LSM9DS0_MFD bool "LSM9DS0 I2C accelerometer, magnetometer and temperature sensor chip" - depends on SENSOR && I2C && NANO_TIMEOUTS + depends on SENSOR && I2C default n help Enable driver for LSM9DS0 I2C-based MFD sensor. diff --git a/include/kernel.h b/include/kernel.h index 7c2795397ef..a263d0a6aa1 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -3553,10 +3553,6 @@ extern void k_cpu_atomic_idle(unsigned int key); extern void _sys_power_save_idle_exit(int32_t ticks); -/* Include legacy APIs */ -#if defined(CONFIG_LEGACY_KERNEL) -#include -#endif #include /* diff --git a/include/logging/kernel_event_logger.h b/include/logging/kernel_event_logger.h index 7b18d5a7246..7ce1e7fb351 100644 --- a/include/logging/kernel_event_logger.h +++ b/include/logging/kernel_event_logger.h @@ -280,7 +280,7 @@ static inline int sys_k_event_logger_get_wait(uint16_t *event_id, * @retval -EMSGSIZE Buffer too small; @a data_size now indicates * the size of the event to be retrieved. */ -#if defined(CONFIG_KERNEL_EVENT_LOGGER) && defined(CONFIG_NANO_TIMEOUTS) +#if defined(CONFIG_KERNEL_EVENT_LOGGER) static inline int sys_k_event_logger_get_wait_timeout(uint16_t *event_id, uint8_t *dropped, uint32_t *event_data, uint8_t *data_size, uint32_t timeout) @@ -289,7 +289,7 @@ static inline int sys_k_event_logger_get_wait_timeout(uint16_t *event_id, dropped, event_data, data_size, timeout); } -#endif /* CONFIG_KERNEL_EVENT_LOGGER && CONFIG_NANO_TIMEOUTS */ +#endif /* CONFIG_KERNEL_EVENT_LOGGER */ /** * @brief Register thread that retrieves kernel events. diff --git a/include/microkernel.h b/include/microkernel.h deleted file mode 100644 index cb490baa18c..00000000000 --- a/include/microkernel.h +++ /dev/null @@ -1,14 +0,0 @@ -/* microkernel.h - public API for microkernel */ - -/* - * Copyright (c) 1997-2015, Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef _MICROKERNEL_H -#define _MICROKERNEL_H - -#include - -#endif /* _MICROKERNEL_H */ diff --git a/include/nanokernel.h b/include/nanokernel.h deleted file mode 100644 index 3af78df59c6..00000000000 --- a/include/nanokernel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997-2015, Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file - * - * @brief Public APIs for the nanokernel. - */ - -#ifndef __NANOKERNEL_H__ -#define __NANOKERNEL_H__ - -#if !defined(CONFIG_LEGACY_KERNEL) -#error "You should include kernel.h and not nanokernel.h or microkernel.h" -#endif - -/* fundamental include files */ - -#include -#include -#include -#include - -/* generic kernel public APIs */ - -#include -#include -#include -#include -#include - -#include - -/* architecture-specific nanokernel public APIs */ -#include - -#endif /* __NANOKERNEL_H__ */ diff --git a/kernel/Kconfig b/kernel/Kconfig index 5a25333a614..f26e5c80d2d 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -307,7 +307,7 @@ menu "Other Kernel Object Options" config SEMAPHORE_GROUPS bool "Enable semaphore groups" - default y if LEGACY_KERNEL + default n help This option enables support for semaphore groups. Threads that use semaphore groups require more stack space. Disabling this option will @@ -427,11 +427,6 @@ config SYS_CLOCK_TICKS_PER_SEC can require a non-trivial extra amount of stack space (e.g. around 80 bytes on x86). - Using the legacy API also incurs an extra penalty, since when asking - for a timeout, a translation is made from ticks to milliseconds to call - the native kernel APIs, and then another translation is made back to - ticks, since the kernel is tick-based. - config SYS_CLOCK_HW_CYCLES_PER_SEC int "System clock's h/w timer frequency" help @@ -535,16 +530,10 @@ endmenu menu "Legacy Kernel Options" -config LEGACY_KERNEL - bool "Legacy Kernel Options" - default n - help - Enable legacy kernel features. - config MDEF bool prompt "Use MDEF files for statically configured kernel objects" - default y if LEGACY_KERNEL + default n help Using an MDEF file can help the startup time of the application since the objects it lists are statically allocated and initialized, and may @@ -554,22 +543,6 @@ config MDEF In doubt, select 'y'. -config NANO_TIMEOUTS - bool - default y if LEGACY_KERNEL - depends on SYS_CLOCK_EXISTS - help - Only here for common (ie. non-unified kernel) code that rely on this. - Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. - -config NANO_TIMERS - bool - default y if LEGACY_KERNEL - depends on SYS_CLOCK_EXISTS - help - Only here for common (ie. non-unified kernel) code that rely on this. - Unified kernel uses SYS_CLOCK_EXISTS everywhere instead. - endmenu source "kernel/Kconfig.event_logger" diff --git a/kernel/Makefile b/kernel/Makefile index 5e0959602f5..5ce6969b87e 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -27,7 +27,6 @@ lib-y += $(strip \ mem_pool.o \ alert.o \ pipes.o \ - legacy_offload.o \ errno.o \ work_q.o \ system_work_q.o \ @@ -36,6 +35,5 @@ lib-y += $(strip \ lib-$(CONFIG_INT_LATENCY_BENCHMARK) += int_latency_bench.o lib-$(CONFIG_STACK_CANARIES) += compiler_stack_protect.o lib-$(CONFIG_SYS_CLOCK_EXISTS) += timer.o -lib-$(CONFIG_LEGACY_KERNEL) += legacy_timer.o lib-$(CONFIG_ATOMIC_OPERATIONS_C) += atomic_c.o lib-$(CONFIG_POLL) += poll.o diff --git a/kernel/include/timeout_q.h b/kernel/include/timeout_q.h index b508e9f1409..2cf39c0171c 100644 --- a/kernel/include/timeout_q.h +++ b/kernel/include/timeout_q.h @@ -188,9 +188,6 @@ static inline void _dump_timeout_q(void) * they were queued. This could be changed at the cost of potential longer * interrupt latency. * - * NOTE: The current implementation of the legacy semaphore feature depends on - * the timeouts being queued in reverse order. - * * Must be called with interrupts locked. */ diff --git a/kernel/legacy_offload.c b/kernel/legacy_offload.c deleted file mode 100644 index 8d94c58afd0..00000000000 --- a/kernel/legacy_offload.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2016 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/** - * @file @brief task_offload_to_fiber() function for legacy applications - * - * For the legacy applications that need task_offload_to_fiber() function, - * the moduel implements it by means of using work queue - */ - -#include -#include -#include -#include - -struct offload_work { - struct k_work work_item; - int (*offload_func)(); - void *offload_args; - struct k_thread *thread; -}; - -static struct k_work_q offload_work_q; - -/* - * Internal handler of the offload requests - */ - -static void offload_handler(struct k_work *work) -{ - struct offload_work *offload = - CONTAINER_OF(work, struct offload_work, work_item); - int result = (offload->offload_func)(offload->offload_args); - unsigned int key = irq_lock(); - - offload->thread->base.swap_data = (void *)result; - irq_unlock(key); -} - -int task_offload_to_fiber(int (*func)(), void *argp) -{ - /* - * Create work in stack. Task is scheduled out and does not - * return until the work is consumed and complete, so the - * work item will exists until then. - */ - struct offload_work offload = { - .offload_func = func, - .offload_args = argp - }; - - __ASSERT(_is_preempt(_current), "Fiber is trying to offload work"); - - k_work_init(&offload.work_item, offload_handler); - - offload.thread = _current; - k_work_submit_to_queue(&offload_work_q, &offload.work_item); - return (int)_current->base.swap_data; -} - -static char __stack offload_work_q_stack[CONFIG_OFFLOAD_WORKQUEUE_STACK_SIZE]; - -static int k_offload_work_q_init(struct device *dev) -{ - ARG_UNUSED(dev); - - k_work_q_start(&offload_work_q, - offload_work_q_stack, - sizeof(offload_work_q_stack), - CONFIG_OFFLOAD_WORKQUEUE_PRIORITY); - - return 0; -} - -SYS_INIT(k_offload_work_q_init, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/kernel/legacy_timer.c b/kernel/legacy_timer.c deleted file mode 100644 index e166c65a7b8..00000000000 --- a/kernel/legacy_timer.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2016 Wind River Systems, Inc. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include - -void _legacy_sleep(int32_t ticks) -{ - __ASSERT(!_is_in_isr(), ""); - __ASSERT(ticks != TICKS_UNLIMITED, ""); - - if (ticks <= 0) { - k_yield(); - return; - } - - int key = irq_lock(); - - _remove_thread_from_ready_q(_current); - _add_thread_timeout(_current, NULL, ticks); - - _Swap(key); -} - -#if (CONFIG_NUM_DYNAMIC_TIMERS > 0) - -static struct k_timer dynamic_timers[CONFIG_NUM_DYNAMIC_TIMERS]; -static sys_dlist_t timer_pool; - -static void timer_sem_give(struct k_timer *timer) -{ - k_sem_give((ksem_t)timer->user_data); -} - -static int init_dyamic_timers(struct device *dev) -{ - ARG_UNUSED(dev); - - int i; - int n_timers = ARRAY_SIZE(dynamic_timers); - - sys_dlist_init(&timer_pool); - for (i = 0; i < n_timers; i++) { - k_timer_init(&dynamic_timers[i], timer_sem_give, NULL); - sys_dlist_append(&timer_pool, - &dynamic_timers[i].timeout.node); - } - return 0; -} - -SYS_INIT(init_dyamic_timers, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS); - -ktimer_t task_timer_alloc(void) -{ - _sched_lock(); - - /* - * This conversion works only if timeout member - * variable is the first in time structure. - */ - struct k_timer *timer = (struct k_timer *)sys_dlist_get(&timer_pool); - - k_sched_unlock(); - return timer; -} - -void task_timer_free(ktimer_t timer) -{ - k_timer_stop(timer); - _sched_lock(); - sys_dlist_append(&timer_pool, &timer->timeout.node); - k_sched_unlock(); -} - -void task_timer_start(ktimer_t timer, int32_t duration, - int32_t period, ksem_t sema) -{ - if (duration < 0 || period < 0 || (duration == 0 && period == 0)) { - k_timer_stop(timer); - return; - } - - timer->user_data = (void *)sema; - - k_timer_start(timer, _ticks_to_ms(duration), _ticks_to_ms(period)); -} - -bool _timer_pool_is_empty(void) -{ - _sched_lock(); - - bool is_empty = sys_dlist_is_empty(&timer_pool); - - k_sched_unlock(); - return is_empty; -} - -#endif /* (CONFIG_NUM_DYNAMIC_TIMERS > 0) */ - -void *nano_timer_test(struct nano_timer *timer, int32_t timeout_in_ticks) -{ - uint32_t (*test_fn)(struct k_timer *timer); - - if (timeout_in_ticks == TICKS_NONE) { - test_fn = k_timer_status_get; - } else { - test_fn = k_timer_status_sync; - } - return test_fn(timer) ? (void *)timer->user_data : NULL; -} diff --git a/kernel/thread_abort.c b/kernel/thread_abort.c index ec2d019c69d..825eb959e4f 100644 --- a/kernel/thread_abort.c +++ b/kernel/thread_abort.c @@ -40,10 +40,3 @@ void k_thread_abort(k_tid_t thread) _reschedule_threads(key); } #endif - -/* legacy API */ - -void task_abort_handler_set(void (*func)(void)) -{ - _current->fn_abort = func; -} diff --git a/tests/benchmarks/app_kernel/prj_fp.conf b/tests/benchmarks/app_kernel/prj_fp.conf index 2464373b765..a784069aa9c 100644 --- a/tests/benchmarks/app_kernel/prj_fp.conf +++ b/tests/benchmarks/app_kernel/prj_fp.conf @@ -9,4 +9,3 @@ CONFIG_NUM_COMMAND_PACKETS=20 # eliminate timer interrupts during the benchmark CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 -CONFIG_LEGACY_KERNEL=n diff --git a/tests/benchmarks/app_kernel/prj_no_fp.conf b/tests/benchmarks/app_kernel/prj_no_fp.conf index acbc7176efe..0c3a22bf00f 100644 --- a/tests/benchmarks/app_kernel/prj_no_fp.conf +++ b/tests/benchmarks/app_kernel/prj_no_fp.conf @@ -4,4 +4,3 @@ CONFIG_NUM_COMMAND_PACKETS=20 # eliminate timer interrupts during the benchmark CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 -CONFIG_LEGACY_KERNEL=n diff --git a/tests/include/test.config b/tests/include/test.config index 0cd9f8e6194..ab99168e54b 100644 --- a/tests/include/test.config +++ b/tests/include/test.config @@ -1,3 +1,2 @@ CONFIG_BOOT_BANNER=y CONFIG_BUILD_TIMESTAMP=y -CONFIG_LEGACY_KERNEL=n diff --git a/tests/kernel/profiling/profiling_api/prj.conf b/tests/kernel/profiling/profiling_api/prj.conf index da148ca53a5..4ad8072f41b 100644 --- a/tests/kernel/profiling/profiling_api/prj.conf +++ b/tests/kernel/profiling/profiling_api/prj.conf @@ -6,7 +6,6 @@ CONFIG_PRINTK=y CONFIG_SYS_POWER_MANAGEMENT=y CONFIG_SYS_POWER_LOW_POWER_STATE=y CONFIG_TICKLESS_IDLE=y -#CONFIG_NANO_TIMEOUTS=y CONFIG_IDLE_STACK_SIZE=512 # to check isr diff --git a/tests/kernel/static_idt/prj.conf b/tests/kernel/static_idt/prj.conf index 232c323e756..34699aa8df0 100644 --- a/tests/kernel/static_idt/prj.conf +++ b/tests/kernel/static_idt/prj.conf @@ -1,3 +1,2 @@ CONFIG_EXCEPTION_DEBUG=n -CONFIG_LEGACY_KERNEL=y CONFIG_MAIN_THREAD_PRIORITY=6 diff --git a/tests/kernel/test_sleep/testcase.ini b/tests/kernel/test_sleep/testcase.ini index cae9173f757..fc3e56d847c 100644 --- a/tests/kernel/test_sleep/testcase.ini +++ b/tests/kernel/test_sleep/testcase.ini @@ -1,2 +1,2 @@ [test] -tags = legacy core bat_commit +tags = core bat_commit diff --git a/tests/kernel/test_tickless/testcase.ini b/tests/kernel/test_tickless/testcase.ini index 45f2ea59c42..d217bfd1d61 100644 --- a/tests/kernel/test_tickless/testcase.ini +++ b/tests/kernel/test_tickless/testcase.ini @@ -1,5 +1,5 @@ [test] -tags = legacy core +tags = core arch_exclude = nios2 filter = CONFIG_X86 or (CONFIG_ARM and (CONFIG_SOC_MK64F12 or CONFIG_SOC_ATMEL_SAM3)) or diff --git a/tests/kernel/timer/timer_api/prj.conf b/tests/kernel/timer/timer_api/prj.conf index e6e1a1fe80a..3c9858c8951 100644 --- a/tests/kernel/timer/timer_api/prj.conf +++ b/tests/kernel/timer/timer_api/prj.conf @@ -1,3 +1,2 @@ CONFIG_ZTEST=y -CONFIG_NANO_TIMEOUTS=y CONFIG_NUM_DYNAMIC_TIMERS=10