/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to dma/nwl_defines.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-27 00:28:57 UTC
  • Revision ID: csa@suren.me-20150427002857-82fk6r3e8rfgy4wr
First stand-alone ipecamera implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/** @name Buffer Descriptor offsets
2
 
 *  USR fields are defined by higher level IP. For example, checksum offload
3
 
 *  setup for EMAC type devices. The 1st 8 words are utilized by hardware. Any
4
 
 *  words after the 8th are for software use only.
5
 
 *  @{
6
 
 */
7
 
#define DMA_BD_BUFL_STATUS_OFFSET   0x00 /**< Buffer length + status */
8
 
#define DMA_BD_USRL_OFFSET          0x04 /**< User logic specific - LSBytes */
9
 
#define DMA_BD_USRH_OFFSET          0x08 /**< User logic specific - MSBytes */
10
 
#define DMA_BD_CARDA_OFFSET         0x0C /**< Card address */
11
 
#define DMA_BD_BUFL_CTRL_OFFSET     0x10 /**< Buffer length + control */
12
 
#define DMA_BD_BUFAL_OFFSET         0x14 /**< Buffer address LSBytes */
13
 
#define DMA_BD_BUFAH_OFFSET         0x18 /**< Buffer address MSBytes */
14
 
#define DMA_BD_NDESC_OFFSET         0x1C /**< Next descriptor pointer */
15
 
 
16
 
/* Bit masks for some BD fields */
17
 
#define DMA_BD_BUFL_MASK            0x000FFFFF /**< Byte count */
18
 
#define DMA_BD_STATUS_MASK          0xFF000000 /**< Status Flags */
19
 
#define DMA_BD_CTRL_MASK            0xFF000000 /**< Control Flags */
20
 
 
21
 
/* Bit masks for BD control field */
22
 
#define DMA_BD_INT_ERROR_MASK       0x02000000 /**< Intr on error */
23
 
#define DMA_BD_INT_COMP_MASK        0x01000000 /**< Intr on BD completion */
24
 
 
25
 
/* Bit masks for BD status field */
26
 
#define DMA_BD_SOP_MASK             0x80000000 /**< Start of packet */
27
 
#define DMA_BD_EOP_MASK             0x40000000 /**< End of packet */
28
 
#define DMA_BD_ERROR_MASK           0x10000000 /**< BD had error */
29
 
#define DMA_BD_USER_HIGH_ZERO_MASK  0x08000000 /**< User High Status zero */
30
 
#define DMA_BD_USER_LOW_ZERO_MASK   0x04000000 /**< User Low Status zero */
31
 
#define DMA_BD_SHORT_MASK           0x02000000 /**< BD not fully used */
32
 
#define DMA_BD_COMP_MASK            0x01000000 /**< BD completed */
33
 
 
34
 
 
35
 
 
36
 
#define DMA_BD_MINIMUM_ALIGNMENT    0x40  /**< Minimum byte alignment */
37
 
 
38
 
/* Common DMA registers */
39
 
#define REG_DMA_CTRL_STATUS     0x4000      /**< DMA Common Ctrl & Status */
40
 
 
41
 
/* These engine registers are applicable to both S2C and C2S channels. 
42
 
 * Register field mask and shift definitions are later in this file.
43
 
 */
44
 
 
45
 
#define REG_DMA_ENG_CAP         0x00000000  /**< DMA Engine Capabilities */
46
 
#define REG_DMA_ENG_CTRL_STATUS 0x00000004  /**< DMA Engine Control */
47
 
#define REG_DMA_ENG_NEXT_BD     0x00000008  /**< HW Next desc pointer */
48
 
#define REG_SW_NEXT_BD          0x0000000C  /**< SW Next desc pointer */
49
 
#define REG_DMA_ENG_LAST_BD     0x00000010  /**< HW Last completed pointer */
50
 
#define REG_DMA_ENG_ACTIVE_TIME 0x00000014  /**< DMA Engine Active Time */
51
 
#define REG_DMA_ENG_WAIT_TIME   0x00000018  /**< DMA Engine Wait Time */
52
 
#define REG_DMA_ENG_COMP_BYTES  0x0000001C  /**< DMA Engine Completed Bytes */
53
 
 
54
 
/* Register masks. The following constants define bit locations of various
55
 
 * control bits in the registers. For further information on the meaning of 
56
 
 * the various bit masks, refer to the hardware spec.
57
 
 *
58
 
 * Masks have been written assuming HW bits 0-31 correspond to SW bits 0-31 
59
 
 */
60
 
 
61
 
/** @name Bitmasks of REG_DMA_CTRL_STATUS register.
62
 
 * @{
63
 
 */
64
 
#define DMA_INT_ENABLE              0x00000001  /**< Enable global interrupts */
65
 
#define DMA_INT_DISABLE             0x00000000  /**< Disable interrupts */
66
 
#define DMA_INT_ACTIVE_MASK         0x00000002  /**< Interrupt active? */
67
 
#define DMA_INT_PENDING_MASK        0x00000004  /**< Engine interrupt pending */
68
 
#define DMA_INT_MSI_MODE            0x00000008  /**< MSI or Legacy mode? */
69
 
#define DMA_USER_INT_ENABLE         0x00000010  /**< Enable user interrupts */
70
 
#define DMA_USER_INT_ACTIVE_MASK    0x00000020  /**< Int - user interrupt */
71
 
#define DMA_USER_INT_ACK            0x00000020  /**< Acknowledge */
72
 
#define DMA_MPS_USED                0x00000700  /**< MPS Used */
73
 
#define DMA_MRRS_USED               0x00007000  /**< MRRS Used */
74
 
#define DMA_S2C_ENG_INT_VAL         0x00FF0000  /**< IRQ value of 1st 8 S2Cs */
75
 
#define DMA_C2S_ENG_INT_VAL         0xFF000000  /**< IRQ value of 1st 8 C2Ss */
76
 
 
77
 
/** @name Bitmasks of REG_DMA_ENG_CAP register.
78
 
 * @{
79
 
 */
80
 
/* DMA engine characteristics */
81
 
#define DMA_ENG_PRESENT_MASK    0x00000001  /**< DMA engine present? */
82
 
#define DMA_ENG_DIRECTION_MASK  0x00000002  /**< DMA engine direction */
83
 
#define DMA_ENG_C2S             0x00000002  /**< DMA engine - C2S */
84
 
#define DMA_ENG_S2C             0x00000000  /**< DMA engine - S2C */
85
 
#define DMA_ENG_TYPE_MASK       0x00000030  /**< DMA engine type */
86
 
#define DMA_ENG_BLOCK           0x00000000  /**< DMA engine - Block type */
87
 
#define DMA_ENG_PACKET          0x00000010  /**< DMA engine - Packet type */
88
 
#define DMA_ENG_NUMBER          0x0000FF00  /**< DMA engine number */
89
 
#define DMA_ENG_BD_MAX_BC       0x3F000000  /**< DMA engine max buffer size */
90
 
 
91
 
 
92
 
/* Shift constants for selected masks */
93
 
#define DMA_ENG_NUMBER_SHIFT        8
94
 
#define DMA_ENG_BD_MAX_BC_SHIFT     24
95
 
 
96
 
/** @name Bitmasks of REG_DMA_ENG_CTRL_STATUS register.
97
 
 * @{
98
 
 */
99
 
/* Interrupt activity and acknowledgement bits */
100
 
#define DMA_ENG_INT_ENABLE          0x00000001  /**< Enable interrupts */
101
 
#define DMA_ENG_INT_DISABLE         0x00000000  /**< Disable interrupts */
102
 
#define DMA_ENG_INT_ACTIVE_MASK     0x00000002  /**< Interrupt active? */
103
 
#define DMA_ENG_INT_ACK             0x00000002  /**< Interrupt ack */
104
 
#define DMA_ENG_INT_BDCOMP          0x00000004  /**< Int - BD completion */
105
 
#define DMA_ENG_INT_BDCOMP_ACK      0x00000004  /**< Acknowledge */
106
 
#define DMA_ENG_INT_ALERR           0x00000008  /**< Int - BD align error */
107
 
#define DMA_ENG_INT_ALERR_ACK       0x00000008  /**< Acknowledge */
108
 
#define DMA_ENG_INT_FETERR          0x00000010  /**< Int - BD fetch error */
109
 
#define DMA_ENG_INT_FETERR_ACK      0x00000010  /**< Acknowledge */
110
 
#define DMA_ENG_INT_ABORTERR        0x00000020  /**< Int - DMA abort error */
111
 
#define DMA_ENG_INT_ABORTERR_ACK    0x00000020  /**< Acknowledge */
112
 
#define DMA_ENG_INT_CHAINEND        0x00000080  /**< Int - BD chain ended */
113
 
#define DMA_ENG_INT_CHAINEND_ACK    0x00000080  /**< Acknowledge */
114
 
 
115
 
/* DMA engine control */
116
 
#define DMA_ENG_ENABLE_MASK         0x00000100  /**< DMA enabled? */
117
 
#define DMA_ENG_ENABLE              0x00000100  /**< Enable DMA */
118
 
#define DMA_ENG_DISABLE             0x00000000  /**< Disable DMA */
119
 
#define DMA_ENG_STATE_MASK          0x00000C00  /**< Current DMA state? */
120
 
#define DMA_ENG_RUNNING             0x00000400  /**< DMA running */
121
 
#define DMA_ENG_IDLE                0x00000000  /**< DMA idle */
122
 
#define DMA_ENG_WAITING             0x00000800  /**< DMA waiting */
123
 
#define DMA_ENG_STATE_WAITED        0x00001000  /**< DMA waited earlier */
124
 
#define DMA_ENG_WAITED_ACK          0x00001000  /**< Acknowledge */
125
 
#define DMA_ENG_USER_RESET          0x00004000  /**< Reset only user logic */
126
 
#define DMA_ENG_RESET               0x00008000  /**< Reset DMA engine + user */
127
 
 
128
 
#define DMA_ENG_ALLINT_MASK         0x000000BE  /**< To get only int events */
129
 
 
130
 
#define DMA_ENGINE_PER_SIZE     0x100   /**< Separation between engine regs */
131
 
#define DMA_OFFSET              0       /**< Starting register offset */
132
 
                                        /**< Size of DMA engine reg space */
133
 
#define DMA_SIZE                (MAX_DMA_ENGINES * DMA_ENGINE_PER_SIZE)
134
 
 
135
 
 
136
 
#define TX_CONFIG_ADDRESS   0x9108  /* Reg for controlling TX data */
137
 
#define RX_CONFIG_ADDRESS   0x9100  /* Reg for controlling RX pkt generator */
138
 
#define PKT_SIZE_ADDRESS    0x9104  /* Reg for programming packet size */
139
 
#define STATUS_ADDRESS      0x910C  /* Reg for checking TX pkt checker status */
140
 
 
141
 
/* Test start / stop conditions */
142
 
#define PKTCHKR             0x00000001  /* Enable TX packet checker */
143
 
#define PKTGENR             0x00000001  /* Enable RX packet generator */
144
 
#define CHKR_MISMATCH       0x00000001  /* TX checker reported data mismatch */
145
 
#define LOOPBACK            0x00000002  /* Enable TX data loopback onto RX */