summaryrefslogtreecommitdiffstats
path: root/src/occ_405/amec
diff options
context:
space:
mode:
Diffstat (limited to 'src/occ_405/amec')
-rwxr-xr-xsrc/occ_405/amec/amec_amester.c12
-rw-r--r--src/occ_405/amec/amec_amester.h4
-rwxr-xr-xsrc/occ_405/amec/amec_sensors_core.c58
-rw-r--r--src/occ_405/amec/amec_sensors_fw.c67
-rwxr-xr-xsrc/occ_405/amec/amec_slave_smh.c120
-rwxr-xr-xsrc/occ_405/amec/amec_slave_smh.h12
-rwxr-xr-xsrc/occ_405/amec/amec_tasks.c8
7 files changed, 133 insertions, 148 deletions
diff --git a/src/occ_405/amec/amec_amester.c b/src/occ_405/amec/amec_amester.c
index 1ac5def..23def82 100755
--- a/src/occ_405/amec/amec_amester.c
+++ b/src/occ_405/amec/amec_amester.c
@@ -58,6 +58,9 @@ extern uint32_t G_present_hw_cores;
//*************************************************************************/
///Maximum size of trace buffer
+// NOTE: Any names in this file using timescale will NOT be kept in sync
+// with RTL tick time changes since this is just for AMESTER, names
+// used outside of the file by the main OCC code will be kept in sync
#define AMEC_TB_2MS_SIZE_BYTES 8192
#define AMEC_TB_250US_SIZE_BYTES 8192
#define AMEC_TB_SIZE_BYTES (AMEC_TB_250US_SIZE_BYTES + AMEC_TB_2MS_SIZE_BYTES)
@@ -85,8 +88,8 @@ DMA_BUFFER(UINT8 g_amec_tb_bytes[AMEC_TB_SIZE_BYTES]);
// Array that maintains a list of all trace buffers built.
// NOTE: Must be in same order as AMEC_TB_ENUM
DMA_BUFFER(amec_tb_t g_amec_tb_list[AMEC_MAX_NUM_TB]) = {
- //trace 2ms
- [AMEC_TB_2MS] = {
+ //trace every 8th tick
+ [AMEC_TB_EVERY_8TH_TICK] = {
"trace2ms", // name
AMEFP(500,0), // freq
(UINT8*)(UINT32)g_amec_tb_bytes, // bytes
@@ -101,8 +104,8 @@ DMA_BUFFER(amec_tb_t g_amec_tb_list[AMEC_MAX_NUM_TB]) = {
{0}, // sensors_num[]
{0} // parms_num[]
},
- // trace 250us
- [AMEC_TB_250US] = {
+ // trace every tick
+ [AMEC_TB_EVERY_TICK] = {
"trace250us", // name
AMEFP(4000,0), // freq
(UINT8*)(UINT32)g_amec_tb_bytes+AMEC_TB_2MS_SIZE_BYTES, // bytes
@@ -1051,7 +1054,6 @@ void amec_tb_record(const AMEC_TB_GUID i_guid)
/* Code */
/*------------------------------------------------------------------------*/
- // Record OCA from last 32 ms
if(G_dcom_slv_inbox_rx.tb_record)
{
// Check for valid tb write entry index
diff --git a/src/occ_405/amec/amec_amester.h b/src/occ_405/amec/amec_amester.h
index c279712..b71782a 100644
--- a/src/occ_405/amec/amec_amester.h
+++ b/src/occ_405/amec/amec_amester.h
@@ -214,8 +214,8 @@ typedef UINT16 AMEC_SENSOR_GUID;
typedef enum
{
- AMEC_TB_2MS, // GUID for 2ms trace
- AMEC_TB_250US, // GUID for 250us trace
+ AMEC_TB_EVERY_8TH_TICK, // GUID for traces every 8th tick
+ AMEC_TB_EVERY_TICK, // GUID for traces every tick
AMEC_TB_NUMBER_OF_TRACES // Number of trace buffers supported
} AMEC_TB_ENUM;
diff --git a/src/occ_405/amec/amec_sensors_core.c b/src/occ_405/amec/amec_sensors_core.c
index 6dd6dfb..df5fb09 100755
--- a/src/occ_405/amec/amec_sensors_core.c
+++ b/src/occ_405/amec/amec_sensors_core.c
@@ -164,7 +164,7 @@ void amec_update_proc_core_sensors(uint8_t i_core)
// Name: amec_calc_dts_sensors
//
// Description: Compute core temperature. This function is called every
-// 4ms/core.
+// CORE_DATA_COLLECTION_US/core.
//
// PreCondition: The core is present.
//
@@ -324,7 +324,7 @@ void amec_calc_dts_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// Name: amec_calc_freq_and_util_sensors
//
// Description: Compute the frequency and utilization sensors for a given core.
-// This function is called every 4ms/core.
+// This function is called CORE_DATA_COLLECTION_US per core.
//
// Thread: RealTime Loop
//
@@ -359,14 +359,14 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Core Frequency
// Sensor: FREQAC0
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: MHz
// Min/Max: 0/6000 (UPPER_LIMIT_PROC_FREQ_MHZ=6000)
- // Formula: cyc_delta(cycles) = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms])
- // time_delta(TOD ticks) = (TOD[t=now] - TOD[t=-4ms])
+ // Formula: cyc_delta(cycles) = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-CORE_DATA_COLLECTION_US])
+ // time_delta(TOD ticks) = (TOD[t=now] - TOD[t=-CORE_DATA_COLLECTION_US])
// frequency(MHz) = (cyc_delta / time_delta) * (2M TOD ticks / 1 second)
// = (2 * cyc_delta) / time_delta
- // NOTE: cyc_delta is the total number of cycles in 4ms time for the core
+ // NOTE: cyc_delta is the total number of cycles in CORE_DATA_COLLECTION_US time for the core
// NOTE: In the HWP where we aquire the TOD count, we shift the counter by 8
// which causes each TOD tick here to equate to 0.5us. This is why we
// are multiplying by 2 in the above equation.
@@ -402,15 +402,15 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Core Utilization
// Sensor: UTILC0
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.01 %
// Min/Max: 0/10000 (0/100%)
- // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms])
- // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms])
+ // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-CORE_DATA_COLLECTION_US])
+ // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-CORE_DATA_COLLECTION_US])
// UTIL(in %) = run_delta / cyc_delta
//
- // NOTE: cyc_delta is the total number of cycles in 4ms time for the core
- // NOTE: run_delta is the total number of cycles utilized by a specific core in 4ms
+ // NOTE: cyc_delta is the total number of cycles in CORE_DATA_COLLECTION_US time for the core
+ // NOTE: run_delta is the total number of cycles utilized by a specific core in CORE_DATA_COLLECTION_US
// </amec_formula>
// Compute Delta in PC_RUN_CYCLES
@@ -447,15 +447,15 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Core Utilization
// Sensor: None
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.01 %
// Min/Max: 0/10000 (0/100%)
- // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-4ms])
- // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms])
+ // Formula: cyc_delta = (RAW_CYCLES[t=now] - RAW_CYCLES[t=-CORE_DATA_COLLECTION_US])
+ // run_delta = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-CORE_DATA_COLLECTION_US])
// UTIL(in %) = run_delta / cyc_delta
//
- // NOTE: cyc_delta is the total number of cycles run by the core in 4ms
- // NOTE: run_delta is the total number of cycles run by a specific thread in 4ms
+ // NOTE: cyc_delta is the total number of cycles run by the core in CORE_DATA_COLLECTION_US
+ // NOTE: run_delta is the total number of cycles run by a specific thread in CORE_DATA_COLLECTION_US
// </amec_formula>
// Get RAW CYCLES for Thread
@@ -551,7 +551,7 @@ void amec_calc_freq_and_util_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Normalized Average Core Utilization
// Sensor: NUTILC0
- // Timescale: 4ms (3s rolling average)
+ // Timescale: CORE_DATA_COLLECTION_US (3s rolling average)
// Units: 0.01 %
// Min/Max: 0/10000 (0/100%)
// </amec_formula>
@@ -680,11 +680,11 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Instructions per Cycle
// Sensor: None
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.01 IPC
// Min/Max: ?
- // Formula: ipc_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-4ms])
- // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms])
+ // Formula: ipc_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-CORE_DATA_COLLECTION_US])
+ // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-CORE_DATA_COLLECTION_US])
// 100 = Convert 0.01 IPC
//
// IPC(in 0.01 IPC) = (ipc_delta * 100) / run_cycles
@@ -701,11 +701,11 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated dispatched Instructions per Cycle
// Sensor: None
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.01 DPC
// Min/Max: ?
- // Formula: dpc_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-4ms])
- // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-4ms])
+ // Formula: dpc_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-CORE_DATA_COLLECTION_US])
+ // run_cycles = (RUN_CYCLES[t=now] - RUN_CYCLES[t=-CORE_DATA_COLLECTION_US])
// 100 = Convert 0.01 DPC
//
// DPC(in 0.01DPC) = (dpc_delta * 100) / run_cycles
@@ -721,11 +721,11 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated dispatched Instructions per Second
// Sensor: None
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.2Mips
// Min/Max: ?
- // Formula: dps_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-4ms])
- // 250 = # of 4ms periods in 1 second
+ // Formula: dps_delta = (INST_DISPATCH[t=now] - INST_DISPATCH[t=-CORE_DATA_COLLECTION_US])
+ // 250 = # of CORE_DATA_COLLECTION_US periods in 1 second
// 50,000 = Convert IPS to 0.2MIPS
//
// DPS(in 0.2Mips) = (dps_delta * 250) / 50,000
@@ -741,12 +741,12 @@ void amec_calc_ips_sensors(CoreData * i_core_data_ptr, uint8_t i_core)
// <amec_formula>
// Result: Calculated Instructions per Second
// Sensor: IPSC0
- // Timescale: 4ms
+ // Timescale: CORE_DATA_COLLECTION_US
// Units: 0.2Mips
// Min/Max: ?
// Formula:
- // comp_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-4ms])
- // ticks_delta = (TOD[t=now] - TOD[t=-4ms])
+ // comp_delta = (INST_COMPLETE[t=now] - INST_COMPLETE[t=-CORE_DATA_COLLECTION_US])
+ // ticks_delta = (TOD[t=now] - TOD[t=-CORE_DATA_COLLECTION_US])
// MIPS = comp_delta (insns/interval) * (1 interval per ticks_delta 2mhz ticks) * (2M 2mhz ticks / s) / 1M
// = (2* fin2) / ticks_2mhz
//
diff --git a/src/occ_405/amec/amec_sensors_fw.c b/src/occ_405/amec/amec_sensors_fw.c
index 426df3d..525890a 100644
--- a/src/occ_405/amec/amec_sensors_fw.c
+++ b/src/occ_405/amec/amec_sensors_fw.c
@@ -100,7 +100,7 @@ void amec_update_fw_sensors(void)
int rc2 = 0;
static bool l_first_call = TRUE;
bool l_gpe0_idle, l_gpe1_idle;
- static int L_consec_trace_count = 0;
+ static uint8_t L_consec_trace_count[2] = {0};
// ------------------------------------------------------
// Update OCC Firmware Sensors from last tick
@@ -136,8 +136,9 @@ void amec_update_fw_sensors(void)
if(l_gpe0_idle && l_gpe1_idle)
{
- //reset the consecutive trace count
- L_consec_trace_count = 0;
+ //reset the consecutive trace counts
+ L_consec_trace_count[0] = 0;
+ L_consec_trace_count[1] = 0;
//Both GPE engines finished on time. Now check if they were
//successful too.
@@ -198,7 +199,7 @@ void amec_update_fw_sensors(void)
commitErrl( &l_err );
}
}
- else if(L_consec_trace_count < MAX_CONSEC_TRACE)
+ else
{
gpe_gpenxiramdbg_t xsr_sprg0 = {0};
gpe_gpenxiramedr_t ir_edr = {0};
@@ -209,29 +210,49 @@ void amec_update_fw_sensors(void)
// will tell us what GPE job is currently executing.
if(!l_gpe0_idle)
{
- xsr_sprg0.fields.xsr = in32(GPE_GPE0XIXSR);
- xsr_sprg0.fields.sprg0 = in32(GPE_GPE0XISPRG0);
- ir_edr.fields.edr = in32(GPE_GPE0XIEDR);
- ir_edr.fields.ir = in32(GPE_GPE0XIIR);
- iar_xsr.fields.iar = in32(GPE_GPE0XIIAR);
- TRAC_ERR("GPE0 programs did not complete within one tick. "
- "XSR[0x%08x] IAR[0x%08x] IR[0x%08x] EDR[0x%08x] SPRG0[0x%08X]",
- xsr_sprg0.fields.xsr, iar_xsr.fields.iar,
- ir_edr.fields.ir, ir_edr.fields.edr, xsr_sprg0.fields.sprg0);
+ INCREMENT_ERR_HISTORY(ERRH_GPE0_NOT_IDLE);
+
+ if(L_consec_trace_count[0] < MAX_CONSEC_TRACE)
+ {
+ xsr_sprg0.fields.xsr = in32(GPE_GPE0XIXSR);
+ xsr_sprg0.fields.sprg0 = in32(GPE_GPE0XISPRG0);
+ ir_edr.fields.edr = in32(GPE_GPE0XIEDR);
+ ir_edr.fields.ir = in32(GPE_GPE0XIIR);
+ iar_xsr.fields.iar = in32(GPE_GPE0XIIAR);
+ TRAC_ERR("GPE0 programs did not complete within one tick. "
+ "XSR[0x%08x] IAR[0x%08x] IR[0x%08x] EDR[0x%08x] SPRG0[0x%08X]",
+ xsr_sprg0.fields.xsr, iar_xsr.fields.iar,
+ ir_edr.fields.ir, ir_edr.fields.edr, xsr_sprg0.fields.sprg0);
+ L_consec_trace_count[0]++;
+ }
}
+ else
+ {
+ L_consec_trace_count[0] = 0;
+ }
+
if(!l_gpe1_idle)
{
- xsr_sprg0.fields.xsr = in32(GPE_GPE1XIXSR);
- xsr_sprg0.fields.sprg0 = in32(GPE_GPE1XISPRG0);
- ir_edr.fields.edr = in32(GPE_GPE1XIEDR);
- ir_edr.fields.ir = in32(GPE_GPE1XIIR);
- iar_xsr.fields.iar = in32(GPE_GPE1XIIAR);
- TRAC_ERR("GPE1 programs did not complete within one tick. "
- "XSR[0x%08x] IAR[0x%08x] IR[0x%08x] EDR[0x%08x] SPRG0[0x%08X]",
- xsr_sprg0.fields.xsr, iar_xsr.fields.iar,
- ir_edr.fields.ir, ir_edr.fields.edr, xsr_sprg0.fields.sprg0);
+ INCREMENT_ERR_HISTORY(ERRH_GPE1_NOT_IDLE);
+
+ if(L_consec_trace_count[1] < MAX_CONSEC_TRACE)
+ {
+ xsr_sprg0.fields.xsr = in32(GPE_GPE1XIXSR);
+ xsr_sprg0.fields.sprg0 = in32(GPE_GPE1XISPRG0);
+ ir_edr.fields.edr = in32(GPE_GPE1XIEDR);
+ ir_edr.fields.ir = in32(GPE_GPE1XIIR);
+ iar_xsr.fields.iar = in32(GPE_GPE1XIIAR);
+ TRAC_ERR("GPE1 programs did not complete within one tick. "
+ "XSR[0x%08x] IAR[0x%08x] IR[0x%08x] EDR[0x%08x] SPRG0[0x%08X]",
+ xsr_sprg0.fields.xsr, iar_xsr.fields.iar,
+ ir_edr.fields.ir, ir_edr.fields.edr, xsr_sprg0.fields.sprg0);
+ L_consec_trace_count[1]++;
+ }
+ }
+ else
+ {
+ L_consec_trace_count[1] = 0;
}
- L_consec_trace_count++;
}
}
}
diff --git a/src/occ_405/amec/amec_slave_smh.c b/src/occ_405/amec/amec_slave_smh.c
index cb349f8..9142caa 100755
--- a/src/occ_405/amec/amec_slave_smh.c
+++ b/src/occ_405/amec/amec_slave_smh.c
@@ -83,9 +83,6 @@ smh_state_t G_amec_slv_state = {AMEC_INITIAL_STATE,
AMEC_INITIAL_STATE,
AMEC_INITIAL_STATE};
-// Number of ticks for periodically updating VRM-related data
-#define AMEC_UPDATE_VRM_TICKS 4000
-
// This table presents the core data sensors collection pattern.
// This pattern is not completely rbitrary, and it must always
// follow track the GPE request pattern for the data collection.
@@ -108,7 +105,7 @@ const uint8_t G_sensor_update_pattern[AMEC_SMH_STATES_PER_LVL][CORES_PER_STATE]
// --------------------------------------------------------
// AMEC Slave State 1 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
@@ -127,26 +124,26 @@ const smh_tbl_t amec_slv_state_1_substate_table[AMEC_SMH_STATES_PER_LVL] =
// --------------------------------------------------------
// AMEC Slave State 2 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_2_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
- {amec_slv_substate_2_0, NULL}, // Substate 2.0
- {NULL, NULL}, // Substate 2.1 (not used)
- {NULL, NULL}, // Substate 2.2 (not used)
- {NULL, NULL}, // Substate 2.3 (not used)
- {amec_slv_substate_2_4, NULL}, // Substate 2.4
- {NULL, NULL}, // Substate 2.5 (not used)
- {NULL, NULL}, // Substate 2.6 (not used)
- {NULL, NULL}, // Substate 2.7 (not used)
+ {amec_slv_substate_2_even, NULL}, // Substate 2.0
+ {NULL, NULL}, // Substate 2.1 (not used)
+ {amec_slv_substate_2_even, NULL}, // Substate 2.2
+ {NULL, NULL}, // Substate 2.3 (not used)
+ {amec_slv_substate_2_even, NULL}, // Substate 2.4
+ {NULL, NULL}, // Substate 2.5 (not used)
+ {amec_slv_substate_2_even, NULL}, // Substate 2.6
+ {NULL, NULL}, // Substate 2.7 (not used)
};
// --------------------------------------------------------
// AMEC Slave State 3 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
@@ -165,7 +162,7 @@ const smh_tbl_t amec_slv_state_3_substate_table[AMEC_SMH_STATES_PER_LVL] =
// --------------------------------------------------------
// AMEC Slave State 5 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
@@ -184,26 +181,26 @@ const smh_tbl_t amec_slv_state_5_substate_table[AMEC_SMH_STATES_PER_LVL] =
// --------------------------------------------------------
// AMEC Slave State 6 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
const smh_tbl_t amec_slv_state_6_substate_table[AMEC_SMH_STATES_PER_LVL] =
{
- {NULL, NULL}, // Substate 6.0 (not used)
- {amec_slv_substate_6_1, NULL}, // Substate 6.1
- {NULL, NULL}, // Substate 6.2 (not used)
- {amec_slv_substate_6_3, NULL}, // Substate 6.3
- {NULL, NULL}, // Substate 6.4 (not used)
- {amec_slv_substate_6_5, NULL}, // Substate 6.5
- {NULL, NULL}, // Substate 6.6 (not used)
- {amec_slv_substate_6_7, NULL}, // Substate 6.7
+ {amec_slv_substate_6_all, NULL}, // Substate 6.0
+ {amec_slv_substate_6_all, NULL}, // Substate 6.1
+ {amec_slv_substate_6_all, NULL}, // Substate 6.2
+ {amec_slv_substate_6_all, NULL}, // Substate 6.3
+ {amec_slv_substate_6_all, NULL}, // Substate 6.4
+ {amec_slv_substate_6_all, NULL}, // Substate 6.5
+ {amec_slv_substate_6_all, NULL}, // Substate 6.6
+ {amec_slv_substate_6_all, NULL}, // Substate 6.7
};
// --------------------------------------------------------
// AMEC Slave State 7 Substate Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 16ms.
+// Each substate runs every 64th tick time = 64 * MICS_PER_TICK
//
// No Substates
//
@@ -223,7 +220,7 @@ const smh_tbl_t amec_slv_state_7_substate_table[AMEC_SMH_STATES_PER_LVL] =
// --------------------------------------------------------
// Main AMEC Slave State Table
// --------------------------------------------------------
-// Each function inside this state table runs once every 2ms.
+// Each function inside this state table runs once every 8th tick
//
const smh_tbl_t amec_slv_state_table[AMEC_SMH_STATES_PER_LVL] =
{
@@ -447,10 +444,9 @@ void amec_slv_common_tasks_post(void)
// Call the OCC slave's performance check
amec_slv_check_perf();
- // Call the 250us trace recording if it has been configured via Amester.
+ // Call the every tick trace recording if it has been configured via Amester.
// If not configured, this call will return immediately.
- amec_tb_record(AMEC_TB_250US);
-
+ amec_tb_record(AMEC_TB_EVERY_TICK);
}
else
L_active_1tick = TRUE;
@@ -467,8 +463,8 @@ void amec_slv_common_tasks_post(void)
if(G_inband_occ_cmd_state != INBAND_OCC_CMD_NONE)
{
// call inband command handler if in active, char or obs state
- if ( (IS_OCC_STATE_ACTIVE() && L_active_1tick) || IS_OCC_STATE_OBSERVATION() ||
- IS_OCC_STATE_CHARACTERIZATION() )
+ if ( IS_OCC_STATE_ACTIVE() || IS_OCC_STATE_OBSERVATION() ||
+ IS_OCC_STATE_CHARACTERIZATION() )
{
inband_command_handler();
}
@@ -501,9 +497,9 @@ void amec_slv_state_0(void)
sensor_vector_update(AMECSENSOR_PTR(IPS), 1);
sensor_vector_update(AMECSENSOR_PTR(UTIL), 1);
- // Call the trace function for 2ms tracing if it has been configured via
+ // Call the trace function for every 8th tick tracing if it has been configured via
// Amester. If not configured, this call will return immediately.
- amec_tb_record(AMEC_TB_2MS);
+ amec_tb_record(AMEC_TB_EVERY_8TH_TICK);
}
@@ -631,7 +627,7 @@ void amec_slv_state_5(void)
//-------------------------------------------------------
// Update partition sensors for DPS algorithms (for this tick)
//-------------------------------------------------------
-// amec_dps_main();
+ amec_dps_main();
}
@@ -865,27 +861,20 @@ void amec_slv_substate_1_7(void)
// Function Specification
//
-// Name: amec_slv_substate_2_0
-// amec_slv_substate_2_4
+// Name: amec_slv_substate_2_even
//
-// Description: slave substate amec_slv_substate_2_0
-// slave substate amec_slv_substate_2_4
-// other substates of state 2 are not currently used
+// Description: even numbered slave substates
+// gives state 2 substate function to be called every 16th tick
+// Time = 16 * MICS_PER_TICK
+// odd substates of state 2 are not currently used
//
// End Function Specification
-void amec_slv_substate_2_0(void)
-{
- AMEC_DBG("\tAMEC Slave State 2.0\n");
- amec_slv_update_main_mem_sensors();
-}
-
-void amec_slv_substate_2_4(void)
+void amec_slv_substate_2_even(void)
{
- AMEC_DBG("\tAMEC Slave State 2.4\n");
+ AMEC_DBG("\tAMEC Slave State 2 even substate\n");
amec_slv_update_main_mem_sensors();
}
-
// Function Specification
//
// Name: amec_slv_substate_3_0
@@ -1259,39 +1248,16 @@ void amec_slv_substate_5_7(void)
// Function Specification
//
-// Name: amec_slv_substate_6_1
-// amec_slv_substate_6_3
-// amec_slv_substate_6_5
-// amec_slv_substate_6_7
+// Name: amec_slv_substate_6_all
//
-// Description: slave substate amec_slv_substate_6_1
-// slave substate amec_slv_substate_6_3
-// slave substate amec_slv_substate_6_5
-// slave substate amec_slv_substate_6_7
-// other substates of state 6 are not currently used
+// Description: Called for every substate of state 6
+// gives state 6 substate function to be called every 8th tick
+// Time = 8 * MICS_PER_TICK
//
// End Function Specification
-void amec_slv_substate_6_1(void)
-{
- AMEC_DBG("\tAMEC Slave State 6.1\n");
- inband_command_check();
-}
-
-void amec_slv_substate_6_3(void)
-{
- AMEC_DBG("\tAMEC Slave State 6.3\n");
- inband_command_check();
-}
-
-void amec_slv_substate_6_5(void)
-{
- AMEC_DBG("\tAMEC Slave State 6.5\n");
- inband_command_check();
-}
-
-void amec_slv_substate_6_7(void)
+void amec_slv_substate_6_all(void)
{
- AMEC_DBG("\tAMEC Slave State 6.7\n");
+ AMEC_DBG("\tAMEC Slave State 6 substate\n");
inband_command_check();
}
diff --git a/src/occ_405/amec/amec_slave_smh.h b/src/occ_405/amec/amec_slave_smh.h
index 6cca955..f761c72 100755
--- a/src/occ_405/amec/amec_slave_smh.h
+++ b/src/occ_405/amec/amec_slave_smh.h
@@ -100,9 +100,8 @@ void amec_slv_substate_1_5(void);
void amec_slv_substate_1_6(void);
void amec_slv_substate_1_7(void);
-// Slave SubState 2 (6 SubStates unused)
-void amec_slv_substate_2_0(void);
-void amec_slv_substate_2_4(void);
+// Slave SubState 2 (odd SubStates currently unused)
+void amec_slv_substate_2_even(void);
// Slave SubState 3
void amec_slv_substate_3_0(void);
@@ -124,11 +123,8 @@ void amec_slv_substate_5_5(void);
void amec_slv_substate_5_6(void);
void amec_slv_substate_5_7(void);
-// Slave SubState 6 (4 SubStates unused) check for inband cmd every 4ms
-void amec_slv_substate_6_1(void);
-void amec_slv_substate_6_3(void);
-void amec_slv_substate_6_5(void);
-void amec_slv_substate_6_7(void);
+// Slave SubState 6 called every SubState - check for inband cmd every 4ms
+void amec_slv_substate_6_all(void);
// Slave SubState 7
void amec_slv_substate_7_0(void);
diff --git a/src/occ_405/amec/amec_tasks.c b/src/occ_405/amec/amec_tasks.c
index 0fe6041..452532e 100755
--- a/src/occ_405/amec/amec_tasks.c
+++ b/src/occ_405/amec/amec_tasks.c
@@ -76,10 +76,10 @@ uint8_t _rotl8(uint8_t val, uint8_t shift)
//
// Description: Generic State Machine that allows for 8 states per level,
// with 3 levels.
-// If State Machine gets called/incremented every 250us,
-// - Each function entry in Level 0 table runs every 2ms,
-// - Each function entry in Level 1 table will run every 16ms,
-// - Each function entry in Level 2 table will run every 128ms.
+// If State Machine gets called/incremented every 500us,
+// - Each function entry in Level 0 table runs every 4ms,
+// - Each function entry in Level 1 table will run every 32ms,
+// - Each function entry in Level 2 table will run every 256ms.
//
// Anything longer than that will need to be taken care of
// inside of the states themselves.
OpenPOWER on IntegriCloud