kernel: remove legacy kernel support

Change-Id: Iac1e21677d74f81a93cd29d64cce261676ae78a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-04-18 09:33:47 -04:00 committed by Kumar Gala
commit 306e15e0a1
26 changed files with 10 additions and 322 deletions

View file

@ -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:

View file

@ -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" \

View file

@ -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.

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -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 <legacy.h>
#endif
#include <arch/cpu.h>
/*

View file

@ -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.

View file

@ -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 <nanokernel.h>
#endif /* _MICROKERNEL_H */

View file

@ -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 <stddef.h>
#include <stdint.h>
#include <toolchain.h>
#include <sections.h>
/* generic kernel public APIs */
#include <kernel_version.h>
#include <sys_clock.h>
#include <drivers/rand32.h>
#include <misc/slist.h>
#include <misc/dlist.h>
#include <kernel.h>
/* architecture-specific nanokernel public APIs */
#include <arch/cpu.h>
#endif /* __NANOKERNEL_H__ */

View file

@ -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"

View file

@ -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

View file

@ -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.
*/

View file

@ -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 <kernel.h>
#include <kernel_structs.h>
#include <ksched.h>
#include <init.h>
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);

View file

@ -1,117 +0,0 @@
/*
* Copyright (c) 2016 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel.h>
#include <init.h>
#include <ksched.h>
#include <wait_q.h>
#include <misc/__assert.h>
#include <misc/util.h>
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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,2 @@
CONFIG_BOOT_BANNER=y
CONFIG_BUILD_TIMESTAMP=y
CONFIG_LEGACY_KERNEL=n

View file

@ -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

View file

@ -1,3 +1,2 @@
CONFIG_EXCEPTION_DEBUG=n
CONFIG_LEGACY_KERNEL=y
CONFIG_MAIN_THREAD_PRIORITY=6

View file

@ -1,2 +1,2 @@
[test]
tags = legacy core bat_commit
tags = core bat_commit

View file

@ -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

View file

@ -1,3 +1,2 @@
CONFIG_ZTEST=y
CONFIG_NANO_TIMEOUTS=y
CONFIG_NUM_DYNAMIC_TIMERS=10