GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / queue / src / queue_access.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 __QUEUE_ACCESS_H
32 #define __QUEUE_ACCESS_H
33
34 #include <type_support.h>
35 #include <ia_css_queue_comm.h>
36 #include <ia_css_circbuf.h>
37 #include <error_support.h>
38
39 #define QUEUE_IGNORE_START_FLAG 0x0001
40 #define QUEUE_IGNORE_END_FLAG   0x0002
41 #define QUEUE_IGNORE_SIZE_FLAG  0x0004
42 #define QUEUE_IGNORE_STEP_FLAG  0x0008
43 #define QUEUE_IGNORE_DESC_FLAGS_MAX 0x000f
44
45 #define QUEUE_IGNORE_SIZE_START_STEP_FLAGS \
46         (QUEUE_IGNORE_SIZE_FLAG | \
47         QUEUE_IGNORE_START_FLAG | \
48         QUEUE_IGNORE_STEP_FLAG)
49
50 #define QUEUE_IGNORE_SIZE_END_STEP_FLAGS \
51         (QUEUE_IGNORE_SIZE_FLAG | \
52         QUEUE_IGNORE_END_FLAG   | \
53         QUEUE_IGNORE_STEP_FLAG)
54
55 #define QUEUE_IGNORE_START_END_STEP_FLAGS \
56         (QUEUE_IGNORE_START_FLAG | \
57         QUEUE_IGNORE_END_FLAG     | \
58         QUEUE_IGNORE_STEP_FLAG)
59
60 #define QUEUE_CB_DESC_INIT(cb_desc)     \
61         do {                            \
62                 (cb_desc)->size  = 0;   \
63                 (cb_desc)->step  = 0;   \
64                 (cb_desc)->start = 0;   \
65                 (cb_desc)->end   = 0;   \
66         } while(0)
67
68 struct ia_css_queue {
69         uint8_t type;        /* Specify remote/local type of access */
70         uint8_t location;    /* Cell location for queue */
71         uint8_t proc_id;     /* Processor id for queue access */
72         union {
73                 ia_css_circbuf_t cb_local;
74                 struct {
75                         uint32_t cb_desc_addr; /*Circbuf desc address for remote queues*/
76                         uint32_t cb_elems_addr; /*Circbuf elements addr for remote queue*/
77                 }       remote;
78         } desc;
79 };
80
81 extern int ia_css_queue_load(
82                 struct ia_css_queue *rdesc,
83                 ia_css_circbuf_desc_t *cb_desc,
84                 uint32_t ignore_desc_flags);
85
86 extern int ia_css_queue_store(
87                 struct ia_css_queue *rdesc,
88                 ia_css_circbuf_desc_t *cb_desc,
89                 uint32_t ignore_desc_flags);
90
91 extern int ia_css_queue_item_load(
92                 struct ia_css_queue *rdesc,
93                 uint8_t position,
94                 ia_css_circbuf_elem_t *item);
95
96 extern int ia_css_queue_item_store(
97                 struct ia_css_queue *rdesc,
98                 uint8_t position,
99                 ia_css_circbuf_elem_t *item);
100
101 #endif /* __QUEUE_ACCESS_H */