криво работает return_type, надо разобратся
чет поделано в коде для тмс
This commit is contained in:
parent
6428e523df
commit
7b720cbdf4
BIN
DebugVarEdit.exe
BIN
DebugVarEdit.exe
Binary file not shown.
@ -182,7 +182,7 @@ class VariableSelectorDialog(QDialog):
|
||||
new_var = {
|
||||
'name': name, 'type': type_str, 'show_var': 'true',
|
||||
'enable': 'true', 'shortname': name, 'pt_type': '', 'iq_type': '',
|
||||
'return_type': 'iq_none', 'file': file_val,
|
||||
'return_type': 't_iq_none', 'file': file_val,
|
||||
'extern': str(extern_val).lower() if extern_val else 'false',
|
||||
'static': str(static_val).lower() if static_val else 'false',
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ def read_vars_from_xml(xml_path):
|
||||
'shortname': var_elem.findtext('shortname', name),
|
||||
'pt_type': var_elem.findtext('pt_type', ''),
|
||||
'iq_type': var_elem.findtext('iq_type', ''),
|
||||
'return_type': var_elem.findtext('return_type', 'int'),
|
||||
'return_type': var_elem.findtext('return_type', 'pt_iq_none'),
|
||||
'type': var_elem.findtext('type', 'unknown'),
|
||||
'file': var_elem.findtext('file', ''),
|
||||
'extern': get_bool('extern'),
|
||||
@ -608,7 +608,7 @@ def generate_xml_output(proj_path, xml_path, unique_vars, h_files_needed, vars_n
|
||||
'shortname': info.get('shortname', name),
|
||||
'pt_type': info.get('pt_type', ''),
|
||||
'iq_type': info.get('iq_type', ''),
|
||||
'return_type': info.get('return_type', 'int'),
|
||||
'return_type': info.get('return_type', 'pt_iq_none'),
|
||||
'type': info.get('type', 'unknown'),
|
||||
'file': info.get('file', ''),
|
||||
'extern': info.get('extern', False),
|
||||
@ -627,7 +627,7 @@ def generate_xml_output(proj_path, xml_path, unique_vars, h_files_needed, vars_n
|
||||
ET.SubElement(var_elem, "shortname").text = info.get('shortname', name)
|
||||
ET.SubElement(var_elem, "pt_type").text = info.get('pt_type', '')
|
||||
ET.SubElement(var_elem, "iq_type").text = info.get('iq_type', '')
|
||||
ET.SubElement(var_elem, "return_type").text = info.get('return_type', 'int')
|
||||
ET.SubElement(var_elem, "return_type").text = info.get('return_type', 'pt_iq_none')
|
||||
|
||||
ET.SubElement(var_elem, "type").text = info.get('type', 'unknown')
|
||||
rel_file = make_relative_if_possible(info.get('file', ''), proj_path).replace("\\", "/")
|
||||
|
554
debug_tools.c
554
debug_tools.c
@ -8,13 +8,15 @@ static int convertDebugVarToIQx(DebugVar_t *var, long *ret_var);
|
||||
|
||||
///////////////////////////----EXAPLE-----//////////////////////////////
|
||||
long var_numb = 1;
|
||||
DebugVarName_t var_name;
|
||||
long return_var;
|
||||
long return_ll_var;
|
||||
int result;
|
||||
char ext_date[] = {7, 233, 11, 07, 16, 50};
|
||||
void Debug_Test_Example(void)
|
||||
{
|
||||
result = Debug_ReadVar(&dbg_vars[var_numb], &return_var);
|
||||
result = Debug_ReadVar(var_numb, &return_var);
|
||||
result = Debug_ReadVarName(var_numb, var_name);
|
||||
|
||||
|
||||
if(Debug_LowLevel_Initialize(ext_date) == 0)
|
||||
@ -22,6 +24,47 @@ void Debug_Test_Example(void)
|
||||
}
|
||||
|
||||
///////////////////////////----PUBLIC-----//////////////////////////////
|
||||
int Debug_ReadVar(int var_ind, long *return_long)
|
||||
{
|
||||
if(return_long == NULL)
|
||||
return 1;
|
||||
long tmp_var;
|
||||
|
||||
if (var_ind >= DebugVar_Qnt)
|
||||
return 1;
|
||||
if((dbg_vars[var_numb].ptr_type == pt_struct) || (dbg_vars[var_numb].ptr_type == pt_union) ||
|
||||
(dbg_vars[var_numb].ptr_type == pt_unknown))
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
return convertDebugVarToIQx(&dbg_vars[var_numb], return_long);
|
||||
}
|
||||
|
||||
int Debug_ReadVarName(int var_ind, DebugVarName_t name_ptr)
|
||||
{
|
||||
if(name_ptr == NULL)
|
||||
return 1;
|
||||
|
||||
if (var_ind >= DebugVar_Qnt)
|
||||
return 1;
|
||||
|
||||
int i;
|
||||
// Êîïèðîâàíèå ñ çàùèòîé îò ïåðåïîëíåíèÿ è ÿâíîé îñòàíîâêîé ïî '\0'
|
||||
for (i = 0; i < sizeof(dbg_vars[var_numb].name); i++)
|
||||
{
|
||||
name_ptr[i] = dbg_vars[var_numb].name[i];
|
||||
if (dbg_vars[var_numb].name[i] == '\0')
|
||||
break;
|
||||
}
|
||||
// Ãàðàíòèðîâàííîå çàâåðøåíèå ñòðîêè (íà ñëó÷àé, åñëè â var->name íå áûëî '\0')
|
||||
name_ptr[sizeof(dbg_vars[var_numb].name) - 1] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Debug_LowLevel_ReadVar(long *return_long)
|
||||
{
|
||||
if (return_long == NULL)
|
||||
@ -46,46 +89,11 @@ int Debug_LowLevel_ReadVar(long *return_long)
|
||||
return 2; // Çàïðåù¸ííûé àäðåñ — íåëüçÿ ÷èòàòü
|
||||
}
|
||||
|
||||
convertDebugVarToIQx(&debug_ll.dbg_var, return_long);
|
||||
|
||||
return 0;
|
||||
return convertDebugVarToIQx(&debug_ll.dbg_var, return_long);
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
int Debug_ReadVar(DebugVar_t *var, long *return_long)
|
||||
{
|
||||
long tmp_var;
|
||||
if (var == NULL)
|
||||
return 1;
|
||||
if((var->ptr_type == pt_struct) || (var->ptr_type == pt_union) ||
|
||||
(var->ptr_type == pt_unknown))
|
||||
return 1;
|
||||
|
||||
convertDebugVarToIQx(var, return_long);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Debug_ReadVarName(DebugVar_t *var, char *name_ptr)
|
||||
{
|
||||
if((var == NULL)||(name_ptr == NULL))
|
||||
return 1;
|
||||
int i;
|
||||
// Êîïèðîâàíèå ñ çàùèòîé îò ïåðåïîëíåíèÿ è ÿâíîé îñòàíîâêîé ïî '\0'
|
||||
for (i = 0; i < sizeof(var->name); i++)
|
||||
{
|
||||
name_ptr[i] = var->name[i];
|
||||
if (var->name[i] == '\0')
|
||||
break;
|
||||
}
|
||||
// Ãàðàíòèðîâàííîå çàâåðøåíèå ñòðîêè (íà ñëó÷àé, åñëè â var->name íå áûëî '\0')
|
||||
name_ptr[sizeof(var->name) - 1] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Debug_LowLevel_Initialize(const char* external_date)
|
||||
{
|
||||
if (external_date == NULL) {
|
||||
@ -121,6 +129,18 @@ int Debug_LowLevel_Initialize(const char* external_date)
|
||||
|
||||
|
||||
/////////////////////----INTERNAL FUNCTIONS-----////////////////////////
|
||||
static int iqTypeToQ(DebugVarIQType_t t)
|
||||
{
|
||||
if (t == t_iq_none)
|
||||
return 0; // áåç IQ, float, int
|
||||
else if (t == t_iq)
|
||||
return GLOBAL_Q; // îáùèé IQ, íàïðèìåð 24
|
||||
else if (t >= t_iq1 && t <= t_iq30)
|
||||
return (int)t - (int)t_iq1 + 1; // íàïðèìåð t_iq1 -> 1, t_iq2 -> 2 è ò.ä.
|
||||
else
|
||||
return -1; // îøèáêà
|
||||
}
|
||||
|
||||
static int convertDebugVarToIQx(DebugVar_t *var, long *ret_var)
|
||||
{
|
||||
long iq_numb, iq_united, iq_final;
|
||||
@ -129,214 +149,53 @@ static int convertDebugVarToIQx(DebugVar_t *var, long *ret_var)
|
||||
if(getDebugVar(var, &iq_numb, &float_numb) != 0)
|
||||
return 1;
|
||||
|
||||
// ïðèâåäåíèå ê îäíîìó IQ
|
||||
switch(var->iq_type)
|
||||
{
|
||||
case t_iq_none:
|
||||
if(var->ptr_type == pt_float)
|
||||
{
|
||||
iq_united = _IQ(float_numb);
|
||||
}
|
||||
else
|
||||
{
|
||||
iq_united = _IQ(iq_numb);
|
||||
}
|
||||
break;
|
||||
case t_iq1:
|
||||
iq_united = _IQ1toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq2:
|
||||
iq_united = _IQ2toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq3:
|
||||
iq_united = _IQ3toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq4:
|
||||
iq_united = _IQ4toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq5:
|
||||
iq_united = _IQ5toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq6:
|
||||
iq_united = _IQ6toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq7:
|
||||
iq_united = _IQ7toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq8:
|
||||
iq_united = _IQ8toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq9:
|
||||
iq_united = _IQ9toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq10:
|
||||
iq_united = _IQ10toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq11:
|
||||
iq_united = _IQ11toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq12:
|
||||
iq_united = _IQ12toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq13:
|
||||
iq_united = _IQ13toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq14:
|
||||
iq_united = _IQ14toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq15:
|
||||
iq_united = _IQ15toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq16:
|
||||
iq_united = _IQ16toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq17:
|
||||
iq_united = _IQ17toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq18:
|
||||
iq_united = _IQ18toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq19:
|
||||
iq_united = _IQ19toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq20:
|
||||
iq_united = _IQ20toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq21:
|
||||
iq_united = _IQ21toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq22:
|
||||
iq_united = _IQ22toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq23:
|
||||
iq_united = _IQ23toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq24:
|
||||
iq_united = _IQ24toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq25:
|
||||
iq_united = _IQ25toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq26:
|
||||
iq_united = _IQ26toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq27:
|
||||
iq_united = _IQ27toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq28:
|
||||
iq_united = _IQ28toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq29:
|
||||
iq_united = _IQ29toIQ(iq_numb);
|
||||
break;
|
||||
case t_iq30:
|
||||
iq_united = _IQ30toIQ(iq_numb);
|
||||
break;
|
||||
int src_q = iqTypeToQ(var->iq_type);
|
||||
int dst_q = iqTypeToQ(var->return_type);
|
||||
|
||||
if (src_q < 0 || dst_q < 0)
|
||||
return 2; // íåïðàâèëüíûé ôîðìàò
|
||||
|
||||
long long iq_united64 = 0;
|
||||
long long iq_final64 = 0;
|
||||
|
||||
// Êîíâåðòàöèÿ ê GLOBAL_Q (64-áèò)
|
||||
if (var->iq_type == t_iq_none) {
|
||||
if (var->ptr_type == pt_float) {
|
||||
// float_numb óìíîæàåì íà 2^GLOBAL_Q (2^24=16777216)
|
||||
// Ðåçóëüòàò ïðèâîäèì ê long long
|
||||
iq_united64 = (long long)(float_numb * 16777216.0f);
|
||||
} else {
|
||||
iq_united64 = ((long long)iq_numb) << GLOBAL_Q;
|
||||
}
|
||||
} else {
|
||||
int shift = GLOBAL_Q - src_q;
|
||||
if (shift >= 0)
|
||||
iq_united64 = ((long long)iq_numb) << shift;
|
||||
else
|
||||
iq_united64 = ((long long)iq_numb) >> (-shift);
|
||||
}
|
||||
|
||||
// ïðèâåäåíèå îáùåãî IQ ê çàïðàøèâàåìîìó
|
||||
switch(var->return_type)
|
||||
{
|
||||
case t_iq_none:
|
||||
iq_final = (long)_IQtoF(iq_united);
|
||||
break;
|
||||
case t_iq1:
|
||||
iq_final = _IQtoIQ1(iq_united);
|
||||
break;
|
||||
case t_iq2:
|
||||
iq_final = _IQtoIQ2(iq_united);
|
||||
break;
|
||||
case t_iq3:
|
||||
iq_final = _IQtoIQ3(iq_united);
|
||||
break;
|
||||
case t_iq4:
|
||||
iq_final = _IQtoIQ4(iq_united);
|
||||
break;
|
||||
case t_iq5:
|
||||
iq_final = _IQtoIQ5(iq_united);
|
||||
break;
|
||||
case t_iq6:
|
||||
iq_final = _IQtoIQ6(iq_united);
|
||||
break;
|
||||
case t_iq7:
|
||||
iq_final = _IQtoIQ7(iq_united);
|
||||
break;
|
||||
case t_iq8:
|
||||
iq_final = _IQtoIQ8(iq_united);
|
||||
break;
|
||||
case t_iq9:
|
||||
iq_final = _IQtoIQ9(iq_united);
|
||||
break;
|
||||
case t_iq10:
|
||||
iq_final = _IQtoIQ10(iq_united);
|
||||
break;
|
||||
case t_iq11:
|
||||
iq_final = _IQtoIQ11(iq_united);
|
||||
break;
|
||||
case t_iq12:
|
||||
iq_final = _IQtoIQ12(iq_united);
|
||||
break;
|
||||
case t_iq13:
|
||||
iq_final = _IQtoIQ13(iq_united);
|
||||
break;
|
||||
case t_iq14:
|
||||
iq_final = _IQtoIQ14(iq_united);
|
||||
break;
|
||||
case t_iq15:
|
||||
iq_final = _IQtoIQ15(iq_united);
|
||||
break;
|
||||
case t_iq16:
|
||||
iq_final = _IQtoIQ16(iq_united);
|
||||
break;
|
||||
case t_iq17:
|
||||
iq_final = _IQtoIQ17(iq_united);
|
||||
break;
|
||||
case t_iq18:
|
||||
iq_final = _IQtoIQ18(iq_united);
|
||||
break;
|
||||
case t_iq19:
|
||||
iq_final = _IQtoIQ19(iq_united);
|
||||
break;
|
||||
case t_iq20:
|
||||
iq_final = _IQtoIQ20(iq_united);
|
||||
break;
|
||||
case t_iq21:
|
||||
iq_final = _IQtoIQ21(iq_united);
|
||||
break;
|
||||
case t_iq22:
|
||||
iq_final = _IQtoIQ22(iq_united);
|
||||
break;
|
||||
case t_iq23:
|
||||
iq_final = _IQtoIQ23(iq_united);
|
||||
break;
|
||||
case t_iq24:
|
||||
iq_final = _IQtoIQ24(iq_united);
|
||||
break;
|
||||
case t_iq25:
|
||||
iq_final = _IQtoIQ25(iq_united);
|
||||
break;
|
||||
case t_iq26:
|
||||
iq_final = _IQtoIQ26(iq_united);
|
||||
break;
|
||||
case t_iq27:
|
||||
iq_final = _IQtoIQ27(iq_united);
|
||||
break;
|
||||
case t_iq28:
|
||||
iq_final = _IQtoIQ28(iq_united);
|
||||
break;
|
||||
case t_iq29:
|
||||
iq_final = _IQtoIQ29(iq_united);
|
||||
break;
|
||||
case t_iq30:
|
||||
iq_final = _IQtoIQ30(iq_united);
|
||||
break;
|
||||
// Êîíâåðòàöèÿ èç GLOBAL_Q â öåëåâîé IQ (64-áèò)
|
||||
if (var->return_type == t_iq_none) {
|
||||
// Âîçâðàùàåì öåëîå, îòáðîñèâ äðîáíóþ ÷àñòü
|
||||
*ret_var = (long)(iq_united64 >> GLOBAL_Q);
|
||||
} else {
|
||||
int shift = dst_q - GLOBAL_Q;
|
||||
if (shift >= 0)
|
||||
iq_final64 = iq_united64 << shift;
|
||||
else
|
||||
iq_final64 = iq_united64 >> (-shift);
|
||||
|
||||
// Ïðîâåðÿåì ïåðåïîëíåíèå int32_t
|
||||
if (iq_final64 > LONG_MAX || iq_final64 < LONG_MIN)
|
||||
return 3; // ïåðåïîëíåíèå
|
||||
|
||||
*ret_var = (long)iq_final64;
|
||||
}
|
||||
|
||||
*ret_var = iq_final;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int getDebugVar(DebugVar_t *var, long *int_var, float *float_var)
|
||||
{
|
||||
if (!var || !int_var || !float_var || !var->Ptr)
|
||||
@ -355,21 +214,19 @@ static int getDebugVar(DebugVar_t *var, long *int_var, float *float_var)
|
||||
|
||||
case pt_int16: // 16 áèò (int)
|
||||
case pt_uint16:
|
||||
if (addr_val & 0x1) // ïðîâåðêà âûðàâíèâàíèÿ ïî 2 áàéòàì
|
||||
return 2; // îøèáêà âûðàâíèâàíèÿ
|
||||
*int_var = *((volatile int *)addr);
|
||||
break;
|
||||
|
||||
case pt_int32: // 32 áèò (long)
|
||||
case pt_uint32:
|
||||
if (addr_val & 0x3) // ïðîâåðêà âûðàâíèâàíèÿ ïî 4 áàéòàì
|
||||
if (addr_val & 0x1) // ïðîâåðÿåì âûðàâíèâàíèå ïî 2 ñëîâàì (4 áàéòà)
|
||||
return 3; // îøèáêà âûðàâíèâàíèÿ
|
||||
*int_var = *((volatile long *)addr);
|
||||
break;
|
||||
|
||||
// case pt_int64: // 64 áèò (long long)
|
||||
// case pt_uint64:
|
||||
// if (addr_val & 0x7) // ïðîâåðêà âûðàâíèâàíèÿ ïî 8 áàéòàì
|
||||
// if (addr_val & 0x3) // ïðîâåðêà âûðàâíèâàíèÿ ïî 4 ñëîâàì (8 áàéòàì)
|
||||
// return 2; // îøèáêà âûðàâíèâàíèÿ
|
||||
// // Òóò ïðîñòî ÷èòàåì, íî long long ìîæåò íå ïîìåñòèòüñÿ â *int_var
|
||||
// // Ìîæíî çàìåíèòü ëîãèêó ïîä 64-áèòíîå ÷òåíèå ïðè íåîáõîäèìîñòè
|
||||
@ -377,7 +234,7 @@ static int getDebugVar(DebugVar_t *var, long *int_var, float *float_var)
|
||||
// break;
|
||||
|
||||
case pt_float: // float (4 áàéòà)
|
||||
if (addr_val & 0x3) // ïðîâåðêà âûðàâíèâàíèÿ ïî 4 áàéòàì
|
||||
if (addr_val & 0x1) // ïðîâåðêà âûðàâíèâàíèÿ ïî 2 ñëîâàì
|
||||
return 4; // îøèáêà âûðàâíèâàíèÿ
|
||||
*float_var = *((volatile float *)addr);
|
||||
break;
|
||||
@ -401,3 +258,212 @@ static int getDebugVar(DebugVar_t *var, long *int_var, float *float_var)
|
||||
|
||||
return 0; // óñïåõ
|
||||
}
|
||||
|
||||
|
||||
///////////// OUTDATE ////////////////
|
||||
|
||||
//
|
||||
// // ïðèâåäåíèå ê îäíîìó IQ
|
||||
// switch(var->iq_type)
|
||||
// {
|
||||
// case t_iq_none:
|
||||
// if(var->ptr_type == pt_float)
|
||||
// {
|
||||
// iq_united = _IQ(float_numb);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// iq_united = _IQ(iq_numb);
|
||||
// }
|
||||
// break;
|
||||
// case t_iq1:
|
||||
// iq_united = _IQ1toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq2:
|
||||
// iq_united = _IQ2toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq3:
|
||||
// iq_united = _IQ3toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq4:
|
||||
// iq_united = _IQ4toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq5:
|
||||
// iq_united = _IQ5toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq6:
|
||||
// iq_united = _IQ6toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq7:
|
||||
// iq_united = _IQ7toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq8:
|
||||
// iq_united = _IQ8toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq9:
|
||||
// iq_united = _IQ9toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq10:
|
||||
// iq_united = _IQ10toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq11:
|
||||
// iq_united = _IQ11toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq12:
|
||||
// iq_united = _IQ12toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq13:
|
||||
// iq_united = _IQ13toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq14:
|
||||
// iq_united = _IQ14toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq15:
|
||||
// iq_united = _IQ15toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq16:
|
||||
// iq_united = _IQ16toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq17:
|
||||
// iq_united = _IQ17toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq18:
|
||||
// iq_united = _IQ18toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq19:
|
||||
// iq_united = _IQ19toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq20:
|
||||
// iq_united = _IQ20toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq21:
|
||||
// iq_united = _IQ21toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq22:
|
||||
// iq_united = _IQ22toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq23:
|
||||
// iq_united = _IQ23toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq24:
|
||||
// iq_united = _IQ24toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq25:
|
||||
// iq_united = _IQ25toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq26:
|
||||
// iq_united = _IQ26toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq27:
|
||||
// iq_united = _IQ27toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq28:
|
||||
// iq_united = _IQ28toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq29:
|
||||
// iq_united = _IQ29toIQ(iq_numb);
|
||||
// break;
|
||||
// case t_iq30:
|
||||
// iq_united = _IQ30toIQ(iq_numb);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// // ïðèâåäåíèå îáùåãî IQ ê çàïðàøèâàåìîìó
|
||||
// switch(var->return_type)
|
||||
// {
|
||||
// case t_iq_none:
|
||||
// iq_final = (long)_IQtoF(iq_united);
|
||||
// break;
|
||||
// case t_iq1:
|
||||
// iq_final = _IQtoIQ1(iq_united);
|
||||
// break;
|
||||
// case t_iq2:
|
||||
// iq_final = _IQtoIQ2(iq_united);
|
||||
// break;
|
||||
// case t_iq3:
|
||||
// iq_final = _IQtoIQ3(iq_united);
|
||||
// break;
|
||||
// case t_iq4:
|
||||
// iq_final = _IQtoIQ4(iq_united);
|
||||
// break;
|
||||
// case t_iq5:
|
||||
// iq_final = _IQtoIQ5(iq_united);
|
||||
// break;
|
||||
// case t_iq6:
|
||||
// iq_final = _IQtoIQ6(iq_united);
|
||||
// break;
|
||||
// case t_iq7:
|
||||
// iq_final = _IQtoIQ7(iq_united);
|
||||
// break;
|
||||
// case t_iq8:
|
||||
// iq_final = _IQtoIQ8(iq_united);
|
||||
// break;
|
||||
// case t_iq9:
|
||||
// iq_final = _IQtoIQ9(iq_united);
|
||||
// break;
|
||||
// case t_iq10:
|
||||
// iq_final = _IQtoIQ10(iq_united);
|
||||
// break;
|
||||
// case t_iq11:
|
||||
// iq_final = _IQtoIQ11(iq_united);
|
||||
// break;
|
||||
// case t_iq12:
|
||||
// iq_final = _IQtoIQ12(iq_united);
|
||||
// break;
|
||||
// case t_iq13:
|
||||
// iq_final = _IQtoIQ13(iq_united);
|
||||
// break;
|
||||
// case t_iq14:
|
||||
// iq_final = _IQtoIQ14(iq_united);
|
||||
// break;
|
||||
// case t_iq15:
|
||||
// iq_final = _IQtoIQ15(iq_united);
|
||||
// break;
|
||||
// case t_iq16:
|
||||
// iq_final = _IQtoIQ16(iq_united);
|
||||
// break;
|
||||
// case t_iq17:
|
||||
// iq_final = _IQtoIQ17(iq_united);
|
||||
// break;
|
||||
// case t_iq18:
|
||||
// iq_final = _IQtoIQ18(iq_united);
|
||||
// break;
|
||||
// case t_iq19:
|
||||
// iq_final = _IQtoIQ19(iq_united);
|
||||
// break;
|
||||
// case t_iq20:
|
||||
// iq_final = _IQtoIQ20(iq_united);
|
||||
// break;
|
||||
// case t_iq21:
|
||||
// iq_final = _IQtoIQ21(iq_united);
|
||||
// break;
|
||||
// case t_iq22:
|
||||
// iq_final = _IQtoIQ22(iq_united);
|
||||
// break;
|
||||
// case t_iq23:
|
||||
// iq_final = _IQtoIQ23(iq_united);
|
||||
// break;
|
||||
// case t_iq24:
|
||||
// iq_final = _IQtoIQ24(iq_united);
|
||||
// break;
|
||||
// case t_iq25:
|
||||
// iq_final = _IQtoIQ25(iq_united);
|
||||
// break;
|
||||
// case t_iq26:
|
||||
// iq_final = _IQtoIQ26(iq_united);
|
||||
// break;
|
||||
// case t_iq27:
|
||||
// iq_final = _IQtoIQ27(iq_united);
|
||||
// break;
|
||||
// case t_iq28:
|
||||
// iq_final = _IQtoIQ28(iq_united);
|
||||
// break;
|
||||
// case t_iq29:
|
||||
// iq_final = _IQtoIQ29(iq_united);
|
||||
// break;
|
||||
// case t_iq30:
|
||||
// iq_final = _IQtoIQ30(iq_united);
|
||||
// break;
|
||||
// }
|
||||
|
||||
// *ret_var = iq_final;
|
||||
|
@ -67,13 +67,14 @@ typedef enum
|
||||
t_iq30
|
||||
}DebugVarIQType_t;
|
||||
|
||||
typedef char DebugVarName_t[11];
|
||||
typedef struct
|
||||
{
|
||||
char* Ptr;
|
||||
DebugVarPtrType_t ptr_type;
|
||||
DebugVarIQType_t iq_type;
|
||||
DebugVarIQType_t return_type;
|
||||
char name[11]; // 10 ñèìâîëîâ + '\0'
|
||||
DebugVarName_t name;
|
||||
}DebugVar_t;
|
||||
|
||||
typedef struct {
|
||||
@ -102,9 +103,9 @@ extern DebugVar_t dbg_vars[];
|
||||
|
||||
void Debug_Test_Example(void);
|
||||
|
||||
int Debug_ReadVar(int var_ind, long *return_long);
|
||||
int Debug_ReadVarName(int var_ind, DebugVarName_t name_ptr);
|
||||
int Debug_LowLevel_ReadVar(long *return_long);
|
||||
int Debug_ReadVar(DebugVar_t *var, long *return_long);
|
||||
int Debug_ReadVarName(DebugVar_t *var, char *name_ptr);
|
||||
int Debug_LowLevel_Initialize(const char* external_date);
|
||||
|
||||
#endif //DEBUG_TOOLS
|
||||
|
74
debug_vars.c
74
debug_vars.c
@ -3,31 +3,31 @@
|
||||
|
||||
|
||||
// Èíêëþäû äëÿ äîñòóïà ê ïåðåìåííûì
|
||||
#include "xp_project.h"
|
||||
#include "RS_Functions_modbus.h"
|
||||
#include "adc_tools.h"
|
||||
#include "errors.h"
|
||||
#include "pwm_vector_regul.h"
|
||||
#include "vector.h"
|
||||
#include "f281xpwm.h"
|
||||
#include "errors.h"
|
||||
#include "RS_Functions_modbus.h"
|
||||
#include "xp_project.h"
|
||||
#include "adc_tools.h"
|
||||
#include "pwm_vector_regul.h"
|
||||
#include "log_can.h"
|
||||
#include "f281xpwm.h"
|
||||
#include "v_pwm24.h"
|
||||
#include "xp_write_xpwm_time.h"
|
||||
#include "rotation_speed.h"
|
||||
#include "teta_calc.h"
|
||||
#include "dq_to_alphabeta_cos.h"
|
||||
#include "teta_calc.h"
|
||||
#include "rotation_speed.h"
|
||||
#include "detect_phase_break2.h"
|
||||
#include "RS_Functions.h"
|
||||
#include "Spartan2E_Functions.h"
|
||||
#include "xp_controller.h"
|
||||
#include "xp_rotation_sensor.h"
|
||||
#include "x_serial_bus.h"
|
||||
#include "x_parallel_bus.h"
|
||||
#include "xPeriphSP6_loader.h"
|
||||
#include "Spartan2E_Functions.h"
|
||||
#include "x_serial_bus.h"
|
||||
#include "xp_rotation_sensor.h"
|
||||
#include "RS_Functions.h"
|
||||
#include "detect_phase_break2.h"
|
||||
#include "log_to_memory.h"
|
||||
#include "CRC_Functions.h"
|
||||
#include "CAN_Setup.h"
|
||||
#include "log_params.h"
|
||||
#include "CAN_Setup.h"
|
||||
#include "CRC_Functions.h"
|
||||
#include "log_to_memory.h"
|
||||
#include "global_time.h"
|
||||
#include "svgen_dq.h"
|
||||
#include "pid_reg3.h"
|
||||
@ -261,7 +261,6 @@ extern T_controller_read r_controller;
|
||||
extern FIFO refo;
|
||||
extern TMS_TO_TERMINAL_STRUCT reply;
|
||||
extern TMS_TO_TERMINAL_TEST_ALL_STRUCT reply_test_all;
|
||||
extern long return_var;
|
||||
extern RMP_MY1 rmp_freq;
|
||||
extern RMP_MY1 rmp_wrot;
|
||||
extern T_rotation_sensor rotation_sensor;
|
||||
@ -297,7 +296,6 @@ extern int time_pause_logs;
|
||||
extern int time_pause_titles;
|
||||
extern volatile int tryNumb;
|
||||
extern UNITES_CAN_SETUP unites_can_setup;
|
||||
extern long var_numb;
|
||||
extern VECTOR_CONTROL vect_control;
|
||||
extern WaterCooler water_cooler;
|
||||
extern _iq winding_displacement;
|
||||
@ -314,24 +312,30 @@ extern int zero_ADC[20];
|
||||
|
||||
|
||||
// Îïðåäåëåíèå ìàññèâà ñ óêàçàòåëÿìè íà ïåðåìåííûå äëÿ îòëàäêè
|
||||
int DebugVar_Qnt = 17;
|
||||
int DebugVar_Qnt = 23;
|
||||
#pragma DATA_SECTION(dbg_vars,".dbgvar_info")
|
||||
DebugVar_t dbg_vars[] = {\
|
||||
{(char *)&ADC0finishAddr, pt_int16, t_iq_none, t_iq_none, "ADC0finish" }, \
|
||||
{(char *)&ADC_sf[0][0], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][1], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][2], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][3], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][4], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][5], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][6], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][7], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][8], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][9], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][10], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][11], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][12], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][13], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][14], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&ADC_sf[0][15], pt_int16, t_iq_none, t_iq_none, "ADC_sf[0][" }, \
|
||||
{(char *)&IQ_OUT_NOM, pt_float, t_iq_none, t_iq10, "IQ_OUT_NOM" }, \
|
||||
{(char *)&KmodTerm, pt_float, t_iq_none, t_iq10, "KmodTerm" }, \
|
||||
{(char *)&freqTerm, pt_float, t_iq_none, t_iq10, "freqTerm" }, \
|
||||
{(char *)&ADC_sf[0][0], pt_int16, t_iq_none, t_iq_none, "ADC_sf00" }, \
|
||||
{(char *)&ADC_sf[0][1], pt_int16, t_iq_none, t_iq_none, "ADC_sf01" }, \
|
||||
{(char *)&ADC_sf[0][2], pt_int16, t_iq_none, t_iq_none, "ADC_sf02" }, \
|
||||
{(char *)&ADC_sf[0][3], pt_int16, t_iq_none, t_iq_none, "ADC_sf03" }, \
|
||||
{(char *)&ADC_sf[0][4], pt_int16, t_iq_none, t_iq_none, "ADC_sf04" }, \
|
||||
{(char *)&ADC_sf[0][5], pt_int16, t_iq_none, t_iq_none, "ADC_sf05" }, \
|
||||
{(char *)&ADC_sf[0][6], pt_int16, t_iq_none, t_iq_none, "ADC_sf06" }, \
|
||||
{(char *)&ADC_sf[0][7], pt_int16, t_iq_none, t_iq_none, "ADC_sf07" }, \
|
||||
{(char *)&ADC_sf[0][8], pt_int16, t_iq_none, t_iq_none, "ADC_sf08" }, \
|
||||
{(char *)&ADC_sf[0][9], pt_int16, t_iq_none, t_iq_none, "ADC_sf09" }, \
|
||||
{(char *)&ADC_sf[0][10], pt_int16, t_iq_none, t_iq_none, "ADC_sf010" }, \
|
||||
{(char *)&ADC_sf[0][11], pt_int16, t_iq_none, t_iq_none, "ADC_sf011" }, \
|
||||
{(char *)&ADC_sf[0][12], pt_int16, t_iq_none, t_iq_none, "ADC_sf012" }, \
|
||||
{(char *)&ADC_sf[0][13], pt_int16, t_iq_none, t_iq_none, "ADC_sf013" }, \
|
||||
{(char *)&ADC_sf[0][14], pt_int16, t_iq_none, t_iq_none, "ADC_sf014" }, \
|
||||
{(char *)&ADC_sf[0][15], pt_int16, t_iq_none, t_iq_none, "ADC_sf015" }, \
|
||||
{(char *)&Bender[0].KOhms, pt_uint16, t_iq_none, t_iq_none, "Bend0.KOhm" }, \
|
||||
{(char *)&Bender[0].Times, pt_uint16, t_iq_none, t_iq_none, "Bend0.Time" }, \
|
||||
{(char *)&Bender[0].Error.all, pt_uint16, t_iq_none, t_iq_none, "Bend0.Err" }, \
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user