2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef _IA_CSS_REFCOUNT_H_
16 #define _IA_CSS_REFCOUNT_H_
18 #include <type_support.h>
19 #include <system_types.h>
20 #include <ia_css_err.h>
22 typedef void (*clear_func)(hrt_vaddress ptr);
24 /*! \brief Function for initializing refcount list
26 * \param[in] size Size of the refcount list.
29 extern enum ia_css_err ia_css_refcount_init(uint32_t size);
31 /*! \brief Function for de-initializing refcount list
35 extern void ia_css_refcount_uninit(void);
37 /*! \brief Function for increasing reference by 1.
39 * \param[in] id ID of the object.
40 * \param[in] ptr Data of the object (ptr).
41 * \return hrt_vaddress (saved address)
43 extern hrt_vaddress ia_css_refcount_increment(int32_t id, hrt_vaddress ptr);
45 /*! \brief Function for decrease reference by 1.
47 * \param[in] id ID of the object.
48 * \param[in] ptr Data of the object (ptr).
50 * - true, if it is successful.
53 extern bool ia_css_refcount_decrement(int32_t id, hrt_vaddress ptr);
55 /*! \brief Function to check if reference count is 1.
57 * \param[in] ptr Data of the object (ptr).
59 * - true, if it is successful.
62 extern bool ia_css_refcount_is_single(hrt_vaddress ptr);
64 /*! \brief Function to clear reference list objects.
66 * \param[in] id ID of the object.
67 * \param[in] clear_func function to be run to free reference objects.
71 extern void ia_css_refcount_clear(int32_t id,
72 clear_func clear_func_ptr);
74 /*! \brief Function to verify if object is valid
76 * \param[in] ptr Data of the object (ptr)
81 extern bool ia_css_refcount_is_valid(hrt_vaddress ptr);
83 #endif /* _IA_CSS_REFCOUNT_H_ */