GNU Linux-libre 4.14.332-gnu1
[releases.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / css_2401_csi2p_system / hrt / stream2mmio_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 _STREAM2MMMIO_DEFS_H
16 #define _STREAM2MMMIO_DEFS_H
17
18 #include <mipi_backend_defs.h>
19
20 #define _STREAM2MMIO_REG_ALIGN                  4
21
22 #define _STREAM2MMIO_COMMAND_REG_ID             0
23 #define _STREAM2MMIO_ACKNOWLEDGE_REG_ID         1
24 #define _STREAM2MMIO_PIX_WIDTH_ID_REG_ID        2
25 #define _STREAM2MMIO_START_ADDR_REG_ID          3      /* master port address,NOT Byte */
26 #define _STREAM2MMIO_END_ADDR_REG_ID            4      /* master port address,NOT Byte */
27 #define _STREAM2MMIO_STRIDE_REG_ID              5      /* stride in master port words, increment is per packet for long sids, stride is not used for short sid's*/
28 #define _STREAM2MMIO_NUM_ITEMS_REG_ID           6      /* number of packets for store packets cmd, number of words for store_words cmd */ 
29 #define _STREAM2MMIO_BLOCK_WHEN_NO_CMD_REG_ID   7      /* if this register is 1, input will be stalled if there is no pending command for this sid */
30 #define _STREAM2MMIO_REGS_PER_SID               8
31
32 #define _STREAM2MMIO_SID_REG_OFFSET             8
33 #define _STREAM2MMIO_MAX_NOF_SIDS              64      /* value used in hss model */
34
35 /* command token definition     */
36 #define _STREAM2MMIO_CMD_TOKEN_CMD_LSB          0      /* bits 1-0 is for the command field */
37 #define _STREAM2MMIO_CMD_TOKEN_CMD_MSB          1
38
39 #define _STREAM2MMIO_CMD_TOKEN_WIDTH           (_STREAM2MMIO_CMD_TOKEN_CMD_MSB+1-_STREAM2MMIO_CMD_TOKEN_CMD_LSB)
40
41 #define _STREAM2MMIO_CMD_TOKEN_STORE_WORDS              0      /* command for storing a number of output words indicated by reg _STREAM2MMIO_NUM_ITEMS */
42 #define _STREAM2MMIO_CMD_TOKEN_STORE_PACKETS            1      /* command for storing a number of packets indicated by reg _STREAM2MMIO_NUM_ITEMS      */
43 #define _STREAM2MMIO_CMD_TOKEN_SYNC_FRAME               2      /* command for waiting for a frame start                                                */
44
45 /* acknowledges from packer module */
46 /* fields: eof   - indicates whether last (short) packet received was an eof packet */
47 /*         eop   - indicates whether command has ended due to packet end or due to no of words requested has been received */
48 /*         count - indicates number of words stored */
49 #define _STREAM2MMIO_PACK_NUM_ITEMS_BITS        16
50 #define _STREAM2MMIO_PACK_ACK_EOP_BIT           _STREAM2MMIO_PACK_NUM_ITEMS_BITS
51 #define _STREAM2MMIO_PACK_ACK_EOF_BIT           (_STREAM2MMIO_PACK_ACK_EOP_BIT+1)
52
53 /* acknowledge token definition */
54 #define _STREAM2MMIO_ACK_TOKEN_NUM_ITEMS_LSB    0      /* bits 3-0 is for the command field */
55 #define _STREAM2MMIO_ACK_TOKEN_NUM_ITEMS_MSB   (_STREAM2MMIO_PACK_NUM_ITEMS_BITS-1)
56 #define _STREAM2MMIO_ACK_TOKEN_EOP_BIT         _STREAM2MMIO_PACK_ACK_EOP_BIT
57 #define _STREAM2MMIO_ACK_TOKEN_EOF_BIT         _STREAM2MMIO_PACK_ACK_EOF_BIT
58 #define _STREAM2MMIO_ACK_TOKEN_VALID_BIT       (_STREAM2MMIO_ACK_TOKEN_EOF_BIT+1)      /* this bit indicates a valid ack    */
59                                                                                        /* if there is no valid ack, a read  */
60                                                                                        /* on the ack register returns 0     */
61 #define _STREAM2MMIO_ACK_TOKEN_WIDTH           (_STREAM2MMIO_ACK_TOKEN_VALID_BIT+1)
62
63 /* commands for packer module */
64 #define _STREAM2MMIO_PACK_CMD_STORE_WORDS        0
65 #define _STREAM2MMIO_PACK_CMD_STORE_LONG_PACKET  1
66 #define _STREAM2MMIO_PACK_CMD_STORE_SHORT_PACKET 2
67
68
69
70
71 #endif /* _STREAM2MMIO_DEFS_H */