1 /******************************************************************************
3 ** FILE NAME : ifxmips_atm_core.h
9 ** DESCRIPTION : ATM driver header file (core functions)
10 ** COPYRIGHT : Copyright (c) 2006
11 ** Infineon Technologies AG
12 ** Am Campeon 1-12, 85579 Neubiberg, Germany
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation; either version 2 of the License, or
17 ** (at your option) any later version.
20 ** $Date $Author $Comment
21 ** 17 JUN 2009 Xu Liang Init Version
22 *******************************************************************************/
24 #ifndef IFXMIPS_ATM_CORE_H
25 #define IFXMIPS_ATM_CORE_H
28 #include "ifxmips_compat.h"
30 #include "ifxmips_atm_ppe_common.h"
31 #include "ifxmips_atm_fw_regs_common.h"
36 * ####################################
38 * ####################################
45 #define ENABLE_DEBUG 1
47 #define ENABLE_ASSERT 1
51 #define DEBUG_DUMP_SKB 1
55 #define DISABLE_QOS_WORKAROUND 0
57 #define ENABLE_DBG_PROC 1
59 #define ENABLE_FW_PROC 1
61 #ifdef CONFIG_IFX_ATM_TASKLET
62 #define ENABLE_TASKLET 1
65 #ifdef CONFIG_IFX_ATM_RETX
66 #define ENABLE_ATM_RETX 1
69 #if defined(CONFIG_DSL_MEI_CPE_DRV) && !defined(CONFIG_IFXMIPS_DSL_CPE_MEI)
70 #define CONFIG_IFXMIPS_DSL_CPE_MEI 1
74 * Debug/Assert/Error Message
77 #define DBG_ENABLE_MASK_ERR (1 << 0)
78 #define DBG_ENABLE_MASK_DEBUG_PRINT (1 << 1)
79 #define DBG_ENABLE_MASK_ASSERT (1 << 2)
80 #define DBG_ENABLE_MASK_DUMP_SKB_RX (1 << 8)
81 #define DBG_ENABLE_MASK_DUMP_SKB_TX (1 << 9)
82 #define DBG_ENABLE_MASK_DUMP_QOS (1 << 10)
83 #define DBG_ENABLE_MASK_DUMP_INIT (1 << 11)
84 #define DBG_ENABLE_MASK_MAC_SWAP (1 << 12)
85 #define DBG_ENABLE_MASK_ALL (DBG_ENABLE_MASK_ERR | DBG_ENABLE_MASK_DEBUG_PRINT | DBG_ENABLE_MASK_ASSERT | DBG_ENABLE_MASK_DUMP_SKB_RX | DBG_ENABLE_MASK_DUMP_SKB_TX | DBG_ENABLE_MASK_DUMP_QOS | DBG_ENABLE_MASK_DUMP_INIT | DBG_ENABLE_MASK_MAC_SWAP)
87 #define err(format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ERR) ) printk(KERN_ERR __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 )
89 #if defined(ENABLE_DEBUG) && ENABLE_DEBUG
91 #define dbg(format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_DEBUG_PRINT) ) printk(KERN_WARNING __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 )
94 #define dbg(format, arg...)
98 #if defined(ENABLE_ASSERT) && ENABLE_ASSERT
99 #define ASSERT(cond, format, arg...) do { if ( (ifx_atm_dbg_enable & DBG_ENABLE_MASK_ASSERT) && !(cond) ) printk(KERN_ERR __FILE__ ":%d:%s: " format "\n", __LINE__, __FUNCTION__, ##arg); } while ( 0 )
101 #define ASSERT(cond, format, arg...)
108 #define DEFAULT_TX_LINK_RATE 3200 // in cells
111 * ATM Port, QSB Queue, DMA RX/TX Channel Parameters
113 #define ATM_PORT_NUMBER 2
114 #define MAX_QUEUE_NUMBER 16
115 #define OAM_RX_QUEUE 15
116 #define QSB_RESERVE_TX_QUEUE 0
117 #define FIRST_QSB_QID 1
118 #define MAX_PVC_NUMBER (MAX_QUEUE_NUMBER - FIRST_QSB_QID)
119 #define MAX_RX_DMA_CHANNEL_NUMBER 8
120 #define MAX_TX_DMA_CHANNEL_NUMBER 16
121 #define DATA_BUFFER_ALIGNMENT EMA_ALIGNMENT
122 #define DESC_ALIGNMENT 8
123 #define DEFAULT_RX_HUNT_BITTH 4
126 * RX DMA Channel Allocation
128 #define RX_DMA_CH_OAM 0
129 #define RX_DMA_CH_AAL 1
130 #define RX_DMA_CH_TOTAL 2
131 #define RX_DMA_CH_OAM_DESC_LEN 32
132 #define RX_DMA_CH_OAM_BUF_SIZE (CELL_SIZE & ~15)
133 #define RX_DMA_CH_AAL_BUF_SIZE (2048 - 48)
138 #define OAM_HTU_ENTRY_NUMBER 3
139 #define OAM_F4_SEG_HTU_ENTRY 0
140 #define OAM_F4_TOT_HTU_ENTRY 1
141 #define OAM_F5_HTU_ENTRY 2
142 #define OAM_F4_CELL_ID 0
143 #define OAM_F5_CELL_ID 15
144 #if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX
145 #undef OAM_HTU_ENTRY_NUMBER
146 #define OAM_HTU_ENTRY_NUMBER 4
147 #define OAM_ARQ_HTU_ENTRY 3
151 * RX Frame Definitions
153 #define MAX_RX_PACKET_ALIGN_BYTES 3
154 #define MAX_RX_PACKET_PADDING_BYTES 3
155 #define RX_INBAND_TRAILER_LENGTH 8
156 #define MAX_RX_FRAME_EXTRA_BYTES (RX_INBAND_TRAILER_LENGTH + MAX_RX_PACKET_ALIGN_BYTES + MAX_RX_PACKET_PADDING_BYTES)
159 * TX Frame Definitions
161 #define MAX_TX_HEADER_ALIGN_BYTES 12
162 #define MAX_TX_PACKET_ALIGN_BYTES 3
163 #define MAX_TX_PACKET_PADDING_BYTES 3
164 #define TX_INBAND_HEADER_LENGTH 8
165 #define MAX_TX_FRAME_EXTRA_BYTES (TX_INBAND_HEADER_LENGTH + MAX_TX_HEADER_ALIGN_BYTES + MAX_TX_PACKET_ALIGN_BYTES + MAX_TX_PACKET_PADDING_BYTES)
170 #define CELL_SIZE ATM_AAL0_SDU
175 #if defined(ENABLE_ATM_RETX) && ENABLE_ATM_RETX
176 #define RETX_PLAYOUT_BUFFER_ORDER 6
177 #define RETX_PLAYOUT_BUFFER_SIZE (PAGE_SIZE * (1 << RETX_PLAYOUT_BUFFER_ORDER))
178 #define RETX_PLAYOUT_FW_BUFF_SIZE (RETX_PLAYOUT_BUFFER_SIZE / (32 * 56 /* cell size */))
179 #define RETX_POLLING_INTERVAL (HZ / 100 > 0 ? HZ / 100 : 1)
185 * ####################################
187 * ####################################
196 unsigned int tx_max_cell_rate
;
197 unsigned int tx_current_cell_rate
;
205 volatile struct tx_descriptor
207 unsigned int tx_desc_pos
;
208 struct sk_buff
**tx_skb
;
210 unsigned int aal5_vcc_crc_err
; /* number of packets with CRC error */
211 unsigned int aal5_vcc_oversize_sdu
; /* number of packets with oversize error */
216 struct atm_priv_data
{
217 unsigned long conn_table
;
218 struct connection conn
[MAX_PVC_NUMBER
];
220 volatile struct rx_descriptor
222 unsigned int aal_desc_pos
;
224 volatile struct rx_descriptor
226 unsigned char *oam_buf
;
227 unsigned int oam_desc_pos
;
229 struct port port
[ATM_PORT_NUMBER
];
231 unsigned int wrx_pdu
; /* successfully received AAL5 packet */
232 unsigned int wrx_drop_pdu
; /* AAL5 packet dropped by driver on RX */
233 unsigned int wtx_pdu
; /* successfully tranmitted AAL5 packet */
234 unsigned int wtx_err_pdu
; /* error AAL5 packet */
235 unsigned int wtx_drop_pdu
; /* AAL5 packet dropped by driver on TX */
237 ppe_u64_t wrx_total_byte
;
238 ppe_u64_t wtx_total_byte
;
239 unsigned int prev_wrx_total_byte
;
240 unsigned int prev_wtx_total_byte
;
252 * ####################################
254 * ####################################
257 extern unsigned int ifx_atm_dbg_enable
;
259 extern void ifx_atm_get_fw_ver(unsigned int *major
, unsigned int *minor
);
261 extern void ifx_atm_init_chip(void);
262 extern void ifx_atm_uninit_chip(void);
264 extern int ifx_pp32_start(int pp32
);
265 extern void ifx_pp32_stop(int pp32
);
267 extern void ifx_reset_ppe(void);
271 #endif // IFXMIPS_ATM_CORE_H
This page took 0.056803 seconds and 5 git commands to generate.