c_tlm_var.h
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
19 #ifndef C_TLM_VAR_H__
20 #define C_TLM_VAR_H__
21 #include "c_list.h"
22 #include "c_tlm_comp.h"
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
38 typedef enum {
40  tlm_int = 1,
41  tlm_uint = 2,
42  tlm_char = 3,
43  tlm_float = 4,
48 } tlm_type ;
49 
53 typedef struct {
54  const char *name;
55  const void *data_ptr;
57  uint32_t elm_size_bytes;
58  uint32_t elm_arr_size;
61 
62 
77  const char *name,
78  const void *data_ptr,
79  const uint16_t data_size,
80  const uint16_t arr_size,
81  tlm_type type);
82 
88 #define TLM_REG_VAR(comp, var, type) \
89  tlm_variable_register(comp, #var, &var, sizeof(var), 1, type)
90 
94 #define TLM_REG_ARR(comp, var, type) \
95  tlm_variable_register(comp, #var, &var[0], sizeof(var[0]), sizeof(var)/sizeof(var[0]), type)
96 
104  const char *name);
105 
112 const tlm_reg_var_type* tlm_variable_get_by_comp_and_name(const char *comp_name,
113  const char *name);
114 
123 bool tlm_variable_set_value(const char *comp_name, const char *name, const char *value);
124 
132 bool tlm_variable_get_value(const char *comp_name, const char *name, char *buffer, int len);
133 
141 bool tlm_variable_print_value(const tlm_reg_var_type *reg_var, char *buffer, int len);
142 
143 
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 #endif /* C_TLM_VAR_H__ */
uint32_t elm_arr_size
Definition: c_tlm_var.h:58
Definition: c_tlm_var.h:44
Definition: c_tlm_var.h:46
unsigned int unsigned int len
Definition: startup.cpp:197
bool tlm_variable_set_value(const char *comp_name, const char *name, const char *value)
Definition: c_tlm_var.c:117
Definition: c_tlm_var.h:53
bool tlm_variable_print_value(const tlm_reg_var_type *reg_var, char *buffer, int len)
Definition: c_tlm_var.c:230
tlm_type elm_type
Definition: c_tlm_var.h:59
const char * name
Definition: c_tlm_var.h:54
bool tlm_variable_get_value(const char *comp_name, const char *name, char *buffer, int len)
Definition: c_tlm_var.c:218
bool tlm_variable_register(tlm_component *comp_ptr, const char *name, const void *data_ptr, const uint16_t data_size, const uint16_t arr_size, tlm_type type)
Definition: c_tlm_var.c:55
Definition: c_tlm_var.h:41
tlm_type
Definition: c_tlm_var.h:38
Definition: c_tlm_var.h:40
Definition: c_tlm_var.h:45
Definition: c_tlm_var.h:42
To use the FreeRTOS so play with it a little *uses roughly of and uses roughly of RAM *The larger the the larger recording buffer *You can choose ring buffer
Definition: readme.txt:4
uint32_t elm_size_bytes
Definition: c_tlm_var.h:57
const void * data_ptr
Definition: c_tlm_var.h:55
Definition: c_tlm_var.h:39
const tlm_reg_var_type * tlm_variable_get_by_name(tlm_component *comp_ptr, const char *name)
Definition: c_tlm_var.c:94
Definition: c_tlm_var.h:47
Definition: c_tlm_comp.h:51
Definition: c_tlm_var.h:43
const tlm_reg_var_type * tlm_variable_get_by_comp_and_name(const char *comp_name, const char *name)
Definition: c_tlm_var.c:104