diff options
Diffstat (limited to 'cpukit/sapi')
22 files changed, 0 insertions, 8315 deletions
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index 326d67f193..4fb7c708cd 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -1,29 +1,6 @@ include $(top_srcdir)/automake/multilib.am include $(top_srcdir)/automake/compile.am -include_rtemsdir = $(includedir)/rtems - -include_rtems_HEADERS = include/confdefs.h -include_rtems_HEADERS += include/rtems/bsd.h -include_rtems_HEADERS += include/rtems/chain.h -include_rtems_HEADERS += include/rtems/config.h -include_rtems_HEADERS += include/rtems/counter.h -include_rtems_HEADERS += include/rtems/extension.h -include_rtems_HEADERS += include/rtems/extensionimpl.h -include_rtems_HEADERS += include/rtems/fatal.h -include_rtems_HEADERS += include/rtems/init.h -include_rtems_HEADERS += include/rtems/io.h -include_rtems_HEADERS += include/rtems/ioimpl.h -include_rtems_HEADERS += include/rtems/mptables.h -include_rtems_HEADERS += include/rtems/cbs.h -include_rtems_HEADERS += include/rtems/profiling.h -include_rtems_HEADERS += include/rtems/rbheap.h -include_rtems_HEADERS += include/rtems/rbtree.h -include_rtems_HEADERS += include/rtems/scheduler.h -include_rtems_HEADERS += include/rtems/timecounter.h -include_rtems_HEADERS += include/rtems/timespec.h -include_rtems_HEADERS += include/rtems/version.h - EXTRA_DIST = include/rtems/README noinst_LIBRARIES = libsapi.a @@ -84,5 +61,4 @@ $(srcdir)/src/version.c: version-vc-key.h all-local: generate-vc-key -include $(srcdir)/preinstall.am include $(top_srcdir)/automake/local.am diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h deleted file mode 100755 index 1c993dd099..0000000000 --- a/cpukit/sapi/include/confdefs.h +++ /dev/null @@ -1,3587 +0,0 @@ -/** - * @file - * - * @brief Configuration Table Template that will be Instantiated - * by an Application - * - * This include file contains the configuration table template that will - * be instantiated by an application based on the setting of a number - * of macros. The macros are documented in the Configuring a System - * chapter of the Classic API User's Guide - */ - -/* - * COPYRIGHT (c) 1989-2015. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef __CONFIGURATION_TEMPLATE_h -#define __CONFIGURATION_TEMPLATE_h - -/* - * Include the executive's configuration - */ -#include <rtems.h> -#include <rtems/ioimpl.h> -#include <rtems/sysinit.h> -#include <rtems/score/apimutex.h> -#include <rtems/score/percpu.h> -#include <rtems/score/userextimpl.h> -#include <rtems/score/wkspace.h> - -#ifdef CONFIGURE_DISABLE_BSP_SETTINGS - #undef BSP_DEFAULT_UNIFIED_WORK_AREAS - #undef BSP_IDLE_TASK_BODY - #undef BSP_IDLE_TASK_STACK_SIZE - #undef BSP_INITIAL_EXTENSION - #undef BSP_INTERRUPT_STACK_SIZE - #undef BSP_MAXIMUM_DEVICES - #undef BSP_ZERO_WORKSPACE_AUTOMATICALLY - #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS - #undef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK -#else - #include <bsp.h> -#endif - -#ifdef RTEMS_NEWLIB - #include <sys/reent.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Internal defines must be prefixed with _CONFIGURE to distinguish them from - * user-provided options which use a CONFIGURE prefix. - */ - -/** - * @defgroup Configuration RTEMS Configuration - * - * This module contains all RTEMS Configuration parameters. - * - * The model is to estimate the memory required for each configured item - * and sum those estimates. The estimate can be too high or too low for - * a variety of reasons: - * - * Reasons estimate is too high: - * + FP contexts (not all tasks are FP) - * - * Reasons estimate is too low: - * + stacks greater than minimum size - * + messages - * + application must account for device driver resources - * + application must account for add-on library resource requirements - * - * NOTE: Eventually this may be able to take into account some of - * the above. This procedure has evolved from just enough to - * support the RTEMS Test Suites into something that can be - * used remarkably reliably by most applications. - */ - -/** - * This is the Classic API initialization tasks table. - */ -extern rtems_initialization_tasks_table Initialization_tasks[]; - -#if defined(RTEMS_MULTIPROCESSING) - /** - * This it the distributed multiprocessing configuration table. - */ - extern rtems_multiprocessing_table Multiprocessing_configuration; -#endif - -#ifdef RTEMS_POSIX_API - /** - * This it the POSIX API configuration table. - */ - extern posix_api_configuration_table Configuration_POSIX_API; -#endif - -/** - * This macro determines whether the RTEMS reentrancy support for - * the Newlib C Library is enabled. - */ -#ifdef RTEMS_SCHEDSIM - #undef RTEMS_NEWLIB -#endif - -#if (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)) - #define _CONFIGURE_NEWLIB_EXTENSION 1 -#else - #define _CONFIGURE_NEWLIB_EXTENSION 0 -#endif - -#ifndef RTEMS_SCHEDSIM -#include <rtems/libio_.h> - -#ifdef CONFIGURE_INIT - #ifndef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM - RTEMS_SYSINIT_ITEM( - rtems_filesystem_initialize, - RTEMS_SYSINIT_ROOT_FILESYSTEM, - RTEMS_SYSINIT_ORDER_MIDDLE - ); - #endif -#endif -#endif - -/** - * This macro defines the number of POSIX file descriptors allocated - * and managed by libio. These are the "integer" file descriptors that - * are used by calls like open(2) and read(2). - */ -#ifndef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS - #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 3 -#endif - -/* - * POSIX key count used by the IO library. - */ -#define _CONFIGURE_LIBIO_POSIX_KEYS 1 - -#ifdef CONFIGURE_INIT - rtems_libio_t rtems_libio_iops[CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS]; - - /** - * When instantiating the configuration tables, this variable is - * initialized to specify the maximum number of file descriptors. - */ - const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops); -#endif - -/* - * This macro determines if termios is disabled by this application. - * This only means that resources will not be reserved. If you end - * up using termios, it will fail. - */ -#ifdef CONFIGURE_TERMIOS_DISABLED - #define _CONFIGURE_TERMIOS_SEMAPHORES 0 -#else - /** - * This macro specifies the number of serial or PTY ports that will - * use termios. - */ - #ifndef CONFIGURE_NUMBER_OF_TERMIOS_PORTS - #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 1 - #endif - - /* - * This macro reserves the number of semaphores required by termios - * based upon the number of communication ports that will use it. - */ - #define _CONFIGURE_TERMIOS_SEMAPHORES \ - ((CONFIGURE_NUMBER_OF_TERMIOS_PORTS * 4) + 1) -#endif - -/** - * This macro specifies the number of PTYs that can be concurrently - * active. - */ -#ifndef CONFIGURE_MAXIMUM_PTYS - #define CONFIGURE_MAXIMUM_PTYS 0 -#endif - -/** - * This variable contains the maximum number of PTYs that can be - * concurrently active. - */ -#ifdef CONFIGURE_INIT - int rtems_telnetd_maximum_ptys = CONFIGURE_MAXIMUM_PTYS; -#else - extern int rtems_telnetd_maximum_ptys; -#endif - -#ifdef CONFIGURE_SMP_MAXIMUM_PROCESSORS - #warning "CONFIGURE_SMP_MAXIMUM_PROCESSORS has been renamed to CONFIGURE_MAXIMUM_PROCESSORS since RTEMS 5.1" - #define CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_SMP_MAXIMUM_PROCESSORS -#endif - -#ifndef CONFIGURE_MAXIMUM_PROCESSORS - #define CONFIGURE_MAXIMUM_PROCESSORS 1 -#endif - -/* - * An internal define to indicate that this is an SMP application - * configuration. - */ -#ifdef RTEMS_SMP - #if !defined(CONFIGURE_DISABLE_SMP_CONFIGURATION) - #define _CONFIGURE_SMP_APPLICATION - #elif CONFIGURE_MAXIMUM_PROCESSORS > 1 - #error "CONFIGURE_DISABLE_SMP_CONFIGURATION and CONFIGURE_MAXIMUM_PROCESSORS > 1 makes no sense" - #endif -#endif - -#ifdef CONFIGURE_SMP_APPLICATION - #warning "CONFIGURE_SMP_APPLICATION is obsolete since RTEMS 5.1" -#endif - -/* - * This sets up the resources for the FIFOs/pipes. - */ - -/** - * This is specified to configure the maximum number of POSIX FIFOs. - */ -#if !defined(CONFIGURE_MAXIMUM_FIFOS) - #define CONFIGURE_MAXIMUM_FIFOS 0 -#endif - -/** - * This is specified to configure the maximum number of POSIX named pipes. - */ -#if !defined(CONFIGURE_MAXIMUM_PIPES) - #define CONFIGURE_MAXIMUM_PIPES 0 -#endif - -/* - * This specifies the number of barriers required for the configured - * number of FIFOs and named pipes. - */ -#if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0 - #define _CONFIGURE_BARRIERS_FOR_FIFOS \ - (2 * (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES)) -#else - #define _CONFIGURE_BARRIERS_FOR_FIFOS 0 -#endif - -/* - * This specifies the number of semaphores required for the configured - * number of FIFOs and named pipes. - */ -#if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0 - #define _CONFIGURE_SEMAPHORES_FOR_FIFOS \ - (1 + (CONFIGURE_MAXIMUM_FIFOS + CONFIGURE_MAXIMUM_PIPES)) -#else - #define _CONFIGURE_SEMAPHORES_FOR_FIFOS 0 -#endif - -/** - * @defgroup ConfigFilesystems Filesystems and Mount Table Configuration - * - * @ingroup Configuration - * - * Defines to control the file system: - * - * - CONFIGURE_APPLICATION_DISABLE_FILESYSTEM: - * Disable the RTEMS filesystems. You get an empty DEVFS. - * - * - CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM: - * Use the DEVFS as the root file system. Limited functions are - * provided when this is used. - * - * - CONFIGURE_FILESYSTEM_ALL: - * Add file filesystems to the default filesystem table. - * - * List of available file systems. You can define as many as you like: - * - CONFIGURE_FILESYSTEM_IMFS - In Memory File System (IMFS) - * - CONFIGURE_FILESYSTEM_DEVFS - Device File System (DSVFS) - * - CONFIGURE_FILESYSTEM_TFTPFS - TFTP File System, networking enabled - * - CONFIGURE_FILESYSTEM_FTPFS - FTP File System, networking enabled - * - CONFIGURE_FILESYSTEM_NFS - Network File System, networking enabled - * - CONFIGURE_FILESYSTEM_DOSFS - DOS File System, uses libblock - * - CONFIGURE_FILESYSTEM_RFS - RTEMS File System (RFS), uses libblock - * - CONFIGURE_FILESYSTEM_JFFS2 - Journalling Flash File System, Version 2 - * - * Combinations: - * - * - If nothing is defined the base file system is the IMFS. - * - * - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystems - * are disabled by force. - * - * - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystems - * are disabled by force and DEVFS is defined. - */ -/**@{*/ - -#ifdef CONFIGURE_INIT - - /* - * Include all file systems. Do this before checking if the filesystem has - * been disabled. - */ - #ifdef CONFIGURE_FILESYSTEM_ALL - #define CONFIGURE_FILESYSTEM_IMFS - #define CONFIGURE_FILESYSTEM_DEVFS - #define CONFIGURE_FILESYSTEM_TFTPFS - #define CONFIGURE_FILESYSTEM_FTPFS - #define CONFIGURE_FILESYSTEM_NFS - #define CONFIGURE_FILESYSTEM_DOSFS - #define CONFIGURE_FILESYSTEM_RFS - #define CONFIGURE_FILESYSTEM_JFFS2 - #endif - - /* - * If disabling the file system, give a compile error if the user has - * configured other filesystem parameters. - */ - #if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) - #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - #error "Filesystem disabled and a base filesystem configured." - #endif - - #if defined(CONFIGURE_FILESYSTEM_IMFS) || \ - defined(CONFIGURE_FILESYSTEM_DEVFS) || \ - defined(CONFIGURE_FILESYSTEM_TFTPFS) || \ - defined(CONFIGURE_FILESYSTEM_FTPFS) || \ - defined(CONFIGURE_FILESYSTEM_NFS) || \ - defined(CONFIGURE_FILESYSTEM_DOSFS) || \ - defined(CONFIGURE_FILESYSTEM_RFS) || \ - defined(CONFIGURE_FILESYSTEM_JFFS2) - #error "Filesystem disabled and a filesystem configured." - #endif - #endif - - /* - * If the base filesystem is DEVFS define it else define IMFS. - * We will have either DEVFS or IMFS defined after this. - */ - #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) - #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - #define CONFIGURE_FILESYSTEM_DEVFS - #endif - #endif - -#endif - -#ifndef RTEMS_SCHEDSIM -/** - * IMFS - */ -#include <rtems/imfs.h> - -/** - * This specifies the number of bytes per block for files within the IMFS. - * There are a maximum number of blocks per file so this dictates the maximum - * size of a file. This has to be balanced with the unused portion of each - * block that might be wasted. - */ -#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK - #define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \ - IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK -#endif - -/** - * This defines the IMFS file system table entry. - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \ - defined(CONFIGURE_FILESYSTEM_IMFS) - #define CONFIGURE_FILESYSTEM_ENTRY_IMFS \ - { RTEMS_FILESYSTEM_TYPE_IMFS, IMFS_initialize } -#endif -#endif - -#ifdef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM - #define CONFIGURE_IMFS_DISABLE_CHMOD - #define CONFIGURE_IMFS_DISABLE_CHOWN - #define CONFIGURE_IMFS_DISABLE_UTIME - #define CONFIGURE_IMFS_DISABLE_LINK - #define CONFIGURE_IMFS_DISABLE_SYMLINK - #define CONFIGURE_IMFS_DISABLE_READLINK - #define CONFIGURE_IMFS_DISABLE_RENAME - #define CONFIGURE_IMFS_DISABLE_UNMOUNT -#endif - -/** - * DEVFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \ - defined(CONFIGURE_FILESYSTEM_DEVFS) -#include <rtems/devfs.h> - #define CONFIGURE_FILESYSTEM_ENTRY_DEVFS \ - { RTEMS_FILESYSTEM_TYPE_DEVFS, devFS_initialize } -#endif - -/** - * FTPFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \ - defined(CONFIGURE_FILESYSTEM_FTPFS) - #include <rtems/ftpfs.h> - #define CONFIGURE_FILESYSTEM_ENTRY_FTPFS \ - { RTEMS_FILESYSTEM_TYPE_FTPFS, rtems_ftpfs_initialize } -#endif - -/** - * TFTPFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \ - defined(CONFIGURE_FILESYSTEM_TFTPFS) - #include <rtems/tftp.h> - #define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS \ - { RTEMS_FILESYSTEM_TYPE_TFTPFS, rtems_tftpfs_initialize } -#endif - -/** - * NFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) && \ - defined(CONFIGURE_FILESYSTEM_NFS) - #include <librtemsNfs.h> - #if !defined(CONFIGURE_MAXIMUM_NFS_MOUNTS) - #define CONFIGURE_MAXIMUM_NFS_MOUNTS 1 - #endif - #define CONFIGURE_FILESYSTEM_ENTRY_NFS \ - { RTEMS_FILESYSTEM_TYPE_NFS, rtems_nfs_initialize } - #define _CONFIGURE_SEMAPHORES_FOR_NFS ((CONFIGURE_MAXIMUM_NFS_MOUNTS * 2) + 1) -#else - #define _CONFIGURE_SEMAPHORES_FOR_NFS 0 -#endif - -/** - * DOSFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \ - defined(CONFIGURE_FILESYSTEM_DOSFS) - #include <rtems/dosfs.h> - #if !defined(CONFIGURE_MAXIMUM_DOSFS_MOUNTS) - #define CONFIGURE_MAXIMUM_DOSFS_MOUNTS 1 - #endif - #define CONFIGURE_FILESYSTEM_ENTRY_DOSFS \ - { RTEMS_FILESYSTEM_TYPE_DOSFS, rtems_dosfs_initialize } - #define _CONFIGURE_SEMAPHORES_FOR_DOSFS CONFIGURE_MAXIMUM_DOSFS_MOUNTS -#else - #define _CONFIGURE_SEMAPHORES_FOR_DOSFS 0 -#endif - -/** - * RFS - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \ - defined(CONFIGURE_FILESYSTEM_RFS) - #include <rtems/rtems-rfs.h> - #if !defined(CONFIGURE_MAXIMUM_RFS_MOUNTS) - #define CONFIGURE_MAXIMUM_RFS_MOUNTS 1 - #endif - #define CONFIGURE_FILESYSTEM_ENTRY_RFS \ - { RTEMS_FILESYSTEM_TYPE_RFS, rtems_rfs_rtems_initialise } - #define _CONFIGURE_SEMAPHORES_FOR_RFS CONFIGURE_MAXIMUM_RFS_MOUNTS -#else - #define _CONFIGURE_SEMAPHORES_FOR_RFS 0 -#endif - -/** - * JFFS2 - */ -#if !defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2) && \ - defined(CONFIGURE_FILESYSTEM_JFFS2) - #include <rtems/jffs2.h> - #if !defined(CONFIGURE_MAXIMUM_JFFS2_MOUNTS) - #define CONFIGURE_MAXIMUM_JFFS2_MOUNTS 1 - #endif - #define CONFIGURE_FILESYSTEM_ENTRY_JFFS2 \ - { RTEMS_FILESYSTEM_TYPE_JFFS2, rtems_jffs2_initialize } - #define _CONFIGURE_SEMAPHORES_FOR_JFFS2 CONFIGURE_MAXIMUM_JFFS2_MOUNTS -#else - #define _CONFIGURE_SEMAPHORES_FOR_JFFS2 0 -#endif - -/** - * This computes the number of semaphores required for the various - * file systems including the FIFO plugin to the IMFS. - */ -#define _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS \ - (_CONFIGURE_SEMAPHORES_FOR_FIFOS + \ - _CONFIGURE_SEMAPHORES_FOR_NFS + \ - _CONFIGURE_SEMAPHORES_FOR_DOSFS + \ - _CONFIGURE_SEMAPHORES_FOR_RFS + \ - _CONFIGURE_SEMAPHORES_FOR_JFFS2) - -#ifdef CONFIGURE_INIT - - /** - * DEVFS variables. - * - * The number of individual devices that may be registered - * in the system or the CONFIGURE_MAXIMUM_DEVICES variable - * is defaulted to 4 when a filesystem is enabled, unless - * the bsp overwrides this. In which case the value is set - * to BSP_MAXIMUM_DEVICES. - */ - #ifdef CONFIGURE_FILESYSTEM_DEVFS - #ifndef CONFIGURE_MAXIMUM_DEVICES - #if defined(BSP_MAXIMUM_DEVICES) - #define CONFIGURE_MAXIMUM_DEVICES BSP_MAXIMUM_DEVICES - #else - #define CONFIGURE_MAXIMUM_DEVICES 4 - #endif - #endif - #include <rtems/devfs.h> - #endif - - /** - * Table termination record. - */ - #define CONFIGURE_FILESYSTEM_NULL { NULL, NULL } - -#ifndef RTEMS_SCHEDSIM - #if !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) && \ - !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - int imfs_rq_memfile_bytes_per_block = - CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK; - #endif - - /** - * The default file system table. Must be terminated with the NULL entry if - * you provide your own. - */ - #if !defined(CONFIGURE_HAS_OWN_FILESYSTEM_TABLE) && \ - !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) - const rtems_filesystem_table_t rtems_filesystem_table[] = { - #if !defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - { "/", IMFS_initialize_support }, - #endif - #if defined(CONFIGURE_FILESYSTEM_IMFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) - CONFIGURE_FILESYSTEM_ENTRY_IMFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_DEVFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) - CONFIGURE_FILESYSTEM_ENTRY_DEVFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) - CONFIGURE_FILESYSTEM_ENTRY_TFTPFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_FTPFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) - CONFIGURE_FILESYSTEM_ENTRY_FTPFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_NFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_NFS) - CONFIGURE_FILESYSTEM_ENTRY_NFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_DOSFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) - CONFIGURE_FILESYSTEM_ENTRY_DOSFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_RFS) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) - CONFIGURE_FILESYSTEM_ENTRY_RFS, - #endif - #if defined(CONFIGURE_FILESYSTEM_JFFS2) && \ - defined(CONFIGURE_FILESYSTEM_ENTRY_JFFS2) - CONFIGURE_FILESYSTEM_ENTRY_JFFS2, - #endif - CONFIGURE_FILESYSTEM_NULL - }; - #endif - - #if !defined(CONFIGURE_HAS_OWN_MOUNT_TABLE) && \ - !defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) - #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - static devFS_node devFS_root_filesystem_nodes [CONFIGURE_MAXIMUM_DEVICES]; - static const devFS_data devFS_root_filesystem_data = { - devFS_root_filesystem_nodes, - CONFIGURE_MAXIMUM_DEVICES - }; - #else - static IMFS_fs_info_t _Configure_IMFS_fs_info; - - static const rtems_filesystem_operations_table _Configure_IMFS_ops = { - rtems_filesystem_default_lock, - rtems_filesystem_default_unlock, - IMFS_eval_path, - #ifdef CONFIGURE_IMFS_DISABLE_LINK - rtems_filesystem_default_link, - #else - IMFS_link, - #endif - rtems_filesystem_default_are_nodes_equal, - #ifdef CONFIGURE_IMFS_DISABLE_MKNOD - rtems_filesystem_default_mknod, - #else - IMFS_mknod, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_RMNOD - rtems_filesystem_default_rmnod, - #else - IMFS_rmnod, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_CHMOD - rtems_filesystem_default_fchmod, - #else - IMFS_fchmod, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_CHOWN - rtems_filesystem_default_chown, - #else - IMFS_chown, - #endif - IMFS_node_clone, - IMFS_node_free, - #ifdef CONFIGURE_IMFS_DISABLE_MOUNT - rtems_filesystem_default_mount, - #else - IMFS_mount, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_UNMOUNT - rtems_filesystem_default_unmount, - #else - IMFS_unmount, - #endif - rtems_filesystem_default_fsunmount, - #ifdef CONFIGURE_IMFS_DISABLE_UTIME - rtems_filesystem_default_utime, - #else - IMFS_utime, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_SYMLINK - rtems_filesystem_default_symlink, - #else - IMFS_symlink, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_READLINK - rtems_filesystem_default_readlink, - #else - IMFS_readlink, - #endif - #ifdef CONFIGURE_IMFS_DISABLE_RENAME - rtems_filesystem_default_rename, - #else - IMFS_rename, - #endif - rtems_filesystem_default_statvfs - }; - - static const IMFS_mknod_controls _Configure_IMFS_mknod_controls = { - #ifdef CONFIGURE_IMFS_DISABLE_READDIR - &IMFS_mknod_control_dir_minimal, - #else - &IMFS_mknod_control_dir_default, - #endif - &IMFS_mknod_control_device, - #ifdef CONFIGURE_IMFS_DISABLE_MKNOD_FILE - &IMFS_mknod_control_enosys, - #else - &IMFS_mknod_control_memfile, - #endif - #if CONFIGURE_MAXIMUM_FIFOS > 0 || CONFIGURE_MAXIMUM_PIPES > 0 - &IMFS_mknod_control_fifo - #else - &IMFS_mknod_control_enosys - #endif - }; - - static const IMFS_mount_data _Configure_IMFS_mount_data = { - &_Configure_IMFS_fs_info, - &_Configure_IMFS_ops, - &_Configure_IMFS_mknod_controls - }; - #endif - - const rtems_filesystem_mount_configuration - rtems_filesystem_root_configuration = { - NULL, - NULL, - #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - RTEMS_FILESYSTEM_TYPE_DEVFS, - #else - "/", - #endif - RTEMS_FILESYSTEM_READ_WRITE, - #if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) - &devFS_root_filesystem_data - #else - &_Configure_IMFS_mount_data - #endif - }; - #endif - -#endif -#endif -/**@}*/ /* end of file system group */ - -/* - * STACK_CHECKER_ON was still available in 4.9 so give a warning for now. - */ -#if defined(STACK_CHECKER_ON) - #define CONFIGURE_STACK_CHECKER_ENABLED - #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED" -#endif - -/** - * This configures the stack checker user extension. - */ -#ifdef CONFIGURE_STACK_CHECKER_ENABLED - #define _CONFIGURE_STACK_CHECKER_EXTENSION 1 -#else - #define _CONFIGURE_STACK_CHECKER_EXTENSION 0 -#endif - -/** - * @brief Maximum priority configuration. - * - * This configures the maximum priority value that - * a task may have. - * - * The following applies to the data space requirements - * of the Priority Scheduler. - * - * By reducing the number of priorities in a system, - * the amount of RAM required by RTEMS can be significantly - * reduced. RTEMS allocates a Chain_Control structure per - * priority and this structure contains 3 pointers. So - * the default is (256 * 12) = 3K on 32-bit architectures. - * - * This must be one less than a power of 2 between - * 4 and 256. Valid values along with the application - * priority levels and memory saved when pointers are - * 32-bits in size are: - * - * + 3, 2 application priorities, 3024 bytes saved - * + 7, 5 application priorities, 2976 bytes saved - * + 15, 13 application priorities, 2880 bytes saved - * + 31, 29 application priorities, 2688 bytes saved - * + 63, 61 application priorities, 2304 bytes saved - * + 127, 125 application priorities, 1536 bytes saved - * + 255, 253 application priorities, 0 bytes saved - * - * It is specified in terms of Classic API priority values. - */ -#ifndef CONFIGURE_MAXIMUM_PRIORITY - #define CONFIGURE_MAXIMUM_PRIORITY PRIORITY_DEFAULT_MAXIMUM -#endif - -/** - * @defgroup ConfigScheduler Scheduler configuration - * - * @ingroup Configuration - * - * The scheduler configuration allows an application to select the - * scheduling policy to use. The supported configurations are: - * - * - CONFIGURE_SCHEDULER_PRIORITY - Deterministic Priority Scheduler - * - CONFIGURE_SCHEDULER_PRIORITY_SMP - Deterministic Priority SMP Scheduler - * - CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Deterministic - * Priority SMP Affinity Scheduler - * - CONFIGURE_SCHEDULER_STRONG_APA - Strong APA Scheduler - * - CONFIGURE_SCHEDULER_SIMPLE - Light-weight Priority Scheduler - * - CONFIGURE_SCHEDULER_SIMPLE_SMP - Simple SMP Priority Scheduler - * - CONFIGURE_SCHEDULER_EDF - EDF Scheduler - * - CONFIGURE_SCHEDULER_EDF_SMP - EDF SMP Scheduler - * - CONFIGURE_SCHEDULER_CBS - CBS Scheduler - * - CONFIGURE_SCHEDULER_USER - user provided scheduler - * - * If no configuration is specified by the application in a uniprocessor - * configuration, then CONFIGURE_SCHEDULER_PRIORITY is the default. - * - * If no configuration is specified by the application in SMP - * configuration, then CONFIGURE_SCHEDULER_PRIORITY_SMP is the default. - * - * An application can define its own scheduling policy by defining - * CONFIGURE_SCHEDULER_USER and the following: - * - * - CONFIGURE_SCHEDULER_CONTEXT - * - CONFIGURE_SCHEDULER_CONTROLS - * - CONFIGURE_SCHEDULER_USER_PER_THREAD - */ - -#if !defined(CONFIGURE_SCHEDULER_USER) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) && \ - !defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) && \ - !defined(CONFIGURE_SCHEDULER_STRONG_APA) && \ - !defined(CONFIGURE_SCHEDULER_SIMPLE) && \ - !defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) && \ - !defined(CONFIGURE_SCHEDULER_EDF) && \ - !defined(CONFIGURE_SCHEDULER_EDF_SMP) && \ - !defined(CONFIGURE_SCHEDULER_CBS) - #if defined(RTEMS_SMP) && CONFIGURE_MAXIMUM_PROCESSORS > 1 - /** - * If no scheduler is specified in an SMP configuration, the - * EDF scheduler is default. - */ - #define CONFIGURE_SCHEDULER_EDF_SMP - #else - /** - * If no scheduler is specified in a uniprocessor configuration, the - * priority scheduler is default. - */ - #define CONFIGURE_SCHEDULER_PRIORITY - #endif -#endif - -#include <rtems/scheduler.h> - -/* - * If the Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'D', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Deterministic Priority SMP Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'D', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Deterministic Priority Affinity SMP Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'A', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( \ - dflt, \ - CONFIGURE_SCHEDULER_NAME \ - ) - #endif -#endif - -/* - * If the Strong APA Scheduler is selected, then configure for - * it. - */ -#if defined(CONFIGURE_SCHEDULER_STRONG_APA) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'A', 'P', 'A') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_STRONG_APA( \ - dflt, \ - CONFIGURE_MAXIMUM_PRIORITY + 1 \ - ) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_STRONG_APA(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Simple Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_SIMPLE) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'P', 'S', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the Simple SMP Priority Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'P', 'S', ' ') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the EDF Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_EDF) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'E', 'D', 'F') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_EDF(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the EDF SMP Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_EDF_SMP) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('M', 'E', 'D', 'F') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT \ - RTEMS_SCHEDULER_CONTEXT_EDF_SMP(dflt, CONFIGURE_MAXIMUM_PROCESSORS) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_EDF_SMP(dflt, CONFIGURE_SCHEDULER_NAME) - #endif -#endif - -/* - * If the CBS Scheduler is selected, then configure for it. - */ -#if defined(CONFIGURE_SCHEDULER_CBS) - #if !defined(CONFIGURE_SCHEDULER_NAME) - /** Configure the name of the scheduler instance */ - #define CONFIGURE_SCHEDULER_NAME rtems_build_name('U', 'C', 'B', 'S') - #endif - - #if !defined(CONFIGURE_SCHEDULER_CONTROLS) - /** Configure the context needed by the scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt) - - /** Configure the controls for this scheduler instance */ - #define CONFIGURE_SCHEDULER_CONTROLS \ - RTEMS_SCHEDULER_CONTROL_CBS(dflt, CONFIGURE_SCHEDULER_NAME) - #endif - - #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS - #define CONFIGURE_CBS_MAXIMUM_SERVERS CONFIGURE_MAXIMUM_TASKS - #endif - - #ifdef CONFIGURE_INIT - const uint32_t _Scheduler_CBS_Maximum_servers = - CONFIGURE_CBS_MAXIMUM_SERVERS; - - Scheduler_CBS_Server - _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ]; - #endif -#endif - -/* - * Set up the scheduler entry points table. The scheduling code uses - * this code to know which scheduler is configured by the user. - */ -#ifdef CONFIGURE_INIT - #if defined(CONFIGURE_SCHEDULER_CONTEXT) - CONFIGURE_SCHEDULER_CONTEXT; - #endif - - const Scheduler_Control _Scheduler_Table[] = { - CONFIGURE_SCHEDULER_CONTROLS - }; - - #define CONFIGURE_SCHEDULER_COUNT RTEMS_ARRAY_SIZE( _Scheduler_Table ) - - #if defined(RTEMS_SMP) - const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT; - - const Scheduler_Assignment _Scheduler_Initial_assignments[] = { - #if defined(CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS) - CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS - #else - #define _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT \ - RTEMS_SCHEDULER_ASSIGN( \ - 0, \ - RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ - ) - _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #if CONFIGURE_MAXIMUM_PROCESSORS >= 2 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 3 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 4 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 5 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 6 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 7 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 8 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 9 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 10 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 11 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 12 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 13 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 14 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 15 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 16 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 17 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 18 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 19 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 20 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 21 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 22 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 23 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 24 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 25 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 26 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 27 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 28 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 29 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 30 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 31 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #if CONFIGURE_MAXIMUM_PROCESSORS >= 32 - , _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - #undef _CONFIGURE_SMP_SCHEDULER_ASSIGN_OPT - #endif - }; - - RTEMS_STATIC_ASSERT( - CONFIGURE_MAXIMUM_PROCESSORS - == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ), - _Scheduler_Initial_assignments - ); - #endif -#endif -/**@}*/ /* end of Scheduler Configuration */ - -/** - * @defgroup ConfigurationIdle IDLE Thread Configuration - * - * @addtogroup Configuration - * - * This module contains configuration parameters related to the - * set of IDLE threads. On a uniprocessor system, there is one - * IDLE thread. On an SMP system, there is one for each core. - */ - -/* - * If you said the IDLE task was going to do application initialization - * and didn't override the IDLE body, then something is amiss. - */ -#if (defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \ - !defined(CONFIGURE_IDLE_TASK_BODY)) - #error "CONFIGURE_ERROR: You did not override the IDLE task body." -#endif - -/** - * @brief Idle task body configuration. - * - * There is a default IDLE thread body provided by RTEMS which - * has the possibility of being CPU specific. There may be a - * BSP specific override of the RTEMS default body and in turn, - * the application may override and provide its own. - */ -#ifndef CONFIGURE_IDLE_TASK_BODY - #if defined(BSP_IDLE_TASK_BODY) - #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY - #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE) - #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body - #else - /* only instantiate and compile if used */ - #ifdef CONFIGURE_INIT - void *_Thread_Idle_body(uintptr_t ignored) - { - for( ; ; ) ; - return 0; /* to avoid warning */ - } - #endif - #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body - #endif -#endif -/**@}*/ /* end of IDLE thread configuration */ - -/** - * @defgroup ConfigurationStackSize Configuration Thread Stack Size - * - * @addtogroup Configuration - * - * This module contains parameters related to thread aand interrupt stacks. - */ - -/** - * By default, use the minimum stack size requested by this port. - */ -#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE - #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE -#endif - -/** - * This specifies the default POSIX thread stack size. By default, it is - * twice that recommended for the port. - */ -#define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \ - (2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE) - -/** - * @brief Idle task stack size configuration. - * - * By default, the IDLE task will have a stack of minimum size. - * The BSP or application may override this value. - */ -#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE - #ifdef BSP_IDLE_TASK_STACK_SIZE - #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE - #else - #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE - #endif -#endif -#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE - #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE" -#endif - -/** - * @brief Interrupt stack size configuration. - * - * By default, the interrupt stack will be of minimum size. - * The BSP or application may override this value. - */ -#ifndef CONFIGURE_INTERRUPT_STACK_SIZE - #ifdef BSP_INTERRUPT_STACK_SIZE - #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE - #else - #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE - #endif -#endif - -/** - * This reserves memory for the interrupt stack if it is to be allocated - * by RTEMS rather than the BSP. - * - * @todo Try to get to the point where all BSPs support allocating the - * memory from the Workspace. - */ -#if (CPU_ALLOCATE_INTERRUPT_STACK == 0) - #define _CONFIGURE_INTERRUPT_STACK_MEMORY 0 -#else - #define _CONFIGURE_INTERRUPT_STACK_MEMORY \ - _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) -#endif - -/** - * Configure the very much optional task stack allocator initialization - */ -#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_INIT - #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT NULL -#endif - -/* - * Configure the very much optional task stack allocator and deallocator. - */ -#if !defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ - && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR) - /** - * This specifies the task stack allocator method. - */ - #define CONFIGURE_TASK_STACK_ALLOCATOR _Workspace_Allocate - /** - * This specifies the task stack deallocator method. - */ - #define CONFIGURE_TASK_STACK_DEALLOCATOR _Workspace_Free -#elif (defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ - && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \ - || (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \ - && defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) - #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined" -#endif -/**@}*/ /* end of thread/interrupt stack configuration */ - -/** - * @addtogroup Configuration - */ -/**@{*/ - -/** - * Should the RTEMS Workspace and C Program Heap be cleared automatically - * at system start up? - */ -#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY - #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY - #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \ - BSP_ZERO_WORKSPACE_AUTOMATICALLY - #else - #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE - #endif -#endif -/**@}*/ /* end of add to group Configuration */ - -/** - * @defgroup ConfigurationMalloc RTEMS Malloc configuration - * - * This module contains parameters related to configuration of the RTEMS - * Malloc implementation. - */ -/**@{*/ -#include <rtems/malloc.h> - -#ifdef CONFIGURE_INIT - /** - * By default, RTEMS uses separate heaps for the RTEMS Workspace and - * the C Program Heap. The application can choose optionally to combine - * these to provide one larger memory pool. This is particularly - * useful in combination with the unlimited objects configuration. - */ - #ifdef CONFIGURE_UNIFIED_WORK_AREAS - Heap_Control *RTEMS_Malloc_Heap = &_Workspace_Area; - #else - Heap_Control RTEMS_Malloc_Area; - Heap_Control *RTEMS_Malloc_Heap = &RTEMS_Malloc_Area; - #endif -#endif - -#ifdef CONFIGURE_INIT - /** - * This configures the sbrk() support for the malloc family. - * By default it is assumed that the BSP provides all available - * RAM to the malloc family implementation so sbrk()'ing to get - * more memory would always fail anyway. - */ - const rtems_heap_extend_handler rtems_malloc_extend_handler = - #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK - rtems_heap_extend_via_sbrk; - #else - rtems_heap_null_extend; - #endif -#endif - -#ifdef CONFIGURE_INIT - /** - * This configures the malloc family plugin which dirties memory - * allocated. This is helpful for finding unitialized data structure - * problems. - */ - rtems_malloc_dirtier_t rtems_malloc_dirty_helper = - #if defined(CONFIGURE_MALLOC_DIRTY) - rtems_malloc_dirty_memory; - #else - NULL; - #endif -#endif -/**@}*/ /* end of Malloc Configuration */ - -/** - * @defgroup ConfigurationHelpers Configuration Helpers - * - * @ingroup Configuration - * - * This module contains items which are used internally to ease - * the configuration calculations. - */ -/**@{*/ - -/** - * Zero of one returns 0 if the parameter is 0 else 1 is returned. - */ -#define _Configure_Zero_or_One(_number) ((_number) ? 1 : 0) - -/** - * General helper to align up a value. - */ -#define _Configure_Align_up(_val, _align) \ - (((_val) + (_align) - 1) - ((_val) + (_align) - 1) % (_align)) - -#define _CONFIGURE_HEAP_MIN_BLOCK_SIZE \ - _Configure_Align_up(sizeof(Heap_Block), CPU_HEAP_ALIGNMENT) - -/** - * This is a helper macro used in calculations in this file. It is used - * to noted when an element is allocated from the RTEMS Workspace and adds - * a factor to account for heap overhead plus an alignment factor that - * may be applied. - */ -#define _Configure_From_workspace(_size) \ - (ssize_t) (_Configure_Zero_or_One(_size) * \ - _Configure_Align_up(_size + HEAP_BLOCK_HEADER_SIZE, \ - _CONFIGURE_HEAP_MIN_BLOCK_SIZE)) - -/** - * This is a helper macro used in stack space calculations in this file. It - * may be provided by the application in case a special task stack allocator - * is used. The default is allocation from the RTEMS Workspace. - */ -#ifdef CONFIGURE_TASK_STACK_FROM_ALLOCATOR - #define _Configure_From_stackspace(_stack_size) \ - CONFIGURE_TASK_STACK_FROM_ALLOCATOR(_stack_size) -#else - #define _Configure_From_stackspace(_stack_size) \ - _Configure_From_workspace(_stack_size) -#endif - -/** - * Do not use the unlimited bit as part of the multiplication - * for memory usage. - */ -#define _Configure_Max_Objects(_max) \ - (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max)) - -/** - * This macro accounts for how memory for a set of configured objects is - * allocated from the Executive Workspace. - * - * NOTE: It does NOT attempt to address the more complex case of unlimited - * objects. - */ -#define _Configure_Object_RAM(_number, _size) ( \ - _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \ - _Configure_From_workspace( \ - _Configure_Zero_or_One(_number) * ( \ - (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \ - _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \ - _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \ - ) \ - ) \ - ) -/**@}*/ - -/** - * @defgroup ConfigurationInitTasksTable Initialization Tasks Configuration - * - * @addtogroup Configuration - * - * This group contains the elements needed to define the Classic API - * Initialization Tasks Table. - * - * Default User Initialization Task Table. This table guarantees that - * one user initialization table is defined. - */ -#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE - -/* - * The user is defining their own table information and setting the - * appropriate variables. - */ - -#else - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the name of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_NAME - #define CONFIGURE_INIT_TASK_NAME rtems_build_name('U', 'I', '1', ' ') -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the stack size of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_STACK_SIZE - #define CONFIGURE_INIT_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the priority of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_PRIORITY - #define CONFIGURE_INIT_TASK_PRIORITY 1 -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the attributes size of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES - #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the entry point of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT - #ifdef __cplusplus - extern "C" { - #endif - rtems_task Init (rtems_task_argument ); - #ifdef __cplusplus - } - #endif - #define CONFIGURE_INIT_TASK_ENTRY_POINT Init - extern const char* bsp_boot_cmdline; - #define CONFIGURE_INIT_TASK_ARGUMENTS ((rtems_task_argument) &bsp_boot_cmdline) -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the initial execution mode of the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES - #ifdef _CONFIGURE_SMP_APPLICATION - #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES - #else - #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT - #endif -#endif - -/** - * When using the default Classic API Initialization Tasks Table, this is - * used to specify the initial argument to the single Classic API task. - */ -#ifndef CONFIGURE_INIT_TASK_ARGUMENTS - #define CONFIGURE_INIT_TASK_ARGUMENTS 0 -#endif - -#ifdef CONFIGURE_INIT - rtems_initialization_tasks_table Initialization_tasks[] = { - { CONFIGURE_INIT_TASK_NAME, - CONFIGURE_INIT_TASK_STACK_SIZE, - CONFIGURE_INIT_TASK_PRIORITY, - CONFIGURE_INIT_TASK_ATTRIBUTES, - CONFIGURE_INIT_TASK_ENTRY_POINT, - CONFIGURE_INIT_TASK_INITIAL_MODES, - CONFIGURE_INIT_TASK_ARGUMENTS - } - }; -#endif - -/** - * This is the name of the Initialization Tasks Table generated. - */ -#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks - -/* - * This is the size of the Initialization Tasks Table generated. - */ -#define CONFIGURE_INIT_TASK_TABLE_SIZE \ - RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE) - -#endif /* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */ - -#else /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */ - -/* - * This is the name of the Initialization Task when none is configured. - */ -#define CONFIGURE_INIT_TASK_TABLE NULL - -/* - * This is the size of the Initialization Task when none is configured. - */ -#define CONFIGURE_INIT_TASK_TABLE_SIZE 0 - -/* - * This is the stack size of the Initialization Task when none is configured. - */ -#define CONFIGURE_INIT_TASK_STACK_SIZE 0 - -#endif -/**@}*/ /* end of Classic API Initialization Tasks Table */ - -/** - * @defgroup ConfigurationDriverTable Device Driver Table Configuration - * - * @addtogroup Configuration - * - * This group contains parameters related to generating a Device Driver - * Table. - * - * Default Device Driver Table. Each driver needed by the test is explicitly - * choosen by the application. There is always a null driver entry. - */ -/**@{*/ - -/** - * This is an empty device driver slot. - */ -#define NULL_DRIVER_TABLE_ENTRY \ - { NULL, NULL, NULL, NULL, NULL, NULL } - -#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \ - defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) -#error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER and CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER are mutually exclusive" -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER - #include <rtems/console.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER - #include <rtems/console.h> - - #ifdef CONFIGURE_INIT - RTEMS_SYSINIT_ITEM( - _Console_simple_Initialize, - RTEMS_SYSINIT_DEVICE_DRIVERS, - RTEMS_SYSINIT_ORDER_SECOND - ); - #endif -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - #include <rtems/clockdrv.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER - #include <rtems/btimer.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER - #include <rtems/rtc.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER - #include <rtems/watchdogdrv.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER - #include <rtems/framebuffer.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER - #include <rtems/devnull.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER - #include <rtems/devzero.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER - /* the ide driver needs the ATA driver */ - #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER - #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER - #endif - #include <libchip/ide_ctrl.h> -#endif - -#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER - #include <libchip/ata.h> -#endif - -#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE - -/** - * This specifies the maximum number of device drivers that - * can be installed in the system at one time. It must account - * for both the statically and dynamically installed drivers. - */ -#ifndef CONFIGURE_MAXIMUM_DRIVERS - #define CONFIGURE_MAXIMUM_DRIVERS -#endif - -#ifdef CONFIGURE_INIT - rtems_driver_address_table - _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = { - #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS - CONFIGURE_BSP_PREREQUISITE_DRIVERS, - #endif - #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS - CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER - CONSOLE_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER - CLOCK_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER - RTC_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER - WATCHDOG_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER - DEVNULL_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER - DEVZERO_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER - IDE_CONTROLLER_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER - ATA_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER - FRAME_BUFFER_DRIVER_TABLE_ENTRY, - #endif - #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS - CONFIGURE_APPLICATION_EXTRA_DRIVERS, - #endif - #ifdef CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER - NULL_DRIVER_TABLE_ENTRY - #elif !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) - NULL_DRIVER_TABLE_ENTRY - #endif - }; - - const size_t _IO_Number_of_drivers = - RTEMS_ARRAY_SIZE( _IO_Driver_address_table ); -#endif - -#endif /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */ - -#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER - /* - * configure the priority of the ATA driver task - */ - #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY - #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY - #endif - #ifdef CONFIGURE_INIT - rtems_task_priority rtems_ata_driver_task_priority - = CONFIGURE_ATA_DRIVER_TASK_PRIORITY; - #endif /* CONFIGURE_INIT */ -#endif -/**@}*/ /* end of Device Driver Table Configuration */ - -/** - * @defgroup ConfigurationLibBlock Configuration of LIBBLOCK - * - * @addtogroup Configuration - * - * This module contains parameters related to the LIBBLOCK buffering - * and caching subsystem. It requires tasks to swap out data to be - * written to non-volatile storage. - */ -/**@{*/ -#ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK - #include <rtems/bdbuf.h> - /* - * configure the bdbuf cache parameters - */ - #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS - #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \ - RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS - #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \ - RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT - #endif - #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY - #define CONFIGURE_SWAPOUT_TASK_PRIORITY \ - RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT - #endif - #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD - #define CONFIGURE_SWAPOUT_SWAP_PERIOD \ - RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT - #endif - #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD - #define CONFIGURE_SWAPOUT_BLOCK_HOLD \ - RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT - #endif - #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS - #define CONFIGURE_SWAPOUT_WORKER_TASKS \ - RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT - #endif - #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY - #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \ - RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE - #define CONFIGURE_BDBUF_TASK_STACK_SIZE \ - RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE - #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \ - RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE - #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \ - RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE - #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \ - RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT - #endif - #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY - #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \ - RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT - #endif - #ifdef CONFIGURE_INIT - const rtems_bdbuf_config rtems_bdbuf_configuration = { - CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS, - CONFIGURE_BDBUF_MAX_WRITE_BLOCKS, - CONFIGURE_SWAPOUT_TASK_PRIORITY, - CONFIGURE_SWAPOUT_SWAP_PERIOD, - CONFIGURE_SWAPOUT_BLOCK_HOLD, - CONFIGURE_SWAPOUT_WORKER_TASKS, - CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY, - CONFIGURE_BDBUF_TASK_STACK_SIZE, - CONFIGURE_BDBUF_CACHE_MEMORY_SIZE, - CONFIGURE_BDBUF_BUFFER_MIN_SIZE, - CONFIGURE_BDBUF_BUFFER_MAX_SIZE, - CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY - }; - #endif - - #define _CONFIGURE_LIBBLOCK_TASKS \ - (1 + CONFIGURE_SWAPOUT_WORKER_TASKS + \ - (CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0)) - - #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS \ - (_CONFIGURE_LIBBLOCK_TASKS * \ - (CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \ - 0 : CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)) - - #ifdef RTEMS_BDBUF_USE_PTHREAD - /* - * Semaphores: - * o disk lock - */ - #define _CONFIGURE_LIBBLOCK_SEMAPHORES 1 - #else - /* - * Semaphores: - * o disk lock - * o bdbuf lock - * o bdbuf sync lock - * o bdbuf access condition - * o bdbuf transfer condition - * o bdbuf buffer condition - */ - #define _CONFIGURE_LIBBLOCK_SEMAPHORES 6 - #endif - - #if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \ - defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \ - defined(CONFIGURE_BDBUF_BUFFER_COUNT) - #error BDBUF Cache does not use a buffer configuration table. Please remove. - #endif -#else - /** This specifies the number of libblock tasks. */ - #define _CONFIGURE_LIBBLOCK_TASKS 0 - /** This specifies the extra stack space configured for libblock tasks. */ - #define _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS 0 - /** This specifies the number of Classic API semaphores needed by libblock. */ - #define _CONFIGURE_LIBBLOCK_SEMAPHORES 0 -#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */ -/**@}*/ - -/** - * @defgroup ConfigurationMultiprocessing Multiprocessing Configuration - * - * @addtogroup Configuration - * - * This module contains the parameters related to the Multiprocessing - * configuration of RTEMS. - * - * In a single processor or SMP configuration, only two parameters are - * needed and they are defaulted. The user should not have to specify - * any parameters. - */ -/**@{*/ - -/** - * This defines the extra stack space required for the MPCI server thread. - */ -#ifndef CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK - #define CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK 0 -#endif - -/** - * This defines the timers required for the shared memory driver in - * a multiprocessing configuration. - */ -#ifndef _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER - #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 0 -#endif - - -#if defined(RTEMS_MULTIPROCESSING) - /* - * Default Multiprocessing Configuration Table. The defaults are - * appropriate for most of the RTEMS Multiprocessor Test Suite. Each - * value may be overridden within each test to customize the environment. - */ - - #ifdef CONFIGURE_MP_APPLICATION - #define _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER 1 - - #ifndef CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE - - #ifndef CONFIGURE_MP_NODE_NUMBER - #define CONFIGURE_MP_NODE_NUMBER NODE_NUMBER - #endif - - #ifndef CONFIGURE_MP_MAXIMUM_NODES - #define CONFIGURE_MP_MAXIMUM_NODES 2 - #endif - - #ifndef CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS - #define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS 32 - #endif - #define _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(_global_objects) \ - _Configure_From_workspace( \ - (_global_objects) * sizeof(Objects_MP_Control) \ - ) - - #ifndef CONFIGURE_MP_MAXIMUM_PROXIES - #define CONFIGURE_MP_MAXIMUM_PROXIES 32 - #endif - #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \ - _Configure_From_workspace((_proxies) \ - * (sizeof(Thread_Proxy_control) \ - + THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT))) - - #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER - #include <mpci.h> - #define CONFIGURE_MP_MPCI_TABLE_POINTER &MPCI_table - #endif - - #ifdef CONFIGURE_INIT - rtems_multiprocessing_table Multiprocessing_configuration = { - CONFIGURE_MP_NODE_NUMBER, /* local node number */ - CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes */ - CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS, /* maximum # global objects */ - CONFIGURE_MP_MAXIMUM_PROXIES, /* maximum # proxies */ - CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, /* MPCI stack > minimum */ - CONFIGURE_MP_MPCI_TABLE_POINTER /* ptr to MPCI config table */ - }; - #endif - - #define CONFIGURE_MULTIPROCESSING_TABLE &Multiprocessing_configuration - - #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1 - - #endif /* CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE */ - - #else - - #define CONFIGURE_MULTIPROCESSING_TABLE NULL - - #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0 - - #endif /* CONFIGURE_MP_APPLICATION */ -#else - #define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0 -#endif /* RTEMS_MULTIPROCESSING */ -/**@}*/ /* end of Multiprocessing Configuration */ - -/** - * This macro specifies that the user wants to use unlimited objects for any - * classic or posix objects that have not already been given resource limits. - */ -#if defined(CONFIGURE_UNLIMITED_OBJECTS) - #if !defined(CONFIGURE_UNIFIED_WORK_AREAS) && \ - !defined(CONFIGURE_EXECUTIVE_RAM_SIZE) && \ - !defined(CONFIGURE_MEMORY_OVERHEAD) - #error "CONFIGURE_UNLIMITED_OBJECTS requires a unified work area, an executive RAM size, or a defined workspace memory overhead" - #endif - - #if !defined(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - /** - * This macro specifies a default allocation size for when auto-extending - * unlimited objects if none was given by the user. - */ - #define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 8 - #endif - #if !defined(CONFIGURE_MAXIMUM_TASKS) - #define CONFIGURE_MAXIMUM_TASKS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_TIMERS) - #define CONFIGURE_MAXIMUM_TIMERS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_SEMAPHORES) - #define CONFIGURE_MAXIMUM_SEMAPHORES \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) - #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_PARTITIONS) - #define CONFIGURE_MAXIMUM_PARTITIONS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_REGIONS) - #define CONFIGURE_MAXIMUM_REGIONS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_PORTS) - #define CONFIGURE_MAXIMUM_PORTS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_PERIODS) - #define CONFIGURE_MAXIMUM_PERIODS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_BARRIERS) - #define CONFIGURE_MAXIMUM_BARRIERS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_KEYS) - #define CONFIGURE_MAXIMUM_POSIX_KEYS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS) - #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - - #ifdef RTEMS_POSIX_API - #if !defined(CONFIGURE_MAXIMUM_POSIX_THREADS) - #define CONFIGURE_MAXIMUM_POSIX_THREADS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_TIMERS) - #define CONFIGURE_MAXIMUM_POSIX_TIMERS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif -/* - #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) - #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif -*/ - #if !defined(CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) - #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) - #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS) - #define CONFIGURE_MAXIMUM_POSIX_SHMS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif - #endif /* RTEMS_POSIX_API */ -#endif /* CONFIGURE_UNLIMITED_OBJECTS */ - - -/** - * @defgroup ConfigurationClassicAPI Classic API Configuration - * - * @ingroup Configuration - * - * This module contains the parameters related to configuration - * of the Classic API services. - */ -/**@{*/ -#ifndef CONFIGURE_HAS_OWN_CONFIGURATION_TABLE - - /** This configures the maximum number of Classic API tasks. */ - #ifndef CONFIGURE_MAXIMUM_TASKS - #define CONFIGURE_MAXIMUM_TASKS 0 - #endif - - /* - * This is calculated to account for the maximum number of Classic API - * tasks used by the application and configured RTEMS capabilities. - */ - #define _CONFIGURE_TASKS \ - (CONFIGURE_MAXIMUM_TASKS + _CONFIGURE_LIBBLOCK_TASKS) - - #ifndef CONFIGURE_MAXIMUM_TIMERS - /** This specifies the maximum number of Classic API timers. */ - #define CONFIGURE_MAXIMUM_TIMERS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API timers. - */ - #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0 - #else - #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) \ - _Configure_Object_RAM(_timers, sizeof(Timer_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_SEMAPHORES - /** This specifies the maximum number of Classic API semaphores. */ - #define CONFIGURE_MAXIMUM_SEMAPHORES 0 - #endif - - /* - * This specifies the number of Classic API semaphores required - */ - #ifdef RTEMS_NETWORKING - #define _CONFIGURE_NETWORKING_SEMAPHORES 1 - #else - #define _CONFIGURE_NETWORKING_SEMAPHORES 0 - #endif - - /* - * This macro is calculated to specify the number of Classic API - * semaphores required by the application and configured RTEMS - * capabilities. - */ - #define _CONFIGURE_SEMAPHORES \ - (CONFIGURE_MAXIMUM_SEMAPHORES + \ - _CONFIGURE_TERMIOS_SEMAPHORES + _CONFIGURE_LIBBLOCK_SEMAPHORES + \ - _CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \ - _CONFIGURE_NETWORKING_SEMAPHORES) - - /* - * This macro is calculated to specify the memory required for - * Classic API Semaphores using MRSP. This is only available in - * SMP configurations. - */ - #if !defined(RTEMS_SMP) || \ - !defined(CONFIGURE_MAXIMUM_MRSP_SEMAPHORES) - #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES 0 - #else - #define _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES \ - CONFIGURE_MAXIMUM_MRSP_SEMAPHORES * \ - _Configure_From_workspace( \ - RTEMS_ARRAY_SIZE(_Scheduler_Table) * sizeof(Priority_Control) \ - ) - #endif - - /* - * This macro is calculated to specify the memory required for - * Classic API Semaphores. - * - * If there are no user or support semaphores defined, then we can assume - * that no memory need be allocated at all for semaphores. - */ - #if _CONFIGURE_SEMAPHORES == 0 - #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0 - #else - #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \ - _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \ - _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES - #endif - - #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES - /** - * This configuration parameter specifies the maximum number of - * Classic API Message Queues. - */ - #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 0 - /* - * This macro is calculated to specify the RTEMS Workspace required for - * the Classic API Message Queues. - */ - #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0 - #else - #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \ - _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_PARTITIONS - /** - * This configuration parameter specifies the maximum number of - * Classic API Partitions. - */ - #define CONFIGURE_MAXIMUM_PARTITIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API - */ - #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0 - #else - #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \ - _Configure_Object_RAM(_partitions, sizeof(Partition_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_REGIONS - /** - * This configuration parameter specifies the maximum number of - * Classic API Regions. - */ - #define CONFIGURE_MAXIMUM_REGIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API Regions. - */ - #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0 - #else - #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) \ - _Configure_Object_RAM(_regions, sizeof(Region_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_PORTS - /** - * This configuration parameter specifies the maximum number of - * Classic API Dual-Ported Memory Ports. - */ - #define CONFIGURE_MAXIMUM_PORTS 0 - /** - * This macro is calculated to specify the memory required for - * Classic API Dual-Ported Memory Ports. - */ - #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) 0 - #else - #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) \ - _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_PERIODS - /** - * This configuration parameter specifies the maximum number of - * Classic API Rate Monotonic Periods. - */ - #define CONFIGURE_MAXIMUM_PERIODS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API Rate Monotonic Periods. - */ - #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0 -#else - #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) \ - _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) ) - #endif - - /** - * This configuration parameter specifies the maximum number of - * Classic API Barriers. - */ - #ifndef CONFIGURE_MAXIMUM_BARRIERS - #define CONFIGURE_MAXIMUM_BARRIERS 0 - #endif - - /* - * This macro is calculated to specify the number of Classic API - * Barriers required by the application and configured capabilities. - */ - #define _CONFIGURE_BARRIERS \ - (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS) - - /* - * This macro is calculated to specify the memory required for - * Classic API Barriers. - */ - #if _CONFIGURE_BARRIERS == 0 - #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0 - #else - #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \ - _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) ) - #endif - - #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS - /** - * This configuration parameter specifies the maximum number of - * Classic API User Extensions. - */ - #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API User Extensions. - */ - #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0 - #else - #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \ - _Configure_Object_RAM(_extensions, sizeof(Extension_Control) ) - #endif - /**@}*/ /* end of Classic API Configuration */ - - /** - * @defgroup ConfigurationGeneral General System Configuration - * - * @ingroup Configuration - * - * This module contains configuration parameters that are independent - * of any API but impact general system configuration. - */ - /**@{*/ - - /** The configures the number of microseconds per clock tick. */ - #ifndef CONFIGURE_MICROSECONDS_PER_TICK - #define CONFIGURE_MICROSECONDS_PER_TICK \ - RTEMS_MILLISECONDS_TO_MICROSECONDS(10) - #endif - - #if 1000000 % CONFIGURE_MICROSECONDS_PER_TICK != 0 - #warning "The clock ticks per second is not an integer" - #endif - - #if CONFIGURE_MICROSECONDS_PER_TICK <= 0 - #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive" - #endif - - #define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK) - - /** The configures the number of clock ticks per timeslice. */ - #ifndef CONFIGURE_TICKS_PER_TIMESLICE - #define CONFIGURE_TICKS_PER_TIMESLICE 50 - #endif - -/**@}*/ /* end of General Configuration */ - -/* - * Initial Extension Set - */ - -#ifdef CONFIGURE_INIT -#ifdef CONFIGURE_STACK_CHECKER_ENABLED -#include <rtems/stackchk.h> -#endif -#include <rtems/libcsupport.h> - -#if defined(BSP_INITIAL_EXTENSION) || \ - defined(CONFIGURE_INITIAL_EXTENSIONS) || \ - defined(CONFIGURE_STACK_CHECKER_ENABLED) || \ - (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY)) - static const rtems_extensions_table Configuration_Initial_Extensions[] = { - #if !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY) - RTEMS_NEWLIB_EXTENSION, - #endif - #if defined(CONFIGURE_STACK_CHECKER_ENABLED) - RTEMS_STACK_CHECKER_EXTENSION, - #endif - #if defined(CONFIGURE_INITIAL_EXTENSIONS) - CONFIGURE_INITIAL_EXTENSIONS, - #endif - #if defined(BSP_INITIAL_EXTENSION) - BSP_INITIAL_EXTENSION - #endif - }; - - #define CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions - #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \ - RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions) - - RTEMS_SYSINIT_ITEM( - _User_extensions_Handler_initialization, - RTEMS_SYSINIT_INITIAL_EXTENSIONS, - RTEMS_SYSINIT_ORDER_MIDDLE - ); -#else - #define CONFIGURE_INITIAL_EXTENSION_TABLE NULL - #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0 -#endif - -#if defined(RTEMS_NEWLIB) - struct _reent *__getreent(void) - { - #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY - return _GLOBAL_REENT; - #else - return _Thread_Get_executing()->libc_reent; - #endif - } -#endif - -#endif - -/** - * @defgroup ConfigurationPOSIXAPI POSIX API Configuration Parameters - * - * This module contains the parameters related to configuration - * of the POSIX API services. - */ -/**@{*/ - -#include <rtems/posix/key.h> - -/** - * This configuration parameter specifies the maximum number of - * POSIX API keys. - * - * POSIX Keys are available whether or not the POSIX API is enabled. - */ -#ifndef CONFIGURE_MAXIMUM_POSIX_KEYS - #define CONFIGURE_MAXIMUM_POSIX_KEYS 0 -#endif - -/* - * This macro is calculated to specify the memory required for - * POSIX API key/value pairs. - */ -#ifndef CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS - #define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \ - (CONFIGURE_MAXIMUM_POSIX_KEYS * \ - (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS)) -#endif - -/* - * This macro is calculated to specify the total number of - * POSIX API keys required by the application and configured - * system capabilities. - */ -#define _CONFIGURE_POSIX_KEYS \ - (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS) - -/* - * This macro is calculated to specify the memory required for - * POSIX API keys. - */ -#define _CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \ - (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \ - + _Configure_From_workspace( \ - _Configure_Max_Objects(_key_value_pairs) \ - * sizeof(POSIX_Keys_Key_value_pair))) - -/* - * The rest of the POSIX threads API features are only available when - * POSIX is enabled. - */ -#ifdef RTEMS_POSIX_API - #include <sys/types.h> - #include <signal.h> - #include <limits.h> - #include <mqueue.h> - #include <rtems/posix/mqueue.h> - #include <rtems/posix/psignal.h> - #include <rtems/posix/pthread.h> - #include <rtems/posix/semaphore.h> - #include <rtems/posix/shm.h> - #include <rtems/posix/threadsup.h> - #include <rtems/posix/timer.h> - - /* - * Account for the object control structures plus the name - * of the object to be duplicated. - */ - #define _Configure_POSIX_Named_Object_RAM(_number, _size) \ - (_Configure_Object_RAM(_number, _size) \ - + _Configure_Max_Objects(_number) \ - * _Configure_From_workspace(_POSIX_PATH_MAX + 1)) - - /** - * This configuration parameter specifies the maximum number of - * POSIX API threads. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS - #define CONFIGURE_MAXIMUM_POSIX_THREADS 0 - #endif - - /** - * This configuration parameter specifies the maximum number of - * POSIX API timers. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS - #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0 - #endif - - /* - * This macro is calculated to specify the memory required for - * POSIX API timers. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \ - _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) ) - - /** - * This configuration parameter specifies the maximum number of - * POSIX API queued signals. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS - #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0 - #endif - - /* - * This macro is calculated to specify the memory required for - * POSIX API queued signals. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \ - _Configure_From_workspace( \ - (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) ) - - /** - * This configuration parameter specifies the maximum number of - * POSIX API message queues. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES - #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 0 - #endif - - /* - * This macro is calculated to specify the memory required for - * POSIX API message queues. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES(_message_queues) \ - _Configure_POSIX_Named_Object_RAM( \ - _message_queues, sizeof(POSIX_Message_queue_Control) ) - - /** - * This configuration parameter specifies the maximum number of - * POSIX API semaphores. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES - #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 0 - #endif - - /* - * This macro is calculated to specify the memory required for - * POSIX API semaphores. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES(_semaphores) \ - _Configure_POSIX_Named_Object_RAM( \ - _semaphores, sizeof(POSIX_Semaphore_Control) ) - - /** - * Configure the maximum number of POSIX shared memory objects. - */ - #if !defined(CONFIGURE_MAXIMUM_POSIX_SHMS) - #define CONFIGURE_MAXIMUM_POSIX_SHMS 0 - #else - #ifdef CONFIGURE_INIT - #if !defined(CONFIGURE_HAS_OWN_POSIX_SHM_OBJECT_OPERATIONS) - const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations = { - _POSIX_Shm_Object_create_from_workspace, - _POSIX_Shm_Object_resize_from_workspace, - _POSIX_Shm_Object_delete_from_workspace, - _POSIX_Shm_Object_read_from_workspace, - _POSIX_Shm_Object_mmap_from_workspace - }; - #endif - #endif - #endif - - /* - * This macro is calculated to specify the memory required for - * POSIX API shared memory. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \ - _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) ) - - - #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE - - #ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE - - /* - * The user is defining their own table information and setting the - * appropriate variables for the POSIX Initialization Thread Table. - */ - - #else - - #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT - #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init - #endif - - #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \ - CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE - #endif - - #ifdef CONFIGURE_INIT - posix_initialization_threads_table POSIX_Initialization_threads[] = { - { CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT, \ - CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE } - }; - #endif - - #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \ - POSIX_Initialization_threads - - #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \ - RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME) - - #endif /* CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */ - - #else /* CONFIGURE_POSIX_INIT_THREAD_TABLE */ - - #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL - #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0 - - #endif - -#else - - /** - * This configuration parameter specifies the maximum number of - * POSIX API threads. - */ - #define CONFIGURE_MAXIMUM_POSIX_THREADS 0 - -#endif /* RTEMS_POSIX_API */ - -/** - * This configuration parameter specifies the stack size of the - * POSIX API Initialization thread (if used). - */ -#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0 -#endif -/**@}*/ /* end of POSIX API Configuration */ - -/** - * @defgroup ConfigurationGNAT GNAT/RTEMS Configuration - * - * @addtogroup Configuration - * - * This modules includes configuration parameters for applications which - * use GNAT/RTEMS. GNAT implements each Ada task as a POSIX thread. - */ -/**@{*/ -#ifdef CONFIGURE_GNAT_RTEMS - /** - * This is the maximum number of Ada tasks which can be concurrently - * in existence. Twenty (20) are required to run all tests in the - * ACATS (formerly ACVC). - */ - #ifndef CONFIGURE_MAXIMUM_ADA_TASKS - #define CONFIGURE_MAXIMUM_ADA_TASKS 20 - #endif - - /** - * This is the number of non-Ada tasks which invoked Ada code. - */ - #ifndef CONFIGURE_MAXIMUM_FAKE_ADA_TASKS - #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 - #endif -#else - /** This defines he number of POSIX mutexes GNAT needs. */ - /** This defines he number of Ada tasks needed by the application. */ - #define CONFIGURE_MAXIMUM_ADA_TASKS 0 - /** - * This defines he number of non-Ada tasks/threads that will invoke - * Ada subprograms or functions. - */ - #define CONFIGURE_MAXIMUM_FAKE_ADA_TASKS 0 -#endif -/**@}*/ /* end of GNAT Configuration */ - -/** - * @defgroup ConfigurationGo GCC Go Configuration - * - * @addtogroup Configuration - * - * This modules includes configuration parameters for applications which - * use GCC Go. - */ -/**@{*/ -#ifdef CONFIGURE_ENABLE_GO - - #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS - #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 - #endif - - #ifndef CONFIGURE_MAXIMUM_GOROUTINES - #define CONFIGURE_MAXIMUM_GOROUTINES 400 - #endif - - #ifndef CONFIGURE_MAXIMUM_GO_CHANNELS - #define CONFIGURE_MAXIMUM_GO_CHANNELS 500 - #endif - -#else - /** This specifies the maximum number of Go co-routines. */ - #define CONFIGURE_MAXIMUM_GOROUTINES 0 - - /** This specifies the maximum number of Go channels required. */ - #define CONFIGURE_MAXIMUM_GO_CHANNELS 0 -#endif -/**@}*/ /* end of Go Configuration */ - -/** - * This is so we can account for tasks with stacks greater than minimum - * size. This is in bytes. - */ -#ifndef CONFIGURE_EXTRA_TASK_STACKS - #define CONFIGURE_EXTRA_TASK_STACKS 0 -#endif - -/** - * This macro provides a summation of the various POSIX thread requirements. - */ -#define _CONFIGURE_POSIX_THREADS \ - (CONFIGURE_MAXIMUM_POSIX_THREADS + \ - CONFIGURE_MAXIMUM_ADA_TASKS + \ - CONFIGURE_MAXIMUM_GOROUTINES) - -#ifdef RTEMS_POSIX_API - /* - * This macro is calculated to specify the memory required for - * the POSIX API in its entirety. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX \ - (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \ - CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \ - _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \ - CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \ - _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \ - CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \ - _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \ - CONFIGURE_MAXIMUM_POSIX_SHMS) + \ - _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS)) -#else - /* - * This macro is calculated to specify the memory required for - * the POSIX API in its entirety. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX 0 -#endif - -/* - * We must be able to split the free block used for the second last allocation - * into two parts so that we have a free block for the last allocation. See - * _Heap_Block_split(). - */ -#define _CONFIGURE_HEAP_HANDLER_OVERHEAD \ - _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT ) - -/* - * Calculate the RAM size based on the maximum number of objects configured. - */ -#ifndef CONFIGURE_EXECUTIVE_RAM_SIZE - -/* - * Account for allocating the following per object - * + array of object control structures - * + local pointer table -- pointer per object plus a zero'th - * entry in the local pointer table. - */ -#define _CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \ - ( \ - _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \ - + _Configure_From_workspace(_Configure_Max_Objects(_tasks) \ - * THREAD_QUEUE_HEADS_SIZE(CONFIGURE_SCHEDULER_COUNT)) \ - + _Configure_Max_Objects(_number_FP_tasks) \ - * _Configure_From_workspace(CONTEXT_FP_SIZE) \ - ) - -/* - * This defines the amount of memory configured for the multiprocessing - * support required by this application. - */ -#ifdef CONFIGURE_MP_APPLICATION - #define _CONFIGURE_MEMORY_FOR_MP \ - (_CONFIGURE_MEMORY_FOR_PROXIES(CONFIGURE_MP_MAXIMUM_PROXIES) + \ - _CONFIGURE_MEMORY_FOR_GLOBAL_OBJECTS(CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS)) -#else - #define _CONFIGURE_MEMORY_FOR_MP 0 -#endif - -/** - * The following macro is used to calculate the memory allocated by RTEMS - * for the message buffers associated with a particular message queue. - * There is a fixed amount of overhead per message. - */ -#define CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE(_messages, _size) \ - _Configure_From_workspace( \ - (_messages) * (_Configure_Align_up(_size, sizeof(uintptr_t)) \ - + sizeof(CORE_message_queue_Buffer_control))) - -/* - * This macro is set to the amount of memory required for pending message - * buffers in bytes. It should be constructed by adding together a - * set of values determined by CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE. - */ -#ifndef CONFIGURE_MESSAGE_BUFFER_MEMORY - #define CONFIGURE_MESSAGE_BUFFER_MEMORY 0 -#endif - -/** - * This macro is available just in case the confdefs.h file underallocates - * memory for a particular application. This lets the user add some extra - * memory in case something broken and underestimates. - * - * It is also possible for cases where confdefs.h overallocates memory, - * you could substract memory from the allocated. The estimate is just - * that, an estimate, and assumes worst case alignment and padding on - * each allocated element. So in some cases it could be too conservative. - * - * NOTE: Historically this was used for message buffers. - */ -#ifndef CONFIGURE_MEMORY_OVERHEAD - #define CONFIGURE_MEMORY_OVERHEAD 0 -#endif - -/** - * This calculates the amount of memory reserved for the IDLE tasks. - * In an SMP system, each CPU core has its own idle task. - */ -#define _CONFIGURE_IDLE_TASKS_COUNT CONFIGURE_MAXIMUM_PROCESSORS - -/** - * This defines the formula used to compute the amount of memory - * reserved for internal task control structures. - */ -#if CPU_IDLE_TASK_IS_FP == TRUE - #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \ - _CONFIGURE_MEMORY_FOR_TASKS( \ - _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \ - _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \ - ) -#else - #define _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS \ - _CONFIGURE_MEMORY_FOR_TASKS( \ - _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT, \ - _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT \ - ) -#endif - -/** - * This macro accounts for general RTEMS system overhead. - */ -#define _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \ - ( _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS + \ - _CONFIGURE_INTERRUPT_STACK_MEMORY \ - ) - -/** - * This macro reserves the memory required by the statically configured - * user extensions. - */ -#define _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \ - (_CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \ - _Configure_From_workspace( \ - _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \ - * sizeof(User_extensions_Switch_control) \ - )) - -/** - * This macro provides a summation of the memory required by the - * Classic API as configured. - */ -#define _CONFIGURE_MEMORY_FOR_CLASSIC \ - (_CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \ - _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \ - _CONFIGURE_MEMORY_FOR_SEMAPHORES(_CONFIGURE_SEMAPHORES) + \ - _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \ - _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \ - _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \ - _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \ - _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \ - _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS) + \ - _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \ - ) - -/* - * This macro provides a summation of the memory required by SMP as configured. - */ -#if defined(RTEMS_SMP) - #define _CONFIGURE_MEMORY_FOR_SMP \ - (CONFIGURE_MAXIMUM_PROCESSORS * \ - _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \ - ) -#else - #define _CONFIGURE_MEMORY_FOR_SMP 0 -#endif - -/** - * This calculates the memory required for the executive workspace. - * - * This is an internal parameter. - */ -#define CONFIGURE_EXECUTIVE_RAM_SIZE \ -( \ - _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD + \ - _CONFIGURE_MEMORY_FOR_TASKS( \ - _CONFIGURE_TASKS, _CONFIGURE_TASKS) + \ - _CONFIGURE_MEMORY_FOR_TASKS( \ - _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \ - _CONFIGURE_MEMORY_FOR_CLASSIC + \ - _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \ - _CONFIGURE_POSIX_KEYS, \ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \ - _CONFIGURE_MEMORY_FOR_POSIX + \ - _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \ - _CONFIGURE_MEMORY_FOR_MP + \ - _CONFIGURE_MEMORY_FOR_SMP + \ - CONFIGURE_MESSAGE_BUFFER_MEMORY + \ - (CONFIGURE_MEMORY_OVERHEAD * 1024) + \ - _CONFIGURE_HEAP_HANDLER_OVERHEAD \ -) - -/* - * Now account for any extra memory that initialization tasks or threads - * may have requested. - */ - -/* - * This accounts for any extra memory required by the Classic API - * Initialization Task. - */ -#if (CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE) - #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART \ - (CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE) -#else - #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART 0 -#endif - -/* - * This accounts for any extra memory required by the POSIX API - * Initialization Thread. - */ -#if defined(RTEMS_POSIX_API) && \ - (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE > \ - CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE) - #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART \ - (CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE - \ - CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE) -#else - #define _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART 0 -#endif - -/* - * This macro provides a summation of the various initialization task - * and thread stack requirements. - */ -#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS \ - (_CONFIGURE_INITIALIZATION_THREADS_STACKS_CLASSIC_PART + \ - _CONFIGURE_INITIALIZATION_THREADS_STACKS_POSIX_PART) - -/* - * This macro is calculated to specify the memory required for - * the Idle tasks(s) stack. - */ -#define _CONFIGURE_IDLE_TASKS_STACK \ - (_CONFIGURE_IDLE_TASKS_COUNT * \ - _Configure_From_stackspace( CONFIGURE_IDLE_TASK_STACK_SIZE ) ) - -/* - * This macro is calculated to specify the stack memory required for the MPCI - * task. - */ -#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK \ - (_CONFIGURE_MPCI_RECEIVE_SERVER_COUNT * \ - _Configure_From_stackspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE)) - -/* - * This macro is calculated to specify the memory required for - * the stacks of all tasks. - */ -#define _CONFIGURE_TASKS_STACK \ - (_Configure_Max_Objects( _CONFIGURE_TASKS ) * \ - _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) ) - -/* - * This macro is calculated to specify the memory required for - * the stacks of all POSIX threads. - */ -#define _CONFIGURE_POSIX_THREADS_STACK \ - (_Configure_Max_Objects( CONFIGURE_MAXIMUM_POSIX_THREADS ) * \ - _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) ) - -/* - * This macro is calculated to specify the memory required for - * the stacks of all Ada tasks. - */ -#define _CONFIGURE_ADA_TASKS_STACK \ - (_Configure_Max_Objects( CONFIGURE_MAXIMUM_ADA_TASKS ) * \ - _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) ) - -/* - * This macro is calculated to specify the memory required for - * the stacks of all Go routines. - */ -#define _CONFIGURE_GOROUTINES_STACK \ - (_Configure_Max_Objects( CONFIGURE_MAXIMUM_GOROUTINES ) * \ - _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) ) - -#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */ - -#define _CONFIGURE_IDLE_TASKS_STACK 0 -#define _CONFIGURE_MPCI_RECEIVE_SERVER_STACK 0 -#define _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS 0 -#define _CONFIGURE_TASKS_STACK 0 -#define _CONFIGURE_POSIX_THREADS_STACK 0 -#define _CONFIGURE_GOROUTINES_STACK 0 -#define _CONFIGURE_ADA_TASKS_STACK 0 - -#if CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK != 0 - #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK" -#endif - -#if CONFIGURE_EXTRA_TASK_STACKS != 0 - #error "CONFIGURE_EXECUTIVE_RAM_SIZE defined with request for CONFIGURE_EXTRA_TASK_STACKS" -#endif - -#endif /* CONFIGURE_EXECUTIVE_RAM_SIZE */ - -/* - * This macro is calculated to specify the memory required for - * all tasks and threads of all varieties. - */ -#define _CONFIGURE_STACK_SPACE_SIZE \ - ( \ - _CONFIGURE_IDLE_TASKS_STACK + \ - _CONFIGURE_MPCI_RECEIVE_SERVER_STACK + \ - _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS + \ - _CONFIGURE_TASKS_STACK + \ - _CONFIGURE_POSIX_THREADS_STACK + \ - _CONFIGURE_GOROUTINES_STACK + \ - _CONFIGURE_ADA_TASKS_STACK + \ - CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK + \ - _CONFIGURE_LIBBLOCK_TASK_EXTRA_STACKS + \ - CONFIGURE_EXTRA_TASK_STACKS + \ - _CONFIGURE_HEAP_HANDLER_OVERHEAD \ - ) - -#ifndef CONFIGURE_MAXIMUM_THREAD_NAME_SIZE - #define CONFIGURE_MAXIMUM_THREAD_NAME_SIZE 16 -#endif - -#ifdef CONFIGURE_INIT - typedef union { - Scheduler_Node Base; - #ifdef CONFIGURE_SCHEDULER_CBS - Scheduler_CBS_Node CBS; - #endif - #ifdef CONFIGURE_SCHEDULER_EDF - Scheduler_EDF_Node EDF; - #endif - #ifdef CONFIGURE_SCHEDULER_EDF_SMP - Scheduler_EDF_SMP_Node EDF_SMP; - #endif - #ifdef CONFIGURE_SCHEDULER_PRIORITY - Scheduler_priority_Node Priority; - #endif - #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP - Scheduler_SMP_Node Simple_SMP; - #endif - #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP - Scheduler_priority_SMP_Node Priority_SMP; - #endif - #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP; - #endif - #ifdef CONFIGURE_SCHEDULER_STRONG_APA - Scheduler_strong_APA_Node Strong_APA; - #endif - #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD - CONFIGURE_SCHEDULER_USER_PER_THREAD User; - #endif - } Configuration_Scheduler_node; - - #ifdef RTEMS_SMP - const size_t _Scheduler_Node_size = sizeof( Configuration_Scheduler_node ); - #endif - - const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE; - - typedef struct { - Thread_Control Control; - #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0 - void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ]; - #endif - Configuration_Scheduler_node Scheduler_nodes[ CONFIGURE_SCHEDULER_COUNT ]; - RTEMS_API_Control API_RTEMS; - #ifdef RTEMS_POSIX_API - POSIX_API_Control API_POSIX; - #endif - #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1 - char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ]; - #endif - #if !defined(RTEMS_SCHEDSIM) \ - && defined(RTEMS_NEWLIB) \ - && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY) - struct _reent Newlib; - #else - struct { /* Empty */ } Newlib; - #endif - } Configuration_Thread_control; - - const size_t _Thread_Control_size = sizeof( Configuration_Thread_control ); - - const Thread_Control_add_on _Thread_Control_add_ons[] = { - { - offsetof( Configuration_Thread_control, Control.Scheduler.nodes ), - offsetof( Configuration_Thread_control, Scheduler_nodes ) - }, { - offsetof( - Configuration_Thread_control, - Control.API_Extensions[ THREAD_API_RTEMS ] - ), - offsetof( Configuration_Thread_control, API_RTEMS ) - }, { - offsetof( - Configuration_Thread_control, - Control.libc_reent - ), - offsetof( Configuration_Thread_control, Newlib ) - } - #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1 - , { - offsetof( - Configuration_Thread_control, - Control.Join_queue.Queue.name - ), - offsetof( Configuration_Thread_control, name ) - } - #endif - #ifdef RTEMS_POSIX_API - , { - offsetof( - Configuration_Thread_control, - Control.API_Extensions[ THREAD_API_POSIX ] - ), - offsetof( Configuration_Thread_control, API_POSIX ) - } - #endif - }; - - const size_t _Thread_Control_add_on_count = - RTEMS_ARRAY_SIZE( _Thread_Control_add_ons ); - - const uint32_t _Watchdog_Nanoseconds_per_tick = - 1000 * CONFIGURE_MICROSECONDS_PER_TICK; - - const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND; - - const uint64_t _Watchdog_Monotonic_max_seconds = - UINT64_MAX / _CONFIGURE_TICKS_PER_SECOND; - - /** - * This is the Classic API Configuration Table. - */ - rtems_api_configuration_table Configuration_RTEMS_API = { - _CONFIGURE_TASKS, - CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER, - _CONFIGURE_SEMAPHORES, - CONFIGURE_MAXIMUM_MESSAGE_QUEUES, - CONFIGURE_MAXIMUM_PARTITIONS, - CONFIGURE_MAXIMUM_REGIONS, - CONFIGURE_MAXIMUM_PORTS, - CONFIGURE_MAXIMUM_PERIODS, - _CONFIGURE_BARRIERS, - CONFIGURE_INIT_TASK_TABLE_SIZE, - CONFIGURE_INIT_TASK_TABLE - }; - - #ifdef RTEMS_POSIX_API - /** - * This is the POSIX API Configuration Table. - */ - posix_api_configuration_table Configuration_POSIX_API = { - _CONFIGURE_POSIX_THREADS, - CONFIGURE_MAXIMUM_POSIX_TIMERS, - CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS, - CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES, - CONFIGURE_MAXIMUM_POSIX_SEMAPHORES, - CONFIGURE_MAXIMUM_POSIX_SHMS, - CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE, - CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME - }; - #endif - - /** - * This variable specifies the minimum stack size for tasks in an RTEMS - * application. - * - * NOTE: This is left as a simple uint32_t so it can be externed as - * needed without requring being high enough logical to - * include the full configuration table. - */ - uint32_t rtems_minimum_stack_size = - CONFIGURE_MINIMUM_TASK_STACK_SIZE; - - /** - * This is the primary Configuration Table for this application. - */ - const rtems_configuration_table Configuration = { - CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */ - _CONFIGURE_STACK_SPACE_SIZE, /* required stack space */ - CONFIGURE_MAXIMUM_USER_EXTENSIONS, /* maximum dynamic extensions */ - _CONFIGURE_POSIX_KEYS, /* POSIX keys are always */ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS, /* enabled */ - CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ - CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */ - CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */ - CONFIGURE_IDLE_TASK_STACK_SIZE, /* IDLE task stack size */ - CONFIGURE_INTERRUPT_STACK_SIZE, /* interrupt stack size */ - CONFIGURE_TASK_STACK_ALLOCATOR_INIT, /* stack allocator init */ - CONFIGURE_TASK_STACK_ALLOCATOR, /* stack allocator */ - CONFIGURE_TASK_STACK_DEALLOCATOR, /* stack deallocator */ - CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY, /* true to clear memory */ - #ifdef CONFIGURE_UNIFIED_WORK_AREAS /* true for unified work areas */ - true, - #else - false, - #endif - #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE /* true to avoid - work space for thread stack - allocation */ - true, - #else - false, - #endif - #ifdef RTEMS_SMP - #ifdef _CONFIGURE_SMP_APPLICATION - true, - #else - false, - #endif - #endif - _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS, /* number of static extensions */ - CONFIGURE_INITIAL_EXTENSION_TABLE, /* pointer to static extensions */ - #if defined(RTEMS_MULTIPROCESSING) - CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ - #endif - #ifdef RTEMS_SMP - CONFIGURE_MAXIMUM_PROCESSORS, - #endif - }; -#endif - -#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */ - -#if defined(RTEMS_SMP) - /* - * Instantiate the Per CPU information based upon the user configuration. - */ - #if defined(CONFIGURE_INIT) - Per_CPU_Control_envelope _Per_CPU_Information[CONFIGURE_MAXIMUM_PROCESSORS]; - #endif - -#endif - -/* - * If the user has configured a set of Classic API Initialization Tasks, - * then we need to install the code that runs that loop. - */ -#ifdef CONFIGURE_INIT - #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \ - defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE) - RTEMS_SYSINIT_ITEM( - _RTEMS_tasks_Initialize_user_tasks_body, - RTEMS_SYSINIT_CLASSIC_USER_TASKS, - RTEMS_SYSINIT_ORDER_MIDDLE - ); - #endif -#endif - -/* - * If the user has configured a set of POSIX Initialization Threads, - * then we need to install the code that runs that loop. - */ -#ifdef RTEMS_POSIX_API - #ifdef CONFIGURE_INIT - #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \ - defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE) - RTEMS_SYSINIT_ITEM( - _POSIX_Threads_Initialize_user_threads_body, - RTEMS_SYSINIT_POSIX_USER_THREADS, - RTEMS_SYSINIT_ORDER_MIDDLE - ); - #endif - #endif -#endif - -/* - * Select PCI Configuration Library - */ -#ifdef RTEMS_PCI_CONFIG_LIB - #ifdef CONFIGURE_INIT - #define PCI_LIB_NONE 0 - #define PCI_LIB_AUTO 1 - #define PCI_LIB_STATIC 2 - #define PCI_LIB_READ 3 - #define PCI_LIB_PERIPHERAL 4 - #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO - #define PCI_CFG_AUTO_LIB - #include <pci/cfg.h> - struct pci_bus pci_hb; - #define PCI_LIB_INIT pci_config_auto - #define PCI_LIB_CONFIG pci_config_auto_register - #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC - #define PCI_CFG_STATIC_LIB - #include <pci/cfg.h> - #define PCI_LIB_INIT pci_config_static - #define PCI_LIB_CONFIG NULL - /* Let user define PCI configuration (struct pci_bus pci_hb) */ - #elif CONFIGURE_PCI_LIB == PCI_LIB_READ - #define PCI_CFG_READ_LIB - #include <pci/cfg.h> - #define PCI_LIB_INIT pci_config_read - #define PCI_LIB_CONFIG NULL - struct pci_bus pci_hb; - #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL - #define PCI_LIB_INIT pci_config_peripheral - #define PCI_LIB_CONFIG NULL - /* Let user define PCI configuration (struct pci_bus pci_hb) */ - #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE - #define PCI_LIB_INIT NULL - #define PCI_LIB_CONFIG NULL - /* No PCI Configuration at all, user can use/debug access routines */ - #else - #error NO PCI LIBRARY DEFINED - #endif - - const int pci_config_lib_type = CONFIGURE_PCI_LIB; - int (*pci_config_lib_init)(void) = PCI_LIB_INIT; - void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG; - #endif -#endif - -#ifdef __cplusplus -} -#endif - -/****************************************************************** - ****************************************************************** - ****************************************************************** - * CONFIGURATION WARNINGS AND ERROR CHECKING * - ****************************************************************** - ****************************************************************** - ****************************************************************** - */ - -#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT) - /** - * This is a debug mechanism, so if you need to, the executable will - * have a structure with various partial values. Add to this as you - * need to. Viewing this structure in gdb combined with dumping - * the Configuration structures generated should help a lot in tracing - * down errors and analyzing where over and under allocations are. - */ - typedef struct { - uint32_t SYSTEM_OVERHEAD; - uint32_t STATIC_EXTENSIONS; - uint32_t INITIALIZATION_THREADS_STACKS; - - uint32_t PER_INTEGER_TASK; - uint32_t FP_OVERHEAD; - uint32_t CLASSIC; - uint32_t POSIX; - - /* System overhead pieces */ - uint32_t INTERRUPT_STACK_MEMORY; - uint32_t MEMORY_FOR_IDLE_TASK; - - /* Classic API Pieces */ - uint32_t CLASSIC_TASKS; - uint32_t TIMERS; - uint32_t SEMAPHORES; - uint32_t MESSAGE_QUEUES; - uint32_t PARTITIONS; - uint32_t REGIONS; - uint32_t PORTS; - uint32_t PERIODS; - uint32_t BARRIERS; - uint32_t USER_EXTENSIONS; - - /* POSIX API managers that are always enabled */ - uint32_t POSIX_KEYS; - -#ifdef RTEMS_POSIX_API - /* POSIX API Pieces */ - uint32_t POSIX_TIMERS; - uint32_t POSIX_QUEUED_SIGNALS; - uint32_t POSIX_MESSAGE_QUEUES; - uint32_t POSIX_SEMAPHORES; - uint32_t POSIX_SHMS; -#endif - - /* Stack space sizes */ - uint32_t IDLE_TASKS_STACK; - uint32_t INITIALIZATION_THREADS_EXTRA_STACKS; - uint32_t TASKS_STACK; - uint32_t POSIX_THREADS_STACK; - uint32_t GOROUTINES_STACK; - uint32_t ADA_TASKS_STACK; - uint32_t EXTRA_MPCI_RECEIVE_SERVER_STACK; - uint32_t EXTRA_TASK_STACKS; - } Configuration_Debug_t; - - Configuration_Debug_t Configuration_Memory_Debug = { - /* General Information */ - _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD, - _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS, - _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS, - _CONFIGURE_MEMORY_FOR_TASKS(1, 0), - _CONFIGURE_MEMORY_FOR_TASKS(0, 1), - _CONFIGURE_MEMORY_FOR_CLASSIC, - _CONFIGURE_MEMORY_FOR_POSIX, - - /* System overhead pieces */ - _CONFIGURE_INTERRUPT_STACK_MEMORY, - _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS, - - /* Classic API Pieces */ - _CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0), - _CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS), - _CONFIGURE_MEMORY_FOR_SEMAPHORES(_CONFIGURE_SEMAPHORES), - _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES), - _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS), - _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ), - _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS), - _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS), - _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS), - _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS), - _CONFIGURE_MEMORY_FOR_POSIX_KEYS( _CONFIGURE_POSIX_KEYS, \ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ), - -#ifdef RTEMS_POSIX_API - /* POSIX API Pieces */ - _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( - CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ), - _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( - CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ), - _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ), - _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ), - _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ), -#endif - - /* Stack space sizes */ - _CONFIGURE_IDLE_TASKS_STACK, - _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS, - _CONFIGURE_TASKS_STACK, - _CONFIGURE_POSIX_THREADS_STACK, - _CONFIGURE_GOROUTINES_STACK, - _CONFIGURE_ADA_TASKS_STACK, - CONFIGURE_EXTRA_MPCI_RECEIVE_SERVER_STACK, - CONFIGURE_EXTRA_TASK_STACKS - }; -#endif - -/* - * Make sure a task/thread of some sort is configured. - * - * When analyzing RTEMS to find the smallest possible of memory - * that must be allocated, you probably do want to configure 0 - * tasks/threads so there is a smaller set of calls to _Workspace_Allocate - * to analyze. - */ -#if !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) - #if (CONFIGURE_MAXIMUM_TASKS == 0) && \ - (CONFIGURE_MAXIMUM_POSIX_THREADS == 0) && \ - (CONFIGURE_MAXIMUM_ADA_TASKS == 0) && \ - (CONFIGURE_MAXIMUM_GOROUTINES == 0) - #error "CONFIGURATION ERROR: No tasks or threads configured!!" - #endif -#endif - -#ifndef RTEMS_SCHEDSIM -/* - * Make sure at least one of the initialization task/thread - * tables was defined. - */ -#if !defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \ - !defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) && \ - !defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) -#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!" -#endif -#endif - -/* - * If the user is trying to configure a multiprocessing application and - * RTEMS was not configured and built multiprocessing, then error out. - */ -#if defined(CONFIGURE_MP_APPLICATION) && \ - !defined(RTEMS_MULTIPROCESSING) -#error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!" -#endif - -/* - * If an attempt was made to configure POSIX objects and - * the POSIX API was not configured into RTEMS, error out. - * - * @note POSIX Keys are always available so the parameters - * CONFIGURE_MAXIMUM_POSIX_KEYS and - * CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS are not in this list. - */ -#if !defined(RTEMS_POSIX_API) - #if ((CONFIGURE_MAXIMUM_POSIX_THREADS != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_SEMAPHORES != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_SHMS != 0) || \ - defined(CONFIGURE_POSIX_INIT_THREAD_TABLE)) - #error "CONFIGURATION ERROR: POSIX API support not configured!!" - #endif -#endif - -#if !defined(RTEMS_SCHEDSIM) - #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) - /* - * You must either explicity include or exclude the clock driver. - * It is such a common newbie error to leave it out. Maybe this - * will put an end to it. - * - * NOTE: If you are using the timer driver, it is considered - * mutually exclusive with the clock driver because the - * drivers are assumed to use the same "timer" hardware - * on many boards. - */ - #if !defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER) && \ - !defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) - #error "CONFIGURATION ERROR: Do you want the clock driver or not?!?" - #endif - - /* - * Only one of the following three configuration parameters should be - * defined at a time. - */ - #if ((defined(CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER) + \ - defined(CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER) + \ - defined(CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER)) > 1) - #error "CONFIGURATION ERROR: More than one clock/timer driver configuration parameter specified?!?" - #endif - #endif /* !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) */ -#endif /* !defined(RTEMS_SCHEDSIM) */ - -/* - * These names have been obsoleted so make the user application stop compiling - */ -#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \ - defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \ - defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \ - defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \ - defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER) -#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete" -#endif - -/* - * Validate the configured maximum priority - */ -#if ((CONFIGURE_MAXIMUM_PRIORITY != 3) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 7) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 15) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 31) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 63) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 127) && \ - (CONFIGURE_MAXIMUM_PRIORITY != 255)) - #error "Maximum priority is not 1 less than a power of 2 between 4 and 256" -#endif - -#if (CONFIGURE_MAXIMUM_PRIORITY > PRIORITY_DEFAULT_MAXIMUM) - #error "Maximum priority configured higher than supported by target." -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS - #warning "The CONFIGURE_MAXIMUM_POSIX_BARRIERS configuration option is obsolete since RTEMS 5.1" -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES - #warning "The CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES configuration option is obsolete since RTEMS 5.1" -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS - #warning "The CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS configuration option is obsolete since RTEMS 5.1" -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES - #warning "The CONFIGURE_MAXIMUM_POSIX_MUTEXES configuration option is obsolete since RTEMS 5.1" -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS - #warning "The CONFIGURE_MAXIMUM_POSIX_RWLOCKS configuration option is obsolete since RTEMS 5.1" -#endif - -#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS - #warning "The CONFIGURE_MAXIMUM_POSIX_SPINLOCKS configuration option is obsolete since RTEMS 5.1" -#endif - -/* - * POSIX Key pair shouldn't be less than POSIX Key, which is highly - * likely to be error. - */ -#if (CONFIGURE_MAXIMUM_POSIX_KEYS != 0) && \ - (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS != 0) - #if (CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS < CONFIGURE_MAXIMUM_POSIX_KEYS) - #error "Fewer POSIX Key pairs than POSIX Key!" - #endif -#endif - -/* - * IMFS block size for in memory files (memfiles) must be a power of - * two between 16 and 512 inclusive. - */ -#if ((CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 16) && \ - (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 32) && \ - (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 64) && \ - (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 128) && \ - (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 256) && \ - (CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK != 512)) - #error "IMFS Memfile block size must be a power of 2 between 16 and 512" -#endif - - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/bsd.h b/cpukit/sapi/include/rtems/bsd.h deleted file mode 100644 index 0c44e3787d..0000000000 --- a/cpukit/sapi/include/rtems/bsd.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @file - * - * @ingroup BSD - * - * @brief BSD Compatibility API - */ - -/* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_BSD_H -#define _RTEMS_BSD_H - -#include <rtems/score/timecounter.h> -#include <rtems/score/basedefs.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup BSD BSD Compatibility Support - * - * @{ - */ - -/** - * @copydoc _Timecounter_Bintime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_bintime( struct bintime *bt ) -{ - _Timecounter_Bintime( bt ); -} - -/** - * @copydoc _Timecounter_Nanotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_nanotime( struct timespec *ts ) -{ - _Timecounter_Nanotime( ts ); -} - -/** - * @copydoc _Timecounter_Microtime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_microtime( struct timeval *tv ) -{ - _Timecounter_Microtime( tv ); -} - -/** - * @copydoc _Timecounter_Binuptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_binuptime( struct bintime *bt ) -{ - _Timecounter_Binuptime( bt ); -} - -/** - * @copydoc _Timecounter_Nanouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_nanouptime( struct timespec *ts ) -{ - _Timecounter_Nanouptime( ts ); -} - -/** - * @copydoc _Timecounter_Microtime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_microuptime( struct timeval *tv ) -{ - _Timecounter_Microuptime( tv ); -} - -/** - * @copydoc _Timecounter_Getbintime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getbintime( struct bintime *bt ) -{ - _Timecounter_Getbintime( bt ); -} - -/** - * @copydoc _Timecounter_Getnanotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getnanotime( struct timespec *ts ) -{ - _Timecounter_Getnanotime( ts ); -} - -/** - * @copydoc _Timecounter_Getmicrotime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getmicrotime( struct timeval *tv ) -{ - _Timecounter_Getmicrotime( tv ); -} - -/** - * @copydoc _Timecounter_Getbinuptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getbinuptime( struct bintime *bt ) -{ - _Timecounter_Getbinuptime( bt ); -} - -/** - * @copydoc _Timecounter_Getnanouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getnanouptime( struct timespec *ts ) -{ - _Timecounter_Getnanouptime( ts ); -} - -/** - * @copydoc _Timecounter_Getmicrouptime() - */ -RTEMS_INLINE_ROUTINE void rtems_bsd_getmicrouptime( struct timeval *tv ) -{ - _Timecounter_Getmicrouptime( tv ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_BSD_H */ diff --git a/cpukit/sapi/include/rtems/cbs.h b/cpukit/sapi/include/rtems/cbs.h deleted file mode 100644 index a42061ddc0..0000000000 --- a/cpukit/sapi/include/rtems/cbs.h +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated - * with the CBS library in RTEMS - * - * This include file contains all the constants and structures associated - * with the CBS library in RTEMS. - */ - -/* - * Copyright (C) 2011 Petr Benes. - * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef CONFIGURE_SCHEDULER_CBS - #error "cbs.h available only with CONFIGURE_SCHEDULER_CBS" -#endif - -#ifndef _RTEMS_CBS_H -#define _RTEMS_CBS_H - -#include <rtems/score/schedulercbs.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Return codes. */ -#define RTEMS_CBS_OK SCHEDULER_CBS_OK -#define RTEMS_CBS_ERROR_GENERIC SCHEDULER_CBS_ERROR_GENERIC -#define RTEMS_CBS_ERROR_NO_MEMORY SCHEDULER_CBS_ERROR_NO_MEMORY -#define RTEMS_CBS_ERROR_INVALID_PARAMETER SCHEDULER_CBS_ERROR_INVALID_PARAM -#define RTEMS_CBS_ERROR_UNAUTHORIZED SCHEDULER_CBS_ERROR_UNAUTHORIZED -#define RTEMS_CBS_ERROR_UNIMPLEMENTED SCHEDULER_CBS_ERROR_UNIMPLEMENTED -#define RTEMS_CBS_ERROR_MISSING_COMPONENT SCHEDULER_CBS_ERROR_MISSING_COMPONENT -#define RTEMS_CBS_ERROR_INCONSISTENT_STATE SCHEDULER_CBS_ERROR_INCONSISTENT_STATE -#define RTEMS_CBS_ERROR_SYSTEM_OVERLOAD SCHEDULER_CBS_ERROR_SYSTEM_OVERLOAD -#define RTEMS_CBS_ERROR_INTERNAL_ERROR SCHEDULER_CBS_ERROR_INTERNAL_ERROR -#define RTEMS_CBS_ERROR_NOT_FOUND SCHEDULER_CBS_ERROR_NOT_FOUND -#define RTEMS_CBS_ERROR_FULL SCHEDULER_CBS_ERROR_FULL -#define RTEMS_CBS_ERROR_EMPTY SCHEDULER_CBS_ERROR_EMPTY -#define RTEMS_CBS_ERROR_NOSERVER SCHEDULER_CBS_ERROR_NOSERVER - -/** Callback function invoked when a budget overrun of a task occurs. */ -typedef Scheduler_CBS_Budget_overrun rtems_cbs_budget_overrun; - -/** Server id. */ -typedef Scheduler_CBS_Server_id rtems_cbs_server_id; - -/** Server parameters. */ -typedef Scheduler_CBS_Parameters rtems_cbs_parameters; - -/** - * @brief Initialize the CBS library. - * - * Initializes the CBS library. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_initialize ( void ) -{ - return _Scheduler_CBS_Initialize(); -} - -/** - * @brief Cleanup resources associated to the CBS Library - * - * Cleanup resources associated to the CBS Library. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_cleanup ( void ) -{ - return _Scheduler_CBS_Cleanup(); -} - -/** - * @brief Create a new server with specified parameters. - * - * Create a new server with specified parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_create_server ( - rtems_cbs_parameters *params, - rtems_cbs_budget_overrun budget_overrun_callback, - rtems_cbs_server_id *server_id -) -{ - return _Scheduler_CBS_Create_server( - params, - budget_overrun_callback, - server_id - ); -} - -/** - * @brief Attach a task to an already existing server. - * - * Attach a task to an already existing server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_attach_thread ( - rtems_cbs_server_id server_id, - rtems_id task_id -) -{ - return _Scheduler_CBS_Attach_thread( server_id, task_id ); -} - -/** - * @brief Detach from the CBS server. - * - * Detach from the CBS Server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_detach_thread ( - rtems_cbs_server_id server_id, - rtems_id task_id -) -{ - return _Scheduler_CBS_Detach_thread( server_id, task_id ); -} - -/** - * @brief Detach all tasks from a server and destroy it. - * - * Detach all tasks from a server and destroy it. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_destroy_server ( - rtems_cbs_server_id server_id -) -{ - return _Scheduler_CBS_Destroy_server( server_id ); -} - -/** - * @brief Get CBS server id. - * - * Get a thread server id, or RTEMS_CBS_E_NOT_FOUND if it is not - * attached to any server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_server_id ( - rtems_id task_id, - rtems_cbs_server_id *server_id -) -{ - return _Scheduler_CBS_Get_server_id( task_id, server_id ); -} - -/** - * @brief Get CBS parameters. - * - * Retrieve CBS scheduling parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_parameters ( - rtems_cbs_server_id server_id, - rtems_cbs_parameters *params -) -{ - return _Scheduler_CBS_Get_parameters( server_id, params ); -} - -/** - * @brief Set CBS parameters. - * - * Change CBS scheduling parameters. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_set_parameters ( - rtems_cbs_server_id server_id, - rtems_cbs_parameters *params -) -{ - return _Scheduler_CBS_Set_parameters( server_id, params ); -} - -/** - * @brief Get the CBS get execution time. - * - * Retrieve time info relative to the current server. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_execution_time ( - rtems_cbs_server_id server_id, - time_t *exec_time, - time_t *abs_time -) -{ - return _Scheduler_CBS_Get_execution_time( server_id, exec_time, abs_time ); -} - -/** - * @brief Get the remaining CBS budget. - * - * Retrieve remaining budget for the current server instance. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_remaining_budget ( - rtems_cbs_server_id server_id, - time_t *remaining_budget -) -{ - return _Scheduler_CBS_Get_remaining_budget( server_id, remaining_budget ); -} - -/** - * @brief Get the approved CBS budget. - * - * Retrieve the budget that has been approved for the subsequent - * server instances. - * - * @return status code. - */ -RTEMS_INLINE_ROUTINE int rtems_cbs_get_approved_budget ( - rtems_cbs_server_id server_id, - time_t *appr_budget -) -{ - return _Scheduler_CBS_Get_approved_budget( server_id, appr_budget ); -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h deleted file mode 100644 index f0e7ee4f40..0000000000 --- a/cpukit/sapi/include/rtems/chain.h +++ /dev/null @@ -1,789 +0,0 @@ -/** - * @file - * - * @brief Chain API - */ - -/* - * Copyright (c) 2010-2014 embedded brains GmbH. - * - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_CHAIN_H -#define _RTEMS_CHAIN_H - -#include <rtems/score/chainimpl.h> -#include <rtems/rtems/event.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicChains Chains - * - * @ingroup ClassicRTEMS - * - * @brief Chain API - */ -/**@{**/ - -typedef Chain_Node rtems_chain_node; - -typedef Chain_Control rtems_chain_control; - -/** - * @brief Chain initializer for an empty chain with designator @a name. - */ -#define RTEMS_CHAIN_INITIALIZER_EMPTY( name ) \ - CHAIN_INITIALIZER_EMPTY( name ) - -/** - * @brief Chain initializer for a chain with one @a node. - * - * @see RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN(). - */ -#define RTEMS_CHAIN_INITIALIZER_ONE_NODE( node ) \ - CHAIN_INITIALIZER_ONE_NODE( node ) - -/** - * @brief Chain node initializer for a @a chain containing exactly this node. - * - * @see RTEMS_CHAIN_INITIALIZER_ONE_NODE(). - */ -#define RTEMS_CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) \ - CHAIN_NODE_INITIALIZER_ONE_NODE_CHAIN( chain ) - -/** - * @brief Chain definition for an empty chain with designator @a name. - */ -#define RTEMS_CHAIN_DEFINE_EMPTY( name ) \ - rtems_chain_control name = RTEMS_CHAIN_INITIALIZER_EMPTY( name ) - -/** - * @brief Appends the @a node to the @a chain and sends the @a events to the - * @a task if the @a chain was empty before the append. - * - * @see rtems_chain_append_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_append_with_notification( - rtems_chain_control *chain, - rtems_chain_node *node, - rtems_id task, - rtems_event_set events -); - -/** - * @brief Prepends the @a node to the @a chain and sends the @a events to the - * @a task if the @a chain was empty before the prepend. - * - * @see rtems_chain_prepend_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_prepend_with_notification( - rtems_chain_control *chain, - rtems_chain_node *node, - rtems_id task, - rtems_event_set events -); - -/** - * @brief Gets the first @a node of the @a chain and sends the @a events to the - * @a task if the @a chain is empty after the get. - * - * @see rtems_chain_get_with_empty_check() and rtems_event_send(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID No such task. - */ -rtems_status_code rtems_chain_get_with_notification( - rtems_chain_control *chain, - rtems_id task, - rtems_event_set events, - rtems_chain_node **node -); - -/** - * @brief Gets the first @a node of the @a chain and sends the @a events to the - * @a task if the @a chain is empty afterwards. - * - * @see rtems_chain_get() and rtems_event_receive(). - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_TIMEOUT Timeout. - */ -rtems_status_code rtems_chain_get_with_wait( - rtems_chain_control *chain, - rtems_event_set events, - rtems_interval timeout, - rtems_chain_node **node -); - -/** - * @brief Initialize a chain Header. - * - * This routine initializes @a the_chain structure to manage the - * contiguous array of @a number_nodes nodes which starts at - * @a starting_address. Each node is of @a node_size bytes. - * - * @param[in] the_chain specifies the chain to initialize - * @param[in] starting_address is the starting address of the array - * of elements - * @param[in] number_nodes is the number of nodes that will be in the chain - * @param[in] node_size is the size of each node - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize( - rtems_chain_control *the_chain, - void *starting_address, - size_t number_nodes, - size_t node_size -) -{ - _Chain_Initialize( - the_chain, - starting_address, - number_nodes, - node_size - ); -} - -/** - * @brief Initialize this chain as empty. - * - * This routine initializes the specified chain to contain zero nodes. - * - * @param[in] the_chain is the chain to be initialized. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_empty( - rtems_chain_control *the_chain -) -{ - _Chain_Initialize_empty( the_chain ); -} - -/** - * @brief Set off chain. - * - * This function sets the next and previous fields of the @a node to NULL - * indicating the @a node is not part of a chain. - * - * @param[in] node the node set to off chain. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain( - rtems_chain_node *node -) -{ - _Chain_Set_off_chain( node ); -} - -/** - * @brief Initializes a chain node. - * - * In debug configurations, the node is set off chain. In all other - * configurations, this function does nothing. - * - * @param[in] the_node The chain node to initialize. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node( - rtems_chain_node *node -) -{ - _Chain_Initialize_node( node ); -} - -/** - * @brief Is the node off chain. - * - * This function returns true if the @a node is not on a chain. A @a node is - * off chain if the next and previous fields are set to NULL. - * - * @param[in] node is the node off chain. - * - * @retval true The node is off chain. - * @retval false The node is not off chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_node_off_chain( - const rtems_chain_node *node -) -{ - return _Chain_Is_node_off_chain( node ); -} - -/** - * @brief Is the chain node pointer NULL. - * - * This function returns true if the_node is NULL and false otherwise. - * - * @param[in] the_node is the node pointer to check. - * - * @retval true The chain node pointer is NULL. - * @retval false The chain node pointer is not NULL. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_null_node( the_node ); -} - -/** - * @brief Return pointer to Chain Head - * - * This function returns a pointer to the first node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head( - rtems_chain_control *the_chain -) -{ - return _Chain_Head( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain Head - * - * This function returns a pointer to the head node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent head node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_head( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_head( the_chain ); -} - -/** - * @brief Return pointer to Chain Tail - * - * This function returns a pointer to the tail node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent tail node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail( - rtems_chain_control *the_chain -) -{ - return _Chain_Tail( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain Tail - * - * This function returns a pointer to the tail node on the chain. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the permanent tail node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_tail( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_tail( the_chain ); -} - -/** - * @brief Return pointer to Chain's First node after the permanent head. - * - * This function returns a pointer to the first node on the chain after the - * head. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the first node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first( - const rtems_chain_control *the_chain -) -{ - return _Chain_First( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain's First node - * - * This function returns a pointer to the first node on the chain after the - * head. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the first node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_first( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_first( the_chain ); -} - -/** - * @brief Return pointer to Chain's Last node before the permanent tail. - * - * This function returns a pointer to the last node on the chain just before - * the tail. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the last node of the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last( - const rtems_chain_control *the_chain -) -{ - return _Chain_Last( the_chain ); -} - -/** - * @brief Return pointer to immutable Chain's Last node - * - * This function returns a pointer to the last node on the chain just before - * the tail. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @return This method returns the last node of the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_last( - const rtems_chain_control *the_chain -) -{ - return _Chain_Immutable_last( the_chain ); -} - -/** - * @brief Return pointer the next node from this node - * - * This function returns a pointer to the next node after this node. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the next node on the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next( - const rtems_chain_node *the_node -) -{ - return _Chain_Next( the_node ); -} - -/** - * @brief Return pointer the immutable next node from this node - * - * This function returns a pointer to the next node after this node. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the next node on the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_next( - const rtems_chain_node *the_node -) -{ - return _Chain_Immutable_next( the_node ); -} - -/** - * @brief Return pointer the previous node from this node - * - * This function returns a pointer to the previous node on this chain. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the previous node on the chain. - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_previous( - const rtems_chain_node *the_node -) -{ - return _Chain_Previous( the_node ); -} - -/** - * @brief Return pointer the immutable previous node from this node. - * - * This function returns a pointer to the previous node on this chain. - * - * @param[in] the_node is the node to be operated upon. - * - * @return This method returns the previous node on the chain. - */ -RTEMS_INLINE_ROUTINE const rtems_chain_node *rtems_chain_immutable_previous( - const rtems_chain_node *the_node -) -{ - return _Chain_Immutable_previous( the_node ); -} - -/** - * @brief Are Two nodes equal. - * - * This function returns true if @a left and @a right are equal, - * and false otherwise. - * - * @param[in] left is the node on the left hand side of the comparison. - * @param[in] right is the node on the left hand side of the comparison. - * - * @retval true @a left is equal to @a right. - * @retval false @a left is not equal to @a right - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_are_nodes_equal( - const rtems_chain_node *left, - const rtems_chain_node *right -) -{ - return _Chain_Are_nodes_equal( left, right ); -} - -/** - * @brief Is the chain empty - * - * This function returns true if there a no nodes on @a the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @retval true The chain is empty. - * @retval false The chain is not empty. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_empty( - const rtems_chain_control *the_chain -) -{ - return _Chain_Is_empty( the_chain ); -} - -/** - * @brief Is this the first node on the chain. - * - * This function returns true if the_node is the first node on a chain and - * false otherwise. - * - * @param[in] the_node is the node the caller wants to know if it is - * the first node on a chain. - * - * @retval true @a the_node is the first node on a chain. - * @retval false @a the_node is not the first node on a chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_first( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_first( the_node ); -} - -/** - * @brief Is this the last node on the chain. - * - * This function returns true if @a the_node is the last node on a chain and - * false otherwise. - * - * @param[in] the_node is the node to check as the last node. - * - * @retval true @a the_node is the last node on a chain. - * @retval false @a the_node is not the last node on a chain - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_last( - const rtems_chain_node *the_node -) -{ - return _Chain_Is_last( the_node ); -} - -/** - * @brief Does this chain have only one node. - * - * This function returns true if there is only one node on @a the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * - * @retval true The chain has only one node. - * @retval false The chain has more than one nodes. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_has_only_one_node( - const rtems_chain_control *the_chain -) -{ - return _Chain_Has_only_one_node( the_chain ); -} - -/** - * @brief Is this node the chain head. - * - * This function returns true if @a the_node is the head of the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to check for being the Chain Head. - * - * @retval true @a the_node is the head of @a the_chain. - * @retval false @a the_node is not the head of @a the_chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_head( - const rtems_chain_control *the_chain, - const rtems_chain_node *the_node -) -{ - return _Chain_Is_head( the_chain, the_node ); -} - -/** - * @brief Is this node the chain tail. - * - * This function returns true if the_node is the tail of the_chain and - * false otherwise. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to check for being the Chain Tail. - * - * @retval true @a the_node is the tail of @a the_chain. - * @retval false @a the_node is not the tail of @a the_chain. - */ -RTEMS_INLINE_ROUTINE bool rtems_chain_is_tail( - const rtems_chain_control *the_chain, - const rtems_chain_node *the_node -) -{ - return _Chain_Is_tail( the_chain, the_node ); -} - -/** - * @brief Extract the specified node from a chain. - * - * This routine extracts @a the_node from the chain on which it resides. - * It disables interrupts to ensure the atomicity of the - * extract operation. - * - * @arg the_node specifies the node to extract - */ -void rtems_chain_extract( - rtems_chain_node *the_node -); - -/** - * @brief Extract the specified node from a chain (unprotected). - * - * This routine extracts @a the_node from the chain on which it resides. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * append operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_extract_unprotected( - rtems_chain_node *the_node -) -{ - _Chain_Extract_unprotected( the_node ); -} - -/** - * @brief Obtain the first node on a chain. - * - * This function removes the first node from @a the_chain and returns - * a pointer to that node. If @a the_chain is empty, then NULL is returned. - * - * @return This method returns a pointer a node. If a node was removed, - * then a pointer to that node is returned. If @a the_chain was - * empty, then NULL is returned. - * - * NOTE: It disables interrupts to ensure the atomicity of the get operation. - */ -rtems_chain_node *rtems_chain_get( - rtems_chain_control *the_chain -); - -/** - * @brief See _Chain_Get_unprotected(). - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_unprotected( - rtems_chain_control *the_chain -) -{ - return _Chain_Get_unprotected( the_chain ); -} - -/** - * @brief See _Chain_Get_first_unprotected(). - */ -RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_get_first_unprotected( - rtems_chain_control *the_chain -) -{ - return _Chain_Get_first_unprotected( the_chain ); -} - -/** - * @brief Insert a node on a chain - * - * This routine inserts @a the_node on a chain immediately following - * @a after_node. - * - * NOTE: It disables interrupts to ensure the atomicity - * of the extract operation. - */ -void rtems_chain_insert( - rtems_chain_node *after_node, - rtems_chain_node *the_node -); - -/** - * @brief See _Chain_Insert_unprotected(). - */ -RTEMS_INLINE_ROUTINE void rtems_chain_insert_unprotected( - rtems_chain_node *after_node, - rtems_chain_node *the_node -) -{ - _Chain_Insert_unprotected( after_node, the_node ); -} - -/** - * @brief Append a node on the end of a chain. - * - * This routine appends @a the_node onto the end of @a the_chain. - * - * NOTE: It disables interrupts to ensure the atomicity of the - * append operation. - */ -void rtems_chain_append( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -); - -/** - * @brief Append a node on the end of a chain (unprotected). - * - * This routine appends @a the_node onto the end of @a the_chain. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * append operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_append_unprotected( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -) -{ - _Chain_Append_unprotected( the_chain, the_node ); -} - -/** - * @brief Prepend a node. - * - * This routine prepends the_node onto the front of the_chain. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to be prepended. - * - * NOTE: It disables interrupts to ensure the atomicity of the - * prepend operation. - */ -void rtems_chain_prepend( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -); - -/** - * @brief Prepend a node (unprotected). - * - * This routine prepends the_node onto the front of the_chain. - * - * @param[in] the_chain is the chain to be operated upon. - * @param[in] the_node is the node to be prepended. - * - * NOTE: It does NOT disable interrupts to ensure the atomicity of the - * prepend operation. - */ -RTEMS_INLINE_ROUTINE void rtems_chain_prepend_unprotected( - rtems_chain_control *the_chain, - rtems_chain_node *the_node -) -{ - _Chain_Prepend_unprotected( the_chain, the_node ); -} - -/** - * @brief Checks if the @a chain is empty and appends the @a node. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain was empty before the append. - * @retval false The chain contained at least one node before the append. - */ -bool rtems_chain_append_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node *node -); - -/** - * @brief Checks if the @a chain is empty and prepends the @a node. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain was empty before the prepend. - * @retval false The chain contained at least one node before the prepend. - */ -bool rtems_chain_prepend_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node *node -); - -/** - * @brief Tries to get the first @a node and check if the @a chain is empty - * afterwards. - * - * This function removes the first node from the @a chain and returns a pointer - * to that node in @a node. If the @a chain is empty, then @c NULL is returned. - * - * Interrupts are disabled to ensure the atomicity of the operation. - * - * @retval true The chain is empty after the node removal. - * @retval false The chain contained at least one node after the node removal. - */ -bool rtems_chain_get_with_empty_check( - rtems_chain_control *chain, - rtems_chain_node **node -); - -/** - * @brief Returns the node count of the chain. - * - * @param[in] chain The chain. - * - * @note It does NOT disable interrupts to ensure the atomicity of the - * operation. - * - * @return The node count of the chain. - */ -RTEMS_INLINE_ROUTINE size_t rtems_chain_node_count_unprotected( - const rtems_chain_control *chain -) -{ - return _Chain_Node_count_unprotected( chain ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h deleted file mode 100644 index 6b97376511..0000000000 --- a/cpukit/sapi/include/rtems/config.h +++ /dev/null @@ -1,397 +0,0 @@ -/** - * @file - * - * @brief Table of User Defined Configuration Parameters - * - * This include file contains the table of user defined configuration - * parameters. - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_CONFIG_H -#define _RTEMS_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Unlimited object support. Changes the configuration table entry for POSIX - * or RTEMS APIs to bounded only by the memory of the work-space. - * - * Use the macro to define the resource unlimited before placing in - * the configuration table. - */ - -#include <rtems/score/object.h> -#define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS - -#define rtems_resource_unlimited(resource) \ - ( resource | RTEMS_UNLIMITED_OBJECTS ) - -#define rtems_resource_is_unlimited(resource) \ - _Objects_Is_unlimited(resource) - -#define rtems_resource_maximum_per_allocation(resource) \ - _Objects_Maximum_per_allocation(resource) - -#include <rtems/score/watchdog.h> - -/* - * This is kind of kludgy but it allows targets to totally ignore the - * optional APIs like POSIX safely. - */ - -#ifdef RTEMS_POSIX_API -#include <rtems/posix/config.h> -#else -typedef void *posix_api_configuration_table; -#endif - -#include <rtems/rtems/config.h> - -#include <rtems/extension.h> -#if defined(RTEMS_MULTIPROCESSING) -#include <rtems/score/mpci.h> -#endif - -#if defined(RTEMS_MULTIPROCESSING) -/* - * The following records define the Multiprocessor Configuration - * Table. This table defines the multiprocessor system - * characteristics which must be known by RTEMS in a multiprocessor - * system. - */ -typedef struct { - /** This is the local node number. */ - uint32_t node; - /** This is the maximum number of nodes in system. */ - uint32_t maximum_nodes; - /** This is the maximum number of global objects. */ - uint32_t maximum_global_objects; - /** This is the maximum number of proxies. */ - uint32_t maximum_proxies; - - /** - * The MPCI Receive server is assumed to have a stack of at least - * minimum stack size. This field specifies the amount of extra - * stack this task will be given in bytes. - */ - uint32_t extra_mpci_receive_server_stack; - - /** This is a pointer to User/BSP provided MPCI Table. */ - rtems_mpci_table *User_mpci_table; -} rtems_multiprocessing_table; -#endif - -/** - * @brief Task stack allocator initialization hook. - * - * @param[in] stack_space_size is the size of the stack space in bytes. - */ -typedef void (*rtems_stack_allocate_init_hook)( size_t stack_space_size ); - -/** - * @brief Task stack allocator hook. - * - * @param[in] stack_size is the Size of the task stack in bytes. - * - * @retval NULL Not enough memory. - * @retval other Pointer to task stack. - */ -typedef void *(*rtems_stack_allocate_hook)( size_t stack_size ); - -/** - * @brief Task stack deallocator hook. - * - * @param[in] addr is a pointer to previously allocated task stack. - */ -typedef void (*rtems_stack_free_hook)( void *addr ); - -/* - * The following records define the Configuration Table. The - * information contained in this table is required in all - * RTEMS systems, whether single or multiprocessor. This - * table primarily defines the following: - * - * + location and size of the RTEMS Workspace - * + microseconds per clock tick - * + clock ticks per task timeslice - * + required number of each object type for each API configured - */ -typedef struct { - /** - * This field specifies the size in bytes of the RTEMS Workspace. - */ - uintptr_t work_space_size; - - /** - * This field specifies the size in bytes of the RTEMS thread stack space. - */ - uintptr_t stack_space_size; - - /** - * This field specifies the maximum number of dynamically installed - * used extensions. - */ - uint32_t maximum_extensions; - - /** - * This field contains the maximum number of POSIX API - * keys which are configured for this application. - */ - uint32_t maximum_keys; - - /** - * This field contains the maximum number of POSIX API - * key value pairs which are configured for this application. - * - * @note There can be potentially be a key/value pair for - * every thread to use every key. But normally this - * many are not needed in a system. - */ - uint32_t maximum_key_value_pairs; - - /** - * This field specifies the number of microseconds which elapse - * between clock ticks. This is the basis for RTEMS timing. - */ - uint32_t microseconds_per_tick; - - /** - * This field specifies the number of ticks in each task's timeslice. - */ - uint32_t ticks_per_timeslice; - - /** - * This element points to the BSP's optional idle task which may override - * the default one provided with RTEMS. - */ - void *(*idle_task)( uintptr_t ); - - /** - * This field specifies the size of the IDLE task's stack. If less than or - * equal to the minimum stack size, then the IDLE task will have the minimum - * stack size. - */ - uint32_t idle_task_stack_size; - - /** - * This field specifies the size of the interrupt stack. If less than or - * equal to the minimum stack size, then the interrupt stack will be of - * minimum stack size. - */ - uint32_t interrupt_stack_size; - - /** - * @brief Optional task stack allocator initialization hook. - */ - rtems_stack_allocate_init_hook stack_allocate_init_hook; - - /** - * @brief Optional task stack allocator hook. - */ - rtems_stack_allocate_hook stack_allocate_hook; - - /** - * @brief Optional task stack free hook. - */ - rtems_stack_free_hook stack_free_hook; - - /** - * If this element is TRUE, then RTEMS will zero the Executive Workspace. - * When this element is FALSE, it is assumed that the BSP or invoking - * environment has ensured that memory was cleared before RTEMS was - * invoked. - */ - bool do_zero_of_workspace; - - /** - * @brief Specifies if a unified work area is used or not. - * - * If this element is @a true, then the RTEMS Workspace and the C Program - * Heap use the same heap, otherwise they use separate heaps. - */ - bool unified_work_area; - - /** - * @brief Specifies if the stack allocator avoids the work space. - * - * If this element is @a true, then the stack allocator must not allocate the - * thread stacks from the RTEMS Workspace, otherwise it should allocate the - * thread stacks from the RTEMS Workspace. - */ - bool stack_allocator_avoids_work_space; - - #ifdef RTEMS_SMP - bool smp_enabled; - #endif - - uint32_t number_of_initial_extensions; - const rtems_extensions_table *User_extension_table; - #if defined(RTEMS_MULTIPROCESSING) - rtems_multiprocessing_table *User_multiprocessing_table; - #endif - #ifdef RTEMS_SMP - uint32_t maximum_processors; - #endif -} rtems_configuration_table; - -/** - * This is the configuration table generated by confdefs.h. - */ -extern const rtems_configuration_table Configuration; - -#if defined(RTEMS_MULTIPROCESSING) - /** - * This points to the multiprocessing configuration table. - */ - extern rtems_multiprocessing_table *_Configuration_MP_table; -#endif - -#if defined(RTEMS_MULTIPROCESSING) - /** - * @brief RTEMS multiprocessing configuration table. - * - * This is the RTEMS Multiprocessing Configuration Table expected to - * be generated by confdefs.h. - */ - extern rtems_multiprocessing_table Multiprocessing_configuration; - - /* - * This is the default Multiprocessing Configuration Table. - * It is used in single processor configurations. - */ - extern const rtems_multiprocessing_table - _Initialization_Default_multiprocessing_table; -#endif - - -/* - * Some handy macros to avoid dependencies on either the BSP - * or the exact format of the configuration table. - */ - -#define rtems_configuration_get_unified_work_area() \ - (Configuration.unified_work_area) - -#define rtems_configuration_get_stack_allocator_avoids_work_space() \ - (Configuration.stack_allocator_avoids_work_space) - -#define rtems_configuration_get_stack_space_size() \ - (Configuration.stack_space_size) - -#define rtems_configuration_get_work_space_size() \ - (Configuration.work_space_size + \ - (rtems_configuration_get_stack_allocator_avoids_work_space() ? \ - 0 : rtems_configuration_get_stack_space_size())) - -#define rtems_configuration_get_maximum_extensions() \ - (Configuration.maximum_extensions) - -#define rtems_configuration_get_microseconds_per_tick() \ - (Configuration.microseconds_per_tick) -#define rtems_configuration_get_milliseconds_per_tick() \ - (Configuration.microseconds_per_tick / 1000) -#define rtems_configuration_get_nanoseconds_per_tick() \ - (_Watchdog_Nanoseconds_per_tick) - -#define rtems_configuration_get_ticks_per_timeslice() \ - (Configuration.ticks_per_timeslice) - -#define rtems_configuration_get_idle_task() \ - (Configuration.idle_task) - -#define rtems_configuration_get_idle_task_stack_size() \ - (Configuration.idle_task_stack_size) - -#define rtems_configuration_get_interrupt_stack_size() \ - (Configuration.interrupt_stack_size) - -#define rtems_configuration_get_stack_allocate_init_hook() \ - (Configuration.stack_allocate_init_hook) - -#define rtems_configuration_get_stack_allocate_hook() \ - (Configuration.stack_allocate_hook) - -#define rtems_configuration_get_stack_free_hook() \ - (Configuration.stack_free_hook) - - /** - * This macro assists in accessing the field which indicates whether - * RTEMS is responsible for zeroing the Executive Workspace. - */ -#define rtems_configuration_get_do_zero_of_workspace() \ - (Configuration.do_zero_of_workspace) - -#define rtems_configuration_get_number_of_initial_extensions() \ - (Configuration.number_of_initial_extensions) - -#define rtems_configuration_get_user_extension_table() \ - (Configuration.User_extension_table) - -#if defined(RTEMS_MULTIPROCESSING) - #define rtems_configuration_get_user_multiprocessing_table() \ - (Configuration.User_multiprocessing_table) -#else - #define rtems_configuration_get_user_multiprocessing_table() \ - NULL -#endif - -/** - * @brief Returns true if the SMP mode of operation is enabled, and false - * otherwise. - * - * In uni-processor configurations this is a compile-time constant which - * evaluates to false. - * - * @retval true SMP mode of operation is enabled. - * @retval false Otherwise. - */ -#ifdef RTEMS_SMP - #define rtems_configuration_is_smp_enabled() \ - (Configuration.smp_enabled) -#else - #define rtems_configuration_is_smp_enabled() \ - false -#endif - -/** - * @brief Returns the configured maximum count of processors. - * - * The actual number of processors available for the application will be less - * than or equal to the configured maximum count of processors. - * - * On single-processor configurations this is a compile time constant which - * evaluates to one. - * - * @return The configured maximum count of processors. - */ -#ifdef RTEMS_SMP - #define rtems_configuration_get_maximum_processors() \ - (Configuration.maximum_processors) -#else - #define rtems_configuration_get_maximum_processors() \ - 1 -#endif - -#define rtems_configuration_get_rtems_api_configuration() \ - (&Configuration_RTEMS_API) - -#define rtems_configuration_get_posix_api_configuration() \ - (&Configuration_POSIX_API) - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/counter.h b/cpukit/sapi/include/rtems/counter.h deleted file mode 100644 index 3b428402a8..0000000000 --- a/cpukit/sapi/include/rtems/counter.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file - * - * @ingroup ClassicCounter - * - * @brief Free-Running Counter and Busy Wait Delay API - */ - -/* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_SAPI_COUNTER_H -#define _RTEMS_SAPI_COUNTER_H - -#include <rtems/score/cpu.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup ClassicCounter Free-Running Counter and Busy Wait Delay - * - * @ingroup ClassicRTEMS - * - * @brief Free-running counter and busy wait delay functions. - * - * The RTEMS counter is some free-running counter. It ticks usually with a - * frequency close to the CPU or system bus clock. - * - * The counter can be used in case the overhead of the - * rtems_clock_get_uptime_nanoseconds() is too high. The step from counter - * ticks to/from nanoseconds is explicit in this API unlike to - * rtems_clock_get_uptime_nanoseconds() which performs the conversion on each - * invocation. - * - * This counter works without a clock driver and during system initialization. - * - * The counter can be used to profile low-level operations like SMP locks or - * interrupt disabled critical sections. The counter can act also as an - * entropy source for a random number generator. - * - * The period of the counter depends on the actual hardware. - * - * @{ - */ - -/** - * @brief Unsigned integer type for counter values. - */ -typedef CPU_Counter_ticks rtems_counter_ticks; - -/** - * @brief Reads the current counter values. - * - * @return The current counter values. - */ -static inline rtems_counter_ticks rtems_counter_read( void ) -{ - return _CPU_Counter_read(); -} - -/** - * @brief Returns the difference between the second and first CPU counter - * value. - * - * This operation may be carried out as a modulo operation depending on the - * range of the CPU counter device. - * - * @param[in] second The second CPU counter value. - * @param[in] first The first CPU counter value. - * - * @return Returns second minus first modulo counter period. - */ -static inline rtems_counter_ticks rtems_counter_difference( - rtems_counter_ticks second, - rtems_counter_ticks first -) -{ - return _CPU_Counter_difference( second, first ); -} - -/** - * @brief Converts counter ticks into nanoseconds. - * - * @param[in] ticks Some counter ticks. - * - * @return The nanoseconds corresponding to the counter ticks. The value is - * rounded up. - */ -uint64_t rtems_counter_ticks_to_nanoseconds( - rtems_counter_ticks ticks -); - -/** - * @brief Converts nanoseconds into counter ticks. - * - * @param[in] nanoseconds Some nanoseconds. - * - * @return The counter ticks corresponding to the nanoseconds. The value is - * rounded up. - */ -rtems_counter_ticks rtems_counter_nanoseconds_to_ticks( - uint32_t nanoseconds -); - -/** - * @brief Initializes the counter ticks to/from nanoseconds converter functions. - * - * This function must be used to initialize the - * rtems_counter_ticks_to_nanoseconds() and - * rtems_counter_nanoseconds_to_ticks() functions. It should be called during - * system initialization by the board support package. - * - * @param[in] frequency The current counter frequency in Hz. - */ -void rtems_counter_initialize_converter( uint32_t frequency ); - -/** - * @brief Busy wait for some counter ticks. - * - * This function does not disable interrupts. Thus task switches and - * interrupts can interfere with this busy wait may prolong the delay. This - * function busy waits at least the specified time. Due to some overhead the - * actual delay may be longer. - * - * @param[in] ticks The minimum busy wait time in counter ticks. - */ -void rtems_counter_delay_ticks( rtems_counter_ticks ticks ); - -/** - * @brief Busy wait for some nanoseconds. - * - * This function does not disable interrupts. Thus task switches and - * interrupts can interfere with this busy wait may prolong the delay. This - * function busy waits at least the specified time. Due to some overhead the - * actual delay may be longer. - * - * @param[in] nanoseconds The minimum busy wait time in nanoseconds. - */ -void rtems_counter_delay_nanoseconds( uint32_t nanoseconds ); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_SAPI_COUNTER_H */ diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h deleted file mode 100644 index f22abf7f18..0000000000 --- a/cpukit/sapi/include/rtems/extension.h +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @file - * - * @brief User Extensions API. - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_EXTENSION_H -#define _RTEMS_EXTENSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/score/object.h> -#include <rtems/score/userext.h> -#include <rtems/rtems/status.h> -#include <rtems/rtems/types.h> - -typedef struct { - Objects_Control Object; - User_extensions_Control Extension; -} Extension_Control; - -typedef User_extensions_routine - rtems_extension RTEMS_DEPRECATED; - -/** - * @defgroup ClassicUserExtensions User Extensions - * - * @ingroup ClassicRTEMS - * - * @brief The User Extensions Manager allows the application developer to - * augment the executive by allowing them to supply extension routines which - * are invoked at critical system events. - * - * @section ClassicUserExtensionsSets Extension Sets - * - * An @ref User_extensions_Table "extension set" is defined as a set of - * routines which are invoked at each of the critical system events at which - * user extension routines are invoked. Together a set of these routines - * typically perform a specific functionality such as performance monitoring or - * debugger support. - * - * RTEMS allows the user to have multiple extension sets active at the same - * time. First, a single static extension set may be defined as the - * application's User Extension Table which is included as part of the - * Configuration Table. This extension set is active for the entire life of the - * system and may not be deleted. This extension set is especially important - * because it is the only way the application can provided a fatal error - * extension which is invoked if RTEMS fails during the - * rtems_initialize_data_structures() directive. The static extension set is - * optional and may be configured as @c NULL if no static extension set is - * required. - * - * Second, the user can install dynamic extensions using the - * rtems_extension_create() directive. These extensions are RTEMS objects in - * that they have a name, an ID, and can be dynamically created and deleted. In - * contrast to the static extension set, these extensions can only be created - * and installed after the rtems_initialize_data_structures() directive - * successfully completes execution. Dynamic extensions are useful for - * encapsulating the functionality of an extension set. For example, the - * application could use extensions to manage a special coprocessor, do - * performance monitoring, and to do stack bounds checking. Each of these - * extension sets could be written and installed independently of the others. - * - * All user extensions are optional and RTEMS places no naming restrictions on - * the user. The user extension entry points are copied into an internal RTEMS - * structure. This means the user does not need to keep the table after - * creating it, and changing the handler entry points dynamically in a table - * once created has no effect. Creating a table local to a function can save - * space in space limited applications. - * - * Extension switches do not effect the context switch overhead if no switch - * handler is installed. - * - * @section ClassicUserExtensionsTCB Task Control Block Area - * - * RTEMS provides for a pointer to a user-defined data area for each extension - * set to be linked to each task's control block (TCB). This area is only - * available for the dynamic extensions. This set of pointers is an extension - * of the TCB and can be used to store additional data required by the user's - * extension functions. - * - * The TCB extension is an array of pointers in the TCB. The index into the - * table can be obtained from the extension identifier returned when the - * extension is created: - * - * @code - * rtems_tcb *task = some_task; - * size_t index = rtems_object_id_get_index(extension_id); - * void *extension_data = task->extensions [index]; - * @endcode - * - * The number of pointers in the area is the same as the number of user - * extension sets configured. This allows an application to augment the TCB - * with user-defined information. For example, an application could implement - * task profiling by storing timing statistics in the TCB's extended memory - * area. When a task context switch is being executed, the task switch - * extension could read a real-time clock to calculate how long the task being - * swapped out has run as well as timestamp the starting time for the task - * being swapped in. - * - * If used, the extended memory area for the TCB should be allocated and the - * TCB extension pointer should be set at the time the task is created or - * started by either the task create or task start extension. The application - * is responsible for managing this extended memory area for the TCBs. The - * memory may be reinitialized by the task restart extension and should be - * deallocated by the task delete extension when the task is deleted. Since the - * TCB extension buffers would most likely be of a fixed size, the RTEMS - * partition manager could be used to manage the application's extended memory - * area. The application could create a partition of fixed size TCB extension - * buffers and use the partition manager's allocation and deallocation - * directives to obtain and release the extension buffers. - * - * @section ClassicUserExtensionsOrder Order of Invokation - * - * When one of the critical system events occur, the user extensions are - * invoked in either @a forward or @a reverse order. Forward order indicates - * that the static extension set is invoked followed by the dynamic extension - * sets in the order in which they were created. Reverse order means that the - * dynamic extension sets are invoked in the opposite of the order in which - * they were created followed by the static extension set. By invoking the - * extension sets in this order, extensions can be built upon one another. At - * the following system events, the extensions are invoked in forward order: - * - * - Task creation - * - Task start - * - Task restart - * - Task context switch - * - Post task context switch - * - Task begins to execute - * - * At the following system events, the extensions are invoked in reverse order: - * - * - Task exit - * - Task deletion - * - Fatal error detection - * - * At these system events, the extensions are invoked in reverse order to - * insure that if an extension set is built upon another, the more complicated - * extension is invoked before the extension set it is built upon. For example, - * by invoking the static extension set last it is known that the "system" - * fatal error extension will be the last fatal error extension executed. - * Another example is use of the task delete extension by the Standard C - * Library. Extension sets which are installed after the Standard C Library - * will operate correctly even if they utilize the C Library because the C - * Library's task delete extension is invoked after that of the other - * extensions. - */ -/**@{**/ - -typedef User_extensions_thread_create_extension rtems_task_create_extension; -typedef User_extensions_thread_delete_extension rtems_task_delete_extension; -typedef User_extensions_thread_start_extension rtems_task_start_extension; -typedef User_extensions_thread_restart_extension rtems_task_restart_extension; -typedef User_extensions_thread_switch_extension rtems_task_switch_extension; -typedef User_extensions_thread_begin_extension rtems_task_begin_extension; -typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; -typedef User_extensions_fatal_extension rtems_fatal_extension; -typedef User_extensions_thread_terminate_extension rtems_task_terminate_extension; - -typedef User_extensions_Table rtems_extensions_table; - -typedef Internal_errors_Source rtems_fatal_source; - -typedef Internal_errors_t rtems_fatal_code; - -/** - * @brief Creates an extension set object. - * - * This directive creates a extension set object from the extension table - * @a extension_table. The assigned extension set identifier is returned in - * @a id. The identifier is used to access this extension set in other - * extension set related directives. The name @a name will be assigned to the - * extension set object. - * - * Newly created extension sets are immediately installed and are invoked upon - * the next system event supporting an extension. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set created successfully. - * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL. - * @retval RTEMS_INVALID_NAME Invalid extension set name. - * @retval RTEMS_TOO_MANY Too many extension sets created. - */ -rtems_status_code rtems_extension_create( - rtems_name name, - const rtems_extensions_table *extension_table, - rtems_id *id -); - -/** - * @brief Identifies an extension set object by a name. - * - * This directive obtains an extension set identifier in @a id associated with - * the extension set name @a name. If the extension set name is not unique, - * then the extension set identifier will match one of the extension sets with - * that name. However, this extension set identifier is not guaranteed to - * correspond to the desired extension set. The extension set identifier is - * used to access this extension set in other extension set related directives. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set identified successfully. - * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL. - * @retval RTEMS_INVALID_NAME Extension set name not found or invalid name. - */ -rtems_status_code rtems_extension_ident( - rtems_name name, - rtems_id *id -); - -/** - * @brief Deletes an extension set object specified by the identifier @a id. - * - * Any subsequent references to the extension's name and identifier are - * invalid. - * - * This directive will not cause the calling task to be preempted. - * - * @retval RTEMS_SUCCESSFUL Extension set deleted successfully. - * @retval RTEMS_INVALID_ID Invalid extension set identifier. - */ -rtems_status_code rtems_extension_delete( - rtems_id id -); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/extensionimpl.h b/cpukit/sapi/include/rtems/extensionimpl.h deleted file mode 100644 index fb4eeaff7c..0000000000 --- a/cpukit/sapi/include/rtems/extensionimpl.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file - * - * @ingroup ClassicUserExtensions - * - * @brief User Extensions API - */ - -/* - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_EXTENSIONIMPL_H -#define _RTEMS_EXTENSIONIMPL_H - -#include <rtems/extension.h> -#include <rtems/score/objectimpl.h> - -#ifdef __cplusplus -extern "C" { -#endif - -extern Objects_Information _Extension_Information; - -RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void ) -{ - return (Extension_Control *) _Objects_Allocate( &_Extension_Information ); -} - -RTEMS_INLINE_ROUTINE void _Extension_Free ( - Extension_Control *the_extension -) -{ - _Objects_Free( &_Extension_Information, &the_extension->Object ); -} - -RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Get( Objects_Id id ) -{ - return (Extension_Control *) - _Objects_Get_no_protection( id, &_Extension_Information ); -} - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h deleted file mode 100644 index 291af42c6e..0000000000 --- a/cpukit/sapi/include/rtems/fatal.h +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @file - * - * @brief Fatal API. - */ - -/* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_FATAL_H -#define _RTEMS_FATAL_H - -#include <rtems/score/basedefs.h> /* RTEMS_NO_RETURN */ -#include <rtems/extension.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicFatal Fatal - * - * @ingroup ClassicRTEMS - * - * @brief The Fatal Manager provides functions for fatal system states and or - * irrecoverable errors. - */ -/**@{**/ - -/** - * @brief Assert context. - */ -typedef struct { - const char *file; - int line; - const char *function; - const char *failed_expression; -} rtems_assert_context; - -/** - * @brief Exception frame. - */ -typedef CPU_Exception_frame rtems_exception_frame; - -/** - * @brief Prints the exception frame via printk(). - * - * @see rtems_fatal() and RTEMS_FATAL_SOURCE_EXCEPTION. - */ -static inline void rtems_exception_frame_print( - const rtems_exception_frame *frame -) -{ - _CPU_Exception_frame_print( frame ); -} - -/** - * @brief Invokes the internal error handler with a source of - * INTERNAL_ERROR_RTEMS_API and is internal set to false. - * - * @param[in] the_error is a 32-bit fatal error code. - * - * @see _Terminate(). - */ -void rtems_fatal_error_occurred( - uint32_t the_error -) RTEMS_NO_RETURN; - -/** - * @brief Terminates the system. - * - * @param[in] fatal_source The fatal source. - * @param[in] error_code The error code. - * - * @see _Terminate(). - */ -RTEMS_NO_RETURN RTEMS_INLINE_ROUTINE void rtems_fatal( - rtems_fatal_source fatal_source, - rtems_fatal_code error_code -) -{ - _Terminate( fatal_source, error_code ); -} - -/** - * @brief Prints the specified message via printk() and terminates the system. - * - * @param[in] fmt The message format. - * @param[in] ... The message parameters. - * - * @see _Terminate(). - */ -RTEMS_NO_RETURN void rtems_panic( - const char *fmt, ... -) RTEMS_PRINTFLIKE( 1, 2 ); - -/** - * @brief Returns a text for a fatal source. - * - * The text for each fatal source is the enumerator constant. - * - * @param[in] source is the fatal source. - * - * @retval text The fatal source text. - * @retval "?" The passed fatal source is invalid. - */ -const char *rtems_fatal_source_text( rtems_fatal_source source ); - -/** - * @brief Returns a text for an internal error code. - * - * The text for each internal error code is the enumerator constant. - * - * @param[in] error is the error code. - * - * @retval text The error code text. - * @retval "?" The passed error code is invalid. - */ -const char *rtems_internal_error_text( rtems_fatal_code error ); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h deleted file mode 100644 index fa3108ea50..0000000000 --- a/cpukit/sapi/include/rtems/init.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated - * with the Initialization Manager - * - * This include file contains all the constants and structures associated - * with the Initialization Manager. This manager is responsible for - * initializing RTEMS, creating and starting all configured initialization - * tasks, invoking the initialization routine for each user-supplied device - * driver, and initializing the optional multiprocessor layer. - * - * This manager provides directives to: - * - * + initialize the RTEMS executive - * + shutdown the RTEMS executive - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_INIT_H -#define _RTEMS_INIT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/rtems/types.h> -#include <rtems/config.h> -#include <rtems/rtems/intr.h> - -/** - * @brief Initializes the system and starts multitasking. - * - * Iterates through the system initialization linker set and invokes the - * registered handlers. The final step is to start multitasking. - * - * This directive should be called by boot_card() only. - * - * This directive does not return. - */ -void rtems_initialize_executive(void) - RTEMS_NO_RETURN; - -/** - * @brief Shutdown the RTEMS environment. - * - * This routine implements the rtems_shutdown_executive directive. The - * invocation of this directive results in the RTEMS environment being - * shutdown and multitasking halted. The system is terminated with a fatal - * source of RTEMS_FATAL_SOURCE_EXIT and the specified result code. - */ -void rtems_shutdown_executive( - uint32_t result -) RTEMS_NO_RETURN; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h deleted file mode 100644 index 760d412bb8..0000000000 --- a/cpukit/sapi/include/rtems/io.h +++ /dev/null @@ -1,254 +0,0 @@ -/** - * @file - * - * @brief Classic Input/Output Manager API - * - * This file emulates the old Classic RTEMS IO manager directives - * which register and lookup names using the in-memory filesystem. - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_IO_H -#define _RTEMS_IO_H - -#include <rtems/rtems/status.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicIO Input/Output - * - * @ingroup ClassicRTEMS - * - */ -/**@{**/ - -typedef uint32_t rtems_device_major_number; - -typedef uint32_t rtems_device_minor_number; - -typedef rtems_status_code rtems_device_driver; - -typedef rtems_device_driver (*rtems_device_driver_entry)( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -typedef struct { - rtems_device_driver_entry initialization_entry; - rtems_device_driver_entry open_entry; - rtems_device_driver_entry close_entry; - rtems_device_driver_entry read_entry; - rtems_device_driver_entry write_entry; - rtems_device_driver_entry control_entry; -} rtems_driver_address_table; - -/** - * @name Device Driver Maintainance - */ -/**@{**/ - -/** - * @brief Returns @c RTEMS_IO_ERROR. - * - * @retval RTEMS_IO_ERROR Only this one. - */ -rtems_status_code rtems_io_driver_io_error( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Registers and initializes the device with the device driver table - * @a driver_table and major number @a major. - * - * If the major number equals zero a major number will be obtained. The major - * number of the registered driver will be returned in @a registered_major. - * - * After a successful registration rtems_io_initialize() will be called to - * initialize the device. - * - * @retval RTEMS_SUCCESSFUL Device successfully registered and initialized. - * @retval RTEMS_INVALID_ADDRESS Pointer to driver table or to registered - * major number are invalid. Device driver table is empty. - * @retval RTEMS_INVALID_NUMBER Invalid major number. - * @retval RTEMS_TOO_MANY No major number available. - * @retval RTEMS_RESOURCE_IN_USE Major number in use. - * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. - * @retval * Status code depends on rtems_io_initialize(). - */ -rtems_status_code rtems_io_register_driver( - rtems_device_major_number major, - const rtems_driver_address_table *driver_table, - rtems_device_major_number *registered_major -); - -/** - * @brief Unregister a driver from the device driver table. - * - * @param[in] major is the device major number. - * - * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered. - * @retval RTEMS_UNSATISFIED Invalid major number. - * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. - */ -rtems_status_code rtems_io_unregister_driver( - rtems_device_major_number major -); - -/** - * @brief Registers the name @a device_name in the file system for the device - * with number tuple @a major and @a minor. - * - * This assumes that all registered devices are character devices. - * - * @retval RTEMS_SUCCESSFUL Name successfully registered. - * @retval RTEMS_TOO_MANY Name already in use or other errors. - */ -rtems_status_code rtems_io_register_name( - const char *device_name, - rtems_device_major_number major, - rtems_device_minor_number minor -); - -/** @} */ - -/** - * @brief IO driver initialization. - * - * This routine is the initialization directive of the IO manager. - * - * @param[in] major is the device drive number - * @param[in] minor is the device number - * @param[in] argument is the pointer to the argument(s) - * - * @return status code - */ -rtems_status_code rtems_io_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Opening for the IO manager. - * - * Opens a device driver with the number @a major. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Closing for the IO manager. - * - * This routine is the close directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Reading for the IO manager. - * - * This routine is the read directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Writing for the IO manager. - * - * This routine is the write directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** - * @brief Control for the IO manager. - * - * This routine is the control directive of the IO manager. - * - * @param[in] major is the device driver number. - * @param[in] minor is the device number. - * @param[in] argument is the pointer to the argument(s). - * - * @return Status code. - */ -rtems_status_code rtems_io_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *argument -); - -/** @} */ - -/** @} */ - -typedef struct { - const char *device_name; - size_t device_name_length; - rtems_device_major_number major; - rtems_device_minor_number minor; -} rtems_driver_name_t; - -/** - * @deprecated Use stat() instead. - */ -rtems_status_code rtems_io_lookup_name( - const char *name, - rtems_driver_name_t *device_info -) RTEMS_DEPRECATED; - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/ioimpl.h b/cpukit/sapi/include/rtems/ioimpl.h deleted file mode 100644 index 5c4a82eea6..0000000000 --- a/cpukit/sapi/include/rtems/ioimpl.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file - * - * @brief Classic Input/Output Manager Implementation API - */ - -/* - * COPYRIGHT (c) 1989-2008. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_IOIMPL_H -#define _RTEMS_IOIMPL_H - -#include <rtems/io.h> -#include <rtems/score/isrlock.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern const size_t _IO_Number_of_drivers; - -extern rtems_driver_address_table _IO_Driver_address_table[]; - -extern bool _IO_All_drivers_initialized; - -/** - * @brief Initialization of all device drivers. - * - * Initializes all device drivers. - */ -void _IO_Initialize_all_drivers( void ); - -ISR_LOCK_DECLARE( extern, _IO_Driver_registration_lock ) - -RTEMS_INLINE_ROUTINE void _IO_Driver_registration_acquire( - ISR_lock_Context *lock_context -) -{ - _ISR_lock_ISR_disable_and_acquire( - &_IO_Driver_registration_lock, - lock_context - ); -} - -RTEMS_INLINE_ROUTINE void _IO_Driver_registration_release( - ISR_lock_Context *lock_context -) -{ - _ISR_lock_Release_and_ISR_enable( - &_IO_Driver_registration_lock, - lock_context - ); -} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_IOIMPL_H */ diff --git a/cpukit/sapi/include/rtems/mptables.h b/cpukit/sapi/include/rtems/mptables.h deleted file mode 100644 index 01e5b653b4..0000000000 --- a/cpukit/sapi/include/rtems/mptables.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file - * - * @brief Executive's Pre-Initialized Tables used in a - * Multiprocessor Configuration - * - * This include file contains the executive's pre-initialized tables - * used in a multiprocessor configuration. - */ - -/* - * COPYRIGHT (c) 1989-2011. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_MPTABLES_H -#define _RTEMS_MPTABLES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/profiling.h b/cpukit/sapi/include/rtems/profiling.h deleted file mode 100644 index 9e434b2a3c..0000000000 --- a/cpukit/sapi/include/rtems/profiling.h +++ /dev/null @@ -1,333 +0,0 @@ -/** - * @file - * - * @ingroup Profiling - * - * @brief Profiling API - */ - -/* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_PROFILING_H -#define _RTEMS_PROFILING_H - -#include <stdint.h> - -#include <rtems/print.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup Profiling Profiling Support - * - * @brief The profiling support offers functions to report profiling - * information available in the system. - * - * Profiling support is by default disabled. It must be enabled via the - * configure command line with the <tt>--enable-profiling</tt> option. In this - * case the RTEMS_PROFILING pre-processor symbol is defined and profiling - * statistics will be gathered during system run-time. The profiling support - * increases the time of critical sections and has some memory overhead. The - * overhead should be acceptable for most applications. The aim of the - * profiling implementation is to be available even for production systems so - * that verification is simplified. - * - * Profiling information includes critical timing values such as the maximum - * time of disabled thread dispatching which is a measure for the thread - * dispatch latency. On SMP configurations statistics of all SMP locks in the - * system are available. - * - * Profiling information can be retrieved via rtems_profiling_iterate() and - * reported as an XML dump via rtems_profiling_report_xml(). These functions - * are always available, but actual profiling data is only available if enabled - * at build configuration time. - * - * @{ - */ - -/** - * @brief Type of profiling data. - */ -typedef enum { - /** - * @brief Type of per-CPU profiling data. - * - * @see rtems_profiling_per_cpu. - */ - RTEMS_PROFILING_PER_CPU, - - /** - * @brief Type of SMP lock profiling data. - * - * @see rtems_profiling_smp_lock. - */ - RTEMS_PROFILING_SMP_LOCK -} rtems_profiling_type; - -/** - * @brief The profiling data header. - */ -typedef struct { - /** - * @brief The profiling data type. - */ - rtems_profiling_type type; -} rtems_profiling_header; - -/** - * @brief Per-CPU profiling data. - * - * Theoretically all values in this structure can overflow, but the integer - * types are chosen so that they cannot overflow in practice. On systems with - * a 1GHz CPU counter, the 64-bit integers can overflow in about 58 years. - * Since the system should not spend most of the time in critical sections the - * actual system run-time is much longer. Several other counters in the system - * will overflow before we get a problem in the profiling area. - */ -typedef struct { - /** - * @brief The profiling data header. - */ - rtems_profiling_header header; - - /** - * @brief The processor index of this profiling data. - */ - uint32_t processor_index; - - /** - * @brief The maximum time of disabled thread dispatching in nanoseconds. - */ - uint32_t max_thread_dispatch_disabled_time; - - /** - * @brief Count of times when the thread dispatch disable level changes from - * zero to one in thread context. - * - * This value may overflow. - */ - uint64_t thread_dispatch_disabled_count; - - /** - * @brief Total time of disabled thread dispatching in nanoseconds. - * - * The average time of disabled thread dispatching is the total time of - * disabled thread dispatching divided by the thread dispatch disabled - * count. - * - * This value may overflow. - */ - uint64_t total_thread_dispatch_disabled_time; - - /** - * @brief The maximum interrupt delay in nanoseconds if supported by the - * hardware. - * - * The interrupt delay is the time interval from the recognition of an - * interrupt signal by the hardware up to the execution start of the - * corresponding high-level handler. The interrupt delay is the main - * contributor to the interrupt latency. To measure this time hardware - * support is required. A time stamp unit must capture the interrupt signal - * recognition time. If no hardware support is available, then this field - * will have a constant value of zero. - */ - uint32_t max_interrupt_delay; - - /** - * @brief The maximum time spent to process a single sequence of nested - * interrupts in nanoseconds. - * - * This is the time interval between the change of the interrupt nest level - * from zero to one and the change back from one to zero. It is the measured - * worst-case execution time of interrupt service routines. Please note that - * in case of nested interrupts this time includes the combined execution - * time and not the maximum time of an individual interrupt service routine. - */ - uint32_t max_interrupt_time; - - /** - * @brief Count of times when the interrupt nest level changes from zero to - * one. - * - * This value may overflow. - */ - uint64_t interrupt_count; - - /** - * @brief Total time of interrupt processing in nanoseconds. - * - * The average time of interrupt processing is the total time of interrupt - * processing divided by the interrupt count. - * - * This value may overflow. - */ - uint64_t total_interrupt_time; -} rtems_profiling_per_cpu; - -/** - * @brief Count of lock contention counters for SMP lock profiling. - */ -#define RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS 4 - -/** - * @brief SMP lock profiling data. - * - * The lock acquire attempt instant is the point in time right after the - * interrupt disable action in the lock acquire sequence. - * - * The lock acquire instant is the point in time right after the lock - * acquisition. This is the begin of the critical section code execution. - * - * The lock acquire time is the time elapsed between the lock acquire attempt - * instant and the lock acquire instant. - * - * The lock release instant is the point in time right before the interrupt - * enable action in the lock release sequence. - * - * The lock section time is the time elapsed between the lock acquire instant - * and the lock release instant. - */ -typedef struct { - /** - * @brief The profiling data header. - */ - rtems_profiling_header header; - - /** - * @brief The lock name. - */ - const char *name; - - /** - * @brief The maximum lock acquire time in nanoseconds. - */ - uint32_t max_acquire_time; - - /** - * @brief The maximum lock section time in nanoseconds. - */ - uint32_t max_section_time; - - /** - * @brief The count of lock uses. - * - * This value may overflow. - */ - uint64_t usage_count; - - /** - * @brief Total lock acquire time in nanoseconds. - * - * The average lock acquire time is the total acquire time divided by the - * lock usage count. The ration of the total section and total acquire times - * gives a measure for the lock contention. - * - * This value may overflow. - */ - uint64_t total_acquire_time; - - /** - * @brief Total lock section time in nanoseconds. - * - * The average lock section time is the total section time divided by the - * lock usage count. - * - * This value may overflow. - */ - uint64_t total_section_time; - - /** - * @brief The counts of lock acquire operations by contention. - * - * The contention count for index N corresponds to a lock acquire attempt - * with an initial queue length of N. The last index corresponds to all - * lock acquire attempts with an initial queue length greater than or equal - * to RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS minus one. - * - * The values may overflow. - */ - uint64_t contention_counts[RTEMS_PROFILING_SMP_LOCK_CONTENTION_COUNTS]; -} rtems_profiling_smp_lock; - -/** - * @brief Collection of profiling data. - */ -typedef union { - /** - * @brief Header to specify the actual profiling data. - */ - rtems_profiling_header header; - - /** - * @brief Per-CPU profiling data if indicated by the header. - */ - rtems_profiling_per_cpu per_cpu; - - /** - * @brief SMP lock profiling data if indicated by the header. - */ - rtems_profiling_smp_lock smp_lock; -} rtems_profiling_data; - -/** - * @brief Visitor function for the profiling iteration. - * - * @param[in, out] arg The visitor argument. - * @param[in] data The current profiling data. - * - * @see rtems_profiling_iterate(). - */ -typedef void (*rtems_profiling_visitor)( - void *arg, - const rtems_profiling_data *data -); - -/** - * @brief Iterates through all profiling data of the system. - * - * @param[in] visitor The visitor. - * @param[in, out] visitor_arg The visitor argument. - */ -void rtems_profiling_iterate( - rtems_profiling_visitor visitor, - void *visitor_arg -); - -/** - * @brief Reports profiling data as XML. - * - * @param[in] name The name of the profiling report. - * @param[in] printer The RTEMS printer to send the output too. - * @param[in] indentation_level The current indentation level. - * @param[in] indentation The string used for indentation. - * - * @returns As specified by printf(). - */ -int rtems_profiling_report_xml( - const char *name, - const rtems_printer *printer, - uint32_t indentation_level, - const char *indentation -); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_PROFILING_H */ diff --git a/cpukit/sapi/include/rtems/rbheap.h b/cpukit/sapi/include/rtems/rbheap.h deleted file mode 100644 index 735aa6c8fd..0000000000 --- a/cpukit/sapi/include/rtems/rbheap.h +++ /dev/null @@ -1,268 +0,0 @@ -/** - * @file - * - * @brief Red-Black Tree Heap API - */ - -/* - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_RBHEAP_H -#define _RTEMS_RBHEAP_H - -#include <rtems.h> -#include <rtems/chain.h> -#include <rtems/rbtree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup RBHeap Red-Black Tree Heap - * - * @ingroup ClassicRTEMS - * - * @brief Red-Black Tree Heap API. - * - * The red-black tree heap provides a memory allocator suitable to implement - * the malloc() and free() interface. It uses a first-fit allocation strategy. - * In the red-black tree heap the administration data structures are not - * contained in the managed memory area. Thus writing beyond the boundaries of - * a chunk does not damage the data to maintain the heap. This can be used for - * example in a task stack allocator which protects the task stacks from access - * by other tasks. The allocated and free memory parts of the managed area are - * called chunks. Each chunk needs a descriptor which is stored outside of the - * managed area. - */ -/**@{*/ - -/** - * @brief Red-black heap chunk descriptor. - */ -typedef struct { - /** - * This chain node can be used in two chains - * - the chain of spare chunk descriptors and - * - the chain of free chunks in the managed memory area. - * - * In case this chain node is not part of a chain, the chunk represents a - * used chunk in the managed memory area. - */ - rtems_chain_node chain_node; - - /** - * Tree node for chunks that represent a part of the managed memory area. - * These chunks are either free or used. - */ - rtems_rbtree_node tree_node; - - /** - * Begin address of the chunk. The address alignment it specified in the - * @ref rtems_rbheap_control. - */ - uintptr_t begin; - - /** - * Size of the chunk in bytes. - */ - uintptr_t size; -} rtems_rbheap_chunk; - -typedef struct rtems_rbheap_control rtems_rbheap_control; - -/** - * @brief Handler to extend the available chunk descriptors. - * - * This handler is called when no more chunk descriptors are available. An - * example implementation is this: - * - * @code - * void extend_descriptors_with_malloc(rtems_rbheap_control *control) - * { - * rtems_rbheap_chunk *chunk = malloc(sizeof(*chunk)); - * - * if (chunk != NULL) { - * rtems_rbheap_add_to_spare_descriptor_chain(control, chunk); - * } - * } - * @endcode - * - * @see rtems_rbheap_extend_descriptors_never() and - * rtems_rbheap_extend_descriptors_with_malloc(). - */ -typedef void (*rtems_rbheap_extend_descriptors)(rtems_rbheap_control *control); - -/** - * @brief Red-black heap control. - */ -struct rtems_rbheap_control { - /** - * Chain of free chunks in the managed memory area. - */ - rtems_chain_control free_chunk_chain; - - /** - * Chain of free chunk descriptors. Descriptors are consumed during - * allocation and may be produced during free if contiguous chunks can be - * coalesced. In case of descriptor starvation the @ref extend_descriptors - * handler will be called. - */ - rtems_chain_control spare_descriptor_chain; - - /** - * Tree of chunks representing the state of the managed memory area. - */ - rtems_rbtree_control chunk_tree; - - /** - * Minimum chunk begin alignment in bytes. - */ - uintptr_t alignment; - - /** - * Handler to extend the available chunk descriptors. - */ - rtems_rbheap_extend_descriptors extend_descriptors; - - /** - * User specified argument handler for private handler data. - */ - void *handler_arg; -}; - -/** - * @brief Initializes the red-black tree heap @a control. - * - * @param[in, out] control The red-black tree heap. - * @param[in] area_begin The managed memory area begin. - * @param[in] area_size The managed memory area size. - * @param[in] alignment The minimum chunk alignment. - * @param[in] extend_descriptors The handler to extend the available chunk - * descriptors. - * @param[in] handler_arg The handler argument. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ADDRESS The memory area is invalid. - * @retval RTEMS_NO_MEMORY Not enough chunk descriptors. - */ -rtems_status_code rtems_rbheap_initialize( - rtems_rbheap_control *control, - void *area_begin, - uintptr_t area_size, - uintptr_t alignment, - rtems_rbheap_extend_descriptors extend_descriptors, - void *handler_arg -); - -/** - * @brief Allocates a chunk of memory of at least @a size bytes from the - * red-black tree heap @a control. - * - * The chunk begin is aligned by the value specified in - * rtems_rbheap_initialize(). - * - * @param[in, out] control The red-black tree heap. - * @param[in] size The requested chunk size in bytes. - * - * @retval NULL Not enough free space in the heap. - * @retval otherwise Pointer to allocated chunk of memory. - */ -void *rtems_rbheap_allocate(rtems_rbheap_control *control, size_t size); - -/** - * @brief Frees a chunk of memory @a ptr allocated from the red-black tree heap - * @a control. - * - * @param[in, out] control The red-black tree heap. - * @param[in] ptr The pointer to the chunk of memory. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID The chunk of memory is not a valid chunk in the - * red-black tree heap. - * @retval RTEMS_INCORRECT_STATE The chunk of memory is not in the right state. - */ -rtems_status_code rtems_rbheap_free(rtems_rbheap_control *control, void *ptr); - -static inline rtems_chain_control *rtems_rbheap_get_spare_descriptor_chain( - rtems_rbheap_control *control -) -{ - return &control->spare_descriptor_chain; -} - -static inline void rtems_rbheap_add_to_spare_descriptor_chain( - rtems_rbheap_control *control, - rtems_rbheap_chunk *chunk -) -{ - rtems_chain_control *chain = - rtems_rbheap_get_spare_descriptor_chain(control); - - rtems_chain_initialize_node(&chunk->chain_node); - rtems_chain_prepend_unprotected(chain, &chunk->chain_node); -} - -static inline void rtems_rbheap_set_extend_descriptors( - rtems_rbheap_control *control, - rtems_rbheap_extend_descriptors extend_descriptors -) -{ - control->extend_descriptors = extend_descriptors; -} - -static inline void *rtems_rbheap_get_handler_arg( - const rtems_rbheap_control *control -) -{ - return control->handler_arg; -} - -static inline void rtems_rbheap_set_handler_arg( - rtems_rbheap_control *control, - void *handler_arg -) -{ - control->handler_arg = handler_arg; -} - -/** - * @brief Chunk descriptor extend handler that does nothing. - */ -void rtems_rbheap_extend_descriptors_never(rtems_rbheap_control *control); - -/** - * @brief Chunk descriptor extend handler that uses malloc(). - */ -void rtems_rbheap_extend_descriptors_with_malloc( - rtems_rbheap_control *control -); - -/** @} */ - -/* Private API */ - -#define rtems_rbheap_chunk_of_node(node) \ - RTEMS_CONTAINER_OF(node, rtems_rbheap_chunk, tree_node) - -static inline bool rtems_rbheap_is_chunk_free(const rtems_rbheap_chunk *chunk) -{ - return !rtems_chain_is_node_off_chain(&chunk->chain_node); -} - -#ifdef __cplusplus -} -#endif - -#endif /* _RTEMS_RBHEAP_H */ diff --git a/cpukit/sapi/include/rtems/rbtree.h b/cpukit/sapi/include/rtems/rbtree.h deleted file mode 100644 index 57821cf31d..0000000000 --- a/cpukit/sapi/include/rtems/rbtree.h +++ /dev/null @@ -1,456 +0,0 @@ -/** - * @file - * - * @brief Constants and Structures Associated with the RBTree API in RTEMS - * - * This include file contains all the constants and structures associated - * with the RBTree API in RTEMS. The rbtree is a Red Black Tree that - * is part of the Super Core. This is the published interface to that - * code. - */ - -/* - * Copyright (c) 2010 Gedare Bloom. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_RBTREE_H -#define _RTEMS_RBTREE_H - -#include <rtems/score/rbtree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicRBTrees Red-Black Trees - * - * @ingroup ClassicRTEMS - * - * @brief A Red-Black Tree container. - * - * The red-black tree container offers no internal protection against - * concurrent access. The user must ensure that at most one thread at once can - * access a red-black tree instance. - * - * @{ - */ - -/** - * @typedef rtems_rbtree_node - * - * A node that can be manipulated in the rbtree. - */ -typedef RBTree_Node rtems_rbtree_node; - -/** - * @typedef rtems_rbtree_control - * - * The rbtree's control anchors the rbtree. - */ -typedef RBTree_Control rtems_rbtree_control; - -/** - * @brief Integer type for compare results. - * - * The type is large enough to represent pointers and 32-bit signed integers. - * - * @see rtems_rbtree_compare. - */ -typedef long rtems_rbtree_compare_result; - -/** - * @brief Compares two red-black tree nodes. - * - * @param[in] first The first node. - * @param[in] second The second node. - * - * @retval positive The key value of the first node is greater than the one of - * the second node. - * @retval 0 The key value of the first node is equal to the one of the second - * node. - * @retval negative The key value of the first node is less than the one of the - * second node. - */ -typedef rtems_rbtree_compare_result ( *rtems_rbtree_compare )( - const RBTree_Node *first, - const RBTree_Node *second -); - -/** - * @brief RBTree initializer for an empty rbtree with designator @a name. - */ -#define RTEMS_RBTREE_INITIALIZER_EMPTY(name) \ - RBTREE_INITIALIZER_EMPTY(name) - -/** - * @brief RBTree definition for an empty rbtree with designator @a name. - */ -#define RTEMS_RBTREE_DEFINE_EMPTY(name) \ - RBTREE_DEFINE_EMPTY(name) - -/** - * @brief Initialize a RBTree header. - * - * This routine initializes @a the_rbtree structure to manage the - * contiguous array of @a number_nodes nodes which starts at - * @a starting_address. Each node is of @a node_size bytes. - * - * @param[in] the_rbtree is the pointer to rbtree header - * @param[in] compare The node compare function. - * @param[in] starting_address is the starting address of first node - * @param[in] number_nodes is the number of nodes in rbtree - * @param[in] node_size is the size of node in bytes - * @param[in] is_unique If true, then reject nodes with a duplicate key, else - * otherwise. - */ -void rtems_rbtree_initialize( - rtems_rbtree_control *the_rbtree, - rtems_rbtree_compare compare, - void *starting_address, - size_t number_nodes, - size_t node_size, - bool is_unique -); - -/** - * @brief Initialize this RBTree as Empty - * - * This routine initializes @a the_rbtree to contain zero nodes. - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_initialize_empty( - rtems_rbtree_control *the_rbtree -) -{ - _RBTree_Initialize_empty( the_rbtree ); -} - -/** - * @brief Set off RBtree. - * - * This function sets the next and previous fields of the @a node to NULL - * indicating the @a node is not part of any rbtree. - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_set_off_tree( - rtems_rbtree_node *node -) -{ - _RBTree_Set_off_tree( node ); -} - -/** - * @brief Is the Node off RBTree. - * - * This function returns true if the @a node is not on a rbtree. A @a node is - * off rbtree if the next and previous fields are set to NULL. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_node_off_tree( - const rtems_rbtree_node *node -) -{ - return _RBTree_Is_node_off_tree( node ); -} - -/** - * @brief Return pointer to RBTree root. - * - * This function returns a pointer to the root node of @a the_rbtree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_root( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Root( the_rbtree ); -} - -/** - * @copydoc _RBTree_Minimum() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_min( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Minimum( the_rbtree ); -} - -/** - * @copydoc _RBTree_Maximum() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_max( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Maximum( the_rbtree ); -} - -/** - * @brief Return pointer to the left child node from this node. - * - * This function returns a pointer to the left child node of @a the_node. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_left( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Left( the_node ); -} - -/** - * @brief Return pointer to the right child node from this node. - * - * This function returns a pointer to the right child node of @a the_node. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_right( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Right( the_node ); -} - -/** - * @copydoc _RBTree_Parent() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_parent( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Parent( the_node ); -} - -/** - * @brief Is the RBTree empty. - * - * This function returns true if there a no nodes on @a the_rbtree and - * false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_empty( - const rtems_rbtree_control *the_rbtree -) -{ - return _RBTree_Is_empty( the_rbtree ); -} - -/** - * @brief Is this the minimum node on the RBTree. - * - * This function returns true if @a the_node is the min node on @a the_rbtree - * and false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_min( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node -) -{ - return rtems_rbtree_min( the_rbtree ) == the_node; -} - -/** - * @brief Is this the maximum node on the RBTree. - * - * This function returns true if @a the_node is the max node on @a the_rbtree - * and false otherwise. - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_max( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node -) -{ - return rtems_rbtree_max( the_rbtree ) == the_node; -} - -/** - * @copydoc _RBTree_Is_root() - */ -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_root( - const rtems_rbtree_node *the_node -) -{ - return _RBTree_Is_root( the_node ); -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_equal( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result == 0; -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_greater( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result > 0; -} - -RTEMS_INLINE_ROUTINE bool rtems_rbtree_is_lesser( - rtems_rbtree_compare_result compare_result -) -{ - return compare_result < 0; -} - -/** - * @brief Tries to find a node for the specified key in the tree. - * - * @param[in] the_rbtree The red-black tree control. - * @param[in] the_node A node specifying the key. - * @param[in] compare The node compare function. - * @param[in] is_unique If true, then return the first node with a key equal to - * the one of the node specified if it exits, else return the last node if it - * exists. - * - * @retval node A node corresponding to the key. If the tree is not unique - * and contains duplicate keys, the set of duplicate keys acts as FIFO. - * @retval NULL No node exists in the tree for the key. - */ -rtems_rbtree_node* rtems_rbtree_find( - const rtems_rbtree_control *the_rbtree, - const rtems_rbtree_node *the_node, - rtems_rbtree_compare compare, - bool is_unique -); - -/** - * @copydoc _RBTree_Predecessor() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_predecessor( - const rtems_rbtree_node *node -) -{ - return _RBTree_Predecessor( node ); -} - -/** - * @copydoc _RBTree_Successor() - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node* rtems_rbtree_successor( - const rtems_rbtree_node *node -) -{ - return _RBTree_Successor( node ); -} - -/** - * @copydoc _RBTree_Extract() - */ -RTEMS_INLINE_ROUTINE void rtems_rbtree_extract( - rtems_rbtree_control *the_rbtree, - rtems_rbtree_node *the_node -) -{ - _RBTree_Extract( the_rbtree, the_node ); -} - -/** - * @brief Gets a node with the minimum key value from the red-black tree. - * - * This function extracts a node with the minimum key value from - * tree and returns a pointer to that node if it exists. In case multiple - * nodes with a minimum key value exist, then they are extracted in FIFO order. - * - * @param[in] the_rbtree The red-black tree control. - * - * @retval NULL The tree is empty. - * @retval node A node with the minimal key value on the tree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_min( - rtems_rbtree_control *the_rbtree -) -{ - rtems_rbtree_node *the_node = rtems_rbtree_min( the_rbtree ); - - if ( the_node != NULL ) { - rtems_rbtree_extract( the_rbtree, the_node ); - } - - return the_node; -} - -/** - * @brief Gets a node with the maximal key value from the red-black tree. - * - * This function extracts a node with the maximum key value from tree and - * returns a pointer to that node if it exists. In case multiple nodes with a - * maximum key value exist, then they are extracted in LIFO order. - * - * @param[in] the_rbtree The red-black tree control. - * - * @retval NULL The tree is empty. - * @retval node A node with the maximal key value on the tree. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_get_max( - rtems_rbtree_control *the_rbtree -) -{ - rtems_rbtree_node *the_node = rtems_rbtree_max( the_rbtree ); - - if ( the_node != NULL ) { - rtems_rbtree_extract( the_rbtree, the_node ); - } - - return the_node; -} - -/** - * @brief Peek at the min node on a rbtree. - * - * This function returns a pointer to the min node from @a the_rbtree - * without changing the tree. If @a the_rbtree is empty, - * then NULL is returned. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_min( - const rtems_rbtree_control *the_rbtree -) -{ - return rtems_rbtree_min( the_rbtree ); -} - -/** - * @brief Peek at the max node on a rbtree. - * - * This function returns a pointer to the max node from @a the_rbtree - * without changing the tree. If @a the_rbtree is empty, - * then NULL is returned. - */ -RTEMS_INLINE_ROUTINE rtems_rbtree_node *rtems_rbtree_peek_max( - const rtems_rbtree_control *the_rbtree -) -{ - return rtems_rbtree_max( the_rbtree ); -} - -/** - * @brief Inserts the node into the red-black tree. - * - * In case the node is already a node of a tree, then this function yields - * unpredictable results. - * - * @param[in] the_rbtree The red-black tree control. - * @param[in] the_node The node to insert. - * @param[in] compare The node compare function. - * @param[in] is_unique If true, then reject nodes with a duplicate key, else - * insert nodes in FIFO order in case the key value is equal to existing nodes. - * - * @retval NULL Successfully inserted. - * @retval existing_node This is a unique insert and there exists a node with - * an equal key in the tree already. - */ -rtems_rbtree_node *rtems_rbtree_insert( - RBTree_Control *the_rbtree, - RBTree_Node *the_node, - rtems_rbtree_compare compare, - bool is_unique -); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/scheduler.h b/cpukit/sapi/include/rtems/scheduler.h deleted file mode 100644 index 8684b798f7..0000000000 --- a/cpukit/sapi/include/rtems/scheduler.h +++ /dev/null @@ -1,247 +0,0 @@ -/** - * @file - * - * @brief Scheduler Configuration API - */ - -/* - * Copyright (c) 2014, 2017 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_SAPI_SCHEDULER_H -#define _RTEMS_SAPI_SCHEDULER_H - -#include <rtems/score/scheduler.h> - -#define RTEMS_SCHEDULER_CONTEXT_NAME( name ) \ - _Configuration_Scheduler_ ## name - -#if defined(RTEMS_SMP) - /* This object doesn't exist and indicates a configuration error */ - extern const Scheduler_Control RTEMS_SCHEDULER_INVALID_INDEX; - - #define RTEMS_SCHEDULER_ASSIGN_DEFAULT \ - SCHEDULER_ASSIGN_DEFAULT - - #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL \ - SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL - - #define RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY \ - SCHEDULER_ASSIGN_PROCESSOR_MANDATORY - - #define RTEMS_SCHEDULER_ASSIGN( index, attr ) \ - { \ - ( index ) < RTEMS_ARRAY_SIZE( _Scheduler_Table ) ? \ - &_Scheduler_Table[ ( index ) ] : &RTEMS_SCHEDULER_INVALID_INDEX, \ - ( attr ) \ - } - - #define RTEMS_SCHEDULER_ASSIGN_NO_SCHEDULER { NULL, 0 } -#endif - -/* - * This file should be only included in the context of <rtems/confdefs.h>. - * Define the scheduler configuration macros only in case the corresponding - * configure symbol is defined. This is necessary to prevent invalid workspace - * size estimates since we have to account for the per-thread scheduler - * information. - */ - -#ifdef CONFIGURE_SCHEDULER_CBS - #include <rtems/score/schedulercbs.h> - - #define RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( CBS_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_CBS( name ) \ - static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_CBS( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_CBS_NAME( name ).Base, \ - SCHEDULER_CBS_ENTRY_POINTS, \ - SCHEDULER_CBS_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_EDF - #include <rtems/score/scheduleredf.h> - - #define RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( EDF_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_EDF( name ) \ - static Scheduler_EDF_Context RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_EDF( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_EDF_NAME( name ).Base, \ - SCHEDULER_EDF_ENTRY_POINTS, \ - SCHEDULER_EDF_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_EDF_SMP - #include <rtems/score/scheduleredfsmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( EDF_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_EDF_SMP( name, max_cpu_count ) \ - static struct { \ - Scheduler_EDF_SMP_Context Base; \ - Scheduler_EDF_SMP_Ready_queue Ready[ ( max_cpu_count ) + 1 ]; \ - } RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_EDF_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_EDF_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_EDF_SMP_ENTRY_POINTS, \ - SCHEDULER_EDF_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY - #include <rtems/score/schedulerpriority.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY( name, prio_count ) \ - static struct { \ - Scheduler_priority_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Base.Base, \ - SCHEDULER_PRIORITY_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP - #include <rtems/score/schedulerpriorityaffinitysmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_affinity_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( name, prio_count ) \ - static struct { \ - Scheduler_priority_SMP_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP - #include <rtems/score/schedulerprioritysmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( priority_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( name, prio_count ) \ - static struct { \ - Scheduler_priority_SMP_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Base.Base.Base, \ - SCHEDULER_PRIORITY_SMP_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_STRONG_APA - #include <rtems/score/schedulerstrongapa.h> - - #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( strong_APA_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_STRONG_APA( name, prio_count ) \ - static struct { \ - Scheduler_strong_APA_Context Base; \ - Chain_Control Ready[ ( prio_count ) ]; \ - } RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_STRONG_APA( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Base.Base.Base, \ - SCHEDULER_STRONG_APA_ENTRY_POINTS, \ - RTEMS_ARRAY_SIZE( \ - RTEMS_SCHEDULER_CONTEXT_STRONG_APA_NAME( name ).Ready \ - ) - 1, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_SIMPLE - #include <rtems/score/schedulersimple.h> - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( simple_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE( name ) \ - static Scheduler_simple_Context \ - RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_SIMPLE( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_SIMPLE_NAME( name ).Base, \ - SCHEDULER_SIMPLE_ENTRY_POINTS, \ - SCHEDULER_SIMPLE_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP - #include <rtems/score/schedulersimplesmp.h> - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) \ - RTEMS_SCHEDULER_CONTEXT_NAME( simple_SMP_ ## name ) - - #define RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP( name ) \ - static Scheduler_simple_SMP_Context \ - RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ) - - #define RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP( name, obj_name ) \ - { \ - &RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP_NAME( name ).Base.Base, \ - SCHEDULER_SIMPLE_SMP_ENTRY_POINTS, \ - SCHEDULER_SIMPLE_SMP_MAXIMUM_PRIORITY, \ - ( obj_name ) \ - } -#endif - -#endif /* _RTEMS_SAPI_SCHEDULER_H */ diff --git a/cpukit/sapi/include/rtems/timecounter.h b/cpukit/sapi/include/rtems/timecounter.h deleted file mode 100644 index 8d1bd78618..0000000000 --- a/cpukit/sapi/include/rtems/timecounter.h +++ /dev/null @@ -1,335 +0,0 @@ -/** - * @file - * - * @ingroup SAPITimecounter - * - * @brief Timecounter API - */ - -/* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_TIMECOUNTER_H -#define _RTEMS_TIMECOUNTER_H - -#include <rtems/score/timecounter.h> -#include <rtems/score/basedefs.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup SAPITimecounter Timecounter Support - * - * @{ - */ - -/** - * @brief Timecounter quality for the clock drivers. - * - * Timecounter with higher quality value are used in favour of those with lower - * quality value. - */ -#define RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER 100 - -/** - * @copydoc _Timecounter_Install() - * - * Below is an exemplary code snippet that shows the adjustable parameters and - * the following call of the install routine. - * - * @code - * struct timecounter tc; - * - * uint32_t get_timecount( struct timecounter *tc ) - * { - * return some_free_running_counter; - * } - * - * void install( void ) - * { - * tc.tc_get_timecount = get_timecount; - * tc.tc_counter_mask = 0xffffffff; - * tc.tc_frequency = 123456; - * tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; - * rtems_timecounter_install( &tc ); - * } - * @endcode - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_install( - struct timecounter *tc -) -{ - _Timecounter_Install( tc ); -} - -/** - * @copydoc _Timecounter_Tick() - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_tick(void) -{ - _Timecounter_Tick(); -} - -/** - * @brief Simple timecounter to support legacy clock drivers. - */ -typedef struct { - struct timecounter tc; - uint64_t scaler; - uint32_t real_interval; - uint32_t binary_interval; -} rtems_timecounter_simple; - -/** - * @brief At tick handling done under protection of the timecounter lock. - */ -typedef void rtems_timecounter_simple_at_tick( - rtems_timecounter_simple *tc -); - -/** - * @brief Returns the current value of a simple timecounter. - */ -typedef uint32_t rtems_timecounter_simple_get( - rtems_timecounter_simple *tc -); - -/** - * @brief Returns true if the interrupt of a simple timecounter is pending, and - * false otherwise. - */ -typedef bool rtems_timecounter_simple_is_pending( - rtems_timecounter_simple *tc -); - -/** - * @brief Initializes and installs a simple timecounter. - * - * A simple timecounter can be used if the hardware provides no free running - * counter. A periodic hardware counter must be provided. The counter period - * must be synchronous to the clock tick. The counter ticks per clock tick is - * scaled up to the next power of two. - * - * @param[in] tc Zero initialized simple timecounter. - * @param[in] counter_frequency_in_hz The hardware counter frequency in Hz. - * @param[in] counter_ticks_per_clock_tick The hardware counter ticks per clock - * tick. - * @param[in] get_timecount The method to get the current time count. - * - * @code - * #include <rtems/timecounter.h> - * - * static rtems_timecounter_simple some_tc; - * - * static uint32_t some_tc_get( rtems_timecounter_simple *tc ) - * { - * return some.value; - * } - * - * static bool some_tc_is_pending( rtems_timecounter_simple *tc ) - * { - * return some.is_pending; - * } - * - * static uint32_t some_tc_get_timecount( struct timecounter *tc ) - * { - * return rtems_timecounter_simple_downcounter_get( - * tc, - * some_tc_get, - * some_tc_is_pending - * ); - * } - * - * static void some_tc_tick( void ) - * { - * rtems_timecounter_simple_downcounter_tick( &some_tc, some_tc_get ); - * } - * - * void some_tc_init( void ) - * { - * uint64_t us_per_tick; - * uint32_t counter_frequency_in_hz; - * uint32_t counter_ticks_per_clock_tick; - * - * us_per_tick = rtems_configuration_get_microseconds_per_tick(); - * counter_frequency_in_hz = some_tc_get_frequency(); - * counter_ticks_per_clock_tick = - * (uint32_t) ( counter_frequency_in_hz * us_per_tick ) / 1000000; - * - * some_tc_init_hardware( counter_ticks_per_clock_tick ); - * some_tc_init_clock_tick_interrupt( some_tc_tick ); - * - * rtems_timecounter_simple_install( - * &some_tc, - * counter_frequency_in_hz, - * counter_ticks_per_clock_tick, - * some_tc_get_timecount - * ); - * } - * @endcode - * - * @see rtems_timecounter_simple_downcounter_get(), - * rtems_timecounter_simple_downcounter_tick(), - * rtems_timecounter_simple_upcounter_get() and - * rtems_timecounter_simple_upcounter_tick(). - */ -void rtems_timecounter_simple_install( - rtems_timecounter_simple *tc, - uint32_t counter_frequency_in_hz, - uint32_t counter_ticks_per_clock_tick, - timecounter_get_t *get_timecount -); - -/** - * @brief Maps a simple timecounter value into its binary frequency domain. - * - * @param[in] tc The simple timecounter. - * @param[in] value The value of the simple timecounter. - * - * @return The scaled value. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_scale( - const rtems_timecounter_simple *tc, - uint32_t value -) -{ - return (uint32_t) ( ( value * tc->scaler ) >> 32 ); -} - -/** - * @brief Performs a simple timecounter tick for downcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] at_tick The method to perform work under timecounter lock - * protection at this tick, e.g. clear a pending flag. - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_downcounter_tick( - rtems_timecounter_simple *tc, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_at_tick at_tick -) -{ - ISR_lock_Context lock_context; - uint32_t current; - - _Timecounter_Acquire( &lock_context ); - - ( *at_tick )( tc ); - - current = rtems_timecounter_simple_scale( - tc, - tc->real_interval - ( *get )( tc ) - ); - - _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context ); -} - -/** - * @brief Performs a simple timecounter tick for upcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] at_tick The method to perform work under timecounter lock - * protection at this tick, e.g. clear a pending flag. - */ -RTEMS_INLINE_ROUTINE void rtems_timecounter_simple_upcounter_tick( - rtems_timecounter_simple *tc, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_at_tick at_tick -) -{ - ISR_lock_Context lock_context; - uint32_t current; - - _Timecounter_Acquire( &lock_context ); - - ( *at_tick )( tc ); - - current = rtems_timecounter_simple_scale( tc, ( *get )( tc ) ); - - _Timecounter_Tick_simple( tc->binary_interval, current, &lock_context ); -} - -/** - * @brief Gets the simple timecounter value mapped to its binary frequency - * domain for downcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] is_pending The method which indicates if the interrupt of the - * simple timecounter is pending. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_downcounter_get( - struct timecounter *tc_base, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_is_pending is_pending -) -{ - rtems_timecounter_simple *tc; - uint32_t counter; - uint32_t interval; - - tc = (rtems_timecounter_simple *) tc_base; - counter = ( *get )( tc ); - interval = tc->real_interval; - - if ( ( *is_pending )( tc ) ) { - counter = ( *get )( tc ); - interval *= 2; - } - - return rtems_timecounter_simple_scale( tc, interval - counter ); -} - -/** - * @brief Gets the simple timecounter value mapped to its binary frequency - * domain for upcounters. - * - * @param[in] tc The simple timecounter. - * @param[in] get The method to get the value of the simple timecounter. - * @param[in] is_pending The method which indicates if the interrupt of the - * simple timecounter is pending. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timecounter_simple_upcounter_get( - struct timecounter *tc_base, - rtems_timecounter_simple_get get, - rtems_timecounter_simple_is_pending is_pending -) -{ - rtems_timecounter_simple *tc; - uint32_t counter; - uint32_t interval; - - tc = (rtems_timecounter_simple *) tc_base; - counter = ( *get )( tc ); - interval = 0; - - if ( ( *is_pending )( tc ) ) { - counter = ( *get )( tc ); - interval = tc->real_interval; - } - - return rtems_timecounter_simple_scale( tc, interval + counter ); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_TIMECOUNTER_H */ diff --git a/cpukit/sapi/include/rtems/timespec.h b/cpukit/sapi/include/rtems/timespec.h deleted file mode 100644 index e82d271492..0000000000 --- a/cpukit/sapi/include/rtems/timespec.h +++ /dev/null @@ -1,305 +0,0 @@ -/** - * @file - * - * @brief Timespec API - * - * This include file contains API for manipulating timespecs. - */ - -/* - * Copyright (c) 2012. - * Krzysztof Miesowicz <krzysztof.miesowicz@gmail.com> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_TIMESPEC_H -#define _RTEMS_TIMESPEC_H - -#include <rtems/score/timespec.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup TimespecAPI Timespec - * - * @ingroup ClassicRTEMS - * - * @brief Timespec API - * - * @{ - * - */ - -/** - * @brief Is timespec valid - * - * This method determines the validity of a timespec. - * - * @param[in] time is the timespec instance to validate. - * - * @retval true The timespec is valid. - * @retval false The timespec is not valid. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_is_valid( - const struct timespec *time -) -{ - return _Timespec_Is_valid(time); -} - -/** - * @brief Timespec less than operator. - * - * This method is the less than operator for timespecs. - * - * @param[in] lhs is the left hand side timespec - * @param[in] rhs is the right hand side timespec - * - * @retval true @a lhs is less than @a rhs. - * @retval false @a lhs is not less than @a rhs. - * - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_less_than( - const struct timespec *lhs, - const struct timespec *rhs -) -{ - return _Timespec_Less_than(lhs,rhs); -} - -/** - * @brief Add to a timespec. - * - * This routine adds two timespecs. The second argument is added - * to the first. - * - * @param[in] time is the base time to be added to - * @param[in] add is the timespec to add to the first argument - * - * @return This method returns the number of seconds @a time increased by. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_add_to( - struct timespec *time, - const struct timespec *add -) -{ - return _Timespec_Add_to(time,add); -} - -/** - * @brief Convert timespec to number of ticks. - * - * This routine convert the @a time timespec to the corresponding number - * of clock ticks. - * - * @param[in] time is the time to be converted - * - * @return This method returns the number of ticks computed. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_to_ticks( - const struct timespec *time -) -{ - return _Timespec_To_ticks(time); -} - -/** - * @brief Convert ticks to timespec. - * - * This routine converts the @a ticks value to the corresponding - * timespec format @a time. - * - * @param[in] time is the timespec format time result - * @param[in] ticks is the number of ticks to convert - */ - -RTEMS_INLINE_ROUTINE void rtems_timespec_from_ticks( - uint32_t ticks, - struct timespec *time -) -{ - _Timespec_From_ticks(ticks,time); -} - -/** - * @brief Subtract two timespec. - * - * This routine subtracts two timespecs. @a result is set to - * @a end - @a start. - * - * @param[in] start is the starting time - * @param[in] end is the ending time - * @param[in] result is the difference between starting and ending time. - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_subtract( - const struct timespec *start, - const struct timespec *end, - struct timespec *result -) -{ - _Timespec_Subtract(start,end,result); -} - -/** - * @brief Divide timespec by integer. - * - * This routine divides a timespec by an integer value. The expected - * use is to assist in benchmark calculations where you typically - * divide a duration by a number of iterations. - * - * @param[in] time is the total - * @param[in] iterations is the number of iterations - * @param[in] result is the average time. - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_divide_by_integer( - const struct timespec *time, - uint32_t iterations, - struct timespec *result -) -{ - _Timespec_Divide_by_integer(time,iterations,result); -} - -/** - * @brief Divide timespec. - * - * This routine divides a timespec by another timespec. The - * intended use is for calculating percentages to three decimal points. - * - * @param[in] lhs is the left hand number - * @param[in] rhs is the right hand number - * @param[in] ival_percentage is the integer portion of the average - * @param[in] fval_percentage is the thousandths of percentage - * - * @return This method fills in @a result. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_divide( - const struct timespec *lhs, - const struct timespec *rhs, - uint32_t *ival_percentage, - uint32_t *fval_percentage -) -{ - _Timespec_Divide(lhs,rhs,ival_percentage,fval_percentage); -} - -/** - * @brief Set timespec to seconds nanosecond. - * - * This method sets the timespec to the specified seconds and nanoseconds - * value. - * - * @param[in] _time points to the timespec instance to validate. - * @param[in] _seconds is the seconds portion of the timespec - * @param[in] _nanoseconds is the nanoseconds portion of the timespec - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_set( - struct timespec *_time, - time_t _seconds, - uint32_t _nanoseconds -) -{ - _Timespec_Set( _time, _seconds, _nanoseconds ); -} - -/** - * @brief Zero timespec. - * - * This method sets the timespec to zero. - * value. - * - * @param[in] _time points to the timespec instance to zero. - */ -RTEMS_INLINE_ROUTINE void rtems_timespec_zero( - struct timespec *_time -) -{ - _Timespec_Set_to_zero( _time ); -} - -/** - * @brief Get seconds portion of timespec. - * - * This method returns the seconds portion of the specified timespec - * - * @param[in] _time points to the timespec - * - * @return The seconds portion of @a _time. - */ -RTEMS_INLINE_ROUTINE time_t rtems_timespec_get_seconds( - struct timespec *_time -) -{ - return _Timespec_Get_seconds( _time ); -} - -/** - * @brief Get nanoseconds portion of timespec. - * - * This method returns the nanoseconds portion of the specified timespec - * - * @param[in] _time points to the timespec - * - * @return The nanoseconds portion of @a _time. - */ -RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_get_nanoseconds( - struct timespec *_time -) -{ - return _Timespec_Get_nanoseconds( _time ); -} - -/** - * @brief Timespec greater than operator. - * - * This method is the greater than operator for timespecs. - * - * @param[in] _lhs is the left hand side timespec - * @param[in] _rhs is the right hand side timespec - * - * @retval true @a _lhs is greater than @a _rhs. - * @retval false @a _lhs is not greater than @a _rhs. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_greater_than( - const struct timespec *_lhs, - const struct timespec *_rhs -) -{ - return _Timespec_Greater_than( _lhs, _rhs ); -} -/** - * @brief Timespec equal to Operator - * - * This method is the is equal to than operator for timespecs. - * - * @param[in] lhs is the left hand side timespec - * @param[in] rhs is the right hand side timespec - * - * @retval true @a lhs is equal to @a rhs. - * @retval false @a lhs is not equal to @a rhs. - */ -RTEMS_INLINE_ROUTINE bool rtems_timespec_equal_to( - const struct timespec *lhs, - const struct timespec *rhs -) -{ - return _Timespec_Equal_to( lhs, rhs); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/include/rtems/version.h b/cpukit/sapi/include/rtems/version.h deleted file mode 100644 index b806cb8c2f..0000000000 --- a/cpukit/sapi/include/rtems/version.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file - * - * @brief Version API. - */ - -/* - * Copyright (C) 2017. - * Chris Johns <chrisj@rtems.org> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_VERSION_H -#define _RTEMS_VERSION_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup ClassicVersion Version - * - * @ingroup ClassicVersion - * - * @brief The Version API provides functions to return the version or parts of - * the version of RTEMS you are using. - */ -/**@{**/ - -/** - * @brief Returns the version string. - * - * @retval text The version as a string. - */ -const char *rtems_version( void ); - -/** - * @brief Returns the version's major number. - * - * @retval int The version's major number. - */ -int rtems_version_major( void ); - -/** - * @brief Returns the version's minor number. - * - * @retval int The version's minor number. - */ -int rtems_version_minor( void ); - -/** - * @brief Returns the version's revision number. - * - * @retval int The version's revision number. - */ -int rtems_version_revision( void ); - -/** - * @brief Returns the version control key for the current version of code that - * has been built. The key is specific to the version control system being used - * and allows the built version to be identified. - * - * @retval int The version's version control key. - */ -const char *rtems_version_control_key( void ); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/sapi/preinstall.am b/cpukit/sapi/preinstall.am deleted file mode 100644 index a6b0ba30df..0000000000 --- a/cpukit/sapi/preinstall.am +++ /dev/null @@ -1,100 +0,0 @@ -## Automatically generated by ampolish3 - Do not edit - -if AMPOLISH3 -$(srcdir)/preinstall.am: Makefile.am - $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am -endif - -PREINSTALL_DIRS = -DISTCLEANFILES = $(PREINSTALL_DIRS) - -all-am: $(PREINSTALL_FILES) - -PREINSTALL_FILES = -CLEANFILES = $(PREINSTALL_FILES) - -$(PROJECT_INCLUDE)/rtems/$(dirstamp): - @$(MKDIR_P) $(PROJECT_INCLUDE)/rtems - @: > $(PROJECT_INCLUDE)/rtems/$(dirstamp) -PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/$(dirstamp) - -$(PROJECT_INCLUDE)/rtems/confdefs.h: include/confdefs.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/confdefs.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/confdefs.h - -$(PROJECT_INCLUDE)/rtems/bsd.h: include/rtems/bsd.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/bsd.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/bsd.h - -$(PROJECT_INCLUDE)/rtems/chain.h: include/rtems/chain.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/chain.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/chain.h - -$(PROJECT_INCLUDE)/rtems/config.h: include/rtems/config.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/config.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/config.h - -$(PROJECT_INCLUDE)/rtems/counter.h: include/rtems/counter.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/counter.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/counter.h - -$(PROJECT_INCLUDE)/rtems/extension.h: include/rtems/extension.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/extension.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/extension.h - -$(PROJECT_INCLUDE)/rtems/extensionimpl.h: include/rtems/extensionimpl.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/extensionimpl.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/extensionimpl.h - -$(PROJECT_INCLUDE)/rtems/fatal.h: include/rtems/fatal.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/fatal.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/fatal.h - -$(PROJECT_INCLUDE)/rtems/init.h: include/rtems/init.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/init.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/init.h - -$(PROJECT_INCLUDE)/rtems/io.h: include/rtems/io.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/io.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/io.h - -$(PROJECT_INCLUDE)/rtems/ioimpl.h: include/rtems/ioimpl.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/ioimpl.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/ioimpl.h - -$(PROJECT_INCLUDE)/rtems/mptables.h: include/rtems/mptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/mptables.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/mptables.h - -$(PROJECT_INCLUDE)/rtems/cbs.h: include/rtems/cbs.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/cbs.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/cbs.h - -$(PROJECT_INCLUDE)/rtems/profiling.h: include/rtems/profiling.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/profiling.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/profiling.h - -$(PROJECT_INCLUDE)/rtems/rbheap.h: include/rtems/rbheap.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rbheap.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbheap.h - -$(PROJECT_INCLUDE)/rtems/rbtree.h: include/rtems/rbtree.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rbtree.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.h - -$(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h - -$(PROJECT_INCLUDE)/rtems/timecounter.h: include/rtems/timecounter.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/timecounter.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timecounter.h - -$(PROJECT_INCLUDE)/rtems/timespec.h: include/rtems/timespec.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/timespec.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timespec.h - -$(PROJECT_INCLUDE)/rtems/version.h: include/rtems/version.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/version.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/version.h - |