Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vcos_cfg.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. Copyright (c) 2012, Broadcom Europe Ltd
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of the copyright holder nor the
  12. names of its contributors may be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #if !defined( VCOS_CFG_H )
  26. #define VCOS_CFG_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "vcos_types.h"
  31. #include "pthreads/vcos_platform.h"
  32. typedef struct opaque_vcos_cfg_buf_t *VCOS_CFG_BUF_T;
  33. typedef struct opaque_vcos_cfg_entry_t *VCOS_CFG_ENTRY_T;
  34. /** \file vcos_file.h
  35. *
  36. * API for accessing configuration/statistics information. This
  37. * is loosely modelled on the linux proc entries.
  38. */
  39. typedef void (*VCOS_CFG_SHOW_FPTR)( VCOS_CFG_BUF_T buf, void *data );
  40. typedef void (*VCOS_CFG_PARSE_FPTR)( VCOS_CFG_BUF_T buf, void *data );
  41. /** Create a configuration directory.
  42. *
  43. * @param entry Place to store the created config entry.
  44. * @param parent Parent entry (for directory like config
  45. * options).
  46. * @param entryName Name of the directory.
  47. */
  48. VCOS_STATUS_T vcos_cfg_mkdir( VCOS_CFG_ENTRY_T *entry,
  49. VCOS_CFG_ENTRY_T *parent,
  50. const char *dirName );
  51. /** Create a configuration entry.
  52. *
  53. * @param entry Place to store the created config entry.
  54. * @param parent Parent entry (for directory like config
  55. * options).
  56. * @param entryName Name of the configuration entry.
  57. * @param showFunc Function pointer to show configuration
  58. * data.
  59. * @param parseFunc Function pointer to parse new data.
  60. */
  61. VCOS_STATUS_T vcos_cfg_create_entry( VCOS_CFG_ENTRY_T *entry,
  62. VCOS_CFG_ENTRY_T *parent,
  63. const char *entryName,
  64. VCOS_CFG_SHOW_FPTR showFunc,
  65. VCOS_CFG_PARSE_FPTR parseFunc,
  66. void *data );
  67. /** Determines if a configuration entry has been created or not.
  68. *
  69. * @param entry Configuration entry to query.
  70. */
  71. int vcos_cfg_is_entry_created( VCOS_CFG_ENTRY_T entry );
  72. /** Returns the name of a configuration entry.
  73. *
  74. * @param entry Configuration entry to query.
  75. */
  76. const char *vcos_cfg_get_entry_name( VCOS_CFG_ENTRY_T entry );
  77. /** Removes a configuration entry.
  78. *
  79. * @param entry Configuration entry to remove.
  80. */
  81. VCOS_STATUS_T vcos_cfg_remove_entry( VCOS_CFG_ENTRY_T *entry );
  82. /** Writes data into a configuration buffer. Only valid inside
  83. * the show function.
  84. *
  85. * @param buf Buffer to write data into.
  86. * @param fmt printf style format string.
  87. */
  88. void vcos_cfg_buf_printf( VCOS_CFG_BUF_T buf, const char *fmt, ... );
  89. /** Retrieves a null terminated string of the data associated
  90. * with the buffer. Only valid inside the parse function.
  91. *
  92. * @param buf Buffer to get data from.
  93. * @param fmt printf style format string.
  94. */
  95. char *vcos_cfg_buf_get_str( VCOS_CFG_BUF_T buf );
  96. void *vcos_cfg_get_proc_entry( VCOS_CFG_ENTRY_T entry );
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif