diff options
Diffstat (limited to 'cpukit/libmisc')
33 files changed, 0 insertions, 7197 deletions
diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am index e1343ddf11..ca4686a954 100644 --- a/cpukit/libmisc/Makefile.am +++ b/cpukit/libmisc/Makefile.am @@ -208,5 +208,4 @@ libxz_a_SOURCES = xz/xz/h xz/xz_crc32.c \ EXTRA_DIST += xz/README xz/COPING ## --- -include $(srcdir)/preinstall.am include $(top_srcdir)/automake/local.am diff --git a/cpukit/libmisc/bspcmdline/bspcmdline.h b/cpukit/libmisc/bspcmdline/bspcmdline.h deleted file mode 100644 index 51916ff26a..0000000000 --- a/cpukit/libmisc/bspcmdline/bspcmdline.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file rtems/bspcmdline.h - * - * @defgroup BSPCommandLine BSP Command Line Helpers - * - * @ingroup libmisc - * @brief BSP Command Line Handler - * - * This include file contains all prototypes and specifications - * related to the BSP Command Line String and associated helper - * routines. The helpers are useful for locating command line - * type arguments (e.g. --mode) and their associated right - * hand side (e.g. FAST in --mode=FAST). - */ - -/* - * COPYRIGHT (c) 1989-2009. - * 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 __BSP_COMMAND_LINE_h -#define __BSP_COMMAND_LINE_h - -/** - * @defgroup BSPCommandLine BSP Command Line Helpers - * - * The BSP Command Line Handler provides a set of routines which assist - * in examining and decoding the Command Line String passed to the BSP - * at boot time. - */ -/**@{*/ - -#include <stddef.h> /* for size_t */ - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @brief Obtain Pointer to BSP Boot Command String - * - * This method returns a pointer to the BSP Boot Command String. It - * is as likely to be NULL as point to a string as most BSPs do not - * have a start environment that provides a boot string. - * - * @retval This method returns the pointer to the BSP Boot Command String. - */ -const char *rtems_bsp_cmdline_get(void); - -/** - * @brief Obtain COPY of the Entire Matching Argument - * - * This method searches for the argument @a name in the BSP Boot Command - * String and returns a copy of the entire string associated with it in - * @a value up to a string of @a length. This will include the argument - * and any right hand side portion of the string. For example, one might - * be returned --mode=FAST if - * searching for --mode. - * - * @param[in] name is the arugment to search for - * @param[in] value points to where the contents will - * be placed if located. - * @param[in] length is the maximum length to copy - * - * @return This method returns NULL if not found and - * @a value if found. - */ -const char *rtems_bsp_cmdline_get_param( - const char *name, - char *value, - size_t length -); - - -/** - * @brief Obtain COPY of the Right Hand Side of the Matching Argument - * - * This method searches for the argument @a name in - * the BSP Boot Command String and returns the right hand side - * associated with it in @a value up to a maximum string @a length. - * This will NOT include the argument but only any right hand side - * portion of the string. * For example, one might be returned FAST if - * searching for --mode. - * - * @param[in] name is the arugment to search for - * @param[in] value points to where the contents will - * be placed if located. - * @param[in] length is the maximum length to copy - * - * @retval This method returns NULL if not found and - * @a value if found. - */ -const char *rtems_bsp_cmdline_get_param_rhs( - const char *name, - char *value, - size_t length -); - -/** - * @brief Obtain Pointer to the Entire Matching Argument - * - * This method searches for the argument @a name in - * the BSP Boot Command String and returns a pointer to the - * entire string associated with it. This will include the - * argument and any right hand side portion of the string. - * For example, one might be returned --mode=FAST if - * searching for --mode. - * - * @param[in] name is the arugment to search for - * - * @retval This method returns NULL if not found and a pointer - * into the BSP Boot Command String if found. - * - * @note The pointer will be to the original BSP Command - * Line string. Exercise caution when using this. - */ -const char *rtems_bsp_cmdline_get_param_raw( - const char *name -); - -#ifdef __cplusplus -} -#endif - -/**@}*/ -#endif diff --git a/cpukit/libmisc/capture/capture-cli.h b/cpukit/libmisc/capture/capture-cli.h deleted file mode 100644 index 55749b7cb1..0000000000 --- a/cpukit/libmisc/capture/capture-cli.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file rtems/capture-cli.h - * - * This is the Target Interface Command Line Interface. You need - * start the RTEMS monitor. - */ - -/* - ------------------------------------------------------------------------ - - Copyright 2002, 2016 Chris Johns <chrisj@rtems.org>. - All rights reserved. - - 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. - - This software with is provided ``as is'' and with NO WARRANTY. - - ------------------------------------------------------------------------ - - RTEMS Performance Monitoring and Measurement Framework. - - This is the Target Interface Command Line Interface. You need - start the RTEMS monitor. - -*/ - -#ifndef __CAPTURE_CLI_H_ -#define __CAPTURE_CLI_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems/capture.h> - -/** - * rtems_capture_cli_init - * - * This function initialises the command line interface to the capture - * engine. - */ -rtems_status_code -rtems_capture_cli_init (rtems_capture_timestamp timestamp); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cpukit/libmisc/capture/capture.h b/cpukit/libmisc/capture/capture.h deleted file mode 100644 index f847ee0424..0000000000 --- a/cpukit/libmisc/capture/capture.h +++ /dev/null @@ -1,1122 +0,0 @@ -/** - * @file rtems/capture.h - * - * @brief Capture Engine Component of the RTEMS Measurement and - * Monitoring System - * - * This is the Capture Engine component of the RTEMS Measurement and - * Monitoring system. - */ - -/* - ------------------------------------------------------------------------ - - Copyright 2002, 2016 Chris Johns <chrisj@rtems.org>. - All rights reserved. - - 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. - - This software with is provided ``as is'' and with NO WARRANTY. - - ------------------------------------------------------------------------ - - RTEMS Performance Monitoring and Measurement Framework. - This is the Capture Engine component. - -*/ - -#ifndef __CAPTURE_H_ -#define __CAPTURE_H_ - -#include <rtems.h> -#include <rtems/rtems/tasksimpl.h> -#include <rtems/score/schedulerimpl.h> - -/** - * @defgroup libmisc_capture RTEMS Capture Engine - * - * @ingroup libmisc - * - * Capture Engine Component of the RTEMS Measurement and Monitoring System - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Global capture flags. - */ -#define RTEMS_CAPTURE_INIT (1u << 0) -#define RTEMS_CAPTURE_ON (1U << 1) -#define RTEMS_CAPTURE_NO_MEMORY (1U << 2) -#define RTEMS_CAPTURE_TRIGGERED (1U << 3) -#define RTEMS_CAPTURE_GLOBAL_WATCH (1U << 4) -#define RTEMS_CAPTURE_ONLY_MONITOR (1U << 5) - -/* - * Per-CPU capture flags. - */ -#define RTEMS_CAPTURE_OVERFLOW (1U << 0) -#define RTEMS_CAPTURE_READER_ACTIVE (1U << 1) -#define RTEMS_CAPTURE_READER_WAITING (1U << 2) - -/** - * The number of tasks in a trigger group. - */ -#define RTEMS_CAPTURE_TRIGGER_TASKS (32) - -/** - * @brief A capture timestamp. - * - * This is a nanosecond capture timestamp - */ -typedef uint64_t rtems_capture_time; - -/** - * @brief Task id and mask for the from trigger. - * - * A from capture is a task id and a mask for the type of - * from trigger we are interested in. The mask uses the same - * bit maps as the flags field in the control structure. There - * will only be a from type trigger if the flags in the control - * structure has the specific *_BY bit set. - */ -typedef struct rtems_capture_from -{ - rtems_name name; - rtems_id id; - uint32_t trigger; -} rtems_capture_from; - -/** - * @brief Capture control structure for a group of tasks. - * - * RTEMS control holds the trigger and watch configuration for a group of - * tasks with the same name. The flags hold global control flags. - * - * The to_triggers fields holds triggers TO this task. The from_triggers holds - * triggers from this task. The by_triggers is an OR or triggers which are - * caused BY the task listed TO this task. The by_valid flag which entries - * in by are valid. - */ -typedef struct rtems_capture_control -{ - rtems_name name; - rtems_id id; - uint32_t flags; - uint32_t to_triggers; - uint32_t from_triggers; - uint32_t by_triggers; - uint32_t by_valid; - rtems_capture_from by[RTEMS_CAPTURE_TRIGGER_TASKS]; - struct rtems_capture_control* next; -} rtems_capture_control; - -/** - * The from_valid mask. - */ -#define RTEMS_CAPTURE_CONTROL_FROM_MASK(_s) \ - (UINT32_C(1) << (RTEMS_CAPTURE_TRIGGER_TASKS - ((_s) + 1))) - -/** - * Control flags. - */ -#define RTEMS_CAPTURE_WATCH (1U << 0) - -/** - * Control triggers. - */ -#define RTEMS_CAPTURE_SWITCH (1 << 0) -#define RTEMS_CAPTURE_CREATE (1 << 1) -#define RTEMS_CAPTURE_START (1 << 2) -#define RTEMS_CAPTURE_RESTART (1 << 3) -#define RTEMS_CAPTURE_DELETE (1 << 4) -#define RTEMS_CAPTURE_BEGIN (1 << 5) -#define RTEMS_CAPTURE_EXITTED (1 << 6) -#define RTEMS_CAPTURE_TERMINATED (1 << 7) - -#define RTEMS_CAPTURE_FROM_TRIGS (RTEMS_CAPTURE_SWITCH | \ - RTEMS_CAPTURE_CREATE | \ - RTEMS_CAPTURE_START | \ - RTEMS_CAPTURE_RESTART | \ - RTEMS_CAPTURE_DELETE) - -#define RTEMS_CAPTURE_TO_TRIGS (RTEMS_CAPTURE_SWITCH | \ - RTEMS_CAPTURE_CREATE | \ - RTEMS_CAPTURE_START | \ - RTEMS_CAPTURE_RESTART | \ - RTEMS_CAPTURE_DELETE | \ - RTEMS_CAPTURE_BEGIN | \ - RTEMS_CAPTURE_EXITTED) - -/** - * Task flags. - */ -#define RTEMS_CAPTURE_TRACED (1U << 0) -#define RTEMS_CAPTURE_INIT_TASK (1U << 1) -#define RTEMS_CAPTURE_RECORD_TASK (1U << 2) - -/* - * @brief Capture record. - * - * This is a record that is written into - * the buffer. The events includes the priority of the task - * at the time of the context switch. - */ -typedef struct rtems_capture_record -{ - size_t size; - uint32_t events; - rtems_id task_id; - rtems_capture_time time; -} RTEMS_PACKED rtems_capture_record; - -/* - * @brief Capture task record. - * - * This is a record that is written into - * the buffer. The events includes the priority of the task - * at the time of the context switch. - */ -typedef struct rtems_capture_task_record -{ - rtems_name name; - rtems_task_priority start_priority; - uint32_t stack_size; -} RTEMS_PACKED rtems_capture_task_record; - -/** - * The capture record event flags. - */ -#define RTEMS_CAPTURE_REAL_PRI_EVENT_MASK UINT32_C (0x000000ff) -#define RTEMS_CAPTURE_CURR_PRI_EVENT_MASK UINT32_C (0x0000ff00) -#define RTEMS_CAPTURE_REAL_PRIORITY_EVENT (0) -#define RTEMS_CAPTURE_CURR_PRIORITY_EVENT (8) -#define RTEMS_CAPTURE_EVENT_START (16) -#define RTEMS_CAPTURE_CREATED_BY_EVENT UINT32_C (0x00010000) -#define RTEMS_CAPTURE_CREATED_EVENT UINT32_C (0x00020000) -#define RTEMS_CAPTURE_STARTED_BY_EVENT UINT32_C (0x00040000) -#define RTEMS_CAPTURE_STARTED_EVENT UINT32_C (0x00080000) -#define RTEMS_CAPTURE_RESTARTED_BY_EVENT UINT32_C (0x00100000) -#define RTEMS_CAPTURE_RESTARTED_EVENT UINT32_C (0x00200000) -#define RTEMS_CAPTURE_DELETED_BY_EVENT UINT32_C (0x00400000) -#define RTEMS_CAPTURE_DELETED_EVENT UINT32_C (0x00800000) -#define RTEMS_CAPTURE_TERMINATED_EVENT UINT32_C (0x01000000) -#define RTEMS_CAPTURE_BEGIN_EVENT UINT32_C (0x02000000) -#define RTEMS_CAPTURE_EXITTED_EVENT UINT32_C (0x04000000) -#define RTEMS_CAPTURE_SWITCHED_OUT_EVENT UINT32_C (0x08000000) -#define RTEMS_CAPTURE_SWITCHED_IN_EVENT UINT32_C (0x10000000) -#define RTEMS_CAPTURE_TIMESTAMP UINT32_C (0x20000000) -#define RTEMS_CAPTURE_EVENT_END (29) - -/** - * @brief Capture trigger modes - * - * The types of trigger modes that exist. - */ -typedef enum rtems_capture_trigger_mode -{ - rtems_capture_to_any, - rtems_capture_from_any, - rtems_capture_from_to -} rtems_capture_trigger_mode; - -/** - * @brief Capture trigger. - * - * The types of triggers that exist. - */ -typedef enum rtems_capture_trigger -{ - rtems_capture_switch, - rtems_capture_create, - rtems_capture_start, - rtems_capture_restart, - rtems_capture_delete, - rtems_capture_begin, - rtems_capture_exitted, - rtems_capture_terminated -} rtems_capture_trigger; - -/** - * @brief Capture timestamp callout handler. - * - * This defines the callout handler to obtain a time stamp. The - * value returned is time count since the last read. - * - */ - -typedef void (*rtems_capture_timestamp)(rtems_capture_time* time); - -/** - * @brief Capture record lock context. - * - * This structure is used to lock a per CPU buffer when opeining recording. The - * per CPU buffer is held locked until the record close is called. Locking - * masks interrupts so use this lock only when needed and do not hold it for - * long. - * - * The lock first masks the CPU interrupt before taking the interrupt - * lock. This stops a thread context taking the lock and then an interrupt on - * the same CPU attempting to take the lock so creating a deadlock. - * - */ -typedef struct { - rtems_interrupt_lock_context lock_context; - rtems_interrupt_lock* lock; -} rtems_capture_record_lock_context; - -/** - * @brief Capture open - * - * This function initialises the realtime trace manager allocating the - * capture buffer. It is assumed we have a working heap at stage of - * initialisation. - * - * @param[in] size The number of capture records to define. - * @param[in] timestamp The timestamp callout handler to use. If the - * the handler is NULL a default nano-second timestamp - * will be used. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_open (uint32_t size, - rtems_capture_timestamp timestamp); - -/** - * @brief Capture close - * - * This function shutdowns the tracer and release any claimed - * resources. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_close (void); - -/** - * @brief Capture control trace enable/disable. - * - * This function allows control of tracing at a global level. - * - * @param[in] enable The trace enable/disable flag. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_set_control (bool enable); - -/** - * @brief Capture monitor enable/disable. - * - * This function enable the monitor mode. When in the monitor mode - * the tasks are monitored but no data is saved. This can be used - * to profile the load on a system. - * - * @param[in] enable The monitor enable/disable flag. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_set_monitor (bool enable); - -/* - * @brief Capture flush trace buffer. - * - * This function flushes the trace buffer. The prime parameter allows the - * capture engine to also be primed again. - * - * @param[in] prime The prime after flush flag. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_flush (bool prime); - -/** - * @brief Capture add watch - * - * This function defines a watch for a specific task given a name. A watch - * causes it to be traced either in or out of context. The watch can be - * optionally enabled or disabled with the set routine. It is disabled by - * default. - * - * @param[in] name The name of the @a capture_controls entry - * @param[in] id The id of the @a capture_controls entry. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_add (rtems_name name, rtems_id id); - -/** - * @brief Capture delete watch. - * - * This function removes a watch for a specific task given a name. The task - * description will still exist if referenced by a trace record in the trace - * buffer or a global watch is defined. - * - * @param[in] name The name of the @a capture_controls entry - * @param[in] id The id of the @a capture_controls entry. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_del (rtems_name name, rtems_id id); - -/** - * @brief Capture enable/disable watch. - * - * This function allows control of a watch. The watch can be enabled or - * disabled. - * - * @param[in] name The name of the @a capture_controls entry - * @param[in] id The id of the @a capture_controls entry. - * @param[in] enable The enable/disable flag for the watch. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_ctrl (rtems_name name, - rtems_id id, - bool enable); - -/** - * @brief Capture enable/disable global watch. - * - * This function allows control of a global watch. The watch can - * be enabled or disabled. A global watch configures all tasks below - * the ceiling and above the floor to be traced. - * - * @param[in] enable The enable/disable flag for the watch. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_global (bool enable); - -/** - * @brief Get global watch state - * - * This function returns the global watch state. - * - * @retval This method returns true if the global watch - * is on. Otherwise, it returns false. - */ -bool rtems_capture_watch_global_on (void); - -/** - * @brief Set watch ceiling. - * - * This function sets a watch ceiling. Events from tasks at or greater - * than the ceiling priority are ignored. This is a simple way to - * monitor an application and exclude system tasks running at a higher - * priority level. - * - * @param[in] ceiling specifies the priority level immediately above - * that at which events from tasks are not captured. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_ceiling (rtems_task_priority ceiling); - -/** - * @brief Get watch ceiling. - * - * This function gets the watch ceiling. - * - * @retval The priority level immediately above that at which events - * from tasks are not captured. - */ -rtems_task_priority rtems_capture_watch_get_ceiling (void); - -/** - * @brief Capture set watch floor. - * - * This function sets a watch floor. Tasks at or less than the - * floor priority are not watched. This is a simple way to monitor - * an application and exclude system tasks running at a lower - * priority level. - * - * @param[in] floor specifies the priority level immediately below - * that at which events from tasks are not captured. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_watch_floor (rtems_task_priority floor); - -/** - * @brief Capture set watch floor - * - * This function gets the watch floor. - * - * @retval The priority level immediately below - * that at which events from tasks are not captured. - */ -rtems_task_priority rtems_capture_watch_get_floor (void); - -/** - * @brief Capture set trigger - * - * This function sets a trigger. - * - * This set trigger routine will create a trace control for the - * target task. The task list is searched and any existing tasks - * are linked to the new control. - * - * We can have a number of tasks that have the same name so we - * search using names. This means a number of tasks can be - * linked to single control. - * - * Some events captured such as context switch include two - * tasks. These are referred to as being "from" and "to" - * Some events may only have one task specified. - * - * @param[in] from_name specifies the name of the from task. - * @param[in] from_id specifies the id of the from task. - * @param[in] to_name specifies the name of the to task. - * @param[in] to_id specifies the id of the to task. - * @param[in] mode specifies the trigger mode. - * @param[in] trigger specifies the type of trigger. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code -rtems_capture_set_trigger (rtems_name from_name, - rtems_id from_id, - rtems_name to_name, - rtems_id to_id, - rtems_capture_trigger_mode mode, - rtems_capture_trigger trigger); - -/** - * @brief Capture clear trigger. - * - * This function clears a trigger. - * - * This clear trigger routine will not clear a watch. - * - * @param[in] from_name specifies the name of the from task. - * @param[in] from_id specifies the id of the from task. - * @param[in] to_name specifies the name of the to task. - * @param[in] to_id specifies the id of the to task. - * @param[in] mode specifies the trigger mode. - * @param[in] trigger specifies the type of trigger. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code -rtems_capture_clear_trigger (rtems_name from_name, - rtems_id from_id, - rtems_name to_name, - rtems_id to_id, - rtems_capture_trigger_mode mode, - rtems_capture_trigger trigger); - -/** - * @brief Capture read records from capture buffer - * - * This function reads a number of records from the capture buffer. - * - * The function returns the number of record that is has that are - * in a continous block of memory. If the number of available records - * wrap then only those records are provided. This removes the need for - * caller to be concerned about buffer wrappings. If the number of - * requested records cannot be met due to the wrapping of the records - * less than the specified number will be returned. - * - * The user must release the records. This is achieved with a call to - * rtems_capture_release. Calls this function without a release will - * result in at least the same number of records being released. - * - * @param[in] cpu The cpu number that the records were recorded on - * @param[out] read will contain the number of records read - * @param[out] recs The capture records that are read. - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_read (uint32_t cpu, - size_t* read, - const void** recs); - -/** - * @brief Capture release records. - * - * This function releases the requested number of record slots back - * to the capture engine. The count must match the number read. - * - * @param[in] count The number of record slots to release - * - * @retval This method returns RTEMS_SUCCESSFUL if there was not an - * error. Otherwise, a status code is returned indicating the - * source of the error. - */ -rtems_status_code rtems_capture_release (uint32_t cpu, uint32_t count); - -/** - * @brief Capture filter - * - * This function this function specifies if the given task and events should be - * logged. - * - * @param[in] task specifies the capture task control block - * @param[in] events specifies the events - * - * @retval This method returns true if this data should be filtered from the - * log. It returns false if this data should be logged. - */ -bool rtems_capture_filter (rtems_tcb* task, uint32_t events); - -/** - * @brief Capture returns the current time. - * - * This function returns the current time. If a handler is provided - * by the user the time is gotten from that. - * - * @param[in] time specifies the capture time - * - * @retval This method returns a nano-second time if no user handler - * is provided. Otherwise, it returns a resolution defined by the handler. - */ -void rtems_capture_get_time (rtems_capture_time* time); - -/** - * @brief Capture get event text. - * - * This function returns a string for an event based on the bit in the - * event. The functions takes the bit offset as a number not the bit - * set in a bit map. - * - * @param[in] event specifies the event to describe - * - * @retval This method returns a string description of the given event. - */ -const char* rtems_capture_event_text (int event); - -/** - * @brief Capture initialize task - * - * This function initializes capture control in the tcb. - * - * @param[in] tcb is the task control block for the task - */ -void rtems_capture_initialize_task (rtems_tcb* tcb); - -/** - * @brief Capture record task. - * - * This function records a new capture task record. - * - * @param[in] tcb is the task control block for the task - */ -void rtems_capture_record_task (rtems_tcb* tcb); - -/** - * @brief Capture record lock. - * - * This does a lock acquire which will remain in effect until - * rtems_capture_record_unlock is called. - * - * @param[out] context specifies the record context - */ -void rtems_capture_record_lock (rtems_capture_record_lock_context* context); - -/** - * @brief Capture record unlock. - * - * This unlocks the record lock. - * - * @param[in] context specifies the record context - */ -void rtems_capture_record_unlock (rtems_capture_record_lock_context* context); - -/** - * @brief Capture record open. - * - * This function allocates a record and fills in the header information. It - * does a lock acquire which will remain in effect until - * rtems_capture_record_close is called. The size is the amount of user data - * being recorded. The record header is internally managed. - * - * @param[in] task specifies the caputre task block - * @param[in] events specifies the events - * @param[in] size specifies the user's capture data size - * @param[out] context specifies the record context - * - * @retval This method returns a pointer to the next location in - * the capture record to store data. - */ -void* rtems_capture_record_open (rtems_tcb* task, - uint32_t events, - size_t size, - rtems_capture_record_lock_context* context); - -/** - * @brief Capture record close. - * - * This function closes writing to capure record and releases the lock that was - * held on the per CPU buffer. - * - * @param[out] context specifies the record context - */ -void rtems_capture_record_close (rtems_capture_record_lock_context* context); - -/** - * @brief Capture append to record to the per CPU buffer. - * - * This function appends data of a specifed size into a capture buffer. - * - * @param[in] rec specifies the next write point in the capture record - * @param[in] data specifies the data to write - * @param[in] size specifies the size of the data - * - * @retval This method returns the next write point in the capture record. - */ -static inline void* -rtems_capture_record_append (void* rec, const void* data, size_t size) -{ - memcpy (rec, data, size); - return ((uint8_t*) rec) + size; -} - -/** - * @brief Capture read a record from the per CPU buffer. - * - * This function reads data of a specifed size from a capture buffer. - * - * @param[in] rec specifies the next read point in the capture record - * @param[in] data specifies where to write the data - * @param[in] size specifies the size of the data - * - * @retval This method returns the next write point in the capture record. - */ -static inline void* -rtems_capture_record_extract (const void* rec, void* data, size_t size) -{ - memcpy (data, rec, size); - return ((uint8_t*) rec) + size; -} - -/** - * @brief Capture task recorded - * - * This function returns true if this task information has been - * recorded. - * - * @param[in] tcb is the task control block for the task - */ -static inline bool rtems_capture_task_recorded (rtems_tcb* tcb) { - return ((tcb->Capture.flags & RTEMS_CAPTURE_RECORD_TASK) != 0); -} - -/** - * @brief Capture task initialized - * - * This function returns true if this task information has been - * initialized. - * - * @param[in] tcb is the task control block for the task - */ -static inline bool rtems_capture_task_initialized (rtems_tcb* tcb) { - return ((tcb->Capture.flags & RTEMS_CAPTURE_INIT_TASK) != 0); -} - -/** - * @brief Capture get task id. - * - * This function returns the task id. - * - * @param[in] task The capture task. - * - * @retval This function returns the task id. - */ -static inline rtems_id -rtems_capture_task_id (rtems_tcb* tcb) -{ - return tcb->Object.id; -} - -/** - * @brief Capture get task API. - * - * This function returns the task API as an int. - * - * @param[in] task The capture task. - * - * @retval This function returns the task API as an int. - */ -static inline int -rtems_capture_task_api (rtems_id id) -{ - return _Objects_Get_API (id); -} - -/** - * @brief Capture get task state. - * - * This function returns the task state. - * - * @param[in] task The capture task. - * - * @retval This function returns the task state. - */ -static inline States_Control -rtems_capture_task_state (rtems_tcb* tcb) -{ - if (tcb) - return tcb->current_state; - return 0; -} - -/** - * @brief Capture get task name. - * - * This function returns the task name. - * - * @param[in] task The capture task. - * - * @retval This function returns the task name. - */ -static inline rtems_name -rtems_capture_task_name (rtems_tcb* tcb) -{ - rtems_name name; - rtems_object_get_classic_name( tcb->Object.id, &name ); - return name; -} - -/** - * @brief Capture get task flags. - * - * This function returns the task flags. - * - * @param[in] task The capture task. - * - * @retval This function returns the task flags. - */ -static inline uint32_t -rtems_capture_task_flags (rtems_tcb* tcb) -{ - return tcb->Capture.flags; -} - -/** - * @brief Capture get task control - * - * This function returns the task control if present. - * - * @param[in] task The capture task. - * - * @retval This function returns the task control if present. - */ -static inline rtems_capture_control* -rtems_capture_task_control (rtems_tcb* tcb) -{ - return tcb->Capture.control; -} - -/** - * @brief Capture get task control flags. - * - * This function returns the task control flags if a control is present. - * - * @param[in] task The capture task. - * - * @retval This function returns the task control flags if a control is present. - */ -static inline uint32_t -rtems_capture_task_control_flags (rtems_tcb* tcb) -{ - rtems_capture_control* control = tcb->Capture.control; - if (!control) - return 0; - return control->flags; -} - -/** - * @brief Capture get task start priority. - * - * This function returns the tasks start priority. The tracer needs this - * to track where the task's priority goes. - * - * @param[in] task The capture task. - * - * @retval This function returns the tasks start priority. The tracer needs this - * to track where the task's priority goes. - */ -static inline rtems_task_priority -rtems_capture_task_start_priority (rtems_tcb* tcb) -{ - return _RTEMS_Priority_From_core (_Thread_Scheduler_get_home( tcb ), - tcb->Start.initial_priority); -} - -/** - * @brief Capture get task real priority. - * - * This function returns the tasks real priority. - * - * @param[in] task The capture task. - * - * @retval This function returns the tasks real priority. - */ -static inline rtems_task_priority -rtems_capture_task_real_priority (rtems_tcb* tcb) -{ - return tcb->Real_priority.priority; -} - -/** - * @brief Capture get task current priority. - * - * This function returns the tasks current priority. - * - * @param[in] task The capture task. - * - * @retval This function returns the tasks current priority. - */ -static inline rtems_task_priority -rtems_capture_task_curr_priority (rtems_tcb* tcb) -{ - return _Thread_Get_priority (tcb); -} - -/** - * @brief Capture get control list. - * - * This function returns the head of the list of controls in the - * capture engine. - * - * @retval This function returns the head of the list of controls in the - * capture engine. - */ -rtems_capture_control* -rtems_capture_get_control_list (void); - -/** - * @brief Capture get next capture control. - * - * This function returns the pointer to the next control in the list. The - * pointer NULL terminates the list. - * - * @param[in] control the current capture control. - * - * @retval This function returns the pointer to the next control in the list. The - * pointer NULL terminates the list. - */ -static inline rtems_capture_control* -rtems_capture_next_control (rtems_capture_control* control) -{ - return control->next; -} - -/** - * @brief Capture get capture control id. - * - * This function returns the control id. - * - * @param[in] control the capture control. - * - * @retval This function returns the control id. - */ -static inline rtems_id -rtems_capture_control_id (rtems_capture_control* control) -{ - return control->id; -} - -/** - * @brief Capture get capture control name. - * - * This function returns the control name. - * - * @param[in] control the capture control. - * - * @retval This function returns the control name. - */ -static inline rtems_name -rtems_capture_control_name (rtems_capture_control* control) -{ - return control->name; -} - -/** - * @brief Capture get capture control flags. - * - * This function returns the control flags. - * - * @param[in] control the capture control. - * - * @retval This function returns the control flags. - */ -static inline uint32_t -rtems_capture_control_flags (rtems_capture_control* control) -{ - return control->flags; -} - -/** - * @brief Capture get capture control to triggers. - * - * This function returns the task control to triggers. - * - * @param[in] control the capture control. - * - * @retval This function returns the task control to triggers. - */ -static inline uint32_t -rtems_capture_control_to_triggers (rtems_capture_control* control) -{ - return control->to_triggers; -} - -/** - * @brief Capture get capture control from triggers. - * - * This function returns the task control from triggers. - * - * @param[in] control the capture control. - * - * @retval This function returns the task control from triggers. - */ -static inline uint32_t -rtems_capture_control_from_triggers (rtems_capture_control* control) -{ - return control->from_triggers; -} - -/** - * @brief Capture get capture control by triggers. - * - * This function returns the task control by triggers. - * - * @param[in] control the capture control. - * - * @retval This function returns the task control by triggers. - */ -static inline uint32_t -rtems_capture_control_all_by_triggers (rtems_capture_control* control) -{ - return control->by_triggers; -} - -/** - * @brief Capture get capture control valid by flags. - * - * This function returns the control valid BY flags. - * - * @param[in] control The capture control. - * @param[in] slot The slot. - * - * @retval This function returns the control valid BY flags. - */ -static inline int -rtems_capture_control_by_valid (rtems_capture_control* control, int slot) -{ - return control->by_valid & RTEMS_CAPTURE_CONTROL_FROM_MASK (slot); -} - -/** - * @brief Capture get capture control by task name. - * - * This function returns the control @a by task name. - * - * @param[in] control The capture control. - * @param[in] by The by index. - * - * @retval This function returns the control @a by task name. - */ -static inline rtems_name -rtems_capture_control_by_name (rtems_capture_control* control, int by) -{ - if (by < RTEMS_CAPTURE_TRIGGER_TASKS) - return control->by[by].name; - return control->by[0].name; -} - -/** - * @brief Capture get capture control by task id. - * - * This function returns the control @a by task id - * - * @retval This function returns the control @a by task id. - */ -static inline rtems_id -rtems_capture_control_by_id (rtems_capture_control* control, int by) -{ - if (by < RTEMS_CAPTURE_TRIGGER_TASKS) - return control->by[by].id; - return control->by[0].id; -} - -/** - * @brief Capture get capture control by task triggers. - * - * This function returns the control @a by task triggers. - * - * @retval This function returns the control @a by task triggers. - */ -static inline uint32_t -rtems_capture_control_by_triggers (rtems_capture_control* control, - int by) -{ - if (by < RTEMS_CAPTURE_TRIGGER_TASKS) - return control->by[by].trigger; - return control->by[0].trigger; -} - -/** - * @brief Capture get capture control count. - * - * This function returns the number of controls the capture - * engine has. - * - * @retval This function returns the number of controls the capture - * engine has. - */ -static inline uint32_t -rtems_capture_control_count (void) -{ - rtems_capture_control* control = rtems_capture_get_control_list (); - uint32_t count = 0; - - while (control) - { - count++; - control = rtems_capture_next_control (control); - } - - return count; -} - -#ifdef __cplusplus -} -#endif -/**@}*/ - -#endif diff --git a/cpukit/libmisc/capture/captureimpl.h b/cpukit/libmisc/capture/captureimpl.h deleted file mode 100644 index 4c4cbe66c3..0000000000 --- a/cpukit/libmisc/capture/captureimpl.h +++ /dev/null @@ -1,185 +0,0 @@ -/** - * @file rtems/captureimpl.h - * - * @brief Capture Implementation file - * - * This file contains an interface between the capture engine and - * capture user extension methods. - */ - -/* - ------------------------------------------------------------------------ - - Copyright 2002, 2016 Chris Johns <chrisj@rtems.org>. - All rights reserved. - - 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. - - This software with is provided ``as is'' and with NO WARRANTY. - - ------------------------------------------------------------------------ - - RTEMS Performance Monitoring and Measurement Framework. - This is the Capture Engine component. - -*/ - -#ifndef __CAPTUREIMPL_H_ -#define __CAPTUREIMPL_H_ - -#include "capture.h" - -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Capture set extension index. - * - * This function is used to set the extension index - * for the capture engine. - * - * @param[in] index specifies the extension index to be - * used for capture engine data. - */ -void rtems_capture_set_extension_index(int index); - -/** - * @brief Capture get extension index. - * - * This function rturns the extension index for the - * capture engine. - * - * @retval This method returns the extension index. - */ -int rtems_capture_get_extension_index(void); - -/** - * @brief Capture get flags. - * - * This function gets the current flag settings - * for the capture engine. - * - * @retval This method returns the global capture - * flags. - * - */ -uint32_t rtems_capture_get_flags(void); - -/** - * @brief Capture set flags. - * - * This function sets a flag in the capture engine - * - * @param[in] mask specifies the flag to set - */ -void rtems_capture_set_flags(uint32_t mask); - -/** - * @brief Capture user extension open. - * - * This function creates the capture user extensions. - * - * - * @retval This method returns RTEMS_SUCCESSFUL upon successful - * creation of the user extensions. - */ -rtems_status_code rtems_capture_user_extension_open(void); - -/** - * @brief Capture user extension close. - * - * This function closes the capture user extensions. - * - * @retval This method returns RTEMS_SUCCESSFUL upon a successful - * delete of the user extensions. - */ -rtems_status_code rtems_capture_user_extension_close(void); - -/** - * @brief Capture check trigger. - * - * This function checks if we have triggered or if this event is a - * cause of a trigger. - * - * @param[in] ft specifies specifices the capture from task - * @param[in] tt specifies specifices the capture to task - * @param[in] events specifies the events - * - * @retval This method returns true if we have triggered or - * if the event is a cause of a trigger. - */ -bool rtems_capture_trigger_fired (rtems_tcb* ft, - rtems_tcb* tt, - uint32_t events); - -/** - * @brief Capture print trace records. - * - * This function reads, prints and releases up to - * total trace records in either a csv format or an - * ascii table format. - * - * @param[in] total specifies the number of records to print - * @param[in] csv specifies a comma seperated value format - */ -void rtems_capture_print_trace_records ( int total, bool csv ); - -/** - * @brief Capture print timestamp. - * - * This function prints uptime in a timestamp format. - * - * @param[in] uptime specifies the timestamp to print - */ -void rtems_capture_print_timestamp (uint64_t uptime); - -/** - * @brief Capture print record task. - * - * This function prints a capture record task. This - * record contains information to identify a task. It - * is refrenced in other records by the task id. - * - * @param[in] cpu specifies the cpu the cpu the record was logged on. - * @param[in] rec specifies the task record. - */ -void rtems_capture_print_record_task(int cpu, - const rtems_capture_record* rec, - const rtems_capture_task_record* task_rec); - -/** - * @brief Capture print capture record. - * - * This function prints a user extension - * capture record. - * - * @param[in] cpu specifies the cpu the cpu the record was logged on. - * @param[in] rec specifies the record. - * @param[in] diff specifies the time between this and the last capture record. - * @param[in] name specifies the name of the task, NULL if none. - * @param[in] task_count number of tasks to search for. - */ -void rtems_capture_print_record_capture(int cpu, - const rtems_capture_record* rec, - uint64_t diff, - const rtems_name* name); - -/** - * @brief Capture print watch list - * - * This function prints a capture watch list - */ -void rtems_capture_print_watch_list (void); - -#ifdef __cplusplus -} -#endif -/**@}*/ - -#endif diff --git a/cpukit/libmisc/capture/rtems-trace-buffer-vars.h b/cpukit/libmisc/capture/rtems-trace-buffer-vars.h deleted file mode 100644 index 8f0ff08587..0000000000 --- a/cpukit/libmisc/capture/rtems-trace-buffer-vars.h +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @file - * - * @ingroup Shell - * - * @brief Access to the RTEMS Trace Buffer Generator (TBG). - */ -/* - * Copyright (c) 2015 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. - */ - -#if !defined (_RTEMS_TRACE_BUFFER_VARS_H_) -#define _RTEMS_TRACE_BUFFER_VARS_H_ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * These functions are provided as a separated interface to the Trace Buffer - * Generatror (TBG) data are not really designed for any real-time performance - * type interface. - * - * Separating the data from the codes stops the compiler incorrectly loop - * optimising. - */ - -typedef struct -{ - uint32_t size; - const char* const type; -} __rtld_trace_sig_arg; - - typedef struct { - uint32_t argc; - const __rtld_trace_sig_arg* args; -} __rtld_trace_sig; - -typedef __rtld_trace_sig_arg rtems_trace_sig_arg; -typedef __rtld_trace_sig rtems_trace_sig; - -/** - * Returns the number of trace functions. - */ -uint32_t rtems_trace_names_size (void); - -/** - * Return the name given an index. No range checking. - */ -const char* rtems_trace_names (const uint32_t index); - -/** - * Returns the number of words in the enables array. - */ -uint32_t rtems_trace_enables_size (void); - -/** - * Return the enable 32bit bitmap indexed into the enables array. No range - * checking. - */ -uint32_t rtems_trace_enables (const uint32_t index); - -/** - * Returns the number of words in the triggers array. - */ -uint32_t rtems_trace_triggers_size (void); - -/** - * Return the trigger 32bit bitmap indexed into the triggers array. No range - * checking. - */ -uint32_t rtems_trace_triggers (const uint32_t index); - -/** - * Return the trace function signature. - */ -const rtems_trace_sig* rtems_trace_signatures (const uint32_t index); - -/** - * Return true is the enable bit is set for the trace function index. - */ -bool rtems_trace_enable_set(const uint32_t index); - -/** - * Return true is the trigger bit is set for the trace function index. - */ -bool rtems_trace_trigger_set(const uint32_t index); - -/** - * The application has been linked with Trace Buffering generated code. - */ -bool rtems_trace_buffering_present (void); - -/** - * Return the trace buffering mode flags. - */ -uint32_t rtems_trace_buffering_mode (void); - -/** - * Return the size of the trace buffering buffer in words. - */ -uint32_t rtems_trace_buffering_buffer_size (void); - -/** - * Return the base of the trace buffering buffer. - */ -uint32_t* rtems_trace_buffering_buffer (void); - -/** - * Return the buffer level. This is only stable if tracing has finished. - */ -uint32_t rtems_trace_buffering_buffer_in (void); - -/** - * The tracing has finished. - */ -bool rtems_trace_buffering_finished (void); - -/** - * Trace has been triggered and enable trace functions are being recorded. - */ -bool rtems_trace_buffering_triggered (void); - -/** - * Start tracing by clearing the triggered flag, setting to 0 and clearing the - * finished flag. - */ -void rtems_trace_buffering_start (void); - -/** - * Stop tracing by setting the finished flag. - */ -void rtems_trace_buffering_stop (void); - -/** - * Resume tracing by setting the finished flag. - */ -void rtems_trace_buffering_resume (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/cpukit/libmisc/cpuuse/cpuuse.h b/cpukit/libmisc/cpuuse/cpuuse.h deleted file mode 100644 index 23f58faf1b..0000000000 --- a/cpukit/libmisc/cpuuse/cpuuse.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file rtems/cpuuse.h - * - * @defgroup libmisc_cpuuse CPU Usage - * - * @ingroup libmisc - * @brief CPU Usage Report - * - * This include file contains information necessary to utilize - * and install the cpu usage reporting mechanism. - */ - -/* - * 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_CPUUSE_h -#define __RTEMS_CPUUSE_h - -#include <rtems.h> -#include <rtems/print.h> - -/** - * @defgroup libmisc_cpuuse CPU Usage - * - * @ingroup libmisc - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/* - * rtems_cpu_usage_report_with_handler - */ - -void rtems_cpu_usage_report_with_plugin( const rtems_printer *printer ); - -/** - * @brief Report CPU usage. - * - * CPU Usage Reporter - */ - -void rtems_cpu_usage_report( void ); - -/** - * @brief CPU usage Top plugin - * - * Report CPU Usage in top format to - * to a print plugin. - */ -void rtems_cpu_usage_top_with_plugin( const rtems_printer *printer ); - -/** - * @brief CPU usage top. - * - * CPU Usage top - */ - -void rtems_cpu_usage_top( void ); - -/** - * @brief Reset CPU usage. - * - * CPU Usage Reporter - */ - -void rtems_cpu_usage_reset( void ); - -/** - * @brief Reports per-processor information. - * - * @return The number of characters printed. - */ -int rtems_cpu_info_report( const rtems_printer *printer ); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif -/* end of include file */ diff --git a/cpukit/libmisc/devnull/devnull.h b/cpukit/libmisc/devnull/devnull.h deleted file mode 100644 index 39081f478b..0000000000 --- a/cpukit/libmisc/devnull/devnull.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file - * - * @brief RTEMS /dev/null Device Driver - * - * This include file defines the interface to the RTEMS /dev/null - * device driver. - */ - -/* - * Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de) - * - * COPYRIGHT (c) 1989-2000. - * 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_DEVNULL_H -#define _RTEMS_DEVNULL_H - -#include <rtems/io.h> - -/** - * @defgroup libmisc_devnull Null Device Driver - * - * @ingroup libmisc - */ -/**@{*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define DEVNULL_DRIVER_TABLE_ENTRY \ - { null_initialize, null_open, null_close, null_read, \ - null_write, null_control } - -#define NULL_SUCCESSFUL RTEMS_SUCCESSFUL - -rtems_device_driver null_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver null_open( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver null_close( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver null_read( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver null_write( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver null_control( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif -/* end of include file */ diff --git a/cpukit/libmisc/devnull/devzero.h b/cpukit/libmisc/devnull/devzero.h deleted file mode 100644 index bc47d3ea09..0000000000 --- a/cpukit/libmisc/devnull/devzero.h +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file rtems/devzero.h - * - * @brief RTEMS /dev/zero Device Driver - * - * This include file defines the interface to the RTEMS /dev/zero - * device driver. - */ - -/* - * Copyright (c) 2011 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_DEVZERO_H -#define _RTEMS_DEVZERO_H - -#include <rtems/io.h> - -/** - * @defgroup libmisc_devzero Zero Device Driver - * - * @ingroup libmisc - */ -/**@{*/ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define DEVZERO_DEVICE_NAME "/dev/zero" - -#define DEVZERO_DRIVER_TABLE_ENTRY \ - { \ - dev_zero_initialize, \ - dev_zero_open, \ - dev_zero_close, \ - dev_zero_read, \ - dev_zero_write, \ - dev_zero_control \ - } - -rtems_device_driver dev_zero_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -rtems_device_driver dev_zero_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -rtems_device_driver dev_zero_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -rtems_device_driver dev_zero_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -rtems_device_driver dev_zero_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -rtems_device_driver dev_zero_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -/**@}*/ -#endif /* _RTEMS_DEVZERO_H */ diff --git a/cpukit/libmisc/dumpbuf/dumpbuf.h b/cpukit/libmisc/dumpbuf/dumpbuf.h deleted file mode 100644 index d714879ab4..0000000000 --- a/cpukit/libmisc/dumpbuf/dumpbuf.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file - * - * @brief Print a Memory Buffer - * - * This file defines the interface to the RTEMS methods to print a - * memory buffer in a style similar to many ROM monitors and debuggers. - */ - -/* - * COPYRIGHT (c) 1997-2011. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef __DUMP_BUFFER_h -#define __DUMP_BUFFER_h - -/** - * @defgroup libmisc_dumpbuf Print Memory Buffer - * - * @ingroup libmisc - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Print memory buffer. - * - * This method prints @a length bytes beginning at @a buffer in - * a nice format similar to what one would expect from a debugger - * or ROM monitor. - * - * @param[in] buffer is the address of the buffer - * @param[in] length is the length of the buffer - */ -void rtems_print_buffer( - const unsigned char *buffer, - int length -); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif -/* end of include file */ diff --git a/cpukit/libmisc/fb/fb.h b/cpukit/libmisc/fb/fb.h deleted file mode 100644 index bb5cb23805..0000000000 --- a/cpukit/libmisc/fb/fb.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @file rtems/fb.h - * - * @brief Frame Buffer Device Driver - * - * This file defines the interface to a frame buffer device driver. - */ - -/* - * Copyright (c) 2000 - Rosimildo da Silva - */ - -#ifndef _MW_FB_H -#define _MW_FB_H - -#include <stdint.h> - -/** - * @defgroup libmisc_fb Frame Buffer Device Driver Interface - * - * @ingroup Device Drivers and Frameworks - */ -/**@{*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ioctls - 0x46 is 'F' */ -#define FBIOGET_VSCREENINFO 0x4600 -#define FBIOPUT_VSCREENINFO 0x4601 -#define FBIOGET_FSCREENINFO 0x4602 -#define FBIOGETCMAP 0x4604 -#define FBIOPUTCMAP 0x4605 -#define FB_EXEC_FUNCTION 0x4606 -#define FBIOSWAPBUFFERS 0x4607 -#define FBIOSETBUFFERMODE 0x4608 -#define FBIOSETVIDEOMODE 0x4609 - -#define FB_SINGLE_BUFFERED 0 -#define FB_TRIPLE_BUFFERED 1 - -#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ -#define FB_TYPE_PLANES 1 /* Non interleaved planes */ -#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ -#define FB_TYPE_TEXT 3 /* Text/attributes */ -#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ -#define FB_TYPE_VIRTUAL_BUFFER 5 /* Virtual Buffer */ - - -#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ -#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ -#define FB_VISUAL_TRUECOLOR 2 /* True color */ -#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ -#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ -#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ - -#define FB_ACCEL_NONE 0 /* no hardware accelerator */ - -struct fb_bitfield { - uint32_t offset; /* beginning of bitfield */ - uint32_t length; /* length of bitfield */ - uint32_t msb_right; /* != 0 : Most significant bit is */ - /* right */ -}; - -struct fb_var_screeninfo { - uint32_t xres; /* visible resolution */ - uint32_t yres; - uint32_t bits_per_pixel; /* guess what */ - struct fb_bitfield red; /* bitfield in fb mem if true color, */ - struct fb_bitfield green; /* else only length is significant */ - struct fb_bitfield blue; - struct fb_bitfield transp; /* transparency */ -}; - -struct fb_fix_screeninfo { - volatile char *smem_start; /* Start of frame buffer mem */ - /* (physical address) */ - uint32_t smem_len; /* Length of frame buffer mem */ - uint32_t type; /* see FB_TYPE_* */ - uint32_t visual; /* see FB_VISUAL_* */ - uint32_t line_length; /* number of chars per line */ -}; - -struct fb_cmap { - uint32_t start; /* First entry */ - uint32_t len; /* Number of entries */ - uint16_t *red; /* Red values */ - uint16_t *green; - uint16_t *blue; - uint16_t *transp; /* transparency, can be NULL */ -}; - -#ifdef __cplusplus -} -#endif -/**@}*/ - -#endif /* _MW_FB_H */ diff --git a/cpukit/libmisc/fb/mw_uid.h b/cpukit/libmisc/fb/mw_uid.h deleted file mode 100644 index aa88392d26..0000000000 --- a/cpukit/libmisc/fb/mw_uid.h +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @file rtems/mw_uid.h - * - * @defgroup libmisc_fb_mw Input Devices for MicroWindows - * - * @ingroup libmisc - * @brief Input Devices for MicroWindows - * - * This file defines the interface for input devices used by MicroWindows - * in an embedded system environment. - */ - -/* - * Copyright (c) 2000 - Rosimildo da Silva - */ - -#ifndef _MW_UID_H -#define _MW_UID_H - -#include <sys/types.h> -#include <rtems/print.h> - -/** - * @defgroup libmisc_fb_mw Input Devices for MicroWindows - * - * @ingroup libmisc - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/* 0x41XX -- IOCTL functions for the Micro Input Devices commands */ -#define MW_UID_REGISTER_DEVICE 0x4100 -#define MW_UID_UNREGISTER_DEVICE 0x4101 - -/* devices supported by MicroWindows */ -enum MW_INPUT_DEVICE_TYPE { - MV_UID_INVALID = 0, - MV_UID_REL_POS = 1, /* mouse */ - MV_UID_ABS_POS = 2, /* touch-screen */ - MV_UID_KBD = 3, /* keyboard */ - MV_UID_TIMER = 4 /* timer -- not used */ -}; - -/* matching MicroWindows */ -#define MV_BUTTON_RIGHT 0x01 -#define MV_BUTTON_CENTER 0x02 -#define MV_BUTTON_LEFT 0x04 - -/* modifiers of the keyboard type devices */ -#define MV_KEY_MODIFIER_SHIFT_DOWN 0x10 -#define MV_KEY_MODIFIER_ALT_DOWN 0x20 - -/* indication of the LEDS */ -#define MV_KEY_MODIFIER_CAPS_ON 0x04 -#define MV_KEY_MODIFIER_NUN_LOCK_ON 0x02 -#define MV_KEY_SCROLL_LOCK_ON 0x01 - -/* keyboard modes -- default ASCII */ -#define MV_KEY_MODE_ASCII 0x01 -/* - * This mode one event is sent when a key is pressed, - * and another one is send when a key is released. - */ -#define MV_KEY_MODE_SCANCODE 0x00 - -/* these defines match with the linux keyboard range - * for ioctls functions for the keyboard interface. - * 0x4BXX --- keyboard related functions - */ -#define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */ -#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */ - -/* - * Message generated by input devices controlled by MicroWindows. - */ -struct MW_UID_MESSAGE { - enum MW_INPUT_DEVICE_TYPE type; /* device type */ - union { - /* fired when keyboard events are raised */ - struct kbd_t { - unsigned short code; /* keycode or scancode */ - unsigned char modifiers; /* key modifiers */ - unsigned char mode; /* current Kbd mode */ - } kbd; - - /* fired when position events are raised, mouse, touch screen, etc */ - struct pos_t { - unsigned short btns; /* indicates which buttons are pressed */ - short x; /* x location */ - short y; /* y location */ - short z; /* z location, 0 for 2D */ - } pos; - - /* fired by a timer device periodically */ - struct timer_t { - unsigned long frt; /* free running timer */ - unsigned long seq; /* sequence number */ - } tmr; - } m; -}; - - -/* - * API for creating/closing/accessing the message queue used by the micro - * input device interface. All functions in this interface returns a - * zero ( 0 ) on success. One exception for that is the "read" routine - * that returns the number of bytes read. Negaive numbers indicate errors - * - * The implementation of the message queue for RTEMS uses a POSIX message - * queue interface. It should be very portable among systems with a POSIX - * support. - */ - -/** - * This method creates the message queue that holds events from the - * input devices. - * - * @param[in] q_name is the name of the message queue - * @param[in] flags controls the behaviour of the queue - * @param[in] max_msgs specifies the maximum number of pending messages - * - * @note The message queue is from the Classic API. - * - * @retval This method returns 0 on success and -1 on error. - */ -extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs ); - -/** - * This method closes the message queue and deletes it. - * - * @retval This method returns 0 on success and -1 on error. - */ -extern int uid_close_queue( void ); - -/** - * This method reads a message from the queue. It waits up to the specified - * timeout in miliseconds. A @a timeout of 0 is a poll. - * - * @param[in] m will be filled in with the received message - * @param[in] timeout is the maximum number of mulliseconds to wait - * - * @retval This method returns 0 on success and -1 on error. - */ -extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout ); - -/** - * This methods writes a message to the queue. - * - * @param[in] m is the message to send - * - * @retval This method returns 0 on success and -1 on error. - */ -extern int uid_send_message( struct MW_UID_MESSAGE *m ); - -/** - * This method registers the device associated with @a fd to - * to insert data to the queue - */ -extern int uid_register_device( int fd, const char *q_name ); - -/* unregister device to stop adding messages to the queue */ -extern int uid_unregister_device( int fd ); - -/* set the keyboard */ -extern int uid_set_kbd_mode( int fd, int mode, int *old_mode ); - -/** - * This methods prints the specified UID message using printk - * - * @param[in] uid points to the message to print - */ -void uid_print_message( - struct MW_UID_MESSAGE *uid -); - -/** - * This methods prints the specified UID message using your fprintf - * style method of choice. - * - * @param[in] RTEMS printer - * @param[in] uid points to the message to print - */ -void uid_print_message_with_plugin( - const rtems_printer *printer, - struct MW_UID_MESSAGE *uid -); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif /* _MW_UID_H */ diff --git a/cpukit/libmisc/fsmount/fsmount.h b/cpukit/libmisc/fsmount/fsmount.h deleted file mode 100644 index 441b0d68ef..0000000000 --- a/cpukit/libmisc/fsmount/fsmount.h +++ /dev/null @@ -1,211 +0,0 @@ -/** - * @file rtems/fsmount.h - * - * @defgroup rtems_fstab File System Mount Support - * - * @ingroup FileSystemTypesAndMount - * @brief File System Mount Functions - * - * This file contains the fsmount functions. These functions - * are used to mount a list of filesystems (and create their mount - * points before). - */ - -/* - * Copyright (c) 2003 IMD - * - * Ingenieurbuero fuer Microcomputertechnik Th. Doerfler - * <Thomas.Doerfler@imd-systems.de> - * all rights reserved - * - * 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 _FSMOUNT_H -#define _FSMOUNT_H - -#include <rtems.h> -#include <rtems/libio.h> -#include <rtems/libcsupport.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup rtems_fstab File System Mount Support - * - * @ingroup FileSystemTypesAndMount - */ -/**@{**/ - -/** - * File system mount report and abort condition flags. - * - * The flags define, which conditions will cause a report during the mount - * process (via printf()) or abort the mount process. - * - * @see rtems_fstab_entry and rtems_fsmount(). - */ -typedef enum { - /** - * No conditions. - */ - RTEMS_FSTAB_NONE = 0U, - - /** - * Complete mount process was successful. - */ - RTEMS_FSTAB_OK = 0x1U, - - /** - * Mount point creation failed. - */ - RTEMS_FSTAB_ERROR_MOUNT_POINT = 0x2U, - - /** - * File system mount failed. - */ - RTEMS_FSTAB_ERROR_MOUNT = 0x4U, - - /** - * Something failed. - */ - RTEMS_FSTAB_ERROR = RTEMS_FSTAB_ERROR_MOUNT_POINT | RTEMS_FSTAB_ERROR_MOUNT, - - /** - * Any condition. - */ - RTEMS_FSTAB_ANY = RTEMS_FSTAB_OK | RTEMS_FSTAB_ERROR -} rtems_fstab_conditions; - -/** - * File system table entry. - */ -typedef struct { - /** - * Source for the mount. - */ - const char *source; - - /** - * Target for the mount. - */ - const char *target; - - /** - * File system operations. - */ - const char *type; - - /** - * File system mount options. - */ - rtems_filesystem_options_t options; - - /** - * Report @ref rtems_fstab_conditions "condition flags". - */ - uint16_t report_reasons; - - /** - * Abort @ref rtems_fstab_conditions "condition flags". - */ - uint16_t abort_reasons; -} rtems_fstab_entry; - -/** - * @brief Mounts the file systems listed in the file system mount table. - * - * Mounts the file systems listed in the file system mount table @a fstab of - * size @a size. - * - * Each file system will be mounted according to its table entry parameters. - * In case of an abort condition the corresponding table index will be reported - * in @a abort_index. The pointer @a abort_index may be @c NULL. The mount - * point paths will be created with rtems_mkdir() and need not exist - * beforehand. - * - * On success, zero is returned. On error, -1 is returned, and @c errno is set - * appropriately. - * - * @see rtems_bdpart_register_from_disk(). - * - * The following example code tries to mount a FAT file system within a SD - * Card. Some cards do not have a partition table so at first it tries to find - * a file system inside the hole disk. If this is successful the mount process - * will be aborted because the @ref RTEMS_FSTAB_OK condition is true. If this - * did not work it tries to mount the file system inside the first partition. - * If this fails the mount process will not be aborted (this is already the - * last entry), but the last error status will be returned. - * - * @code - * #include <stdio.h> - * #include <string.h> - * #include <errno.h> - * - * #include <rtems.h> - * #include <rtems/bdpart.h> - * #include <rtems/error.h> - * #include <rtems/fsmount.h> - * - * static const rtems_fstab_entry fstab [] = { - * { - * .source = "/dev/sd-card-a", - * .target = "/mnt", - * .type = "dosfs", - * .options = RTEMS_FILESYSTEM_READ_WRITE, - * .report_reasons = RTEMS_FSTAB_ANY, - * .abort_reasons = RTEMS_FSTAB_OK - * }, { - * .source = "/dev/sd-card-a1", - * .target = "/mnt", - * .type = "dosfs", - * .options = RTEMS_FILESYSTEM_READ_WRITE, - * .report_reasons = RTEMS_FSTAB_ANY, - * .abort_reasons = RTEMS_FSTAB_NONE - * } - * }; - * - * static void my_mount(void) - * { - * rtems_status_code sc = RTEMS_SUCCESSFUL; - * int rv = 0; - * size_t abort_index = 0; - * - * sc = rtems_bdpart_register_from_disk("/dev/sd-card-a"); - * if (sc != RTEMS_SUCCESSFUL) { - * printf("read partition table failed: %s\n", rtems_status_text(sc)); - * } - * - * rv = rtems_fsmount(fstab, sizeof(fstab) / sizeof(fstab [0]), &abort_index); - * if (rv != 0) { - * printf("mount failed: %s\n", strerror(errno)); - * } - * printf("mount aborted at %zu\n", abort_index); - * } - * @endcode - */ -int rtems_fsmount( - const rtems_fstab_entry *fstab, - size_t size, - size_t *abort_index -); - -/** @} */ - -typedef rtems_fstab_entry fstab_t; - -#define FSMOUNT_MNT_OK RTEMS_FSTAB_OK - -#define FSMOUNT_MNTPNT_CRTERR RTEMS_FSTAB_ERROR_MOUNT_POINT - -#define FSMOUNT_MNT_FAILED RTEMS_FSTAB_ERROR_MOUNT - -#ifdef __cplusplus -} -#endif - -#endif /* _FSMOUNT_H */ diff --git a/cpukit/libmisc/monitor/monitor.h b/cpukit/libmisc/monitor/monitor.h deleted file mode 100644 index 6ecd903c63..0000000000 --- a/cpukit/libmisc/monitor/monitor.h +++ /dev/null @@ -1,528 +0,0 @@ -/** - * @file rtems/monitor.h - * - * @brief The RTEMS Monitor Task - */ - - -#ifndef __MONITOR_H -#define __MONITOR_H - -#include <rtems/score/objectimpl.h> -#include <rtems/error.h> /* rtems_error() */ -#include <rtems/config.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Forward decls from symbols.h */ -typedef struct _rtems_symbol_t rtems_symbol_t; -typedef struct _rtems_symbol_table_t rtems_symbol_table_t; - -/* - * Monitor types are derived from rtems object classes - */ - -typedef enum { - RTEMS_MONITOR_OBJECT_INVALID = OBJECTS_CLASSIC_NO_CLASS, - RTEMS_MONITOR_OBJECT_TASK = OBJECTS_RTEMS_TASKS, - RTEMS_MONITOR_OBJECT_EXTENSION = OBJECTS_RTEMS_EXTENSIONS, - RTEMS_MONITOR_OBJECT_QUEUE = OBJECTS_RTEMS_MESSAGE_QUEUES, - RTEMS_MONITOR_OBJECT_SEMAPHORE = OBJECTS_RTEMS_SEMAPHORES, - RTEMS_MONITOR_OBJECT_PARTITION = OBJECTS_RTEMS_PARTITIONS, - RTEMS_MONITOR_OBJECT_REGION = OBJECTS_RTEMS_REGIONS, - RTEMS_MONITOR_OBJECT_PORT = OBJECTS_RTEMS_PORTS, - - /* following monitor objects are not known to RTEMS, but - * we like to have "types" for them anyway */ - - RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_RTEMS_CLASSES_LAST+1, - RTEMS_MONITOR_OBJECT_DNAME, - RTEMS_MONITOR_OBJECT_CONFIG, - RTEMS_MONITOR_OBJECT_INIT_TASK, - RTEMS_MONITOR_OBJECT_MPCI, - RTEMS_MONITOR_OBJECT_SYMBOL, - #if defined(RTEMS_POSIX_API) - RTEMS_MONITOR_OBJECT_PTHREAD, - #endif -} rtems_monitor_object_type_t; - -/* - * rtems_monitor_init() flags - */ - -#define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */ -#define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */ -#define RTEMS_MONITOR_NOTASK 0x0004 /* do not start monitor task */ -#define RTEMS_MONITOR_NOSYMLOAD 0x0008 /* do not load symbols */ -#define RTEMS_MONITOR_WAITQUIT 0x0010 /* wait for monitor task to terminate */ - -/* - * Public interfaces for RTEMS data structures monitor is aware of. - * These are only used by the monitor. - * - * NOTE: - * All the canonical objects that correspond to RTEMS managed "objects" - * must have an identical first portion with 'id' and 'name' fields. - * - * Others do not have that restriction, even tho we would like them to. - * This is because some of the canonical structures are almost too big - * for shared memory driver (eg: mpci) and we are nickel and diming it. - */ - -/* - * Type of a pointer that may be a symbol - */ - -#define MONITOR_SYMBOL_LEN 20 -typedef struct { - char name[MONITOR_SYMBOL_LEN]; - uint32_t value; - uint32_t offset; -} rtems_monitor_symbol_t; - -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ -} rtems_monitor_generic_t; - -/* - * Task - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - char short_name[5]; - char long_name[16]; - Thread_Entry_information entry; - void *stack; - uint32_t stack_size; - char scheduler_name[5]; - rtems_task_priority priority; - States_Control state; - rtems_event_set events; - rtems_mode modes; - rtems_attribute attributes; - char wait[17]; - uint32_t ticks; -} rtems_monitor_task_t; - -/* - * Init task - */ - -typedef struct { - rtems_id id; /* not really an id */ - rtems_name name; - /* end of common portion */ - rtems_monitor_symbol_t entry; - uint32_t argument; - uint32_t stack_size; - rtems_task_priority priority; - rtems_mode modes; - rtems_attribute attributes; -} rtems_monitor_init_task_t; - - -/* - * Message queue - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - rtems_attribute attributes; - uint32_t number_of_pending_messages; - uint32_t maximum_pending_messages; - size_t maximum_message_size; -} rtems_monitor_queue_t; - -/* - * Semaphore - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - rtems_attribute attribute; - rtems_task_priority priority_ceiling; - uint32_t max_count; - uint32_t cur_count; - rtems_id holder_id; -} rtems_monitor_sema_t; - -/* - * Extension - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - rtems_monitor_symbol_t e_create; - rtems_monitor_symbol_t e_start; - rtems_monitor_symbol_t e_restart; - rtems_monitor_symbol_t e_delete; - rtems_monitor_symbol_t e_tswitch; - rtems_monitor_symbol_t e_begin; - rtems_monitor_symbol_t e_exitted; - rtems_monitor_symbol_t e_fatal; -} rtems_monitor_extension_t; - - /* - * Region - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - rtems_attribute attribute; - void * start_addr; - uint32_t length; - uint32_t page_size; - uint32_t max_seg_size; - uint32_t used_blocks; -} rtems_monitor_region_t; - -/* - * Partition - */ -typedef struct { - rtems_id id; - rtems_name name; - /* end of common portion */ - rtems_attribute attribute; - void * start_addr; - uint32_t length; - uint32_t buf_size; - uint32_t used_blocks; -} rtems_monitor_part_t; - -/* - * Device driver - */ - -typedef struct { - rtems_id id; /* not really an id (should be tho) */ - rtems_name name; /* ditto */ - /* end of common portion */ - rtems_monitor_symbol_t initialization; /* initialization procedure */ - rtems_monitor_symbol_t open; /* open request procedure */ - rtems_monitor_symbol_t close; /* close request procedure */ - rtems_monitor_symbol_t read; /* read request procedure */ - rtems_monitor_symbol_t write; /* write request procedure */ - rtems_monitor_symbol_t control; /* special functions procedure */ -} rtems_monitor_driver_t; - -/* - * System config - */ - -typedef struct { - void *work_space_start; - uint32_t work_space_size; - uint32_t maximum_tasks; - uint32_t maximum_timers; - uint32_t maximum_semaphores; - uint32_t maximum_message_queues; - uint32_t maximum_partitions; - uint32_t maximum_regions; - uint32_t maximum_ports; - uint32_t maximum_periods; - uint32_t maximum_extensions; - uint32_t microseconds_per_tick; - uint32_t ticks_per_timeslice; - uint32_t number_of_initialization_tasks; -} rtems_monitor_config_t; - -/* - * MPCI config - */ - -#if defined(RTEMS_MULTIPROCESSING) -typedef struct { - uint32_t node; /* local node number */ - uint32_t maximum_nodes; /* maximum # nodes in system */ - uint32_t maximum_global_objects; /* maximum # global objects */ - uint32_t maximum_proxies; /* maximum # proxies */ - - uint32_t default_timeout; /* in ticks */ - size_t maximum_packet_size; - rtems_monitor_symbol_t initialization; - rtems_monitor_symbol_t get_packet; - rtems_monitor_symbol_t return_packet; - rtems_monitor_symbol_t send_packet; - rtems_monitor_symbol_t receive_packet; -} rtems_monitor_mpci_t; -#endif - -/* - * The generic canonical information union - */ - -typedef union { - rtems_monitor_generic_t generic; - rtems_monitor_task_t task; - rtems_monitor_queue_t queue; - rtems_monitor_sema_t sema; - rtems_monitor_extension_t extension; - rtems_monitor_driver_t driver; - rtems_monitor_config_t config; - rtems_monitor_region_t region; - rtems_monitor_part_t part; -#if defined(RTEMS_MULTIPROCESSING) - rtems_monitor_mpci_t mpci; -#endif - rtems_monitor_init_task_t itask; -} rtems_monitor_union_t; - -/* - * Support for talking to other monitors - */ - -/* - * Names of other monitors - */ - -#define RTEMS_MONITOR_NAME (rtems_build_name('R', 'M', 'O', 'N')) -#define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V')) -#define RTEMS_MONITOR_QUEUE_NAME (rtems_build_name('R', 'M', 'S', 'Q')) -#define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q')) - -#define RTEMS_MONITOR_SERVER_RESPONSE 0x0001 -#define RTEMS_MONITOR_SERVER_CANONICAL 0x0002 - -typedef struct -{ - uint32_t command; - rtems_id return_id; - uint32_t argument0; - uint32_t argument1; - uint32_t argument2; - uint32_t argument3; - uint32_t argument4; - uint32_t argument5; -} rtems_monitor_server_request_t; - -typedef struct -{ - uint32_t command; - uint32_t result0; - uint32_t result1; - rtems_monitor_union_t payload; -} rtems_monitor_server_response_t; - -extern rtems_id rtems_monitor_task_id; - -extern uint32_t rtems_monitor_node; /* our node number */ -extern uint32_t rtems_monitor_default_node; /* current default for commands */ - -/* - * Monitor command function and table entry - */ - -typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t; -typedef union _rtems_monitor_command_arg_t rtems_monitor_command_arg_t; - -typedef void (*rtems_monitor_command_function_t)( - int argc, - char **argv, - const rtems_monitor_command_arg_t *command_arg, - bool verbose -); - -union _rtems_monitor_command_arg_t { - rtems_monitor_object_type_t monitor_object; - rtems_status_code status_code; - rtems_symbol_table_t **symbol_table; - const rtems_monitor_command_entry_t *monitor_command_entry; -}; - -struct rtems_monitor_command_entry_s { - const char *command; /* command name */ - const char *usage; /* usage string for the command */ - uint32_t arguments_required; /* # of required args */ - rtems_monitor_command_function_t command_function; - /* Some argument for the command */ - rtems_monitor_command_arg_t command_arg; - const rtems_monitor_command_entry_t *next; -}; - - -typedef const void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *); -typedef void (*rtems_monitor_object_canonical_fn)(void *, const void *); -typedef void (*rtems_monitor_object_dump_header_fn)(bool); -typedef void (*rtems_monitor_object_dump_fn)(void *, bool); - -typedef struct { - rtems_monitor_object_type_t type; - void *object_information; - int size; /* of canonical object */ - rtems_monitor_object_next_fn next; - rtems_monitor_object_canonical_fn canonical; - rtems_monitor_object_dump_header_fn dump_header; - rtems_monitor_object_dump_fn dump; -} rtems_monitor_object_info_t; - -typedef bool (*rtems_monitor_per_command_routine)(const rtems_monitor_command_entry_t *, void *); - -/* monitor.c */ -void rtems_monitor_pause_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_fatal_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_continue_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_debugger_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_reset_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_node_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); -void rtems_monitor_symbols_loadup(void); -int rtems_monitor_insert_cmd(rtems_monitor_command_entry_t *); -void rtems_monitor_wakeup(void); -void rtems_monitor_command_iterate(rtems_monitor_per_command_routine routine, void *arg); -rtems_status_code rtems_monitor_suspend(rtems_interval timeout); - -/* editor.c */ -void rtems_monitor_kill(void); -void rtems_monitor_init(uint32_t); -void rtems_monitor_task(rtems_task_argument); - -/* server.c */ -void rtems_monitor_server_kill(void); -rtems_status_code rtems_monitor_server_request(uint32_t , rtems_monitor_server_request_t *, rtems_monitor_server_response_t *); -void rtems_monitor_server_task(rtems_task_argument); -void rtems_monitor_server_init(uint32_t); - -/* command.c */ -int rtems_monitor_make_argv(char *, int *, char **); -int rtems_monitor_command_read(char *, int *, char **); -void rtems_monitor_command_usage(const rtems_monitor_command_entry_t *, const char *); -void rtems_monitor_help_cmd(int, char **, const rtems_monitor_command_arg_t *, bool); -const rtems_monitor_command_entry_t *rtems_monitor_command_lookup(const char *name); - -/* prmisc.c */ -void rtems_monitor_separator(void); -uint32_t rtems_monitor_pad(uint32_t dest_col, uint32_t curr_col); -int rtems_monitor_dump_decimal(uint32_t num); -int rtems_monitor_dump_hex(uint32_t num); -int rtems_monitor_dump_addr(const void *addr); -int rtems_monitor_dump_id(rtems_id id); -int rtems_monitor_dump_name(rtems_id id); -int rtems_monitor_dump_priority(rtems_task_priority priority); -int rtems_monitor_dump_state(States_Control state); -int rtems_monitor_dump_modes(rtems_mode modes); -int rtems_monitor_dump_attributes(rtems_attribute attributes); -int rtems_monitor_dump_events(rtems_event_set events); - -/* object.c */ -rtems_id rtems_monitor_id_fixup(rtems_id, uint32_t , rtems_monitor_object_type_t); -const rtems_monitor_object_info_t *rtems_monitor_object_lookup(rtems_monitor_object_type_t type); -rtems_id rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, size_t *size_p); -rtems_id rtems_monitor_object_canonical_next(const rtems_monitor_object_info_t *, rtems_id, void *); -const void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *); -rtems_id rtems_monitor_object_canonical(rtems_id, const void *); -void rtems_monitor_object_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); - -/* manager.c */ -const void *rtems_monitor_manager_next(void *, void *, rtems_id *); - -/* config.c */ -void rtems_monitor_config_canonical(rtems_monitor_config_t *, const void *); -const void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *); -void rtems_monitor_config_dump_header(bool); -int rtems_monitor_config_dump(rtems_monitor_config_t *, bool verbose); - -/* mpci.c */ -#if defined(RTEMS_MULTIPROCESSING) -void rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, const void *); -const void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *); -void rtems_monitor_mpci_dump_header(bool); -void rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, bool verbose); -#endif - -/* itask.c */ -void rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, const void *); -const void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *); -void rtems_monitor_init_task_dump_header(bool); -void rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, bool verbose); - -/* extension.c */ -void rtems_monitor_extension_canonical(rtems_monitor_extension_t *, const void *); -void rtems_monitor_extension_dump_header(bool verbose); -void rtems_monitor_extension_dump(rtems_monitor_extension_t *, bool); - -/* task.c */ -void rtems_monitor_task_canonical(rtems_monitor_task_t *, const void *); -void rtems_monitor_task_dump_header(bool verbose); -void rtems_monitor_task_dump(rtems_monitor_task_t *, bool); - -/* sema.c */ -void rtems_monitor_sema_canonical(rtems_monitor_sema_t *, const void *); -void rtems_monitor_sema_dump_header(bool verbose); -void rtems_monitor_sema_dump(rtems_monitor_sema_t *, bool); - -/* queue.c */ -void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, const void *); -void rtems_monitor_queue_dump_header(bool verbose); -void rtems_monitor_queue_dump(rtems_monitor_queue_t *, bool); - -/* region.c */ -void rtems_monitor_region_canonical(rtems_monitor_region_t *, const void *); -void rtems_monitor_region_dump_header(bool verbose); -void rtems_monitor_region_dump(rtems_monitor_region_t *, bool); - -/* partition.c */ -void rtems_monitor_part_canonical(rtems_monitor_part_t *, const void *); -void rtems_monitor_part_dump_header(bool verbose); -void rtems_monitor_part_dump(rtems_monitor_part_t *, bool); - -/* driver.c */ -const void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *); -void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, const void *); -void rtems_monitor_driver_dump_header(bool); -void rtems_monitor_driver_dump(rtems_monitor_driver_t *, bool); - -/* symbols.c */ -rtems_symbol_table_t *rtems_symbol_table_create(void); -void rtems_symbol_table_destroy(rtems_symbol_table_t *table); - -rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, const char *, uint32_t); -rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, uint32_t); -const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, uint32_t); -rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, const char *); -const void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *); -void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *); -void rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, const char *); -void rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *); -uint32_t rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, bool); -void rtems_monitor_symbol_cmd(int, char **, const rtems_monitor_command_arg_t*, bool); - -#if defined(RTEMS_NETWORKING) -void mon_ifconfig( - int argc, - char *argv[], - uint32_t command_arg, - bool verbose -); -void mon_route( - int argc, - char *argv[], - uint32_t command_arg, - bool verbose -); -#endif - -/* mon-object.c */ -const rtems_monitor_object_info_t *rtems_monitor_object_lookup( - rtems_monitor_object_type_t type -); - -/* shared data */ -extern rtems_symbol_table_t *rtems_monitor_symbols; - -#define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0 - -#ifdef __cplusplus -} -#endif - -#endif /* ! __MONITOR_H */ diff --git a/cpukit/libmisc/mouse/mouse_parser.h b/cpukit/libmisc/mouse/mouse_parser.h deleted file mode 100644 index 27bea1bbbc..0000000000 --- a/cpukit/libmisc/mouse/mouse_parser.h +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file rtems/mouse_parser.h - * - * @brief Initialize Mouse Parser Engine - * - * This file is the header file for the Mouse Parser Engine. - */ - -/* - * This file is derived from a UNIX Serial Port Mouse Driver with the - * following notice: - * - * ================================================================== - * Copyright (c) 1999 Greg Haerr <greg@censoft.com> - * Portions Copyright (c) 1991 David I. Bell - * Permission is granted to use, distribute, or modify this source, - * provided that this copyright notice remains intact. - * - * UNIX Serial Port Mouse Driver - * - * This driver opens a serial port directly, and interprets serial data. - * Microsoft, PC, Logitech and PS/2 mice are supported. The PS/2 mouse - * is only supported if the OS runs the mouse byte codes through the - * serial port. - * - * Mouse Types Supported: pc ms, logi, ps2 - * ================================================================== - * - * It has been modified to support the concept of being just a parser - * fed data from an arbitrary source. It is independent of either - * a PS/2 driver or a serial port. - * - * It was moved to cpukit/libmisc/mouse by Joel Sherrill. - */ - -#ifndef __MOUSE_PARSER_h__ -#define __MOUSE_PARSER_h__ - -#include <rtems/mw_uid.h> - -/** - * @defgroup libmisc_mouseparser Mouse Parser Engine - * @ingroup libmisc_mouse - */ -/**@{*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This is the mask for the right button. - * - * @note Use the same definitions as the user interface. - */ -#define RBUTTON MV_BUTTON_RIGHT - -/** - * This is the mask for the center button. - * - * @note Use the same definitions as the user interface. - */ -#define MBUTTON MV_BUTTON_CENTER - -/** - * This is the mask for the left button. - * - * @note Use the same definitions as the user interface. - */ -#define LBUTTON MV_BUTTON_LEFT - -/** - * This type is the device coordinates. - */ -typedef int COORD; - -/** - * This type is the mouse button mask. - */ -typedef unsigned int BUTTON; - -/** - * This type defines a pointer to the enqueue method. It is - * available since some device drivers keep pointers to the method - * to know when to enqueue or not. - */ -typedef void (*mouse_parser_enqueue_handler)(unsigned char *, size_t); - -/** - * @brief Initialize the mouse parser engine. - * - * This method initializes the Mouse Parser Engine for the mouse - * of @a type. The @a type should be one of the following strings: - * pc ms, logi, ps2. - * - * @a param[in] type indicates the type of mouse. - * - * @retval This method returns 0 on success and -1 on error. - */ -int mouse_parser_initialize(const char *type); - -/** - * @brief Enqueue input to the mouse parser engine. - * - * This method is used to pass mouse input to the Mouse Parser Engine. - * - * @a param[in] buffer is the data to enqueue - * @a param[in] size is the amount of data to enqueue - */ -void mouse_parser_enqueue( - unsigned char *buffer, - size_t size -); - -#ifdef __cplusplus -} -#endif - -/**@}*/ - -#endif diff --git a/cpukit/libmisc/mouse/serial_mouse.h b/cpukit/libmisc/mouse/serial_mouse.h deleted file mode 100644 index 174fcfb909..0000000000 --- a/cpukit/libmisc/mouse/serial_mouse.h +++ /dev/null @@ -1,169 +0,0 @@ -/** - * @file - * - * @brief Serial Mouse Driver - * - * This file describes the Serial Mouse Driver for all boards. - * This driver assumes that the BSP or application will provide - * an implementation of the method bsp_get_serial_mouse_device() - * which tells the driver what serial port device to open() and - * what type of mouse is connected. - * - * This driver relies on the Mouse Parser Engine. - */ - -/* - * 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 __SERIAL_MOUSE_h__ -#define __SERIAL_MOUSE_h__ - -#include <rtems/io.h> - -/* functions */ - -/** - * @defgroup libmisc_serialmouse Serial Mouse Driver - * @ingroup libmisc_mouse - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Standard device file path for a PS2 mouse device. - */ -#define SERIAL_MOUSE_DEVICE_PS2 "/dev/psaux" - -/** - * This macro defines the serial mouse device driver entry points. - */ -#define SERIAL_MOUSE_DRIVER_TABLE_ENTRY \ - { serial_mouse_initialize, serial_mouse_open, serial_mouse_close, \ - serial_mouse_read, serial_mouse_write, serial_mouse_control } - -/** - * @brief The initialization of the serial mouse driver. - * - * This method initializes the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Open device driver entry point for the serial mouse driver. - * - * This method implements the Open device driver entry - * point for the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Close device driver entry point for the serial mouse driver. - * - * This method implements the Close device driver entry - * point for the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Read device driver entry point for the serial mouse driver. - * - * This method implements the Read device driver entry - * point for the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Write device driver entry point for the serial mouse driver. - * - * This method implements the Write device driver entry - * point for the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief IO Control device driver entry point for the serial mouse driver. - * - * This method implements the IO Control device driver entry - * point for the serial mouse driver. - * - * @param[in] major is the mouse device major number - * @param[in] minor is the mouse device minor number - * @param[in] arg points to device driver arguments - */ -rtems_device_driver serial_mouse_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -); - -/** - * @brief Obtain serial mouse configuration information. - * - * This method is implemented by the BSP or application and - * tells the driver what device to open() and what type of - * mouse is connected. - * - * @param[in] name will point to a string with the device name - * of the serial port with the mouse connected. - * @param[in] type will point to a string with the type of mouse connected. - * - * @retval This method returns true on success and false on error. - */ -bool bsp_get_serial_mouse_device( - const char **name, - const char **type -); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif /* __tty_drv__ */ diff --git a/cpukit/libmisc/preinstall.am b/cpukit/libmisc/preinstall.am deleted file mode 100644 index f6a7e763d2..0000000000 --- a/cpukit/libmisc/preinstall.am +++ /dev/null @@ -1,9 +0,0 @@ -## Automatically generated by ampolish3 - Do not edit - -if AMPOLISH3 -$(srcdir)/preinstall.am: Makefile.am - $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am -endif - -if LIBSHELL -endif diff --git a/cpukit/libmisc/redirector/stdio-redirect.h b/cpukit/libmisc/redirector/stdio-redirect.h deleted file mode 100644 index 6f1d4cdd98..0000000000 --- a/cpukit/libmisc/redirector/stdio-redirect.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2014 Chris Johns (chrisj@rtems.org) - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution. - * - * This software with is provided ``as is'' and with NO WARRANTY. - */ - -/* - * @brief Redirect an stdio file decriptor. - * - * The is a helper module of code design to redirect an stdio file - * descriptor. You can optionally have the data buffered and/or you can provide - * a handler function that is called when data arrives. - * - * The module uses standard POSIX calls to implement the redirection and if the - * threading was POSIX based the code would be portable. Currently the code - * uses RTEMS threads. - * - * Redirecting stderr and stdout is useful in embedded system because you can - * transport the output off your device or create a web interface that can - * display the output. This can be a very powerful diagnostic and support tool. - * - * The implementation does: - * - * 1. Duplicate the file descriptor (fd) to redirect using the dup call. The - * duplicated desciptor is used to echo the output out the existing path. - * - * 2. Create a pipe using the pipe call. - * - * 3. Duplicate the pipe's writer file descriptor to user's file - * descriptor. This results in any writes to the user's fd being written to - * the pipe. - * - * 4. Create a reader task that blocks on the pipe. It optionally calls a - * handler and if configured buffers the data. - */ - -#if !defined(RTEMS_STDIO_REDIRECT_H) -#define RTEMS_STDIO_REDIRECT_H - -#include <stdbool.h> -#include <rtems.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * Handler called whenever redirected data arrives. - * - * @param buffer The data. - * @param length The amount of data in the buffer. - */ -typedef void (*rtems_stdio_redirect_handler)(const char* buffer, - ssize_t length); - -/* - * Redirector data. - */ -typedef struct -{ - volatile uint32_t state; /**< The state. */ - rtems_id reader; /**< The reader thread. */ - rtems_id lock; /**< Lock for this struct. */ - int fd; /**< The file descriptor to redirect. */ - int fd_dup; /**< Duplicated fd to write to. */ - int pipe[2]; /**< The pipe to the reader thread. */ - char* input; /**< The input buffer the reader uses. */ - ssize_t input_size; /**< The input buffer size. */ - char* buffer; /**< Captured redirected data. */ - ssize_t buffer_size; /**< Capture buffer size. */ - ssize_t in; /**< Buffer in index. */ - bool full; /**< The buffer is full. */ - bool echo; /**< Echo the data out the existing path. */ - rtems_stdio_redirect_handler handler; /**< Redirected data handler. */ -} rtems_stdio_redirect; - -/* - * Open a redirector returning the handle to it. - * - * @param fd The file descriptor to redirect. - * @param priority The priority of the reader thread. - */ -rtems_stdio_redirect* rtems_stdio_redirect_open(int fd, - rtems_task_priority priority, - size_t stack_size, - ssize_t input_size, - ssize_t buffer_size, - bool echo, - rtems_stdio_redirect_handler handler); - -/* - * Close the redirector. - */ -void rtems_stdio_redirect_close(rtems_stdio_redirect* sr); - -/* - * Get data from the capture buffer. Data read is removed from the buffer. - * - * @param sr The stdio redirection handle. - * @param buffer The buffer data is written into. - * @param length The size of the buffer. - * @return ssize_t The amount of data written and -1 or an error. - */ -ssize_t rtems_stdio_redirect_read(rtems_stdio_redirect* sr, - char* buffer, - ssize_t length); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.h b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.h deleted file mode 100644 index 74e9a44aaf..0000000000 --- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * COPYRIGHT (c) 2013-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. - */ -/** - * @file - * - * @ingroup rtems_fdt - * - * @brief RTEMS Flattened Device Tree Shell Command - * - * Support for loading, managing and accessing FDT blobs in RTEMS. - */ - -#if !defined (_RTEMS_FDT_SHELL_H_) -#define _RTEMS_FDT_SHELL_H_ - -#include <rtems/rtems-fdt.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * Add a shell command to access memory and registers associated with the DTF. - */ -void rtems_fdt_add_shell_command (void); - -/** - * Get a pointer to the handle. You can use this to load files or register - * blobs and have the shell command access them. - */ -rtems_fdt_handle* rtems_fdt_get_shell_handle (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.h b/cpukit/libmisc/rtems-fdt/rtems-fdt.h deleted file mode 100644 index ebc222e4c9..0000000000 --- a/cpukit/libmisc/rtems-fdt/rtems-fdt.h +++ /dev/null @@ -1,621 +0,0 @@ -/* - * COPYRIGHT (c) 2013-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. - * - * Interface based on the libdft: - * libfdt - Flat Device Tree manipulation - * Copyright (C) 2006 David Gibson, IBM Corporation. - */ -/** - * @file - * - * @ingroup rtems_fdt - * - * @brief RTEMS Flattened Device Tree - * - * Support for loading, managing and accessing FDT blobs in RTEMS. - */ - -#if !defined (_RTEMS_FDT_H_) -#define _RTEMS_FDT_H_ - -#include <rtems.h> -#include <rtems/chain.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * A blob. - */ -struct rtems_fdt_blob; -typedef struct rtems_fdt_blob rtems_fdt_blob; - -/** - * A blob handle is a way to manage access to the FDT blobs. The blob is - * referenced via the handle to allow searches across loaded DTB's to return - * the referenced DTB. - */ -typedef struct -{ - rtems_fdt_blob* blob; /**< The blob the handle references. */ -} rtems_fdt_handle; - -/* - * The following are mappings to the standard FDT calls. - */ - -/** - * RTEMS_FDT_ERR_NOTFOUND: The requested node or property does not exist - */ -#define RTEMS_FDT_ERR_NOTFOUND 1 -/** - * RTEMS_FDT_ERR_EXISTS: Attemped to create a node or property which already - * exists */ -#define RTEMS_FDT_ERR_EXISTS 2 -/** - * RTEMS_FDT_ERR_NOSPACE: Operation needed to expand the device tree, but its - * buffer did not have sufficient space to contain the expanded tree. Use - * rtems_fdt_open_into() to move the device tree to a buffer with more space. - */ -#define RTEMS_FDT_ERR_NOSPACE 3 - -/* Error codes: codes for bad parameters */ -/** - * RTEMS_FDT_ERR_BADOFFSET: Function was passed a structure block offset which - * is out-of-bounds, or which points to an unsuitable part of the structure for - * the operation. - */ -#define RTEMS_FDT_ERR_BADOFFSET 4 -/** - * RTEMS_FDT_ERR_BADPATH: Function was passed a badly formatted path - * (e.g. missing a leading / for a function which requires an absolute path) -*/ -#define RTEMS_FDT_ERR_BADPATH 5 -/** - * RTEMS_FDT_ERR_BADPHANDLE: Function was passed an invalid phandle value. - * phandle values of 0 and -1 are not permitted. - */ -#define RTEMS_FDT_ERR_BADPHANDLE 6 -/** - * RTEMS_FDT_ERR_BADSTATE: Function was passed an incomplete device tree - * created by the sequential-write functions, which is not sufficiently - * complete for the requested operation. - */ -#define RTEMS_FDT_ERR_BADSTATE 7 - -/* Error codes: codes for bad device tree blobs */ - -/** - * RTEMS_FDT_ERR_TRUNCATED: Structure block of the given device tree ends - * without an RTEMS_FDT_END tag. - */ -#define RTEMS_FDT_ERR_TRUNCATED 8 -/** - * RTEMS_FDT_ERR_BADMAGIC: Given "device tree" appears not to be a device tree - * at all - it is missing the flattened device tree magic number. - */ -#define RTEMS_FDT_ERR_BADMAGIC 9 -/** RTEMS_FDT_ERR_BADVERSION: Given device tree has a version which can't be - * handled by the requested operation. For read-write functions, this may mean - * that rtems_fdt_open_into() is required to convert the tree to the expected - * version. - */ -#define RTEMS_FDT_ERR_BADVERSION 10 -/** - * RTEMS_FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt structure block - * or other serious error (e.g. misnested nodes, or subnodes preceding - * properties). - */ -#define RTEMS_FDT_ERR_BADSTRUCTURE 11 -/** - * RTEMS_FDT_ERR_BADLAYOUT: For read-write functions, the given device tree has - * it's sub-blocks in an order that the function can't handle (memory reserve - * map, then structure, then strings). Use rtems_fdt_open_into() to reorganize - * the tree into a form suitable for the read-write operations. - */ -#define RTEMS_FDT_ERR_BADLAYOUT 12 -/** - * "Can't happen" error indicating a bug in libfdt - */ -#define RTEMS_FDT_ERR_INTERNAL 13 - -/* RTEMS error codes. */ - -/** - * Invalid handle. - */ -#define RTEMS_FDT_ERR_INVALID_HANDLE 100 -/** - * No memory. - */ -#define RTEMS_FDT_ERR_NO_MEMORY 101 -/** - * File not found. - */ -#define RTEMS_FDT_ERR_NOT_FOUND 102 -/** - * Cannot read the DTB into memory. - */ -#define RTEMS_FDT_ERR_READ_FAIL 103 -/** - * The blob cannot be unloaded as it is referenced. - */ -#define RTEMS_FDT_ERR_REFERENCED 104 - -#define RTEMS_FDT_ERR_RTEMS_MIN 100 -#define RTEMS_FDT_ERR_MAX 104 - -/** - * Initialise a handle to a default state. - * - * @param handle The handle to initialise. - */ -void rtems_fdt_init_handle (rtems_fdt_handle* handle); - -/** - * Duplicate a handle. The copy must be released. - * - * @param from Duplicate from this handle. - * @param to Duplicate to this handle. - */ -void rtems_fdt_dup_handle (rtems_fdt_handle* from, rtems_fdt_handle* to); - -/** - * Release a blob from a handle and clear it. - * - * @param handle The handle to check. - */ -void rtems_fdt_release_handle (rtems_fdt_handle* handle); - -/** - * Check if a handle had a valid blob assigned. - * - * @param handle The handle to check. - * @retval true The handle has a valid blob. - * @retval false The handle does not have a valid blob. - */ -bool rtems_fdt_valid_handle (const rtems_fdt_handle* handle); - -/** - * Find a tree node by its full path looking across of loaded blobs.. Each path - * component may omit the unit address portion, but the results of this are - * undefined if any such path component is ambiguous (that is if there are - * multiple nodes at the relevant level matching the given component, - * differentiated only by unit address). - * - * If the handle points to a valid blob it is release and the search starts - * from the first blob. - * - * @param handle The FDT handle assigned to the blob if found else left invalid. - * @param path Full path of the node to locate. - * @param int If less than 0 an error code else the node offset is returned. - */ -int rtems_fdt_find_path_offset (rtems_fdt_handle* handle, const char* path); - -/** - * Load a device tree blob or DTB file into memory and register it on the chain - * of blobs. - * - * @param filename The name of the blob file to load. - * @param handle The handle returns the reference to the blob once load. - * @return int If less than 0 it is an error code else it is the blob descriptor. - */ -int rtems_fdt_load (const char* const filename, rtems_fdt_handle* handle); - -/** - * Register a device tree blob or DTB on to the chain of blobs. - * - * @param blob_desc A pointer to the blob. - * @param handle The handle returns the reference to the blob once load. - * @return int If less than 0 it is an error code else it is the blob descriptor. - */ -int rtems_fdt_register (const void* blob, rtems_fdt_handle* handle); - -/** - * Unload a device tree blob or DTB file and release any memory allocated when - * loading. The blob is removed from the list of registered. - * - * @param blob_desc A valid blob descriptor. - * @return int If less than 0 it is an error code else 0 is return on success. - */ -int rtems_fdt_unload (rtems_fdt_handle* handle); - -/** - * Returns the number of entries in the device tree blob's memory - * reservation map. This does not include the terminating 0,0 entry - * or any other (0,0) entries reserved for expansion. - * - * @param blob_desc A valid blob descriptor. - * @return int The number of entries. - */ -int rtems_fdt_num_mem_rsv (rtems_fdt_handle* handle); - -/** - * Retrieve one memory reserve map entry. On success, *address and *size will - * contain the address and size of the n-th reserve map entry from the device - * tree blob, in native-endian format. - * - * @param blob_desc A valid blob descriptor. - * @param address Pointer to 64-bit variables to hold the addresses. - * @param size Pointer to 64-bit variables to hold the size. - * @return int If less than 0 it is an error code else 0 is returned on - * success. - */ -int rtems_fdt_get_mem_rsv (rtems_fdt_handle* handle, - int n, - uint64_t* address, - uint64_t* size); - -/** - * Find a subnode based on substring. Identical to rtems_fdt_subnode_offset(), - * but only examine the first namelen characters of name for matching the - * subnode name. This is useful for finding subnodes based on a portion of a - * larger string, such as a full path. - * - * @param blob_desc A valid blob descriptor. - * @param arentoffset Structure block offset of a node - * @param name Name of the subnode to locate. - * @param namelen Number of characters of name to consider. - * @return int If less than 0 it is an error code else the node offset is - * returned. - */ -int rtems_fdt_subnode_offset_namelen (rtems_fdt_handle* handle, - int parentoffset, - const char* const name, - int namelen); - -/** - * Find a subnode of a given node at structure block offset parentoffset with - * the given name. The name may include a unit address, in which case - * rtems_fdt_subnode_offset() will find the subnode with that unit address, or - * the unit address may be omitted, in which case rtems_fdt_subnode_offset() - * will find an arbitrary subnode whose name excluding unit address matches the - * given name. - * - * @param blob_desc A valid blob descriptor. - * @param parentoffset Structure block offset of a node. - * @param name The name of the subnode to locate. - * @return int If less than 0 it is an error code else the subnode offset is - * returned. - */ -int rtems_fdt_subnode_offset (rtems_fdt_handle* handle, - int parentoffset, - const char* const name); - -/** - * Find a tree node by its full path. Each path component may omit the unit - * address portion, but the results of this are undefined if any such path - * component is ambiguous (that is if there are multiple nodes at the relevant - * level matching the given component, differentiated only by unit address). - * - * @param handle The FDT handle to the current blob. - * @param path Full path of the node to locate. - * @param int If less than 0 an error code else the node offset is returned. - */ -int rtems_fdt_path_offset (rtems_fdt_handle* handle, const char* path); - -/** - * Retrieve the name of a given node (including unit address) of the device - * tree node at structure block offset @nodeoffset. If @length is non-NULL, - * the length of this name is also returned, in the integer pointed to by - * @length. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset Structure block offset of the starting node. - * @param length Pointer to an integer variable (will be overwritten) or NULL. - * @return const char* The node's name on success or NULL on error. The length - * if non-NULL will hold the error code. - */ -const char* rtems_fdt_get_name (rtems_fdt_handle* handle, - int nodeoffset, - int* length); - -/** - * Get property value based on substring. Identical to rtems_fdt_getprop(), but - * only examine the first namelen characters of name for matching the property - * name. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset Offset of the node whose property to find - * @param name The name of the property to find - * @param namelen The number of characters of name to consider - * @param length A pointer to an integer variable (will be overwritten) or - * NULL. - * @return const void* The node's property on success or NULL on error. The - * length if non-NULL will hold the error code. - */ -const void *rtems_fdt_getprop_namelen (rtems_fdt_handle* handle, - int nodeoffset, - const char* const name, - int namelen, - int* length); - -/** - * Retrieve the value of a given property. Retrieves a pointer to the value of - * the property named 'name' of the node at offset nodeoffset (this will be a - * pointer to within the device blob itself, not a copy of the value). If lenp - * is non-NULL, the length of the property value is also returned, in the - * integer pointed to by @length. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of the node whose property to find. - * @param name The name of the property to find. - * @param length A pointer to an integer variable (will be overwritten) or - * NULL. - * @return const void* The node's property on success or NULL on error. The - * length if non-NULL will hold the error code. - */ -const void *rtems_fdt_getprop (rtems_fdt_handle* handle, - int nodeoffset, - const char* const name, - int* length); - -/** - * Retrieve the phandle of a given of the device tree node at structure block - * offset nodeoffset. - * - * @param handle The FDT handle to the current blob. - * @oaram nodeoffset The structure block offset of the node. - * return uint32_t The phandle of the node at nodeoffset, on success (!= 0, != - * -1) 0, if the node has no phandle, or another error occurs. - */ -uint32_t rtems_fdt_get_phandle (rtems_fdt_handle* handle, int nodeoffset); - -/** - * Get alias based on substring. Identical to rtems_fdt_get_alias(), but only - * examine the first namelen characters of name for matching the alias name. - * - * @param handle The FDT handle to the current blob. - * @param name The name of the alias th look up. - * @param namelen The number of characters of name to consider. - * @return const char* The alias or NULL. - */ -const char *rtems_fdt_get_alias_namelen (rtems_fdt_handle* handle, - const char* const name, - int namelen); - -/** - * Retreive the path referenced by a given alias. That is, the value of the - * property named 'name' in the node /aliases. - * - * @param handle The FDT handle to the current blob. - * @param name The name of the alias to look up. - * @return const char* A pointer to the expansion of the alias named 'name', of - * it exists NULL, if the given alias or the /aliases node - * does not exist - */ -const char* rtems_fdt_get_alias (rtems_fdt_handle* handle, const char* name); - -/** - * Determine the full path of a node. This function is expensive, as it must - * scan the device tree structure from the start to nodeoffset. It computes the - * full path of the node at offset nodeoffset, and records that path in the - * buffer at buf. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of the node whose path to find. - * @param buf A character buffer to contain the returned path (will be - * overwritten) - * @param buflen The size of the character buffer at buf. - * @return int 0 on success of an error code. - */ -int rtems_fdt_get_path (rtems_fdt_handle* handle, - int nodeoffset, - char* buf, - int buflen); - -/** - * Find a specific ancestor of a node at a specific depth from the root (where - * the root itself has depth 0, its immediate subnodes depth 1 and so forth). - * So rtems_fdt_supernode_atdepth_offset(blob, nodeoffset, 0, NULL); will - * always return 0, the offset of the root node. If the node at nodeoffset has - * depth D, then: - * rtems_fdt_supernode_atdepth_offset(blob, nodeoffset, D, NULL); - * will return nodeoffset itself. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of the node whose parent to find. - * @param supernodedepth The depth of the ancestor to find. - * @oaram nodedepth The pointer to an integer variable (will be overwritten) or - * NULL - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_supernode_atdepth_offset (rtems_fdt_handle* handle, - int nodeoffset, - int supernodedepth, - int* nodedepth); - -/** - * Find the depth of a given node. The root node has depth 0, its immediate - * subnodes depth 1 and so forth. - * - * @note This function is expensive, as it must scan the device tree structure - * from the start to nodeoffset. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of the node whose parent to find. - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_node_depth (rtems_fdt_handle* handle, int nodeoffset); - -/** - * Find the parent of a given node. This funciton locates the parent node of a - * given node (that is, it finds the offset of the node which contains the node - * at nodeoffset as a subnode). - * - * @note This function is expensive, as it must scan the device tree structure - * from the start to nodeoffset, *twice*. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of the node whose parent to find. - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_parent_offset (rtems_fdt_handle* handle, int nodeoffset); - -/** - * Find nodes with a given property value. This funtion returns the offset of - * the first node after startoffset, which has a property named propname whose - * value is of length proplen and has value equal to propval; or if startoffset - * is -1, the very first such node in the tree. - * - * To iterate through all nodes matching the criterion, the following idiom can - * be used: - * offset = rtemsfdt_node_offset_by_prop_value(blob, -1, propname, - * propval, proplen); - * while (offset != -RTEMS_FDT_ERR_NOTFOUND) { - * // other code here - * offset = rtems_fdt_node_offset_by_prop_value(fdt, offset, propname, - * propval, proplen); - * } - * - * @note The -1 in the first call to the function, if 0 is used here - * instead, the function will never locate the root node, even if it - * matches the criterion. - * - * @param handle The FDT handle to the current blob. - * @param startoffset Only find nodes after this offset. - * @param propname The property name to check. - * @param propval The property value to search for. - * @param proplen The length of the value in propval. - * @return int The structure block offset of the located node (>= 0, - * >startoffset), on success and an error code is less - * than 0. - */ -int rtems_fdt_node_offset_by_prop_value (rtems_fdt_handle* handle, - int startoffset, - const char* const propname, - const void* propval, - int proplen); - -/** - * Find the node with a given phandle returning the offset of the node which - * has the given phandle value. If there is more than one node in the tree - * with the given phandle (an invalid tree), results are undefined. - * - * @param handle The FDT handle to the current blob. - * @param phandle The phandle value. - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_node_offset_by_phandle (rtems_fdt_handle* handle, - uint32_t phandle); - -/** - * Check a node's compatible property returning 0 if the given node contains a - * 'compatible' property with the given string as one of its elements, it - * returns non-zero otherwise, or on error. - * - * @param handle The FDT handle to the current blob. - * @param nodeoffset The offset of a tree node. - * @param compatible The string to match against. - * @retval 0, if the node has a 'compatible' property listing the given string. - * @retval 1, if the node has a 'compatible' property, but it does not list the - * given string - */ -int rtems_fdt_node_check_compatible (rtems_fdt_handle* handle, - int nodeoffset, - const char* const compatible); - -/** - * Find nodes with a given 'compatible' value returning the offset of the first - * node after startoffset, which has a 'compatible' property which lists the - * given compatible string; or if startoffset is -1, the very first such node - * in the tree. - * - * To iterate through all nodes matching the criterion, the following idiom can - * be used: - * - * offset = rtems_fdt_node_offset_by_compatible(blob, -1, compatible); - * while (offset != -RTEMS_FDT_ERR_NOTFOUND) { - * // other code here - * offset = rtems_fdt_node_offset_by_compatible(blob, offset, compatible); - * } - * - * @note The -1 in the first call to the function, if 0 is used here instead, - * the function will never locate the root node, even if it matches the - * criterion. - * - * @param handle The FDT handle to the current blob. - * @param startoffset Only find nodes after this offset. - * @param compatible The 'compatible' string to match against. - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_node_offset_by_compatible(rtems_fdt_handle* handle, - int startoffset, - const char* compatible); - -/** - * Traverse to the next node. - * - * @param handle The FDT handle to the current blob. - * @param offset The offset in the blob to start looking for the next node. - * @param depth Pointer to return the depth the node is. - * @return int If less than 0 an error else the node offset. - */ -int rtems_fdt_next_node (rtems_fdt_handle* handle, int offset, int* depth); - -/** - * Return an error string given an error value. - * - * @param errval The error value. - * @return const char* The error string. - */ -const char* rtems_fdt_strerror (int errval); - -/** - * Return a property given a path. - */ -int rtems_fdt_prop_value(const char* const path, - const char* const propname, - void* value, - size_t* size); - -/** - * Create a map given a path the property name and the names of the subnodes of - * the path. - */ -int rtems_fdt_prop_map (const char* const path, - const char* const propname, - const char* const names[], - uint32_t* values, - size_t count); - -/* - * Get a value given a path and a property. - */ -int rtems_fdt_get_value (const char* const path, - const char* const property, - size_t size, - uint32_t* value); - -/** - * Get the number of entries in an FDT handle. - */ -int rtems_fdt_num_entries(rtems_fdt_handle* handle); - -/** - * Get the numbered entry name. Note that the id isn't the same as - * the offset - it's numbered 0, 1, 2 ... num_entries-1 - */ -const char *rtems_fdt_entry_name(rtems_fdt_handle* handle, int id); - -/** - * Get the numbered entry offset. Note that the id isn't the same as - * the offset - it's numbered 0, 1, 2 ... num_entries-1 - */ -int rtems_fdt_entry_offset(rtems_fdt_handle* handle, int id); - -/* - * Helper function to convert the void* property result to a 32bit unsigned int. - */ -uint32_t rtems_fdt_get_uint32 (const void* prop); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/cpukit/libmisc/serdbg/serdbg.h b/cpukit/libmisc/serdbg/serdbg.h deleted file mode 100644 index fe106bce44..0000000000 --- a/cpukit/libmisc/serdbg/serdbg.h +++ /dev/null @@ -1,151 +0,0 @@ -/*===============================================================*\ -| Project: RTEMS remote gdb over serial line | -+-----------------------------------------------------------------+ -| File: serdbg.h | -+-----------------------------------------------------------------+ -| Copyright (c) 2002 IMD | -| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler | -| <Thomas.Doerfler@imd-systems.de> | -| all rights reserved | -+-----------------------------------------------------------------+ -| this file declares intialization functions to add | -| a gdb remote debug stub to an RTEMS system | -| | -+-----------------------------------------------------------------+ -| date history ID | -| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | -| 04.04.02 creation doe | -\*===============================================================*/ -#ifndef _SERDBG_H -#define _SERDBG_H - -#include <rtems.h> -#include <termios.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint32_t baudrate; /* debug baud rate, e.g. 57600 */ - void (*callout)(void); /* callout pointer during polling */ - int (*open_io)(const char *dev_name, uint32_t baudrate); /* I/O open fnc */ - const char *devname; /* debug device, e.g. "/dev/tty01" */ - bool skip_init_bkpt; /* if TRUE, do not stop when initializing */ -} serdbg_conf_t; - -/* - * must be defined in init module... - */ -extern serdbg_conf_t serdbg_conf; - - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -void putDebugChar -( -/*-------------------------------------------------------------------------*\ -| Purpose: | -| send character to remote debugger | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ - char c /* char to send */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| <none> | -\*=========================================================================*/ - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int getDebugChar -( -/*-------------------------------------------------------------------------*\ -| Purpose: | -| get character from remote debugger | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ - void /* <none> */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| <none> | -\*=========================================================================*/ - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -void serdbg_exceptionHandler -( -/*-------------------------------------------------------------------------*\ -| Purpose: | -| hook directly to an exception vector | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ - int vecnum, /* vector index to hook at */ - void *vector /* address of handler function */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| <none> | -\*=========================================================================*/ - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int serdbg_init -( -/*-------------------------------------------------------------------------*\ -| Purpose: | -| initialize remote gdb session over serial line | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ - void - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| rtems_status_code | -\*=========================================================================*/ - -/* - * stuff from serdbgio.c - */ -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int serdbg_open - -/*-------------------------------------------------------------------------*\ -| Purpose: | -| try to open given serial debug port | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ -( - const char *dev_name, /* name of device to open */ - uint32_t baudrate /* baud rate to use */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| 0 on success, -1 and errno otherwise | -\*=========================================================================*/ - - -extern int serdbg_init_dbg(void); - -/* - * Assumed to be provided by the BSP - */ -extern void set_debug_traps(void); -extern void breakpoint(void); -#ifdef __cplusplus -} -#endif - -#endif /* _SERDBG_H */ diff --git a/cpukit/libmisc/serdbg/serdbgcnf.h b/cpukit/libmisc/serdbg/serdbgcnf.h deleted file mode 100644 index 9d4087ae69..0000000000 --- a/cpukit/libmisc/serdbg/serdbgcnf.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @file - * - * @brief Adds a GDB remote Debug Stub to an RTEMS System - */ - -/*===============================================================*\ -| Project: RTEMS configure remote gdb over serial line | -+-----------------------------------------------------------------+ -| File: serdbgcnf.h | -+-----------------------------------------------------------------+ -| Copyright (c) 2002 IMD | -| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler | -| <Thomas.Doerfler@imd-systems.de> | -| all rights reserved | -+-----------------------------------------------------------------+ -| this file declares intialization functions to add | -| a gdb remote debug stub to an RTEMS system | -| | -+-----------------------------------------------------------------+ -| date history ID | -| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | -| 13.05.02 creation doe | -\*===============================================================*/ -#ifndef _SERDBGCNF_H -#define _SERDBGCNF_H - -#include <rtems/serdbg.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef CONFIGURE_INIT - -/* - * fallback for baud rate to use - */ -#ifndef CONFIGURE_SERDBG_BAUDRATE -#define CONFIGURE_SERDBG_BAUDRATE 9600 -#endif - -/* - * fallback for device name to use - */ -#ifndef CONFIGURE_SERDBG_DEVNAME -#define CONFIGURE_SERDBG_DEVNAME "/dev/tty01" -#endif - -/* - * fill in serdbg_conf structure - */ -serdbg_conf_t serdbg_conf = { - CONFIGURE_SERDBG_BAUDRATE, - -#ifdef CONFIGURE_SERDBG_CALLOUT - CONFIGURE_SERDBG_CALLOUT, -#else - NULL, -#endif - -#ifdef CONFIGURE_SERDBG_USE_POLLED_TERMIOS - serdbg_open, -#else - NULL, -#endif - - CONFIGURE_SERDBG_DEVNAME, - -#ifdef CONFIGURE_SERDBG_SKIP_INIT_BKPT - true, -#else - false, -#endif -}; - -int serdbg_init(void) { -#ifdef CONFIGURE_USE_SERDBG - return serdbg_init_dbg(); -#else - return 0; -#endif -} - -#endif /* CONFIGURE_INIT */ - -#ifdef __cplusplus -} -#endif - -#endif /* _SERDBGCNF_H */ diff --git a/cpukit/libmisc/serdbg/termios_printk.h b/cpukit/libmisc/serdbg/termios_printk.h deleted file mode 100644 index dcb183533a..0000000000 --- a/cpukit/libmisc/serdbg/termios_printk.h +++ /dev/null @@ -1,101 +0,0 @@ -/*===============================================================*\ -| Project: RTEMS remote gdb over serial line | -+-----------------------------------------------------------------+ -| File: termios_printk.h | -+-----------------------------------------------------------------+ -| Copyright (c) 2002 IMD | -| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler | -| <Thomas.Doerfler@imd-systems.de> | -| all rights reserved | -+-----------------------------------------------------------------+ -| this file declares intialization functions to add | -| printk polled output via termios polled drivers | -| | -+-----------------------------------------------------------------+ -| date history ID | -| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | -| 13.04.02 creation doe | -\*===============================================================*/ -#ifndef _TERMIOS_PRINTK_H -#define _TERMIOS_PRINTK_H - -#include <rtems.h> -#include <termios.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - uint32_t baudrate; /* debug baud rate, e.g. 57600 */ - void (*callout)(void); /* callout pointer during polling */ - const char *devname; /* debug device, e.g. "/dev/tty01" */ -} termios_printk_conf_t; - -/* - * must be defined in init module... - */ -extern termios_printk_conf_t termios_printk_conf; - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -void termios_printk_outputchar -/*-------------------------------------------------------------------------*\ -| Purpose: | -| send one character to serial port | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ -( - char c /* character to print */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| <none> | -\*=========================================================================*/ - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int termios_printk_inputchar -/*-------------------------------------------------------------------------*\ -| Purpose: | -| wait for one character from serial port | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ -( - void /* none */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| received character | -\*=========================================================================*/ - - -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int termios_printk_open - -/*-------------------------------------------------------------------------*\ -| Purpose: | -| try to open given serial debug port | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ -( - const char *dev_name, /* name of device to open */ - uint32_t baudrate /* baud rate to use */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| 0 on success, -1 and errno otherwise | -\*=========================================================================*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _TERMIOS_PRINTK_H */ diff --git a/cpukit/libmisc/serdbg/termios_printk_cnf.h b/cpukit/libmisc/serdbg/termios_printk_cnf.h deleted file mode 100644 index 03c3090c38..0000000000 --- a/cpukit/libmisc/serdbg/termios_printk_cnf.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file - * - * @brief Adds printk Support via Polled termios - */ - -/*===============================================================*\ -| Project: RTEMS configure remote gdb over serial line | -+-----------------------------------------------------------------+ -| File: termios_printk_cnf.h | -+-----------------------------------------------------------------+ -| Copyright (c) 2002 IMD | -| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler | -| <Thomas.Doerfler@imd-systems.de> | -| all rights reserved | -+-----------------------------------------------------------------+ -| this file declares intialization functions to add | -| printk support via polled termios | -| | -+-----------------------------------------------------------------+ -| date history ID | -| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | -| 13.05.02 creation doe | -\*===============================================================*/ -#ifndef _TERMIOS_PRINTK_CNF_H -#define _TERMIOS_PRINTK_CNF_H - -#include <rtems/termios_printk.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef CONFIGURE_INIT - -/* - * fallback for baud rate to use - */ -#ifndef CONFIGURE_TERMIOS_PRINTK_BAUDRATE -#define CONFIGURE_TERMIOS_PRINTK_BAUDRATE 9600 -#endif - -/* - * fallback for device name to use - */ -#ifndef CONFIGURE_TERMIOS_PRINTK_DEVNAME -#define CONFIGURE_TERMIOS_PRINTK_DEVNAME "/dev/console" -#endif - -#ifdef CONFIGURE_USE_TERMIOS_PRINTK -/* - * fill in termios_printk_conf structure - */ -termios_printk_conf_t termios_printk_conf = { - CONFIGURE_TERMIOS_PRINTK_BAUDRATE, - -#ifdef CONFIGURE_TERMIOS_PRINTK_CALLOUT - CONFIGURE_TERMIOS_PRINTK_CALLOUT, -#else - NULL, -#endif - CONFIGURE_TERMIOS_PRINTK_DEVNAME, -}; -#endif - -int termios_printk_init(void) { -#ifdef CONFIGURE_USE_TERMIOS_PRINTK - return termios_printk_open(termios_printk_conf.devname, - termios_printk_conf.baudrate); -#else - return 0; -#endif -} - -#endif /* CONFIGURE_INIT */ - -#ifdef __cplusplus -} -#endif - -#endif /* _TERMIOS_PRINTK_CNF_H */ diff --git a/cpukit/libmisc/shell/shell.h b/cpukit/libmisc/shell/shell.h deleted file mode 100644 index 98ddf0a958..0000000000 --- a/cpukit/libmisc/shell/shell.h +++ /dev/null @@ -1,385 +0,0 @@ -/** - * @file rtems/shell.h - * - * @brief Instantatiate a New Terminal Shell - */ - -/* - * Author: - * - * WORK: fernando.ruiz@ctv.es - * HOME: correo@fernando-ruiz.com - * - * Thanks at: - * Chris Johns - */ - -#ifndef __RTEMS_SHELL_H__ -#define __RTEMS_SHELL_H__ - -#include <sys/types.h> -#include <sys/stat.h> -#include <rtems.h> -#include <stdio.h> -#include <termios.h> -#include <rtems/fs.h> -#include <rtems/libio.h> -#include <rtems/chain.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Some key labels to define special keys. - */ - -#define RTEMS_SHELL_KEYS_EXTENDED (0x8000) -#define RTEMS_SHELL_KEYS_NORMAL_MASK (0x00ff) -#define RTEMS_SHELL_KEYS_INS (0) -#define RTEMS_SHELL_KEYS_DEL (1) -#define RTEMS_SHELL_KEYS_UARROW (2) -#define RTEMS_SHELL_KEYS_DARROW (3) -#define RTEMS_SHELL_KEYS_LARROW (4) -#define RTEMS_SHELL_KEYS_RARROW (5) -#define RTEMS_SHELL_KEYS_HOME (6) -#define RTEMS_SHELL_KEYS_END (7) -#define RTEMS_SHELL_KEYS_F1 (8) -#define RTEMS_SHELL_KEYS_F2 (9) -#define RTEMS_SHELL_KEYS_F3 (10) -#define RTEMS_SHELL_KEYS_F4 (11) -#define RTEMS_SHELL_KEYS_F5 (12) -#define RTEMS_SHELL_KEYS_F6 (13) -#define RTEMS_SHELL_KEYS_F7 (14) -#define RTEMS_SHELL_KEYS_F8 (15) -#define RTEMS_SHELL_KEYS_F9 (16) -#define RTEMS_SHELL_KEYS_F10 (17) - -typedef bool (*rtems_shell_login_check_t)( - const char * /* user */, - const char * /* passphrase */ -); - -extern bool rtems_shell_login_prompt( - FILE *in, - FILE *out, - const char *device, - rtems_shell_login_check_t check -); - -extern bool rtems_shell_login_check( - const char *user, - const char *passphrase -); - -typedef int (*rtems_shell_command_t)(int argc, char **argv); - -struct rtems_shell_cmd_tt; -typedef struct rtems_shell_cmd_tt rtems_shell_cmd_t; - -struct rtems_shell_cmd_tt { - const char *name; - const char *usage; - const char *topic; - rtems_shell_command_t command; - rtems_shell_cmd_t *alias; - rtems_shell_cmd_t *next; - mode_t mode; - uid_t uid; - gid_t gid; -}; - -typedef struct { - const char *name; - const char *alias; -} rtems_shell_alias_t; - -struct rtems_shell_topic_tt; -typedef struct rtems_shell_topic_tt rtems_shell_topic_t; - -struct rtems_shell_topic_tt { - const char *topic; - rtems_shell_topic_t *next; -}; - -/* - * The return value has RTEMS_SHELL_KEYS_EXTENDED set if the key - * is extended, ie a special key. - */ -extern unsigned int rtems_shell_getchar(FILE *in); - -extern rtems_shell_cmd_t * rtems_shell_lookup_cmd(const char *cmd); - -extern rtems_shell_cmd_t *rtems_shell_add_cmd_struct( - rtems_shell_cmd_t *shell_cmd -); - -rtems_shell_cmd_t * rtems_shell_add_cmd( - const char *cmd, - const char *topic, - const char *usage, - rtems_shell_command_t command -); - -extern rtems_shell_cmd_t * rtems_shell_alias_cmd( - const char *cmd, - const char *alias -); - -extern int rtems_shell_make_args( - char *commandLine, - int *argc_p, - char **argv_p, - int max_args -); - -extern rtems_shell_topic_t * rtems_shell_lookup_topic( - const char *topic -); - -extern bool rtems_shell_can_see_cmd( - const rtems_shell_cmd_t *shell_cmd -); - -extern int rtems_shell_execute_cmd( - const char *cmd, int argc, char *argv[] -); - -/* - * Call to set up the shell environment if you need to execute commands before - * running a shell. - */ -extern void rtems_shell_init_environment( - void -); - -extern int rtems_shell_cat_file( - FILE *out, - const char *name -); - -extern void rtems_shell_write_file( - const char *name, - const char *content -); - -extern int rtems_shell_script_file( - int argc, - char **argv -); - -/** - * Initialise the shell creating tasks to login and run the shell - * sessions. - * - * @param task_name Name of the shell task. - * @param task_stacksize The size of the stack. If 0 the default size is used. - * @param task_priority The priority the shell runs at. - * @param forever Repeat logins. - * @param wait Caller should block until shell exits. - * @param login_check User login check function, NULL disables login checks. - * - */ -extern rtems_status_code rtems_shell_init( - const char *task_name, - size_t task_stacksize, - rtems_task_priority task_priority, - const char *devname, - bool forever, - bool wait, - rtems_shell_login_check_t login_check -); - -/** - * Run a shell script creating a shell tasks to execute the command under. - * - * @param task_name Name of the shell task. - * @param task_stacksize The size of the stack. If 0 the default size is used. - * @param task_priority The priority the shell runs at. - * @param input The file of commands. Can be 'stdin' to use stdin. - * @param output The output file to write commands to. Can be 'stdout', - * 'stderr' or '/dev/null'. - * @param output_append Append the output to the file or truncate the file. - * Create if it does not exist. - * @param wait Wait for the script to finish. - */ -extern rtems_status_code rtems_shell_script( - const char *task_name, - size_t task_stacksize, /* 0 default*/ - rtems_task_priority task_priority, - const char *input, - const char *output, - bool output_append, - bool wait, - bool echo -); - -/** - * Private environment associated with each shell instance. - */ -typedef struct { - /** 'S','E','N','V': Shell Environment */ - rtems_name magic; - const char *devname; - const char *taskname; - bool exit_shell; /* logout */ - bool forever; /* repeat login */ - int errorlevel; - bool echo; - char cwd[256]; - const char *input; - const char *output; - bool output_append; - rtems_id wake_on_end; - rtems_shell_login_check_t login_check; - - /** - * @brief The real and effective UID of the shell task in case no login check - * is present. - */ - uid_t uid; - - /** - * @brief The real and effective GID of the shell task in case no login check - * is present. - */ - gid_t gid; -} rtems_shell_env_t; - -bool rtems_shell_main_loop( - rtems_shell_env_t *rtems_shell_env -); - -extern const rtems_shell_env_t rtems_global_shell_env; - -rtems_shell_env_t *rtems_shell_get_current_env(void); -void rtems_shell_dup_current_env(rtems_shell_env_t *); - -/* - * The types of file systems we can mount. We have them broken out - * out like this so they can be configured by shellconfig.h. The - * mount command needs special treatment due to some file systems - * being dependent on the network stack and some not. If we had - * all possible file systems being included it would force the - * networking stack into the applcation and this may not be - * required. - */ -struct rtems_shell_filesystems_tt; -typedef struct rtems_shell_filesystems_tt rtems_shell_filesystems_t; - -typedef int (*rtems_shell_filesystems_mounter_t)( - const char* driver, - const char* path, - rtems_shell_filesystems_t* fs, - rtems_filesystem_options_t options -); - -struct rtems_shell_filesystems_tt { - rtems_chain_node link; - const char *name; - int driver_needed; - const rtems_filesystem_operations_table *fs_ops; - rtems_shell_filesystems_mounter_t mounter; -}; - -/** - * This method dynamically builds the command line prompt string - * and places it in @a prompt. - * - * @param[in] shell_env is the shell execution environment - * @param[in] prompt is a pointer to a string buffer area - * @param[in] size is length of the prompt buffer area - * - * @return This method fills in the memory pointed to by @a prompt. - * - * @note An application specific implementation can be provided - * by the user. - */ -extern void rtems_shell_get_prompt( - rtems_shell_env_t *shell_env, - char *prompt, - size_t size -); - -/** - * Helper for the mount command. - * - * @param[in] driver The path to the driver. - * @param[in] path The path to mount on. - * @param[in] fs The file system definition. - * @param[in] options Special file system options. - */ -extern int rtems_shell_libc_mounter( - const char* driver, - const char* path, - rtems_shell_filesystems_t* fs, - rtems_filesystem_options_t options -); - -/** - * Add a new file system mount configuration to the mount command. - * - * @param[in] fs The file system mount data. - */ -extern void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs); - -/** - * Delete file system mount configuration from the mount command. - * - * @param[in] fs The file system mount data to remove. - */ -extern void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs); - -typedef void (*rtems_shell_wait_for_input_notification)( - int fd, - int seconds_remaining, - void *arg -); - -/** - * @brief Waits for input. - * - * @retval RTEMS_SUCCESSFUL Input detected. - * @retval RTEMS_TIMEOUT Timeout expired. - * @retval RTEMS_UNSATISFIED Cannot change or restore termios attributes. - */ -extern rtems_status_code rtems_shell_wait_for_input( - int fd, - int timeout_in_seconds, - rtems_shell_wait_for_input_notification notification, - void *notification_arg -); - -/** - * @brief Waits for explicit input. - * - * @param desired_input An explicit unsigned character to wait for or -1 to - * accept any input. - * - * @retval RTEMS_SUCCESSFUL Input detected. - * @retval RTEMS_TIMEOUT Timeout expired. - * @retval RTEMS_UNSATISFIED Cannot change or restore termios attributes. - */ -extern rtems_status_code rtems_shell_wait_for_explicit_input( - int fd, - int timeout_in_seconds, - rtems_shell_wait_for_input_notification notification, - void *notification_arg, - int desired_input -); - -extern int rtems_shell_main_monitor(int argc, char **argv); - -/* - * Provide these commands for application use, as their implementation - * is tedious. - */ -int rtems_shell_main_mv(int argc, char *argv[]); -int rtems_shell_main_cp(int argc, char *argv[]); -int rtems_shell_main_rm(int argc, char *argv[]); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cpukit/libmisc/shell/shellconfig.h b/cpukit/libmisc/shell/shellconfig.h deleted file mode 100644 index 9f68b313fb..0000000000 --- a/cpukit/libmisc/shell/shellconfig.h +++ /dev/null @@ -1,554 +0,0 @@ -/** - * @file rtems/shellconfig.h - * - * RTEMS Shell Command Set Configuration - */ - -/* - * COPYRIGHT (c) 1989-2012. - * 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_SHELL_CONFIG_h -#define _RTEMS_SHELL_CONFIG_h - -#include <rtems/shell.h> - -/* - * Externs for all command definition structures - */ -extern rtems_shell_cmd_t rtems_shell_HELP_Command; -extern rtems_shell_cmd_t rtems_shell_ALIAS_Command; -extern rtems_shell_cmd_t rtems_shell_TIME_Command; -extern rtems_shell_cmd_t rtems_shell_CMDLS_Command; -extern rtems_shell_cmd_t rtems_shell_CMDCHOWN_Command; -extern rtems_shell_cmd_t rtems_shell_CMDCHMOD_Command; -extern rtems_shell_cmd_t rtems_shell_LOGOFF_Command; -extern rtems_shell_cmd_t rtems_shell_SETENV_Command; -extern rtems_shell_cmd_t rtems_shell_GETENV_Command; -extern rtems_shell_cmd_t rtems_shell_UNSETENV_Command; - -extern rtems_shell_cmd_t rtems_shell_MDUMP_Command; -extern rtems_shell_cmd_t rtems_shell_WDUMP_Command; -extern rtems_shell_cmd_t rtems_shell_LDUMP_Command; -extern rtems_shell_cmd_t rtems_shell_MEDIT_Command; -extern rtems_shell_cmd_t rtems_shell_MFILL_Command; -extern rtems_shell_cmd_t rtems_shell_MMOVE_Command; - -extern rtems_shell_cmd_t rtems_shell_JOEL_Command; -extern rtems_shell_cmd_t rtems_shell_DATE_Command; -extern rtems_shell_cmd_t rtems_shell_ECHO_Command; -extern rtems_shell_cmd_t rtems_shell_EDIT_Command; -extern rtems_shell_cmd_t rtems_shell_SLEEP_Command; -extern rtems_shell_cmd_t rtems_shell_ID_Command; -extern rtems_shell_cmd_t rtems_shell_TTY_Command; -extern rtems_shell_cmd_t rtems_shell_WHOAMI_Command; - -extern rtems_shell_cmd_t rtems_shell_CP_Command; -extern rtems_shell_cmd_t rtems_shell_PWD_Command; -extern rtems_shell_cmd_t rtems_shell_LS_Command; -extern rtems_shell_cmd_t rtems_shell_CHDIR_Command; -extern rtems_shell_cmd_t rtems_shell_MKDIR_Command; -extern rtems_shell_cmd_t rtems_shell_RMDIR_Command; -extern rtems_shell_cmd_t rtems_shell_CHROOT_Command; -extern rtems_shell_cmd_t rtems_shell_CHMOD_Command; -extern rtems_shell_cmd_t rtems_shell_CAT_Command; -extern rtems_shell_cmd_t rtems_shell_MKRFS_Command; -extern rtems_shell_cmd_t rtems_shell_MSDOSFMT_Command; -extern rtems_shell_cmd_t rtems_shell_MSDOSFMT_Alias; -extern rtems_shell_cmd_t rtems_shell_MV_Command; -extern rtems_shell_cmd_t rtems_shell_RM_Command; -extern rtems_shell_cmd_t rtems_shell_LN_Command; -extern rtems_shell_cmd_t rtems_shell_MKNOD_Command; -extern rtems_shell_cmd_t rtems_shell_UMASK_Command; -extern rtems_shell_cmd_t rtems_shell_LSOF_Command; -extern rtems_shell_cmd_t rtems_shell_MOUNT_Command; -extern rtems_shell_cmd_t rtems_shell_UNMOUNT_Command; -extern rtems_shell_cmd_t rtems_shell_BLKSYNC_Command; -extern rtems_shell_cmd_t rtems_shell_BLKSTATS_Command; -extern rtems_shell_cmd_t rtems_shell_FDISK_Command; -extern rtems_shell_cmd_t rtems_shell_DD_Command; -extern rtems_shell_cmd_t rtems_shell_HEXDUMP_Command; -extern rtems_shell_cmd_t rtems_shell_DEBUGRFS_Command; -extern rtems_shell_cmd_t rtems_shell_DF_Command; -extern rtems_shell_cmd_t rtems_shell_MD5_Command; - -extern rtems_shell_cmd_t rtems_shell_RTC_Command; - -extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command; -extern rtems_shell_cmd_t rtems_shell_CPUINFO_Command; -extern rtems_shell_cmd_t rtems_shell_CPUUSE_Command; -extern rtems_shell_cmd_t rtems_shell_TOP_Command; -extern rtems_shell_cmd_t rtems_shell_STACKUSE_Command; -extern rtems_shell_cmd_t rtems_shell_PERIODUSE_Command; -extern rtems_shell_cmd_t rtems_shell_PROFREPORT_Command; -extern rtems_shell_cmd_t rtems_shell_WKSPACE_INFO_Command; -extern rtems_shell_cmd_t rtems_shell_MALLOC_INFO_Command; -extern rtems_shell_cmd_t rtems_shell_RTRACE_Command; -#if RTEMS_NETWORKING - extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command; - extern rtems_shell_cmd_t rtems_shell_ROUTE_Command; - extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command; - extern rtems_shell_cmd_t rtems_shell_PING_Command; -#endif - -/* - * Extern for System commands - */ -extern rtems_shell_cmd_t rtems_shell_DRVMGR_Command; -extern rtems_shell_cmd_t rtems_shell_PCI_Command; - -extern rtems_shell_cmd_t * const rtems_shell_Initial_commands[]; - -/* - * Extern for alias commands - */ -extern rtems_shell_alias_t rtems_shell_DIR_Alias; -extern rtems_shell_alias_t rtems_shell_CD_Alias; -extern rtems_shell_alias_t rtems_shell_EXIT_Alias; - -extern rtems_shell_alias_t * const rtems_shell_Initial_aliases[]; - -/* - * If we are configured to alias a command, then make sure the underlying - * command is configured. - */ - -#if !defined(CONFIGURE_SHELL_COMMANDS_ALL) - #if defined(CONFIGURE_SHELL_COMMANDS_DIR) && \ - !defined(CONFIGURE_SHELL_COMMANDS_LS) - #define CONFIGURE_SHELL_COMMAND_LS - #endif - - #if defined(CONFIGURE_SHELL_COMMANDS_CD) && \ - !defined(CONFIGURE_SHELL_COMMANDS_CHDIR) - #define CONFIGURE_SHELL_COMMAND_CHDIR - #endif - - #if defined(CONFIGURE_SHELL_COMMANDS_EXIT) && \ - !defined(CONFIGURE_SHELL_COMMANDS_LOGOFF) - #define CONFIGURE_SHELL_COMMAND_LOGOFF - #endif -#endif - -#if defined(CONFIGURE_SHELL_COMMANDS_INIT) - rtems_shell_alias_t * const rtems_shell_Initial_aliases[] = { - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DIR)) || \ - defined(CONFIGURE_SHELL_COMMAND_DIR) - &rtems_shell_DIR_Alias, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CD)) || \ - defined(CONFIGURE_SHELL_COMMAND_CD) - &rtems_shell_CD_Alias, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_EXIT)) || \ - defined(CONFIGURE_SHELL_COMMAND_EXIT) - &rtems_shell_EXIT_Alias, - #endif - - /* - * User defined shell aliases - */ - #if defined(CONFIGURE_SHELL_USER_ALIASES) - CONFIGURE_SHELL_USER_ALIASES, - #endif - NULL - }; - - rtems_shell_cmd_t * const rtems_shell_Initial_commands[] = { - /* - * General comamnds that should be present - */ - &rtems_shell_HELP_Command, - &rtems_shell_ALIAS_Command, - &rtems_shell_TIME_Command, - - /* - * Common commands that can be optional - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CMDLS)) || \ - defined(CONFIGURE_SHELL_COMMAND_CMDLS) - &rtems_shell_CMDLS_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CMDCHOWN)) || \ - defined(CONFIGURE_SHELL_COMMAND_CMDCHOWN) - &rtems_shell_CMDCHOWN_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CMDCHMOD)) || \ - defined(CONFIGURE_SHELL_COMMAND_CMDCHMOD) - &rtems_shell_CMDCHMOD_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_JOEL)) || \ - defined(CONFIGURE_SHELL_COMMAND_JOEL) - &rtems_shell_JOEL_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DATE)) || \ - defined(CONFIGURE_SHELL_COMMAND_DATE) - &rtems_shell_DATE_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_ECHO)) || \ - defined(CONFIGURE_SHELL_COMMAND_ECHO) - &rtems_shell_ECHO_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_EDIT)) || \ - defined(CONFIGURE_SHELL_COMMAND_EDIT) - &rtems_shell_EDIT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_SLEEP)) || \ - defined(CONFIGURE_SHELL_COMMAND_SLEEP) - &rtems_shell_SLEEP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_ID)) || \ - defined(CONFIGURE_SHELL_COMMAND_ID) - &rtems_shell_ID_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_TTY)) || \ - defined(CONFIGURE_SHELL_COMMAND_TTY) - &rtems_shell_TTY_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_WHOAMI)) || \ - defined(CONFIGURE_SHELL_COMMAND_WHOAMI) - &rtems_shell_WHOAMI_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_LOGOFF)) || \ - defined(CONFIGURE_SHELL_COMMAND_LOGOFF) - &rtems_shell_LOGOFF_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_SETENV)) || \ - defined(CONFIGURE_SHELL_COMMAND_SETENV) - &rtems_shell_SETENV_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_GETENV)) || \ - defined(CONFIGURE_SHELL_COMMAND_GETENV) - &rtems_shell_GETENV_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CRLENV)) || \ - defined(CONFIGURE_SHELL_COMMAND_UNSETENV) - &rtems_shell_UNSETENV_Command, - #endif - - /* - * Memory printing/modification family commands - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MDUMP)) || \ - defined(CONFIGURE_SHELL_COMMAND_MDUMP) - &rtems_shell_MDUMP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_WDUMP)) || \ - defined(CONFIGURE_SHELL_COMMAND_WDUMP) - &rtems_shell_WDUMP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_LDUMP)) || \ - defined(CONFIGURE_SHELL_COMMAND_LDUMP) - &rtems_shell_LDUMP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MEDIT)) || \ - defined(CONFIGURE_SHELL_COMMAND_MEDIT) - &rtems_shell_MEDIT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MFILL)) || \ - defined(CONFIGURE_SHELL_COMMAND_MFILL) - &rtems_shell_MFILL_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MMOVE)) || \ - defined(CONFIGURE_SHELL_COMMAND_MMOVE) - &rtems_shell_MMOVE_Command, - #endif - - /* - * File and directory commands - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CP)) || \ - defined(CONFIGURE_SHELL_COMMAND_CP) - &rtems_shell_CP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_PWD)) || \ - defined(CONFIGURE_SHELL_COMMAND_PWD) - &rtems_shell_PWD_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_LS)) || \ - defined(CONFIGURE_SHELL_COMMAND_LS) - &rtems_shell_LS_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CHDIR)) || \ - defined(CONFIGURE_SHELL_COMMAND_CHDIR) - &rtems_shell_CHDIR_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MKDIR)) || \ - defined(CONFIGURE_SHELL_COMMAND_MKDIR) - &rtems_shell_MKDIR_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_RMDIR)) || \ - defined(CONFIGURE_SHELL_COMMAND_RMDIR) - &rtems_shell_RMDIR_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CHROOT)) || \ - defined(CONFIGURE_SHELL_COMMAND_CHROOT) - &rtems_shell_CHROOT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CHMOD)) || \ - defined(CONFIGURE_SHELL_COMMAND_CHMOD) - &rtems_shell_CHMOD_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CAT)) || \ - defined(CONFIGURE_SHELL_COMMAND_CAT) - &rtems_shell_CAT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MKRFS)) || \ - defined(CONFIGURE_SHELL_COMMAND_MKRFS) - &rtems_shell_MKRFS_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MSDOSFMT)) || \ - defined(CONFIGURE_SHELL_COMMAND_MSDOSFMT) - &rtems_shell_MSDOSFMT_Command, - &rtems_shell_MSDOSFMT_Alias, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MV)) || \ - defined(CONFIGURE_SHELL_COMMAND_MV) - &rtems_shell_MV_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_RM)) || \ - defined(CONFIGURE_SHELL_COMMAND_RM) - &rtems_shell_RM_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_LN)) || \ - defined(CONFIGURE_SHELL_COMMAND_LN) - &rtems_shell_LN_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MKNOD)) || \ - defined(CONFIGURE_SHELL_COMMAND_MKNOD) - &rtems_shell_MKNOD_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_UMASK)) || \ - defined(CONFIGURE_SHELL_COMMAND_UMASK) - &rtems_shell_UMASK_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_LSOF)) || \ - defined(CONFIGURE_SHELL_COMMAND_LSOF) - &rtems_shell_LSOF_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MOUNT)) || \ - defined(CONFIGURE_SHELL_COMMAND_MOUNT) - &rtems_shell_MOUNT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_UNMOUNT)) || \ - defined(CONFIGURE_SHELL_COMMAND_UNMOUNT) - &rtems_shell_UNMOUNT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_BLKSYNC)) || \ - defined(CONFIGURE_SHELL_COMMAND_BLKSYNC) - &rtems_shell_BLKSYNC_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_BLKSTATS)) || \ - defined(CONFIGURE_SHELL_COMMAND_BLKSTATS) - &rtems_shell_BLKSTATS_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_FDISK)) || \ - defined(CONFIGURE_SHELL_COMMAND_FDISK) - &rtems_shell_FDISK_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DD)) || \ - defined(CONFIGURE_SHELL_COMMAND_DD) - &rtems_shell_DD_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_HEXDUMP)) || \ - defined(CONFIGURE_SHELL_COMMAND_HEXDUMP) - &rtems_shell_HEXDUMP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DEBUGRFS)) || \ - defined(CONFIGURE_SHELL_COMMAND_DEBUGRFS) - &rtems_shell_DEBUGRFS_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DF)) || \ - defined(CONFIGURE_SHELL_COMMAND_DF) - &rtems_shell_DF_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MD5)) || \ - defined(CONFIGURE_SHELL_COMMAND_MD5) - &rtems_shell_MD5_Command, - #endif - - /* - * RTEMS Related commands - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_SHUTDOWN)) || \ - defined(CONFIGURE_SHELL_COMMAND_SHUTDOWN) - &rtems_shell_SHUTDOWN_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CPUINFO)) || \ - defined(CONFIGURE_SHELL_COMMAND_CPUINFO) - &rtems_shell_CPUINFO_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_CPUUSE)) || \ - defined(CONFIGURE_SHELL_COMMAND_CPUUSE) - &rtems_shell_CPUUSE_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_TOP)) || \ - defined(CONFIGURE_SHELL_COMMAND_TOP) - &rtems_shell_TOP_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_STACKUSE)) || \ - defined(CONFIGURE_SHELL_COMMAND_STACKUSE) - &rtems_shell_STACKUSE_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_PERIODUSE)) || \ - defined(CONFIGURE_SHELL_COMMAND_PERIODUSE) - &rtems_shell_PERIODUSE_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_PROFREPORT)) || \ - defined(CONFIGURE_SHELL_COMMAND_PROFREPORT) - &rtems_shell_PROFREPORT_Command, - #endif - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_WKSPACE_INFO)) || \ - defined(CONFIGURE_SHELL_COMMAND_WKSPACE_INFO) - &rtems_shell_WKSPACE_INFO_Command, - #endif - - /* - * Malloc family commands - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_MALLOC_INFO)) || \ - defined(CONFIGURE_SHELL_COMMAND_MALLOC_INFO) - &rtems_shell_MALLOC_INFO_Command, - #endif - - /* - * Tracing family commands - */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_RTRACE)) || \ - defined(CONFIGURE_SHELL_COMMAND_RTRACE) - &rtems_shell_RTRACE_Command, - #endif - - /* - * Network related commands - */ - #if RTEMS_NETWORKING - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_IFCONFIG)) || \ - defined(CONFIGURE_SHELL_COMMAND_IFCONFIG) - &rtems_shell_IFCONFIG_Command, - #endif - - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_ROUTE)) || \ - defined(CONFIGURE_SHELL_COMMAND_ROUTE) - &rtems_shell_ROUTE_Command, - #endif - - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_NETSTATS)) || \ - defined(CONFIGURE_SHELL_COMMAND_NETSTATS) - &rtems_shell_NETSTATS_Command, - #endif - - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_PING)) || \ - defined(CONFIGURE_SHELL_COMMAND_PING) - &rtems_shell_PING_Command, - #endif - #endif - - /* Miscanellous shell commands */ - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \ - && !defined(CONFIGURE_SHELL_NO_COMMAND_RTC)) \ - || defined(CONFIGURE_SHELL_COMMAND_RTC) - &rtems_shell_RTC_Command, - #endif - - /* - * System related commands - */ - #if defined(RTEMS_DRVMGR_STARTUP) || defined(CONFIGURE_SHELL_COMMAND_DRVMGR) - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_DRVMGR)) || \ - defined(CONFIGURE_SHELL_COMMAND_DRVMGR) - &rtems_shell_DRVMGR_Command, - #endif - #endif - - #if defined(RTEMS_PCI_CONFIG_LIB) - #if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \ - !defined(CONFIGURE_SHELL_NO_COMMAND_PCI)) || \ - defined(CONFIGURE_SHELL_COMMAND_PCI) - &rtems_shell_PCI_Command, - #endif - #endif - - /* - * User defined shell commands - */ - #if defined(CONFIGURE_SHELL_USER_COMMANDS) - CONFIGURE_SHELL_USER_COMMANDS, - #endif - NULL - }; - -#endif - -#endif diff --git a/cpukit/libmisc/stackchk/stackchk.h b/cpukit/libmisc/stackchk/stackchk.h deleted file mode 100644 index 16fc4f9b9d..0000000000 --- a/cpukit/libmisc/stackchk/stackchk.h +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @file rtems/stackchk.h - * - * @defgroup libmisc_stackchk Stack Checker Mechanism - * - * @ingroup libmisc - * @brief Stack Checker Information - * - * This include file contains information necessary to utilize - * and install the stack checker mechanism. - */ - -/* - * COPYRIGHT (c) 1989-2009. - * 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_STACKCHK_H -#define _RTEMS_STACKCHK_H - -#include <stdbool.h> /* bool */ - -#include <rtems/score/thread.h> /* Thread_Control */ -#include <rtems/print.h> - -/** - * @defgroup libmisc_stackchk Stack Checker Mechanism - * - * @ingroup libmisc - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Checks if current task is blown its stack. - * - * This method is used to determine if the current stack pointer - * of the currently executing task is within bounds. - * - * @retval This method returns true if the currently executing task - * has blown its stack. - * - */ -bool rtems_stack_checker_is_blown( void ); - -/** - * @brief Print the stack usage report using printk. - * - * This method prints a stack usage report for the curently executing - * task. - * - * @note It uses printk to print the report. - */ -void rtems_stack_checker_report_usage( void ); - -/** - * @brief Print the stack usage report using caller's routine. - * - * This method prints a stack usage report for the curently executing - * task. - * - * @param[in] context is the context to pass to the print handler - * @param[in] print is the print handler - * - * @note It uses the caller's routine to print the report. - */ -void rtems_stack_checker_report_usage_with_plugin( - const rtems_printer *printer -); - -/************************************************************* - ************************************************************* - ** Prototyped only so the user extension can be installed ** - ************************************************************* - *************************************************************/ - -/** - * @brief Stack Checker Task Create Extension - * - * This method is the task create extension for the stack checker. - * - * @param[in] running points to the currently executing task - * @param[in] the_thread points to the newly created task - * - * @note If this this the first task created, the stack checker - * will automatically intialize itself. - */ -bool rtems_stack_checker_create_extension( - Thread_Control *running, - Thread_Control *the_thread -); - -/** - * @brief Stack Checker Task Context Switch Extension - * - * This method is the task context switch extension for the stack checker. - * - * @param[in] running points to the currently executing task which - * is being context switched out - * @param[in] running points to the heir task which we are switching to - * - * @note This is called from the internal method _Thread_Dispatch. - */ -void rtems_stack_checker_switch_extension( - Thread_Control *running, - Thread_Control *heir -); - -/** - * @brief Stack Checker Extension Set Definition - * - * This macro defines the user extension handler set for the stack - * checker. This macro is normally only used by confdefs.h. - */ -#define RTEMS_STACK_CHECKER_EXTENSION \ -{ \ - rtems_stack_checker_create_extension, /* rtems_task_create */ \ - 0, /* rtems_task_start */ \ - 0, /* rtems_task_restart */ \ - 0, /* rtems_task_delete */ \ - rtems_stack_checker_switch_extension, /* task_switch */ \ - 0, /* task_begin */ \ - 0, /* task_exitted */ \ - 0 /* rtems_stack_checker_fatal_extension */, /* fatal */ \ - 0, /* terminate */ \ -} - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif -/* end of include file */ diff --git a/cpukit/libmisc/stringto/stringto.h b/cpukit/libmisc/stringto/stringto.h deleted file mode 100644 index 878814da54..0000000000 --- a/cpukit/libmisc/stringto/stringto.h +++ /dev/null @@ -1,262 +0,0 @@ -/** - * @file rtems/stringto.h - * - * @defgroup libmisc_conv_help Conversion Helpers - * - * @ingroup libmisc - * @brief Convert String to Pointer (with validation) - * - * This file defines the interface to a set of string conversion helpers. - */ - -/* - * COPYRIGHT (c) 2009-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_STRINGTO_H -#define _RTEMS_STRINGTO_H -/** - * @defgroup libmisc_conv_help Conversion Helpers - * - * @ingroup libmisc - */ -/**@{*/ - -#include <rtems.h> - -/** - * @brief Convert String to Pointer (with validation). - * - * This method converts a string to a pointer (void *) with - * basic numeric validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_pointer( - const char *s, - void **n, - char **endptr -); - -/** - * @brief Convert String to Unsigned Character (with validation). - * - * This method converts a string to an unsigned character with - * range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_unsigned_char( - const char *s, - unsigned char *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Int (with validation). - * - * This method converts a string to an int with range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_int( - const char *s, - int *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Unsigned Int (with validation). - * - * This method converts a string to an unsigned int with range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_unsigned_int( - const char *s, - unsigned int *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Long (with validation). - * - * This method converts a string to a long with - * range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_long( - const char *s, - long *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Unsigned Long (with validation). - * - * This method converts a string to an unsigned long with - * range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_unsigned_long( - const char *s, - unsigned long *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Long Long (with validation). - * - * This method converts a string to a long long with - * range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_long_long( - const char *s, - long long *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Unsigned Long Long (with validation). - * - * This method converts a string to an unsigned character with - * range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * @param[in] base is the expected base of the number - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_unsigned_long_long( - const char *s, - unsigned long long *n, - char **endptr, - int base -); - -/** - * @brief Convert String to Float (with validation). - * - * This method converts a string to a float with range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_float( - const char *s, - float *n, - char **endptr -); - -/** - * @brief Convert String to Double (with validation). - * - * This method converts a string to a double with range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_double( - const char *s, - double *n, - char **endptr -); - -/** - * @brief Convert String to long double (with validation). - * - * This method converts a string to a long double with range validation. - * - * @param[in] s is the string to convert - * @param[in] n points to the variable to place the converted output in - * @param[in] endptr is used to keep track of the position in the string - * - * @retval This method returns RTEMS_SUCCESSFUL on successful conversion - * and *n is filled in. Otherwise, the status indicates the - * source of the error. - */ -rtems_status_code rtems_string_to_long_double( - const char *s, - long double *n, - char **endptr -); - -#endif -/**@}*/ diff --git a/cpukit/libmisc/testsupport/test.h b/cpukit/libmisc/testsupport/test.h deleted file mode 100644 index 3dbdb9e32e..0000000000 --- a/cpukit/libmisc/testsupport/test.h +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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_TEST_H -#define _RTEMS_TEST_H - -#include <rtems.h> -#include <rtems/printer.h> -#include <rtems/score/atomic.h> -#include <rtems/score/smpbarrier.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup RTEMSTest Test Support - * - * @brief Test support functions. - * - * @{ - */ - -/** - * @brief Each test must define a test name string. - */ -extern const char rtems_test_name[]; - -/** - * @brief Each test must define a printer. - */ -extern rtems_printer rtems_test_printer; - -/** - * @brief Fatal extension for tests. - */ -void rtems_test_fatal_extension( - rtems_fatal_source source, - bool always_set_to_false, - rtems_fatal_code code -); - -/** - * @brief Initial extension for tests. - */ -#define RTEMS_TEST_INITIAL_EXTENSION \ - { NULL, NULL, NULL, NULL, NULL, NULL, NULL, rtems_test_fatal_extension } - -/** - * @brief Test states. - */ -typedef enum -{ - RTEMS_TEST_STATE_PASS, - RTEMS_TEST_STATE_FAIL, - RTEMS_TEST_STATE_USER_INPUT, - RTEMS_TEST_STATE_INDETERMINATE, - RTEMS_TEST_STATE_BENCHMARK -} RTEMS_TEST_STATE; - -#if (TEST_STATE_EXPECTED_FAIL && TEST_STATE_USER_INPUT) || \ - (TEST_STATE_EXPECTED_FAIL && TEST_STATE_INDETERMINATE) || \ - (TEST_STATE_EXPECTED_FAIL && TEST_STATE_BENCHMARK) || \ - (TEST_STATE_USER_INPUT && TEST_STATE_INDETERMINATE) || \ - (TEST_STATE_USER_INPUT && TEST_STATE_BENCHMARK) || \ - (TEST_STATE_INDETERMINATE && TEST_STATE_BENCHMARK) - #error Test states must be unique -#endif - -#if TEST_STATE_EXPECTED_FAIL - #define TEST_STATE RTEMS_TEST_STATE_FAIL -#elif TEST_STATE_USER_INPUT - #define TEST_STATE RTEMS_TEST_STATE_USER_INPUT -#elif TEST_STATE_INDETERMINATE - #define TEST_STATE RTEMS_TEST_STATE_INDETERMINATE -#elif TEST_STATE_BENCHMARK - #define TEST_STATE RTEMS_TEST_STATE_BENCHMARK -#else - #define TEST_STATE RTEMS_TEST_STATE_PASS -#endif - -/** - * @brief Prints a begin of test message using printf(). - * - * @returns As specified by printf(). - */ -int rtems_test_begin(const char* name, const RTEMS_TEST_STATE state); - -/** - * @brief Prints an end of test message using printf(). - * - * @returns As specified by printf(). - */ -int rtems_test_end(const char* name); - -/** - * @brief Exit the test without calling exit() since it closes stdin, etc and - * pulls in stdio code - */ -void rtems_test_exit(int status) RTEMS_NO_RETURN; - -/** - * @brief Prints via the RTEMS printer. - * - * @returns As specified by printf(). - */ -int rtems_test_printf(const char* format, ...) RTEMS_PRINTFLIKE(1, 2); - -#define RTEMS_TEST_PARALLEL_PROCESSOR_MAX 32 - -typedef struct rtems_test_parallel_job rtems_test_parallel_job; - -/** - * @brief Internal context for parallel job execution. - */ -typedef struct { - Atomic_Ulong stop; - SMP_barrier_Control barrier; - size_t worker_count; - rtems_id worker_ids[RTEMS_TEST_PARALLEL_PROCESSOR_MAX]; - rtems_id stop_worker_timer_id; - const struct rtems_test_parallel_job *jobs; - size_t job_count; -} rtems_test_parallel_context; - -/** - * @brief Worker task setup handler. - * - * Called during rtems_test_parallel() to optionally setup a worker task before - * it is started. - * - * @param[in] ctx The parallel context. - * @param[in] worker_index The worker index. - * @param[in] worker_id The worker task identifier. - */ -typedef void (*rtems_test_parallel_worker_setup)( - rtems_test_parallel_context *ctx, - size_t worker_index, - rtems_id worker_id -); - -/** - * @brief Basic parallel job description. - */ -struct rtems_test_parallel_job { - /** - * @brief Job initialization handler. - * - * This handler executes only in the context of the master worker before the - * job body handler. - * - * @param[in] ctx The parallel context. - * @param[in] arg The user specified argument. - * @param[in] active_workers Count of active workers. Depends on the cascade - * option. - * - * @return The desired job body execution time in clock ticks. See - * rtems_test_parallel_stop_job(). - */ - rtems_interval (*init)( - rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers - ); - - /** - * @brief Job body handler. - * - * @param[in] ctx The parallel context. - * @param[in] arg The user specified argument. - * @param[in] active_workers Count of active workers. Depends on the cascade - * option. - * @param[in] worker_index The worker index. It ranges from 0 to the - * processor count minus one. - */ - void (*body)( - rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers, - size_t worker_index - ); - - /** - * @brief Job finalization handler. - * - * This handler executes only in the context of the master worker after the - * job body handler. - * - * @param[in] ctx The parallel context. - * @param[in] arg The user specified argument. - * @param[in] active_workers Count of active workers. Depends on the cascade - * option. - */ - void (*fini)( - rtems_test_parallel_context *ctx, - void *arg, - size_t active_workers - ); - - /** - * @brief Job specific argument. - */ - void *arg; - - /** - * @brief Job cascading flag. - * - * This flag indicates whether the job should be executed in a cascaded - * manner (the job is executed on one processor first, two processors - * afterwards and incremented step by step until all processors are used). - */ - bool cascade; -}; - -/** - * @brief Indicates if a job body should stop its work loop. - * - * @param[in] ctx The parallel context. - * - * @retval true The job body should stop its work loop and return to the caller. - * @retval false Otherwise. - */ -static inline bool rtems_test_parallel_stop_job( - const rtems_test_parallel_context *ctx -) -{ - return _Atomic_Load_ulong(&ctx->stop, ATOMIC_ORDER_RELAXED) != 0; -} - -/** - * @brief Indicates if a worker is the master worker. - * - * The master worker is the thread that called rtems_test_parallel(). - * - * @param[in] worker_index The worker index. - * - * @retval true This is the master worker. - * @retval false Otherwise. - */ -static inline bool rtems_test_parallel_is_master_worker(size_t worker_index) -{ - return worker_index == 0; -} - -/** - * @brief Returns the task identifier for a worker. - * - * @param[in] ctx The parallel context. - * @param[in] worker_index The worker index. - * - * @return The task identifier of the worker. - */ -static inline rtems_id rtems_test_parallel_get_task_id( - const rtems_test_parallel_context *ctx, - size_t worker_index -) -{ - return ctx->worker_ids[worker_index]; -} - -/** - * @brief Runs a bunch of jobs in parallel on all processors of the system. - * - * The worker tasks inherit the priority of the executing task. - * - * There are SMP barriers before and after the job body. - * - * @param[in] ctx The parallel context. - * @param[in] worker_setup Optional handler to setup a worker task before it is - * started. - * @param[in] jobs The table of jobs. - * @param[in] job_count The count of jobs in the job table. - */ -void rtems_test_parallel( - rtems_test_parallel_context *ctx, - rtems_test_parallel_worker_setup worker_setup, - const rtems_test_parallel_job *jobs, - size_t job_count -); - -/** - * @brief Performs a busy loop with the specified iteration count. - * - * This function is optimized to not perform memory accesses and should have a - * small jitter. - * - * @param[in] count The iteration count. - */ -void rtems_test_busy(uint_fast32_t count); - -/** - * @brief Returns a count value for rtems_test_busy() which yields roughly a - * duration of one clock tick. - */ -uint_fast32_t rtems_test_get_one_tick_busy_count(void); - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _RTEMS_TEST_H */ diff --git a/cpukit/libmisc/untar/untar.h b/cpukit/libmisc/untar/untar.h deleted file mode 100644 index bc0a97c103..0000000000 --- a/cpukit/libmisc/untar/untar.h +++ /dev/null @@ -1,260 +0,0 @@ -/** - * @file - * - * @brief Untar an Image - * - * This file defines the interface to methods which can untar an image. - */ - -/* - * Written by: Jake Janovetz <janovetz@tempest.ece.uiuc.edu> - * - * 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_UNTAR_H -#define _RTEMS_UNTAR_H - -#include <stdbool.h> -#include <stddef.h> -#include <tar.h> -#include <zlib.h> -#include <xz.h> - -#include <rtems/print.h> - -/** - * @defgroup libmisc_untar_img Untar Image - * - * @ingroup libmisc - */ -/**@{*/ -#ifdef __cplusplus -extern "C" { -#endif - -#define UNTAR_SUCCESSFUL 0 -#define UNTAR_FAIL 1 -#define UNTAR_INVALID_CHECKSUM 2 -#define UNTAR_INVALID_HEADER 3 - -#define UNTAR_GZ_INFLATE_FAILED 4 -#define UNTAR_GZ_INFLATE_END_FAILED 5 - -int Untar_FromMemory(void *tar_buf, size_t size); -int Untar_FromMemory_Print(void *tar_buf, size_t size, const rtems_printer* printer); -int Untar_FromFile(const char *tar_name); -int Untar_FromFile_Print(const char *tar_name, const rtems_printer* printer); - -typedef struct { - /** - * @brief Current context state. - */ - enum { - UNTAR_CHUNK_HEADER, - UNTAR_CHUNK_SKIP, - UNTAR_CHUNK_WRITE, - UNTAR_CHUNK_ERROR - } state; - - /** - * @brief Header buffer. - */ - char header[512]; - - /** - * @brief Name buffer. - */ - char fname[100]; - - /** - * @brief Number of bytes of overall length are already processed. - */ - size_t done_bytes; - - /** - * @brief Mode of the file. - */ - unsigned long mode; - - /** - * @brief Overall amount of bytes to be processed. - */ - unsigned long todo_bytes; - - /** - * @brief Overall amount of blocks to be processed. - */ - unsigned long todo_blocks; - - /** - * @brief File descriptor of output file. - */ - int out_fd; -} Untar_ChunkContext; - -typedef struct { - /** - * @brief Instance of Chunk Context needed for tar decompression. - */ - Untar_ChunkContext base; - - /** - * @brief Current zlib context. - */ - z_stream strm; - - /** - * @brief Buffer that contains the inflated data. - */ - void *inflateBuffer; - - /** - * @brief Size of buffer that contains the inflated data. - */ - size_t inflateBufferSize; - -} Untar_GzChunkContext; - -typedef struct { - /** - * @brief Instance of Chunk Context needed for tar decompression. - */ - Untar_ChunkContext base; - - /** - * @brief Xz context. - */ - struct xz_dec* strm; - - /** - * @brief Xz buffer. - */ - struct xz_buf buf; - - /** - * @brief Buffer that contains the inflated data. - */ - void *inflateBuffer; - - /** - * @brief Size of buffer that contains the inflated data. - */ - size_t inflateBufferSize; - -} Untar_XzChunkContext; - -/** - * @brief Initializes the Untar_ChunkContext files out of a part of a block of - * memory. - * - * @param Untar_ChunkContext *context [in] Pointer to a context structure. - */ -void Untar_ChunkContext_Init(Untar_ChunkContext *context); - -/* - * @brief Rips links, directories and files out of a part of a block of memory. - * - * @param Untar_ChunkContext *context [in] Pointer to a context structure. - * @param void *chunk [in] Pointer to a chunk of a TAR buffer. - * @param size_t chunk_size [in] Length of the chunk of a TAR buffer. - * - * @retval UNTAR_SUCCESSFUL (0) on successful completion. - * @retval UNTAR_FAIL for a faulty step within the process. - * @retval UNTAR_INVALID_CHECKSUM for an invalid header checksum. - * @retval UNTAR_INVALID_HEADER for an invalid header. - */ - -int Untar_FromChunk_Print( - Untar_ChunkContext *context, - void *chunk, - size_t chunk_size, - const rtems_printer* printer -); - -/** - * @brief Initializes the Untar_ChunkGzContext. - * - * @param Untar_ChunkGzContext *context [in] Pointer to a context structure. - * @param void *inflateBuffer [in] Pointer to a context structure. - * @param size_t inflateBufferSize [in] Size of inflateBuffer. - */ -int Untar_GzChunkContext_Init( - Untar_GzChunkContext *ctx, - void *inflateBuffer, - size_t inflateBufferSize -); - -/* - * @brief Untars a GZ compressed POSIX TAR file. - * - * This is a subroutine used to rip links, directories, and - * files out of a tar.gz/tgz file. - * - * @param Untar_ChunkContext *context [in] Pointer to a context structure. - * @param ssize buflen [in] Size of valid bytes in input buffer. - * @param z_stream *strm [in] Pointer to the current zlib context. - */ -int Untar_FromGzChunk_Print( - Untar_GzChunkContext *ctx, - void *chunk, - size_t chunk_size, - const rtems_printer* printer -); - -/** - * @brief Initializes the Untar_ChunkXzContext. - * - * @param Untar_ChunkXzContext *context [in] Pointer to a context structure. - * @param enum xz_mode mode [in] Dictionary mode. - * @param uint32_t dict_max [in] Maximum size of dictionary. - * @param void *inflateBuffer [in] Pointer to a context structure. - * @param size_t inflateBufferSize [in] Size of inflateBuffer. - */ -int Untar_XzChunkContext_Init( - Untar_XzChunkContext *ctx, - enum xz_mode mode, - uint32_t dict_max, - void *inflateBuffer, - size_t inflateBufferSize -); - -/* - * @brief Untars a XZ compressed POSIX TAR file. - * - * This is a subroutine used to rip links, directories, and - * files out of a tar.gz/tgz file. - * - * @param Untar_ChunkContext *context [in] Pointer to a context structure. - * @param ssize buflen [in] Size of valid bytes in input buffer. - * @param z_stream *strm [in] Pointer to the current zlib context. - */ -int Untar_FromXzChunk_Print( - Untar_XzChunkContext *ctx, - const void *chunk, - size_t chunk_size, - const rtems_printer* printer -); - -/************************************************************************** - * This converts octal ASCII number representations into an - * unsigned long. Only support 32-bit numbers for now. - *************************************************************************/ -extern unsigned long -_rtems_octal2ulong(const char *octascii, size_t len); - -/************************************************************************ - * Compute the TAR checksum and check with the value in - * the archive. The checksum is computed over the entire - * header, but the checksum field is substituted with blanks. - ************************************************************************/ -extern int -_rtems_tar_header_checksum(const char *bufr); - -#ifdef __cplusplus -} -#endif -/**@}*/ -#endif /* _RTEMS_UNTAR_H */ diff --git a/cpukit/libmisc/utf8proc/utf8proc.h b/cpukit/libmisc/utf8proc/utf8proc.h deleted file mode 100644 index 24a891b6c6..0000000000 --- a/cpukit/libmisc/utf8proc/utf8proc.h +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (c) 2009 Public Software Group e. V., Berlin, Germany - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -/* - * File name: utf8proc.h - * - * Description: - * Header files for libutf8proc, which is a mapping tool for UTF-8 strings - * with following features: - * - decomposing and composing of strings - * - replacing compatibility characters with their equivalents - * - stripping of "default ignorable characters" - * like SOFT-HYPHEN or ZERO-WIDTH-SPACE - * - folding of certain characters for string comparison - * (e.g. HYPHEN U+2010 and MINUS U+2212 to ASCII "-") - * (see "LUMP" option) - * - optional rejection of strings containing non-assigned code points - * - stripping of control characters - * - stripping of character marks (accents, etc.) - * - transformation of LF, CRLF, CR and NEL to line-feed (LF) - * or to the unicode chararacters for paragraph separation (PS) - * or line separation (LS). - * - unicode case folding (for case insensitive string comparisons) - * - rejection of illegal UTF-8 data - * (i.e. UTF-8 encoded UTF-16 surrogates) - * - support for korean hangul characters - * Unicode Version 5.0.0 is supported. - */ - - -#ifndef UTF8PROC_H -#define UTF8PROC_H - - -#include <stdlib.h> -#include <sys/types.h> -#ifdef _MSC_VER -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -#ifdef _WIN64 -#define ssize_t __int64 -#else -#define ssize_t int -#endif -typedef unsigned char bool; -enum {false, true}; -#else -#include <stdbool.h> -#include <inttypes.h> -#endif -#include <limits.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef SSIZE_MAX -#define SSIZE_MAX ((size_t)SIZE_MAX/2) -#endif - -#define UTF8PROC_NULLTERM (1<<0) -#define UTF8PROC_STABLE (1<<1) -#define UTF8PROC_COMPAT (1<<2) -#define UTF8PROC_COMPOSE (1<<3) -#define UTF8PROC_DECOMPOSE (1<<4) -#define UTF8PROC_IGNORE (1<<5) -#define UTF8PROC_REJECTNA (1<<6) -#define UTF8PROC_NLF2LS (1<<7) -#define UTF8PROC_NLF2PS (1<<8) -#define UTF8PROC_NLF2LF (UTF8PROC_NLF2LS | UTF8PROC_NLF2PS) -#define UTF8PROC_STRIPCC (1<<9) -#define UTF8PROC_CASEFOLD (1<<10) -#define UTF8PROC_CHARBOUND (1<<11) -#define UTF8PROC_LUMP (1<<12) -#define UTF8PROC_STRIPMARK (1<<13) -/* - * Flags being regarded by several functions in the library: - * NULLTERM: The given UTF-8 input is NULL terminated. - * STABLE: Unicode Versioning Stability has to be respected. - * COMPAT: Compatiblity decomposition - * (i.e. formatting information is lost) - * COMPOSE: Return a result with composed characters. - * DECOMPOSE: Return a result with decomposed characters. - * IGNORE: Strip "default ignorable characters" - * REJECTNA: Return an error, if the input contains unassigned - * code points. - * NLF2LS: Indicating that NLF-sequences (LF, CRLF, CR, NEL) are - * representing a line break, and should be converted to the - * unicode character for line separation (LS). - * NLF2PS: Indicating that NLF-sequences are representing a paragraph - * break, and should be converted to the unicode character for - * paragraph separation (PS). - * NLF2LF: Indicating that the meaning of NLF-sequences is unknown. - * STRIPCC: Strips and/or convers control characters. - * NLF-sequences are transformed into space, except if one of - * the NLF2LS/PS/LF options is given. - * HorizontalTab (HT) and FormFeed (FF) are treated as a - * NLF-sequence in this case. - * All other control characters are simply removed. - * CASEFOLD: Performs unicode case folding, to be able to do a - * case-insensitive string comparison. - * CHARBOUND: Inserts 0xFF bytes at the beginning of each sequence which - * is representing a single grapheme cluster (see UAX#29). - * LUMP: Lumps certain characters together - * (e.g. HYPHEN U+2010 and MINUS U+2212 to ASCII "-"). - * (See lump.txt for details.) - * If NLF2LF is set, this includes a transformation of - * paragraph and line separators to ASCII line-feed (LF). - * STRIPMARK: Strips all character markings - * (non-spacing, spacing and enclosing) (i.e. accents) - * NOTE: this option works only with COMPOSE or DECOMPOSE - */ - -#define UTF8PROC_ERROR_NOMEM -1 -#define UTF8PROC_ERROR_OVERFLOW -2 -#define UTF8PROC_ERROR_INVALIDUTF8 -3 -#define UTF8PROC_ERROR_NOTASSIGNED -4 -#define UTF8PROC_ERROR_INVALIDOPTS -5 -/* - * Error codes being returned by almost all functions: - * ERROR_NOMEM: Memory could not be allocated. - * ERROR_OVERFLOW: The given string is too long to be processed. - * ERROR_INVALIDUTF8: The given string is not a legal UTF-8 string. - * ERROR_NOTASSIGNED: The REJECTNA flag was set, - * and an unassigned code point was found. - * ERROR_INVALIDOPTS: Invalid options have been used. - */ - -typedef int16_t utf8proc_propval_t; -typedef struct utf8proc_property_struct { - utf8proc_propval_t category; - utf8proc_propval_t combining_class; - utf8proc_propval_t bidi_class; - utf8proc_propval_t decomp_type; - const int32_t *decomp_mapping; - unsigned bidi_mirrored:1; - int32_t uppercase_mapping; - int32_t lowercase_mapping; - int32_t titlecase_mapping; - int32_t comb1st_index; - int32_t comb2nd_index; - unsigned comp_exclusion:1; - unsigned ignorable:1; - unsigned control_boundary:1; - unsigned extend:1; - const int32_t *casefold_mapping; -} utf8proc_property_t; - -#define UTF8PROC_CATEGORY_LU 1 -#define UTF8PROC_CATEGORY_LL 2 -#define UTF8PROC_CATEGORY_LT 3 -#define UTF8PROC_CATEGORY_LM 4 -#define UTF8PROC_CATEGORY_LO 5 -#define UTF8PROC_CATEGORY_MN 6 -#define UTF8PROC_CATEGORY_MC 7 -#define UTF8PROC_CATEGORY_ME 8 -#define UTF8PROC_CATEGORY_ND 9 -#define UTF8PROC_CATEGORY_NL 10 -#define UTF8PROC_CATEGORY_NO 11 -#define UTF8PROC_CATEGORY_PC 12 -#define UTF8PROC_CATEGORY_PD 13 -#define UTF8PROC_CATEGORY_PS 14 -#define UTF8PROC_CATEGORY_PE 15 -#define UTF8PROC_CATEGORY_PI 16 -#define UTF8PROC_CATEGORY_PF 17 -#define UTF8PROC_CATEGORY_PO 18 -#define UTF8PROC_CATEGORY_SM 19 -#define UTF8PROC_CATEGORY_SC 20 -#define UTF8PROC_CATEGORY_SK 21 -#define UTF8PROC_CATEGORY_SO 22 -#define UTF8PROC_CATEGORY_ZS 23 -#define UTF8PROC_CATEGORY_ZL 24 -#define UTF8PROC_CATEGORY_ZP 25 -#define UTF8PROC_CATEGORY_CC 26 -#define UTF8PROC_CATEGORY_CF 27 -#define UTF8PROC_CATEGORY_CS 28 -#define UTF8PROC_CATEGORY_CO 29 -#define UTF8PROC_CATEGORY_CN 30 -#define UTF8PROC_BIDI_CLASS_L 1 -#define UTF8PROC_BIDI_CLASS_LRE 2 -#define UTF8PROC_BIDI_CLASS_LRO 3 -#define UTF8PROC_BIDI_CLASS_R 4 -#define UTF8PROC_BIDI_CLASS_AL 5 -#define UTF8PROC_BIDI_CLASS_RLE 6 -#define UTF8PROC_BIDI_CLASS_RLO 7 -#define UTF8PROC_BIDI_CLASS_PDF 8 -#define UTF8PROC_BIDI_CLASS_EN 9 -#define UTF8PROC_BIDI_CLASS_ES 10 -#define UTF8PROC_BIDI_CLASS_ET 11 -#define UTF8PROC_BIDI_CLASS_AN 12 -#define UTF8PROC_BIDI_CLASS_CS 13 -#define UTF8PROC_BIDI_CLASS_NSM 14 -#define UTF8PROC_BIDI_CLASS_BN 15 -#define UTF8PROC_BIDI_CLASS_B 16 -#define UTF8PROC_BIDI_CLASS_S 17 -#define UTF8PROC_BIDI_CLASS_WS 18 -#define UTF8PROC_BIDI_CLASS_ON 19 -#define UTF8PROC_DECOMP_TYPE_FONT 1 -#define UTF8PROC_DECOMP_TYPE_NOBREAK 2 -#define UTF8PROC_DECOMP_TYPE_INITIAL 3 -#define UTF8PROC_DECOMP_TYPE_MEDIAL 4 -#define UTF8PROC_DECOMP_TYPE_FINAL 5 -#define UTF8PROC_DECOMP_TYPE_ISOLATED 6 -#define UTF8PROC_DECOMP_TYPE_CIRCLE 7 -#define UTF8PROC_DECOMP_TYPE_SUPER 8 -#define UTF8PROC_DECOMP_TYPE_SUB 9 -#define UTF8PROC_DECOMP_TYPE_VERTICAL 10 -#define UTF8PROC_DECOMP_TYPE_WIDE 11 -#define UTF8PROC_DECOMP_TYPE_NARROW 12 -#define UTF8PROC_DECOMP_TYPE_SMALL 13 -#define UTF8PROC_DECOMP_TYPE_SQUARE 14 -#define UTF8PROC_DECOMP_TYPE_FRACTION 15 -#define UTF8PROC_DECOMP_TYPE_COMPAT 16 - -extern const int8_t utf8proc_utf8class[256]; - -const char *utf8proc_version(void); - -const char *utf8proc_errmsg(ssize_t errcode); -/* - * Returns a static error string for the given error code. - */ - -ssize_t utf8proc_iterate(const uint8_t *str, ssize_t strlen, int32_t *dst); -/* - * Reads a single char from the UTF-8 sequence being pointed to by 'str'. - * The maximum number of bytes read is 'strlen', unless 'strlen' is - * negative. - * If a valid unicode char could be read, it is stored in the variable - * being pointed to by 'dst', otherwise that variable will be set to -1. - * In case of success the number of bytes read is returned, otherwise a - * negative error code is returned. - */ - -bool utf8proc_codepoint_valid(int32_t uc); -/* - * Returns 1, if the given unicode code-point is valid, otherwise 0. - */ - -ssize_t utf8proc_encode_char(int32_t uc, uint8_t *dst); -/* - * Encodes the unicode char with the code point 'uc' as an UTF-8 string in - * the byte array being pointed to by 'dst'. This array has to be at least - * 4 bytes long. - * In case of success the number of bytes written is returned, - * otherwise 0. - * This function does not check if 'uc' is a valid unicode code point. - */ - -const utf8proc_property_t *utf8proc_get_property(int32_t uc); -/* - * Returns a pointer to a (constant) struct containing information about - * the unicode char with the given code point 'uc'. - * If the character is not existent a pointer to a special struct is - * returned, where 'category' is a NULL pointer. - * WARNING: The parameter 'uc' has to be in the range of 0x0000 to - * 0x10FFFF, otherwise the program might crash! - */ - -ssize_t utf8proc_decompose_char( - int32_t uc, int32_t *dst, ssize_t bufsize, - int options, int *last_boundclass -); -/* - * Writes a decomposition of the unicode char 'uc' into the array being - * pointed to by 'dst'. - * Following flags in the 'options' field are regarded: - * REJECTNA: an unassigned unicode code point leads to an error - * IGNORE: "default ignorable" chars are stripped - * CASEFOLD: unicode casefolding is applied - * COMPAT: replace certain characters with their - * compatibility decomposition - * CHARBOUND: Inserts 0xFF bytes before each grapheme cluster - * LUMP: lumps certain different characters together - * STRIPMARK: removes all character marks - * The pointer 'last_boundclass' has to point to an integer variable which - * is storing the last character boundary class, if the CHARBOUND option - * is used. - * In case of success the number of chars written is returned, - * in case of an error, a negative error code is returned. - * If the number of written chars would be bigger than 'bufsize', - * the buffer (up to 'bufsize') has inpredictable data, and the needed - * buffer size is returned. - * WARNING: The parameter 'uc' has to be in the range of 0x0000 to - * 0x10FFFF, otherwise the program might crash! - */ - -ssize_t utf8proc_decompose( - const uint8_t *str, ssize_t strlen, - int32_t *buffer, ssize_t bufsize, int options -); -/* - * Does the same as 'utf8proc_decompose_char', but acts on a whole UTF-8 - * string, and orders the decomposed sequences correctly. - * If the NULLTERM flag in 'options' is set, processing will be stopped, - * when a NULL byte is encounted, otherwise 'strlen' bytes are processed. - * The result in form of unicode code points is written into the buffer - * being pointed to by 'buffer', having the length of 'bufsize' entries. - * In case of success the number of chars written is returned, - * in case of an error, a negative error code is returned. - * If the number of written chars would be bigger than 'bufsize', - * the buffer (up to 'bufsize') has inpredictable data, and the needed - * buffer size is returned. - */ - -ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, int options); -/* - * Reencodes the sequence of unicode characters given by the pointer - * 'buffer' and 'length' as UTF-8. - * The result is stored in the same memory area where the data is read. - * Following flags in the 'options' field are regarded: - * NLF2LS: converts LF, CRLF, CR and NEL into LS - * NLF2PS: converts LF, CRLF, CR and NEL into PS - * NLF2LF: converts LF, CRLF, CR and NEL into LF - * STRIPCC: strips or converts all non-affected control characters - * COMPOSE: tries to combine decomposed characters into composite - * characters - * STABLE: prohibits combining characters which would violate - * the unicode versioning stability - * In case of success the length of the resulting UTF-8 string is - * returned, otherwise a negative error code is returned. - * WARNING: The amount of free space being pointed to by 'buffer', has to - * exceed the amount of the input data by one byte, and the - * entries of the array pointed to by 'str' have to be in the - * range of 0x0000 to 0x10FFFF, otherwise the program might - * crash! - */ - -ssize_t utf8proc_map( - const uint8_t *str, ssize_t strlen, uint8_t **dstptr, int options -); -/* - * Maps the given UTF-8 string being pointed to by 'str' to a new UTF-8 - * string, which is allocated dynamically, and afterwards pointed to by - * the pointer being pointed to by 'dstptr'. - * If the NULLTERM flag in the 'options' field is set, the length is - * determined by a NULL terminator, otherwise the parameter 'strlen' is - * evaluated to determine the string length, but in any case the result - * will be NULL terminated (though it might contain NULL characters - * before). Other flags in the 'options' field are passed to the functions - * defined above, and regarded as described. - * In case of success the length of the new string is returned, - * otherwise a negative error code is returned. - * NOTICE: The memory of the new UTF-8 string will have been allocated with - * 'malloc', and has theirfore to be freed with 'free'. - */ - -uint8_t *utf8proc_NFD(const uint8_t *str); -uint8_t *utf8proc_NFC(const uint8_t *str); -uint8_t *utf8proc_NFKD(const uint8_t *str); -uint8_t *utf8proc_NFKC(const uint8_t *str); -/* - * Returns a pointer to newly allocated memory of a NFD, NFC, NFKD or NFKC - * normalized version of the null-terminated string 'str'. - */ - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/cpukit/libmisc/uuid/uuid.h b/cpukit/libmisc/uuid/uuid.h deleted file mode 100644 index ca846da0f0..0000000000 --- a/cpukit/libmisc/uuid/uuid.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Public include file for the UUID library - * - * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. - * - * %Begin-Header% - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, and the entire permission notice in its entirety, - * including the disclaimer of warranties. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF - * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * %End-Header% - */ - -#ifndef _UUID_UUID_H -#define _UUID_UUID_H - -#include <sys/types.h> -#ifndef _WIN32 -#include <sys/time.h> -#endif -#include <time.h> - -typedef unsigned char uuid_t[16]; - -/* UUID Variant definitions */ -#define UUID_VARIANT_NCS 0 -#define UUID_VARIANT_DCE 1 -#define UUID_VARIANT_MICROSOFT 2 -#define UUID_VARIANT_OTHER 3 - -/* UUID Type definitions */ -#define UUID_TYPE_DCE_TIME 1 -#define UUID_TYPE_DCE_RANDOM 4 - -/* Allow UUID constants to be defined */ -#ifdef __GNUC__ -#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ - static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} -#else -#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ - static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* clear.c */ -void uuid_clear(uuid_t uu); - -/* compare.c */ -int uuid_compare(const uuid_t uu1, const uuid_t uu2); - -/* copy.c */ -void uuid_copy(uuid_t dst, const uuid_t src); - -/* gen_uuid.c */ -void uuid_generate(uuid_t out); -void uuid_generate_random(uuid_t out); -void uuid_generate_time(uuid_t out); - -/* isnull.c */ -int uuid_is_null(const uuid_t uu); - -/* parse.c */ -int uuid_parse(const char *in, uuid_t uu); - -/* unparse.c */ -void uuid_unparse(const uuid_t uu, char *out); -void uuid_unparse_lower(const uuid_t uu, char *out); -void uuid_unparse_upper(const uuid_t uu, char *out); - -/* uuid_time.c */ -time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); -int uuid_type(const uuid_t uu); -int uuid_variant(const uuid_t uu); - -#ifdef __cplusplus -} -#endif - -#endif /* _UUID_UUID_H */ diff --git a/cpukit/libmisc/xz/xz.h b/cpukit/libmisc/xz/xz.h deleted file mode 100644 index 0a4b38d33c..0000000000 --- a/cpukit/libmisc/xz/xz.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * XZ decompressor - * - * Authors: Lasse Collin <lasse.collin@tukaani.org> - * Igor Pavlov <http://7-zip.org/> - * - * This file has been put into the public domain. - * You can do whatever you want with this file. - */ - -#ifndef XZ_H -#define XZ_H - -#ifdef __KERNEL__ -# include <linux/stddef.h> -# include <linux/types.h> -#else -# include <stddef.h> -# include <stdint.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* In Linux, this is used to make extern functions static when needed. */ -#ifndef XZ_EXTERN -# define XZ_EXTERN extern -#endif - -/** - * enum xz_mode - Operation mode - * - * @XZ_SINGLE: Single-call mode. This uses less RAM than - * than multi-call modes, because the LZMA2 - * dictionary doesn't need to be allocated as - * part of the decoder state. All required data - * structures are allocated at initialization, - * so xz_dec_run() cannot return XZ_MEM_ERROR. - * @XZ_PREALLOC: Multi-call mode with preallocated LZMA2 - * dictionary buffer. All data structures are - * allocated at initialization, so xz_dec_run() - * cannot return XZ_MEM_ERROR. - * @XZ_DYNALLOC: Multi-call mode. The LZMA2 dictionary is - * allocated once the required size has been - * parsed from the stream headers. If the - * allocation fails, xz_dec_run() will return - * XZ_MEM_ERROR. - * - * It is possible to enable support only for a subset of the above - * modes at compile time by defining XZ_DEC_SINGLE, XZ_DEC_PREALLOC, - * or XZ_DEC_DYNALLOC. The xz_dec kernel module is always compiled - * with support for all operation modes, but the preboot code may - * be built with fewer features to minimize code size. - */ -enum xz_mode { - XZ_SINGLE, - XZ_PREALLOC, - XZ_DYNALLOC -}; - -/** - * enum xz_ret - Return codes - * @XZ_OK: Everything is OK so far. More input or more - * output space is required to continue. This - * return code is possible only in multi-call mode - * (XZ_PREALLOC or XZ_DYNALLOC). - * @XZ_STREAM_END: Operation finished successfully. - * @XZ_UNSUPPORTED_CHECK: Integrity check type is not supported. Decoding - * is still possible in multi-call mode by simply - * calling xz_dec_run() again. - * Note that this return value is used only if - * XZ_DEC_ANY_CHECK was defined at build time, - * which is not used in the kernel. Unsupported - * check types return XZ_OPTIONS_ERROR if - * XZ_DEC_ANY_CHECK was not defined at build time. - * @XZ_MEM_ERROR: Allocating memory failed. This return code is - * possible only if the decoder was initialized - * with XZ_DYNALLOC. The amount of memory that was - * tried to be allocated was no more than the - * dict_max argument given to xz_dec_init(). - * @XZ_MEMLIMIT_ERROR: A bigger LZMA2 dictionary would be needed than - * allowed by the dict_max argument given to - * xz_dec_init(). This return value is possible - * only in multi-call mode (XZ_PREALLOC or - * XZ_DYNALLOC); the single-call mode (XZ_SINGLE) - * ignores the dict_max argument. - * @XZ_FORMAT_ERROR: File format was not recognized (wrong magic - * bytes). - * @XZ_OPTIONS_ERROR: This implementation doesn't support the requested - * compression options. In the decoder this means - * that the header CRC32 matches, but the header - * itself specifies something that we don't support. - * @XZ_DATA_ERROR: Compressed data is corrupt. - * @XZ_BUF_ERROR: Cannot make any progress. Details are slightly - * different between multi-call and single-call - * mode; more information below. - * - * In multi-call mode, XZ_BUF_ERROR is returned when two consecutive calls - * to XZ code cannot consume any input and cannot produce any new output. - * This happens when there is no new input available, or the output buffer - * is full while at least one output byte is still pending. Assuming your - * code is not buggy, you can get this error only when decoding a compressed - * stream that is truncated or otherwise corrupt. - * - * In single-call mode, XZ_BUF_ERROR is returned only when the output buffer - * is too small or the compressed input is corrupt in a way that makes the - * decoder produce more output than the caller expected. When it is - * (relatively) clear that the compressed input is truncated, XZ_DATA_ERROR - * is used instead of XZ_BUF_ERROR. - */ -enum xz_ret { - XZ_OK, - XZ_STREAM_END, - XZ_UNSUPPORTED_CHECK, - XZ_MEM_ERROR, - XZ_MEMLIMIT_ERROR, - XZ_FORMAT_ERROR, - XZ_OPTIONS_ERROR, - XZ_DATA_ERROR, - XZ_BUF_ERROR -}; - -/** - * struct xz_buf - Passing input and output buffers to XZ code - * @in: Beginning of the input buffer. This may be NULL if and only - * if in_pos is equal to in_size. - * @in_pos: Current position in the input buffer. This must not exceed - * in_size. - * @in_size: Size of the input buffer - * @out: Beginning of the output buffer. This may be NULL if and only - * if out_pos is equal to out_size. - * @out_pos: Current position in the output buffer. This must not exceed - * out_size. - * @out_size: Size of the output buffer - * - * Only the contents of the output buffer from out[out_pos] onward, and - * the variables in_pos and out_pos are modified by the XZ code. - */ -struct xz_buf { - const uint8_t *in; - size_t in_pos; - size_t in_size; - - uint8_t *out; - size_t out_pos; - size_t out_size; -}; - -/** - * struct xz_dec - Opaque type to hold the XZ decoder state - */ -struct xz_dec; - -/** - * xz_dec_init() - Allocate and initialize a XZ decoder state - * @mode: Operation mode - * @dict_max: Maximum size of the LZMA2 dictionary (history buffer) for - * multi-call decoding. This is ignored in single-call mode - * (mode == XZ_SINGLE). LZMA2 dictionary is always 2^n bytes - * or 2^n + 2^(n-1) bytes (the latter sizes are less common - * in practice), so other values for dict_max don't make sense. - * In the kernel, dictionary sizes of 64 KiB, 128 KiB, 256 KiB, - * 512 KiB, and 1 MiB are probably the only reasonable values, - * except for kernel and initramfs images where a bigger - * dictionary can be fine and useful. - * - * Single-call mode (XZ_SINGLE): xz_dec_run() decodes the whole stream at - * once. The caller must provide enough output space or the decoding will - * fail. The output space is used as the dictionary buffer, which is why - * there is no need to allocate the dictionary as part of the decoder's - * internal state. - * - * Because the output buffer is used as the workspace, streams encoded using - * a big dictionary are not a problem in single-call mode. It is enough that - * the output buffer is big enough to hold the actual uncompressed data; it - * can be smaller than the dictionary size stored in the stream headers. - * - * Multi-call mode with preallocated dictionary (XZ_PREALLOC): dict_max bytes - * of memory is preallocated for the LZMA2 dictionary. This way there is no - * risk that xz_dec_run() could run out of memory, since xz_dec_run() will - * never allocate any memory. Instead, if the preallocated dictionary is too - * small for decoding the given input stream, xz_dec_run() will return - * XZ_MEMLIMIT_ERROR. Thus, it is important to know what kind of data will be - * decoded to avoid allocating excessive amount of memory for the dictionary. - * - * Multi-call mode with dynamically allocated dictionary (XZ_DYNALLOC): - * dict_max specifies the maximum allowed dictionary size that xz_dec_run() - * may allocate once it has parsed the dictionary size from the stream - * headers. This way excessive allocations can be avoided while still - * limiting the maximum memory usage to a sane value to prevent running the - * system out of memory when decompressing streams from untrusted sources. - * - * On success, xz_dec_init() returns a pointer to struct xz_dec, which is - * ready to be used with xz_dec_run(). If memory allocation fails, - * xz_dec_init() returns NULL. - */ -XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max); - -/** - * xz_dec_run() - Run the XZ decoder - * @s: Decoder state allocated using xz_dec_init() - * @b: Input and output buffers - * - * The possible return values depend on build options and operation mode. - * See enum xz_ret for details. - * - * Note that if an error occurs in single-call mode (return value is not - * XZ_STREAM_END), b->in_pos and b->out_pos are not modified and the - * contents of the output buffer from b->out[b->out_pos] onward are - * undefined. This is true even after XZ_BUF_ERROR, because with some filter - * chains, there may be a second pass over the output buffer, and this pass - * cannot be properly done if the output buffer is truncated. Thus, you - * cannot give the single-call decoder a too small buffer and then expect to - * get that amount valid data from the beginning of the stream. You must use - * the multi-call decoder if you don't want to uncompress the whole stream. - */ -XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b); - -/** - * xz_dec_reset() - Reset an already allocated decoder state - * @s: Decoder state allocated using xz_dec_init() - * - * This function can be used to reset the multi-call decoder state without - * freeing and reallocating memory with xz_dec_end() and xz_dec_init(). - * - * In single-call mode, xz_dec_reset() is always called in the beginning of - * xz_dec_run(). Thus, explicit call to xz_dec_reset() is useful only in - * multi-call mode. - */ -XZ_EXTERN void xz_dec_reset(struct xz_dec *s); - -/** - * xz_dec_end() - Free the memory allocated for the decoder state - * @s: Decoder state allocated using xz_dec_init(). If s is NULL, - * this function does nothing. - */ -XZ_EXTERN void xz_dec_end(struct xz_dec *s); - -/* - * Standalone build (userspace build or in-kernel build for boot time use) - * needs a CRC32 implementation. For normal in-kernel use, kernel's own - * CRC32 module is used instead, and users of this module don't need to - * care about the functions below. - */ -#ifndef XZ_INTERNAL_CRC32 -# ifdef __KERNEL__ -# define XZ_INTERNAL_CRC32 0 -# else -# define XZ_INTERNAL_CRC32 1 -# endif -#endif - -/* - * If CRC64 support has been enabled with XZ_USE_CRC64, a CRC64 - * implementation is needed too. - */ -#ifndef XZ_USE_CRC64 -# undef XZ_INTERNAL_CRC64 -# define XZ_INTERNAL_CRC64 0 -#endif -#ifndef XZ_INTERNAL_CRC64 -# ifdef __KERNEL__ -# error Using CRC64 in the kernel has not been implemented. -# else -# define XZ_INTERNAL_CRC64 1 -# endif -#endif - -#if XZ_INTERNAL_CRC32 -/* - * This must be called before any other xz_* function to initialize - * the CRC32 lookup table. - */ -XZ_EXTERN void xz_crc32_init(void); - -/* - * Update CRC32 value using the polynomial from IEEE-802.3. To start a new - * calculation, the third argument must be zero. To continue the calculation, - * the previously returned value is passed as the third argument. - */ -XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc); -#endif - -#if XZ_INTERNAL_CRC64 -/* - * This must be called before any other xz_* function (except xz_crc32_init()) - * to initialize the CRC64 lookup table. - */ -XZ_EXTERN void xz_crc64_init(void); - -/* - * Update CRC64 value using the polynomial from ECMA-182. To start a new - * calculation, the third argument must be zero. To continue the calculation, - * the previously returned value is passed as the third argument. - */ -XZ_EXTERN uint64_t xz_crc64(const uint8_t *buf, size_t size, uint64_t crc); -#endif - -#ifdef __cplusplus -} -#endif - -#endif |