1 /**************************************************************************//** 2 * 3 * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved. 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 * 7 * Change Logs: 8 * Date Author Notes 9 * 2022-10-5 Wayne First version 10 * 11 ******************************************************************************/ 12 13 #ifndef __DRV_HWSEM_H__ 14 #define __DRV_HWSEM_H__ 15 16 #include <rtdevice.h> 17 18 typedef enum 19 { 20 evHWSEM0 = 0, 21 evHWSEM1, 22 evHWSEM2, 23 evHWSEM3, 24 evHWSEM4, 25 evHWSEM5, 26 evHWSEM6, 27 evHWSEM7, 28 evHWSEM_CNT, 29 } E_HWSEM_ID; 30 31 struct nu_mutex 32 { 33 E_HWSEM_ID id; 34 }; 35 typedef struct nu_mutex *nu_mutex_t; 36 37 nu_mutex_t nu_mutex_init(struct rt_device *device, E_HWSEM_ID id); 38 rt_err_t nu_mutex_take(nu_mutex_t mutex, rt_int32_t timeout); 39 rt_err_t nu_mutex_release(nu_mutex_t mutex); 40 void nu_mutex_deinit(struct rt_device *device, E_HWSEM_ID id); 41 42 43 #endif /* __DRV_HWSEM_H__ */ 44