Skip to content

Commit

Permalink
Remove BENCH_TEST macro
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 committed May 18, 2023
1 parent eddf4fb commit 123b877
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 31 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ include_directories( ${UCONTROLLER_HDRS} ${PROJ_HDRS} )

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTARGET_CONTROLLER=${TARGET_CONTROLLER} -DTARGET_BOARD_NAME=\"${TARGET_BOARD_NAME}\" ")

if(BENCH_TEST)
set(MODULES_FLAGS "${MODULES_FLAGS} -DBENCH_TEST")
message( STATUS "${Magenta}Bench mode activated! ${ColourReset}")
endif()

# Get Git information
git_describe(GIT_TAG "--tags")
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
Expand Down
5 changes: 5 additions & 0 deletions modules/ipmb.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#include "board_ipmb.h"


/**
* @brief Address out of range of the MicroTCA Carrier's AMC Slot ID
*/
#define IPMB_ADDR_DISCONNECTED 0xA2

/**
* @brief Maximum count of messages to be sent
*/
Expand Down
4 changes: 0 additions & 4 deletions modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ int main( void )
printf("Version: %s\n", g_GIT_TAG);
printf("SHA1: %s\n", g_GIT_SHA1);

#ifdef BENCH_TEST
printf("BENCH_TEST mode activated! This will enable some debug functions, be careful!\n");
#endif

#ifdef MODULE_WATCHDOG
watchdog_init();
#endif
Expand Down
38 changes: 24 additions & 14 deletions modules/sensors/hotswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ void vTaskHotSwap( void *Parameters )
continue;
}

if ( new_state_amc ^ old_state_amc ) {
bool standalone_mode = false;
if (get_ipmb_addr() == 0xA2) {
standalone_mode = true;
}

if ( new_state_amc ^ old_state_amc ) {
if ( new_state_amc == 0 ) {
printf("AMC Hotswap handle pressed!\n");
} else {
Expand All @@ -148,9 +153,9 @@ void vTaskHotSwap( void *Parameters )
hotswap_clear_mask_bit( HOTSWAP_AMC, 1 << (!new_state_amc) );
old_state_amc = new_state_amc;
}
#ifdef BENCH_TEST
old_state_amc = new_state_amc;
#endif
if (!standalone_mode){
old_state_amc = new_state_amc;
}
}

#ifdef MODULE_RTM
Expand All @@ -167,23 +172,28 @@ void vTaskHotSwap( void *Parameters )
if ( new_state_rtm ^ old_state_rtm ) {
if ( new_state_rtm == 0 ) {
printf("RTM Hotswap handle pressed!\n");
#ifdef BENCH_TEST
payload_send_message(FRU_RTM, PAYLOAD_MESSAGE_RTM_ENABLE);
#endif

if (!standalone_mode){
payload_send_message(FRU_RTM, PAYLOAD_MESSAGE_RTM_ENABLE);
}
} else {
printf("RTM Hotswap handle released!\n");
#ifdef BENCH_TEST
payload_send_message(FRU_RTM, PAYLOAD_MESSAGE_QUIESCE);
#endif
printf("RTM Hotswap handle released!\n");

if (!standalone_mode){
payload_send_message(FRU_RTM, PAYLOAD_MESSAGE_QUIESCE);
}

}
if ( hotswap_send_event( hotswap_rtm_sensor, new_state_rtm ) == ipmb_error_success ) {
hotswap_set_mask_bit( HOTSWAP_RTM, 1 << new_state_rtm );
hotswap_clear_mask_bit( HOTSWAP_RTM, 1 << (!new_state_rtm) );
old_state_rtm = new_state_rtm;
}
#ifdef BENCH_TEST
old_state_rtm = new_state_rtm;
#endif

if(!standalone_mode) {
old_state_rtm = new_state_rtm;
}

}
#endif
}
Expand Down
14 changes: 10 additions & 4 deletions port/board/afc-bpm/v3_1/payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,17 @@ TaskHandle_t vTaskPayload_Handle;

void payload_init( void )
{
/* Set standalone mode if the module is disconnected from a create*/
bool standalone_mode = false;

#ifndef BENCH_TEST
/* Wait until ENABLE# signal is asserted ( ENABLE == 0) */
while ( gpio_read_pin( PIN_PORT(GPIO_MMC_ENABLE), PIN_NUMBER(GPIO_MMC_ENABLE) ) == 1 ) {};
#endif
if(get_ipmb_addr() == IPMB_ADDR_DISCONNECTED){
standalone_mode = true;
}

if(!standalone_mode) {
/* Wait until ENABLE# signal is asserted ( ENABLE == 0) */
while ( gpio_read_pin( PIN_PORT(GPIO_MMC_ENABLE), PIN_NUMBER(GPIO_MMC_ENABLE) ) == 1 ) {};
}

xTaskCreate( vTaskPayload, "Payload", 120, NULL, tskPAYLOAD_PRIORITY, &vTaskPayload_Handle );

Expand Down
17 changes: 13 additions & 4 deletions port/board/afc-timing/payload.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,19 @@ TaskHandle_t vTaskPayload_Handle;
void payload_init( void )
{

#ifndef BENCH_TEST
/* Wait until ENABLE# signal is asserted ( ENABLE == 0) */
while ( gpio_read_pin( PIN_PORT(GPIO_MMC_ENABLE), PIN_NUMBER(GPIO_MMC_ENABLE) ) == 1 ) {};
#endif

/* Set standalone mode if the module is disconnected from a create*/
bool standalone_mode = false;

if(get_ipmp_addr() == IPMB_ADDR_DISCONNECTED) {
standalone_mode = true;
}

if(!standalone_mode) {
/* Wait until ENABLE# signal is asserted ( ENABLE == 0) */
while ( gpio_read_pin( PIN_PORT(GPIO_MMC_ENABLE), PIN_NUMBER(GPIO_MMC_ENABLE) ) == 1 ) {};
}


xTaskCreate( vTaskPayload, "Payload", 120, NULL, tskPAYLOAD_PRIORITY, &vTaskPayload_Handle );

Expand Down

0 comments on commit 123b877

Please sign in to comment.