GNU Linux-libre 4.14.259-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / rmgr / interface / ia_css_rmgr_vbuf.h
1 #ifndef ISP2401
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
23
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
27 more details.
28 */
29 #endif
30
31 #ifndef _IA_CSS_RMGR_VBUF_H
32 #define _IA_CSS_RMGR_VBUF_H
33
34 #include "ia_css_rmgr.h"
35 #include <type_support.h>
36 #include <system_types.h>
37
38 /**
39  * @brief Data structure for the resource handle (host, vbuf)
40  */
41 struct ia_css_rmgr_vbuf_handle {
42         hrt_vaddress vptr;
43         uint8_t count;
44         uint32_t size;
45 };
46
47 /**
48  * @brief Data structure for the resource pool (host, vbuf)
49  */
50 struct ia_css_rmgr_vbuf_pool {
51         uint8_t copy_on_write;
52         uint8_t recycle;
53         uint32_t size;
54         uint32_t index;
55         struct ia_css_rmgr_vbuf_handle **handles;
56 };
57
58 /**
59  * @brief VBUF resource pools
60  */
61 extern struct ia_css_rmgr_vbuf_pool *vbuf_ref;
62 extern struct ia_css_rmgr_vbuf_pool *vbuf_write;
63 extern struct ia_css_rmgr_vbuf_pool *hmm_buffer_pool;
64
65 /**
66  * @brief Initialize the resource pool (host, vbuf)
67  *
68  * @param pool  The pointer to the pool
69  */
70 STORAGE_CLASS_RMGR_H enum ia_css_err ia_css_rmgr_init_vbuf(
71         struct ia_css_rmgr_vbuf_pool *pool);
72
73 /**
74  * @brief Uninitialize the resource pool (host, vbuf)
75  *
76  * @param pool  The pointer to the pool
77  */
78 STORAGE_CLASS_RMGR_H void ia_css_rmgr_uninit_vbuf(
79         struct ia_css_rmgr_vbuf_pool *pool);
80
81 /**
82  * @brief Acquire a handle from the pool (host, vbuf)
83  *
84  * @param pool          The pointer to the pool
85  * @param handle        The pointer to the handle
86  */
87 STORAGE_CLASS_RMGR_H void ia_css_rmgr_acq_vbuf(
88         struct ia_css_rmgr_vbuf_pool *pool,
89         struct ia_css_rmgr_vbuf_handle **handle);
90
91 /**
92  * @brief Release a handle to the pool (host, vbuf)
93  *
94  * @param pool          The pointer to the pool
95  * @param handle        The pointer to the handle
96  */
97 STORAGE_CLASS_RMGR_H void ia_css_rmgr_rel_vbuf(
98         struct ia_css_rmgr_vbuf_pool *pool,
99         struct ia_css_rmgr_vbuf_handle **handle);
100
101 /**
102  * @brief Retain the reference count for a handle (host, vbuf)
103  *
104  * @param handle        The pointer to the handle
105  */
106 void ia_css_rmgr_refcount_retain_vbuf(struct ia_css_rmgr_vbuf_handle **handle);
107
108 /**
109  * @brief Release the reference count for a handle (host, vbuf)
110  *
111  * @param handle        The pointer to the handle
112  */
113 void ia_css_rmgr_refcount_release_vbuf(struct ia_css_rmgr_vbuf_handle **handle);
114
115 #endif  /* _IA_CSS_RMGR_VBUF_H */