summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/assoc.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-12-23 18:18:56 +1100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-25 08:45:26 +0100
commit2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch)
tree44759efe9374f13200a97e96d91bd9a2b7e5ce2a /cpukit/include/rtems/assoc.h
parentMAINTAINERS: Add myself to Write After Approval. (diff)
downloadrtems-2afb22b7e1ebcbe40373ff7e0efae7d207c655a9.tar.bz2
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.
Diffstat (limited to 'cpukit/include/rtems/assoc.h')
-rw-r--r--cpukit/include/rtems/assoc.h204
1 files changed, 204 insertions, 0 deletions
diff --git a/cpukit/include/rtems/assoc.h b/cpukit/include/rtems/assoc.h
new file mode 100644
index 0000000000..345761758a
--- /dev/null
+++ b/cpukit/include/rtems/assoc.h
@@ -0,0 +1,204 @@
+/**
+ * @file rtems/assoc.h
+ *
+ * @brief RTEMS Associativity Routines
+ *
+ * RTEMS associativity routines. Mainly used to convert a value from
+ * one space to another (eg: our errno's to host errno's and vice-versa)
+ */
+
+
+#ifndef _RTEMS_RTEMS_ASSOC_H
+#define _RTEMS_RTEMS_ASSOC_H
+
+/**
+ * @defgroup Associativity Associativity Routines
+ */
+/**@{*/
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ const char *name;
+ uint32_t local_value;
+ uint32_t remote_value;
+} rtems_assoc_t;
+
+/*
+ * Flag/marker for optional default value in each table
+ */
+
+#define RTEMS_ASSOC_DEFAULT_NAME "(default)"
+
+/**
+ * @brief RTEMS Associate Pointer by Name
+ */
+const rtems_assoc_t *rtems_assoc_ptr_by_name(
+ const rtems_assoc_t *,
+ const char *
+);
+
+/**
+ * @brief RTEMS Associate Pointer by Remote
+ */
+const rtems_assoc_t *rtems_assoc_ptr_by_remote(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+uint32_t rtems_assoc_remote_by_local(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Associate Local by Remote
+ */
+uint32_t rtems_assoc_local_by_remote(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Associate Remote by Name
+ */
+uint32_t rtems_assoc_remote_by_name(
+ const rtems_assoc_t *,
+ const char *
+);
+
+/**
+ * @brief RTEMS Associate Local by Name
+ */
+uint32_t rtems_assoc_local_by_name(
+ const rtems_assoc_t *,
+ const char *
+);
+
+/**
+ * @brief RTEMS Associate Name by Local
+ */
+const char *rtems_assoc_name_by_local(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Associate Name by Remote
+ */
+const char *rtems_assoc_name_by_remote(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Assoc Routines
+ */
+uint32_t rtems_assoc_remote_by_local_bitfield(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Associate Name by Local Bitfield
+ */
+char *rtems_assoc_name_by_local_bitfield(
+ const rtems_assoc_t *,
+ uint32_t ,
+ char *
+);
+
+/**
+ * @brief RTEMS Associate Name by Remote Bitfield
+ */
+char *rtems_assoc_name_by_remote_bitfield(
+ const rtems_assoc_t *,
+ uint32_t ,
+ char *
+);
+
+uint32_t rtems_assoc_local_by_remote_bitfield(
+ const rtems_assoc_t *,
+ uint32_t
+);
+
+/**
+ * @brief RTEMS Associate Pointer by Local
+ */
+const rtems_assoc_t *rtems_assoc_ptr_by_local(
+ const rtems_assoc_t *ap,
+ uint32_t local_value
+);
+
+#if defined(INSIDE_ASSOC)
+
+#define rtems_assoc_is_default(_ap) \
+ ((_ap)->name && !strcmp((_ap)->name, RTEMS_ASSOC_DEFAULT_NAME))
+
+/**
+ * @brief RTEMS Associate Bad Name
+ *
+ * what to return if a value is not found
+ * this is not reentrant, but it really shouldn't be invoked anyway
+ */
+const char *rtems_assoc_name_bad(
+ uint32_t bad_value
+);
+#endif
+
+typedef struct {
+ uint32_t bits;
+ const char *name;
+} rtems_assoc_32_pair;
+
+/**
+ * @brief Converts the specified value into a text representation.
+ *
+ * @param[in] value The value to convert.
+ * @param[in] buffer The buffer for the text representation.
+ * @param[in] buffer_size The buffer size in characters.
+ * @param[in] pairs Names for particular bits.
+ * @param[in] pair_count Count of pairs.
+ * @param[in] separator Separator between individual names.
+ * @param[in] fallback Fallback value in case no bits contained in the pairs
+ * are set in the value.
+ *
+ * @retval The length of the text representation. May be greater than or equal
+ * to the buffer size if truncation occurred.
+ */
+size_t rtems_assoc_32_to_string(
+ uint32_t value,
+ char *buffer,
+ size_t buffer_size,
+ const rtems_assoc_32_pair *pairs,
+ size_t pair_count,
+ const char *separator,
+ const char *fallback
+);
+
+/**
+ * @brief Converts the specified thread states into a text representation.
+ *
+ * @param[in] states The thread states to convert.
+ * @param[in] buffer The buffer for the text representation.
+ * @param[in] buffer_size The buffer size in characters.
+ *
+ * @retval The length of the text representation. May be greater than or equal
+ * to the buffer size if truncation occurred.
+ */
+size_t rtems_assoc_thread_states_to_string(
+ uint32_t states,
+ char *buffer,
+ size_t buffer_size
+);
+
+#ifdef __cplusplus
+}
+#endif
+/**@}*/
+#endif /* ! _RTEMS_RTEMS_ASSOC_H */