Skip to content

Commit

Permalink
Current state
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Becker committed Jun 20, 2024
1 parent f96b2e2 commit d315446
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 35 deletions.
22 changes: 15 additions & 7 deletions prj/scu-control/fg/scu_eca_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,23 @@ inline void ecaHandler( void )
#endif

if( !ecaTestTagAndPop( g_eca.pQueue, g_eca.tag ) )
{
lm32Log( LM32_LOG_ERROR, ESC_ERROR "Invalid ECA-tag: 0x%04X; expected: 0x%04X !" ESC_NORMAL,
g_eca.pQueue->tag, g_eca.tag );
return;
}

lm32Log( LM32_LOG_DEBUG, ESC_DEBUG "ECA with tag: 0x%04X received" ESC_NORMAL,
g_eca.pQueue->tag );


#ifdef CONFIG_MIL_PIGGY
bool isMilDevArmed = false;
bool isMilDevArmed = false;
#endif
SCUBUS_SLAVE_FLAGS_T active_sios = 0; /* bitmap with active sios */
SCUBUS_SLAVE_FLAGS_T activeSioSlaves = 0; /* bitmap with active sios */

/*
* Check if there are armed SCI SIO MIL or extention MIL
* Check if there are armed SCU SIO MIL or extention MIL
* function generator(s).
*/
for( unsigned int channel = 0; channel < ARRAY_SIZE(g_shared.oSaftLib.oFg.aRegs); channel++ )
Expand Down Expand Up @@ -123,7 +131,7 @@ inline void ecaHandler( void )

const unsigned int slot = getFgSlotNumber( socket );
if( (slot != 0) && isMilScuBusFg( socket ) )
active_sios |= scuBusGetSlaveFlag( slot );
activeSioSlaves |= scuBusGetSlaveFlag( slot );
}

#ifdef CONFIG_MIL_PIGGY
Expand All @@ -134,19 +142,19 @@ inline void ecaHandler( void )
/*
* Send broadcast start to active SIO SCI-BUS-slaves
*/
if( active_sios != 0 ) ECA_ATOMIC_SECTION()
if( activeSioSlaves != 0 ) ECA_ATOMIC_SECTION()
{ /*
* Select active SIO slaves.
*/
scuBusSetSlaveValue16( scuBusGetSysAddr( g_pScub_base ), MULTI_SLAVE_SEL, active_sios );
scuBusSetSlaveValue16( scuBusGetSysAddr( g_pScub_base ), MULTI_SLAVE_SEL, activeSioSlaves );

/*
* Send broadcast.
*/
scuBusSetSlaveValue16( scuBusGetBroadcastAddr( g_pScub_base ), MIL_SIO3_TX_CMD, MIL_BROADCAST );
}

// mprintf( "SIO: %08b\n", active_sios );
// mprintf( "SIO: %08b\n", activeSioSlaves );
}

