1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef __OSIF_H__ 16 #define __OSIF_H__ 17 #include <stdint.h> 18 19 typedef uint32_t osif_timer_t; 20 21 typedef void (*osif_timer_callback)(void); 22 23 #if defined(__cplusplus) 24 extern "C" { 25 #endif 26 27 bool osif_init(void); 28 29 uint32_t osif_get_sys_time(void); 30 31 uint16_t osif_rand(void); 32 33 void osif_stop_hardware(void); 34 35 void osif_resume_hardware(void); 36 37 void osif_memcopy(uint8_t *dest, const uint8_t *source, uint32_t numBytes); 38 39 bool osif_memcmp(const uint8_t *buffer1, uint16_t len1, const uint8_t *buffer2, uint16_t len2); 40 41 void osif_memset(uint8_t *dest, uint8_t byte, uint32_t len); 42 43 uint8_t osif_strcmp(const char *Str1, const char *Str2); 44 45 uint16_t osif_strlen(const char *Str); 46 47 void osif_assert(const char *expression, const char *file, uint16_t line); 48 49 void osif_lock_stack(void); 50 51 void osif_unlock_stack(void); 52 53 void osif_notify_evm(void); 54 55 void osif_start_timer(osif_timer_t t, osif_timer_callback func); 56 57 void osif_cancel_timer(void); 58 59 uint8_t osif_lock_is_exist(void); 60 61 #if defined(__cplusplus) 62 } 63 #endif 64 65 #endif /*__OSIF_H__*/ 66 67