mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 06:47:45 +08:00
Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step. It copied header files from arbitrary locations into the build tree. The header files were included via the -Bsome/build/tree/path GCC command line option. This has at least seven problems: * The make preinstall step itself needs time and disk space. * Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error. * There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult. * The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit. * An introduction of a new build system is difficult. * Include paths specified by the -B option are system headers. This may suppress warnings. * The parallel build had sporadic failures on some hosts. This patch removes the make preinstall step. All installed header files are moved to dedicated include directories in the source tree. Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc, etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g. erc32, imx, qoriq, etc. The new cpukit include directories are: * cpukit/include * cpukit/score/cpu/@RTEMS_CPU@/include * cpukit/libnetworking The new BSP include directories are: * bsps/include * bsps/@RTEMS_CPU@/include * bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include There are build tree include directories for generated files. The include directory order favours the most general header file, e.g. it is not possible to override general header files via the include path order. The "bootstrap -p" option was removed. The new "bootstrap -H" option should be used to regenerate the "headers.am" files. Update #3254.
This commit is contained in:
committed by
Sebastian Huber
parent
9704efb4ec
commit
2afb22b7e1
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -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
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -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__ */
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
@@ -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
|
||||
/**@}*/
|
||||
@@ -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 */
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user