Skip to content

Commit ca1f6e1

Browse files
Merge branch 'main' into cmm_posix
2 parents b7c25ee + 1947dd2 commit ca1f6e1

File tree

9 files changed

+229
-84
lines changed

9 files changed

+229
-84
lines changed

.github/.cSpellWords.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ brhi
5959
brne
6060
bswtrg
6161
BSWTRG
62+
Bytesto
6263
CANEN
6364
CANRX
6465
CANTX
@@ -89,13 +90,16 @@ CKGR
8990
CKLO
9091
CKPS
9192
CLDIV
93+
CLEARINTENA
9294
CLKA
9395
CLKB
96+
CLKDIS
9497
CLKEN
9598
clki
9699
CLKI
97100
CLKP
98101
CLKS
102+
CLKSOURCE
99103
CLKSTA
100104
CLRB
101105
CLRF
@@ -690,6 +694,7 @@ Rsvd
690694
RTAR
691695
RTCEN
692696
RTCSC
697+
RTICTL
693698
RTIE
694699
RTIF
695700
RTIFRC
@@ -713,6 +718,7 @@ RXRSM
713718
RXSETUP
714719
RXSUSP
715720
RXSYN
721+
RXTDIS
716722
RXTEN
717723
RXUBR
718724
SBYCR
@@ -726,6 +732,7 @@ SECU
726732
SENDA
727733
SETB
728734
SETEN
735+
SETINTENA
729736
SETPSW
730737
SETR
731738
setvect
@@ -849,6 +856,7 @@ TXVC
849856
TXVDIS
850857
UDCP
851858
uncrustify
859+
UNDADD
852860
UNRE
853861
unsuspended
854862
URAD
@@ -867,6 +875,7 @@ VDDCORE
867875
vect
868876
VECT
869877
VECTACTIVE
878+
VECTKEY
870879
visualisation
871880
vldmdbeq
872881
vldmia

include/FreeRTOS.h

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,36 @@
509509

510510
#endif /* configUSE_TIMERS */
511511

512+
#ifndef portHAS_NESTED_INTERRUPTS
513+
#if defined( portSET_INTERRUPT_MASK_FROM_ISR ) && defined( portCLEAR_INTERRUPT_MASK_FROM_ISR )
514+
#define portHAS_NESTED_INTERRUPTS 1
515+
#else
516+
#define portHAS_NESTED_INTERRUPTS 0
517+
#endif
518+
#endif
519+
512520
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
513-
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
521+
#if ( portHAS_NESTED_INTERRUPTS == 1 )
522+
#error portSET_INTERRUPT_MASK_FROM_ISR must be defined for ports that support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1)
523+
#else
524+
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
525+
#endif
526+
#else
527+
#if ( portHAS_NESTED_INTERRUPTS == 0 )
528+
#error portSET_INTERRUPT_MASK_FROM_ISR must not be defined for ports that do not support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
529+
#endif
514530
#endif
515531

516532
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
517-
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
533+
#if ( portHAS_NESTED_INTERRUPTS == 1 )
534+
#error portCLEAR_INTERRUPT_MASK_FROM_ISR must be defined for ports that support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1)
535+
#else
536+
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
537+
#endif
538+
#else
539+
#if ( portHAS_NESTED_INTERRUPTS == 0 )
540+
#error portCLEAR_INTERRUPT_MASK_FROM_ISR must not be defined for ports that do not support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
541+
#endif
518542
#endif
519543

520544
#ifndef portCLEAN_UP_TCB
@@ -2485,6 +2509,22 @@
24852509
#define traceRETURN_xStreamBufferReceiveCompletedFromISR( xReturn )
24862510
#endif
24872511

2512+
#ifndef traceENTER_uxStreamBufferGetStreamBufferNotificationIndex
2513+
#define traceENTER_uxStreamBufferGetStreamBufferNotificationIndex( xStreamBuffer )
2514+
#endif
2515+
2516+
#ifndef traceRETURN_uxStreamBufferGetStreamBufferNotificationIndex
2517+
#define traceRETURN_uxStreamBufferGetStreamBufferNotificationIndex( uxNotificationIndex )
2518+
#endif
2519+
2520+
#ifndef traceENTER_vStreamBufferSetStreamBufferNotificationIndex
2521+
#define traceENTER_vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, uxNotificationIndex )
2522+
#endif
2523+
2524+
#ifndef traceRETURN_vStreamBufferSetStreamBufferNotificationIndex
2525+
#define traceRETURN_vStreamBufferSetStreamBufferNotificationIndex()
2526+
#endif
2527+
24882528
#ifndef traceENTER_uxStreamBufferGetStreamBufferNumber
24892529
#define traceENTER_uxStreamBufferGetStreamBufferNumber( xStreamBuffer )
24902530
#endif
@@ -3247,6 +3287,7 @@ typedef struct xSTATIC_STREAM_BUFFER
32473287
#if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
32483288
void * pvDummy5[ 2 ];
32493289
#endif
3290+
UBaseType_t uxDummy6;
32503291
} StaticStreamBuffer_t;
32513292

32523293
/* Message buffers are built on stream buffers. */

