rtems: Add RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT

If the RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT define has a non-zero value,
then the interrupt lock operations require an object of type
rtems_interrupt_lock, otherwise no lock object is required.

This indication can be used to avoid the space overhead for lock objects
when they are not needed.  In this case, the lock operations will not
use a lock objects parameter.

Update #4957 and #5038.
This commit is contained in:
Sebastian Huber
2024-06-18 11:56:09 +02:00
parent 26a0bfcbc2
commit 050b61aab6
4 changed files with 119 additions and 20 deletions

View File

@@ -7,7 +7,7 @@
*/
/*
* Copyright (C) 2021 embedded brains GmbH & Co. KG
* Copyright (C) 2021, 2024 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -69,6 +69,9 @@
*
* - Validate some interrupt lock macros.
*
* - Assert that RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT is a constant expression
* which evaluates to a value of zero.
*
* - Check that RTEMS_INTERRUPT_LOCK_DECLARE() expands to white space only.
*
* - Check that RTEMS_INTERRUPT_LOCK_DEFINE() expands to white space only.
@@ -79,8 +82,8 @@
*
* - Check that rtems_interrupt_lock_destroy() expands to white space only.
*
* - Check that RTEMS_INTERRUPT_LOCK_INITIALIZER() expands to an empty
* structure initializer.
* - Check that RTEMS_INTERRUPT_LOCK_INITIALIZER() expands to a character
* literal initializer.
*
* - Check that rtems_interrupt_lock_initialize() expands to a code block
* which marks the second parameter as used.
@@ -101,6 +104,12 @@ static void RtemsIntrValIntrNonSmp_Action_0( void )
{
const char *s;
/*
* Assert that RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT is a constant expression
* which evaluates to a value of zero.
*/
RTEMS_STATIC_ASSERT( !RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT, LOCK_NEEDS_OBJECT );
/*
* Check that RTEMS_INTERRUPT_LOCK_DECLARE() expands to white space only.
*/
@@ -132,11 +141,11 @@ static void RtemsIntrValIntrNonSmp_Action_0( void )
T_true( IsWhiteSpaceOnly( s ) );
/*
* Check that RTEMS_INTERRUPT_LOCK_INITIALIZER() expands to an empty
* structure initializer.
* Check that RTEMS_INTERRUPT_LOCK_INITIALIZER() expands to a character
* literal initializer.
*/
s = RTEMS_XSTRING( RTEMS_INTERRUPT_LOCK_INITIALIZER( x ) );
T_true( IsEqualIgnoreWhiteSpace( s, "{}" ) );
T_true( IsEqualIgnoreWhiteSpace( s, "0" ) );
/*
* Check that rtems_interrupt_lock_initialize() expands to a code block which

View File

@@ -7,7 +7,7 @@
*/
/*
* Copyright (C) 2021 embedded brains GmbH & Co. KG
* Copyright (C) 2021, 2024 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -69,6 +69,9 @@
*
* - Validate the interrupt lock directives.
*
* - Assert that RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT is a constant expression
* which evaluates to a non-zero value.
*
* - Check that RTEMS_INTERRUPT_LOCK_REFERENCE() expanded to a lock reference
* definition. Check that the lock is available after static
* initialization.
@@ -125,6 +128,12 @@ static void RtemsIntrValIntrSmpOnly_Action_0( void )
RTEMS_INTERRUPT_LOCK_REFERENCE( ref, &the_lock )
rtems_interrupt_lock_context lock_context;
/*
* Assert that RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT is a constant expression
* which evaluates to a non-zero value.
*/
RTEMS_STATIC_ASSERT( RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT, LOCK_NEEDS_OBJECT );
/*
* Check that RTEMS_INTERRUPT_LOCK_REFERENCE() expanded to a lock reference
* definition. Check that the lock is available after static initialization.