/* ================================= EOF ====================================*/
7 changes: 4 additions & 3 deletions prj/scu-control/lm32-non-os_exe/scu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ STATIC void onScuMSInterrupt( const unsigned int intNum,
STATIC void onScuTimerInterrupt( const unsigned int intNum,
const void* pContext UNUSED )
{
MSI_ITEM_T m;
irqMsiCopyObjectAndRemove( &m, intNum );
//MSI_ITEM_T m;
//irqMsiCopyObjectAndRemove( &m, intNum );
irqMsiCleanQueue( intNum );
#ifndef CONFIG_ENABLE_TIMER_INTERRUPT_IN_ANY_CASES
milExecuteTasks();
#endif
Expand Down Expand Up @@ -388,7 +389,7 @@ ONE_TIME_CALL void schedule( void )
if( evPopSave( &g_ecaEvent ) )
{
ecaHandler();
lm32Log( LM32_LOG_DEBUG, ESC_DEBUG "ECA received\n" ESC_NORMAL );
//lm32Log( LM32_LOG_DEBUG, ESC_DEBUG "ECA received\n" ESC_NORMAL );
}
#endif
#endif
Expand Down
2 changes: 2 additions & 0 deletions prj/scu-control/lm32-rtos_exe/SCU3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
BASE_VERSION = 4
SUB_VERSION = 6.5

DEFINES += CONFIG_HANDLE_UNUSED_ECAS

#------------------------------------------------------------------------------
SCU_MIL := 1
# MIL_GAP := 1
Expand Down
14 changes: 14 additions & 0 deletions prj/scu-control/lm32-rtos_exe/scu_control_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ STATIC void onScuMSInterrupt( const unsigned int intNum,
{ /*
* ECA event received
*/
// mprintf( "*\n" );
evPushWatched( &g_ecaEvent );
#if (configUSE_TASK_NOTIFICATIONS == 1) && defined( CONFIG_SLEEP_MIL_TASK )
taskWakeupMilFromISR();
Expand Down Expand Up @@ -451,6 +452,19 @@ STATIC void taskMain( void* pTaskData UNUSED )
wdtPoll();
#endif
commandHandler();
#if defined( CONFIG_MIL_FG ) && defined( CONFIG_HANDLE_UNUSED_ECAS )
if( !taskIsMilTaskRunning() )
{
if( evPopSave( &g_ecaEvent ) )
{
ecaTestTagAndPop( g_eca.pQueue, g_eca.tag );
lm32Log( LM32_LOG_WARNING, ESC_WARNING
"Unused ECA with tag: 0x%04X received!"
ESC_NORMAL,
g_eca.pQueue->tag );
}
}
#endif
TASK_YIELD();
}
}
Expand Down
6 changes: 5 additions & 1 deletion prj/scu-control/lm32-rtos_exe/scu_task_mil.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ STATIC TaskHandle_t mg_taskMilHandle = NULL;

EV_CREATE_STATIC( g_ecaEvent, MAX_FG_CHANNELS );

bool taskIsMilTaskRunning( void )
{
return mg_taskMilHandle != NULL;
}

/*! ---------------------------------------------------------------------------
* @ingroup RTOS_TASK
* @brief RTOS- task for MIL-FGs and MIL-DAQs
Expand Down Expand Up @@ -69,7 +74,6 @@ STATIC void taskMil( void* pTaskData UNUSED )
if( evPopSave( &g_ecaEvent ) )
{
ecaHandler();
lm32Log( LM32_LOG_DEBUG, ESC_DEBUG "ECA received\n" ESC_NORMAL );
}
milExecuteTasks();
}
Expand Down
6 changes: 6 additions & 0 deletions prj/scu-control/lm32-rtos_exe/scu_task_mil.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ extern "C" {

extern EVENT_T g_ecaEvent;

/*!----------------------------------------------------------------------------
* @ingroup RTOS_TASK
* @brief Returns "true" if the MIL-tasp is running.
*/
bool taskIsMilTaskRunning( void );

/*!----------------------------------------------------------------------------
* @ingroup RTOS_TASK
* @brief Starts the RTOS- MIL task for MIL-FGs and MIL-DAQs,
Expand Down
13 changes: 13 additions & 0 deletions srclib/lm32/scu_msi.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ bool irqMsiCopyObjectAndRemoveIfActive( volatile MSI_ITEM_T* const pItem,
return status;
}

/*! ---------------------------------------------------------------------------
* @ingroup INTERRUPT
* @brief Coelas the hardware MSI-queue is this queue will not used.
* @note This function is mandatory for interrupt-routins which doesn't use
* the this queue. E.g.: the timer-interrupt.
* @param intNum Interrupt number of the corresponding interrupt.
*/
STATIC inline void irqMsiCleanQueue( const unsigned int intNum )
{
volatile MSI_ITEM_T m;
irqMsiCopyObjectAndRemove( &m, intNum );
}

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions srclib/lm32/sys/FreeRTOS_LM32_SCU/port/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ STATIC void onTimerInterrupt( const unsigned int intNum,
const void* pContext UNUSED )
{
#ifdef CONFIG_SCU
MSI_ITEM_T m;
irqMsiCopyObjectAndRemove( &m, intNum );

//MSI_ITEM_T m;
//irqMsiCopyObjectAndRemove( &m, intNum );
irqMsiCleanQueue( intNum );
// irqMsiPop( intNum );
#endif
xTaskIncrementTick();
Expand Down
53 changes: 32 additions & 21 deletions tools/bash/build-DU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,46 +133,55 @@ then
JOBS=8
fi

cd $FESA_CLASS_NAME
make -j$JOBS $MAKE_ARG
if [ "$?" != "0" ]
if [ "$1" != "i" ]
then
die "Can't build \"$FESA_CLASS_NAME\"!"
cd $FESA_CLASS_NAME
make -j$JOBS $MAKE_ARG
if [ "$?" != "0" ]
then
die "Can't build \"$FESA_CLASS_NAME\"!"
fi
cd $ORIGIN_DIR
fi

cd $ORIGIN_DIR

if [ "$1" = "C" ]
then
echo -e $ESC_SUCCESS"\"$FESA_CLASS_NAME\" successful build!"$ESC_NORMAL
exit 0
fi

cd $DU_NAME
make -j$JOBS $MAKE_ARG
if [ "$?" != "0" ]
then
die "Can't build \"${DU_NAME}\"!"
fi

if [ "$1" = "clean" ]
if [ "$1" != "i" ]
then
cd $ORIGIN_DIR
exit 0
fi
make -j$JOBS $MAKE_ARG
if [ "$?" != "0" ]
then
die "Can't build \"${DU_NAME}\"!"
fi

if [ ! -x "$BINARY_FILE" ]
then
die "Binary \"$BINARY_FILE\" not found!"
if [ "$1" = "clean" ]
then
cd $ORIGIN_DIR
exit 0
fi

if [ ! -x "$BINARY_FILE" ]
then
die "Binary \"$BINARY_FILE\" not found!"
fi
fi

if [ ! -d "${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}" ]
then
die "Target directory \"${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}\" not found! Maybe the first build process had not made by Eclipse."
fi

echo -e $ESC_SUCCESS"*** Build was successful, exporting executable: \"${DU_NAME}\" to \"${TARGET}\" ***"$ESC_NORMAL
cp -u ${BINARY_FILE} ${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}/${DU_NAME}
if [ "$1" != "i" ]
then
echo -e $ESC_SUCCESS"*** Build was successful, exporting executable: \"${DU_NAME}\" to \"${TARGET}\" ***"$ESC_NORMAL
cp -u ${BINARY_FILE} ${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}/${DU_NAME}
fi

TEST_DIR=src/test
if [ ! -d "$TEST_DIR" ]
Expand All @@ -198,7 +207,9 @@ if [ "$?" = "0" ]
then
echo "Content of \"${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}\":"
ls -g ${EXPORT_DIR}/${DU_NAME}${BINARY_DIR_SUFFIX}
echo "done"
echo -e $ESC_SUCCESS"done"$ESC_NORMAL
else
die "Can't copy instance-file: \"$INSTANCE_FILE\""
fi
cd $ORIGIN_DIR
#=================================== EOF ======================================

0 comments on commit d315446

Please sign in to comment.