Skip to content

Commit

Permalink
Code review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg committed Aug 9, 2024
1 parent df28f29 commit bc5e796
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 75 deletions.
1 change: 1 addition & 0 deletions .github/.cSpellWords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ CMock
CNBTR
CNDA
CNDTR
CNOT
CNTALOAD
CNTAMAX
CNTBLOAD
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Intro

This directory contains a FreeRTOS project to build either a Blinky demo
for the [RM57L843](https://www.ti.com/product/RM57L843).
This directory contains a FreeRTOS project to build a set of demos for the
[RM57L843](https://www.ti.com/product/RM57L843) board. The demos to build are
selected using the macro `mainDEMO_TYPE` in the `include/demo_tasks.h` file.

It is set up to blink LEDs on the Texas Instruments
[LAUNCHXL2-RM57L](https://www.ti.com/tool/LAUNCHXL2-RM57L)
Expand All @@ -10,7 +11,7 @@ and the [TMDXRM57LHDK](https://www.ti.com/tool/TMDXRM57LHDK) Development Kits.
The code related to the Main Demo Files can be found in the
[source](./source) directory.
The code related to the board setup can be found in the
[BoardFiles](./BoardFiles) directory
[BoardFiles](./BoardFiles) directory.

## Building

Expand Down Expand Up @@ -63,4 +64,4 @@ These binaries can then be flashed to the board by using

Rudimentary UART output is available by opening a Serial Connection
to the board. The settings for the UART are a BAUD rate of 115200, 1 stopbit,
and None Parity
and None Parity.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@

#if ( mainDEMO_TYPE &IRQ_DEMO )

/** @brief TCB used by the IRQ Test Task */
/** @brief TCB used by the IRQ Test Task. */
static StaticTask_t xIRQTestTaskTCB;

/** @brief Stack used by the IRQ Test Task */
/** @brief Stack used by the IRQ Test Task. */

static StackType_t uxIRQTestTaskStack[ configMINIMAL_STACK_SIZE ];

Expand All @@ -68,16 +68,14 @@
*/
static void prvIRQTestTask( void * pvParameters )
{
/* Ensure that the correct parameter was passed to the task */
/* Ensure that the correct parameter was passed to the task. */
configASSERT( ( uint32_t ) pvParameters == irqTASK_PARAMETER );
volatile uint32_t * xSoftwareInterruptRegister;
volatile TickType_t ulLoopCount;
volatile TickType_t xPreIRQTickCount;

for( ; ; )
{
/* Disable IRQs to raise a Software Based IRQ */
/* portDISABLE_INTERRUPTS(); */
sci_print( "IRQ Test Task Starting IRQ Nesting Test!\r\n" );
ulIntNestTestVal = 0xFFFFUL;

Expand Down Expand Up @@ -117,7 +115,7 @@
}

sci_print( "IRQ Test Task sleeping before next loop!\r\n\r\n" );
/* Sleep for odd number of seconds to schedule at different real-times */
/* Sleep for odd number of seconds to schedule at different real-times. */
vTaskDelay( pdMS_TO_TICKS( 3150UL ) );
}
}
Expand All @@ -130,9 +128,9 @@
volatile uint32_t ulSSIRegisterValue;
volatile uint32_t ulSSIIntFlagValue;
volatile uint32_t * xSoftwareInterruptRegister;
/* The 4 different SWI Registers use a bitfield to mark that they where raised */
/* The 4 different SWI Registers use a bitfield to mark that they where raised. */
{
/* Determine what channel raised the IRQ without clearing the interrupt */
/* Determine what channel raised the IRQ without clearing the interrupt. */
ulSSIIntFlagValue = portSSI_INTFLAG_REG;

if( 0x1UL & ulSSIIntFlagValue )
Expand All @@ -145,24 +143,24 @@
ulIntNestTestVal++;
sci_print( "\t\tSWI Channel #1 Raised with Data Value 0x11, clearing the "
"IRQs...\r\n" );
/* Read to mark this IRQ as cleared */
/* Mark the Nested Channel 1 IRQ as cleared */
/* Read to mark this IRQ as cleared. */
/* Mark the Nested Channel 1 IRQ as cleared. */
ulSSIIntFlagValue = portSSI_VEC_REG;
configASSERT( 0x1101UL == ulSSIIntFlagValue );

/* Mark the Nested Channel 2 IRQ as cleared */
/* Mark the Nested Channel 2 IRQ as cleared. */
ulSSIIntFlagValue = portSSI_VEC_REG;
configASSERT( 0x2202UL == ulSSIIntFlagValue );

/* Mark the Nested Channel 3 IRQ as cleared */
/* Mark the Nested Channel 3 IRQ as cleared. */
ulSSIIntFlagValue = portSSI_VEC_REG;
configASSERT( 0x3303UL == ulSSIIntFlagValue );

/* Mark the Nested Channel 4 IRQ as cleared */
/* Mark the Nested Channel 4 IRQ as cleared. */
ulSSIIntFlagValue = portSSI_VEC_REG;
configASSERT( 0x4404UL == ulSSIIntFlagValue );

/* Should be no other IRQs raised, mask out the data */
/* Should be no other IRQs raised, mask out the data. */
ulSSIIntFlagValue = ( portSSI_VEC_REG ) & 0XFFUL;
configASSERT( 0x0UL == ulSSIIntFlagValue );
}
Expand Down
40 changes: 20 additions & 20 deletions FreeRTOS/Demo/CORTEX_No_GIC_R5F_TI_RM57_HERCULES_GCC/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
/** @brief Configure the hardware to start the scheduler timer. */
void vMainSetupTimerInterrupt( void );

/** @brief Set up necessary hardware registers */
/** @brief Set up necessary hardware registers. */
static void prvSetupHardware( void );

/** @brief Landing point function for any failed configASSERT() check.
Expand All @@ -71,19 +71,19 @@ void vAssertCalled( const char * pcFileName,
void vApplicationIRQHandler( void );
/* --------------------- Static Task Memory Allocation --------------------- */

/** @brief Statically declared TCB Used by the Idle Task */
/** @brief Statically declared TCB Used by the Idle Task. */
static StaticTask_t xTimerTaskTCB;

/** @brief Statically declared stack used by the timer task */
/** @brief Statically declared stack used by the timer task. */
static StackType_t uxTimerTaskStack[ configMINIMAL_STACK_SIZE ];

/** @brief Statically declared TCB Used by the Idle Task */
/** @brief Statically declared TCB Used by the Idle Task. */
static StaticTask_t xIdleTaskTCB;

/** @brief Statically declared stack used by the idle task */
/** @brief Statically declared stack used by the idle task. */
static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];

/** @brief Simple variable to show how the idle tick hook can be used */
/** @brief Simple variable to show how the idle tick hook can be used. */
static volatile TickType_t ulIdleTickHookCount = 0x0;

extern volatile uint32_t ulPortYieldRequired;
Expand Down Expand Up @@ -167,9 +167,9 @@ static void prvSetupHardware( void )
hetInit();
sciInit();

/* Setup gioPORTB for when using the RM57 Launchpad */
gioPORTB->DIR |= ( 0x01 << 6 ); /*configure GIOB[6] as output */
gioPORTB->DIR |= ( 0x01 << 7 ); /*configure GIOB[7] as output */
/* Setup gioPORTB for when using the RM57 Launchpad. */
gioPORTB->DIR |= ( 0x01 << 6 ); /*configure GIOB[6] as output. */
gioPORTB->DIR |= ( 0x01 << 7 ); /*configure GIOB[7] as output. */

/* Configure HET as master, pull functionality, and switch on. */
hetREG1->GCR = 0x01000001;
Expand All @@ -180,8 +180,8 @@ static void prvSetupHardware( void )
hetREG1->DIR = 0xAA178035;
hetREG1->DOUT = 0x0;

/* Enable notifications for the SCI register */
/* Use a BAUD rate of 115200, 1 stop bit, and None Parity */
/* Enable notifications for the SCI register. */
/* Use a BAUD rate of 115200, 1 stop bit, and None Parity. */
sciEnableNotification( scilinREG, SCI_RX_INT );
}

Expand All @@ -194,13 +194,13 @@ void vToggleLED( uint32_t ulLEDNum )

if( 0x0 == ulLEDNum )
{
/* RM57 TMDX Dev Kit LED1 use NHET[27], Launchpad LED2 uses GIOB[6] */
/* RM57 TMDX Dev Kit LED1 use NHET[27], Launchpad LED2 uses GIOB[6]. */
ulLEDVal = 1UL << 27UL;
ulGIOVal = 1UL << 6UL;
}
else
{
/* RM57 TMDX Dev Kit LED2 use NHET[5], Launchpad LED3 uses GIOB[7] */
/* RM57 TMDX Dev Kit LED2 use NHET[5], Launchpad LED3 uses GIOB[7]. */
ulLEDVal = 1UL << 5UL;
ulGIOVal = 1UL << 7UL;
}
Expand Down Expand Up @@ -319,11 +319,11 @@ void vAssertCalled( const char * pcFuncName,
*/
void vApplicationIRQHandler( void )
{
/* Load the IRQ Channel Number and Function PTR from the VIM */
/* Load the IRQ Channel Number and Function PTR from the VIM. */
volatile uint32_t ulIRQChannelIndex = portVIM_IRQ_INDEX;
volatile ISRFunction_t xIRQFncPtr = portVIM_IRQ_VEC_REG;

/* Setup Bit Mask Clear Values */
/* Setup Bit Mask Clear Values. */
volatile uint32_t ulPendingIRQMask;

volatile uint32_t ulPendISRReg0 = vimREG->REQMASKCLR0;
Expand Down Expand Up @@ -374,7 +374,7 @@ void vApplicationIRQHandler( void )
/*
* Channel 0 is the ESM handler, treat this as a special case.
* phantomInterrupt()
* Keep interrupts disabled, this function does not return
* Keep interrupts disabled, this function does not return.
*/

if( 0UL == ulIRQChannelIndex )
Expand All @@ -396,23 +396,23 @@ void vApplicationIRQHandler( void )
/* An IRQ Raised by Channel Two of the VIM is RTI Compare Interrupt 0. */
if( 2UL == ulIRQChannelIndex )
{
/* This is the System Tick Timer Interrupt */
/* This is the System Tick Timer Interrupt. */
ulPortYieldRequired = xTaskIncrementTick();
/* Acknowledge the System Tick Timer Interrupt */
/* Acknowledge the System Tick Timer Interrupt. */
portRTI_INTFLAG_REG = 0x1UL;
}
/* An IRQ Raised by Channel 21 of the VIM is a Software Interrupt (SSI). */
else if( 21UL == ulIRQChannelIndex )
{
#if ( mainDEMO_TYPE &IRQ_DEMO )
/* This is an interrupt raised by Software */
/* This is an interrupt raised by Software. */
vIRQDemoHandler();
#else
sci_print( "SWI of unknown cause was raised!\r\n" );
configASSERT( 0x0 );
#endif

/* Register read is needed to mark the end of the IRQ */
/* Register read is needed to mark the end of the IRQ. */
volatile uint32_t ulEndOfIntRegVal = *portEND_OF_INTERRUPT_REG;
*portEND_OF_INTERRUPT_REG = ulEndOfIntRegVal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
* for the purpose of ensuring parameters are passed into tasks correctly. */
#define notificationTASK_PARAMETER ( 0xFEEDBEEFUL )

/** @brief Value sent back and forth between the tasks */
/** @brief Value sent back and forth between the tasks. */
#define notificationTEST_VALUE 0x1234UL

/** @brief TCB used by the Notification Test Task */
/** @brief TCB used by the Notification Test Task. */
static StaticTask_t xNotificationTestTaskTCB;

/** @brief Stack used by the Notification Test Task */
/** @brief Stack used by the Notification Test Task. */
static StackType_t uxNotificationTestTaskStack[ configMINIMAL_STACK_SIZE ];

/** @brief Statically allocated task handle for the Notification Test task. */
Expand Down Expand Up @@ -85,12 +85,12 @@
BaseType_t xReturned;
UBaseType_t ulNotificationValue;

/* Ensure that the correct parameter was passed to the task */
/* Ensure that the correct parameter was passed to the task. */
configASSERT( ( uint32_t ) pvParameters == notificationTEST_VALUE );

for( ; ; )
{
/* Clear the notification value each loop */
/* Clear the notification value each loop. */
ulNotificationValue = 0x0UL;

/* The task should not yet have a notification pending. */
Expand All @@ -99,31 +99,31 @@
configASSERT( pdFAIL == xReturned );
configASSERT( 0x0UL == ulNotificationValue );

/* Tell the task to notify itself twice */
/* Tell the task to notify itself twice. */
xReturned = xTaskNotifyGive( xTaskGetCurrentTaskHandle() );
prvNotifyCheck( xReturned );

xReturned = xTaskNotifyGive( xTaskGetCurrentTaskHandle() );
prvNotifyCheck( xReturned );

/* Perform a non-blocking notification read, should see two "gives" */
/* Perform a non-blocking notification read, should see two "gives". */
ulNotificationValue = ulTaskNotifyTake( pdTRUE, 0x0 );

/* Two notifications have been sent to this task by itself */
/* Two notifications have been sent to this task by itself. */
configASSERT( 0x2UL == ulNotificationValue );
sci_print( "Notification Task correctly sent itself two"
"notifications!\r\n" );

/* Now make the task send itself a notification with a value */
/* Now make the task send itself a notification with a value. */
xReturned = xTaskNotify( xTaskGetCurrentTaskHandle(),
notificationTEST_VALUE,
eSetValueWithOverwrite );
prvNotifyCheck( xReturned );

/* Clear ulNotificationValue before using it */
/* Clear ulNotificationValue before using it. */
ulNotificationValue = 0x0UL;

/* Receive the value sent using xTaskNotify */
/* Receive the value sent using xTaskNotify. */
xReturned = xTaskNotifyWait( 0,
( uint32_t ) 0xFFFFFFFFUL,
&ulNotificationValue,
Expand All @@ -141,10 +141,10 @@
configASSERT( 0x0UL );
}

/* Reset the variable before using it */
/* Reset the variable before using it. */
ulNotificationValue = 0x0UL;

/* There should be no value to receive this time */
/* There should be no value to receive this time. */
xReturned = xTaskNotifyWait( 0, 0, &ulNotificationValue,
( TickType_t ) 0x0UL );

Expand All @@ -168,7 +168,7 @@
configASSERT( xReturned == pdFALSE );

sci_print( "Notification Task sleeping before next loop!\r\n\r\n" );
/* Sleep for odd number of seconds to schedule at different real-times */
/* Sleep for odd number of seconds to schedule at different real-times. */
vTaskDelay( pdMS_TO_TICKS( 2750UL ) );
}
}
Expand All @@ -179,7 +179,7 @@
{
BaseType_t xReturn = pdFAIL;

/* Create the notification test task */
/* Create the notification test task. */
xNotificationTaskOneHandle = xTaskCreateStatic( prvNotificationTestTask,
"NotificationTestTask",
configMINIMAL_STACK_SIZE,
Expand Down
Loading

0 comments on commit bc5e796

Please sign in to comment.