blob: 38b9a162ff9173a1acd1c01c7be952f8f1449ea2 [file] [log] [blame]
Kevin Peng477fa942019-07-29 10:55:17 +08001/*
2 * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __OS_WRAPPER_SEMAPHORE_H__
9#define __OS_WRAPPER_SEMAPHORE_H__
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include "common.h"
16
17/**
18 * \brief Creates a new semaphore
19 *
20 * \param[in] max_count Highest count of the semaphore
21 * \param[in] initial_count Starting count of the semaphore
22 * \param[in] name Name of the semaphore
23 *
24 * \return Returns ID of the semaphore created, or \ref OS_WRAPPER_ERROR in case
25 * of error
26 */
27uint32_t os_wrapper_semaphore_create(uint32_t max_count, uint32_t initial_count,
28 const char *name);
29
30/**
31 * \brief Acquires the semaphore
32 *
33 * \param[in] semaphore_id Semaphore ID
34 * \param[in] timeout Timeout value
35 *
36 * \return \ref OS_WRAPPER_SUCCESS in case of successful acquision, or
37 * \ref OS_WRAPPER_ERROR in case of error
38 */
39uint32_t os_wrapper_semaphore_acquire(uint32_t semaphore_id, uint32_t timeout);
40
41/**
42 * \brief Releases the semaphore
43 *
44 * \param[in] semaphore_id Semaphore ID
45 *
46 * \return \ref OS_WRAPPER_SUCCESS in case of successful release, or
47 * \ref OS_WRAPPER_ERROR in case of error
48 */
49uint32_t os_wrapper_semaphore_release(uint32_t semaphore_id);
50
51/**
52 * \brief Deletes the semaphore
53 *
54 * \param[in] semaphore_id Semaphore ID
55 *
56 * \return \ref OS_WRAPPER_SUCCESS in case of successful release, or
57 * \ref OS_WRAPPER_ERROR in case of error
58 */
59uint32_t os_wrapper_semaphore_delete(uint32_t semaphore_id);
60
61#ifdef __cplusplus
62}
63#endif
64
65#endif /* __OS_WRAPPER_SEMAPHORE_H__ */