include/atomic.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
* This file implements atomic functions by disabling interrupts globally.
3434
* Implementations with architecture specific atomic instructions can be
3535
* provided under each compiler directory.
36+
*
37+
* The atomic interface can be used in FreeRTOS tasks on all FreeRTOS ports. It
38+
* can also be used in Interrupt Service Routines (ISRs) on FreeRTOS ports that
39+
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 1). The
40+
* atomic interface must not be used in ISRs on FreeRTOS ports that do not
41+
* support nested interrupts (i.e. portHAS_NESTED_INTERRUPTS is set to 0)
42+
* because ISRs on these ports cannot be interrupted and therefore, do not need
43+
* atomics in ISRs.
3644
*/
3745

3846
#ifndef ATOMIC_H
@@ -59,7 +67,7 @@
5967
* ATOMIC_ENTER_CRITICAL().
6068
*
6169
*/
62-
#if defined( portSET_INTERRUPT_MASK_FROM_ISR )
70+
#if ( portHAS_NESTED_INTERRUPTS == 1 )
6371

6472
/* Nested interrupt scheme is supported in this port. */
6573
#define ATOMIC_ENTER_CRITICAL() \

include/queue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,8 +1522,8 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
15221522
#endif
15231523

15241524
/*
1525-
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
1526-
* xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
1525+
* For internal use only. Use xSemaphoreTakeRecursive() or
1526+
* xSemaphoreGiveRecursive() instead of calling these functions directly.
15271527
*/
15281528
BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex,
15291529
TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;

include/stream_buffer.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,57 @@ BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer
911911
BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
912912
BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
913913

914+
/**
915+
* stream_buffer.h
916+
*
917+
* @code{c}
918+
* UBaseType_t uxStreamBufferGetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer );
919+
* @endcode
920+
*
921+
* Get the task notification index used for the supplied stream buffer which can
922+
* be set using vStreamBufferSetStreamBufferNotificationIndex. If the task
923+
* notification index for the stream buffer is not changed using
924+
* vStreamBufferSetStreamBufferNotificationIndex, this function returns the
925+
* default value (tskDEFAULT_INDEX_TO_NOTIFY).
926+
*
927+
* @param xStreamBuffer The handle of the stream buffer for which the task
928+
* notification index is retrieved.
929+
*
930+
* @return The task notification index for the stream buffer.
931+
*
932+
* \defgroup uxStreamBufferGetStreamBufferNotificationIndex uxStreamBufferGetStreamBufferNotificationIndex
933+
* \ingroup StreamBufferManagement
934+
*/
935+
UBaseType_t uxStreamBufferGetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
936+
937+
/**
938+
* stream_buffer.h
939+
*
940+
* @code{c}
941+
* void vStreamBufferSetStreamBufferNotificationIndex ( StreamBuffer_t xStreamBuffer, UBaseType_t uxNotificationIndex );
942+
* @endcode
943+
*
944+
* Set the task notification index used for the supplied stream buffer.
945+
* Successive calls to stream buffer APIs (like xStreamBufferSend or
946+
* xStreamBufferReceive) for this stream buffer will use this new index for
947+
* their task notifications.
948+
*
949+
* If this function is not called, the default index (tskDEFAULT_INDEX_TO_NOTIFY)
950+
* is used for task notifications. It is recommended to call this function
951+
* before attempting to send or receive data from the stream buffer to avoid
952+
* inconsistencies.
953+
*
954+
* @param xStreamBuffer The handle of the stream buffer for which the task
955+
* notification index is set.
956+
*
957+
* @param uxNotificationIndex The task notification index to set.
958+
*
959+
* \defgroup vStreamBufferSetStreamBufferNotificationIndex vStreamBufferSetStreamBufferNotificationIndex
960+
* \ingroup StreamBufferManagement
961+
*/
962+
void vStreamBufferSetStreamBufferNotificationIndex( StreamBufferHandle_t xStreamBuffer,
963+
UBaseType_t uxNotificationIndex ) PRIVILEGED_FUNCTION;
964+
914965
/* Functions below here are not part of the public API. */
915966
StreamBufferHandle_t xStreamBufferGenericCreate( size_t xBufferSizeBytes,
916967
size_t xTriggerLevelBytes,

portable/GCC/RISC-V/portmacro.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ extern void vTaskSwitchContext( void );
111111
/* Critical section management. */
112112
#define portCRITICAL_NESTING_IN_TCB 0
113113

114-
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
115-
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
116-
117114
#define portDISABLE_INTERRUPTS() __asm volatile ( "csrc mstatus, 8" )
118115
#define portENABLE_INTERRUPTS() __asm volatile ( "csrs mstatus, 8" )
119116

portable/IAR/RISC-V/portmacro.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ extern void vTaskSwitchContext( void );
113113
/* Critical section management. */
114114
#define portCRITICAL_NESTING_IN_TCB 0
115115

116-
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
117-
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
118-
119116
#define portDISABLE_INTERRUPTS() __disable_interrupt()
120117
#define portENABLE_INTERRUPTS() __enable_interrupt()
121118

portable/ThirdParty/xClang/XCOREAI/portmacro.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@
139139
#define portSET_INTERRUPT_MASK() rtos_interrupt_mask_all()
140140
#define portCLEAR_INTERRUPT_MASK( ulState ) rtos_interrupt_mask_set( ulState )
141141

142-
#define portSET_INTERRUPT_MASK_FROM_ISR() ( 0 )
143-
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( ( void ) x )
144-
145142
/*
146143
* Will enable interrupts if ulState is non-zero.
147144
*/

0 commit comments

Comments
 (0)