Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/rtos_none/cmsis_os2_port.c@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file cmsis_os2_port.c |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2019, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | #include "cmsis_os2.h" |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #include "SysTick_Handler.h" |
Pawel Zarembski |
0:01f31e923fe2 | 23 | |
Pawel Zarembski |
0:01f31e923fe2 | 24 | osStatus_t osKernelInitialize(void) |
Pawel Zarembski |
0:01f31e923fe2 | 25 | { |
Pawel Zarembski |
0:01f31e923fe2 | 26 | sysTickInit(); |
Pawel Zarembski |
0:01f31e923fe2 | 27 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 28 | } |
Pawel Zarembski |
0:01f31e923fe2 | 29 | |
Pawel Zarembski |
0:01f31e923fe2 | 30 | osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr) |
Pawel Zarembski |
0:01f31e923fe2 | 31 | { |
Pawel Zarembski |
0:01f31e923fe2 | 32 | sysTickRegMainFunc(func); |
Pawel Zarembski |
0:01f31e923fe2 | 33 | return (osThreadId_t)1; |
Pawel Zarembski |
0:01f31e923fe2 | 34 | } |
Pawel Zarembski |
0:01f31e923fe2 | 35 | |
Pawel Zarembski |
0:01f31e923fe2 | 36 | osStatus_t osKernelStart(void) |
Pawel Zarembski |
0:01f31e923fe2 | 37 | { |
Pawel Zarembski |
0:01f31e923fe2 | 38 | sysTickStartMain(); |
Pawel Zarembski |
0:01f31e923fe2 | 39 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 40 | } |
Pawel Zarembski |
0:01f31e923fe2 | 41 | |
Pawel Zarembski |
0:01f31e923fe2 | 42 | uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags) |
Pawel Zarembski |
0:01f31e923fe2 | 43 | { |
Pawel Zarembski |
0:01f31e923fe2 | 44 | sysTickEvtSet(flags); |
Pawel Zarembski |
0:01f31e923fe2 | 45 | return flags; |
Pawel Zarembski |
0:01f31e923fe2 | 46 | } |
Pawel Zarembski |
0:01f31e923fe2 | 47 | |
Pawel Zarembski |
0:01f31e923fe2 | 48 | osStatus_t osDelay(uint32_t ticks) |
Pawel Zarembski |
0:01f31e923fe2 | 49 | { |
Pawel Zarembski |
0:01f31e923fe2 | 50 | sysTickWait(ticks); |
Pawel Zarembski |
0:01f31e923fe2 | 51 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 52 | } |
Pawel Zarembski |
0:01f31e923fe2 | 53 | |
Pawel Zarembski |
0:01f31e923fe2 | 54 | osTimerId_t osTimerNew(osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr) |
Pawel Zarembski |
0:01f31e923fe2 | 55 | { |
Pawel Zarembski |
0:01f31e923fe2 | 56 | sysTickRegCallback(func); |
Pawel Zarembski |
0:01f31e923fe2 | 57 | return (osTimerId_t)1; |
Pawel Zarembski |
0:01f31e923fe2 | 58 | } |
Pawel Zarembski |
0:01f31e923fe2 | 59 | |
Pawel Zarembski |
0:01f31e923fe2 | 60 | osStatus_t osTimerStart(osTimerId_t timer_id, uint32_t ticks) |
Pawel Zarembski |
0:01f31e923fe2 | 61 | { |
Pawel Zarembski |
0:01f31e923fe2 | 62 | sysTickFreqSet(ticks); |
Pawel Zarembski |
0:01f31e923fe2 | 63 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 64 | } |
Pawel Zarembski |
0:01f31e923fe2 | 65 | |
Pawel Zarembski |
0:01f31e923fe2 | 66 | uint32_t osThreadFlagsWait(uint32_t flags, uint32_t options, uint32_t timeout) |
Pawel Zarembski |
0:01f31e923fe2 | 67 | { |
Pawel Zarembski |
0:01f31e923fe2 | 68 | return sysTickEvtWaitOr(flags); |
Pawel Zarembski |
0:01f31e923fe2 | 69 | } |
Pawel Zarembski |
0:01f31e923fe2 | 70 | |
Pawel Zarembski |
0:01f31e923fe2 | 71 | osMutexId_t osMutexNew(const osMutexAttr_t *attr) |
Pawel Zarembski |
0:01f31e923fe2 | 72 | { |
Pawel Zarembski |
0:01f31e923fe2 | 73 | return NULL; |
Pawel Zarembski |
0:01f31e923fe2 | 74 | } |
Pawel Zarembski |
0:01f31e923fe2 | 75 | |
Pawel Zarembski |
0:01f31e923fe2 | 76 | osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) |
Pawel Zarembski |
0:01f31e923fe2 | 77 | { |
Pawel Zarembski |
0:01f31e923fe2 | 78 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 79 | } |
Pawel Zarembski |
0:01f31e923fe2 | 80 | |
Pawel Zarembski |
0:01f31e923fe2 | 81 | osStatus_t osMutexRelease (osMutexId_t mutex_id) |
Pawel Zarembski |
0:01f31e923fe2 | 82 | { |
Pawel Zarembski |
0:01f31e923fe2 | 83 | return osOK; |
Pawel Zarembski |
0:01f31e923fe2 | 84 | } |
Pawel Zarembski |
0:01f31e923fe2 | 85 | |
Pawel Zarembski |
0:01f31e923fe2 | 86 | osThreadId_t osThreadGetId (void) |
Pawel Zarembski |
0:01f31e923fe2 | 87 | { |
Pawel Zarembski |
0:01f31e923fe2 | 88 | return (osThreadId_t)1; |
Pawel Zarembski |
0:01f31e923fe2 | 89 | } |