2014-03-17 17:59:06 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin
|
|
|
|
*
|
2014-08-23 15:43:13 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-03-17 17:59:06 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup core_arch
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file thread_arch.h
|
|
|
|
* @brief Architecture dependent kernel interface for handling and managing threads
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __THREAD_ARCH_H
|
|
|
|
#define __THREAD_ARCH_H
|
|
|
|
|
2014-10-13 14:44:28 +02:00
|
|
|
#include "attributes.h"
|
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-10-19 23:10:14 +02:00
|
|
|
#include "kernel_internal.h"
|
2014-03-17 17:59:06 +01:00
|
|
|
/**
|
|
|
|
* @name Define the mapping between the architecture independent interfaces
|
|
|
|
* and the kernel internal interfaces
|
2014-05-14 10:46:15 +02:00
|
|
|
*
|
|
|
|
* This mapping is done for compatibility of existing platforms,
|
2014-03-17 17:59:06 +01:00
|
|
|
* new platforms should always use the *_arch_* interfaces.
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#ifdef COREIF_NG
|
|
|
|
#define thread_stack_init thread_arch_stack_init
|
|
|
|
#define thread_print_stack thread_arch_print_stack
|
|
|
|
#define cpu_switch_context_exit thread_arch_start_threading
|
2014-10-18 01:24:49 +02:00
|
|
|
#define thread_yield_higher thread_arch_yield
|
2014-03-17 17:59:06 +01:00
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize a thread's stack
|
|
|
|
*
|
|
|
|
* @param[in] task_func pointer to the thread's code
|
2014-03-04 20:20:01 +01:00
|
|
|
* @param[in] arg argument to task_func
|
2014-03-17 17:59:06 +01:00
|
|
|
* @param[in] stack_start pointer to the start address of the thread
|
|
|
|
* @param[in] stack_size the maximum size of the stack
|
|
|
|
*
|
|
|
|
* @return pointer to the new top of the stack
|
|
|
|
*/
|
2014-10-19 23:10:14 +02:00
|
|
|
char *thread_arch_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stack_size);
|
2014-03-17 17:59:06 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Print the current stack to stdout
|
|
|
|
*/
|
|
|
|
void thread_arch_stack_print(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Start threading by loading a threads initial information from the stack
|
|
|
|
*/
|
2014-06-05 21:01:35 +02:00
|
|
|
void thread_arch_start_threading(void) NORETURN;
|
2014-03-17 17:59:06 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Pause the current thread and schedule the next pending, if available
|
|
|
|
*/
|
|
|
|
void thread_arch_yield(void);
|
|
|
|
|
2014-10-09 01:18:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-03-17 17:59:06 +01:00
|
|
|
|
|
|
|
#endif /* __THREAD_ARCH_H */
|
|
|
|
/** @} */
|