Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cmsis_os2_port.c Source File

cmsis_os2_port.c

00001 /**
00002  * @file    cmsis_os2_port.c
00003  * @brief   
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2019, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 #include "cmsis_os2.h"
00022 #include "SysTick_Handler.h"
00023 
00024 osStatus_t osKernelInitialize(void)
00025 {
00026     sysTickInit();
00027     return osOK;
00028 }
00029 
00030 osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
00031 {
00032     sysTickRegMainFunc(func);
00033     return (osThreadId_t)1;
00034 }
00035 
00036 osStatus_t osKernelStart(void)
00037 {
00038     sysTickStartMain();
00039     return osOK;
00040 }
00041 
00042 uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags)
00043 {
00044     sysTickEvtSet(flags);
00045     return flags;
00046 }
00047 
00048 osStatus_t osDelay(uint32_t ticks)
00049 {
00050     sysTickWait(ticks);
00051     return osOK;
00052 }
00053 
00054 osTimerId_t osTimerNew(osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)
00055 {
00056     sysTickRegCallback(func);
00057     return (osTimerId_t)1;
00058 }
00059 
00060 osStatus_t osTimerStart(osTimerId_t timer_id, uint32_t ticks)
00061 {
00062     sysTickFreqSet(ticks);
00063     return osOK;
00064 }
00065 
00066 uint32_t osThreadFlagsWait(uint32_t flags, uint32_t options, uint32_t timeout)
00067 {
00068     return sysTickEvtWaitOr(flags);
00069 }
00070 
00071 osMutexId_t osMutexNew(const osMutexAttr_t *attr)
00072 {
00073     return NULL;
00074 }
00075 
00076 osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)
00077 {
00078     return osOK;
00079 }
00080 
00081 osStatus_t osMutexRelease (osMutexId_t mutex_id)
00082 {
00083     return osOK;
00084 }
00085 
00086 osThreadId_t osThreadGetId (void)
00087 {
00088     return (osThreadId_t)1;
00089 }