mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-20 15:08:37 +03:00
Initial commit
This commit is contained in:
1487
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/Lint/MISRA_C_2012_Config.lnt
vendored
Normal file
1487
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/Lint/MISRA_C_2012_Config.lnt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1796
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/RTX_CM.uvoptx
vendored
Normal file
1796
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/RTX_CM.uvoptx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5432
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/RTX_CM.uvprojx
vendored
Normal file
5432
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/ARM/MDK/RTX_CM.uvprojx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1634
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/GCC/MDK/RTX_CM.uvoptx
vendored
Normal file
1634
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/GCC/MDK/RTX_CM.uvoptx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4789
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/GCC/MDK/RTX_CM.uvprojx
vendored
Normal file
4789
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/GCC/MDK/RTX_CM.uvprojx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTE_Components.h
vendored
Normal file
13
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTE_Components.h
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Component Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'RTX_CM'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
13919
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTX_CM.ewp
vendored
Normal file
13919
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTX_CM.ewp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
63
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTX_CM.eww
vendored
Normal file
63
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/IAR/IDE/RTX_CM.eww
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<workspace>
|
||||
<project>
|
||||
<path>$WS_DIR$\RTX_CM.ewp</path>
|
||||
</project>
|
||||
<batchBuild>
|
||||
<batchDefinition>
|
||||
<name>RTX_CM</name>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>CM0</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>CM3</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>CM4F</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MB</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MBN</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MM</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MMF</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MMFN</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V8MMN</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V81MM</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V81MMF</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V81MMFN</configuration>
|
||||
</member>
|
||||
<member>
|
||||
<project>RTX_CM</project>
|
||||
<configuration>V81MMN</configuration>
|
||||
</member>
|
||||
</batchDefinition>
|
||||
</batchBuild>
|
||||
</workspace>
|
189
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/RTX_Config.h
vendored
Normal file
189
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/RTX_Config.h
vendored
Normal file
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2023 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* $Revision: V5.6.0
|
||||
*
|
||||
* Project: CMSIS-RTOS RTX
|
||||
* Title: RTX Library Configuration definitions
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef RTX_CONFIG_H_
|
||||
#define RTX_CONFIG_H_
|
||||
|
||||
//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
|
||||
|
||||
// <h>System Configuration
|
||||
// =======================
|
||||
|
||||
// <e>Safety features (Source variant only)
|
||||
// <i> Enables FuSa related features.
|
||||
// <i> Requires RTX Source variant.
|
||||
// <i> Enables:
|
||||
// <i> - selected features from this group
|
||||
// <i> - Thread functions: osThreadProtectPrivileged
|
||||
#ifndef OS_SAFETY_FEATURES
|
||||
#define OS_SAFETY_FEATURES 0
|
||||
#endif
|
||||
|
||||
// <q>Safety Class
|
||||
// <i> Threads assigned to lower classes cannot modify higher class threads.
|
||||
// <i> Enables:
|
||||
// <i> - Object attributes: osSafetyClass
|
||||
// <i> - Kernel functions: osKernelProtect, osKernelDestroyClass
|
||||
// <i> - Thread functions: osThreadGetClass, osThreadSuspendClass, osThreadResumeClass
|
||||
#ifndef OS_SAFETY_CLASS
|
||||
#define OS_SAFETY_CLASS 1
|
||||
#endif
|
||||
|
||||
// <q>MPU Protected Zone
|
||||
// <i> Access protection via MPU (Spatial isolation).
|
||||
// <i> Enables:
|
||||
// <i> - Thread attributes: osThreadZone
|
||||
// <i> - Thread functions: osThreadGetZone, osThreadTerminateZone
|
||||
// <i> - Zone Management: osZoneSetup_Callback
|
||||
#ifndef OS_EXECUTION_ZONE
|
||||
#define OS_EXECUTION_ZONE 1
|
||||
#endif
|
||||
|
||||
// <q>Thread Watchdog
|
||||
// <i> Watchdog alerts ensure timing for critical threads (Temporal isolation).
|
||||
// <i> Enables:
|
||||
// <i> - Thread functions: osThreadFeedWatchdog
|
||||
// <i> - Handler functions: osWatchdogAlarm_Handler
|
||||
#ifndef OS_THREAD_WATCHDOG
|
||||
#define OS_THREAD_WATCHDOG 1
|
||||
#endif
|
||||
|
||||
// <q>Object Pointer checking
|
||||
// <i> Check object pointer alignment and memory region.
|
||||
#ifndef OS_OBJ_PTR_CHECK
|
||||
#define OS_OBJ_PTR_CHECK 0
|
||||
#endif
|
||||
|
||||
// <q>SVC Function Pointer checking
|
||||
// <i> Check SVC function pointer alignment and memory region.
|
||||
// <i> User needs to define a linker execution region RTX_SVC_VENEERS
|
||||
// <i> containing input sections: rtx_*.o (.text.os.svc.veneer.*)
|
||||
#ifndef OS_SVC_PTR_CHECK
|
||||
#define OS_SVC_PTR_CHECK 0
|
||||
#endif
|
||||
|
||||
// </e>
|
||||
|
||||
// <q>Object Memory usage counters
|
||||
// <i> Enables object memory usage counters (requires RTX source variant).
|
||||
#ifndef OS_OBJ_MEM_USAGE
|
||||
#define OS_OBJ_MEM_USAGE 0
|
||||
#endif
|
||||
|
||||
// </h>
|
||||
|
||||
// <h>Thread Configuration
|
||||
// =======================
|
||||
|
||||
// <q>Stack overrun checking
|
||||
// <i> Enables stack overrun check at thread switch (requires RTX source variant).
|
||||
// <i> Enabling this option increases slightly the execution time of a thread switch.
|
||||
#ifndef OS_STACK_CHECK
|
||||
#define OS_STACK_CHECK 0
|
||||
#endif
|
||||
|
||||
// </h>
|
||||
|
||||
// <h>Event Recorder Configuration
|
||||
// ===============================
|
||||
|
||||
// <h>RTOS Event Generation
|
||||
// <i> Enables event generation for RTX components (requires RTX source variant).
|
||||
|
||||
// <q>Memory Management
|
||||
// <i> Enables Memory Management event generation.
|
||||
#ifndef OS_EVR_MEMORY
|
||||
#define OS_EVR_MEMORY 1
|
||||
#endif
|
||||
|
||||
// <q>Kernel
|
||||
// <i> Enables Kernel event generation.
|
||||
#ifndef OS_EVR_KERNEL
|
||||
#define OS_EVR_KERNEL 1
|
||||
#endif
|
||||
|
||||
// <q>Thread
|
||||
// <i> Enables Thread event generation.
|
||||
#ifndef OS_EVR_THREAD
|
||||
#define OS_EVR_THREAD 1
|
||||
#endif
|
||||
|
||||
// <q>Generic Wait
|
||||
// <i> Enables Generic Wait event generation.
|
||||
#ifndef OS_EVR_WAIT
|
||||
#define OS_EVR_WAIT 1
|
||||
#endif
|
||||
|
||||
// <q>Thread Flags
|
||||
// <i> Enables Thread Flags event generation.
|
||||
#ifndef OS_EVR_THFLAGS
|
||||
#define OS_EVR_THFLAGS 1
|
||||
#endif
|
||||
|
||||
// <q>Event Flags
|
||||
// <i> Enables Event Flags event generation.
|
||||
#ifndef OS_EVR_EVFLAGS
|
||||
#define OS_EVR_EVFLAGS 1
|
||||
#endif
|
||||
|
||||
// <q>Timer
|
||||
// <i> Enables Timer event generation.
|
||||
#ifndef OS_EVR_TIMER
|
||||
#define OS_EVR_TIMER 1
|
||||
#endif
|
||||
|
||||
// <q>Mutex
|
||||
// <i> Enables Mutex event generation.
|
||||
#ifndef OS_EVR_MUTEX
|
||||
#define OS_EVR_MUTEX 1
|
||||
#endif
|
||||
|
||||
// <q>Semaphore
|
||||
// <i> Enables Semaphore event generation.
|
||||
#ifndef OS_EVR_SEMAPHORE
|
||||
#define OS_EVR_SEMAPHORE 1
|
||||
#endif
|
||||
|
||||
// <q>Memory Pool
|
||||
// <i> Enables Memory Pool event generation.
|
||||
#ifndef OS_EVR_MEMPOOL
|
||||
#define OS_EVR_MEMPOOL 1
|
||||
#endif
|
||||
|
||||
// <q>Message Queue
|
||||
// <i> Enables Message Queue event generation.
|
||||
#ifndef OS_EVR_MSGQUEUE
|
||||
#define OS_EVR_MSGQUEUE 1
|
||||
#endif
|
||||
|
||||
// </h>
|
||||
|
||||
// </h>
|
||||
|
||||
//------------- <<< end of configuration section >>> ---------------------------
|
||||
|
||||
#endif // RTX_CONFIG_H_
|
50
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/build.py
vendored
Normal file
50
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/build.py
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from matrix_runner import main, matrix_axis, matrix_action, matrix_command
|
||||
|
||||
|
||||
@matrix_axis("device", "d", "Device(s) to be considered.")
|
||||
class Device(Enum):
|
||||
CM0 = ('CM0', 'CM0_LE')
|
||||
CM3 = ('CM3', 'CM3_LE')
|
||||
CM4F = ('CM4F', 'CM4F_LE')
|
||||
V8MB = ('V8MB', 'ARMv8MBL_LE')
|
||||
V8MBN = ('V8MBN', 'ARMv8MBL_NS_LE')
|
||||
V8MM = ('V8MM', 'ARMv8MML_LE')
|
||||
V8MMF = ('V8MMF', 'ARMv8MML_SP_LE')
|
||||
V8MMFN = ('V8MMFN', 'ARMv8MML_SP_NS_LE')
|
||||
V8MMN = ('V8MMN', 'ARMv8MML_NS_LE')
|
||||
|
||||
|
||||
@matrix_axis("compiler", "c", "Compiler(s) to be considered.")
|
||||
class CompilerAxis(Enum):
|
||||
AC6 = ('AC6', 'ArmCompiler6', 'armclang')
|
||||
GCC = ('GCC',)
|
||||
|
||||
@property
|
||||
def project(self):
|
||||
return {
|
||||
CompilerAxis.AC6: "ARM/MDK/RTX_CM.uvprojx",
|
||||
CompilerAxis.GCC: "GCC/MDK/RTX_CM.uvprojx"
|
||||
}[self]
|
||||
|
||||
|
||||
@matrix_action
|
||||
def build(config, results):
|
||||
"""Build the selected configurations."""
|
||||
yield uvision(config)
|
||||
|
||||
|
||||
@matrix_command()
|
||||
def uvision(config):
|
||||
return ['uvision.com',
|
||||
'-r', config.compiler.project,
|
||||
'-t', config.device[1],
|
||||
'-j0']
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
371
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/cmsis_os1.c
vendored
Normal file
371
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/cmsis_os1.c
vendored
Normal file
@ -0,0 +1,371 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2017 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ----------------------------------------------------------------------
|
||||
*
|
||||
* $Date: 10. January 2017
|
||||
* $Revision: V1.2
|
||||
*
|
||||
* Project: CMSIS-RTOS API V1
|
||||
* Title: cmsis_os_v1.c V1 module file
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <string.h>
|
||||
#include "cmsis_os.h"
|
||||
|
||||
#if (osCMSIS >= 0x20000U) && !defined(os1_Disable)
|
||||
|
||||
|
||||
// Thread
|
||||
#if !defined(os1_Disable_Thread)
|
||||
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument) {
|
||||
|
||||
if (thread_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osThreadNew((osThreadFunc_t)thread_def->pthread, argument, &thread_def->attr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Signals
|
||||
|
||||
#if !defined(os1_Disable_Signal)
|
||||
|
||||
#define SignalMask ((1U<<osFeature_Signals)-1U)
|
||||
|
||||
int32_t osSignalSet (osThreadId thread_id, int32_t signals) {
|
||||
uint32_t flags;
|
||||
|
||||
flags = osThreadFlagsSet(thread_id, (uint32_t)signals);
|
||||
if ((flags & 0x80000000U) != 0U) {
|
||||
return ((int32_t)0x80000000U);
|
||||
}
|
||||
return ((int32_t)(flags & ~((uint32_t)signals)));
|
||||
}
|
||||
|
||||
int32_t osSignalClear (osThreadId thread_id, int32_t signals) {
|
||||
uint32_t flags;
|
||||
|
||||
if (thread_id != osThreadGetId()) {
|
||||
return ((int32_t)0x80000000U);
|
||||
}
|
||||
flags = osThreadFlagsClear((uint32_t)signals);
|
||||
if ((flags & 0x80000000U) != 0U) {
|
||||
return ((int32_t)0x80000000U);
|
||||
}
|
||||
return ((int32_t)flags);
|
||||
}
|
||||
|
||||
os_InRegs osEvent osSignalWait (int32_t signals, uint32_t millisec) {
|
||||
osEvent event;
|
||||
uint32_t flags;
|
||||
|
||||
if (signals != 0) {
|
||||
flags = osThreadFlagsWait((uint32_t)signals, osFlagsWaitAll, millisec);
|
||||
} else {
|
||||
flags = osThreadFlagsWait(SignalMask, osFlagsWaitAny, millisec);
|
||||
}
|
||||
if ((flags > 0U) && (flags < 0x80000000U)) {
|
||||
event.status = osEventSignal;
|
||||
event.value.signals = (int32_t)flags;
|
||||
} else {
|
||||
switch ((int32_t)flags) {
|
||||
case osErrorResource:
|
||||
event.status = osOK;
|
||||
break;
|
||||
case osErrorTimeout:
|
||||
event.status = osEventTimeout;
|
||||
break;
|
||||
case osErrorParameter:
|
||||
event.status = osErrorValue;
|
||||
break;
|
||||
default:
|
||||
event.status = (osStatus)flags;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
#endif // Signal
|
||||
|
||||
|
||||
// Timer
|
||||
#if !defined(os1_Disable_Timer)
|
||||
osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument) {
|
||||
|
||||
if (timer_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osTimerNew((osTimerFunc_t)timer_def->ptimer, type, argument, &timer_def->attr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Mutex
|
||||
#if !defined(os1_Disable_Mutex)
|
||||
osMutexId osMutexCreate (const osMutexDef_t *mutex_def) {
|
||||
|
||||
if (mutex_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osMutexNew(mutex_def);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Semaphore
|
||||
|
||||
#if (defined (osFeature_Semaphore) && (osFeature_Semaphore != 0U)) && !defined(os1_Disable_Semaphore)
|
||||
|
||||
osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count) {
|
||||
|
||||
if (semaphore_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osSemaphoreNew((uint32_t)count, (uint32_t)count, semaphore_def);
|
||||
}
|
||||
|
||||
int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec) {
|
||||
osStatus_t status;
|
||||
uint32_t count;
|
||||
|
||||
status = osSemaphoreAcquire(semaphore_id, millisec);
|
||||
switch (status) {
|
||||
case osOK:
|
||||
count = osSemaphoreGetCount(semaphore_id);
|
||||
return ((int32_t)count + 1);
|
||||
case osErrorResource:
|
||||
case osErrorTimeout:
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif // Semaphore
|
||||
|
||||
|
||||
// Memory Pool
|
||||
|
||||
#if (defined(osFeature_Pool) && (osFeature_Pool != 0))&& !defined(os1_Disable_Pool)
|
||||
|
||||
osPoolId osPoolCreate (const osPoolDef_t *pool_def) {
|
||||
|
||||
if (pool_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osMemoryPoolNew(pool_def->pool_sz, pool_def->item_sz, &pool_def->attr);
|
||||
}
|
||||
|
||||
void *osPoolAlloc (osPoolId pool_id) {
|
||||
return osMemoryPoolAlloc(pool_id, 0U);
|
||||
}
|
||||
|
||||
void *osPoolCAlloc (osPoolId pool_id) {
|
||||
void *block;
|
||||
uint32_t block_size;
|
||||
|
||||
block_size = osMemoryPoolGetBlockSize((osMemoryPoolId_t)pool_id);
|
||||
if (block_size == 0U) {
|
||||
return NULL;
|
||||
}
|
||||
block = osMemoryPoolAlloc(pool_id, 0U);
|
||||
if (block != NULL) {
|
||||
memset(block, 0, block_size);
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
osStatus osPoolFree (osPoolId pool_id, void *block) {
|
||||
return osMemoryPoolFree(pool_id, block);
|
||||
}
|
||||
|
||||
#endif // Memory Pool
|
||||
|
||||
|
||||
// Message Queue
|
||||
|
||||
#if (defined(osFeature_MessageQ) && (osFeature_MessageQ != 0)) && !defined(os1_Disable_MessageQ)
|
||||
|
||||
osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id) {
|
||||
(void)thread_id;
|
||||
|
||||
if (queue_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osMessageQueueNew(queue_def->queue_sz, sizeof(uint32_t), &queue_def->attr);
|
||||
}
|
||||
|
||||
osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec) {
|
||||
return osMessageQueuePut(queue_id, &info, 0U, millisec);
|
||||
}
|
||||
|
||||
os_InRegs osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec) {
|
||||
osStatus_t status;
|
||||
osEvent event;
|
||||
uint32_t message;
|
||||
|
||||
status = osMessageQueueGet(queue_id, &message, NULL, millisec);
|
||||
switch (status) {
|
||||
case osOK:
|
||||
event.status = osEventMessage;
|
||||
event.value.v = message;
|
||||
break;
|
||||
case osErrorResource:
|
||||
event.status = osOK;
|
||||
break;
|
||||
case osErrorTimeout:
|
||||
event.status = osEventTimeout;
|
||||
break;
|
||||
default:
|
||||
event.status = status;
|
||||
break;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
#endif // Message Queue
|
||||
|
||||
|
||||
// Mail Queue
|
||||
|
||||
#if (defined(osFeature_MailQ) && (osFeature_MailQ != 0)) && !defined(os1_Disable_MailQ)
|
||||
|
||||
typedef struct os_mail_queue_s {
|
||||
osMemoryPoolId_t mp_id;
|
||||
osMessageQueueId_t mq_id;
|
||||
} os_mail_queue_t;
|
||||
|
||||
osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id) {
|
||||
os_mail_queue_t *ptr;
|
||||
(void)thread_id;
|
||||
|
||||
if (queue_def == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr = queue_def->mail;
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr->mp_id = osMemoryPoolNew (queue_def->queue_sz, queue_def->item_sz, &queue_def->mp_attr);
|
||||
ptr->mq_id = osMessageQueueNew(queue_def->queue_sz, sizeof(void *), &queue_def->mq_attr);
|
||||
if ((ptr->mp_id == NULL) || (ptr->mq_id == NULL)) {
|
||||
if (ptr->mp_id != NULL) {
|
||||
osMemoryPoolDelete(ptr->mp_id);
|
||||
}
|
||||
if (ptr->mq_id != NULL) {
|
||||
osMessageQueueDelete(ptr->mq_id);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *osMailAlloc (osMailQId queue_id, uint32_t millisec) {
|
||||
os_mail_queue_t *ptr = (os_mail_queue_t *)queue_id;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return osMemoryPoolAlloc(ptr->mp_id, millisec);
|
||||
}
|
||||
|
||||
void *osMailCAlloc (osMailQId queue_id, uint32_t millisec) {
|
||||
os_mail_queue_t *ptr = (os_mail_queue_t *)queue_id;
|
||||
void *block;
|
||||
uint32_t block_size;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
block_size = osMemoryPoolGetBlockSize(ptr->mp_id);
|
||||
if (block_size == 0U) {
|
||||
return NULL;
|
||||
}
|
||||
block = osMemoryPoolAlloc(ptr->mp_id, millisec);
|
||||
if (block != NULL) {
|
||||
memset(block, 0, block_size);
|
||||
}
|
||||
|
||||
return block;
|
||||
|
||||
}
|
||||
|
||||
osStatus osMailPut (osMailQId queue_id, const void *mail) {
|
||||
os_mail_queue_t *ptr = (os_mail_queue_t *)queue_id;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return osErrorParameter;
|
||||
}
|
||||
if (mail == NULL) {
|
||||
return osErrorValue;
|
||||
}
|
||||
return osMessageQueuePut(ptr->mq_id, &mail, 0U, 0U);
|
||||
}
|
||||
|
||||
os_InRegs osEvent osMailGet (osMailQId queue_id, uint32_t millisec) {
|
||||
os_mail_queue_t *ptr = (os_mail_queue_t *)queue_id;
|
||||
osStatus_t status;
|
||||
osEvent event;
|
||||
void *mail;
|
||||
|
||||
if (ptr == NULL) {
|
||||
event.status = osErrorParameter;
|
||||
return event;
|
||||
}
|
||||
|
||||
status = osMessageQueueGet(ptr->mq_id, &mail, NULL, millisec);
|
||||
switch (status) {
|
||||
case osOK:
|
||||
event.status = osEventMail;
|
||||
event.value.p = mail;
|
||||
break;
|
||||
case osErrorResource:
|
||||
event.status = osOK;
|
||||
break;
|
||||
case osErrorTimeout:
|
||||
event.status = osEventTimeout;
|
||||
break;
|
||||
default:
|
||||
event.status = status;
|
||||
break;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
osStatus osMailFree (osMailQId queue_id, void *mail) {
|
||||
os_mail_queue_t *ptr = (os_mail_queue_t *)queue_id;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return osErrorParameter;
|
||||
}
|
||||
if (mail == NULL) {
|
||||
return osErrorValue;
|
||||
}
|
||||
return osMemoryPoolFree(ptr->mp_id, mail);
|
||||
}
|
||||
|
||||
#endif // Mail Queue
|
||||
|
||||
|
||||
#endif // osCMSIS
|
80
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/fetch_libs.sh
vendored
Normal file
80
external/CMSIS_5/CMSIS/RTOS2/RTX/Library/fetch_libs.sh
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
VERSION=5.5.5
|
||||
if [ -z "$JENKINS_FAMILY_ENV" ]; then
|
||||
ARTIFACTORY_URL=https://artifactory.eu02.arm.com:443/artifactory/mcu.promoted
|
||||
else
|
||||
ARTIFACTORY_URL=https://eu-west-1.artifactory.aws.arm.com:443/artifactory/mcu.promoted
|
||||
fi
|
||||
|
||||
if [ -z "$ARTIFACTORY_API_KEY" ]; then
|
||||
echo "Please set your Artifactory in ARTIFACTORY_API_KEY"
|
||||
echo ""
|
||||
echo "1. Browse to $(dirname $(dirname $ARTIFACTORY_URL))/ui/admin/artifactory/user_profile"
|
||||
echo "2. Copy the API Key"
|
||||
echo "3. Add 'export ARTIFACTORY_API_KEY=\"<API Key>\"' to ~/.bashrc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -o pipefail
|
||||
|
||||
function usage {
|
||||
echo "$(basename $0) [-h|--help] [-f|--force]"
|
||||
echo ""
|
||||
echo "Arguments:"
|
||||
echo " -h|--help Print this usage message and exit."
|
||||
echo " -f|--force Force (re)download."
|
||||
echo ""
|
||||
echo "Environment:"
|
||||
echo " curl"
|
||||
echo " sha256sum"
|
||||
echo ""
|
||||
}
|
||||
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
'-h'|'--help')
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
'-f'|'--force')
|
||||
FORCE=1
|
||||
;;
|
||||
*) # unknown option
|
||||
POSITIONAL+=("$1") # save it in an array for later
|
||||
;;
|
||||
esac
|
||||
shift # past argument
|
||||
done
|
||||
set -- "${POSITIONAL[@]}" # restore positional parameters
|
||||
|
||||
pushd $(dirname $0) > /dev/null
|
||||
|
||||
ARCHIVE_NAME="RTX5-${VERSION}.zip"
|
||||
ARCHIVE_URL="${ARTIFACTORY_URL}/CMSIS_5/Libraries/${ARCHIVE_NAME}"
|
||||
echo "Fetching ${ARCHIVE_URL}..."
|
||||
|
||||
if [[ $FORCE == 1 ]]; then
|
||||
rm ${ARCHIVE_NAME}
|
||||
fi
|
||||
|
||||
if [[ -f ${ARCHIVE_NAME} ]]; then
|
||||
sha256sum=$(curl -s -I -H "X-JFrog-Art-Api:${ARTIFACTORY_API_KEY}" "${ARCHIVE_URL}" | grep "X-Checksum-Sha256" | cut -d" " -f2)
|
||||
if echo "${sha256sum} *${ARCHIVE_NAME}" | sha256sum -c --status; then
|
||||
echo "Already up-to-date"
|
||||
else
|
||||
rm ${ARCHIVE_NAME}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -f ${ARCHIVE_NAME} ]]; then
|
||||
curl -C - -H "X-JFrog-Art-Api:${ARTIFACTORY_API_KEY}" -O "${ARCHIVE_URL}"
|
||||
fi
|
||||
|
||||
unzip -u ${ARCHIVE_NAME}
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user