GNU Linux-libre 4.14.303-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2401_csi2p_system / hrt / ibuf_cntrl_defs.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2015, Intel Corporation.
4  *
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.
8  *
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
12  * more details.
13  */
14
15 #ifndef _ibuf_cntrl_defs_h_
16 #define _ibuf_cntrl_defs_h_
17
18 #include <stream2mmio_defs.h>
19 #include <dma_v2_defs.h>
20
21 #define _IBUF_CNTRL_REG_ALIGN 4
22   /* alignment of register banks, first bank are shared configuration and status registers: */
23 #define _IBUF_CNTRL_PROC_REG_ALIGN        32
24
25   /* the actual amount of configuration registers per proc: */
26 #define _IBUF_CNTRL_CONFIG_REGS_PER_PROC 18
27   /* the actual amount of shared configuration registers: */
28 #define _IBUF_CNTRL_CONFIG_REGS_NO_PROC  0
29
30   /* the actual amount of status registers per proc */
31 #define _IBUF_CNTRL_STATUS_REGS_PER_PROC (_IBUF_CNTRL_CONFIG_REGS_PER_PROC + 10)
32   /* the actual amount shared status registers */
33 #define _IBUF_CNTRL_STATUS_REGS_NO_PROC  (_IBUF_CNTRL_CONFIG_REGS_NO_PROC + 2)
34
35   /* time out bits, maximum time out value is 2^_IBUF_CNTRL_TIME_OUT_BITS - 1 */
36 #define _IBUF_CNTRL_TIME_OUT_BITS         5
37
38 /* command token definition */
39 #define _IBUF_CNTRL_CMD_TOKEN_LSB          0
40 #define _IBUF_CNTRL_CMD_TOKEN_MSB          1
41
42 /* Str2MMIO defines */
43 #define _IBUF_CNTRL_STREAM2MMIO_CMD_TOKEN_MSB        _STREAM2MMIO_CMD_TOKEN_CMD_MSB
44 #define _IBUF_CNTRL_STREAM2MMIO_CMD_TOKEN_LSB        _STREAM2MMIO_CMD_TOKEN_CMD_LSB
45 #define _IBUF_CNTRL_STREAM2MMIO_NUM_ITEMS_BITS       _STREAM2MMIO_PACK_NUM_ITEMS_BITS
46 #define _IBUF_CNTRL_STREAM2MMIO_ACK_EOF_BIT          _STREAM2MMIO_PACK_ACK_EOF_BIT
47 #define _IBUF_CNTRL_STREAM2MMIO_ACK_TOKEN_VALID_BIT  _STREAM2MMIO_ACK_TOKEN_VALID_BIT
48
49 /* acknowledge token definition */
50 #define _IBUF_CNTRL_ACK_TOKEN_STORES_IDX    0
51 #define _IBUF_CNTRL_ACK_TOKEN_STORES_BITS   15
52 #define _IBUF_CNTRL_ACK_TOKEN_ITEMS_IDX     (_IBUF_CNTRL_ACK_TOKEN_STORES_BITS + _IBUF_CNTRL_ACK_TOKEN_STORES_IDX)
53 #define _IBUF_CNTRL_ACK_TOKEN_ITEMS_BITS    _STREAM2MMIO_PACK_NUM_ITEMS_BITS
54 #define _IBUF_CNTRL_ACK_TOKEN_LSB          _IBUF_CNTRL_ACK_TOKEN_STORES_IDX
55 #define _IBUF_CNTRL_ACK_TOKEN_MSB          (_IBUF_CNTRL_ACK_TOKEN_ITEMS_BITS + _IBUF_CNTRL_ACK_TOKEN_ITEMS_IDX - 1)
56           /* bit 31 indicates a valid ack: */
57 #define _IBUF_CNTRL_ACK_TOKEN_VALID_BIT    (_IBUF_CNTRL_ACK_TOKEN_ITEMS_BITS + _IBUF_CNTRL_ACK_TOKEN_ITEMS_IDX)
58
59
60 /*shared registers:*/
61 #define _IBUF_CNTRL_RECALC_WORDS_STATUS     0
62 #define _IBUF_CNTRL_ARBITERS_STATUS         1
63
64 #define _IBUF_CNTRL_SET_CRUN                2 /* NO PHYSICAL REGISTER!! Only used in HSS model */
65
66
67 /*register addresses for each proc: */
68 #define _IBUF_CNTRL_CMD                   0
69 #define _IBUF_CNTRL_ACK                   1
70
71         /* number of items (packets or words) per frame: */
72 #define _IBUF_CNTRL_NUM_ITEMS_PER_STORE   2
73
74         /* number of stores (packets or words) per store/buffer: */
75 #define _IBUF_CNTRL_NUM_STORES_PER_FRAME  3
76
77         /* the channel and command in the DMA */
78 #define _IBUF_CNTRL_DMA_CHANNEL           4
79 #define _IBUF_CNTRL_DMA_CMD               5
80
81         /* the start address and stride of the buffers */
82 #define _IBUF_CNTRL_BUFFER_START_ADDRESS  6
83 #define _IBUF_CNTRL_BUFFER_STRIDE         7
84 #define _IBUF_CNTRL_BUFFER_END_ADDRESS    8
85
86         /* destination start address, stride and end address; should be the same as in the DMA */
87 #define _IBUF_CNTRL_DEST_START_ADDRESS    9
88 #define _IBUF_CNTRL_DEST_STRIDE           10
89 #define _IBUF_CNTRL_DEST_END_ADDRESS      11
90
91         /* send a frame sync or not, default 1 */
92 #define _IBUF_CNTRL_SYNC_FRAME            12
93
94         /* str2mmio cmds */
95 #define _IBUF_CNTRL_STR2MMIO_SYNC_CMD     13
96 #define _IBUF_CNTRL_STR2MMIO_STORE_CMD    14
97
98         /* num elems p word*/
99 #define _IBUF_CNTRL_SHIFT_ITEMS           15
100 #define _IBUF_CNTRL_ELEMS_P_WORD_IBUF     16
101 #define _IBUF_CNTRL_ELEMS_P_WORD_DEST     17
102
103
104    /* STATUS */
105         /* current frame and stores in buffer */
106 #define _IBUF_CNTRL_CUR_STORES            18
107 #define _IBUF_CNTRL_CUR_ACKS              19
108
109         /* current buffer and destination address for DMA cmd's */
110 #define _IBUF_CNTRL_CUR_S2M_IBUF_ADDR     20
111 #define _IBUF_CNTRL_CUR_DMA_IBUF_ADDR     21
112 #define _IBUF_CNTRL_CUR_DMA_DEST_ADDR     22
113 #define _IBUF_CNTRL_CUR_ISP_DEST_ADDR     23
114
115 #define _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND  24
116
117 #define _IBUF_CNTRL_MAIN_CNTRL_STATE      25
118 #define _IBUF_CNTRL_DMA_SYNC_STATE        26
119 #define _IBUF_CNTRL_ISP_SYNC_STATE        27
120
121
122 /*Commands: */
123 #define _IBUF_CNTRL_CMD_STORE_FRAME_IDX     0
124 #define _IBUF_CNTRL_CMD_ONLINE_IDX          1
125
126   /* initialize, copy st_addr to cur_addr etc */
127 #define _IBUF_CNTRL_CMD_INITIALIZE          0
128
129   /* store an online frame (sync with ISP, use end cfg start, stride and end address: */
130 #define _IBUF_CNTRL_CMD_STORE_ONLINE_FRAME  ((1<<_IBUF_CNTRL_CMD_STORE_FRAME_IDX) | (1<<_IBUF_CNTRL_CMD_ONLINE_IDX))
131
132   /* store an offline frame (don't sync with ISP, requires start address as 2nd token, no end address: */
133 #define _IBUF_CNTRL_CMD_STORE_OFFLINE_FRAME  (1<<_IBUF_CNTRL_CMD_STORE_FRAME_IDX)
134
135   /* false command token, should be different then commands. Use online bit, not store frame: */
136 #define _IBUF_CNTRL_FALSE_ACK               2
137
138 #endif