mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-02 04:13:54 -04:00
CI-CD Updates (#768)
* Use new version of CI-CD Actions * Use cSpell spell check, and use ubuntu-20.04 for formatting check * Format and spell check all files in the portable directory * Remove the https:// from #errors and #warnings as uncrustify attempts to change it to /* * Use checkout@v3 instead of checkout@v2 on all jobs ---------
This commit is contained in:
parent
d6bccb1f4c
commit
5fb9b50da8
485 changed files with 108790 additions and 107581 deletions
326
portable/ThirdParty/XCC/Xtensa/portclib.c
vendored
326
portable/ThirdParty/XCC/Xtensa/portclib.c
vendored
|
@ -31,200 +31,204 @@
|
|||
|
||||
#if XT_USE_THREAD_SAFE_CLIB
|
||||
|
||||
#if XSHAL_CLIB == XTHAL_CLIB_XCLIB
|
||||
#if XSHAL_CLIB == XTHAL_CLIB_XCLIB
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/reent.h>
|
||||
#include <errno.h>
|
||||
#include <sys/reent.h>
|
||||
|
||||
#include "semphr.h"
|
||||
#include "semphr.h"
|
||||
|
||||
typedef SemaphoreHandle_t _Rmtx;
|
||||
typedef SemaphoreHandle_t _Rmtx;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Override this and set to nonzero to enable locking.
|
||||
//-----------------------------------------------------------------------------
|
||||
int32_t _xclib_use_mt = 1;
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Override this and set to nonzero to enable locking. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
int32_t _xclib_use_mt = 1;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Init lock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
_Mtxinit(_Rmtx * mtx)
|
||||
{
|
||||
*mtx = xSemaphoreCreateRecursiveMutex();
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Init lock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void _Mtxinit( _Rmtx * mtx )
|
||||
{
|
||||
*mtx = xSemaphoreCreateRecursiveMutex();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Destroy lock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
_Mtxdst(_Rmtx * mtx)
|
||||
{
|
||||
if ((mtx != NULL) && (*mtx != NULL)) {
|
||||
vSemaphoreDelete(*mtx);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Destroy lock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void _Mtxdst( _Rmtx * mtx )
|
||||
{
|
||||
if( ( mtx != NULL ) && ( *mtx != NULL ) )
|
||||
{
|
||||
vSemaphoreDelete( *mtx );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Lock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
_Mtxlock(_Rmtx * mtx)
|
||||
{
|
||||
if ((mtx != NULL) && (*mtx != NULL)) {
|
||||
xSemaphoreTakeRecursive(*mtx, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Lock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void _Mtxlock( _Rmtx * mtx )
|
||||
{
|
||||
if( ( mtx != NULL ) && ( *mtx != NULL ) )
|
||||
{
|
||||
xSemaphoreTakeRecursive( *mtx, portMAX_DELAY );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Unlock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
_Mtxunlock(_Rmtx * mtx)
|
||||
{
|
||||
if ((mtx != NULL) && (*mtx != NULL)) {
|
||||
xSemaphoreGiveRecursive(*mtx);
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Unlock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void _Mtxunlock( _Rmtx * mtx )
|
||||
{
|
||||
if( ( mtx != NULL ) && ( *mtx != NULL ) )
|
||||
{
|
||||
xSemaphoreGiveRecursive( *mtx );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called by malloc() to allocate blocks of memory from the heap.
|
||||
//-----------------------------------------------------------------------------
|
||||
void *
|
||||
_sbrk_r (struct _reent * reent, int32_t incr)
|
||||
{
|
||||
extern char _end;
|
||||
extern char _heap_sentry;
|
||||
static char * _heap_sentry_ptr = &_heap_sentry;
|
||||
static char * heap_ptr;
|
||||
char * base;
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Called by malloc() to allocate blocks of memory from the heap. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void * _sbrk_r( struct _reent * reent,
|
||||
int32_t incr )
|
||||
{
|
||||
extern char _end;
|
||||
extern char _heap_sentry;
|
||||
static char * _heap_sentry_ptr = &_heap_sentry;
|
||||
static char * heap_ptr;
|
||||
char * base;
|
||||
|
||||
if (!heap_ptr)
|
||||
heap_ptr = (char *) &_end;
|
||||
if( !heap_ptr )
|
||||
{
|
||||
heap_ptr = ( char * ) &_end;
|
||||
}
|
||||
|
||||
base = heap_ptr;
|
||||
if (heap_ptr + incr >= _heap_sentry_ptr) {
|
||||
reent->_errno = ENOMEM;
|
||||
return (char *) -1;
|
||||
}
|
||||
base = heap_ptr;
|
||||
|
||||
heap_ptr += incr;
|
||||
return base;
|
||||
}
|
||||
if( heap_ptr + incr >= _heap_sentry_ptr )
|
||||
{
|
||||
reent->_errno = ENOMEM;
|
||||
return ( char * ) -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Global initialization for C library.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
vPortClibInit(void)
|
||||
{
|
||||
}
|
||||
heap_ptr += incr;
|
||||
return base;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Per-thread cleanup stub provided for linking, does nothing.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
_reclaim_reent(void * ptr)
|
||||
{
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Global initialization for C library. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void vPortClibInit( void )
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* XSHAL_CLIB == XTHAL_CLIB_XCLIB */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Per-thread cleanup stub provided for linking, does nothing. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void _reclaim_reent( void * ptr )
|
||||
{
|
||||
}
|
||||
|
||||
#if XSHAL_CLIB == XTHAL_CLIB_NEWLIB
|
||||
#endif /* XSHAL_CLIB == XTHAL_CLIB_XCLIB */
|
||||
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if XSHAL_CLIB == XTHAL_CLIB_NEWLIB
|
||||
|
||||
#include "semphr.h"
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static SemaphoreHandle_t xClibMutex;
|
||||
static uint32_t ulClibInitDone = 0;
|
||||
#include "semphr.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Get C library lock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
__malloc_lock(struct _reent * ptr)
|
||||
{
|
||||
if (!ulClibInitDone)
|
||||
return;
|
||||
static SemaphoreHandle_t xClibMutex;
|
||||
static uint32_t ulClibInitDone = 0;
|
||||
|
||||
xSemaphoreTakeRecursive(xClibMutex, portMAX_DELAY);
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Get C library lock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void __malloc_lock( struct _reent * ptr )
|
||||
{
|
||||
if( !ulClibInitDone )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Release C library lock.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
__malloc_unlock(struct _reent * ptr)
|
||||
{
|
||||
if (!ulClibInitDone)
|
||||
return;
|
||||
xSemaphoreTakeRecursive( xClibMutex, portMAX_DELAY );
|
||||
}
|
||||
|
||||
xSemaphoreGiveRecursive(xClibMutex);
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Release C library lock. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void __malloc_unlock( struct _reent * ptr )
|
||||
{
|
||||
if( !ulClibInitDone )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Lock for environment. Since we have only one global lock we can just call
|
||||
// the malloc() lock function.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
__env_lock(struct _reent * ptr)
|
||||
{
|
||||
__malloc_lock(ptr);
|
||||
}
|
||||
xSemaphoreGiveRecursive( xClibMutex );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Lock for environment. Since we have only one global lock we can just call */
|
||||
/* the malloc() lock function. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void __env_lock( struct _reent * ptr )
|
||||
{
|
||||
__malloc_lock( ptr );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Unlock environment.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
__env_unlock(struct _reent * ptr)
|
||||
{
|
||||
__malloc_unlock(ptr);
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Unlock environment. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void __env_unlock( struct _reent * ptr )
|
||||
{
|
||||
__malloc_unlock( ptr );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Called by malloc() to allocate blocks of memory from the heap.
|
||||
//-----------------------------------------------------------------------------
|
||||
void *
|
||||
_sbrk_r (struct _reent * reent, int32_t incr)
|
||||
{
|
||||
extern char _end;
|
||||
extern char _heap_sentry;
|
||||
static char * _heap_sentry_ptr = &_heap_sentry;
|
||||
static char * heap_ptr;
|
||||
char * base;
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Called by malloc() to allocate blocks of memory from the heap. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void * _sbrk_r( struct _reent * reent,
|
||||
int32_t incr )
|
||||
{
|
||||
extern char _end;
|
||||
extern char _heap_sentry;
|
||||
static char * _heap_sentry_ptr = &_heap_sentry;
|
||||
static char * heap_ptr;
|
||||
char * base;
|
||||
|
||||
if (!heap_ptr)
|
||||
heap_ptr = (char *) &_end;
|
||||
if( !heap_ptr )
|
||||
{
|
||||
heap_ptr = ( char * ) &_end;
|
||||
}
|
||||
|
||||
base = heap_ptr;
|
||||
if (heap_ptr + incr >= _heap_sentry_ptr) {
|
||||
reent->_errno = ENOMEM;
|
||||
return (char *) -1;
|
||||
}
|
||||
base = heap_ptr;
|
||||
|
||||
heap_ptr += incr;
|
||||
return base;
|
||||
}
|
||||
if( heap_ptr + incr >= _heap_sentry_ptr )
|
||||
{
|
||||
reent->_errno = ENOMEM;
|
||||
return ( char * ) -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Global initialization for C library.
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
vPortClibInit(void)
|
||||
{
|
||||
configASSERT(!ulClibInitDone);
|
||||
heap_ptr += incr;
|
||||
return base;
|
||||
}
|
||||
|
||||
xClibMutex = xSemaphoreCreateRecursiveMutex();
|
||||
ulClibInitDone = 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------------- */
|
||||
/* Global initialization for C library. */
|
||||
/*----------------------------------------------------------------------------- */
|
||||
void vPortClibInit( void )
|
||||
{
|
||||
configASSERT( !ulClibInitDone );
|
||||
|
||||
#endif /* XSHAL_CLIB == XTHAL_CLIB_NEWLIB */
|
||||
xClibMutex = xSemaphoreCreateRecursiveMutex();
|
||||
ulClibInitDone = 1;
|
||||
}
|
||||
|
||||
#endif /* XSHAL_CLIB == XTHAL_CLIB_NEWLIB */
|
||||
|
||||
#endif /* XT_USE_THREAD_SAFE_CLIB */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue