250 lines
5.4 KiB
C
250 lines
5.4 KiB
C
|
/****************************************************************/
|
|||
|
/* TMS320C32 */
|
|||
|
/* ====== BIOS, <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> ====== */
|
|||
|
/* <09><><EFBFBD><EFBFBD> <20><><EFBFBD> (<28>) 1998-2001<30>. */
|
|||
|
/****************************************************************/
|
|||
|
/* log_to_mem.c
|
|||
|
****************************************************************
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD>y<EFBFBD><EFBFBD> *
|
|||
|
****************************************************************/
|
|||
|
|
|||
|
#include <log_to_mem.h>
|
|||
|
|
|||
|
#include "MemoryFunctions.h"
|
|||
|
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>/<2F> logs_data(), write_to_mem <20> clear_mem
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>y<EFBFBD><79> <20><>y <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><>. <20>/<2F> write_to_mem)
|
|||
|
//#pragma DATA_SECTION(count_mem,".fast_vars");
|
|||
|
//static long count_mem = START_ADDRESS_LOG;
|
|||
|
|
|||
|
#pragma DATA_SECTION(count_mem_slow,".fast_vars");
|
|||
|
static long count_mem_slow = START_ADDRESS_LOG_SLOW;
|
|||
|
|
|||
|
|
|||
|
// <20><>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>y<EFBFBD><79><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>y <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
int hb_logs_data = 0;
|
|||
|
#pragma DATA_SECTION(stop_log,".fast_vars");
|
|||
|
int stop_log = 0;
|
|||
|
int stop_log_slow = 0;
|
|||
|
|
|||
|
|
|||
|
#pragma DATA_SECTION(logpar,".fast_vars");
|
|||
|
LOGSPARAMS logpar = LOGSPARAMS_DEFAULTS;
|
|||
|
|
|||
|
#pragma DATA_SECTION(no_write,".fast_vars");
|
|||
|
int no_write = 0; // <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>)
|
|||
|
#pragma DATA_SECTION(no_write_slow,".fast_vars");
|
|||
|
int no_write_slow = 0; // <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>)
|
|||
|
|
|||
|
#pragma CODE_SECTION(clear_logpar,".fast_run");
|
|||
|
void clear_logpar()
|
|||
|
{
|
|||
|
int i;
|
|||
|
for(i=0;i<SIZE_LOGS_ARRAY;i++)
|
|||
|
logpar.logs[i] = 0;
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>y<EFBFBD><79>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#pragma CODE_SECTION(write_to_mem,".fast_run");
|
|||
|
void write_to_mem(int tlog,int DataM)
|
|||
|
{
|
|||
|
// int DataT;
|
|||
|
|
|||
|
if (tlog==FAST_LOG)
|
|||
|
{
|
|||
|
if (no_write) return;
|
|||
|
|
|||
|
if (logpar.stop_log_level_1) return;
|
|||
|
|
|||
|
if (logpar.addres_mem >= END_ADDRESS_LOG) logpar.addres_mem = END_ADDRESS_LOG;
|
|||
|
|
|||
|
i_WriteMemory(logpar.addres_mem,DataM);
|
|||
|
// *(int *)logpar.count_mem = ((DataM & 0xFFFF) );
|
|||
|
logpar.addres_mem++;
|
|||
|
}
|
|||
|
|
|||
|
if (tlog==SLOW_LOG)
|
|||
|
{
|
|||
|
if (no_write_slow) return;
|
|||
|
|
|||
|
if (logpar.stop_log_slow_level_1) return;
|
|||
|
|
|||
|
if (count_mem_slow >= END_ADDRESS_LOG_SLOW) count_mem_slow = END_ADDRESS_LOG_SLOW;
|
|||
|
|
|||
|
i_WriteMemory(count_mem_slow,DataM);
|
|||
|
// *(int *)logpar.count_mem = ((DataM & 0xFFFF) );
|
|||
|
count_mem_slow++;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#pragma CODE_SECTION(test_mem_limit,".fast_run");
|
|||
|
void test_mem_limit(int tlog,int ciclelog)
|
|||
|
{
|
|||
|
if (tlog==FAST_LOG)
|
|||
|
{
|
|||
|
if( logpar.addres_mem >= (END_ADDRESS_LOG - LENGTH_HAZARD))
|
|||
|
{
|
|||
|
logpar.real_finish_addres_mem = logpar.addres_mem;
|
|||
|
|
|||
|
if (ciclelog==1)
|
|||
|
{
|
|||
|
stop_log = 0;
|
|||
|
logpar.stop_log_level_1=0;
|
|||
|
logpar.addres_mem = START_ADDRESS_LOG;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
stop_log = 1;
|
|||
|
logpar.stop_log_level_1=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if( logpar.addres_mem >= (END_ADDRESS_LOG_LEVEL_2))
|
|||
|
{
|
|||
|
logpar.stop_log_level_2=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logpar.stop_log_level_2=0;
|
|||
|
}
|
|||
|
|
|||
|
if( logpar.addres_mem >= (END_ADDRESS_LOG_LEVEL_3))
|
|||
|
{
|
|||
|
logpar.stop_log_level_3=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logpar.stop_log_level_3=0;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (tlog==SLOW_LOG)
|
|||
|
{
|
|||
|
if (ciclelog==1)
|
|||
|
{
|
|||
|
logpar.stop_log_slow_level_1=0;
|
|||
|
}
|
|||
|
|
|||
|
if( count_mem_slow >= (END_ADDRESS_LOG_SLOW - LENGTH_HAZARD))
|
|||
|
{
|
|||
|
if (ciclelog==1)
|
|||
|
{
|
|||
|
stop_log_slow = 0;
|
|||
|
logpar.stop_log_slow_level_1=0;
|
|||
|
count_mem_slow = START_ADDRESS_LOG_SLOW;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
stop_log_slow = 1;
|
|||
|
logpar.stop_log_slow_level_1=1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if( count_mem_slow >= (END_ADDRESS_LOG_SLOW_LEVEL_2))
|
|||
|
{
|
|||
|
logpar.stop_log_slow_level_2=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logpar.stop_log_slow_level_2=0;
|
|||
|
}
|
|||
|
|
|||
|
if( count_mem_slow >= (END_ADDRESS_LOG_SLOW_LEVEL_3))
|
|||
|
{
|
|||
|
logpar.stop_log_slow_level_3=1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
logpar.stop_log_slow_level_3=0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>y<EFBFBD><79>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
void clear_mem(int tlog)
|
|||
|
{
|
|||
|
if (tlog==FAST_LOG)
|
|||
|
{
|
|||
|
logpar.real_finish_addres_mem = 0;
|
|||
|
|
|||
|
for (logpar.addres_mem=START_ADDRESS_LOG; logpar.addres_mem<END_ADDRESS_LOG; logpar.addres_mem++)//END_ADDRESS_LOG; logpar.count_mem++)
|
|||
|
i_WriteMemory(logpar.addres_mem,0x0);
|
|||
|
|
|||
|
logpar.addres_mem = START_ADDRESS_LOG;
|
|||
|
hb_logs_data = 0;
|
|||
|
stop_log = 0;
|
|||
|
|
|||
|
logpar.stop_log_level_1=0;
|
|||
|
logpar.stop_log_level_2=0;
|
|||
|
logpar.stop_log_level_3=0;
|
|||
|
logpar.start_write_fast_log = 1;
|
|||
|
}
|
|||
|
|
|||
|
if (tlog==SLOW_LOG)
|
|||
|
{
|
|||
|
|
|||
|
for (count_mem_slow=START_ADDRESS_LOG_SLOW; count_mem_slow<END_ADDRESS_LOG_SLOW; count_mem_slow++)
|
|||
|
i_WriteMemory(count_mem_slow,0x0);
|
|||
|
|
|||
|
count_mem_slow = START_ADDRESS_LOG_SLOW;
|
|||
|
hb_logs_data = 0;
|
|||
|
stop_log_slow = 0;
|
|||
|
|
|||
|
logpar.stop_log_slow_level_1=0;
|
|||
|
logpar.stop_log_slow_level_2=0;
|
|||
|
logpar.stop_log_slow_level_3=0;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
void set_start_mem(int tlog)
|
|||
|
{
|
|||
|
|
|||
|
if (tlog==FAST_LOG)
|
|||
|
{
|
|||
|
|
|||
|
logpar.real_finish_addres_mem = 0;
|
|||
|
logpar.addres_mem = START_ADDRESS_LOG;
|
|||
|
hb_logs_data = 0;
|
|||
|
stop_log = 0;
|
|||
|
|
|||
|
logpar.stop_log_level_1=0;
|
|||
|
logpar.stop_log_level_2=0;
|
|||
|
logpar.stop_log_level_3=0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (tlog==SLOW_LOG)
|
|||
|
{
|
|||
|
|
|||
|
count_mem_slow = START_ADDRESS_LOG_SLOW;
|
|||
|
hb_logs_data = 0;
|
|||
|
stop_log_slow = 0;
|
|||
|
|
|||
|
logpar.stop_log_slow_level_1=0;
|
|||
|
logpar.stop_log_slow_level_2=0;
|
|||
|
logpar.stop_log_slow_level_3=0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void get_log_params_count(void) {
|
|||
|
logpar.count_log_params_fast_log = logpar.addres_mem - START_ADDRESS_LOG;
|
|||
|
}
|