Merge premilinary Broadcom 63xx support (Livebox, Siemens SE515...)
[openwrt.git] / target / linux / brcm63xx-2.6 / patches / 001-bcm963xx.patch
1 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/Kconfig linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/Kconfig
2 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/Kconfig        1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/Kconfig       2006-06-26 09:07:08.000000000 +0200
4 @@ -0,0 +1,169 @@
5 +# Kernel and Driver configuration for Broadcom Commengine ADSL board
6 +choice
7 +       prompt "Broadcom Commengine ADSL board"
8 +       depends on MIPS_BRCM
9 +       default BCM96345
10 +       help
11 +         Select different Broadcom ADSL board
12 +
13 +config BCM96338
14 +       bool "96338 ADSL board"
15 +       select DMA_NONCOHERENT
16 +
17 +config BCM96345
18 +       bool "96345 ADSL board"
19 +       select DMA_NONCOHERENT
20 +
21 +config BCM96348
22 +       bool "96348 ADSL board"
23 +       select DMA_NONCOHERENT
24 +
25 +endchoice
26 +
27 +config BCM_BOARD
28 +       bool "Support for Broadcom Board"
29 +       depends on BCM96338 || BCM96345 || BCM96348
30 +
31 +config BCM_SERIAL
32 +       bool "Support for Serial Port"
33 +       depends on BCM96338 || BCM96345 || BCM96348
34 +
35 +config BCM_ENET
36 +       tristate "Support for Ethernet"
37 +       depends on BCM96338 || BCM96345 || BCM96348
38 +
39 +config BCM_USB
40 +       tristate "Support for USB"
41 +       depends on BCM96338 || BCM96345 || BCM96348
42 +
43 +config BCM_WLAN
44 +       tristate "Support for Wireless"
45 +       depends on BCM96338 || BCM96345 || BCM96348
46 +
47 +config BCM_PCI
48 +       bool "Support for PCI"
49 +       depends on BCM96338 || BCM96345 || BCM96348
50 +       select PCI
51 +
52 +config BCM_ATMAPI
53 +       tristate "Support for ATM"
54 +       depends on BCM96338 || BCM96345 || BCM96348
55 +
56 +config BCM_ATMTEST
57 +       tristate "Support for ATM Diagnostic"
58 +       depends on BCM96338 || BCM96345 || BCM96348
59 +
60 +config BCM_ADSL
61 +       tristate "Support for ADSL"
62 +       depends on BCM96338 || BCM96345 || BCM96348
63 +
64 +config BCM_ENDPOINT
65 +       tristate "Support for VOICE"
66 +       depends on BCM96338 || BCM96345 || BCM96348
67 +
68 +config BCM_PROCFS
69 +       tristate "Support for PROCFS"
70 +       depends on BCM96338 || BCM96345 || BCM96348
71 +
72 +config BCM_VDSL
73 +       tristate "Support for VDSL"
74 +       depends on BCM96338 || BCM96345 || BCM96348
75 +
76 +config BCM_SECURITY
77 +       tristate "Support for SECURITY"
78 +       depends on BCM96338 || BCM96345 || BCM96348
79 +
80 +config BCM_HPNA
81 +       tristate "Support for HPNA"
82 +       depends on BCM96338 || BCM96345 || BCM96348
83 +
84 +config BCM_BOARD_IMPL
85 +       int "Implementation index for ADSL Board"
86 +       depends on BCM96338 || BCM96345 || BCM96348
87 +
88 +config BCM_SERIAL_IMPL
89 +       int "Implementation index for Serial"
90 +       depends on BCM96338 || BCM96345 || BCM96348
91 +
92 +config BCM_ENET_IMPL
93 +       int "Implementation index for Ethernet"
94 +       depends on BCM96338 || BCM96345 || BCM96348
95 +
96 +config BCM_USB_IMPL
97 +       int "Implementation index for USB"
98 +       depends on BCM96338 || BCM96345 || BCM96348
99 +
100 +config BCM_WLAN_IMPL
101 +       int "Implementation index for WIRELESS"
102 +       depends on BCM96338 || BCM96345 || BCM96348
103 +
104 +config BCM_ATMAPI_IMPL
105 +       int "Implementation index for ATM"
106 +       depends on BCM96338 || BCM96345 || BCM96348
107 +
108 +config BCM_ATMTEST_IMPL
109 +       int "Implementation index for ATM Diagnostic"
110 +       depends on BCM96338 || BCM96345 || BCM96348
111 +
112 +config BCM_BLAA_IMPL
113 +       int "Implementation index for BLAA"
114 +       depends on BCM96338 || BCM96345 || BCM96348
115 +
116 +config BCM_ADSL_IMPL
117 +       int "Implementation index for ADSL"
118 +       depends on BCM96338 || BCM96345 || BCM96348
119 +
120 +config BCM_ENDPOINT_IMPL
121 +       int "Implementation index for VOICE"
122 +       depends on BCM96338 || BCM96345 || BCM96348
123 +
124 +config BCM_PROCFS_IMPL
125 +       int "Implementation index for PROCFS"
126 +       depends on BCM96338 || BCM96345 || BCM96348
127 +
128 +config BCM_VDSL_IMPL
129 +       int "Implementation index for VDSL"
130 +       depends on BCM96338 || BCM96345 || BCM96348
131 +
132 +config BCM_SECURITY_IMPL
133 +       int "Implementation index for SECURITY"
134 +       depends on BCM96338 || BCM96345 || BCM96348
135 +
136 +config BCM_HPNA_IMPL
137 +       int "Implementation index for HPNA"
138 +       depends on BCM96338 || BCM96345 || BCM96348
139 +
140 +choice
141 +       prompt "Root File System"
142 +       depends on MIPS_BRCM
143 +       default ROOTFS_SQUASHFS
144 +       help
145 +         Select root file system on the board flash. 
146 +
147 +config ROOTFS_SQUASHFS
148 +        bool "SQUASHFS"
149 +config ROOTFS_CRAMFS
150 +        bool "CRAMFS"
151 +config ROOTFS_JFFS2
152 +        bool "JFFS2"
153 +config ROOTFS_NFS
154 +        bool "NFS"
155 +
156 +endchoice
157 +
158 +config ROOT_FLASHFS
159 +       string "flash partition"
160 +       depends on ROOTFS_SQUASHFS || ROOTFS_CRAMFS || ROOTFS_JFFS2
161 +       default "root=31:0 ro noinitrd" if ROOTFS_SQUASHFS = y || ROOTFS_CRAMFS = y
162 +       default "root=31:2 ro noinitrd" if ROOTFS_JFFS2 = y
163 +       help
164 +         This is the root file system partition on flash memory
165 +
166 +config ROOT_NFS_DIR
167 +       string "NFS server path"
168 +       depends on ROOTFS_NFS
169 +       default "/opt/bcm96338/targets/96338R/fs" if BCM96338 = y
170 +       default "/opt/bcm96345/targets/96345R/fs" if BCM96345 = y
171 +       default "/opt/bcm96348/targets/96348R/fs" if BCM96348 = y  
172 +       help
173 +         This is the path of NFS server (host system)
174 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/Makefile linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/Makefile
175 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/Makefile       1970-01-01 01:00:00.000000000 +0100
176 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/Makefile      2006-06-26 09:07:08.000000000 +0200
177 @@ -0,0 +1,23 @@
178 +#
179 +# Makefile for generic Broadcom MIPS boards
180 +#
181 +# Copyright (C) 2004 Broadcom Corporation
182 +#
183 +obj-y           := irq.o prom.o setup.o time.o ser_init.o
184 +
185 +SRCBASE         := $(TOPDIR)
186 +EXTRA_CFLAGS    += -I$(INC_BRCMBOARDPARMS_PATH)/$(BRCM_BOARD) -I$(SRCBASE)/include -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
187 +#EXTRA_CFLAGS    += -I$(INC_ADSLDRV_PATH) -DDBG
188 +EXTRA_CFLAGS    += -I$(INC_ADSLDRV_PATH) 
189 +
190 +
191 +ifeq "$(ADSL)" "ANNEX_B"
192 +EXTRA_CFLAGS += -DADSL_ANNEXB
193 +endif
194 +ifeq "$(ADSL)" "SADSL"
195 +EXTRA_CFLAGS += -DADSL_SADSL
196 +endif
197 +ifeq "$(ADSL)" "ANNEX_C"
198 +EXTRA_CFLAGS += -DADSL_ANNEXC
199 +endif
200 +
201 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/irq.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/irq.c
202 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/irq.c  1970-01-01 01:00:00.000000000 +0100
203 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/irq.c 2006-06-26 09:07:08.000000000 +0200
204 @@ -0,0 +1,276 @@
205 +/*
206 +<:copyright-gpl 
207 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
208
209 + This program is free software; you can distribute it and/or modify it 
210 + under the terms of the GNU General Public License (Version 2) as 
211 + published by the Free Software Foundation. 
212
213 + This program is distributed in the hope it will be useful, but WITHOUT 
214 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
215 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
216 + for more details. 
217
218 + You should have received a copy of the GNU General Public License along 
219 + with this program; if not, write to the Free Software Foundation, Inc., 
220 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
221 +:>
222 +*/
223 +/*
224 + * Interrupt control functions for Broadcom 963xx MIPS boards
225 + */
226 +
227 +#include <asm/atomic.h>
228 +
229 +#include <linux/delay.h>
230 +#include <linux/init.h>
231 +#include <linux/ioport.h>
232 +#include <linux/irq.h>
233 +#include <linux/interrupt.h>
234 +#include <linux/kernel.h>
235 +#include <linux/slab.h>
236 +#include <linux/module.h>
237 +
238 +#include <asm/irq.h>
239 +#include <asm/mipsregs.h>
240 +#include <asm/addrspace.h>
241 +#include <asm/signal.h>
242 +#include <bcm_map_part.h>
243 +#include <bcm_intr.h>
244 +
245 +extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs);
246 +
247 +static void irq_dispatch_int(struct pt_regs *regs)
248 +{
249 +    unsigned int pendingIrqs;
250 +    static unsigned int irqBit;
251 +    static unsigned int isrNumber = 31;
252 +
253 +    pendingIrqs = PERF->IrqStatus & PERF->IrqMask;
254 +    if (!pendingIrqs) {
255 +        return;
256 +    }
257 +
258 +    while (1) {
259 +       irqBit <<= 1;
260 +       isrNumber++;
261 +       if (isrNumber == 32) {
262 +               isrNumber = 0;
263 +               irqBit = 0x1;
264 +       }
265 +       if (pendingIrqs & irqBit) {
266 +               PERF->IrqMask &= ~irqBit; // mask
267 +               do_IRQ(isrNumber + INTERNAL_ISR_TABLE_OFFSET, regs);
268 +               break;
269 +       }
270 +    }
271 +}
272 +
273 +static void irq_dispatch_ext(uint32 irq, struct pt_regs *regs)
274 +{
275 +    if (!(PERF->ExtIrqCfg & (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT)))) {
276 +       printk("**** Ext IRQ mask. Should not dispatch ****\n");
277 +    }
278 +    /* disable and clear interrupt in the controller */
279 +    PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT));
280 +    PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
281 +    do_IRQ(irq, regs);
282 +}
283 +
284 +void brcm_irq_dispatch(struct pt_regs *regs)
285 +{
286 +    u32 cause;
287 +    while((cause = (read_c0_cause()& CAUSEF_IP))) {
288 +       if (cause & CAUSEF_IP7)
289 +               do_IRQ(MIPS_TIMER_INT, regs);
290 +       else if (cause & CAUSEF_IP2)
291 +               irq_dispatch_int(regs);
292 +       else if (cause & CAUSEF_IP3)
293 +               irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_0, regs);
294 +       else if (cause & CAUSEF_IP4)
295 +               irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_1, regs);
296 +       else if (cause & CAUSEF_IP5)
297 +               irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_2, regs);
298 +       else if (cause & CAUSEF_IP6)
299 +               irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_3, regs);
300 +       cli();
301 +    }
302 +}
303 +
304 +
305 +void enable_brcm_irq(unsigned int irq)
306 +{
307 +    unsigned long flags;
308 +
309 +    local_irq_save(flags);
310 +    if( irq >= INTERNAL_ISR_TABLE_OFFSET ) {
311 +       PERF->IrqMask |= (1 << (irq - INTERNAL_ISR_TABLE_OFFSET));
312 +    }
313 +    else if (irq >= INTERRUPT_ID_EXTERNAL_0 && irq <= INTERRUPT_ID_EXTERNAL_3) {
314 +    /* enable and clear interrupt in the controller */
315 +       PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT));
316 +       PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
317 +    }
318 +    local_irq_restore(flags);
319 +}
320 +
321 +void disable_brcm_irq(unsigned int irq)
322 +{
323 +    unsigned long flags;
324 +
325 +    local_irq_save(flags);
326 +    if( irq >= INTERNAL_ISR_TABLE_OFFSET ) {
327 +       PERF->IrqMask &= ~(1 << (irq - INTERNAL_ISR_TABLE_OFFSET));
328 +    }
329 +    else if (irq >= INTERRUPT_ID_EXTERNAL_0 && irq <= INTERRUPT_ID_EXTERNAL_3) {
330 +    /* disable interrupt in the controller */
331 +       PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
332 +    }
333 +    local_irq_restore(flags);
334 +}
335 +
336 +void ack_brcm_irq(unsigned int irq)
337 +{
338 +    /* Already done in brcm_irq_dispatch */
339 +}
340 +
341 +unsigned int startup_brcm_irq(unsigned int irq)
342 +{
343 +    enable_brcm_irq(irq);
344 +
345 +    return 0; /* never anything pending */
346 +}
347 +
348 +unsigned int startup_brcm_none(unsigned int irq)
349 +{
350 +    return 0;
351 +}
352 +
353 +void end_brcm_irq(unsigned int irq)
354 +{
355 +    if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
356 +        enable_brcm_irq(irq);
357 +}
358 +
359 +void end_brcm_none(unsigned int irq)
360 +{
361 +}
362 +
363 +#define ALLINTS_NOTIMER (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
364 +
365 +static void __init brcm_irq_setup(void)
366 +{
367 +       extern asmlinkage void brcmIRQ(void);
368 +
369 +       clear_c0_status(ST0_BEV);
370 +       set_except_vector(0, brcmIRQ);
371 +       change_c0_status(ST0_IM, ALLINTS_NOTIMER);
372 +
373 +#ifdef CONFIG_REMOTE_DEBUG
374 +       rs_kgdb_hook(0);
375 +#endif
376 +}
377 +
378 +static struct hw_interrupt_type brcm_irq_type = {
379 +    .typename  = "MIPS",
380 +    .startup   = startup_brcm_irq,
381 +    .shutdown  = disable_brcm_irq,
382 +    .enable    = enable_brcm_irq,
383 +    .disable   = disable_brcm_irq,
384 +    .ack       = ack_brcm_irq,
385 +    .end       = end_brcm_irq,
386 +    .set_affinity = NULL
387 +};
388 +
389 +static struct hw_interrupt_type brcm_irq_no_end_type = {
390 +    .typename  = "MIPS",
391 +    .startup   = startup_brcm_none,
392 +    .shutdown  = disable_brcm_irq,
393 +    .enable    = enable_brcm_irq,
394 +    .disable   = disable_brcm_irq,
395 +    .ack       = ack_brcm_irq,
396 +    .end       = end_brcm_none,
397 +    .set_affinity = NULL
398 +};
399 +
400 +void __init arch_init_irq(void)
401 +{
402 +    int i;
403 +
404 +    for (i = 0; i < NR_IRQS; i++) {
405 +        irq_desc[i].status = IRQ_DISABLED;
406 +        irq_desc[i].action = 0;
407 +        irq_desc[i].depth = 1;
408 +        irq_desc[i].handler = &brcm_irq_type;
409 +    }
410 +
411 +    brcm_irq_setup();
412 +}
413 +
414 +int request_external_irq(unsigned int irq, 
415 +       FN_HANDLER handler,
416 +        unsigned long irqflags, 
417 +        const char * devname,
418 +        void *dev_id)
419 +{
420 +    unsigned long flags;
421 +
422 +    local_irq_save(flags);
423 +
424 +    PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT));      // Clear
425 +    PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));      // Mask
426 +    PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_INSENS_SHFT));    // Edge insesnsitive
427 +    PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_LEVEL_SHFT));      // Level triggered
428 +    PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_SENSE_SHFT));     // Low level
429 +
430 +    local_irq_restore(flags);
431 +
432 +    return( request_irq(irq, handler, irqflags, devname, dev_id) );
433 +}
434 +
435 +/* VxWorks compatibility function(s). */
436 +
437 +unsigned int BcmHalMapInterrupt(FN_HANDLER pfunc, unsigned int param,
438 +    unsigned int interruptId)
439 +{
440 +    int nRet = -1;
441 +    char *devname;
442 +
443 +    devname = kmalloc(16, GFP_KERNEL);
444 +    if (devname)
445 +        sprintf( devname, "brcm_%d", interruptId );
446 +
447 +    /* Set the IRQ description to not automatically enable the interrupt at
448 +     * the end of an ISR.  The driver that handles the interrupt must
449 +     * explicitly call BcmHalInterruptEnable or enable_brcm_irq.  This behavior
450 +     * is consistent with interrupt handling on VxWorks.
451 +     */
452 +    irq_desc[interruptId].handler = &brcm_irq_no_end_type;
453 +
454 +    if( interruptId >= INTERNAL_ISR_TABLE_OFFSET )
455 +    {
456 +        nRet = request_irq( interruptId, pfunc, SA_SAMPLE_RANDOM | SA_INTERRUPT,
457 +            devname, (void *) param );
458 +    }
459 +    else if (interruptId >= INTERRUPT_ID_EXTERNAL_0 && interruptId <= INTERRUPT_ID_EXTERNAL_3)
460 +    {
461 +        nRet = request_external_irq( interruptId, pfunc, SA_SAMPLE_RANDOM | SA_INTERRUPT,
462 +            devname, (void *) param );
463 +    }
464 +
465 +    return( nRet );
466 +}
467 +
468 +
469 +/* Debug function. */
470 +
471 +void dump_intr_regs(void)
472 +{
473 +    printk("PERF->ExtIrqCfg [%08x]\n", *(&(PERF->ExtIrqCfg)));
474 +} 
475 +
476 +EXPORT_SYMBOL(enable_brcm_irq);
477 +EXPORT_SYMBOL(disable_brcm_irq);
478 +EXPORT_SYMBOL(request_external_irq);
479 +EXPORT_SYMBOL(BcmHalMapInterrupt);
480 +
481 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/prom.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/prom.c
482 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/prom.c 1970-01-01 01:00:00.000000000 +0100
483 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/prom.c        2006-06-26 09:07:08.000000000 +0200
484 @@ -0,0 +1,233 @@
485 +/*
486 +<:copyright-gpl 
487 + Copyright 2004 Broadcom Corp. All Rights Reserved. 
488
489 + This program is free software; you can distribute it and/or modify it 
490 + under the terms of the GNU General Public License (Version 2) as 
491 + published by the Free Software Foundation. 
492
493 + This program is distributed in the hope it will be useful, but WITHOUT 
494 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
495 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
496 + for more details. 
497
498 + You should have received a copy of the GNU General Public License along 
499 + with this program; if not, write to the Free Software Foundation, Inc., 
500 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
501 +:>
502 +*/
503 +/*
504 + * prom.c: PROM library initialization code.
505 + *
506 + */
507 +#include <linux/init.h>
508 +#include <linux/mm.h>
509 +#include <linux/sched.h>
510 +#include <linux/bootmem.h>
511 +#include <linux/blkdev.h>
512 +#include <asm/addrspace.h>
513 +#include <asm/bootinfo.h>
514 +#include <asm/cpu.h>
515 +#include <asm/time.h>
516 +
517 +#include <bcm_map_part.h>
518 +#include <board.h>
519 +#include "boardparms.h"
520 +#include "softdsl/AdslCoreDefs.h"
521 +
522 +
523 +extern int  do_syslog(int, char *, int);
524 +extern void serial_init(void);
525 +extern void __init InitNvramInfo( void );
526 +extern void kerSysFlashInit( void );
527 +extern unsigned long get_nvram_start_addr(void);
528 +void __init create_root_nfs_cmdline( char *cmdline );
529 +
530 +#if defined(CONFIG_BCM96338)
531 +#define CPU_CLOCK                   240000000
532 +#define MACH_BCM                    MACH_BCM96338
533 +#endif
534 +#if defined(CONFIG_BCM96345)
535 +#define CPU_CLOCK                   140000000
536 +#define MACH_BCM                    MACH_BCM96345
537 +#endif
538 +#if defined(CONFIG_BCM96348)
539 +void __init calculateCpuSpeed(void);
540 +static unsigned long cpu_speed;
541 +#define CPU_CLOCK                   cpu_speed
542 +#define MACH_BCM                    MACH_BCM96348
543 +#endif
544 +
545 +const char *get_system_type(void)
546 +{
547 +    PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
548 +
549 +    return( pNvramData->szBoardId );
550 +}
551 +
552 +unsigned long getMemorySize(void)
553 +{
554 +    unsigned long ulSdramType = BOARD_SDRAM_TYPE;
555 +
556 +    unsigned long ulSdramSize;
557 +
558 +    switch( ulSdramType )
559 +    {
560 +    case BP_MEMORY_16MB_1_CHIP:
561 +    case BP_MEMORY_16MB_2_CHIP:
562 +        ulSdramSize = 16 * 1024 * 1024;
563 +        break;
564 +    case BP_MEMORY_32MB_1_CHIP:
565 +    case BP_MEMORY_32MB_2_CHIP:
566 +        ulSdramSize = 32 * 1024 * 1024;
567 +        break;
568 +    case BP_MEMORY_64MB_2_CHIP:
569 +        ulSdramSize = 64 * 1024 * 1024;
570 +        break;
571 +    default:
572 +        ulSdramSize = 8 * 1024 * 1024;
573 +        break;
574 +    }
575 +
576 +    return ulSdramSize;
577 +}
578 +
579 +/* --------------------------------------------------------------------------
580 +    Name: prom_init
581 + -------------------------------------------------------------------------- */
582 +void __init prom_init(void)
583 +{
584 +    extern ulong r4k_interval;
585 +
586 +    serial_init();
587 +
588 +    kerSysFlashInit();
589 +
590 +    do_syslog(8, NULL, 8);
591 +
592 +    printk( "%s prom init\n", get_system_type() );
593 +
594 +    PERF->IrqMask = 0;
595 +
596 +    arcs_cmdline[0] = '\0';
597 +
598 +#if defined(CONFIG_ROOT_NFS)
599 +    create_root_nfs_cmdline( arcs_cmdline );
600 +#elif defined(CONFIG_ROOT_FLASHFS)
601 +    strcpy(arcs_cmdline, CONFIG_ROOT_FLASHFS);
602 +#endif
603 +
604 +    add_memory_region(0, (getMemorySize() - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
605 +
606 +#if defined(CONFIG_BCM96348)
607 +    calculateCpuSpeed();
608 +#endif
609 +    /* Count register increments every other clock */
610 +    r4k_interval = CPU_CLOCK / HZ / 2;
611 +    mips_hpt_frequency = CPU_CLOCK / 2;
612 +
613 +    mips_machgroup = MACH_GROUP_BRCM;
614 +    mips_machtype = MACH_BCM;
615 +}
616 +
617 +/* --------------------------------------------------------------------------
618 +    Name: prom_free_prom_memory
619 +Abstract: 
620 + -------------------------------------------------------------------------- */
621 +void __init prom_free_prom_memory(void)
622 +{
623 +
624 +}
625 +
626 +
627 +#if defined(CONFIG_ROOT_NFS)
628 +/* This function reads in a line that looks something like this:
629 + *
630 + *
631 + * CFE bootline=bcmEnet(0,0)host:vmlinux e=192.169.0.100:ffffff00 h=192.169.0.1
632 + *
633 + *
634 + * and retuns in the cmdline parameter some that looks like this:
635 + *
636 + * CONFIG_CMDLINE="root=/dev/nfs nfsroot=192.168.0.1:/opt/targets/96345R/fs
637 + * ip=192.168.0.100:192.168.0.1::255.255.255.0::eth0:off rw"
638 + */
639 +#define BOOT_LINE_ADDR   0x0
640 +#define HEXDIGIT(d) ((d >= '0' && d <= '9') ? (d - '0') : ((d | 0x20) - 'W'))
641 +#define HEXBYTE(b)  (HEXDIGIT((b)[0]) << 4) + HEXDIGIT((b)[1])
642 +extern unsigned long get_nvram_start_addr(void);
643 +
644 +void __init create_root_nfs_cmdline( char *cmdline )
645 +{
646 +    char root_nfs_cl[] = "root=/dev/nfs nfsroot=%s:" CONFIG_ROOT_NFS_DIR
647 +        " ip=%s:%s::%s::eth0:off rw";
648 +
649 +    char *localip = NULL;
650 +    char *hostip = NULL;
651 +    char mask[16] = "";
652 +    PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
653 +    char bootline[128] = "";
654 +    char *p = bootline;
655 +
656 +    memcpy(bootline, pNvramData->szBootline, sizeof(bootline));
657 +    while( *p )
658 +    {
659 +        if( p[0] == 'e' && p[1] == '=' )
660 +        {
661 +            /* Found local ip address */
662 +            p += 2;
663 +            localip = p;
664 +            while( *p && *p != ' ' && *p != ':' )
665 +                p++;
666 +            if( *p == ':' )
667 +            {
668 +                /* Found network mask (eg FFFFFF00 */
669 +                *p++ = '\0';
670 +                sprintf( mask, "%u.%u.%u.%u", HEXBYTE(p), HEXBYTE(p + 2),
671 +                HEXBYTE(p + 4), HEXBYTE(p + 6) );
672 +                p += 4;
673 +            }
674 +            else if( *p == ' ' )
675 +                *p++ = '\0';
676 +        }
677 +        else if( p[0] == 'h' && p[1] == '=' )
678 +        {
679 +            /* Found host ip address */
680 +            p += 2;
681 +            hostip = p;
682 +            while( *p && *p != ' ' )
683 +                p++;
684 +            if( *p == ' ' )
685 +                    *p++ = '\0';
686 +        }
687 +        else 
688 +            p++;
689 +    }
690 +
691 +    if( localip && hostip ) 
692 +        sprintf( cmdline, root_nfs_cl, hostip, localip, hostip, mask );
693 +}
694 +#endif
695 +
696 +#if defined(CONFIG_BCM96348)
697 +/*  *********************************************************************
698 +    *  calculateCpuSpeed()
699 +    *      Calculate the BCM6348 CPU speed by reading the PLL strap register
700 +    *      and applying the following formula:
701 +    *      cpu_clk = (.25 * 64MHz freq) * (N1 + 1) * (N2 + 2) / (M1_CPU + 1)
702 +    *  Input parameters:
703 +    *      none
704 +    *  Return value:
705 +    *      none
706 +    ********************************************************************* */
707 +void __init calculateCpuSpeed(void)
708 +{
709 +    UINT32 pllStrap = PERF->PllStrap;
710 +    int n1 = (pllStrap & PLL_N1_MASK) >> PLL_N1_SHFT;
711 +    int n2 = (pllStrap & PLL_N2_MASK) >> PLL_N2_SHFT;
712 +    int m1cpu = (pllStrap & PLL_M1_CPU_MASK) >> PLL_M1_CPU_SHFT;
713 +
714 +    cpu_speed = (16 * (n1 + 1) * (n2 + 2) / (m1cpu + 1)) * 1000000;
715 +}
716 +#endif
717 +
718 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/ser_init.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/ser_init.c
719 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/ser_init.c     1970-01-01 01:00:00.000000000 +0100
720 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/ser_init.c    2006-06-26 09:07:08.000000000 +0200
721 @@ -0,0 +1,180 @@
722 +/*
723 +<:copyright-gpl 
724 + Copyright 2004 Broadcom Corp. All Rights Reserved. 
725
726 + This program is free software; you can distribute it and/or modify it 
727 + under the terms of the GNU General Public License (Version 2) as 
728 + published by the Free Software Foundation. 
729
730 + This program is distributed in the hope it will be useful, but WITHOUT 
731 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
732 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
733 + for more details. 
734
735 + You should have received a copy of the GNU General Public License along 
736 + with this program; if not, write to the Free Software Foundation, Inc., 
737 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
738 +:>
739 +*/
740 +/*
741 + *  Broadcom bcm63xx serial port initialization, also prepare for printk
742 + *  by registering with console_init
743 + *   
744 + */
745 +
746 +#include <linux/config.h>
747 +#include <linux/init.h>
748 +#include <linux/interrupt.h>
749 +#include <linux/kernel.h>
750 +#include <linux/types.h>
751 +#include <linux/console.h>
752 +#include <linux/sched.h>
753 +
754 +#include <asm/addrspace.h>
755 +#include <asm/irq.h>
756 +#include <asm/reboot.h>
757 +#include <asm/gdb-stub.h>
758 +#include <asm/mc146818rtc.h> 
759 +
760 +#include <bcm_map_part.h>
761 +#include <board.h>
762 +
763 +#define  SER63XX_DEFAULT_BAUD      115200
764 +#define BD_BCM63XX_TIMER_CLOCK_INPUT    (FPERIPH)
765 +#define stUart ((volatile Uart * const) UART_BASE)
766 +
767 +// Transmit interrupts
768 +#define TXINT       (TXFIFOEMT | TXUNDERR | TXOVFERR)
769 +// Receive interrupts
770 +#define RXINT       (RXFIFONE | RXOVFERR)
771 +
772 +/* --------------------------------------------------------------------------
773 +    Name: serial_init
774 + Purpose: Initalize the UART
775 +-------------------------------------------------------------------------- */
776 +void __init serial_init(void)
777 +{
778 +    UINT32 tmpVal = SER63XX_DEFAULT_BAUD;
779 +    ULONG clockFreqHz;    
780 +
781 +#if defined(CONFIG_BCM96345)
782 +    // Make sure clock is ticking
783 +    PERF->blkEnables |= UART_CLK_EN;
784 +#endif
785 +               
786 +    /* Dissable channel's receiver and transmitter.                */
787 +    stUart->control &= ~(BRGEN|TXEN|RXEN);
788 +               
789 +    /*--------------------------------------------------------------------*/
790 +    /* Write the table value to the clock select register.                */
791 +    /* DPullen - this is the equation to use:                             */
792 +    /*       value = clockFreqHz / baud / 32-1;                           */
793 +    /*   (snmod) Actually you should also take into account any necessary */
794 +    /*           rounding.  Divide by 16, look at lsb, if 0, divide by 2  */
795 +    /*           and subtract 1.  If 1, just divide by 2                  */
796 +    /*--------------------------------------------------------------------*/
797 +    clockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
798 +    tmpVal = (clockFreqHz / tmpVal) / 16;
799 +    if( tmpVal & 0x01 )
800 +        tmpVal /= 2;  //Rounding up, so sub is already accounted for
801 +    else
802 +        tmpVal = (tmpVal / 2) - 1; // Rounding down so we must sub 1
803 +    stUart->baudword = tmpVal;
804 +        
805 +    /* Finally, re-enable the transmitter and receiver.            */
806 +    stUart->control |= (BRGEN|TXEN|RXEN);
807 +
808 +    stUart->config   = (BITS8SYM | ONESTOP);
809 +    // Set the FIFO interrupt depth ... stUart->fifocfg  = 0xAA;
810 +    stUart->fifoctl  =  RSTTXFIFOS | RSTRXFIFOS;
811 +    stUart->intMask  = 0;       
812 +    stUart->intMask = RXINT | TXINT;
813 +}
814 +
815 +
816 +/* prom_putc()
817 + * Output a character to the UART
818 + */
819 +void prom_putc(char c)
820 +{
821 +       /* Wait for Tx uffer to empty */
822 +       while (! (READ16(stUart->intStatus) & TXFIFOEMT));
823 +       /* Send character */
824 +       stUart->Data = c;
825 +}
826 +
827 +/* prom_puts()
828 + * Write a string to the UART
829 + */
830 +void prom_puts(const char *s)
831 +{
832 +       while (*s) {
833 +               if (*s == '\n') {
834 +                       prom_putc('\r');
835 +               }
836 +               prom_putc(*s++);
837 +       }
838 +}
839 +
840 +
841 +/* prom_getc_nowait()
842 + * Returns a character from the UART
843 + * Returns -1 if no characters available or corrupted
844 + */
845 +int prom_getc_nowait(void)
846 +{
847 +    uint16  uStatus;
848 +    int    cData = -1;
849 +
850 +     uStatus = READ16(stUart->intStatus);
851 +
852 +     if (uStatus & RXFIFONE) { /* Do we have a character? */
853 +           cData =  READ16(stUart->Data) & 0xff; /* Read character */
854 +           if (uStatus & (RXFRAMERR | RXPARERR)) {  /* If we got an error, throw it away */
855 +               cData = -1;
856 +           }
857 +  }
858 +
859 +   return cData;
860 +}
861 +
862 +/* prom_getc()
863 + * Returns a charcter from the serial port
864 + * Will block until it receives a valid character
865 +*/
866 +char prom_getc(void)
867 +{
868 +    int    cData = -1;
869 +
870 +    /* Loop until we get a valid character */
871 +    while(cData == -1) {
872 +       cData = prom_getc_nowait();
873 +    }
874 +   return (char) cData;
875 +}
876 +
877 +/* prom_testc()
878 + * Returns 0 if no characters available
879 + */
880 +int prom_testc(void)
881 +{
882 +    uint16  uStatus;
883 +
884 +     uStatus = READ16(stUart->intStatus);
885 +
886 +     return (uStatus & RXFIFONE);
887 +}
888 +
889 +#if CONFIG_REMOTE_DEBUG
890 +/* Prevent other code from writing to the serial port */
891 +void _putc(char c) { }
892 +void _puts(const char *ptr) { }
893 +#else
894 +/* Low level outputs call prom routines */
895 +void _putc(char c) {
896 +       prom_putc(c);
897 +}
898 +void _puts(const char *ptr) {
899 +       prom_puts(ptr);
900 +}
901 +#endif
902 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/setup.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/setup.c
903 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/setup.c        1970-01-01 01:00:00.000000000 +0100
904 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/setup.c       2006-06-26 09:07:08.000000000 +0200
905 @@ -0,0 +1,519 @@
906 +/*
907 +<:copyright-gpl 
908 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
909
910 + This program is free software; you can distribute it and/or modify it 
911 + under the terms of the GNU General Public License (Version 2) as 
912 + published by the Free Software Foundation. 
913
914 + This program is distributed in the hope it will be useful, but WITHOUT 
915 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
916 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
917 + for more details. 
918
919 + You should have received a copy of the GNU General Public License along 
920 + with this program; if not, write to the Free Software Foundation, Inc., 
921 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
922 +:>
923 +*/
924 +/*
925 + * Generic setup routines for Broadcom 963xx MIPS boards
926 + */
927 +
928 +#include <linux/config.h>
929 +#include <linux/init.h>
930 +#include <linux/interrupt.h>
931 +#include <linux/kernel.h>
932 +#include <linux/kdev_t.h>
933 +#include <linux/types.h>
934 +#include <linux/console.h>
935 +#include <linux/sched.h>
936 +#include <linux/mm.h>
937 +#include <linux/slab.h>
938 +#include <linux/module.h>
939 +
940 +#include <asm/addrspace.h>
941 +#include <asm/bcache.h>
942 +#include <asm/irq.h>
943 +#include <asm/time.h>
944 +#include <asm/reboot.h>
945 +#include <asm/gdb-stub.h>
946 +
947 +extern void brcm_timer_setup(struct irqaction *irq);
948 +extern unsigned long getMemorySize(void);
949 +
950 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
951 +#include <linux/pci.h>
952 +#include <linux/delay.h>
953 +#include <bcm_map_part.h>
954 +#include <bcmpci.h>
955 +
956 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
957 +#endif
958 +
959 +/* This function should be in a board specific directory.  For now,
960 + * assume that all boards that include this file use a Broadcom chip
961 + * with a soft reset bit in the PLL control register.
962 + */
963 +static void brcm_machine_restart(char *command)
964 +{
965 +    const unsigned long ulSoftReset = 0x00000001;
966 +    unsigned long *pulPllCtrl = (unsigned long *) 0xfffe0008;
967 +    *pulPllCtrl |= ulSoftReset;
968 +}
969 +
970 +static void brcm_machine_halt(void)
971 +{
972 +    printk("System halted\n");
973 +    while (1);
974 +}
975 +
976 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
977 +
978 +static void mpi_SetLocalPciConfigReg(uint32 reg, uint32 value)
979 +{
980 +    /* write index then value */
981 +    mpi->pcicfgcntrl = PCI_CFG_REG_WRITE_EN + reg;;
982 +    mpi->pcicfgdata = value;
983 +}
984 +
985 +static uint32 mpi_GetLocalPciConfigReg(uint32 reg)
986 +{
987 +    /* write index then get value */
988 +    mpi->pcicfgcntrl = PCI_CFG_REG_WRITE_EN + reg;;
989 +    return mpi->pcicfgdata;
990 +}
991 +
992 +/*
993 + * mpi_ResetPcCard: Set/Reset the PcCard
994 + */
995 +static void mpi_ResetPcCard(int cardtype, BOOL bReset)
996 +{
997 +    if (cardtype == MPI_CARDTYPE_NONE) {
998 +        return;
999 +    }
1000 +
1001 +    if (cardtype == MPI_CARDTYPE_CARDBUS) {
1002 +        bReset = ! bReset;
1003 +    }
1004 +
1005 +    if (bReset) {
1006 +        mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & ~PCCARD_CARD_RESET);
1007 +    } else {
1008 +        mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 | PCCARD_CARD_RESET);
1009 +    }
1010 +}
1011 +
1012 +/*
1013 + * mpi_ConfigCs: Configure an MPI/EBI chip select
1014 + */
1015 +static void mpi_ConfigCs(uint32 cs, uint32 base, uint32 size, uint32 flags)
1016 +{
1017 +    mpi->cs[cs].base = ((base & 0x1FFFFFFF) | size);
1018 +    mpi->cs[cs].config = flags;
1019 +}
1020 +
1021 +/*
1022 + * mpi_InitPcmciaSpace
1023 + */
1024 +static void mpi_InitPcmciaSpace(void)
1025 +{
1026 +    // ChipSelect 4 controls PCMCIA Memory accesses
1027 +    mpi_ConfigCs(PCMCIA_COMMON_BASE, pcmciaMem, EBI_SIZE_1M, (EBI_WORD_WIDE|EBI_ENABLE));
1028 +    // ChipSelect 5 controls PCMCIA Attribute accesses
1029 +    mpi_ConfigCs(PCMCIA_ATTRIBUTE_BASE, pcmciaAttr, EBI_SIZE_1M, (EBI_WORD_WIDE|EBI_ENABLE));
1030 +    // ChipSelect 6 controls PCMCIA I/O accesses
1031 +    mpi_ConfigCs(PCMCIA_IO_BASE, pcmciaIo, EBI_SIZE_64K, (EBI_WORD_WIDE|EBI_ENABLE));
1032 +
1033 +    mpi->pcmcia_cntl2 = ((PCMCIA_ATTR_ACTIVE << RW_ACTIVE_CNT_BIT) | 
1034 +                         (PCMCIA_ATTR_INACTIVE << INACTIVE_CNT_BIT) | 
1035 +                         (PCMCIA_ATTR_CE_SETUP << CE_SETUP_CNT_BIT) | 
1036 +                         (PCMCIA_ATTR_CE_HOLD << CE_HOLD_CNT_BIT));
1037 +
1038 +    mpi->pcmcia_cntl2 |= (PCMCIA_HALFWORD_EN | PCMCIA_BYTESWAP_DIS);
1039 +}
1040 +
1041 +/*
1042 + * cardtype_vcc_detect: PC Card's card detect and voltage sense connection
1043 + * 
1044 + *   CD1#/      CD2#/     VS1#/     VS2#/    Card       Initial Vcc
1045 + *  CCD1#      CCD2#     CVS1      CVS2      Type
1046 + *
1047 + *   GND        GND       open      open     16-bit     5 vdc
1048 + *
1049 + *   GND        GND       GND       open     16-bit     3.3 vdc
1050 + *
1051 + *   GND        GND       open      GND      16-bit     x.x vdc
1052 + *
1053 + *   GND        GND       GND       GND      16-bit     3.3 & x.x vdc
1054 + *
1055 + *====================================================================
1056 + *
1057 + *   CVS1       GND       CCD1#     open     CardBus    3.3 vdc
1058 + *
1059 + *   GND        CVS2      open      CCD2#    CardBus    x.x vdc
1060 + *
1061 + *   GND        CVS1      CCD2#     open     CardBus    y.y vdc
1062 + *
1063 + *   GND        CVS2      GND       CCD2#    CardBus    3.3 & x.x vdc
1064 + *
1065 + *   CVS2       GND       open      CCD1#    CardBus    x.x & y.y vdc
1066 + *
1067 + *   GND        CVS1      CCD2#     open     CardBus    3.3, x.x & y.y vdc
1068 + *
1069 + */
1070 +static int cardtype_vcc_detect(void)
1071 +{
1072 +    uint32 data32;
1073 +    int cardtype;
1074 +
1075 +    cardtype = MPI_CARDTYPE_NONE;
1076 +    mpi->pcmcia_cntl1 = 0x0000A000; // Turn on the output enables and drive
1077 +                                        // the CVS pins to 0.
1078 +    data32 = mpi->pcmcia_cntl1;
1079 +    switch (data32 & 0x00000003)  // Test CD1# and CD2#, see if card is plugged in.
1080 +    {
1081 +    case 0x00000003:  // No Card is in the slot.
1082 +        printk("mpi: No Card is in the PCMCIA slot\n");
1083 +        break;
1084 +
1085 +    case 0x00000002:  // Partial insertion, No CD2#.
1086 +        printk("mpi: Card in the PCMCIA slot partial insertion, no CD2 signal\n");
1087 +        break;
1088 +
1089 +    case 0x00000001:  // Partial insertion, No CD1#.
1090 +        printk("mpi: Card in the PCMCIA slot partial insertion, no CD1 signal\n");
1091 +        break;
1092 +
1093 +    case 0x00000000:
1094 +        mpi->pcmcia_cntl1 = 0x0000A0C0; // Turn off the CVS output enables and
1095 +                                        // float the CVS pins.
1096 +        mdelay(1);
1097 +        data32 = mpi->pcmcia_cntl1;
1098 +        // Read the Register.
1099 +        switch (data32 & 0x0000000C)  // See what is on the CVS pins.
1100 +        {
1101 +        case 0x00000000: // CVS1 and CVS2 are tied to ground, only 1 option.
1102 +            printk("mpi: Detected 3.3 & x.x 16-bit PCMCIA card\n");
1103 +            cardtype = MPI_CARDTYPE_PCMCIA;
1104 +            break;
1105 +          
1106 +        case 0x00000004: // CVS1 is open or tied to CCD1/CCD2 and CVS2 is tied to ground.
1107 +                         // 2 valid voltage options.
1108 +        switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
1109 +        {
1110 +            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
1111 +                              // This is not a valid combination.
1112 +                printk("mpi: Unknown card plugged into slot\n"); 
1113 +                break;
1114 +      
1115 +            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2. 
1116 +                mpi->pcmcia_cntl1 = 0x0000A080; // Drive CVS1 to a 0.
1117 +                mdelay(1);
1118 +                data32 = mpi->pcmcia_cntl1;
1119 +                if (data32 & 0x00000002) { // CCD2 is tied to CVS2, not valid.
1120 +                    printk("mpi: Unknown card plugged into slot\n"); 
1121 +                } else {                   // CCD2 is tied to CVS1.
1122 +                    printk("mpi: Detected 3.3, x.x and y.y Cardbus card\n");
1123 +                    cardtype = MPI_CARDTYPE_CARDBUS;
1124 +                }
1125 +                break;
1126 +                
1127 +            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
1128 +                             // This is not a valid combination.
1129 +                printk("mpi: Unknown card plugged into slot\n"); 
1130 +                break;
1131 +                
1132 +            case 0x00000000:  // CCD1 and CCD2 are tied to ground.
1133 +                printk("mpi: Detected x.x vdc 16-bit PCMCIA card\n");
1134 +                cardtype = MPI_CARDTYPE_PCMCIA;
1135 +                break;
1136 +            }
1137 +            break;
1138 +          
1139 +        case 0x00000008: // CVS2 is open or tied to CCD1/CCD2 and CVS1 is tied to ground.
1140 +                         // 2 valid voltage options.
1141 +            switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
1142 +            {
1143 +            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
1144 +                              // This is not a valid combination.
1145 +                printk("mpi: Unknown card plugged into slot\n"); 
1146 +                break;
1147 +      
1148 +            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2.
1149 +                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
1150 +                mdelay(1);
1151 +                data32 = mpi->pcmcia_cntl1;
1152 +                if (data32 & 0x00000002) { // CCD2 is tied to CVS1, not valid.
1153 +                    printk("mpi: Unknown card plugged into slot\n"); 
1154 +                } else {// CCD2 is tied to CVS2.
1155 +                    printk("mpi: Detected 3.3 and x.x Cardbus card\n");
1156 +                    cardtype = MPI_CARDTYPE_CARDBUS;
1157 +                }
1158 +                break;
1159 +
1160 +            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
1161 +                             // This is not a valid combination.
1162 +                printk("mpi: Unknown card plugged into slot\n"); 
1163 +                break;
1164 +
1165 +            case 0x00000000:  // CCD1 and CCD2 are tied to ground.
1166 +                cardtype = MPI_CARDTYPE_PCMCIA;
1167 +                printk("mpi: Detected 3.3 vdc 16-bit PCMCIA card\n");
1168 +                break;
1169 +            }
1170 +            break;
1171 +          
1172 +        case 0x0000000C:  // CVS1 and CVS2 are open or tied to CCD1/CCD2.
1173 +                          // 5 valid voltage options.
1174 +      
1175 +            switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
1176 +            {
1177 +            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
1178 +                              // This is not a valid combination.
1179 +                printk("mpi: Unknown card plugged into slot\n"); 
1180 +                break;
1181 +      
1182 +            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2.
1183 +                              // CCD1 is tied to ground.
1184 +                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
1185 +                mdelay(1);
1186 +                data32 = mpi->pcmcia_cntl1;
1187 +                if (data32 & 0x00000002) {  // CCD2 is tied to CVS1.
1188 +                    printk("mpi: Detected y.y vdc Cardbus card\n");
1189 +                } else {                    // CCD2 is tied to CVS2.
1190 +                    printk("mpi: Detected x.x vdc Cardbus card\n");
1191 +                }
1192 +                cardtype = MPI_CARDTYPE_CARDBUS;
1193 +                break;
1194 +      
1195 +            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
1196 +                             // CCD2 is tied to ground.
1197 +      
1198 +                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
1199 +                mdelay(1);
1200 +                data32 = mpi->pcmcia_cntl1;
1201 +                if (data32 & 0x00000001) {// CCD1 is tied to CVS1.
1202 +                    printk("mpi: Detected 3.3 vdc Cardbus card\n");
1203 +                } else {                    // CCD1 is tied to CVS2.
1204 +                    printk("mpi: Detected x.x and y.y Cardbus card\n");
1205 +                }
1206 +                cardtype = MPI_CARDTYPE_CARDBUS;
1207 +                break;
1208 +      
1209 +            case 0x00000000:  // CCD1 and CCD2 are tied to ground.
1210 +                cardtype = MPI_CARDTYPE_PCMCIA;
1211 +                printk("mpi: Detected 5 vdc 16-bit PCMCIA card\n");
1212 +                break;
1213 +            }
1214 +            break;
1215 +      
1216 +        default:
1217 +            printk("mpi: Unknown card plugged into slot\n"); 
1218 +            break;
1219 +        
1220 +        }
1221 +    }
1222 +    return cardtype;
1223 +}
1224 +
1225 +/*
1226 + * mpi_DetectPcCard: Detect the plugged in PC-Card
1227 + * Return: < 0 => Unknown card detected
1228 + *         0 => No card detected
1229 + *         1 => 16-bit card detected
1230 + *         2 => 32-bit CardBus card detected
1231 + */
1232 +static int mpi_DetectPcCard(void)
1233 +{
1234 +    int cardtype;
1235 +
1236 +    cardtype = cardtype_vcc_detect();
1237 +    switch(cardtype) {
1238 +        case MPI_CARDTYPE_PCMCIA:
1239 +            mpi->pcmcia_cntl1 &= ~0x0000e000; // disable enable bits
1240 +            //mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & ~PCCARD_CARD_RESET);
1241 +            mpi->pcmcia_cntl1 |= (PCMCIA_ENABLE | PCMCIA_GPIO_ENABLE);
1242 +            mpi_InitPcmciaSpace();
1243 +            mpi_ResetPcCard(cardtype, FALSE);
1244 +            // Hold card in reset for 10ms
1245 +            mdelay(10);
1246 +            mpi_ResetPcCard(cardtype, TRUE);
1247 +            // Let card come out of reset
1248 +            mdelay(100);
1249 +            break;
1250 +        case MPI_CARDTYPE_CARDBUS:
1251 +            // 8 => CardBus Enable
1252 +            // 1 => PCI Slot Number
1253 +            // C => Float VS1 & VS2
1254 +            mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & 0xFFFF0000) | 
1255 +                                CARDBUS_ENABLE | 
1256 +                                (CARDBUS_SLOT << 8)| 
1257 +                                VS2_OEN |
1258 +                                VS1_OEN;
1259 +            /* access to this memory window will be to/from CardBus */
1260 +            mpi->l2pmremap1 |= CARDBUS_MEM;
1261 +
1262 +            // Need to reset the Cardbus Card. There's no CardManager to do this, 
1263 +            // and we need to be ready for PCI configuration. 
1264 +            mpi_ResetPcCard(cardtype, FALSE);
1265 +            // Hold card in reset for 10ms
1266 +            mdelay(10);
1267 +            mpi_ResetPcCard(cardtype, TRUE);
1268 +            // Let card come out of reset
1269 +            mdelay(100);
1270 +            break;
1271 +        default:
1272 +            break;
1273 +    }
1274 +    return cardtype;
1275 +}
1276 +
1277 +static int mpi_init(void)
1278 +{
1279 +    unsigned long data;
1280 +    unsigned int chipid;
1281 +    unsigned int chiprev;
1282 +    unsigned int sdramsize;
1283 +
1284 +    chipid  = (PERF->RevID & 0xFFFF0000) >> 16;
1285 +    chiprev = (PERF->RevID & 0xFF);
1286 +    sdramsize = getMemorySize();
1287 +    /*
1288 +     * Init the pci interface 
1289 +     */
1290 +    data = GPIO->GPIOMode; // GPIO mode register
1291 +    data |= GROUP2_PCI | GROUP1_MII_PCCARD; // PCI internal arbiter + Cardbus
1292 +    GPIO->GPIOMode = data; // PCI internal arbiter
1293 +
1294 +    /*
1295 +     * In the BCM6348 CardBus support is defaulted to Slot 0
1296 +     * because there is no external IDSEL for CardBus.  To disable
1297 +     * the CardBus and allow a standard PCI card in Slot 0 
1298 +     * set the cbus_idsel field to 0x1f.
1299 +    */
1300 +    /*
1301 +    uData = mpi->pcmcia_cntl1;
1302 +    uData |= CARDBUS_IDSEL;
1303 +    mpi->pcmcia_cntl1 = uData;
1304 +    */
1305 +    // Setup PCI I/O Window range. Give 64K to PCI I/O
1306 +    mpi->l2piorange = ~(BCM_PCI_IO_SIZE_64KB-1);
1307 +    // UBUS to PCI I/O base address 
1308 +    mpi->l2piobase = BCM_PCI_IO_BASE & BCM_PCI_ADDR_MASK;
1309 +    // UBUS to PCI I/O Window remap
1310 +    mpi->l2pioremap = (BCM_PCI_IO_BASE | MEM_WINDOW_EN);
1311 +
1312 +    // enable PCI related GPIO pins and data swap between system and PCI bus
1313 +    mpi->locbuscntrl = (EN_PCI_GPIO | DIR_U2P_NOSWAP);
1314 +
1315 +    /* Enable 6348 BusMaster and Memory access mode */
1316 +    data = mpi_GetLocalPciConfigReg(PCI_COMMAND);
1317 +    data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
1318 +    mpi_SetLocalPciConfigReg(PCI_COMMAND, data);
1319 +
1320 +    /* Configure two 16 MByte PCI to System memory regions. */
1321 +    /* These memory regions are used when PCI device is a bus master */
1322 +    /* Accesses to the SDRAM from PCI bus will be "byte swapped" for this region */
1323 +    mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_3, BCM_HOST_MEM_SPACE1);
1324 +    mpi->sp0remap = 0x0;
1325 +
1326 +    /* Accesses to the SDRAM from PCI bus will not be "byte swapped" for this region */
1327 +    mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_4, BCM_HOST_MEM_SPACE2);
1328 +    mpi->sp1remap = 0x0;
1329 +    mpi->pcimodesel |= (PCI_BAR2_NOSWAP | 0x40);
1330 +
1331 +    if ((chipid == 0x6348) && (chiprev == 0xb0)) {
1332 +        mpi->sp0range = ~(sdramsize-1);
1333 +        mpi->sp1range = ~(sdramsize-1);
1334 +    }
1335 +    /*
1336 +     * Change 6348 PCI Cfg Reg. offset 0x40 to PCI memory read retry count infinity
1337 +     * by set 0 in bit 8~15.  This resolve read Bcm4306 srom return 0xffff in
1338 +     * first read.
1339 +     */
1340 +    data = mpi_GetLocalPciConfigReg(BRCM_PCI_CONFIG_TIMER);
1341 +    data &= ~BRCM_PCI_CONFIG_TIMER_RETRY_MASK;
1342 +    data |= 0x00000080;
1343 +    mpi_SetLocalPciConfigReg(BRCM_PCI_CONFIG_TIMER, data);
1344 +
1345 +    /* enable pci interrupt */
1346 +    mpi->locintstat |= (EXT_PCI_INT << 16);
1347 +
1348 +    mpi_DetectPcCard();
1349 +
1350 +    ioport_resource.start = BCM_PCI_IO_BASE;
1351 +    ioport_resource.end = BCM_PCI_IO_BASE + BCM_PCI_IO_SIZE_64KB;
1352 +
1353 +#if defined(CONFIG_USB)
1354 +    PERF->blkEnables |= USBH_CLK_EN;
1355 +    mdelay(100);
1356 +    *USBH_NON_OHCI = NON_OHCI_BYTE_SWAP;
1357 +#endif
1358 +
1359 +    return 0;
1360 +}
1361 +#endif
1362 +
1363 +static int __init brcm63xx_setup(void)
1364 +{
1365 +    extern int panic_timeout;
1366 +
1367 +    _machine_restart = brcm_machine_restart;
1368 +    _machine_halt = brcm_machine_halt;
1369 +    _machine_power_off = brcm_machine_halt;
1370 +
1371 +    board_timer_setup = brcm_timer_setup;
1372 +
1373 +    panic_timeout = 180;
1374 +
1375 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
1376 +    /* mpi initialization */
1377 +    mpi_init();
1378 +#endif
1379 +    return 0;
1380 +}
1381 +
1382 +early_initcall(brcm63xx_setup);
1383 +
1384 +/***************************************************************************
1385 + * C++ New and delete operator functions
1386 + ***************************************************************************/
1387 +
1388 +/* void *operator new(unsigned int sz) */
1389 +void *_Znwj(unsigned int sz)
1390 +{
1391 +    return( kmalloc(sz, GFP_KERNEL) );
1392 +}
1393 +
1394 +/* void *operator new[](unsigned int sz)*/
1395 +void *_Znaj(unsigned int sz)
1396 +{
1397 +    return( kmalloc(sz, GFP_KERNEL) );
1398 +}
1399 +
1400 +/* placement new operator */
1401 +/* void *operator new (unsigned int size, void *ptr) */
1402 +void *ZnwjPv(unsigned int size, void *ptr)
1403 +{
1404 +    return ptr;
1405 +}
1406 +
1407 +/* void operator delete(void *m) */
1408 +void _ZdlPv(void *m)
1409 +{
1410 +    kfree(m);
1411 +}
1412 +
1413 +/* void operator delete[](void *m) */
1414 +void _ZdaPv(void *m)
1415 +{
1416 +    kfree(m);
1417 +}
1418 +
1419 +EXPORT_SYMBOL(_Znwj);
1420 +EXPORT_SYMBOL(_Znaj);
1421 +EXPORT_SYMBOL(ZnwjPv);
1422 +EXPORT_SYMBOL(_ZdlPv);
1423 +EXPORT_SYMBOL(_ZdaPv);
1424 +
1425 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/time.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/time.c
1426 --- linux-2.6.8.1/arch/mips/brcm-boards/bcm963xx/time.c 1970-01-01 01:00:00.000000000 +0100
1427 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/bcm963xx/time.c        2006-06-26 09:07:08.000000000 +0200
1428 @@ -0,0 +1,277 @@
1429 +/*
1430 +<:copyright-gpl
1431 + Copyright 2004 Broadcom Corp. All Rights Reserved.
1432 +
1433 + This program is free software; you can distribute it and/or modify it
1434 + under the terms of the GNU General Public License (Version 2) as
1435 + published by the Free Software Foundation.
1436 +
1437 + This program is distributed in the hope it will be useful, but WITHOUT
1438 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1439 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1440 + for more details.
1441 +
1442 + You should have received a copy of the GNU General Public License along
1443 + with this program; if not, write to the Free Software Foundation, Inc.,
1444 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1445 +:>
1446 +*/
1447 +/*
1448 + * Setup time for Broadcom 963xx MIPS boards
1449 + */
1450 +
1451 +#include <linux/config.h>
1452 +#include <linux/init.h>
1453 +#include <linux/kernel_stat.h>
1454 +#include <linux/sched.h>
1455 +#include <linux/spinlock.h>
1456 +#include <linux/interrupt.h>
1457 +#include <linux/module.h>
1458 +#include <linux/time.h>
1459 +#include <linux/timex.h>
1460 +
1461 +#include <asm/mipsregs.h>
1462 +#include <asm/ptrace.h>
1463 +#include <asm/div64.h>
1464 +#include <asm/time.h>
1465 +
1466 +#include <bcm_map_part.h>
1467 +#include <bcm_intr.h>
1468 +
1469 +unsigned long r4k_interval;    /* Amount to increment compare reg each time */
1470 +static unsigned long r4k_cur;  /* What counter should be at next timer irq */
1471 +
1472 +/* Cycle counter value at the previous timer interrupt.. */
1473 +static unsigned int timerhi = 0, timerlo = 0;
1474 +
1475 +extern volatile unsigned long wall_jiffies;
1476 +
1477 +/* Optional board-specific timer routine */
1478 +void (*board_timer_interrupt)(int irq, void *dev_id, struct pt_regs * regs);
1479 +
1480 +static inline void ack_r4ktimer(unsigned long newval)
1481 +{
1482 +       write_c0_compare(newval);
1483 +}
1484 +
1485 +/*
1486 + * There are a lot of conceptually broken versions of the MIPS timer interrupt
1487 + * handler floating around.  This one is rather different, but the algorithm
1488 + * is provably more robust.
1489 + */
1490 +static irqreturn_t brcm_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1491 +{
1492 +       unsigned int count;
1493 +
1494 +       if (r4k_interval == 0)
1495 +               goto null;
1496 +
1497 +       do {
1498 +               do_timer(regs);
1499 +
1500 +               if (board_timer_interrupt)
1501 +                       board_timer_interrupt(irq, dev_id, regs);
1502 +
1503 +               r4k_cur += r4k_interval;
1504 +               ack_r4ktimer(r4k_cur);
1505 +
1506 +       } while (((count = (unsigned long)read_c0_count())
1507 +                 - r4k_cur) < 0x7fffffff);
1508 +
1509 +       if (!jiffies) {
1510 +               /*
1511 +                * If jiffies has overflowed in this timer_interrupt we must
1512 +                * update the timer[hi]/[lo] to make do_fast_gettimeoffset()
1513 +                * quotient calc still valid. -arca
1514 +                */
1515 +               timerhi = timerlo = 0;
1516 +       } else {
1517 +               /*
1518 +                * The cycle counter is only 32 bit which is good for about
1519 +                * a minute at current count rates of upto 150MHz or so.
1520 +                */
1521 +               timerhi += (count < timerlo);   /* Wrap around */
1522 +               timerlo = count;
1523 +       }
1524 +
1525 +       return IRQ_HANDLED;
1526 +
1527 +null:
1528 +       ack_r4ktimer(0);
1529 +       return IRQ_NONE;
1530 +}
1531 +
1532 +static struct irqaction brcm_timer_action = {
1533 +       .handler        = brcm_timer_interrupt,
1534 +       .flags          = SA_INTERRUPT,
1535 +       .mask           = CPU_MASK_NONE,
1536 +       .name           = "timer",
1537 +       .next           = NULL,
1538 +       .dev_id         = brcm_timer_interrupt,
1539 +};
1540 +
1541 +
1542 +void __init brcm_timer_setup(struct irqaction *irq)
1543 +{
1544 +       r4k_cur = (read_c0_count() + r4k_interval);
1545 +       write_c0_compare(r4k_cur);
1546 +
1547 +       /* we are using the cpu counter for timer interrupts */
1548 +        irq->handler = no_action;     /* we use our own handler */
1549 +       setup_irq(MIPS_TIMER_INT, &brcm_timer_action);
1550 +       set_c0_status(IE_IRQ5);
1551 +}
1552 +
1553 +#if 0
1554 +/* This is for machines which generate the exact clock. */
1555 +#define USECS_PER_JIFFY (1000000/HZ)
1556 +#define USECS_PER_JIFFY_FRAC (0x100000000*1000000/HZ&0xffffffff)
1557 +
1558 +static void call_do_div64_32( unsigned long *res, unsigned int high,
1559 +    unsigned int low, unsigned long base )
1560 +{
1561 +    do_div64_32(*res, high, low, base);
1562 +}
1563 +
1564 +/*
1565 + * FIXME: Does playing with the RP bit in c0_status interfere with this code?
1566 + */
1567 +static unsigned long do_fast_gettimeoffset(void)
1568 +{
1569 +       u32 count;
1570 +       unsigned long res, tmp;
1571 +
1572 +       /* Last jiffy when do_fast_gettimeoffset() was called. */
1573 +       static unsigned long last_jiffies=0;
1574 +       unsigned long quotient;
1575 +
1576 +       /*
1577 +        * Cached "1/(clocks per usec)*2^32" value.
1578 +        * It has to be recalculated once each jiffy.
1579 +        */
1580 +       static unsigned long cached_quotient=0;
1581 +
1582 +       tmp = jiffies;
1583 +
1584 +       quotient = cached_quotient;
1585 +
1586 +       if (tmp && last_jiffies != tmp) {
1587 +               last_jiffies = tmp;
1588 +#ifdef CONFIG_CPU_MIPS32
1589 +               if (last_jiffies != 0) {
1590 +
1591 +                       unsigned long r0;
1592 +                       /* gcc 3.0.1 gets an internal compiler error if there are two
1593 +                        * do_div64_32 inline macros.  To work around this problem,
1594 +                        * do_div64_32 is called as a function.
1595 +                        */
1596 +                       call_do_div64_32(&r0, timerhi, timerlo, tmp);
1597 +                       call_do_div64_32(&quotient, USECS_PER_JIFFY,
1598 +                                   USECS_PER_JIFFY_FRAC, r0);
1599 +
1600 +                       cached_quotient = quotient;
1601 +
1602 +               }
1603 +#else
1604 +               __asm__(".set\tnoreorder\n\t"
1605 +                       ".set\tnoat\n\t"
1606 +                       ".set\tmips3\n\t"
1607 +                       "lwu\t%0,%2\n\t"
1608 +                       "dsll32\t$1,%1,0\n\t"
1609 +                       "or\t$1,$1,%0\n\t"
1610 +                       "ddivu\t$0,$1,%3\n\t"
1611 +                       "mflo\t$1\n\t"
1612 +                       "dsll32\t%0,%4,0\n\t"
1613 +                       "nop\n\t"
1614 +                       "ddivu\t$0,%0,$1\n\t"
1615 +                       "mflo\t%0\n\t"
1616 +                       ".set\tmips0\n\t"
1617 +                       ".set\tat\n\t"
1618 +                       ".set\treorder"
1619 +                       :"=&r" (quotient)
1620 +                       :"r" (timerhi),
1621 +                        "m" (timerlo),
1622 +                        "r" (tmp),
1623 +                        "r" (USECS_PER_JIFFY)
1624 +                       :"$1");
1625 +               cached_quotient = quotient;
1626 +#endif
1627 +       }
1628 +
1629 +       /* Get last timer tick in absolute kernel time */
1630 +       count = read_c0_count();
1631 +
1632 +       /* .. relative to previous jiffy (32 bits is enough) */
1633 +       count -= timerlo;
1634 +
1635 +       __asm__("multu\t%1,%2\n\t"
1636 +               "mfhi\t%0"
1637 +               :"=r" (res)
1638 +               :"r" (count),
1639 +                "r" (quotient));
1640 +
1641 +       /*
1642 +        * Due to possible jiffies inconsistencies, we need to check 
1643 +        * the result so that we'll get a timer that is monotonic.
1644 +        */
1645 +       if (res >= USECS_PER_JIFFY)
1646 +               res = USECS_PER_JIFFY-1;
1647 +
1648 +       return res;
1649 +}
1650 +
1651 +void do_gettimeofday(struct timeval *tv)
1652 +{
1653 +       unsigned int flags;
1654 +
1655 +       read_lock_irqsave (&xtime_lock, flags);
1656 +       tv->tv_sec = xtime.tv_sec;
1657 +       tv->tv_usec = xtime.tv_nsec/1000;
1658 +       tv->tv_usec += do_fast_gettimeoffset();
1659 +
1660 +       /*
1661 +        * xtime is atomically updated in timer_bh. jiffies - wall_jiffies
1662 +        * is nonzero if the timer bottom half hasnt executed yet.
1663 +        */
1664 +       if (jiffies - wall_jiffies)
1665 +               tv->tv_usec += USECS_PER_JIFFY;
1666 +
1667 +       read_unlock_irqrestore (&xtime_lock, flags);
1668 +
1669 +       if (tv->tv_usec >= 1000000) {
1670 +               tv->tv_usec -= 1000000;
1671 +               tv->tv_sec++;
1672 +       }
1673 +}
1674 +
1675 +EXPORT_SYMBOL(do_gettimeofday);
1676 +
1677 +int do_settimeofday(struct timespec *tv)
1678 +{
1679 +       write_lock_irq (&xtime_lock);
1680 +
1681 +       /* This is revolting. We need to set the xtime.tv_usec correctly.
1682 +        * However, the value in this location is is value at the last tick.
1683 +        * Discover what correction gettimeofday would have done, and then
1684 +        * undo it!
1685 +        */
1686 +       tv->tv_nsec -= do_fast_gettimeoffset()*NSEC_PER_USEC;
1687 +
1688 +       if (tv->tv_nsec < 0) {
1689 +               tv->tv_nsec += 1000000*NSEC_PER_USEC;
1690 +               tv->tv_sec--;
1691 +       }
1692 +
1693 +       xtime.tv_sec = tv->tv_sec;
1694 +       xtime.tv_nsec = tv->tv_nsec;
1695 +       time_adjust = 0;                /* stop active adjtime() */
1696 +       time_status |= STA_UNSYNC;
1697 +       time_maxerror = NTP_PHASE_LIMIT;
1698 +       time_esterror = NTP_PHASE_LIMIT;
1699 +
1700 +       write_unlock_irq (&xtime_lock);
1701 +}
1702 +
1703 +EXPORT_SYMBOL(do_settimeofday);
1704 +
1705 +#endif
1706 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/generic/Makefile linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/Makefile
1707 --- linux-2.6.8.1/arch/mips/brcm-boards/generic/Makefile        1970-01-01 01:00:00.000000000 +0100
1708 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/Makefile       2006-06-26 09:07:08.000000000 +0200
1709 @@ -0,0 +1,11 @@
1710 +#
1711 +# Makefile for generic Broadcom MIPS boards
1712 +#
1713 +# Copyright (C) 2001 Broadcom Corporation
1714 +#
1715 +obj-y          := int-handler.o
1716 +
1717 +ifdef CONFIG_REMOTE_DEBUG
1718 +obj-y += dbg_io.o
1719 +endif
1720 +
1721 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/generic/dbg_io.c linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/dbg_io.c
1722 --- linux-2.6.8.1/arch/mips/brcm-boards/generic/dbg_io.c        1970-01-01 01:00:00.000000000 +0100
1723 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/dbg_io.c       2006-06-26 09:07:08.000000000 +0200
1724 @@ -0,0 +1,260 @@
1725 +/*
1726 +<:copyright-gpl 
1727 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
1728
1729 + This program is free software; you can distribute it and/or modify it 
1730 + under the terms of the GNU General Public License (Version 2) as 
1731 + published by the Free Software Foundation. 
1732
1733 + This program is distributed in the hope it will be useful, but WITHOUT 
1734 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
1735 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
1736 + for more details. 
1737
1738 + You should have received a copy of the GNU General Public License along 
1739 + with this program; if not, write to the Free Software Foundation, Inc., 
1740 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
1741 +:>
1742 +*/
1743 +
1744 +#include <linux/config.h>
1745 +#include <linux/tty.h>
1746 +#include <linux/major.h>
1747 +#include <linux/init.h>
1748 +#include <linux/console.h>
1749 +#include <linux/fs.h>
1750 +#include <linux/interrupt.h>
1751 +#include <linux/kernel.h>
1752 +#include <linux/types.h>
1753 +#include <linux/sched.h>
1754 +
1755 +#include <bcm_map_part.h>
1756 +
1757 +#undef PRNT                            /* define for debug printing */
1758 +
1759 +#define         UART16550_BAUD_2400             2400
1760 +#define         UART16550_BAUD_4800             4800
1761 +#define         UART16550_BAUD_9600             9600
1762 +#define         UART16550_BAUD_19200            19200
1763 +#define         UART16550_BAUD_38400            38400
1764 +#define         UART16550_BAUD_57600            57600
1765 +#define         UART16550_BAUD_115200           115200
1766 +
1767 +#define         UART16550_PARITY_NONE           0
1768 +#define         UART16550_PARITY_ODD            0x08
1769 +#define         UART16550_PARITY_EVEN           0x18
1770 +#define         UART16550_PARITY_MARK           0x28
1771 +#define         UART16550_PARITY_SPACE          0x38
1772 +
1773 +#define         UART16550_DATA_5BIT             0x0
1774 +#define         UART16550_DATA_6BIT             0x1
1775 +#define         UART16550_DATA_7BIT             0x2
1776 +#define         UART16550_DATA_8BIT             0x3
1777 +
1778 +#define         UART16550_STOP_1BIT             0x0
1779 +#define         UART16550_STOP_2BIT             0x4
1780 +
1781 +volatile Uart * stUart =  UART_BASE;
1782 +
1783 +#define WRITE16(addr, value)        ((*(volatile UINT16 *)((ULONG)&addr)) = value)
1784 +
1785 +/* Low level UART routines from promcon.c */
1786 +extern void prom_putc(char c);
1787 +extern char prom_getc(void);
1788 +extern int prom_getc_nowait(void);
1789 +extern int prom_testc(void);
1790 +
1791 +extern void set_debug_traps(void);
1792 +extern void breakpoint(void);
1793 +extern void enable_brcm_irq(unsigned int);
1794 +extern void set_async_breakpoint(unsigned int epc);
1795 +
1796 +#ifdef CONFIG_GDB_CONSOLE
1797 +extern void register_gdb_console(void);
1798 +#endif
1799 +
1800 +int gdb_initialized = 0;
1801 +
1802 +#define        GDB_BUF_SIZE    512             /* power of 2, please */
1803 +
1804 +static char    gdb_buf[GDB_BUF_SIZE] ;
1805 +static int     gdb_buf_in_inx ;
1806 +static atomic_t        gdb_buf_in_cnt ;
1807 +static int     gdb_buf_out_inx ;
1808 +
1809 +void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
1810 +{
1811 +       /* Do nothing, assume boot loader has already set up serial port */
1812 +       printk("debugInit called\n");
1813 +}
1814 +
1815 +/*
1816 + * Get a char if available, return -1 if nothing available.
1817 + * Empty the receive buffer first, then look at the interface hardware.
1818 + */
1819 +static int     read_char(void)
1820 +{
1821 +    if (atomic_read(&gdb_buf_in_cnt) != 0)     /* intr routine has q'd chars */
1822 +    {
1823 +       int             chr ;
1824 +
1825 +       chr = gdb_buf[gdb_buf_out_inx++] ;
1826 +       gdb_buf_out_inx &= (GDB_BUF_SIZE - 1) ;
1827 +       atomic_dec(&gdb_buf_in_cnt) ;
1828 +       return(chr) ;
1829 +    }
1830 +    return(prom_getc_nowait()) ;       /* read from hardware */
1831 +} /* read_char */
1832 +
1833 +/*
1834 + * This is the receiver interrupt routine for the GDB stub.
1835 + * It will receive a limited number of characters of input
1836 + * from the gdb  host machine and save them up in a buffer.
1837 + *
1838 + * When the gdb stub routine getDebugChar() is called it
1839 + * draws characters out of the buffer until it is empty and
1840 + * then reads directly from the serial port.
1841 + *
1842 + * We do not attempt to write chars from the interrupt routine
1843 + * since the stubs do all of that via putDebugChar() which
1844 + * writes one byte after waiting for the interface to become
1845 + * ready.
1846 + *
1847 + * The debug stubs like to run with interrupts disabled since,
1848 + * after all, they run as a consequence of a breakpoint in
1849 + * the kernel.
1850 + *
1851 + * Perhaps someone who knows more about the tty driver than I
1852 + * care to learn can make this work for any low level serial
1853 + * driver.
1854 + */
1855 +static void gdb_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1856 +{
1857 +    int         chr ;
1858 +    int        more;
1859 +    do
1860 +    {
1861 +       chr = prom_getc_nowait() ;
1862 +       more = prom_testc();
1863 +       if (chr < 0) continue ;
1864 +
1865 +        /* If we receive a Ctrl-C then this is GDB trying to break in */
1866 +        if (chr == 3)
1867 +       {
1868 +           /* Replace current instruction with breakpoint */
1869 +           set_async_breakpoint(regs->cp0_epc);
1870 +            //breakpoint();
1871 +       }
1872 +               
1873 +#ifdef PRNT
1874 +       printk("gdb_interrupt: chr=%02x '%c', more = %x\n",
1875 +               chr, chr > ' ' && chr < 0x7F ? chr : ' ', more) ;
1876 +#endif
1877 +
1878 +       if (atomic_read(&gdb_buf_in_cnt) >= GDB_BUF_SIZE)
1879 +       {                               /* buffer overflow, clear it */
1880 +           gdb_buf_in_inx = 0 ;
1881 +           atomic_set(&gdb_buf_in_cnt, 0) ;
1882 +           gdb_buf_out_inx = 0 ;
1883 +           break ;
1884 +       }
1885 +
1886 +       gdb_buf[gdb_buf_in_inx++] = chr ;
1887 +       gdb_buf_in_inx &= (GDB_BUF_SIZE - 1) ;
1888 +       atomic_inc(&gdb_buf_in_cnt) ;
1889 +    }
1890 +    while (more !=0);
1891 +
1892 +} /* gdb_interrupt */
1893 +
1894 +/*
1895 + * getDebugChar
1896 + *
1897 + * This is a GDB stub routine.  It waits for a character from the
1898 + * serial interface and then returns it.  If there is no serial
1899 + * interface connection then it returns a bogus value which will
1900 + * almost certainly cause the system to hang.
1901 + */
1902 +int    getDebugChar(void)
1903 +{
1904 +    volatile int       chr ;
1905 +
1906 +#ifdef PRNT
1907 +    printk("getDebugChar: ") ;
1908 +#endif
1909 +
1910 +    while ( (chr = read_char()) < 0 ) ;
1911 +
1912 +#ifdef PRNT
1913 +    printk("%c\n", chr > ' ' && chr < 0x7F ? chr : ' ') ;
1914 +#endif
1915 +    return(chr) ;
1916 +
1917 +} /* getDebugChar */
1918 +
1919 +/*
1920 + * putDebugChar
1921 + *
1922 + * This is a GDB stub routine.  It waits until the interface is ready
1923 + * to transmit a char and then sends it.  If there is no serial
1924 + * interface connection then it simply returns to its caller, having
1925 + * pretended to send the char.
1926 + */
1927 +int putDebugChar(unsigned char chr)
1928 +{
1929 +#ifdef PRNT
1930 +    printk("putDebugChar: chr=%02x '%c'\n", chr,
1931 +               chr > ' ' && chr < 0x7F ? chr : ' ') ;
1932 +#endif
1933 +
1934 +    prom_putc(chr) ;   /* this routine will wait */
1935 +     return 1;
1936 +
1937 +} /* putDebugChar */
1938 +
1939 +/* Just a NULL routine for testing. */
1940 +void gdb_null(void)
1941 +{
1942 +}
1943 +
1944 +void rs_kgdb_hook(int tty_no)
1945 +{
1946 +    printk("rs_kgdb_hook: tty %d\n", tty_no);
1947 +
1948 +    /* Call GDB routine to setup the exception vectors for the debugger */
1949 +   set_debug_traps();
1950 +
1951 +   printk("Breaking into debugger...\n");
1952 +   breakpoint();
1953 +   gdb_null() ;
1954 +   printk("Connected.\n");
1955 +
1956 +   gdb_initialized = 1;
1957 +
1958 +#ifdef CONFIG_GDB_CONSOLE
1959 +    register_gdb_console();
1960 +#endif
1961 +}
1962 +
1963 +void kgdb_hook_irq()
1964 +{
1965 +    int         retval ;
1966 +    uint16 uMask;
1967 +
1968 +    printk("GDB: Hooking UART interrupt\n");
1969 +
1970 +    retval = request_irq(INTERRUPT_ID_UART,
1971 +                         gdb_interrupt,
1972 +                         SA_INTERRUPT,
1973 +                         "GDB-stub", NULL);
1974 +
1975 +    if (retval != 0)
1976 +       printk("gdb_hook: request_irq(irq=%d) failed: %d\n", INTERRUPT_ID_UART, retval);
1977 +
1978 +      // Enable UART config Rx not empty IRQ
1979 +     uMask = READ16(stUart->intMask) ;
1980 +      //     printk("intMask: 0x%x\n", uMask);
1981 +     WRITE16(stUart->intMask, uMask | RXFIFONE);
1982 +}
1983 +
1984 +
1985 diff -urN linux-2.6.8.1/arch/mips/brcm-boards/generic/int-handler.S linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/int-handler.S
1986 --- linux-2.6.8.1/arch/mips/brcm-boards/generic/int-handler.S   1970-01-01 01:00:00.000000000 +0100
1987 +++ linux-2.6.8.1-brcm63xx/arch/mips/brcm-boards/generic/int-handler.S  2006-06-26 09:07:08.000000000 +0200
1988 @@ -0,0 +1,59 @@
1989 +/*
1990 +<:copyright-gpl 
1991 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
1992
1993 + This program is free software; you can distribute it and/or modify it 
1994 + under the terms of the GNU General Public License (Version 2) as 
1995 + published by the Free Software Foundation. 
1996
1997 + This program is distributed in the hope it will be useful, but WITHOUT 
1998 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
1999 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
2000 + for more details. 
2001
2002 + You should have received a copy of the GNU General Public License along 
2003 + with this program; if not, write to the Free Software Foundation, Inc., 
2004 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
2005 +:>
2006 +*/
2007 +/*
2008 + * Generic interrupt handler for Broadcom MIPS boards
2009 + */
2010 +
2011 +#include <linux/config.h>
2012 +
2013 +#include <asm/asm.h>
2014 +#include <asm/mipsregs.h>
2015 +#include <asm/regdef.h>
2016 +#include <asm/stackframe.h>
2017 +
2018 +/*
2019 + *     MIPS IRQ        Source
2020 + *      --------        ------
2021 + *             0       Software (ignored)
2022 + *             1        Software (ignored)
2023 + *             2        Combined hardware interrupt (hw0)
2024 + *             3        Hardware
2025 + *             4        Hardware
2026 + *             5        Hardware
2027 + *             6        Hardware
2028 + *             7        R4k timer
2029 + */
2030 +
2031 +       .text
2032 +       .set    noreorder
2033 +       .set    noat
2034 +       .align  5
2035 +       NESTED(brcmIRQ, PT_SIZE, sp)
2036 +       SAVE_ALL
2037 +       CLI
2038 +       .set    noreorder
2039 +       .set    at
2040 +
2041 +       jal             brcm_irq_dispatch
2042 +       move    a0, sp
2043 +
2044 +       j       ret_from_irq
2045 +       nop
2046 +               
2047 +       END(brcmIRQ)
2048 --- linux-2.6.8.1/arch/mips/Kconfig     2004-08-14 12:55:32.000000000 +0200
2049 +++ linux-2.6.8.1-brcm63xx/arch/mips/Kconfig    2006-06-26 09:07:08.000000000 +0200
2050 @@ -27,6 +27,17 @@
2051  
2052  menu "Machine selection"
2053  
2054 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
2055 +
2056 +config MIPS_BRCM
2057 +       bool "Support for the Broadcom boards"
2058 +       help
2059 +        This is a family of boards based on the Broadcom MIPS32
2060 +
2061 +source "arch/mips/brcm-boards/bcm963xx/Kconfig"
2062 +        
2063 +# CONFIG_MIPS_BRCM End Broadcom changed code.
2064 +
2065  config MACH_JAZZ
2066         bool "Support for the Jazz family of machines"
2067         select ISA
2068 @@ -146,6 +157,7 @@
2069         depends on MIPS32
2070         select DMA_NONCOHERENT
2071         select HW_HAS_PCI
2072 +       select SWAP_IO_SPACE
2073  
2074  config MIPS_COBALT
2075         bool "Support for Cobalt Server (EXPERIMENTAL)"
2076 @@ -198,6 +210,7 @@
2077         select IRQ_CPU
2078         select MIPS_GT96100
2079         select RM7000_CPU_SCACHE
2080 +       select SWAP_IO_SPACE
2081         help
2082           This is an evaluation board based on the Galileo GT-96100 LAN/WAN
2083           communications controllers containing a MIPS R5000 compatible core
2084 @@ -268,6 +281,7 @@
2085         bool "Support for MIPS Atlas board"
2086         select DMA_NONCOHERENT
2087         select HW_HAS_PCI
2088 +       select SWAP_IO_SPACE
2089         help
2090           This enables support for the QED R5231-based MIPS Atlas evaluation
2091           board.
2092 @@ -277,6 +291,7 @@
2093         select HAVE_STD_PC_SERIAL_PORT
2094         select DMA_NONCOHERENT
2095         select HW_HAS_PCI
2096 +       select SWAP_IO_SPACE
2097         help
2098           This enables support for the VR5000-based MIPS Malta evaluation
2099           board.
2100 @@ -294,6 +309,7 @@
2101         select IRQ_CPU
2102         select IRQ_CPU_RM7K
2103         select RM7000_CPU_SCACHE
2104 +       select SWAP_IO_SPACE
2105         help
2106           The Ocelot is a MIPS-based Single Board Computer (SBC) made by
2107           Momentum Computer <http://www.momenco.com/>.
2108 @@ -306,6 +322,7 @@
2109         select IRQ_CPU_RM7K
2110         select PCI_MARVELL
2111         select RM7000_CPU_SCACHE
2112 +       select SWAP_IO_SPACE
2113         help
2114           The Ocelot is a MIPS-based Single Board Computer (SBC) made by
2115           Momentum Computer <http://www.momenco.com/>.
2116 @@ -318,6 +335,7 @@
2117         select IRQ_MV64340
2118         select PCI_MARVELL
2119         select RM7000_CPU_SCACHE
2120 +       select SWAP_IO_SPACE
2121         help
2122           The Ocelot is a MIPS-based Single Board Computer (SBC) made by
2123           Momentum Computer <http://www.momenco.com/>.
2124 @@ -332,6 +350,7 @@
2125         select LIMITED_DMA
2126         select PCI_MARVELL
2127         select RM7000_CPU_SCACHE
2128 +       select SWAP_IO_SPACE
2129         help
2130           The Jaguar ATX is a MIPS-based Single Board Computer (SBC) made by
2131           Momentum Computer <http://www.momenco.com/>.
2132 @@ -349,6 +368,7 @@
2133         select HW_HAS_PCI
2134         select IRQ_CPU
2135         select IRQ_CPU_RM7K
2136 +       select SWAP_IO_SPACE
2137         help
2138           Yosemite is an evaluation board for the RM9000x2 processor
2139           manufactured by PMC-Sierra
2140 @@ -411,6 +431,7 @@
2141         select DMA_NONCOHERENT
2142         select IP22_CPU_SCACHE
2143         select IRQ_CPU
2144 +       select SWAP_IO_SPACE
2145         help
2146           This are the SGI Indy, Challenge S and Indigo2, as well as certain
2147           OEM variants like the Tandem CMN B006S. To compile a Linux kernel
2148 @@ -529,12 +550,14 @@
2149         depends on SOC_AU1000
2150         select DMA_NONCOHERENT
2151         select HW_HAS_PCI
2152 +       select SWAP_IO_SPACE
2153  
2154  config MIPS_PB1100
2155         bool "PB1100 board"
2156         depends on SOC_AU1100
2157         select DMA_NONCOHERENT
2158         select HW_HAS_PCI
2159 +       select SWAP_IO_SPACE
2160  
2161  config MIPS_PB1500
2162         bool "PB1500 board"
2163 @@ -596,6 +619,7 @@
2164         bool "Support for Broadcom BCM1xxx SOCs (EXPERIMENTAL)"
2165         depends on EXPERIMENTAL
2166         select DMA_COHERENT
2167 +       select SWAP_IO_SPACE
2168  
2169  choice
2170         prompt "BCM1xxx SOC-based board"
2171 @@ -818,6 +842,7 @@
2172         select DMA_NONCOHERENT
2173         select HW_HAS_PCI
2174         select ISA
2175 +       select SWAP_IO_SPACE
2176  
2177  config RWSEM_GENERIC_SPINLOCK
2178         bool
2179 @@ -934,8 +959,6 @@
2180  
2181  config SWAP_IO_SPACE
2182         bool
2183 -       depends on TOSHIBA_JMR3927 || TOSHIBA_RBTX4927 || SIBYTE_SB1xxx_SOC || SGI_IP22 || MOMENCO_OCELOT_C || MOMENCO_OCELOT_G || MOMENCO_OCELOT || MOMENCO_JAGUAR_ATX || MIPS_MALTA || MIPS_ATLAS || MIPS_EV96100 || MIPS_PB1100 || MIPS_PB1000
2184 -       default y
2185  
2186  #
2187  # Unfortunately not all GT64120 systems run the chip at the same clock.
2188 --- linux-2.6.8.1/arch/mips/kernel/cpu-probe.c  2004-08-14 12:55:10.000000000 +0200
2189 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/cpu-probe.c 2006-06-26 09:07:09.000000000 +0200
2190 @@ -538,6 +538,27 @@
2191         }
2192  }
2193  
2194 +#if defined(CONFIG_MIPS_BRCM)
2195 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
2196 +{
2197 +       decode_config1(c);
2198 +       switch (c->processor_id & 0xff00) {
2199 +       case PRID_IMP_BCM6338:          
2200 +               c->cputype = CPU_BCM6338;
2201 +               break;
2202 +       case PRID_IMP_BCM6345:
2203 +               c->cputype = CPU_BCM6345;
2204 +               break;
2205 +       case PRID_IMP_BCM6348:
2206 +               c->cputype = CPU_BCM6348;
2207 +               break;
2208 +       default:
2209 +               c->cputype = CPU_UNKNOWN;
2210 +               break;
2211 +       }
2212 +}
2213 +#endif
2214 +
2215  static inline void cpu_probe_sandcraft(struct cpuinfo_mips *c)
2216  {
2217         decode_config1(c);
2218 @@ -576,6 +597,11 @@
2219         case PRID_COMP_SIBYTE:
2220                 cpu_probe_sibyte(c);
2221                 break;
2222 +#if defined(CONFIG_MIPS_BRCM)
2223 +       case PRID_COMP_BROADCOM:
2224 +               cpu_probe_broadcom(c);
2225 +               break;
2226 +#endif
2227  
2228         case PRID_COMP_SANDCRAFT:
2229                 cpu_probe_sandcraft(c);
2230 --- linux-2.6.8.1/arch/mips/kernel/gdb-stub.c   2004-08-14 12:56:23.000000000 +0200
2231 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/gdb-stub.c  2006-06-26 09:07:09.000000000 +0200
2232 @@ -171,6 +171,8 @@
2233  static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
2234  void handle_exception(struct gdb_regs *regs);
2235  
2236 +int kgdb_enabled;
2237 +
2238  /*
2239   * spin locks for smp case
2240   */
2241 --- linux-2.6.8.1/arch/mips/kernel/irq.c        2004-08-14 12:54:50.000000000 +0200
2242 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/irq.c       2006-06-26 09:07:09.000000000 +0200
2243 @@ -30,12 +30,7 @@
2244  /*
2245   * Controller mappings for all interrupt sources:
2246   */
2247 -irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
2248 -       [0 ... NR_IRQS-1] = {
2249 -               .handler = &no_irq_type,
2250 -               .lock = SPIN_LOCK_UNLOCKED
2251 -       }
2252 -};
2253 +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned;
2254  
2255  static void register_irq_proc (unsigned int irq);
2256  
2257 @@ -809,7 +804,20 @@
2258         return 0;
2259  }
2260  
2261 -void __init init_generic_irq(void)
2262 +#ifdef CONFIG_KGDB
2263 +extern void breakpoint(void);
2264 +extern void set_debug_traps(void);
2265 +
2266 +static int kgdb_flag = 1;
2267 +static int __init nokgdb(char *str)
2268 +{
2269 +       kgdb_flag = 0;
2270 +       return 1;
2271 +}
2272 +__setup("nokgdb", nokgdb);
2273 +#endif
2274 +
2275 +void __init init_IRQ(void)
2276  {
2277         int i;
2278  
2279 @@ -818,7 +826,18 @@
2280                 irq_desc[i].action  = NULL;
2281                 irq_desc[i].depth   = 1;
2282                 irq_desc[i].handler = &no_irq_type;
2283 +               irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
2284 +       }
2285 +
2286 +       arch_init_irq();
2287 +
2288 +#ifdef CONFIG_KGDB
2289 +       if (kgdb_flag) {
2290 +               printk("Wait for gdb client connection ...\n");
2291 +               set_debug_traps();
2292 +               breakpoint();
2293         }
2294 +#endif
2295  }
2296  
2297  EXPORT_SYMBOL(disable_irq_nosync);
2298 @@ -833,7 +852,7 @@
2299  
2300  static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
2301  
2302 -static cpumask_t irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
2303 +static cpumask_t irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
2304  static int irq_affinity_read_proc (char *page, char **start, off_t off,
2305                         int count, int *eof, void *data)
2306  {
2307 --- linux-2.6.8.1/arch/mips/kernel/Makefile     2004-08-14 12:55:19.000000000 +0200
2308 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/Makefile    2006-06-26 09:07:09.000000000 +0200
2309 @@ -8,6 +8,13 @@
2310                    ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
2311                    time.o traps.o unaligned.o
2312  
2313 +# CONFIG_MIPS_BRCM Begin Broadcom added code.
2314 +# gcc 3.4.x reorders code with -Os and -O2, breaking the save_static stuff.
2315 +CFLAGS_syscall.o               := -O1
2316 +CFLAGS_signal.o                        := -O1
2317 +CFLAGS_signal32.o              := -O1
2318 +# CONFIG_MIPS_BRCM End Broadcom added code.
2319 +
2320  ifdef CONFIG_MODULES
2321  obj-y                          += mips_ksyms.o module.o
2322  obj-$(CONFIG_MIPS32)           += module-elf32.o
2323 --- linux-2.6.8.1/arch/mips/kernel/proc.c       2004-08-14 12:55:09.000000000 +0200
2324 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/proc.c      2006-06-26 09:07:09.000000000 +0200
2325 @@ -75,6 +75,11 @@
2326         [CPU_VR4133]    "NEC VR4133",
2327         [CPU_VR4181]    "NEC VR4181",
2328         [CPU_VR4181A]   "NEC VR4181A",
2329 +#if defined(CONFIG_MIPS_BRCM)
2330 +       [CPU_BCM6338]   "BCM6338",
2331 +       [CPU_BCM6345]   "BCM6345",
2332 +       [CPU_BCM6348]   "BCM6348",
2333 +#endif
2334         [CPU_SR71000]   "Sandcraft SR71000"
2335  };
2336  
2337 --- linux-2.6.8.1/arch/mips/kernel/scall32-o32.S        2004-08-14 12:54:49.000000000 +0200
2338 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/scall32-o32.S       2006-06-26 12:42:05.000000000 +0200
2339 @@ -640,9 +640,9 @@
2340         syscalltable
2341         .size   sys_call_table, . - sys_call_table
2342  
2343 -       .macro  sys function, nargs
2344 +       /*.macro        sys function, nargs
2345         .byte   \nargs
2346 -       .endm
2347 +       .endm*/
2348  
2349  sys_narg_table:
2350         syscalltable
2351 --- linux-2.6.8.1/arch/mips/kernel/time.c       2004-08-14 12:55:20.000000000 +0200
2352 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/time.c      2006-06-26 09:07:09.000000000 +0200
2353 @@ -274,11 +274,15 @@
2354  
2355         /* .. relative to previous jiffy (32 bits is enough) */
2356         count -= timerlo;
2357 -
2358 +       
2359         __asm__("multu  %1,%2"
2360                 : "=h" (res)
2361                 : "r" (count), "r" (sll32_usecs_per_cycle)
2362 +#if defined(CONFIG_MIPS_BRCM)          
2363 +               : "lo");
2364 +#else
2365                 : "lo", "accum");
2366 +#endif         
2367  
2368         /*
2369          * Due to possible jiffies inconsistencies, we need to check
2370 @@ -333,7 +337,11 @@
2371         __asm__("multu  %1,%2"
2372                 : "=h" (res)
2373                 : "r" (count), "r" (quotient)
2374 +#if defined(CONFIG_MIPS_BRCM)
2375 +               : "lo");
2376 +#else          
2377                 : "lo", "accum");
2378 +#endif         
2379  
2380         /*
2381          * Due to possible jiffies inconsistencies, we need to check
2382 @@ -375,7 +383,11 @@
2383                                 : "r" (timerhi), "m" (timerlo),
2384                                   "r" (tmp), "r" (USECS_PER_JIFFY),
2385                                   "r" (USECS_PER_JIFFY_FRAC)
2386 +#if defined(CONFIG_MIPS_BRCM)
2387 +                               : "hi", "lo");
2388 +#else                            
2389                                 : "hi", "lo", "accum");
2390 +#endif                         
2391                         cached_quotient = quotient;
2392                 }
2393         }
2394 @@ -389,7 +401,11 @@
2395         __asm__("multu  %1,%2"
2396                 : "=h" (res)
2397                 : "r" (count), "r" (quotient)
2398 +#if defined(CONFIG_MIPS_BRCM)
2399 +               : "lo");
2400 +#else          
2401                 : "lo", "accum");
2402 +#endif         
2403  
2404         /*
2405          * Due to possible jiffies inconsistencies, we need to check
2406 @@ -738,6 +754,7 @@
2407         board_timer_setup(&timer_irqaction);
2408  }
2409  
2410 +
2411  #define FEBRUARY               2
2412  #define STARTOFTIME            1970
2413  #define SECDAY                 86400L
2414 --- linux-2.6.8.1/arch/mips/kernel/traps.c      2004-08-14 12:55:20.000000000 +0200
2415 +++ linux-2.6.8.1-brcm63xx/arch/mips/kernel/traps.c     2006-06-26 09:07:09.000000000 +0200
2416 @@ -246,6 +246,13 @@
2417  
2418  static spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
2419  
2420 +#if defined(CONFIG_MIPS_BRCM)
2421 +#ifdef CONFIG_REMOTE_DEBUG
2422 +#include <asm/gdb-stub.h>
2423 +extern void handle_exception(struct gdb_regs *regs);
2424 +#endif
2425 +#endif
2426 +
2427  NORET_TYPE void __die(const char * str, struct pt_regs * regs,
2428         const char * file, const char * func, unsigned long line)
2429  {
2430 @@ -258,7 +265,33 @@
2431                 printk(" in %s:%s, line %ld", file, func, line);
2432         printk("[#%d]:\n", ++die_counter);
2433         show_registers(regs);
2434 +#if defined(CONFIG_MIPS_BRCM)
2435 +#ifdef CONFIG_REMOTE_DEBUG
2436 +        {
2437 +                struct gdb_regs regs2;
2438 +                int i;
2439 +                long *ptr;
2440 +
2441 +                ptr = &regs2.reg0;
2442 +                /* Copy registers to GDB structure */
2443 +                for(i=0; i<32;i++)
2444 +                        *ptr++ = regs->regs[i];
2445 +
2446 +                regs2.lo = regs->lo;
2447 +                regs2.hi = regs->hi;
2448 +                regs2.cp0_epc = regs->cp0_epc;
2449 +                regs2.cp0_badvaddr = regs->cp0_badvaddr;
2450 +                regs2.cp0_status = regs->cp0_status;
2451 +                regs2.cp0_cause = regs->cp0_cause;
2452 +
2453 +                handle_exception(&regs2); /* Break to GDB */
2454 +        }
2455 +#endif
2456 +#endif
2457         spin_unlock_irq(&die_lock);
2458 +       /* Ron add for kernel crash */
2459 +       (*(volatile unsigned int *)(0xfffe040c)) &= ~(1<<5);
2460 +       machine_restart(NULL);
2461         do_exit(SIGSEGV);
2462  }
2463  
2464 --- linux-2.6.8.1/arch/mips/Makefile    2004-08-14 12:54:47.000000000 +0200
2465 +++ linux-2.6.8.1-brcm63xx/arch/mips/Makefile   2006-06-26 09:07:09.000000000 +0200
2466 @@ -41,8 +41,14 @@
2467  endif
2468  
2469  ifdef CONFIG_CROSSCOMPILE
2470 +# CONFIG_MIPS_BRCM Begin Broadcom added code.
2471 +ifdef CONFIG_MIPS_BRCM
2472 +CROSS_COMPILE          := mips-linux-uclibc-#$(tool-prefix)
2473 +else
2474  CROSS_COMPILE          := $(tool-prefix)
2475  endif
2476 +# CONFIG_MIPS_BRCM End Broadcom added code.
2477 +endif
2478  
2479  #
2480  # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
2481 @@ -57,6 +63,9 @@
2482  cflags-y                       := -I $(TOPDIR)/include/asm/gcc
2483  cflags-y                       += -G 0 -mno-abicalls -fno-pic -pipe
2484  cflags-y                       += $(call check_gcc, -finline-limit=100000,)
2485 +ifeq ($(strip $(JTAG_KERNEL_DEBUG)),y)
2486 +cflags-y                       += -g
2487 +endif
2488  LDFLAGS_vmlinux                        += -G 0 -static -n
2489  MODFLAGS                       += -mlong-calls
2490  
2491 @@ -64,6 +73,12 @@
2492  
2493  check_warning = $(shell if $(CC) $(1) -c -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
2494  
2495 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
2496 +ifdef CONFIG_MIPS_BRCM 
2497 +cflags-$(CONFIG_REMOTE_DEBUG)  += -ggdb
2498 +endif
2499 +# CONFIG_MIPS_BRCM End Broadcom changed code.
2500 +
2501  #
2502  # Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>)
2503  #
2504 @@ -302,6 +317,20 @@
2505  libs-$(CONFIG_BAGET_MIPS)      += arch/mips/baget/ arch/mips/baget/prom/
2506  load-$(CONFIG_BAGET_MIPS)      += 0x80001000
2507  
2508 +# CONFIG_MIPS_BRCM Begin Broadcom added code.
2509 +ifdef CONFIG_MIPS_BRCM
2510 +#
2511 +# Broadcom board
2512 +core-$(CONFIG_BCM96338)                += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm963xx/
2513 +cflags-$(CONFIG_BCM96338)      += -Iinclude/asm-mips/mach-bcm963xx
2514 +core-$(CONFIG_BCM96345)                += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm963xx/
2515 +cflags-$(CONFIG_BCM96345)      += -Iinclude/asm-mips/mach-bcm963xx
2516 +core-$(CONFIG_BCM96348)                += arch/mips/brcm-boards/generic/ arch/mips/brcm-boards/bcm963xx/
2517 +cflags-$(CONFIG_BCM96348)      += -Iinclude/asm-mips/mach-bcm963xx
2518 +load-$(CONFIG_MIPS_BRCM)       += 0x80010000
2519 +endif
2520 +# CONFIG_MIPS_BRCM End Broadcom added code.
2521 +
2522  #
2523  # Cobalt Server
2524  #
2525 --- linux-2.6.8.1/arch/mips/mm/c-r4k.c  2004-08-14 12:56:22.000000000 +0200
2526 +++ linux-2.6.8.1-brcm63xx/arch/mips/mm/c-r4k.c 2006-06-26 09:07:09.000000000 +0200
2527 @@ -86,7 +86,7 @@
2528  
2529  static void (* r4k_blast_dcache)(void);
2530  
2531 -static void r4k_blast_dcache_setup(void)
2532 +static inline void r4k_blast_dcache_setup(void)
2533  {
2534         unsigned long dc_lsize = cpu_dcache_line_size();
2535  
2536 @@ -385,6 +385,7 @@
2537  static void r4k_flush_icache_range(unsigned long start, unsigned long end)
2538  {
2539         unsigned long dc_lsize = current_cpu_data.dcache.linesz;
2540 +       unsigned long ic_lsize = current_cpu_data.icache.linesz;
2541         unsigned long addr, aend;
2542  
2543         if (!cpu_has_ic_fills_f_dc) {
2544 @@ -407,14 +408,14 @@
2545         if (end - start > icache_size)
2546                 r4k_blast_icache();
2547         else {
2548 -               addr = start & ~(dc_lsize - 1);
2549 -               aend = (end - 1) & ~(dc_lsize - 1);
2550 +               addr = start & ~(ic_lsize - 1);
2551 +               aend = (end - 1) & ~(ic_lsize - 1);
2552                 while (1) {
2553                         /* Hit_Invalidate_I */
2554                         protected_flush_icache_line(addr);
2555                         if (addr == aend)
2556                                 break;
2557 -                       addr += dc_lsize;
2558 +                       addr += ic_lsize;
2559                 }
2560         }
2561  }
2562 @@ -802,6 +803,13 @@
2563                 if (!(config & MIPS_CONF_M))
2564                         panic("Don't know how to probe P-caches on this cpu.");
2565  
2566 +#if defined(CONFIG_MIPS_BRCM)
2567 +               if (c->cputype == CPU_BCM6338 || c->cputype == CPU_BCM6345 || c->cputype == CPU_BCM6348){
2568 +                       printk("brcm mips: enabling icache and dcache...\n");
2569 +                       /* Enable caches */
2570 +                       write_c0_diag(read_c0_diag() | 0xC0000000);
2571 +               }
2572 +#endif
2573                 /*
2574                  * So we seem to be a MIPS32 or MIPS64 CPU
2575                  * So let's probe the I-cache ...
2576 --- linux-2.6.8.1/arch/mips/pci/fixup-bcm96348.c        1970-01-01 01:00:00.000000000 +0100
2577 +++ linux-2.6.8.1-brcm63xx/arch/mips/pci/fixup-bcm96348.c       2006-06-26 09:07:09.000000000 +0200
2578 @@ -0,0 +1,85 @@
2579 +/*
2580 +<:copyright-gpl 
2581 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
2582
2583 + This program is free software; you can distribute it and/or modify it 
2584 + under the terms of the GNU General Public License (Version 2) as 
2585 + published by the Free Software Foundation. 
2586
2587 + This program is distributed in the hope it will be useful, but WITHOUT 
2588 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
2589 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
2590 + for more details. 
2591
2592 + You should have received a copy of the GNU General Public License along 
2593 + with this program; if not, write to the Free Software Foundation, Inc., 
2594 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
2595 +:>
2596 +*/
2597 +#include <linux/init.h>
2598 +#include <linux/types.h>
2599 +#include <linux/pci.h>
2600 +
2601 +#include <bcmpci.h>
2602 +#include <bcm_intr.h>
2603 +#include <bcm_map_part.h>
2604 +
2605 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
2606 +
2607 +static char irq_tab_bcm96348[] __initdata = {
2608 +    [0] = INTERRUPT_ID_MPI,
2609 +    [1] = INTERRUPT_ID_MPI,
2610 +#if defined(CONFIG_USB)
2611 +    [USB_HOST_SLOT] = INTERRUPT_ID_USBH
2612 +#endif
2613 +};
2614 +
2615 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
2616 +{
2617 +    return irq_tab_bcm96348[slot];
2618 +}
2619 +
2620 +static void bcm96348_fixup(struct pci_dev *dev)
2621 +{
2622 +    uint32 memaddr;
2623 +    uint32 size;
2624 +
2625 +    memaddr = pci_resource_start(dev, 0);
2626 +    size = pci_resource_len(dev, 0);
2627 +
2628 +    switch (PCI_SLOT(dev->devfn)) {
2629 +        case 0:
2630 +            // UBUS to PCI address range
2631 +            // Memory Window 1. Mask determines which bits are decoded.
2632 +            mpi->l2pmrange1 = ~(size-1);
2633 +            // UBUS to PCI Memory base address. This is akin to the ChipSelect base
2634 +            // register. 
2635 +            mpi->l2pmbase1 = memaddr & BCM_PCI_ADDR_MASK;
2636 +            // UBUS to PCI Remap Address. Replaces the masked address bits in the
2637 +            // range register with this setting. 
2638 +            // Also, enable direct I/O and direct Memory accesses
2639 +            mpi->l2pmremap1 = (memaddr | MEM_WINDOW_EN);
2640 +            break;
2641 +
2642 +        case 1:
2643 +            // Memory Window 2
2644 +            mpi->l2pmrange2 = ~(size-1);
2645 +            // UBUS to PCI Memory base address. 
2646 +            mpi->l2pmbase2 = memaddr & BCM_PCI_ADDR_MASK;
2647 +            // UBUS to PCI Remap Address
2648 +            mpi->l2pmremap2 = (memaddr | MEM_WINDOW_EN);
2649 +            break;
2650 +
2651 +#if defined(CONFIG_USB)
2652 +        case USB_HOST_SLOT:
2653 +            dev->resource[0].start = USB_HOST_BASE;
2654 +            dev->resource[0].end = USB_HOST_BASE+USB_BAR0_MEM_SIZE-1;
2655 +            break;
2656 +#endif
2657 +    }
2658 +}
2659 +
2660 +struct pci_fixup pcibios_fixups[] = {
2661 +    { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, bcm96348_fixup },
2662 +    {0}
2663 +};
2664 --- linux-2.6.8.1/arch/mips/pci/ops-bcm96348.c  1970-01-01 01:00:00.000000000 +0100
2665 +++ linux-2.6.8.1-brcm63xx/arch/mips/pci/ops-bcm96348.c 2006-06-26 09:07:09.000000000 +0200
2666 @@ -0,0 +1,276 @@
2667 +/*
2668 +<:copyright-gpl 
2669 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
2670
2671 + This program is free software; you can distribute it and/or modify it 
2672 + under the terms of the GNU General Public License (Version 2) as 
2673 + published by the Free Software Foundation. 
2674
2675 + This program is distributed in the hope it will be useful, but WITHOUT 
2676 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
2677 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
2678 + for more details. 
2679
2680 + You should have received a copy of the GNU General Public License along 
2681 + with this program; if not, write to the Free Software Foundation, Inc., 
2682 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
2683 +:>
2684 +*/
2685 +#include <linux/types.h>
2686 +#include <linux/pci.h>
2687 +#include <linux/kernel.h>
2688 +#include <linux/init.h>
2689 +#include <asm/addrspace.h>
2690 +
2691 +#include <bcm_intr.h>
2692 +#include <bcm_map_part.h>
2693 +#include <bcmpci.h>
2694 +
2695 +#include <linux/delay.h>
2696 +
2697 +#if defined(CONFIG_USB)
2698 +#if 0
2699 +#define DPRINT(x...)        printk(x)
2700 +#else
2701 +#define DPRINT(x...)
2702 +#endif
2703 +
2704 +static int 
2705 +pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size);
2706 +static int 
2707 +pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size);
2708 +
2709 +static bool usb_mem_size_rd = FALSE;
2710 +static uint32 usb_mem_base = 0;
2711 +static uint32 usb_cfg_space_cmd_reg = 0;
2712 +#endif
2713 +static bool pci_mem_size_rd = FALSE;
2714 +
2715 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
2716 +
2717 +static void mpi_SetupPciConfigAccess(uint32 addr)
2718 +{
2719 +    mpi->l2pcfgctl = (DIR_CFG_SEL | DIR_CFG_USEREG | addr) & ~CONFIG_TYPE;
2720 +}
2721 +
2722 +static void mpi_ClearPciConfigAccess(void)
2723 +{
2724 +    mpi->l2pcfgctl = 0x00000000;
2725 +}
2726 +
2727 +#if defined(CONFIG_USB)
2728 +/* --------------------------------------------------------------------------
2729 +    Name: pci63xx_int_write
2730 +Abstract: PCI Config write on internal device(s)
2731 + -------------------------------------------------------------------------- */
2732 +static int 
2733 +pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size)
2734 +{
2735 +    if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
2736 +        return PCIBIOS_SUCCESSFUL;
2737 +    }
2738 +
2739 +    switch (size) {
2740 +        case 1:
2741 +            DPRINT("W => Slot: %d Where: %2X Len: %d Data: %02X\n", 
2742 +                PCI_SLOT(devfn), where, size, *value);
2743 +            break;
2744 +        case 2:
2745 +            DPRINT("W => Slot: %d Where: %2X Len: %d Data: %04X\n", 
2746 +                PCI_SLOT(devfn), where, size, *value);
2747 +            switch (where) {
2748 +                case PCI_COMMAND:
2749 +                    usb_cfg_space_cmd_reg = *value;
2750 +                    break;
2751 +                default:
2752 +                    break;
2753 +            }
2754 +            break;
2755 +        case 4:
2756 +            DPRINT("W => Slot: %d Where: %2X Len: %d Data: %08lX\n", 
2757 +                PCI_SLOT(devfn), where, size, *value);
2758 +            switch (where) {
2759 +                case PCI_BASE_ADDRESS_0:
2760 +                    if (*value == 0xffffffff) {
2761 +                        usb_mem_size_rd = TRUE;
2762 +                    } else {
2763 +                        usb_mem_base = *value;
2764 +                    }
2765 +                    break;
2766 +                default:
2767 +                    break;
2768 +            }
2769 +            break;
2770 +        default:
2771 +            break;
2772 +    }
2773 +
2774 +    return PCIBIOS_SUCCESSFUL;
2775 +}
2776 +
2777 +/* --------------------------------------------------------------------------
2778 +    Name: pci63xx_int_read
2779 +Abstract: PCI Config read on internal device(s)
2780 + -------------------------------------------------------------------------- */
2781 +static int 
2782 +pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size)
2783 +{
2784 +    uint32 retValue = 0xFFFFFFFF;
2785 +
2786 +    if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
2787 +        return PCIBIOS_SUCCESSFUL;
2788 +    }
2789 +
2790 +    // For now, this is specific to the USB Host controller. We can
2791 +    // make it more general if we have to...
2792 +    // Emulate PCI Config accesses
2793 +    switch (where) {
2794 +        case PCI_VENDOR_ID:     
2795 +        case PCI_DEVICE_ID:
2796 +            retValue = PCI_VENDOR_ID_BROADCOM | 0x63000000;
2797 +            break;
2798 +        case PCI_COMMAND:
2799 +        case PCI_STATUS:
2800 +            retValue = (0x0006 << 16) | usb_cfg_space_cmd_reg;
2801 +            break;
2802 +        case PCI_CLASS_REVISION:
2803 +        case PCI_CLASS_DEVICE:
2804 +            retValue = (PCI_CLASS_SERIAL_USB << 16) | (0x10 << 8) | 0x01;
2805 +            break;
2806 +        case PCI_BASE_ADDRESS_0:
2807 +            if (usb_mem_size_rd) {
2808 +                retValue = USB_BAR0_MEM_SIZE;
2809 +            } else {
2810 +                if (usb_mem_base != 0)
2811 +                    retValue = usb_mem_base;
2812 +                else
2813 +                    retValue = USB_HOST_BASE;
2814 +            }
2815 +            usb_mem_size_rd = FALSE;
2816 +            break;
2817 +        case PCI_CACHE_LINE_SIZE:
2818 +        case PCI_LATENCY_TIMER:
2819 +            retValue = 0;
2820 +            break;
2821 +        case PCI_HEADER_TYPE:
2822 +            retValue = PCI_HEADER_TYPE_NORMAL;
2823 +            break;
2824 +        case PCI_SUBSYSTEM_VENDOR_ID:
2825 +            retValue = PCI_VENDOR_ID_BROADCOM;
2826 +            break;
2827 +        case PCI_SUBSYSTEM_ID:
2828 +            retValue = 0x6300;
2829 +            break;
2830 +        case PCI_INTERRUPT_LINE:
2831 +            retValue = INTERRUPT_ID_USBH; 
2832 +            break;
2833 +        default:
2834 +            break;
2835 +    }
2836 +
2837 +    switch (size) {
2838 +        case 1:
2839 +            *value = (retValue >> ((where & 3) << 3)) & 0xff;
2840 +            DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %02X\n", 
2841 +                PCI_SLOT(devfn), where, size, *value);
2842 +            break;
2843 +        case 2:
2844 +            *value = (retValue >> ((where & 3) << 3)) & 0xffff;
2845 +            DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %04X\n", 
2846 +                PCI_SLOT(devfn), where, size, *value);
2847 +            break;
2848 +        case 4:
2849 +            *value = retValue;
2850 +            DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %08lX\n", 
2851 +                PCI_SLOT(devfn), where, size, *value);
2852 +            break;
2853 +        default:
2854 +            break;
2855 +    }
2856 +
2857 +    return PCIBIOS_SUCCESSFUL;
2858 +}
2859 +#endif
2860 +
2861 +static int bcm96348_pcibios_read(struct pci_bus *bus, unsigned int devfn,
2862 +       int where, int size, u32 * val)
2863 +{
2864 +    volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
2865 +    uint32 data;
2866 +
2867 +#if defined(CONFIG_USB)
2868 +    if (PCI_SLOT(devfn) == USB_HOST_SLOT)
2869 +        return pci63xx_int_read(devfn, where, val, size);
2870 +#endif
2871 +
2872 +    mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
2873 +    data = *(uint32 *)ioBase;
2874 +    switch(size) {
2875 +        case 1:
2876 +            *val = (data >> ((where & 3) << 3)) & 0xff;
2877 +            break;
2878 +        case 2:
2879 +            *val = (data >> ((where & 3) << 3)) & 0xffff;
2880 +            break;
2881 +        case 4:
2882 +            *val = data;
2883 +             /* Special case for reading PCI device range */
2884 +            if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
2885 +                if (pci_mem_size_rd) {
2886 +                    /* bcm6348 PCI memory window minimum size is 64K */
2887 +                    *val &= PCI_SIZE_64K;
2888 +                }
2889 +            }
2890 +            break;
2891 +        default:
2892 +            break;
2893 +    }
2894 +    pci_mem_size_rd = FALSE;
2895 +    mpi_ClearPciConfigAccess();
2896 +
2897 +    return PCIBIOS_SUCCESSFUL;
2898 +}
2899 +
2900 +static int bcm96348_pcibios_write(struct pci_bus *bus, unsigned int devfn,
2901 +       int where, int size, u32 val)
2902 +{
2903 +    volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
2904 +    uint32 data;
2905 +
2906 +#if defined(CONFIG_USB)
2907 +    if (PCI_SLOT(devfn) == USB_HOST_SLOT)
2908 +        return pci63xx_int_write(devfn, where, &val, size);
2909 +#endif
2910 +    mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
2911 +    data = *(uint32 *)ioBase;
2912 +    switch(size) {
2913 +        case 1:
2914 +            data = (data & ~(0xff << ((where & 3) << 3))) |
2915 +                (val << ((where & 3) << 3));
2916 +            break;
2917 +        case 2:
2918 +            data = (data & ~(0xffff << ((where & 3) << 3))) |
2919 +                (val << ((where & 3) << 3));
2920 +            break;
2921 +        case 4:
2922 +            data = val;
2923 +            /* Special case for reading PCI device range */
2924 +            if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
2925 +                if (val == 0xffffffff)
2926 +                    pci_mem_size_rd = TRUE;
2927 +            }
2928 +            break;
2929 +        default:
2930 +            break;
2931 +    }
2932 +    *(uint32 *)ioBase = data;
2933 +    udelay(500);
2934 +    mpi_ClearPciConfigAccess();
2935 +
2936 +    return PCIBIOS_SUCCESSFUL;
2937 +}
2938 +
2939 +struct pci_ops bcm96348_pci_ops = {
2940 +    .read   = bcm96348_pcibios_read,
2941 +    .write  = bcm96348_pcibios_write
2942 +};
2943 --- linux-2.6.8.1/arch/mips/pci/Makefile        2004-08-14 12:54:47.000000000 +0200
2944 +++ linux-2.6.8.1-brcm63xx/arch/mips/pci/Makefile       2006-06-26 09:07:09.000000000 +0200
2945 @@ -17,6 +17,8 @@
2946  obj-$(CONFIG_MIPS_NILE4)       += ops-nile4.o
2947  obj-$(CONFIG_MIPS_TX3927)      += ops-jmr3927.o
2948  obj-$(CONFIG_PCI_VR41XX)       += ops-vr41xx.o pci-vr41xx.o
2949 +obj-$(CONFIG_PCI_VR41XX)       += ops-vr41xx.o pci-vr41xx.o
2950 +obj-$(CONFIG_BCM_PCI)          += fixup-bcm96348.o pci-bcm96348.o ops-bcm96348.o
2951  
2952  #
2953  # These are still pretty much in the old state, watch, go blind.
2954 @@ -51,3 +53,7 @@
2955  obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o ops-tx4927.o
2956  obj-$(CONFIG_VICTOR_MPC30X)    += fixup-mpc30x.o
2957  obj-$(CONFIG_ZAO_CAPCELLA)     += fixup-capcella.o
2958 +
2959 +ifeq "$(CONFIG_BCM_PCI)" "y"
2960 +EXTRA_CFLAGS += -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
2961 +endif
2962 --- linux-2.6.8.1/arch/mips/pci/pci-bcm96348.c  1970-01-01 01:00:00.000000000 +0100
2963 +++ linux-2.6.8.1-brcm63xx/arch/mips/pci/pci-bcm96348.c 2006-06-26 09:07:09.000000000 +0200
2964 @@ -0,0 +1,54 @@
2965 +/*
2966 +<:copyright-gpl 
2967 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
2968
2969 + This program is free software; you can distribute it and/or modify it 
2970 + under the terms of the GNU General Public License (Version 2) as 
2971 + published by the Free Software Foundation. 
2972
2973 + This program is distributed in the hope it will be useful, but WITHOUT 
2974 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
2975 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
2976 + for more details. 
2977
2978 + You should have received a copy of the GNU General Public License along 
2979 + with this program; if not, write to the Free Software Foundation, Inc., 
2980 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
2981 +:>
2982 +*/
2983 +#include <linux/types.h>
2984 +#include <linux/pci.h>
2985 +#include <linux/kernel.h>
2986 +#include <linux/init.h>
2987 +
2988 +#include <asm/pci_channel.h>
2989 +#include <bcmpci.h>
2990 +
2991 +static struct resource bcm_pci_io_resource = {
2992 +    .name   = "bcm96348 pci IO space",
2993 +    .start  = BCM_PCI_IO_BASE,
2994 +    .end    = BCM_PCI_IO_BASE + BCM_PCI_IO_SIZE_64KB - 1,
2995 +    .flags  = IORESOURCE_IO
2996 +};
2997 +
2998 +static struct resource bcm_pci_mem_resource = {
2999 +    .name   = "bcm96348 pci memory space",
3000 +    .start  = BCM_PCI_MEM_BASE,
3001 +    .end    = BCM_PCI_MEM_BASE + BCM_PCI_MEM_SIZE_16MB - 1,
3002 +    .flags  = IORESOURCE_MEM
3003 +};
3004 +
3005 +extern struct pci_ops bcm96348_pci_ops;
3006 +
3007 +struct pci_controller bcm96348_controller = {
3008 +    .pci_ops   = &bcm96348_pci_ops,
3009 +    .io_resource       = &bcm_pci_io_resource,
3010 +    .mem_resource      = &bcm_pci_mem_resource,
3011 +};
3012 +
3013 +static void bcm96348_pci_init(void)
3014 +{
3015 +    register_pci_controller(&bcm96348_controller);
3016 +}
3017 +
3018 +arch_initcall(bcm96348_pci_init);
3019 --- linux-2.6.8.1/drivers/mtd/maps/bcm963xx.c   1970-01-01 01:00:00.000000000 +0100
3020 +++ linux-2.6.8.1-brcm63xx/drivers/mtd/maps/bcm963xx.c  2006-06-26 09:07:13.000000000 +0200
3021 @@ -0,0 +1,162 @@
3022 +/*
3023 + * A simple flash mapping code for BCM963xx board flash memory
3024 + * It is simple because it only treats all the flash memory as ROM
3025 + * It is used with chips/map_rom.c
3026 + *
3027 + *  Song Wang (songw@broadcom.com)
3028 + */
3029 +#include <linux/module.h>
3030 +#include <linux/types.h>
3031 +#include <linux/kernel.h>
3032 +#include <linux/init.h>
3033 +#include <asm/io.h>
3034 +#include <linux/mtd/mtd.h>
3035 +#include <linux/mtd/map.h>
3036 +#include <linux/config.h>
3037 +#include <linux/mtd/partitions.h>
3038 +
3039 +#include <board.h>
3040 +#include <bcmTag.h>
3041 +#define  VERSION       "1.0"
3042 +
3043 +
3044 +extern PFILE_TAG kerSysImageTagGet(void);
3045 +
3046 +static struct mtd_info *mymtd;
3047 +static struct mtd_partition brcm_partition_info[4];
3048 +
3049 +#define CFE_ADDR       0xbfc00000
3050 +#define CFE_SIZE       64 << 10
3051 +#define FLASH_2M_SIZE  2048 << 10
3052 +#define FLASH_4M_SIZE  4096 << 10
3053 +#define NVRAM_SIZE     64 << 10
3054 +#define TAG_SIZE       0x100
3055 +#define FS_KERNEL_SIZE_4M      0x3E0000
3056 +#define NVRAM_ADDR_4M  0x3F0000
3057 +
3058 +static map_word brcm_physmap_read16(struct map_info *map, unsigned long ofs)
3059 +{
3060 +       map_word val;
3061 +       
3062 +       val.x[0] = __raw_readw(map->map_priv_1 + ofs);
3063 +       
3064 +       return val;
3065 +}
3066 +
3067 +void brcm_physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
3068 +{
3069 +       memcpy_fromio(to, map->map_priv_1 + from, len);
3070 +}
3071 +
3072 +static void brcm_physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
3073 +{
3074 +       __raw_writew(d, map->map_priv_1 + adr);
3075 +       mb();
3076 +}
3077 +
3078 +void brcm_physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
3079 +{
3080 +       memcpy_toio(map->map_priv_1 + to, from, len);
3081 +}
3082 +
3083 +struct map_info brcm_physmap_map = {
3084 +       .name = "Physically mapped flash",
3085 +       .bankwidth      = 2,
3086 +       .read = brcm_physmap_read16,
3087 +       .copy_from = brcm_physmap_copy_from,
3088 +       .write = brcm_physmap_write16,
3089 +       .copy_to = brcm_physmap_copy_to
3090 +
3091 +};
3092 +
3093 +
3094 +
3095 +int __init init_brcm_physmap(void)
3096 +{
3097 +        PFILE_TAG pTag = NULL;
3098 +        u_int32_t rootfs_addr, kernel_addr,fs_len,cfe_len;
3099 +        FLASH_ADDR_INFO info;
3100 +
3101 +        kerSysFlashAddrInfoGet( &info );
3102 +
3103 +        /* Read the flash memory map from flash memory. */
3104 +        if (!(pTag = kerSysImageTagGet())) {
3105 +                printk("Failed to read image tag from flash\n");
3106 +                return -EIO;
3107 +        }
3108 +
3109 +        rootfs_addr = (u_int32_t) simple_strtoul(pTag->rootfsAddress, NULL, 10);
3110 +        kernel_addr = (u_int32_t) simple_strtoul(pTag->kernelAddress, NULL, 10);
3111 +       
3112 +       
3113 +       brcm_physmap_map.size = FLASH_4M_SIZE;
3114 +       
3115 +       fs_len = kernel_addr - rootfs_addr;
3116 +       cfe_len=CFE_SIZE;
3117 +       /* Ron mapping from fs */
3118 +       brcm_physmap_map.map_priv_1 = (unsigned long)CFE_ADDR;
3119 +
3120 +       if (!brcm_physmap_map.map_priv_1) {
3121 +               printk("Wrong flash starting address\n");
3122 +               return -EIO;
3123 +       }
3124 +       
3125 +       if (brcm_physmap_map.size <= 0) {
3126 +               printk("Wrong flash size\n");
3127 +               return -EIO;
3128 +       }       
3129 +       
3130 +       mymtd = do_map_probe("cfi_probe", &brcm_physmap_map);
3131 +       if (!mymtd)
3132 +               return -EIO;
3133 +       
3134 +       mymtd->owner = THIS_MODULE;
3135 +       /* Ron file system */
3136 +       brcm_partition_info[0].name = "fs";
3137 +       brcm_partition_info[0].offset = (cfe_len + TAG_SIZE);
3138 +       brcm_partition_info[0].size = fs_len;
3139 +       brcm_partition_info[0].mask_flags = 0;
3140 +       
3141 +       /* Ron tag + file system + kernel */
3142 +       brcm_partition_info[1].name = "tag+fs+kernel";
3143 +       brcm_partition_info[1].offset = cfe_len;
3144 +       brcm_partition_info[1].size = FS_KERNEL_SIZE_4M; 
3145 +       brcm_partition_info[1].mask_flags = 0;
3146 +
3147 +       /* Ron bootloader */
3148 +       brcm_partition_info[2].name = "bootloader";
3149 +       brcm_partition_info[2].offset = 0x00;
3150 +       brcm_partition_info[2].size = cfe_len;
3151 +       brcm_partition_info[2].mask_flags = 0;
3152 +
3153 +       /* Ron nvram */
3154 +       brcm_partition_info[3].name = "nvram";
3155 +       brcm_partition_info[3].offset = NVRAM_ADDR_4M;
3156 +       brcm_partition_info[3].size = NVRAM_SIZE;
3157 +       brcm_partition_info[3].mask_flags = 0;
3158 +       
3159 +       add_mtd_partitions(mymtd, brcm_partition_info, 4);
3160 +
3161 +       return 0;
3162 +
3163 +}
3164 +
3165 +static void __exit cleanup_brcm_physmap(void)
3166 +{
3167 +if (mymtd) {
3168 +       del_mtd_partitions(mymtd);
3169 +       del_mtd_device(mymtd);
3170 +       map_destroy(mymtd);
3171 +}
3172 +if (brcm_physmap_map.map_priv_1) {
3173 +       brcm_physmap_map.map_priv_1 = 0;
3174 +}
3175 +}
3176 +
3177 +module_init(init_brcm_physmap);
3178 +module_exit(cleanup_brcm_physmap);
3179 +
3180 +
3181 +MODULE_LICENSE("GPL");
3182 +MODULE_AUTHOR("Song Wang songw@broadcom.com");
3183 +MODULE_DESCRIPTION("Configurable MTD map driver for read-only root file system");
3184 --- linux-2.6.8.1/drivers/mtd/maps/Makefile     2004-08-14 12:54:46.000000000 +0200
3185 +++ linux-2.6.8.1-brcm63xx/drivers/mtd/maps/Makefile    2006-06-26 09:07:13.000000000 +0200
3186 @@ -39,13 +39,13 @@
3187  obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
3188  obj-$(CONFIG_MTD_DBOX2)                += dbox2-flash.o
3189  obj-$(CONFIG_MTD_OCELOT)       += ocelot.o
3190 +obj-$(CONFIG_MTD_LASAT)                += lasat.o
3191  obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
3192  obj-$(CONFIG_MTD_PCI)          += pci.o
3193 -obj-$(CONFIG_MTD_PB1XXX)       += pb1xxx-flash.o
3194 -obj-$(CONFIG_MTD_DB1X00)        += db1x00-flash.o
3195 -obj-$(CONFIG_MTD_PB1550)        += pb1550-flash.o
3196 -obj-$(CONFIG_MTD_DB1550)        += db1550-flash.o
3197  obj-$(CONFIG_MTD_LASAT)                += lasat.o
3198 +obj-$(CONFIG_MTD_DB1X00)       += db1x00-flash.o
3199 +obj-$(CONFIG_MTD_PB1550)       += pb1550-flash.o
3200 +obj-$(CONFIG_MTD_DB1550)       += db1550-flash.o
3201  obj-$(CONFIG_MTD_AUTCPU12)     += autcpu12-nvram.o
3202  obj-$(CONFIG_MTD_EDB7312)      += edb7312.o
3203  obj-$(CONFIG_MTD_IMPA7)                += impa7.o
3204 @@ -64,3 +64,11 @@
3205  obj-$(CONFIG_MTD_IXP4XX)       += ixp4xx.o
3206  obj-$(CONFIG_MTD_WRSBC8260)    += wr_sbc82xx_flash.o
3207  obj-$(CONFIG_MTD_DMV182)       += dmv182.o
3208 +obj-$(CONFIG_MTD_PB1000)        += pb1xxx-flash.o
3209 +obj-$(CONFIG_MTD_PB1100)        += pb1xxx-flash.o
3210 +obj-$(CONFIG_MTD_PB1500)        += pb1xxx-flash.o
3211 +obj-$(CONFIG_MTD_DB1X00)        += db1x00-flash.o
3212 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
3213 +obj-$(CONFIG_MTD_BCM963XX)      += bcm963xx.o
3214 +EXTRA_CFLAGS                   += -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
3215 +# CONFIG_MIPS_BRCM End Broadcom changed code.
3216 --- linux-2.6.8.1/drivers/mtd/maps/Kconfig      2004-08-14 12:56:23.000000000 +0200
3217 +++ linux-2.6.8.1-brcm63xx/drivers/mtd/maps/Kconfig     2006-06-26 09:07:13.000000000 +0200
3218 @@ -60,6 +60,12 @@
3219           Ignore this option if you use run-time physmap configuration
3220           (i.e., run-time calling physmap_configure()).
3221  
3222 +config MTD_BCM963XX
3223 +       tristate "Broadcom 963xx ADSL board flash memory support"
3224 +       depends on MIPS_BRCM
3225 +       help
3226 +         Broadcom 963xx ADSL board flash memory
3227 +
3228  config MTD_SUN_UFLASH
3229         tristate "Sun Microsystems userflash support"
3230         depends on (SPARC32 || SPARC64) && MTD_CFI
3231 @@ -182,41 +188,12 @@
3232         help
3233           Support for the flash chip on Tsunami TIG bus.
3234  
3235 -config MTD_LASAT
3236 -       tristate "Flash chips on LASAT board"
3237 -       depends on LASAT
3238 -       help
3239 -         Support for the flash chips on the Lasat 100 and 200 boards.
3240 -
3241  config MTD_NETtel
3242         tristate "CFI flash device on SnapGear/SecureEdge"
3243         depends on X86 && MTD_PARTITIONS && MTD_JEDECPROBE
3244         help
3245           Support for flash chips on NETtel/SecureEdge/SnapGear boards.
3246  
3247 -config MTD_PB1XXX
3248 -       tristate "Flash devices on Alchemy PB1xxx boards"
3249 -       depends on MIPS && ( MIPS_PB1000 || MIPS_PB1100 || MIPS_PB1500 )
3250 -       help
3251 -         Flash memory access on Alchemy Pb1000/Pb1100/Pb1500 boards
3252 -
3253 -config MTD_PB1XXX_BOOT
3254 -       bool "PB1x00 boot flash device"
3255 -       depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
3256 -       help
3257 -         Use the first of the two 32MiB flash banks on Pb1100/Pb1500 board.
3258 -         You can say 'Y' to both this and 'MTD_PB1XXX_USER' below, to use
3259 -         both banks.
3260 -
3261 -config MTD_PB1XXX_USER
3262 -       bool "PB1x00 user flash device"
3263 -       depends on MTD_PB1XXX && ( MIPS_PB1100 || MIPS_PB1500 )
3264 -       default y if MTD_PB1XX_BOOT = n
3265 -       help
3266 -         Use the second of the two 32MiB flash banks on Pb1100/Pb1500 board.
3267 -         You can say 'Y' to both this and 'MTD_PB1XXX_BOOT' above, to use
3268 -         both banks.
3269 -
3270  config MTD_PB1550
3271         tristate "Flash devices on Alchemy PB1550 board"
3272         depends on MIPS && MIPS_PB1550
3273 @@ -338,6 +315,80 @@
3274           Mapping for the Flaga digital module. If you don´t have one, ignore
3275           this setting.
3276  
3277 +config MTD_PB1000
3278 +       tristate "Pb1000 Boot Flash device"
3279 +       depends on MIPS && MIPS_PB1000
3280 +       help
3281 +         Flash memory access on Alchemy Pb1000
3282 +
3283 +config MTD_PB1100
3284 +       tristate "Pb1100 Flash device"
3285 +       depends on MIPS && MIPS_PB1100
3286 +       help
3287 +         Flash memory access on Alchemy Pb1100
3288 +
3289 +config MTD_PB1500
3290 +       tristate "Pb1500 Flash device"
3291 +       depends on MIPS && MIPS_PB1500
3292 +       help
3293 +         Flash memory access on Alchemy Pb1500
3294 +
3295 +config MTD_PB1500_BOOT
3296 +       bool "Pb1100/Pb1500 Boot Flash device"
3297 +       depends on MIPS && (MTD_PB1500 || MTD_PB1100)
3298 +       help
3299 +         Use the first of the two 32MB flash banks on Pb1100/Pb1500 board.
3300 +         You can say 'Y' to both this and the USER flash option, to use
3301 +         both banks.
3302 +
3303 +config MTD_PB1500_USER
3304 +       bool "Pb1100/Pb1500 User Flash device (2nd 32MB bank)"
3305 +       depends on MIPS && (MTD_PB1500 || MTD_PB1100)
3306 +       help
3307 +         Use the second of the two 32MB flash banks on Pb1100/Pb1500 board.
3308 +         You can say 'Y' to both this and the BOOT flash option, to use
3309 +         both banks.
3310 +
3311 +config MTD_DB1X00
3312 +       tristate "Db1X00 Flash device"
3313 +       depends on MIPS && (MIPS_DB1000 || MIPS_DB1100 || MIPS_DB1500)
3314 +       help
3315 +         Flash memory access on Alchemy Db1X00 Boards
3316 +
3317 +config MTD_DB1X00_BOOT
3318 +       bool "Db1X00 Boot Flash device"
3319 +       depends on MIPS && MTD_DB1X00
3320 +       help
3321 +         Use the first of the two 32MB flash banks on Db1X00 board.
3322 +         You can say 'Y' to both this and the USER flash option, to use
3323 +         both banks.
3324 +
3325 +config MTD_DB1X00_USER
3326 +       bool "Db1X00 User Flash device (2nd 32MB bank)"
3327 +       depends on MIPS && MTD_DB1X00
3328 +       help
3329 +         Use the second of the two 32MB flash banks on Db1X00 boards.
3330 +         You can say 'Y' to both this and the BOOT flash option, to use
3331 +         both banks.
3332 +
3333 +config MTD_BOSPORUS
3334 +       tristate "Bosporus Flash device"
3335 +       depends on MIPS && MIPS_BOSPORUS
3336 +       help
3337 +         Flash memory access on Alchemy Bosporus Board
3338 +
3339 +config MTD_XXS1500
3340 +       tristate "MyCable XXS1500 Flash device"
3341 +       depends on MIPS && MIPS_XXS1500
3342 +       help
3343 +         Flash memory access on MyCable XXS1500 Board
3344 +
3345 +config MTD_MTX1
3346 +       tristate "4-G Systems MTX-1 Flash device"
3347 +       depends on MIPS && MIPS_MTX1
3348 +       help
3349 +         Flash memory access on 4-G Systems MTX-1 Board
3350 +
3351  config MTD_BEECH
3352         tristate "CFI Flash device mapped on IBM 405LP Beech"
3353         depends on MTD_CFI && PPC32 && 40x && BEECH
3354 @@ -422,6 +473,12 @@
3355           NVRAM on the Momenco Ocelot board. If you have one of these boards
3356           and would like access to either of these, say 'Y'.
3357  
3358 +config MTD_LASAT
3359 +       tristate "LASAT flash device"
3360 +       depends on LASAT && MTD_CFI
3361 +       help
3362 +         Support for the flash chips on the Lasat 100 and 200 boards.
3363 +
3364  config MTD_SOLUTIONENGINE
3365         tristate "CFI Flash device mapped on Hitachi SolutionEngine"
3366         depends on SUPERH && MTD_CFI && MTD_REDBOOT_PARTS
3367 --- linux-2.6.8.1/drivers/usb/host/Makefile     2004-08-14 12:56:23.000000000 +0200
3368 +++ linux-2.6.8.1-brcm63xx/drivers/usb/host/Makefile    2006-06-26 09:07:14.000000000 +0200
3369 @@ -8,3 +8,7 @@
3370  obj-$(CONFIG_USB_UHCI_HCD)     += uhci-hcd.o
3371  
3372  obj-$(CONFIG_USB_SL811HS)      += hc_sl811.o
3373 +
3374 +ifeq ($(CONFIG_MIPS_BRCM),y)
3375 +EXTRA_CFLAGS   += -DCONFIG_SWAP_IO_SPACE -D__MIPSEB__
3376 +endif
3377 \ No newline at end of file
3378 --- linux-2.6.8.1/include/asm-mips/addrspace.h  2004-08-14 12:54:47.000000000 +0200
3379 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/addrspace.h 2006-06-26 09:07:15.000000000 +0200
3380 @@ -11,7 +11,13 @@
3381  #define _ASM_ADDRSPACE_H
3382  
3383  #include <linux/config.h>
3384 +#ifdef __KERNEL__
3385 +#if defined(CONFIG_BCM_ENDPOINT_MODULE)
3386 +#include <asm/mach-generic/spaces.h>
3387 +#else
3388  #include <spaces.h>
3389 +#endif
3390 +#endif
3391  
3392  /*
3393   *  Configure language
3394 --- linux-2.6.8.1/include/asm-mips/bootinfo.h   2004-08-14 12:54:51.000000000 +0200
3395 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/bootinfo.h  2006-06-26 09:07:15.000000000 +0200
3396 @@ -210,6 +210,16 @@
3397  #define MACH_GROUP_TITAN       22      /* PMC-Sierra Titan             */
3398  #define  MACH_TITAN_YOSEMITE   1       /* PMC-Sierra Yosemite          */
3399  
3400 +#if defined(CONFIG_MIPS_BRCM)
3401 +/*
3402 + * Valid machtype for group BRCM
3403 + */
3404 +#define MACH_GROUP_BRCM        23      /* Broadcom boards              */
3405 +#define MACH_BCM96338          0
3406 +#define MACH_BCM96345          1
3407 +#define MACH_BCM96348          2
3408 +#endif
3409 +
3410  #define CL_SIZE                        COMMAND_LINE_SIZE
3411  
3412  const char *get_system_type(void);
3413 --- linux-2.6.8.1/include/asm-mips/cpu.h        2004-08-14 12:54:50.000000000 +0200
3414 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/cpu.h       2006-06-26 09:07:15.000000000 +0200
3415 @@ -71,6 +71,11 @@
3416  #define PRID_IMP_4KEMPR2       0x9100
3417  #define PRID_IMP_4KSD          0x9200
3418  #define PRID_IMP_24K           0x9300
3419 +#if defined(CONFIG_MIPS_BRCM)
3420 +#define PRID_IMP_BCM6338       0x9000
3421 +#define PRID_IMP_BCM6345       0x8000
3422 +#define PRID_IMP_BCM6348       0x9100
3423 +#endif
3424  
3425  #define PRID_IMP_UNKNOWN       0xff00
3426  
3427 @@ -177,7 +182,14 @@
3428  #define CPU_VR4133             56
3429  #define CPU_AU1550             57
3430  #define CPU_24K                        58
3431 +#if defined(CONFIG_MIPS_BRCM)
3432 +#define CPU_BCM6338            59
3433 +#define CPU_BCM6345            60
3434 +#define CPU_BCM6348            61
3435 +#define CPU_LAST               61
3436 +#else
3437  #define CPU_LAST               58
3438 +#endif
3439  
3440  /*
3441   * ISA Level encodings
3442 diff -urN linux-2.6.8.1/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h linux-2.6.8.1-brcm63xx/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h
3443 --- linux-2.6.8.1/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h        1970-01-01 01:00:00.000000000 +0100
3444 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h       2006-06-26 09:07:15.000000000 +0200
3445 @@ -0,0 +1,36 @@
3446 +#ifndef __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
3447 +#define __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
3448 +
3449 +#define cpu_has_tlb                    1
3450 +#define cpu_has_4kex                   4
3451 +#define cpu_has_4ktlb                  8
3452 +#define cpu_has_fpu                    0
3453 +#define cpu_has_32fpr                  0
3454 +#define cpu_has_counter                        0x40
3455 +#define cpu_has_watch                  0
3456 +#define cpu_has_mips16                 0
3457 +#define cpu_has_divec                  0x200
3458 +#define cpu_has_vce                    0
3459 +#define cpu_has_cache_cdex_p           0
3460 +#define cpu_has_cache_cdex_s           0
3461 +#define cpu_has_prefetch               0x40000
3462 +#define cpu_has_mcheck                 0x2000
3463 +#define cpu_has_ejtag                  0x4000
3464 +#define cpu_has_llsc                   0x10000
3465 +#define cpu_has_vtag_icache            0
3466 +#define cpu_has_dc_aliases             0
3467 +#define cpu_has_ic_fills_f_dc          0
3468 +
3469 +#define cpu_has_nofpuex                        0
3470 +#define cpu_has_64bits                 0
3471 +#define cpu_has_64bit_zero_reg         0
3472 +#define cpu_has_64bit_gp_regs          0
3473 +#define cpu_has_64bit_addresses                0
3474 +
3475 +#define cpu_has_subset_pcaches         0
3476 +
3477 +#define cpu_dcache_line_size()         16
3478 +#define cpu_icache_line_size()         16
3479 +#define cpu_scache_line_size()         0
3480 +
3481 +#endif /* __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H */
3482 --- linux-2.6.8.1/include/asm-mips/mach-generic/param.h 2004-08-14 12:55:10.000000000 +0200
3483 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/mach-generic/param.h        2006-06-26 09:07:15.000000000 +0200
3484 @@ -8,6 +8,10 @@
3485  #ifndef __ASM_MACH_GENERIC_PARAM_H
3486  #define __ASM_MACH_GENERIC_PARAM_H
3487  
3488 +#if defined(CONFIG_MIPS_BRCM)
3489 +#define HZ             200                 /* Internal kernel timer frequency */
3490 +#else
3491  #define HZ             1000            /* Internal kernel timer frequency */
3492 +#endif
3493  
3494  #endif /* __ASM_MACH_GENERIC_PARAM_H */
3495 --- linux-2.6.8.1/include/asm-mips/page.h       2004-08-14 12:55:10.000000000 +0200
3496 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/page.h      2006-06-26 09:07:15.000000000 +0200
3497 @@ -13,7 +13,13 @@
3498  
3499  #ifdef __KERNEL__
3500  
3501 +#if defined(CONFIG_BCM_ENDPOINT_MODULE)
3502 +#include <asm/mach-generic/spaces.h>
3503 +#else
3504  #include <spaces.h>
3505 +#endif
3506 +
3507 +#endif
3508  
3509  /*
3510   * PAGE_SHIFT determines the page size
3511 @@ -33,6 +39,7 @@
3512  #define PAGE_SIZE      (1UL << PAGE_SHIFT)
3513  #define PAGE_MASK      (~(PAGE_SIZE-1))
3514  
3515 +#ifdef __KERNEL__
3516  #ifndef __ASSEMBLY__
3517  
3518  extern void clear_page(void * page);
3519 --- linux-2.6.8.1/include/asm-mips/param.h      2004-08-14 12:54:51.000000000 +0200
3520 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/param.h     2006-06-26 09:07:15.000000000 +0200
3521 @@ -12,7 +12,11 @@
3522  #ifdef __KERNEL__
3523  
3524  # include <param.h>                    /* Internal kernel timer frequency */
3525 +#if defined(CONFIG_BCM_ENDPOINT_MODULE)
3526 +# define USER_HZ       HZ              /* .. some user interfaces are in "ticks" */
3527 +#else
3528  # define USER_HZ       100             /* .. some user interfaces are in "ticks" */
3529 +#endif
3530  # define CLOCKS_PER_SEC        (USER_HZ)       /* like times() */
3531  #endif
3532  
3533 --- linux-2.6.8.1/include/asm-mips/timex.h      2004-08-14 12:56:15.000000000 +0200
3534 +++ linux-2.6.8.1-brcm63xx/include/asm-mips/timex.h     2006-06-26 09:07:15.000000000 +0200
3535 @@ -31,7 +31,11 @@
3536   * no reason to make this a separate architecture.
3537   */
3538  
3539 +#if defined(CONFIG_BCM_ENDPOINT_MODULE)
3540 +#include <asm/mach-generic/timex.h>
3541 +#else
3542  #include <timex.h>
3543 +#endif
3544  
3545  /*
3546   * Standard way to access the cycle counter.
3547 diff -urN linux-2.6.8.1/bcmdrivers/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/Makefile
3548 --- linux-2.6.8.1/bcmdrivers/Makefile   1970-01-01 01:00:00.000000000 +0100
3549 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/Makefile  2006-06-26 09:07:10.000000000 +0200
3550 @@ -0,0 +1,17 @@
3551 +# File: bcmdrivers/Makefile
3552 +#
3553 +# Makefile for the Linux kernel modules.
3554 +#
3555 +-include $(KERNEL_DIR)/.config
3556 +
3557 +obj-y += opensource/
3558 +
3559 +# If rootfs is nfs, we have to build Ethernet
3560 +# driver as built-n
3561 +ifeq ($(CONFIG_ROOTFS_NFS),y)
3562 +obj-y += broadcom/
3563 +endif
3564 +
3565 +obj-y += broadcom/
3566 +obj-m += broadcom/
3567 +
3568 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/Makefile
3569 --- linux-2.6.8.1/bcmdrivers/broadcom/Makefile  1970-01-01 01:00:00.000000000 +0100
3570 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/Makefile 2006-06-26 10:29:23.000000000 +0200
3571 @@ -0,0 +1,3 @@
3572 +
3573 +symlinks:
3574 +       #cp ../../../tools/built-in.o built-in.o
3575 Files linux-2.6.8.1/bcmdrivers/broadcom/built-in.o and linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/built-in.o differ
3576 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_defs.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_defs.h
3577 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_defs.h       1970-01-01 01:00:00.000000000 +0100
3578 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_defs.h      2006-06-26 09:07:10.000000000 +0200
3579 @@ -0,0 +1,133 @@
3580 +/* TARGET=bcm6348-dmt-T1-dmtbis-adsl2plus-L2-SRA-firmware-Qproc-HW-RTL-pipeline-IncOneBit-Readsl2-doubleUS  */
3581 +
3582 +#define SOURCE_FILE_ 
3583 +#define BCM6348_SRC 
3584 +#define G994_T1P413_1024_FFT 
3585 +#define ENABLE_DIG_USPWR_CUTBACK 
3586 +#define ADSLCORE_ONLY 
3587 +#define TEQ_DF 
3588 +#define LOOP_TIMING_PLL 
3589 +#define RCV_PHASE_TWEAK_ONLY 
3590 +#define ADSL_MAX_POSSIBLE_RCV_RATE 
3591 +#define HARDWARE_CHANNEL 
3592 +#define ADSL_HARDWARE_AGC 
3593 +#define HW_CHANNEL_ADC 
3594 +#define HW_CHANNEL_DAC 
3595 +#define HW_PGA 
3596 +#define DIGITALEC_SINGLE_TAP_UPDATE 
3597 +#define ANALOGEC_SINGLE_TAP_UPDATE 
3598 +#define HWLOG 
3599 +#define G992_TRELLIS_CODE_CLAMPING 
3600 +#define G992DECODERTRELLISBOUNDARY 
3601 +#define MEMORYLIMIT64K 
3602 +#define bcm47xx 
3603 +#define DSL_BIG_ENDIAN 
3604 +#define MIPS_SRC 
3605 +#define VP_INLINE -Winline 
3606 +#define USE_ASM_API 
3607 +#define RTL_SRC 
3608 +#define RSENC_INLINE 
3609 +#define BITENC_INLINE 
3610 +#define USE_SLOW_DATA 
3611 +#define USE_FAST_TEXT 
3612 +#define PROFILE_INLINE 
3613 +#define CHIP_SRC 
3614 +#define G992_RESYNC_PILOT_PHASE_IN_SHOWTIME 
3615 +#define G992_APPLY_SSVI 
3616 +#define SHARE_TEQ_VARS 
3617 +#define ANNEX_M 
3618 +#define DOUBLE_UP_STREAM 
3619 +#define G994P1_SUPPORT_A43C 
3620 +#define USE_ASM_API 
3621 +#define MIPS_ASM 
3622 +#define MEMORYLIMIT64K 
3623 +#define ADSL_FIRMWARE 
3624 +#define G992DATA_XMT_COMPACT_WORD 
3625 +#define ADSL_MAX_POSSIBLE_RCV_RATE 
3626 +#define DSP_FRONTEND_ONLY 
3627 +#define G992P3_ONE_BIT_CONSTELLATION 
3628 +#define ADSL_MODEM 
3629 +#define ATM 
3630 +#define ADSL_ATUR 
3631 +#define ADSL_SOFTWARE_TIME_ERROR_CALCULATION 
3632 +#define DSL_REPORT_ALL_COUNTERS 
3633 +#define ADSL_MONITOR_LCD 
3634 +#define G994P1 
3635 +#define G994P1_ATUR 
3636 +#define G992 
3637 +#define G992_ATUR 
3638 +#define ADSL_FRAMER 
3639 +#define G997_1 
3640 +#define ATM_I432 
3641 +#define TEQ_DF 
3642 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
3643 +#define G994P1_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
3644 +#define G992_TRELLISCODE 
3645 +#define ADSL_HARDWARE_ECHO_CANCELLOR 
3646 +#define G992P1 
3647 +#define G992P1_ATUR 
3648 +#define G992P1_ANNEX_A 
3649 +#define ADSL_HARDWARE_TIME_ERROR_TRACKING 
3650 +#define G992P1_NEWFRAME 
3651 +#define G992P1_NEWFRAME_ATUR 
3652 +#define G992P1_ANNEX_A_USED_FOR_G992P2 
3653 +#define T1P413 
3654 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
3655 +#define G992_CALC_DEBUG_SNR_BEFORE_TEQ 
3656 +#define G992P3 
3657 +#define RATE_SELECT_E14 
3658 +#define G992P3_ATUR 
3659 +#define G992P3AMENDMENT 
3660 +#define GLOBESPAN_DM 
3661 +#define G992P3_COMB_MSG_THREE_COPIES 
3662 +#define G992P3_POWER_MANAGEMENT 
3663 +#define G992P3_SRA 
3664 +#define G992P5 
3665 +#define G992P5_ATUR 
3666 +#define ADSL_PIPELINE_CODE 
3667 +#define ADSL_HARDWARE_TIME_ERROR_TRACKING 
3668 +#define G994P1RCV_QPROC 
3669 +#define G994P1XMT_QPROC 
3670 +#define G992RCV_QPROC 
3671 +#define G992XMT_QPROC 
3672 +#define G992RCV_RS 
3673 +#define VP_SIMULATOR 
3674 +#define T1P413RCV_QPROC 
3675 +#define T1P413XMT_QPROC 
3676 +#define G992ENC_HW_DATAMODE 
3677 +#define G992DATA_XMT_HW_RS 
3678 +#define G992DATA_XMT_COMPACT_WORD 
3679 +#define G992RCV_QPROC_FAST 
3680 +#define G992_BIT_SWAP 
3681 +#define ADSL_IDENTIFY_VENDOR_FIRMWARE 
3682 +#define ADSL_ATUR_FORCE_BIGGER_UPSTREAM_MARGIN 
3683 +#define G992_MORE_FRAME_MODE 
3684 +#define XMT_RACT2_FOR_ADI_COMPATIBILITY 
3685 +#define XMT_FFT_SIZE_2X 
3686 +#define SYNCH_SYMBOL_DETECTION 
3687 +#define ANSI_CACT12_PING_PONG 
3688 +#define ADSL_SPECIAL_FIX_FOR_FRENCH_TELECOM 
3689 +#define G994P1_CHECK_SECURITY 
3690 +#define G994P1_NON_STD_INFO 
3691 +#define I432_HEADER_COMPRESSION 
3692 +#define TDC_IOP_FIX_ERICSSON_TI_4000C_350 
3693 +#define TDC_IOP_FIX_SEIMENS_TI 
3694 +#define FT_ADI_US_RATE_FIX 
3695 +#define ANSI_CACT12_PING_PONG 
3696 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
3697 +#define G994P1_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
3698 +#define READSL2 
3699 +#define G992_APPLY_SSVI 
3700 +#define READSL2_FILTERS
3701 +
3702 +
3703 +#define ADSL_PHY_XFACE_OFFSET 0x21F90
3704 +
3705 +
3706 +#define ADSL_PHY_SDRAM_BIAS 0x1A0000
3707 +
3708 +
3709 +#define ADSL_PHY_SDRAM_LINK_OFFSET 0x1A0000
3710 +
3711 +
3712 +#define ADSL_PHY_SDRAM_PAGE_SIZE 0x200000
3713 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_lmem.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_lmem.h
3714 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_lmem.h       1970-01-01 01:00:00.000000000 +0100
3715 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_lmem.h      2006-06-26 09:07:10.000000000 +0200
3716 @@ -0,0 +1,6 @@
3717 +/*
3718 +**     Don't change!
3719 +**     This file has been generated automatically by bin2c program
3720 +*/
3721 +
3722 +extern const unsigned char adsl_lmem[51036];
3723 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_sdram.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_sdram.h
3724 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_sdram.h      1970-01-01 01:00:00.000000000 +0100
3725 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/adslcore6348/adsl_sdram.h     2006-06-26 09:07:10.000000000 +0200
3726 @@ -0,0 +1,6 @@
3727 +/*
3728 +**     Don't change!
3729 +**     This file has been generated automatically by bin2c program
3730 +*/
3731 +
3732 +extern const unsigned char adsl_sdram[364348];
3733 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslCoreDefs.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslCoreDefs.h
3734 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslCoreDefs.h 1970-01-01 01:00:00.000000000 +0100
3735 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslCoreDefs.h        2006-06-26 09:07:10.000000000 +0200
3736 @@ -0,0 +1,245 @@
3737 +/*
3738 +<:copyright-broadcom 
3739
3740 + Copyright (c) 2002 Broadcom Corporation 
3741 + All Rights Reserved 
3742 + No portions of this material may be reproduced in any form without the 
3743 + written permission of: 
3744 +          Broadcom Corporation 
3745 +          16215 Alton Parkway 
3746 +          Irvine, California 92619 
3747 + All information contained in this document is Broadcom Corporation 
3748 + company private, proprietary, and trade secret. 
3749
3750 +:>
3751 +*/
3752 +/****************************************************************************
3753 + *
3754 + * AdslCore.c -- Bcm ADSL core driver
3755 + *
3756 + * Description:
3757 + *     This file contains BCM ADSL core driver 
3758 + *
3759 + *
3760 + * Copyright (c) 2000-2001  Broadcom Corporation
3761 + * All Rights Reserved
3762 + * No portions of this material may be reproduced in any form without the
3763 + * written permission of:
3764 + *          Broadcom Corporation
3765 + *          16215 Alton Parkway
3766 + *          Irvine, California 92619
3767 + * All information contained in this document is Broadcom Corporation
3768 + * company private, proprietary, and trade secret.
3769 + * Authors: Ilya Stomakhin
3770 + *
3771 + * $Revision: 1.4 $
3772 + *
3773 + * $Id: AdslCoreDefs.h,v 1.4 2004/07/20 23:45:48 ilyas Exp $
3774 + *
3775 + * $Log: AdslCoreDefs.h,v $
3776 + * Revision 1.4  2004/07/20 23:45:48  ilyas
3777 + * Added driver version info, SoftDslPrintf support. Fixed G.997 related issues
3778 + *
3779 + * Revision 1.3  2004/06/10 00:20:33  ilyas
3780 + * Added L2/L3 and SRA
3781 + *
3782 + * Revision 1.2  2004/04/12 23:24:38  ilyas
3783 + * Added default G992P5 PHY definition
3784 + *
3785 + * Revision 1.1  2004/04/08 23:59:15  ilyas
3786 + * Initial CVS checkin
3787 + *
3788 + ****************************************************************************/
3789 +
3790 +#ifndef _ADSL_CORE_DEFS_H
3791 +#define _ADSL_CORE_DEFS_H
3792 +
3793 +#if defined(__KERNEL__)
3794 +#include <linux/config.h>
3795 +#endif
3796 +
3797 +#if defined(CONFIG_BCM96348) || defined(BOARD_bcm96348) || defined(_BCM96348_) ||  defined(CONFIG_BCM96338) || defined(BOARD_bcm96338) || defined(_BCM96338_)
3798 +#ifdef ADSL_ANNEXC
3799 +#include "../adslcore6348C/adsl_defs.h"
3800 +#elif defined(ADSL_ANNEXB)
3801 +#include "../adslcore6348B/adsl_defs.h"
3802 +#elif defined(ADSL_SADSL)
3803 +#include "../adslcore6348SA/adsl_defs.h"
3804 +#else
3805 +#include "../adslcore6348/adsl_defs.h"
3806 +#endif
3807 +#endif
3808 +
3809 +#if defined(__KERNEL__) || defined(TARG_OS_RTEMS) || defined(_CFE_)
3810 +#if defined(CONFIG_BCM96345) || defined(BOARD_bcm96345) || defined(_BCM96345_)
3811 +#ifdef ADSL_ANNEXC
3812 +#include "../adslcore6345C/adsl_defs.h"
3813 +#elif defined(ADSL_ANNEXB)
3814 +#include "../adslcore6345B/adsl_defs.h"
3815 +#elif defined(ADSL_SADSL)
3816 +#include "../adslcore6345SA/adsl_defs.h"
3817 +#else
3818 +#include "../adslcore6345/adsl_defs.h"
3819 +#endif
3820 +#endif /* of CONFIG_BCM96345 */
3821 +#else
3822 +#if defined(CONFIG_BCM96345)
3823 +#ifdef ADSL_ANNEXC
3824 +#include "../adslcoreC/adsl_defs.h"
3825 +#elif defined(ADSL_ANNEXB)
3826 +#include "../adslcoreB/adsl_defs.h"
3827 +#elif defined(ADSL_SADSL)
3828 +#include "../adslcoreSA/adsl_defs.h"
3829 +#else
3830 +#include "../adslcore/adsl_defs.h"
3831 +#endif
3832 +#endif /* of CONFIG_BCM96345 */
3833 +#endif /* __KERNEL__ */
3834 +
3835 +#ifdef _WIN32_WCE
3836 +#define        ASSERT(a)
3837 +#endif
3838 +
3839 +#include "AdslXfaceData.h"
3840 +
3841 +/* adjust some definitions for the HOST */
3842 +
3843 +#undef GLOBAL_PTR_BIAS
3844 +#undef ADSLCORE_ONLY
3845 +#undef USE_SLOW_DATA 
3846 +#undef USE_FAST_TEXT 
3847 +#undef VP_SIMULATOR 
3848 +#undef bcm47xx 
3849 +#undef ADSL_FRAMER
3850 +#undef ATM
3851 +#undef ATM_I432 
3852 +#undef DSL_OS
3853 +
3854 +#define HOST_ONLY
3855 +#define G997_1_FRAMER
3856 +#define ADSL_MIB
3857 +
3858 +#ifndef FLATTEN_ADDR_ADJUST
3859 +#define FLATTEN_ADDR_ADJUST    0xFFF00000
3860 +#endif
3861 +
3862 +/* definitions for combo PHY (AnnexA(ADSL2) and AnnexB) */
3863
3864 +#if !(defined(ADSL_SINGLE_PHY) || defined(G992_ANNEXC))
3865 +
3866 +#undef G992P1_ANNEX_A
3867 +#define        G992P1_ANNEX_A
3868 +#undef G992P3
3869 +#define        G992P3
3870 +#undef G992P5
3871 +#define        G992P5
3872 +#define        G992P1_ANNEX_A
3873 +#undef READSL2
3874 +#define        READSL2
3875 +#undef G992P1_ANNEX_A_USED_FOR_G992P2
3876 +#define        G992P1_ANNEX_A_USED_FOR_G992P2
3877 +#undef T1P413
3878 +#define        T1P413
3879 +
3880 +#undef G992P1_ANNEX_B
3881 +#define        G992P1_ANNEX_B
3882 +
3883 +#endif
3884 +
3885 +/* ADSL PHY definition */
3886 +
3887 +typedef struct {
3888 +       unsigned long   sdramPageAddr;
3889 +       unsigned long   sdramImageAddr;
3890 +       unsigned long   sdramImageSize;
3891 +       unsigned long   sdramPhyImageAddr;
3892 +       unsigned short  fwType;
3893 +       unsigned short  chipType;
3894 +       unsigned short  mjVerNum;
3895 +       unsigned short  mnVerNum;
3896 +       char                    *pVerStr;
3897 +       unsigned long   features[4];
3898 +} adslPhyInfo;
3899 +extern adslPhyInfo     adslCorePhyDesc;
3900 +
3901 +/* chip list */ 
3902 +
3903 +#define        kAdslPhyChipMjMask                      0xFF00
3904 +#define        kAdslPhyChipMnMask                      0x00FF
3905 +#define        kAdslPhyChipUnknown                     0
3906 +#define        kAdslPhyChip6345                        0x100
3907 +#define        kAdslPhyChip6348                        0x200
3908 +#define        kAdslPhyChipRev0                        0
3909 +#define        kAdslPhyChipRev1                        1
3910 +#define        kAdslPhyChipRev2                        2
3911 +#define        kAdslPhyChipRev3                        3
3912 +#define        kAdslPhyChipRev4                        4
3913 +#define        kAdslPhyChipRev5                        5
3914 +
3915 +#define        ADSL_PHY_SUPPORT(f)                     AdslFeatureSupported(adslCorePhyDesc.features,f)
3916 +#define        ADSL_PHY_SET_SUPPORT(p,f)       AdslFeatureSet((p)->features,f)
3917 +
3918 +/* ADSL Driver to/from PHY address and data conversion macros */
3919 +
3920 +#ifdef  ADSLDRV_LITTLE_ENDIAN
3921 +#define        ADSL_ENDIAN_CONV_LONG(x)        ( ((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((unsigned long)(x) >> 24) )
3922 +#define        ADSL_ENDIAN_CONV_SHORT(x)       ( ((x) << 8) | ((unsigned short)(x) >> 8) )
3923 +#define ADSL_ENDIAN_CONV_2SHORTS(x)    ( ((x) << 16) | ((unsigned long)(x) >> 16) )
3924 +#else
3925 +#define        ADSL_ENDIAN_CONV_LONG(x)        x
3926 +#define        ADSL_ENDIAN_CONV_SHORT(x)       x
3927 +#define ADSL_ENDIAN_CONV_2SHORTS(x)    x
3928 +#endif
3929 +
3930 +#ifndef ADSL_PHY_XFACE_OFFSET
3931 +#define ADSL_PHY_XFACE_OFFSET                  0x00017F90
3932 +#endif
3933 +#define ADSL_LMEM_XFACE_DATA                   (0xFFF00000 | ADSL_PHY_XFACE_OFFSET)
3934 +
3935 +#ifndef ADSL_PHY_SDRAM_START
3936 +#define ADSL_PHY_SDRAM_START                   0x10000000
3937 +#endif
3938 +#ifndef ADSL_PHY_SDRAM_BIAS
3939 +#define ADSL_PHY_SDRAM_BIAS                            0x00040000
3940 +#endif
3941 +#define        ADSL_PHY_SDRAM_START_4                  (ADSL_PHY_SDRAM_START + ADSL_PHY_SDRAM_BIAS)
3942 +
3943 +#ifndef        ADSL_PHY_SDRAM_PAGE_SIZE
3944 +#define ADSL_PHY_SDRAM_PAGE_SIZE               0x00080000
3945 +#endif
3946 +
3947 +#ifdef ADSL_PHY_SDRAM_BIAS
3948 +#define ADSL_SDRAM_IMAGE_SIZE                  (ADSL_PHY_SDRAM_PAGE_SIZE - ADSL_PHY_SDRAM_BIAS)
3949 +#else
3950 +#define ADSL_SDRAM_IMAGE_SIZE                  (256*1024)
3951 +#endif
3952 +
3953 +
3954 +#ifndef        ADSL_PHY_SDRAM_LINK_OFFSET
3955 +#define ADSL_PHY_SDRAM_LINK_OFFSET             0x00040000
3956 +#endif
3957 +
3958 +#define ADSL_SDRAM_TOTAL_SIZE                  0x00800000
3959 +#define ADSL_SDRAM_HOST_MIPS_DEFAULT   (0xA0000000 | (ADSL_SDRAM_TOTAL_SIZE - ADSL_PHY_SDRAM_PAGE_SIZE + ADSL_PHY_SDRAM_BIAS))
3960 +
3961 +#define ADSLXF                                                 ((AdslXfaceData *) ADSL_LMEM_XFACE_DATA)
3962 +
3963 +#define ADSL_MIPS_LMEM_ADDR(a) (((ulong)(a) & 0x19000000) == 0x19000000)
3964 +#define        SDRAM_ADDR_TO_HOST(a)   ((void *) ((ulong)(a) - adslCorePhyDesc.sdramPhyImageAddr + \
3965 +       (ADSLXF->sdramBaseAddr ? (unsigned long) ADSLXF->sdramBaseAddr : ADSL_SDRAM_HOST_MIPS_DEFAULT)))
3966 +#define        SDRAM_ADDR_TO_ADSL(a)   ((void *) (adslCorePhyDesc.sdramPhyImageAddr + ((ulong)(a) - \
3967 +       (ADSLXF->sdramBaseAddr ? (unsigned long) ADSLXF->sdramBaseAddr : ADSL_SDRAM_HOST_MIPS_DEFAULT))))
3968 +
3969 +#define ADSL_ADDR_TO_HOST(addr)                ADSL_MIPS_LMEM_ADDR(addr) ? (void *) ((ulong) (addr) | FLATTEN_ADDR_ADJUST) : SDRAM_ADDR_TO_HOST(addr)
3970 +
3971 +
3972 +#ifndef DEBUG
3973 +#define DEBUG
3974 +#endif
3975 +
3976 +#ifndef __SoftDslPrintf
3977 +void __SoftDslPrintf(void *gDslVars, char *fmt, int argNum, ...);
3978 +#endif
3979 +
3980 +#endif
3981 +
3982 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.gh
3983 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.gh     1970-01-01 01:00:00.000000000 +0100
3984 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.gh    2006-06-26 09:07:10.000000000 +0200
3985 @@ -0,0 +1,94 @@
3986 +/****************************************************************************
3987 + *
3988 + * AdslMib.gh 
3989 + *
3990 + * Description:
3991 + *     This is a header file which defines the type for AdslMib
3992 + *     global variable structure.
3993 + *
3994 + *
3995 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
3996 + * Authors: Ilya Stomakhin
3997 + *
3998 + * $Revision: 1.8 $
3999 + *
4000 + * $Id: AdslMib.gh,v 1.8 2004/06/04 18:56:01 ilyas Exp $
4001 + *
4002 + * $Log: AdslMib.gh,v $
4003 + * Revision 1.8  2004/06/04 18:56:01  ilyas
4004 + * Added counter for ADSL2 framing and performance
4005 + *
4006 + * Revision 1.7  2003/10/17 21:02:12  ilyas
4007 + * Added more data for ADSL2
4008 + *
4009 + * Revision 1.6  2003/10/14 00:55:27  ilyas
4010 + * Added UAS, LOSS, SES error seconds counters.
4011 + * Support for 512 tones (AnnexI)
4012 + *
4013 + * Revision 1.5  2003/07/18 19:07:15  ilyas
4014 + * Merged with ADSL driver
4015 + *
4016 + * Revision 1.4  2002/11/13 21:32:49  ilyas
4017 + * Added adjustK support for Centillium non-standard framing mode
4018 + *
4019 + * Revision 1.3  2002/10/31 20:27:13  ilyas
4020 + * Merged with the latest changes for VxWorks/Linux driver
4021 + *
4022 + * Revision 1.2  2002/07/20 00:51:41  ilyas
4023 + * Merged witchanges made for VxWorks/Linux driver.
4024 + *
4025 + * Revision 1.1  2001/12/21 22:39:30  ilyas
4026 + * Added support for ADSL MIB data objects (RFC2662)
4027 + *
4028 + *
4029 + *****************************************************************************/
4030 +
4031 +#ifndef        AdslMibGlobals
4032 +#define        AdslMibGlobals
4033 +
4034 +#include "AdslMib.h"
4035 +
4036 +typedef struct
4037 +       {
4038 +       /* MIB data */
4039 +
4040 +       adslMibInfo                             adslMib;
4041 +
4042 +       /* ADSL state data */
4043 +
4044 +       adslMibNotifyHandlerType notifyHandlerPtr;
4045 +       ulong                                   timeSec;
4046 +       ulong                                   timeMs;
4047 +       Boolean                                 currSecondErrored;
4048 +       Boolean                                 currSecondLOS;
4049 +       Boolean                                 currSecondSES;
4050 +       Boolean                                 currSecondFEC;
4051 +       ulong                                   rcvPower;
4052 +       ulong                                   rcvRateBps;
4053 +       ulong                                   xmtRateBps;
4054 +       ulong                                   linkStatus;
4055 +       G992CodingParams                rcvParams;
4056 +       G992CodingParams                xmtParams;
4057 +       ulong                                   shtCounters[kG992ShowtimeNumOfMonitorCounters];
4058 +       ulong                                   scratchData;
4059 +       long                                    showtimeMarginThld;
4060 +
4061 +       /* ADSL diag data */
4062 +
4063 +       short                                   snr[kAdslMibMaxToneNum];
4064 +       short                                   showtimeMargin[kAdslMibMaxToneNum];
4065 +       uchar                                   bitAlloc[kAdslMibMaxToneNum];
4066 +       short                                   gain[kAdslMibMaxToneNum];
4067 +       ComplexShort                    chanCharLin[kAdslMibMaxToneNum];
4068 +       short                                   chanCharLog[kAdslMibMaxToneNum];
4069 +       short                                   quietLineNoise[kAdslMibMaxToneNum];
4070 +
4071 +       ushort                                  nTones;
4072 +       uchar                                   nMsgCnt;
4073 +       ulong                                   g992MsgType;
4074 +       uchar                                   rsOption[1+4];
4075 +       Boolean                                 rsOptionValid;
4076 +       }
4077 +       adslMibVarsStruct;
4078 +
4079 +#endif /* AdslMibGlobals */
4080 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.h
4081 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.h      1970-01-01 01:00:00.000000000 +0100
4082 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMib.h     2006-06-26 09:07:10.000000000 +0200
4083 @@ -0,0 +1,114 @@
4084 +/*
4085 +<:copyright-broadcom 
4086
4087 + Copyright (c) 2002 Broadcom Corporation 
4088 + All Rights Reserved 
4089 + No portions of this material may be reproduced in any form without the 
4090 + written permission of: 
4091 +          Broadcom Corporation 
4092 +          16215 Alton Parkway 
4093 +          Irvine, California 92619 
4094 + All information contained in this document is Broadcom Corporation 
4095 + company private, proprietary, and trade secret. 
4096
4097 +:>
4098 +*/
4099 +/****************************************************************************
4100 + *
4101 + * AdslMib.h 
4102 + *
4103 + * Description:
4104 + *     This file contains the exported functions and definitions for AdslMib
4105 + *
4106 + *
4107 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
4108 + * Authors: Ilya Stomakhin
4109 + *
4110 + * $Revision: 1.9 $
4111 + *
4112 + * $Id: AdslMib.h,v 1.9 2004/04/12 23:34:52 ilyas Exp $
4113 + *
4114 + * $Log: AdslMib.h,v $
4115 + * Revision 1.9  2004/04/12 23:34:52  ilyas
4116 + * Merged the latest ADSL driver chnages for ADSL2+
4117 + *
4118 + * Revision 1.8  2004/03/03 20:14:05  ilyas
4119 + * Merged changes for ADSL2+ from ADSL driver
4120 + *
4121 + * Revision 1.7  2003/10/14 00:55:27  ilyas
4122 + * Added UAS, LOSS, SES error seconds counters.
4123 + * Support for 512 tones (AnnexI)
4124 + *
4125 + * Revision 1.6  2003/07/18 19:07:15  ilyas
4126 + * Merged with ADSL driver
4127 + *
4128 + * Revision 1.5  2002/10/31 20:27:13  ilyas
4129 + * Merged with the latest changes for VxWorks/Linux driver
4130 + *
4131 + * Revision 1.4  2002/07/20 00:51:41  ilyas
4132 + * Merged witchanges made for VxWorks/Linux driver.
4133 + *
4134 + * Revision 1.3  2002/01/13 22:25:40  ilyas
4135 + * Added functions to get channels rate
4136 + *
4137 + * Revision 1.2  2002/01/03 06:03:36  ilyas
4138 + * Handle byte moves tha are not multiple of 2
4139 + *
4140 + * Revision 1.1  2001/12/21 22:39:30  ilyas
4141 + * Added support for ADSL MIB data objects (RFC2662)
4142 + *
4143 + *
4144 + *****************************************************************************/
4145 +
4146 +#ifndef        AdslMibHeader
4147 +#define        AdslMibHeader
4148 +
4149 +#if defined(_CFE_)
4150 +#include "lib_types.h"
4151 +#include "lib_string.h"
4152 +#endif
4153 +
4154 +#include "AdslMibDef.h"
4155 +
4156 +/* Interface functions */
4157 +
4158 +typedef        int     (SM_DECL *adslMibNotifyHandlerType)     (void *gDslVars, ulong event);
4159 +
4160 +extern Boolean  AdslMibInit(void *gDslVars);
4161 +extern void            AdslMibTimer(void *gDslVars, long timeMs);
4162 +extern void            AdslMibStatusSnooper (void *gDslVars, dslStatusStruct *status);
4163 +extern void            AdslMibSetNotifyHandler(void *gDslVars, adslMibNotifyHandlerType notifyHandlerPtr);
4164 +extern int             AdslMibGetModulationType(void *gDslVars);
4165 +extern Boolean AdslMibIsAdsl2Mod(void *gDslVars);
4166 +extern int             AdslMibGetActiveChannel(void *gDslVars);
4167 +extern int             AdslMibGetGetChannelRate(void *gDslVars, int dir, int channel);
4168 +extern Boolean  AdslMibIsLinkActive(void *gDslVars);
4169 +extern int             AdslMibPowerState(void *gDslVars);
4170 +extern int             AdslMibTrainingState (void *gDslVars);
4171 +extern void            AdslMibClearData(void *gDslVars);
4172 +extern void            AdslMibClearBertResults(void *gDslVars);
4173 +extern void            AdslMibBertStartEx(void *gDslVars, ulong bertSec);
4174 +extern void            AdslMibBertStopEx(void *gDslVars);
4175 +extern ulong   AdslMibBertContinueEx(void *gDslVars, ulong totalBits, ulong errBits);
4176 +extern void            AdslMibSetLPR(void *gDslVars);
4177 +extern void            AdslMibSetShowtimeMargin(void *gDslVars, long showtimeMargin);
4178 +extern void            AdslMibResetConectionStatCounters(void *gDslVars);
4179 +
4180 +extern void            AdslMibByteMove (int size, void* srcPtr, void* dstPtr);
4181 +extern void            AdslMibByteClear(int size, void* dstPtr);
4182 +extern int             AdslMibStrCopy(char *srcPtr, char *dstPtr);
4183 +
4184 +/* AdslMibGetData dataId codes */
4185 +
4186 +#define        kAdslMibDataAll                                 0
4187 +
4188 +extern void            *AdslMibGetData (void *gDslVars, int dataId, void *pAdslMibData);
4189 +
4190 +extern int             AdslMibGetObjectValue (
4191 +                                       void    *gDslVars, 
4192 +                                       uchar   *objId, 
4193 +                                       int             objIdLen,
4194 +                                       uchar   *dataBuf,
4195 +                                       ulong   *dataBufLen);
4196 +
4197 +#endif /* AdslMibHeader */
4198 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMibOid.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMibOid.h
4199 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMibOid.h   1970-01-01 01:00:00.000000000 +0100
4200 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslMibOid.h  2006-06-26 09:07:10.000000000 +0200
4201 @@ -0,0 +1,177 @@
4202 +/*
4203 +<:copyright-broadcom 
4204
4205 + Copyright (c) 2002 Broadcom Corporation 
4206 + All Rights Reserved 
4207 + No portions of this material may be reproduced in any form without the 
4208 + written permission of: 
4209 +          Broadcom Corporation 
4210 +          16215 Alton Parkway 
4211 +          Irvine, California 92619 
4212 + All information contained in this document is Broadcom Corporation 
4213 + company private, proprietary, and trade secret. 
4214
4215 +:>
4216 +*/
4217 +/****************************************************************************
4218 + *
4219 + * AdslMibOid.h 
4220 + *
4221 + * Description:
4222 + *     SNMP object identifiers for ADSL MIB and other related MIBs
4223 + *
4224 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
4225 + * Authors: Ilya Stomakhin
4226 + *
4227 + * $Revision: 1.5 $
4228 + *
4229 + * $Id: AdslMibOid.h,v 1.5 2004/06/04 18:56:01 ilyas Exp $
4230 + *
4231 + * $Log: AdslMibOid.h,v $
4232 + * Revision 1.5  2004/06/04 18:56:01  ilyas
4233 + * Added counter for ADSL2 framing and performance
4234 + *
4235 + * Revision 1.4  2003/10/17 21:02:12  ilyas
4236 + * Added more data for ADSL2
4237 + *
4238 + * Revision 1.3  2003/10/14 00:55:27  ilyas
4239 + * Added UAS, LOSS, SES error seconds counters.
4240 + * Support for 512 tones (AnnexI)
4241 + *
4242 + * Revision 1.2  2002/07/20 00:51:41  ilyas
4243 + * Merged witchanges made for VxWorks/Linux driver.
4244 + *
4245 + * Revision 1.1  2001/12/21 22:39:30  ilyas
4246 + * Added support for ADSL MIB data objects (RFC2662)
4247 + *
4248 + *
4249 + *****************************************************************************/
4250 +
4251 +#ifndef        AdslMibOidHeader
4252 +#define        AdslMibOidHeader
4253 +
4254 +#define kOidAdsl                                                       94
4255 +#define kOidAdslInterleave                                     124
4256 +#define kOidAdslFast                                           125
4257 +#define kOidAtm                                                                37
4258 +
4259 +#define kOidAdslLine                                           1
4260 +#define kOidAdslMibObjects                                     1
4261 +
4262 +#define kOidAdslLineTable                                      1
4263 +#define kOidAdslLineEntry                                      1
4264 +#define kOidAdslLineCoding                                     1
4265 +#define kOidAdslLineType                                       2
4266 +#define kOidAdslLineSpecific                       3
4267 +#define kOidAdslLineConfProfile                                4
4268 +#define kOidAdslLineAlarmConfProfile           5
4269 +
4270 +#define kOidAdslAtucPhysTable                          2
4271 +#define kOidAdslAturPhysTable                          3
4272 +#define kOidAdslPhysEntry                                      1
4273 +#define kOidAdslPhysInvSerialNumber            1
4274 +#define kOidAdslPhysInvVendorID             2
4275 +#define kOidAdslPhysInvVersionNumber           3
4276 +#define kOidAdslPhysCurrSnrMgn                 4
4277 +#define kOidAdslPhysCurrAtn                    5
4278 +#define kOidAdslPhysCurrStatus                 6
4279 +#define kOidAdslPhysCurrOutputPwr              7
4280 +#define kOidAdslPhysCurrAttainableRate         8
4281 +
4282 +#define kOidAdslAtucChanTable                          4
4283 +#define kOidAdslAturChanTable                          5
4284 +#define kOidAdslChanEntry                                      1
4285 +#define kOidAdslChanInterleaveDelay                    1
4286 +#define kOidAdslChanCurrTxRate                         2
4287 +#define kOidAdslChanPrevTxRate                 3
4288 +#define kOidAdslChanCrcBlockLength             4
4289 +
4290 +#define kOidAdslAtucPerfDataTable                      6
4291 +#define kOidAdslAturPerfDataTable                      7
4292 +#define kOidAdslPerfDataEntry                          1
4293 +#define kOidAdslPerfLofs                       1
4294 +#define kOidAdslPerfLoss                       2
4295 +#define kOidAdslPerfLprs                       3
4296 +#define kOidAdslPerfESs                        4
4297 +#define kOidAdslPerfValidIntervals          5
4298 +#define kOidAdslPerfInvalidIntervals           6
4299 +#define kOidAdslPerfCurr15MinTimeElapsed       7
4300 +#define kOidAdslPerfCurr15MinLofs              8
4301 +#define kOidAdslPerfCurr15MinLoss              9
4302 +#define kOidAdslPerfCurr15MinLprs              10
4303 +#define kOidAdslPerfCurr15MinESs               11
4304 +#define kOidAdslPerfCurr1DayTimeElapsed     12
4305 +#define kOidAdslPerfCurr1DayLofs               13
4306 +#define kOidAdslPerfCurr1DayLoss               14
4307 +#define kOidAdslPerfCurr1DayLprs               15
4308 +#define kOidAdslPerfCurr1DayESs                16
4309 +#define kOidAdslPerfPrev1DayMoniSecs           17
4310 +#define kOidAdslPerfPrev1DayLofs               18
4311 +#define kOidAdslPerfPrev1DayLoss            19
4312 +#define kOidAdslPerfPrev1DayLprs               20
4313 +#define kOidAdslPerfPrev1DayESs                21
4314 +
4315 +#define kOidAdslAtucPerfIntervalTable          8
4316 +#define kOidAdslAturPerfIntervalTable          9
4317 +#define kOidAdslPerfIntervalEntry                      1
4318 +#define kOidAdslIntervalNumber                         1
4319 +#define kOidAdslIntervalLofs                           2
4320 +#define kOidAdslIntervalLoss                           3
4321 +#define kOidAdslIntervalLprs                           4
4322 +#define kOidAdslIntervalESs                                    5
4323 +#define kOidAdslIntervalValidData                      6
4324 +
4325 +#define kOidAdslAtucChanPerfTable                                      10
4326 +#define kOidAdslAturChanPerfTable                                      11
4327 +#define kOidAdslChanPerfEntry                                          1
4328 +#define kOidAdslChanReceivedBlks                       1
4329 +#define kOidAdslChanTransmittedBlks                    2
4330 +#define kOidAdslChanCorrectedBlks                      3
4331 +#define kOidAdslChanUncorrectBlks                      4
4332 +#define kOidAdslChanPerfValidIntervals                 5
4333 +#define kOidAdslChanPerfInvalidIntervals               6
4334 +#define kOidAdslChanPerfCurr15MinTimeElapsed           7
4335 +#define kOidAdslChanPerfCurr15MinReceivedBlks          8
4336 +#define kOidAdslChanPerfCurr15MinTransmittedBlks       9
4337 +#define kOidAdslChanPerfCurr15MinCorrectedBlks         10
4338 +#define kOidAdslChanPerfCurr15MinUncorrectBlks         11
4339 +#define kOidAdslChanPerfCurr1DayTimeElapsed            12
4340 +#define kOidAdslChanPerfCurr1DayReceivedBlks           13
4341 +#define kOidAdslChanPerfCurr1DayTransmittedBlks        14
4342 +#define kOidAdslChanPerfCurr1DayCorrectedBlks          15
4343 +#define kOidAdslChanPerfCurr1DayUncorrectBlks          16
4344 +#define kOidAdslChanPerfPrev1DayMoniSecs               17
4345 +#define kOidAdslChanPerfPrev1DayReceivedBlks           18
4346 +#define kOidAdslChanPerfPrev1DayTransmittedBlks        19
4347 +#define kOidAdslChanPerfPrev1DayCorrectedBlks          20
4348 +#define kOidAdslChanPerfPrev1DayUncorrectBlks          21
4349 +
4350 +#define kOidAdslAtucChanIntervalTable                          12
4351 +#define kOidAdslAturChanIntervalTable                          13
4352 +#define kOidAdslChanIntervalEntry                                      1
4353 +#define kOidAdslChanIntervalNumber                                     1
4354 +#define kOidAdslChanIntervalReceivedBlks               2
4355 +#define kOidAdslChanIntervalTransmittedBlks            3
4356 +#define kOidAdslChanIntervalCorrectedBlks              4
4357 +#define kOidAdslChanIntervalUncorrectBlks              5
4358 +#define kOidAdslChanIntervalValidData                  6
4359 +
4360 +/* AdslExtra OIDs for kOidAdslPrivate, kOidAdslPrivExtraInfo (defined in AdslMibDef.h) */
4361 +
4362 +#define kOidAdslExtraConnectionInfo                                    1
4363 +#define kOidAdslExtraConnectionStat                                    2
4364 +#define kOidAdslExtraFramingMode                                       3
4365 +#define kOidAdslExtraTrainingState                                     4
4366 +#define kOidAdslExtraNonStdFramingAdjustK                      5
4367 +#define kOidAdslExtraAtmStat                                           6
4368 +#define kOidAdslExtraDiagModeData                                      7
4369 +#define kOidAdslExtraAdsl2Info                                         8
4370 +#define kOidAdslExtraTxPerfCounterInfo                         9
4371 +
4372 +#define kOidAtmMibObjects              1
4373 +#define kOidAtmTcTable                 4
4374 +#define kOidAtmTcEntry                 1
4375 +#define kOidAtmOcdEvents               1
4376 +#define kOidAtmAlarmState              2
4377 +
4378 +#endif /* AdslMibOidHeader */
4379 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslXfaceData.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslXfaceData.h
4380 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslXfaceData.h        1970-01-01 01:00:00.000000000 +0100
4381 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/AdslXfaceData.h       2006-06-26 09:07:10.000000000 +0200
4382 @@ -0,0 +1,129 @@
4383 +/*
4384 +<:copyright-broadcom 
4385
4386 + Copyright (c) 2002 Broadcom Corporation 
4387 + All Rights Reserved 
4388 + No portions of this material may be reproduced in any form without the 
4389 + written permission of: 
4390 +          Broadcom Corporation 
4391 +          16215 Alton Parkway 
4392 +          Irvine, California 92619 
4393 + All information contained in this document is Broadcom Corporation 
4394 + company private, proprietary, and trade secret. 
4395
4396 +:>
4397 +*/
4398 +/****************************************************************************
4399 + *
4400 + * AdslXfaceData.h -- ADSL Core interface data structure
4401 + *
4402 + * Description:
4403 + *     To be included both in SoftDsl and BcmAdslCore driver
4404 + *
4405 + *
4406 + * Copyright (c) 2000-2001  Broadcom Corporation
4407 + * All Rights Reserved
4408 + * No portions of this material may be reproduced in any form without the
4409 + * written permission of:
4410 + *          Broadcom Corporation
4411 + *          16215 Alton Parkway
4412 + *          Irvine, California 92619
4413 + * All information contained in this document is Broadcom Corporation
4414 + * company private, proprietary, and trade secret.
4415 + * Authors: Ilya Stomakhin
4416 + *
4417 + * $Revision: 1.9 $
4418 + *
4419 + * $Id: AdslXfaceData.h,v 1.9 2004/02/03 02:57:22 ilyas Exp $
4420 + *
4421 + * $Log: AdslXfaceData.h,v $
4422 + * Revision 1.9  2004/02/03 02:57:22  ilyas
4423 + * Added PHY feature settings
4424 + *
4425 + * Revision 1.8  2003/07/18 04:50:21  ilyas
4426 + * Added shared buffer for clEoc messages to avoid copying thru command buffer
4427 + *
4428 + * Revision 1.7  2003/02/25 00:46:32  ilyas
4429 + * Added T1.413 EOC vendor ID
4430 + *
4431 + * Revision 1.6  2003/02/21 23:29:13  ilyas
4432 + * Added OEM vendor ID parameter for T1.413 mode
4433 + *
4434 + * Revision 1.5  2002/09/13 21:17:12  ilyas
4435 + * Added pointers to version and build string to OEM interface structure
4436 + *
4437 + * Revision 1.4  2002/09/07 04:16:29  ilyas
4438 + * Fixed HOST to ADSL MIPS SDRAM address translation for relocatable images
4439 + *
4440 + * Revision 1.3  2002/09/07 01:43:59  ilyas
4441 + * Added support for OEM parameters
4442 + *
4443 + * Revision 1.2  2002/01/22 19:03:10  khp
4444 + * -put sdramBaseAddr at end of Xface struct
4445 + *
4446 + * Revision 1.1  2002/01/15 06:25:08  ilyas
4447 + * Initial implementation of ADSL core firmware
4448 + *
4449 + ****************************************************************************/
4450 +
4451 +#ifndef        AdslXfaceDataHeader
4452 +#define AdslXfaceDataHeader
4453 +
4454 +#include "CircBuf.h"
4455 +
4456 +typedef struct _AdslXfaceData {
4457 +       stretchBufferStruct sbSta;
4458 +       stretchBufferStruct sbCmd;
4459 +       unsigned long           gfcTable[15];
4460 +       void                            *sdramBaseAddr;
4461 +} AdslXfaceData;
4462 +
4463 +/* Shared SDRAM configuration data */
4464 +
4465 +#define        kAdslOemVendorIdMaxSize         8
4466 +#define        kAdslOemVersionMaxSize          32
4467 +#define        kAdslOemSerNumMaxSize           32
4468 +#define        kAdslOemNonStdInfoMaxSize       64
4469 +
4470 +typedef struct _AdslOemSharedData {
4471 +       unsigned long           g994VendorIdLen;
4472 +       unsigned long           g994XmtNonStdInfoLen;
4473 +       unsigned long           g994RcvNonStdInfoLen;
4474 +       unsigned long           eocVendorIdLen;
4475 +       unsigned long           eocVersionLen;
4476 +       unsigned long           eocSerNumLen;
4477 +       unsigned char           g994VendorId[kAdslOemVendorIdMaxSize];
4478 +       unsigned char           eocVendorId[kAdslOemVendorIdMaxSize];
4479 +       unsigned char           eocVersion[kAdslOemVersionMaxSize];
4480 +       unsigned char           eocSerNum[kAdslOemSerNumMaxSize];
4481 +       unsigned char           g994XmtNonStdInfo[kAdslOemNonStdInfoMaxSize];
4482 +       unsigned char           g994RcvNonStdInfo[kAdslOemNonStdInfoMaxSize];
4483 +       char                            *gDslVerionStringPtr;
4484 +       char                            *gDslBuildDataStringPtr;
4485 +       unsigned long           t1413VendorIdLen;
4486 +       unsigned char           t1413VendorId[kAdslOemVendorIdMaxSize];
4487 +       unsigned long           t1413EocVendorIdLen;
4488 +       unsigned char           t1413EocVendorId[kAdslOemVendorIdMaxSize];
4489 +       unsigned long           clEocBufLen;
4490 +       unsigned char           *clEocBufPtr;
4491 +} AdslOemSharedData;
4492 +
4493 +/* feature list */ 
4494 +
4495 +#define        kAdslPhyAnnexA                          0
4496 +#define        kAdslPhyAnnexB                          1
4497 +#define        kAdslPhyAnnexC                          2
4498 +#define        kAdslPhySADSL                           3
4499 +#define        kAdslPhyAdsl2                           4
4500 +#define        kAdslPhyAdslG992p3                      4
4501 +#define        kAdslPhyAdsl2p                          5
4502 +#define        kAdslPhyAdslG992p5                      5
4503 +#define        kAdslPhyAnnexI                          6
4504 +#define        kAdslPhyAdslReAdsl2                     7
4505 +#define        kAdslPhyG992p2Init                      8
4506 +#define        kAdslPhyT1P413                          9
4507 +
4508 +#define        AdslFeatureSupported(fa,f)      ((fa)[(f) >> 5] & (1 << ((f) & 0x1F)))
4509 +#define        AdslFeatureSet(fa,f)            (fa)[(f) >> 5] |= (1 << ((f) & 0x1F))
4510 +
4511 +#endif /* AdslXfaceDataHeader */
4512 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlankList.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlankList.h
4513 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlankList.h    1970-01-01 01:00:00.000000000 +0100
4514 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlankList.h   2006-06-26 09:07:10.000000000 +0200
4515 @@ -0,0 +1,87 @@
4516 +/*
4517 +<:copyright-broadcom 
4518
4519 + Copyright (c) 2002 Broadcom Corporation 
4520 + All Rights Reserved 
4521 + No portions of this material may be reproduced in any form without the 
4522 + written permission of: 
4523 +          Broadcom Corporation 
4524 +          16215 Alton Parkway 
4525 +          Irvine, California 92619 
4526 + All information contained in this document is Broadcom Corporation 
4527 + company private, proprietary, and trade secret. 
4528
4529 +:>
4530 +*/
4531 +/****************************************************************************
4532 + *
4533 + * BlankList.h 
4534 + *
4535 + * Description:
4536 + *     Definition and implementation (via macros and inline functions)
4537 + *  of blank list - list of unused items of any size (not less than 
4538 + *     sizeof(void *)
4539 + *
4540 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
4541 + * Authors: Ilya Stomakhin
4542 + *
4543 + *****************************************************************************/
4544 +
4545 +#ifndef        BlankListHeader
4546 +#define        BlankListHeader
4547 +
4548 +#define BlankListPeek(head)            ((void *) (head))
4549 +#define BlankListNext(p)               (*(void **) (p))
4550 +
4551 +#define BlankListAdd(pHead,p)  do {                    \
4552 +  BlankListNext(p)        = BlankListNext(pHead);      \
4553 +  BlankListNext(pHead) = (void *) (p);                 \
4554 +} while (0)
4555 +
4556 +#define BlankListAddList(pHead,pFirst,pLast) do {      \
4557 +  if (NULL != (pLast)) {                                                       \
4558 +       BlankListNext(pLast) = BlankListNext(pHead);    \
4559 +       BlankListNext(pHead) = (void *) (pFirst);               \
4560 +  }                                                                                                    \
4561 +} while (0)
4562 +
4563 +#define BlankListGet(pHead)                                                    \
4564 +  BlankListNext(pHead);                                                                \
4565 +  {                                                                                                    \
4566 +       void    **__p;                                                                  \
4567 +       __p = (void     **) BlankListNext(pHead);                       \
4568 +       if (NULL != __p)                                                                \
4569 +         BlankListNext(pHead) = *__p;                                  \
4570 +  }
4571 +
4572 +
4573 +#define        BlankListForEach(pHead,f,ref)   do {            \
4574 +  void *p = BlankListNext(pHead);                                      \
4575 +                                                                                                       \
4576 +  while (NULL != p) {                                                          \
4577 +       if ( (f)((p), ref) ) break;                                             \
4578 +       p = BlankListNext(p);                                                   \
4579 +  }                                                                                                    \
4580 +} while (0)
4581 +
4582 +
4583 +#include       "Que.h"
4584 +
4585 +#define BlankListAddQue(pHead,pqHdr)   do {                                                    \
4586 +  if (NULL != ((QueHeader *)(pqHdr))->tail) {                                                  \
4587 +       BlankListNext(((QueHeader *)(pqHdr))->tail) = BlankListNext(pHead);     \
4588 +       BlankListNext(pHead) = ((QueHeader *)(pqHdr))->head;                            \
4589 +  }                                                                                                                                            \
4590 +} while (0)
4591 +
4592 +#include       "DList.h"
4593 +
4594 +#define BlankListAddDList(pHead,pDListHead)    do {                                            \
4595 +  if (!DListEmpty(pDListHead)) {                                                                               \
4596 +       BlankListNext(DListLast(pDListHead)) = BlankListNext(pHead);            \
4597 +       BlankListNext(pHead) = DListFirst(pDListHead);                                          \
4598 +  }                                                                                                                                            \
4599 +} while (0)
4600 +
4601 +#endif /* BlankListHeader */
4602 +
4603 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlockUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlockUtil.h
4604 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlockUtil.h    1970-01-01 01:00:00.000000000 +0100
4605 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/BlockUtil.h   2006-06-26 09:07:10.000000000 +0200
4606 @@ -0,0 +1,235 @@
4607 +/*
4608 +<:copyright-broadcom 
4609
4610 + Copyright (c) 2002 Broadcom Corporation 
4611 + All Rights Reserved 
4612 + No portions of this material may be reproduced in any form without the 
4613 + written permission of: 
4614 +          Broadcom Corporation 
4615 +          16215 Alton Parkway 
4616 +          Irvine, California 92619 
4617 + All information contained in this document is Broadcom Corporation 
4618 + company private, proprietary, and trade secret. 
4619
4620 +:>
4621 +*/
4622 +/* BlockUtil.h
4623 + *
4624 + *     Description:
4625 + *             This file contains the interfaces for the fixed point block
4626 + *             processing utilities.
4627 + *
4628 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
4629 + * Authors: Mark Gonikberg, Haixiang Liang.
4630 + *
4631 + * $Revision: 1.23 $
4632 + *
4633 + * $Id: BlockUtil.h,v 1.23 2004/04/13 00:31:10 ilyas Exp $
4634 + *
4635 + * $Log: BlockUtil.h,v $
4636 + * Revision 1.23  2004/04/13 00:31:10  ilyas
4637 + * Added standard header for shared ADSL driver files
4638 + *
4639 + * Revision 1.22  2003/07/11 01:49:01  gsyu
4640 + * Added BlockShortClearByLong to speed up performance
4641 + *
4642 + * Revision 1.21  2003/07/10 22:35:23  gsyu
4643 + * Speed up BlockByteXXX performance
4644 + *
4645 + * Revision 1.20  2003/07/10 22:15:51  gsyu
4646 + * Added BlockByteMoveByWord to speed up performance
4647 + *
4648 + * Revision 1.19  2002/03/12 00:03:03  yongbing
4649 + * Modify cplxScaleCplxSymbols to accept a shift value instead of an array of shifts
4650 + *
4651 + * Revision 1.18  2001/03/14 00:50:25  georgep
4652 + * All targets use FEQ_PASS_FFTSHIFT, remove code for case where its not defined
4653 + *
4654 + * Revision 1.17  2000/11/30 03:54:09  khp
4655 + * -BlockRealScaleCplxSymbols instead of BlockScaleComplexSymbols
4656 + *
4657 + * Revision 1.16  2000/11/29 20:42:12  liang
4658 + * Add function for ADSL xmt gains with fixed shift.
4659 + *
4660 + * Revision 1.15  2000/10/02 19:24:08  georgep
4661 + * Modify FEQ for new fft, fft outputs a shift for each block
4662 + *
4663 + * Revision 1.14  2000/09/09 00:23:48  liang
4664 + * Add corresponding functions for the ComplexLong FEQ coef.
4665 + *
4666 + * Revision 1.13  2000/05/17 01:36:52  yongbing
4667 + * Add Pentium MMX assembly codes for more block related functions
4668 + *
4669 + * Revision 1.12  2000/04/19 19:22:22  yongbing
4670 + * Add BlockShortScaleby2 function used in G994p1
4671 + *
4672 + * Revision 1.11  2000/04/04 02:28:01  liang
4673 + * Merged with SoftDsl_0_2 from old tree.
4674 + *
4675 + * Revision 1.11  2000/03/14 23:29:01  yongbing
4676 + * Add Pentim MMX codes for BlockCplxSymbolUpdateCplxScale function
4677 + *
4678 + * Revision 1.10  2000/02/16 01:53:00  yongbing
4679 + * Add Pentium MMX module for FEQ
4680 + *
4681 + * Revision 1.9  1999/11/02 02:49:55  liang
4682 + * Add BlockComplexPower function.
4683 + *
4684 + * Revision 1.8  1999/08/05 19:42:34  liang
4685 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
4686 + *
4687 + * Revision 1.7  1999/06/16 00:54:39  liang
4688 + * BlockRealScaleComplexSymbols takes a scale shift buffer now.
4689 + *
4690 + * Revision 1.6  1999/05/22 02:18:29  liang
4691 + * Add one more parameter to BlockCplxSymbolUpdateCplxScale function.
4692 + *
4693 + * Revision 1.5  1999/05/14 22:49:39  liang
4694 + * Added two more functions.
4695 + *
4696 + * Revision 1.4  1999/03/26 03:29:57  liang
4697 + * Add function BlockComplexMultLongAcc.
4698 + *
4699 + * Revision 1.3  1999/02/22 22:40:59  liang
4700 + * BlockByteSum takes uchar inputs instead of schar.
4701 + *
4702 + * Revision 1.2  1999/02/10 01:56:44  liang
4703 + * Added BlockByteSum, BlockRealScaleComplexSymbols and BlockCplxScaleComplexSymbols.
4704 + *
4705 + * Revision 1.1  1998/10/28 01:35:38  liang
4706 + * *** empty log message ***
4707 + *
4708 + * Revision 1.12  1998/07/08 17:09:25  scott
4709 + * Removed unnecessary undefs
4710 + *
4711 + * Revision 1.11  1998/04/02 06:19:44  mwg
4712 + * Added two new utilities.
4713 + *
4714 + * Revision 1.10  1998/03/26 23:20:55  liang
4715 + * Added function BlockShortMultiply.
4716 + *
4717 + * Revision 1.9  1998/02/16  18:41:00  scott
4718 + * Added MMX autodetect support
4719 + *
4720 + * Revision 1.8  1997/12/13 06:11:35  mwg
4721 + * Added new functions:
4722 + * BlockLongSubtract()
4723 + * BlockLongAdd()
4724 + * BlockLong2ShortSubtract()
4725 + * BlockShort2LongMove()
4726 + * BlockShortInterpolate()
4727 + * BlockLongCorrelate()
4728 + * BlockMapShort2Short()
4729 + *
4730 + * Revision 1.7  1997/03/19 18:35:10  mwg
4731 + * Changed copyright notice.
4732 + *
4733 + * Revision 1.6  1997/02/11  00:08:18  mwg
4734 + * Added BlockByteMove function
4735 + *
4736 + * Revision 1.5  1997/02/04  08:40:08  mwg
4737 + * Changed interface forBlockReal2ComplexMacc()
4738 + *
4739 + * Revision 1.4  1997/01/23  02:04:28  mwg
4740 + * Added return value to BlockShortMove
4741 + *
4742 + * Revision 1.3  1996/12/19  22:34:55  mwg
4743 + * Added new function BlockFullPower().
4744 + *
4745 + * Revision 1.2  1996/02/21  03:59:15  mwg
4746 + * Added new function BlockReal2ComplexMacc
4747 + *
4748 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
4749 + * Redesigned the project directory structure. Merged V.34 into the project.
4750 + *
4751 + * Revision 1.5  1995/04/04  06:09:32  mwg
4752 + * Changed the SoftModem status reporting: now the status is a structure/union
4753 + * where different fields used for different status code. This will enable
4754 + * efficient status snooping for high level protocols on top of the softmodem.
4755 + *
4756 + */
4757 +
4758 +#ifndef        BlockUtilPh
4759 +#define        BlockUtilPh
4760 +
4761 +extern void    BlockLongAdd                            (int, long*, long*, long*);
4762 +extern void    BlockLong2ShortSubtract         (int, long*, long*, short*);
4763 +extern void    BlockShort2LongMove                     (int, short*, long*);
4764 +extern void    BlockShortMultiply                      (int, int, short*, short*, short*);
4765 +extern void    BlockByteMoveUnaligned          (int size, uchar *srcPtr, uchar *dstPtr);
4766 +extern void    BlockShortOffset                        (int, short, short*, short*);
4767 +extern long    BlockShortInterpolateWithIncrement (int size, long scaleFactor, long increment, int shift, short* src1Ptr, short* src2Ptr, short* dstPtr);
4768 +extern void    BlockReal2ComplexMult           (int, short*, ComplexShort*, ComplexShort*);
4769 +extern void    BlockComplexConjigateMult       (int, ComplexShort*, ComplexShort*, ComplexShort*);
4770 +
4771 +extern long    BlockSum                                        (int, short*);
4772 +extern long    BlockByteSum                            (int, uchar*);
4773 +extern void    BlockComplexSum                         (int, ComplexShort*, ComplexLong*);
4774 +extern void    BlockComplexPower                       (int, int, ComplexShort*, long*);
4775 +extern long    BlockFullPower                          (int, short*);
4776 +extern long    BlockLongCorrelate                      (int, long*, long*);
4777 +
4778 +extern int             BlockSymbol2Byte                        (int, int, ushort*, uchar*);
4779 +extern int             BlockByte2Symbol                        (int, int, uchar*, ushort*);
4780 +
4781 +extern void    BlockMapShort2Complex           (int, ushort*, ComplexByte*, ComplexShort*);
4782 +extern void    BlockMapShort2Short                     (int size, ushort *srcPtr, short *mapPtr, short *dstPtr);
4783 +extern void    BlockMapByte2Byte                       (int size, uchar *srcPtr, uchar *mapPtr, uchar *dstPtr);
4784 +extern void    BlockMapByte2Short                      (int size, uchar *srcPtr, short *mapPtr, short *dstPtr);
4785 +extern void    BlockShortMult                          (int size, int shift, short* src1Ptr, short* src2Ptr, short* dstPtr);
4786 +
4787 +extern int             SM_DECL Idle(void);
4788 +
4789 +extern void    BlockGenerateAngles(int size, ComplexShort *anglePtr, ComplexShort *incPtr, ComplexShort *dstPtr);
4790 +extern void    BlockExtractRealPart(int size, ComplexShort *srcPtr, short *dstPtr);
4791 +extern void    BlockShortScaleByShift (int size, int shift, short* srcPtr, short* dstPtr);
4792 +
4793 +#ifndef PENTIUM_REDEFS /* only if these have not been redefined to function pointers */
4794 +extern long    BlockPower                                      (int, short*);
4795 +extern void    BlockReal2ComplexMacc           (int, int, short*, ComplexShort*, ComplexLong*);
4796 +extern void    BlockComplexMult                        (int, ComplexShort*, ComplexShort*, ComplexShort*);
4797 +extern void    BlockShortScale                         (int, short, int, short*, short*);
4798 +extern int             SM_DECL BlockShortMove                          (int, short*, short*);
4799 +extern long    BlockCorrelate                          (int, short*, short*);
4800 +
4801 +extern void    BlockRealScaleComplexSymbols(int, int, uchar*, short*, ComplexShort*, ComplexShort*);
4802 +/* FIXME -- the following 3 functions can be removed */
4803 +extern void    BlockCplxScaleComplexSymbols(int, int, int, ComplexShort*, ComplexShort*, ComplexShort*);
4804 +extern void    BlockCplxSymbolUpdateCplxScale(int, int, int, uchar*, ComplexShort*,
4805 +                                       ComplexShort*, ComplexShort*, ComplexShort*);
4806 +extern void    BlockComplexShortFill           (int, short, short, ComplexShort*);
4807 +
4808 +
4809 +extern void    BlockRealScaleCplxSymbols(int, int, int, short*, ComplexShort*, ComplexShort*);
4810 +extern void    BlockCplxLongConjigateMultCplxShort(int, ComplexLong*, ComplexShort*, ComplexLong*);
4811 +
4812 +extern void    BlockCplxLongScaleCplxSymbols(int, int, int, ComplexLong*, ComplexShort*, short*, ComplexShort*);
4813 +extern void    BlockCplxSymbolUpdateCplxLongScale(int, int, int, int,
4814 +                                       ComplexShort*, short *, ComplexLong*, ComplexShort*);
4815 +
4816 +extern void    BlockComplexLongFill            (int, long, long, ComplexLong*);
4817 +
4818 +extern void    BlockShortSubtract                      (int, short*, short*, short*);
4819 +extern void    BlockLongSubtract                       (int, long*, long*, long*);
4820 +extern void    BlockShortAdd                           (int, short*, short*, short*);
4821 +extern void    BlockByteMove                           (int, uchar*, uchar*);
4822 +extern void    BlockByteMoveByLong                     (int, uchar*, uchar*);
4823 +extern void    SM_DECL BlockByteFill           (int, uchar, uchar*);
4824 +extern void    BlockByteFillByLong             (int, uchar, uchar*);
4825 +extern void    BlockByteClear                          (int, uchar*);
4826 +extern void    BlockByteClearByLong            (int, uchar*);
4827 +extern void    BlockShortFill                          (int, short, short*);
4828 +extern void    BlockShortClear                         (int, short*);
4829 +extern void    BlockShortClearByLong           (int, short*);
4830 +extern void    BlockLongFill                           (int, long, long*);
4831 +extern void    BlockLongClear                          (int, long*);
4832 +extern void    BlockComplexShortClear          (int, ComplexShort*);
4833 +extern void    BlockShortInvert                        (int, short*, short*);
4834 +extern void    BlockShortScaleDown                     (int, short*);
4835 +extern void    BlockLongMove                           (int, long*, long*);
4836 +extern void    BlockShortInterpolate           (int, short, int, short*, short*, short*);
4837 +extern void    BlockComplexMultLongAcc     (int, int, ComplexShort*, ComplexShort*, ComplexLong*);
4838 +
4839 +#endif
4840 +
4841 +#endif /* BlockUtilPh */
4842 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/CircBuf.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/CircBuf.h
4843 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/CircBuf.h      1970-01-01 01:00:00.000000000 +0100
4844 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/CircBuf.h     2006-06-26 09:07:10.000000000 +0200
4845 @@ -0,0 +1,217 @@
4846 +/*
4847 +<:copyright-broadcom 
4848
4849 + Copyright (c) 2002 Broadcom Corporation 
4850 + All Rights Reserved 
4851 + No portions of this material may be reproduced in any form without the 
4852 + written permission of: 
4853 +          Broadcom Corporation 
4854 +          16215 Alton Parkway 
4855 +          Irvine, California 92619 
4856 + All information contained in this document is Broadcom Corporation 
4857 + company private, proprietary, and trade secret. 
4858
4859 +:>
4860 +*/
4861 +/****************************************************************************
4862 + *
4863 + * CircBuf -- Generic Circular Buffer
4864 + *
4865 + * Description:
4866 + *     Implementation of generic circular buffer algorithms
4867 + *
4868 + *
4869 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
4870 + * Authors: Ilya Stomakhin
4871 + *
4872 + * $Revision: 1.14 $
4873 + *
4874 + * $Id: CircBuf.h,v 1.14 2004/06/24 03:10:37 ilyas Exp $
4875 + *
4876 + * $Log: CircBuf.h,v $
4877 + * Revision 1.14  2004/06/24 03:10:37  ilyas
4878 + * Added extra macro to be able to use un-cached variable (for status write)
4879 + *
4880 + * Revision 1.13  2004/02/09 23:47:02  ilyas
4881 + * Fixed last change
4882 + *
4883 + * Revision 1.12  2004/02/06 22:52:58  ilyas
4884 + * Improved stretch buffer write
4885 + *
4886 + * Revision 1.11  2002/12/30 23:27:55  ilyas
4887 + * Added macro for HostDma optimizations
4888 + *
4889 + * Revision 1.10  2002/10/26 02:15:02  ilyas
4890 + * Optimized and added new macros for HostDma
4891 + *
4892 + * Revision 1.9  2002/01/22 23:59:29  ilyas
4893 + * Added paraenthesis around macro argument
4894 + *
4895 + * Revision 1.8  2002/01/15 22:28:38  ilyas
4896 + * Extended macro to support readPtr from uncached address
4897 + *
4898 + * Revision 1.7  2001/09/21 19:47:05  ilyas
4899 + * Fixed compiler warnings for VxWorks build
4900 + *
4901 + * Revision 1.6  2001/06/07 18:47:56  ilyas
4902 + * Added more macros for circular buffer arithmetics
4903 + *
4904 + * Revision 1.5  2001/04/18 03:58:34  ilyas
4905 + * Added LOG file write granularity
4906 + *
4907 + * Revision 1.4  2001/01/19 04:34:12  ilyas
4908 + * Added more macros to circular buffer implementation
4909 + *
4910 + * Revision 1.3  2001/01/06 04:01:41  ilyas
4911 + * Changed the way we write status messages
4912 + *
4913 + * Revision 1.2  2001/01/04 05:52:21  ilyas
4914 + * Added implementation of stretchable circular buffer used in LOG and Status
4915 + * handlers
4916 + *
4917 + * Revision 1.1  2000/05/03 03:45:55  ilyas
4918 + * Original implementation
4919 + *
4920 + *
4921 + *****************************************************************************/
4922 +
4923 +#ifndef        CircBufHeader_H_
4924 +#define        CircBufHeader_H_
4925 +
4926 +
4927 +typedef struct {
4928 +       char    *pStart;
4929 +       char    *pEnd;
4930 +       char    *pRead;
4931 +       char    *pWrite;
4932 +} circBufferStruct;
4933 +
4934 +/* Initialize circular buffer */
4935 +
4936 +#define        CircBufferInit(pCB,buf,size)    do {                    \
4937 +       (pCB)->pStart = (char *) (buf);                                         \
4938 +       (pCB)->pRead = (pCB)->pWrite = (pCB)->pStart;           \
4939 +       (pCB)->pEnd = (pCB)->pStart + size;                                     \
4940 +} while (0)
4941 +
4942 +#define        CircBufferGetSize(pCB)                  ((pCB)->pEnd - (pCB)->pStart)
4943 +#define        CircBufferGetStartPtr(pCB)              ((void *) (pCB)->pStart)
4944 +#define        CircBufferGetEndPtr(pCB)                ((void *) (pCB)->pEnd)
4945 +
4946 +#define        CircBufferReset(pCB)                    (pCB)->pRead = (pCB)->pWrite = (pCB)->pStart
4947 +
4948 +
4949 +#define        CircBufferGetReadPtr(pCB)               ((void *) (pCB)->pRead)
4950 +#define        CircBufferGetWritePtr(pCB)              ((void *) (pCB)->pWrite)
4951 +
4952 +
4953 +#ifndef bcm47xx
4954 +#define        CircBufferDistance(pCB,p1,p2,d) ((char*)(p2) - (char*)(p1) - d >= 0 ?                   \
4955 +                                                                                       (char*)(p2) - (char*)(p1) - d :                 \
4956 +                                                                                       ((char*)(p2)- (char*)(p1) - d + ((pCB)->pEnd - (pCB)->pStart)))
4957 +
4958 +#define        CircBufferAddContig(pCB,p,n)    ((char*)(p) + (n) == (pCB)->pEnd ? (pCB)->pStart : (char*)(p) + (n))
4959 +#else
4960 +static __inline int CircBufferDistance(circBufferStruct *pCB, char *p1, char *p2, int d)
4961 +{
4962 +       int tmp = p2 - p1 - d;
4963 +
4964 +       return (tmp >= 0 ? tmp : tmp + (pCB->pEnd - pCB->pStart));
4965 +}
4966 +
4967 +static __inline char * CircBufferAddContig(circBufferStruct *pCB, char *p, int n)
4968 +{
4969 +       p += n;
4970 +       return (p == pCB->pEnd ? pCB->pStart : p);
4971 +}
4972 +#endif
4973 +
4974 +#define        CircBufferAdd(pCB,p,n)                  ((char*)(p) + (n) >= (pCB)->pEnd ?                                              \
4975 +                                                                                       (pCB)->pStart + ((char*)(p) + (n) - (pCB)->pEnd) :      \
4976 +                                                                                       (char*)(p) + (n))
4977 +
4978 +#define        CircBufferReadUpdate(pCB,n)             (pCB)->pRead = CircBufferAdd(pCB,(pCB)->pRead,n)
4979 +#define        CircBufferWriteUpdate(pCB,n)    (pCB)->pWrite= CircBufferAdd(pCB,(pCB)->pWrite,n)
4980 +
4981 +#define        CircBufferReadUpdateContig(pCB,n)       (pCB)->pRead = CircBufferAddContig(pCB,(pCB)->pRead,n)
4982 +#define        CircBufferWriteUpdateContig(pCB,n)      (pCB)->pWrite= CircBufferAddContig(pCB,(pCB)->pWrite,n)
4983 +
4984 +#define        CircBufferGetReadAvail(pCB)             CircBufferDistance(pCB,(pCB)->pRead,(pCB)->pWrite,0)
4985 +#define        CircBufferIsReadEmpty(pCB)              ((pCB)->pRead == (pCB)->pWrite)
4986 +#define        CircBufferGetWriteAvail(pCB)    CircBufferDistance(pCB,(pCB)->pWrite,(pCB)->pRead,1)
4987 +#define        CircBufferGetWriteAvailN(pCB,n) CircBufferDistance(pCB,(pCB)->pWrite,(pCB)->pRead,n)
4988 +
4989 +#define        CircBufferGetReadContig(pCB)    ((unsigned long)(pCB)->pWrite >= (unsigned long) (pCB)->pRead ? \
4990 +                                                                                       (pCB)->pWrite - (pCB)->pRead :          \
4991 +                                                                                       (pCB)->pEnd       - (pCB)->pRead)
4992 +
4993 +#define        CircBufferGetWriteContig(pCB)   ((pCB)->pEnd - (pCB)->pWrite > CircBufferGetWriteAvail(pCB) ?   \
4994 +                                                                                       CircBufferGetWriteAvail(pCB) :          \
4995 +                                                                                       (pCB)->pEnd - (pCB)->pWrite)
4996 +
4997 +/*
4998 +**
4999 +**             structure and macros for "strectch" buffer
5000 +**
5001 +*/
5002 +
5003 +typedef struct {
5004 +       char    *pStart;
5005 +       char    *pEnd;
5006 +       char    *pExtraEnd;
5007 +       char    *pStretchEnd;
5008 +       char    *pRead;
5009 +       char    *pWrite;
5010 +} stretchBufferStruct;
5011 +
5012 +#define        StretchBufferInit(pSB,buf,size,extra)   do {    \
5013 +       (pSB)->pStart = (char *) (buf);                                         \
5014 +       (pSB)->pRead = (pSB)->pWrite = (pSB)->pStart;           \
5015 +       (pSB)->pEnd = (pSB)->pStart + (size);                           \
5016 +       (pSB)->pStretchEnd = (pSB)->pEnd;                                       \
5017 +       (pSB)->pExtraEnd = (pSB)->pEnd+(extra);                         \
5018 +} while (0)
5019 +
5020 +#define        StretchBufferGetSize(pSB)               ((pSB)->pEnd - (pSB)->pStart)
5021 +#define        StretchBufferGetStartPtr(pSB)   ((void *) (pSB)->pStart)
5022 +#define        StretchBufferGetReadPtr(pSB)    ((void *) (pSB)->pRead)
5023 +#define        StretchBufferGetWritePtr(pSB)   ((void *) (pSB)->pWrite)
5024 +#define        StretchBufferReset(pSB)                 ((pSB)->pRead = (pSB)->pWrite = (pSB)->pStart)
5025 +
5026 +#define        StretchBufferGetReadToEnd(pSB)  ((pSB)->pStretchEnd - (pSB)->pRead)
5027 +
5028 +#define        StretchBufferGetReadAvail(pSB)          ((pSB)->pWrite - (pSB)->pRead >= 0 ?    \
5029 +                                                                                       (pSB)->pWrite - (pSB)->pRead   :                \
5030 +                                                                                       (pSB)->pStretchEnd - (pSB)->pRead)
5031 +#define        _StretchBufferGetWriteAvail(pSB,rd) ((rd) - (pSB)->pWrite > 0 ?                         \
5032 +                                                                                       (rd) - (pSB)->pWrite - 1 :                              \
5033 +                                                                                       ((pSB)->pExtraEnd - (pSB)->pWrite))
5034 +#define        StretchBufferGetWriteAvail(pSB)         _StretchBufferGetWriteAvail(pSB, (pSB)->pRead)
5035 +
5036 +#define        StretchBufferReadUpdate(pSB,n)          do {                                                            \
5037 +       char    *p;                                                                                                                                     \
5038 +                                                                                                                                                               \
5039 +       p = (pSB)->pRead + (n);                                                                                                         \
5040 +       (pSB)->pRead = (p >= (pSB)->pStretchEnd ? (pSB)->pStart : p);                           \
5041 +} while (0)
5042 +
5043 +#define        _StretchBufferWriteUpdate(pSB,rd,n)     do {                                                            \
5044 +       char    *p;                                                                                                                                     \
5045 +                                                                                                                                                               \
5046 +       p = (pSB)->pWrite + (n);                                                                                                        \
5047 +       if (p >= (pSB)->pEnd) {                                                                                                         \
5048 +         if ((rd) != (pSB)->pStart) {                                                                                          \
5049 +               (pSB)->pStretchEnd = p;                                                                                                 \
5050 +               (pSB)->pWrite = (pSB)->pStart;                                                                                  \
5051 +         }                                                                                                                                                     \
5052 +       }                                                                                                                                                       \
5053 +       else                                                                                                                                            \
5054 +               (pSB)->pWrite = p;                                                                                                              \
5055 +} while (0)
5056 +
5057 +#define        StretchBufferWriteUpdate(pSB,n)         _StretchBufferWriteUpdate(pSB,(pSB)->pRead,n)   
5058 +
5059 +#endif /* CircBufHeader_H_ */
5060 +
5061 +
5062 +
5063 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DList.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DList.h
5064 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DList.h        1970-01-01 01:00:00.000000000 +0100
5065 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DList.h       2006-06-26 09:07:10.000000000 +0200
5066 @@ -0,0 +1,131 @@
5067 +/*
5068 +<:copyright-broadcom 
5069
5070 + Copyright (c) 2002 Broadcom Corporation 
5071 + All Rights Reserved 
5072 + No portions of this material may be reproduced in any form without the 
5073 + written permission of: 
5074 +          Broadcom Corporation 
5075 +          16215 Alton Parkway 
5076 +          Irvine, California 92619 
5077 + All information contained in this document is Broadcom Corporation 
5078 + company private, proprietary, and trade secret. 
5079
5080 +:>
5081 +*/
5082 +/****************************************************************************
5083 + *
5084 + * DList.h
5085 + *
5086 + * Description:
5087 + *     Definition and implementation (via macros and inline functions)
5088 + *  of double-linked list
5089 + *
5090 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
5091 + * Authors: Ilya Stomakhin
5092 + *
5093 + *****************************************************************************/
5094 +
5095 +#ifndef        DListHeader_H_
5096 +#define        DListHeader_H_
5097 +
5098 +typedef struct _DListHeader
5099 +       {
5100 +       struct _DListHeader     *next;          /* next item in the list */
5101 +       struct _DListHeader     *prev;          /* prev item in the list */
5102 +       } DListHeader;
5103 +
5104 +typedef struct _DListUpHeader
5105 +       {
5106 +       struct _DListUpHeader   *next;  /* next item in the list */
5107 +       struct _DListUpHeader   *prev;  /* prev item in the list */
5108 +       struct _DListUpHeader   *head;  /* head of the list */
5109 +       } DListUpHeader;
5110 +
5111 +/* Double linked list DList management macros */
5112 +
5113 +#define        DListInit(pDListHead)   do {                                    \
5114 +       ((DListHeader *)(pDListHead))->next = pDListHead;       \
5115 +       ((DListHeader *)(pDListHead))->prev = pDListHead;       \
5116 +} while (0)
5117 +
5118 +#define        DListNext(pDListEntry)          (((DListHeader *)(pDListEntry))->next)
5119 +#define        DListPrev(pDListEntry)          (((DListHeader *)(pDListEntry))->prev)
5120 +
5121 +#define        DListEntryLinked(pDListEntry)   (NULL != DListNext(pDListEntry))
5122 +#define        DListUnlinkEntry(pDListEntry)   (DListNext(pDListEntry) = DListPrev(pDListEntry) = NULL)
5123 +
5124 +#define        DListFirst(pDListHead)          DListNext(pDListHead)
5125 +#define        DListLast(pDListHead)           DListPrev(pDListHead)
5126 +#define        DListValid(pDListHead,pEntry)   ((void *)(pDListHead) != (pEntry))
5127 +#define        DListEmpty(pDListHead)          ((void *)pDListHead == ((DListHeader *)pDListHead)->next)
5128 +
5129 +#define        DListInsertAfter(pDListEntry,pEntry)     do {                                           \
5130 +       ((DListHeader *)(pEntry))->next = ((DListHeader *)(pDListEntry))->next; \
5131 +       ((DListHeader *)(pEntry))->prev = (DListHeader *)(pDListEntry);                 \
5132 +       ((DListHeader *)(pDListEntry))->next->prev = (DListHeader *) (pEntry);  \
5133 +       ((DListHeader *)(pDListEntry))->next = (DListHeader *) (pEntry);                \
5134 +} while (0)
5135 +
5136 +#define        DListInsertBefore(pDListEntry,pEntry) do {                                                      \
5137 +       ((DListHeader *)(pEntry))->next = (DListHeader *)(pDListEntry);                 \
5138 +       ((DListHeader *)(pEntry))->prev = ((DListHeader *)(pDListEntry))->prev; \
5139 +       ((DListHeader *)(pDListEntry))->prev->next = (DListHeader *) (pEntry);  \
5140 +       ((DListHeader *)(pDListEntry))->prev = (DListHeader *) (pEntry);                \
5141 +} while (0)
5142 +
5143 +#define        DListInsertTail(pDListHead,pEntry)      DListInsertBefore(pDListHead,pEntry)
5144 +#define        DListInsertHead(pDListHead,pEntry)      DListInsertAfter(pDListHead,pEntry)
5145 +
5146 +#define        DListRemove(pDListEntry)        do {                            \
5147 +       ((DListHeader *)(pDListEntry))->prev->next = ((DListHeader *)(pDListEntry))->next;      \
5148 +       ((DListHeader *)(pDListEntry))->next->prev = ((DListHeader *)(pDListEntry))->prev;      \
5149 +} while (0)
5150 +
5151 +
5152 +#define        DListForEach(pDListHead,f,ref)          do {                    \
5153 +       DListHeader     *p = ((DListHeader *)(pDListHead))->next;       \
5154 +                                                                                                                       \
5155 +       while (DListValid(pDListHead,p)) {                                              \
5156 +         DListHeader *p0 = p;                                                                  \
5157 +         p = DListNext(p);                                                                             \
5158 +         if ( (f)((void *)p0, ref) ) break;                                    \
5159 +       }                                                                                                               \
5160 +} while (0)
5161 +
5162 +
5163 +/* Double linked list with up link DListUp management macros */
5164 +
5165 +#define        DListUpInit(pDListHead) do {                                                                            \
5166 +       ((DListUpHeader *)(pDListHead))->next = (DListUpHeader *) (pDListHead); \
5167 +       ((DListUpHeader *)(pDListHead))->prev = (DListUpHeader *) (pDListHead); \
5168 +       ((DListUpHeader *)(pDListHead))->head = (DListUpHeader *) (pDListHead); \
5169 +} while (0)
5170 +
5171 +#define        DListUpNext(pDListEntry)        ((DListUpHeader *) DListNext(pDListEntry))
5172 +#define        DListUpPrev(pDListEntry)        ((DListUpHeader *) DListPrev(pDListEntry))
5173 +#define        DListUpHead(pDListEntry)        (((DListUpHeader *)(pDListEntry))->head)
5174 +
5175 +#define        DListUpFirst(pDListHead)        DListUpNext(pDListHead)
5176 +#define        DListUpLast(pDListHead)         DListUpPrev(pDListHead)         
5177 +#define        DListUpValid(pEntry)            (((DListUpHeader *)(pEntry))->head != (void *) pEntry)
5178 +#define        DListUpEmpty(pDListHead)        DListEmpty(pDListHead)          
5179 +
5180 +#define        DListUpInsertAfter(pDListEntry,pEntry)   do {                                                   \
5181 +       DListInsertAfter(pDListEntry,pEntry);                                                                           \
5182 +       ((DListUpHeader *)(pEntry))->head = ((DListUpHeader *)(pDListEntry))->head;     \
5183 +} while (0)
5184 +
5185 +#define        DListUpInsertBefore(pDListEntry,pEntry)  do {                                                   \
5186 +       DListInsertBefore(pDListEntry,pEntry);                                                                          \
5187 +       ((DListUpHeader *)(pEntry))->head = ((DListUpHeader *)(pDListEntry))->head;     \
5188 +} while (0)
5189 +
5190 +#define        DListUpInsertTail(pDListHead,pEntry)    DListUpInsertBefore(pDListHead,pEntry)
5191 +#define        DListUpInsertHead(pDListHead,pEntry)    DListUpInsertAfter(pDListHead,pEntry)
5192 +
5193 +#define        DListUpRemove(pDListEntry)              DListRemove(pDListEntry)
5194 +#define        DListUpForEach(pDListHead,f,ref) DListForEach((DListHeader *)(pDListHead),f,ref)
5195 +
5196 +#endif /* DListHeader_H_ */
5197 +
5198 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DslFramer.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DslFramer.h
5199 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DslFramer.h    1970-01-01 01:00:00.000000000 +0100
5200 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/DslFramer.h   2006-06-26 09:07:10.000000000 +0200
5201 @@ -0,0 +1,159 @@
5202 +/*
5203 +<:copyright-broadcom 
5204
5205 + Copyright (c) 2002 Broadcom Corporation 
5206 + All Rights Reserved 
5207 + No portions of this material may be reproduced in any form without the 
5208 + written permission of: 
5209 +          Broadcom Corporation 
5210 +          16215 Alton Parkway 
5211 +          Irvine, California 92619 
5212 + All information contained in this document is Broadcom Corporation 
5213 + company private, proprietary, and trade secret. 
5214
5215 +:>
5216 +*/
5217 +/****************************************************************************
5218 + *
5219 + * DslFramer.h 
5220 + *
5221 + * Description:
5222 + *     This file contains common DSL framer definitions
5223 + *
5224 + *
5225 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
5226 + * Authors: Ilya Stomakhin
5227 + *
5228 + * $Revision: 1.3 $
5229 + *
5230 + * $Id: DslFramer.h,v 1.3 2004/07/21 01:39:41 ilyas Exp $
5231 + *
5232 + * $Log: DslFramer.h,v $
5233 + * Revision 1.3  2004/07/21 01:39:41  ilyas
5234 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
5235 + *
5236 + * Revision 1.2  2004/04/12 23:41:10  ilyas
5237 + * Added standard header for shared ADSL driver files
5238 + *
5239 + * Revision 1.1  2001/12/13 02:28:27  ilyas
5240 + * Added common framer (DslPacket and G997) and G997 module
5241 + *
5242 + *
5243 + *
5244 + *****************************************************************************/
5245 +
5246 +#ifndef        DslFramerHeader
5247 +#define        DslFramerHeader
5248 +
5249 +#include "DList.h"
5250 +
5251 +#define        kDslFramerInitialized                   0x80000000
5252 +
5253 +/* status codes */
5254 +
5255 +#define        kDslFramerRxFrame                               1
5256 +#define        kDslFramerRxFrameErr                    2
5257 +#define kDslFramerTxFrame                              3
5258 +#define        kDslFramerTxFrameErr                    4
5259 +
5260 +#define        kDslFramerRxFrameErrFlushed             1
5261 +#define        kDslFramerRxFrameErrAbort               2
5262 +#define        kDslFramerRxFrameErrPhy                 3
5263 +
5264 +#define        kDslFramerTxFrameErrFlushed             1
5265 +
5266 +
5267 +typedef        struct _dslFramerBufDesc {
5268 +       long            pkId;
5269 +       long            bufFlags;
5270 +       void            *bufPtr;
5271 +       long            bufLen;
5272 +} dslFramerBufDesc;
5273 +
5274 +/* data bufDesc flags */
5275 +
5276 +#define kDslFramerStartNewFrame                        1
5277 +#define kDslFramerEndOfFrame                   2
5278 +#define kDslFramerAbortFrame                   4
5279 +
5280 +#define kDslFramerExtraByteShift               3
5281 +#define kDslFramerExtraByteMask                        (0x7 << kDslFramerExtraByteShift)
5282 +
5283 +typedef struct _dslFramerControl {
5284 +       bitMap                                  setup;
5285 +       dslFrameHandlerType             rxIndicateHandlerPtr;
5286 +       dslFrameHandlerType             txCompleteHandlerPtr;
5287 +       dslStatusHandlerType    statusHandlerPtr;
5288 +       ulong                                   statusCode;
5289 +       ulong                                   statusOffset;
5290 +
5291 +       int                                             nRxBuffers;
5292 +       int                                             nRxBufSize;
5293 +       int                                             nRxPackets;
5294 +
5295 +       dslFrame                                *freeBufListPtr;
5296 +       void                                    *freeBufPool;
5297 +       void                                    *pBufMemory;
5298 +
5299 +       dslFrame                                *freePacketListPtr;
5300 +       void                                    *freePacketPool;
5301 +
5302 +       /* RX working data set */
5303 +
5304 +       dslFrame                                *pRxFrame;
5305 +       dslFrameBuffer                  *pRxBuf;
5306 +       uchar                                   *pRxBufData;
5307 +       uchar                                   *pRxBufDataEnd;
5308 +       int                                             rxFrameLen;
5309 +
5310 +       /* TX working data set */
5311 +
5312 +       DListHeader                             dlistTxWaiting;
5313 +       dslFrame                                *pTxFrame;
5314 +       dslFrameBuffer                  *pTxBuf;
5315 +       uchar                                   *pTxBufData;
5316 +       uchar                                   *pTxBufDataEnd;
5317 +
5318 +       /* stats data */
5319 +
5320 +       ulong                                   dslByteCntRxTotal;
5321 +       ulong                                   dslByteCntTxTotal;
5322 +
5323 +       ulong                                   dslFrameCntRxTotal;
5324 +       ulong                                   dslFrameCntRxErr;
5325 +       ulong                                   dslFrameCntTxTotal;
5326 +       
5327 +} dslFramerControl;
5328 +
5329 +
5330 +extern Boolean  DslFramerInit(
5331 +                       void                                    *gDslVars,
5332 +                       dslFramerControl                *dfCtrl,
5333 +                       bitMap                                  setup,
5334 +                       ulong                                   statusCode,
5335 +                       ulong                                   statusOffset,
5336 +                       dslFrameHandlerType             rxIndicateHandlerPtr,
5337 +                       dslFrameHandlerType             txCompleteHandlerPtr,
5338 +                       dslStatusHandlerType    statusHandlerPtr,
5339 +                       ulong                                   rxBufNum,
5340 +                       ulong                                   rxBufSize,
5341 +                       ulong                                   rxPacketNum);
5342 +extern void DslFramerClose(void *gDslVars, dslFramerControl *dfCtrl);
5343 +extern void DslFramerSendFrame(void *gDslVars, dslFramerControl *dfCtrl, dslFrame *pFrame);
5344 +extern void DslFramerReturnFrame(void *gDslVars, dslFramerControl *dfCtrl, dslFrame *pFrame);
5345 +
5346 +
5347 +extern Boolean DslFramerRxGetPtr(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
5348 +extern void    DslFramerRxDone  (void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
5349 +extern Boolean DslFramerTxGetPtr(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
5350 +extern void    DslFramerTxDone(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
5351 +extern Boolean DslFramerTxIdle (void *gDslVars, dslFramerControl *dfCtrl);
5352 +extern void DslFramerTxFlush(void *gDslVars, dslFramerControl *dfCtrl);
5353 +
5354 +extern void * DslFramerGetFramePoolHandler(dslFramerControl *dfCtrl);
5355 +extern void DslFramerClearStat(dslFramerControl *dfCtrl);
5356 +
5357 +extern void DslFramerRxFlushFrame (void *gDslVars, dslFramerControl *dfCtrl, int errCode);
5358 +extern void DslFramerRxFlush(void *gDslVars, dslFramerControl *dfCtrl);
5359 +
5360 +#endif /* DslFramerHeader */
5361 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Flatten.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Flatten.h
5362 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Flatten.h      1970-01-01 01:00:00.000000000 +0100
5363 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Flatten.h     2006-06-26 09:07:10.000000000 +0200
5364 @@ -0,0 +1,115 @@
5365 +/*
5366 +<:copyright-broadcom 
5367
5368 + Copyright (c) 2002 Broadcom Corporation 
5369 + All Rights Reserved 
5370 + No portions of this material may be reproduced in any form without the 
5371 + written permission of: 
5372 +          Broadcom Corporation 
5373 +          16215 Alton Parkway 
5374 +          Irvine, California 92619 
5375 + All information contained in this document is Broadcom Corporation 
5376 + company private, proprietary, and trade secret. 
5377
5378 +:>
5379 +*/
5380 +/****************************************************************************
5381 + *
5382 + * Flatten.h -- Header for Flatten/Unflatten command/status
5383 + *
5384 + * Copyright (c) 1998 AltoCom, Inc. All rights reserved.
5385 + * Authors: Ilya Stomakhin
5386 + *
5387 + * $Revision: 1.14 $
5388 + *
5389 + * $Id: Flatten.h,v 1.14 2004/03/04 19:48:52 linyin Exp $
5390 + *
5391 + * $Log: Flatten.h,v $
5392 + * Revision 1.14  2004/03/04 19:48:52  linyin
5393 + * Support adsl2plus
5394 + *
5395 + * Revision 1.13  2003/10/17 22:45:14  yongbing
5396 + * Increase buffer size for large B&G table of G992P3
5397 + *
5398 + * Revision 1.12  2003/08/12 23:16:26  khp
5399 + * - for Haixiang: added support for ADSL_MARGIN_TWEAK_TEST
5400 + *
5401 + * Revision 1.11  2003/02/27 06:33:03  ilyas
5402 + * Improved free space checking in command buffer (became a problem with
5403 + * 2 commands SetXmtgain and StartPhy)
5404 + *
5405 + * Revision 1.10  2003/01/11 01:27:07  ilyas
5406 + * Improved checking for available space in status buffer
5407 + *
5408 + * Revision 1.9  2002/09/07 01:43:59  ilyas
5409 + * Added support for OEM parameters
5410 + *
5411 + * Revision 1.8  2002/05/16 00:01:52  khp
5412 + * -added missing #endif
5413 + *
5414 + * Revision 1.7  2002/05/15 00:04:48  mprahlad
5415 + * increase the status buffer size - prevent memory overflow for annexC cases
5416 + *
5417 + * Revision 1.6  2002/04/05 04:10:33  linyin
5418 + * -hack to fit in Annex C firmware in LMEM
5419 + *
5420 + * Revision 1.5  2002/04/05 02:45:25  linyin
5421 + * Make the buffer side larger for annexC
5422 + *
5423 + * Revision 1.4  2002/01/30 07:19:06  ilyas
5424 + * Moved showtime code to LMEM
5425 + *
5426 + * Revision 1.3  2001/08/29 02:56:01  ilyas
5427 + * Added tests for flattening/unflatenning command and statuses (dual mode)
5428 + *
5429 + * Revision 1.2  2001/04/25 00:30:54  ilyas
5430 + * Adjusted MaxFrameLen
5431 + *
5432 + * Revision 1.1  2001/04/24 21:41:21  ilyas
5433 + * Implemented status flattening/unflattaning to transfer statuses between
5434 + * modules asynchronously through the circular buffer
5435 + *
5436 + *
5437 + *****************************************************************************/
5438 +
5439 +#ifndef _Flatten_H_
5440 +#define _Flatten_H_
5441 +
5442 +#include       "CircBuf.h"
5443 +
5444 +#ifdef ADSL_MARGIN_TWEAK_TEST
5445 +#define kMaxFlattenedCommandSize       272             /* maximum no. of bytes in flattened cmd */
5446 +#else
5447 +#define kMaxFlattenedCommandSize       128             /* maximum no. of bytes in flattened cmd */
5448 +#endif
5449 +#if    defined(G992_ANNEXC) || defined(G992P3)
5450 +#if defined(G992P5)
5451 +#define kMaxFlattenedStatusSize                2200    /* maximum no. of bytes in flattened status */
5452 +#else
5453 +#define kMaxFlattenedStatusSize                1100    /* maximum no. of bytes in flattened status */
5454 +#endif
5455 +#else
5456 +#define kMaxFlattenedStatusSize                 550    /* maximum no. of bytes in flattened status */
5457 +#endif
5458 +
5459 +#define        kMaxFlattenFramelength          (kMaxFlattenedStatusSize - (4*sizeof(long)) - 20)
5460 +
5461 +extern int     SM_DECL FlattenCommand  (dslCommandStruct *cmd, ulong *dstPtr, ulong nAvail);
5462 +extern int     SM_DECL UnflattenCommand(ulong *srcPtr, dslCommandStruct *cmd);
5463 +extern int     SM_DECL FlattenStatus   (dslStatusStruct *status, ulong *dstPtr, ulong nAvail);
5464 +extern int     SM_DECL UnflattenStatus (ulong *srcPtr, dslStatusStruct *status);
5465 +
5466 +#define        FlattenBufferInit(fb,fbData,bufSize,itemSize)           \
5467 +       StretchBufferInit(fb, fbData, bufSize, itemSize)
5468 +       
5469 +extern int     SM_DECL FlattenBufferStatusWrite(stretchBufferStruct *fBuf, dslStatusStruct *status);
5470 +extern int     SM_DECL FlattenBufferStatusRead(stretchBufferStruct *fBuf, dslStatusStruct *status);
5471 +
5472 +extern int     SM_DECL FlattenBufferCommandWrite(stretchBufferStruct *fBuf, dslCommandStruct *cmd);
5473 +extern int     SM_DECL FlattenBufferCommandRead(stretchBufferStruct *fBuf, dslCommandStruct *cmd);
5474 +
5475 +#define FlattenBufferReadComplete(fb,nBytes)                           \
5476 +       StretchBufferReadUpdate (fb, nBytes)
5477 +
5478 +#endif /* _Flatten_H_ */
5479 +
5480 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.gh
5481 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.gh        1970-01-01 01:00:00.000000000 +0100
5482 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.gh       2006-06-26 09:07:10.000000000 +0200
5483 @@ -0,0 +1,110 @@
5484 +/*
5485 +<:copyright-broadcom 
5486
5487 + Copyright (c) 2002 Broadcom Corporation 
5488 + All Rights Reserved 
5489 + No portions of this material may be reproduced in any form without the 
5490 + written permission of: 
5491 +          Broadcom Corporation 
5492 +          16215 Alton Parkway 
5493 +          Irvine, California 92619 
5494 + All information contained in this document is Broadcom Corporation 
5495 + company private, proprietary, and trade secret. 
5496
5497 +:>
5498 +*/
5499 +/****************************************************************************
5500 + *
5501 + * G992p3OvhMsg.gh 
5502 + *
5503 + * Description:
5504 + *     This is a header file which defines the type for the G992p3 overhead 
5505 + *  channel messages global variable structure.
5506 + *
5507 + *
5508 + * Copyright (c) 1999-2003 BroadCom, Inc. All rights reserved.
5509 + * Authors: Ilya Stomakhin
5510 + *
5511 + * $Revision: 1.5 $
5512 + *
5513 + * $Id: G992p3OvhMsg.gh,v 1.5 2004/09/11 03:52:25 ilyas Exp $
5514 + *
5515 + * $Log: G992p3OvhMsg.gh,v $
5516 + * Revision 1.5  2004/09/11 03:52:25  ilyas
5517 + * Added support for overhead message segmentation
5518 + *
5519 + * Revision 1.4  2004/07/07 01:27:20  ilyas
5520 + * Fixed OHC message stuck problem on L2 entry/exit
5521 + *
5522 + * Revision 1.3  2004/06/10 00:13:31  ilyas
5523 + * Added L2/L3 and SRA
5524 + *
5525 + * Revision 1.2  2004/04/12 23:34:52  ilyas
5526 + * Merged the latest ADSL driver chnages for ADSL2+
5527 + *
5528 + * Revision 1.1  2003/07/18 19:39:18  ilyas
5529 + * Initial G.992.3 overhead channel message implementation (from ADSL driver)
5530 + *
5531 + *
5532 + *****************************************************************************/
5533 +
5534 +#ifndef        G992p3OvhMsgFramerGlobals
5535 +#define        G992p3OvhMsgFramerGlobals
5536 +
5537 +#define        kG992p3OvhMsgMaxCmdSize                 (16 + 16)
5538 +#define        kG992p3OvhMsgMaxRspSize                 (16 + 2*512)
5539 +
5540 +typedef struct
5541 +       {
5542 +       dslFrame                                *segFrame;
5543 +       dslFrameBuffer                  *segFrBufCur;
5544 +       dslFrameBuffer                  segFrBuf;
5545 +       ulong                                   timeSegOut;
5546 +       uchar                                   tryCnt;
5547 +       uchar                                   segTotal;
5548 +       uchar                                   segId;
5549 +       }
5550 +       g992p3SegFrameCtlStruct;
5551 +
5552 +typedef struct
5553 +       {
5554 +       bitMap                                  setup;
5555 +       dslFrameHandlerType             rxReturnFramePtr;
5556 +       dslFrameHandlerType             txSendFramePtr;
5557 +       dslCommandHandlerType   cmdHandlerPtr;
5558 +       dslStatusHandlerType    statusHandlerPtr;
5559 +
5560 +       dslFrame                                txRspFrame;
5561 +       dslFrameBuffer                  txRspFrBuf;
5562 +       dslFrameBuffer                  txRspFrBuf1;
5563 +       uchar                                   txRspBuf[kG992p3OvhMsgMaxRspSize];
5564 +       dslFrame                                txPwrRspFrame;
5565 +       dslFrameBuffer                  txPwrRspFrBuf0;
5566 +       dslFrameBuffer                  txPwrRspFrBuf0a;
5567 +       dslFrameBuffer                  txPwrRspFrBuf1;
5568 +       uchar                                   txPwrRspBuf0[8];
5569 +       dslFrame                                txCmdFrame;
5570 +       dslFrameBuffer                  txCmdFrBuf0;
5571 +       dslFrameBuffer                  txCmdFrBuf0a;
5572 +       dslFrameBuffer                  txCmdFrBuf1;
5573 +       uchar                                   txCmdBuf[kG992p3OvhMsgMaxCmdSize];
5574 +       g992p3SegFrameCtlStruct txSegFrameCtl;
5575 +       ulong                                   txFlags;
5576 +       uchar                                   txL0Rq;
5577 +       uchar                                   txL3Rq;
5578 +
5579 +       ulong                                   timeMs;
5580 +       ulong                                   timeCmdOut;
5581 +       ulong                                   cmdTryCnt;
5582 +       ulong                                   cmdNum;
5583 +       ulong                                   timeRspOut;
5584 +       uchar                                   *txPmdCmd;
5585 +
5586 +       uchar                                   rxCmdMsgNum;
5587 +       uchar                                   rxRspMsgNum;
5588 +       uchar                                   txCmdMsgNum;
5589 +       uchar                                   txRspMsgNum;
5590 +       }
5591 +       g992p3OvhMsgVarsStruct;
5592 +
5593 +#endif /* G992p3OvhMsgFramerGlobals */
5594 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.h
5595 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.h 1970-01-01 01:00:00.000000000 +0100
5596 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G992p3OvhMsg.h        2006-06-26 09:07:10.000000000 +0200
5597 @@ -0,0 +1,64 @@
5598 +/*
5599 +<:copyright-broadcom 
5600
5601 + Copyright (c) 2002 Broadcom Corporation 
5602 + All Rights Reserved 
5603 + No portions of this material may be reproduced in any form without the 
5604 + written permission of: 
5605 +          Broadcom Corporation 
5606 +          16215 Alton Parkway 
5607 +          Irvine, California 92619 
5608 + All information contained in this document is Broadcom Corporation 
5609 + company private, proprietary, and trade secret. 
5610
5611 +:>
5612 +*/
5613 +/****************************************************************************
5614 + *
5615 + * G992p3OvhMsg.h 
5616 + *
5617 + * Description:
5618 + *     This file contains the exported functions and definitions for G992p3 
5619 + *  overhead channel messages
5620 + *
5621 + *
5622 + * Copyright (c) 1999-2003 BroadCom, Inc. All rights reserved.
5623 + * Authors: Ilya Stomakhin
5624 + *
5625 + * $Revision: 1.1 $
5626 + *
5627 + * $Id: G992p3OvhMsg.h,v 1.1 2003/07/18 19:39:18 ilyas Exp $
5628 + *
5629 + * $Log: G992p3OvhMsg.h,v $
5630 + * Revision 1.1  2003/07/18 19:39:18  ilyas
5631 + * Initial G.992.3 overhead channel message implementation (from ADSL driver)
5632 + *
5633 + *
5634 + *****************************************************************************/
5635 +
5636 +#ifndef        G992p3OvhMsgFramerHeader
5637 +#define        G992p3OvhMsgFramerHeader
5638 +
5639 +#define        kG992p3OvhMsgFrameBufCnt        -1
5640 +
5641 +extern Boolean  G992p3OvhMsgInit(
5642 +               void                                    *gDslVars, 
5643 +               bitMap                                  setup,
5644 +               dslFrameHandlerType             rxReturnFramePtr,
5645 +               dslFrameHandlerType             txSendFramePtr,
5646 +               dslCommandHandlerType   commandHandler,
5647 +               dslStatusHandlerType    statusHandler);
5648 +
5649 +extern void            G992p3OvhMsgReset(void *gDslVars);
5650 +extern void            G992p3OvhMsgClose(void *gDslVars);
5651 +extern void            G992p3OvhMsgTimer(void *gDslVars, long timeQ24ms);
5652 +extern Boolean G992p3OvhMsgCommandHandler (void *gDslVars, dslCommandStruct *cmd);
5653 +extern void            G992p3OvhMsgStatusSnooper (void *gDslVars, dslStatusStruct *status);
5654 +
5655 +extern int             G992p3OvhMsgSendCompleteFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
5656 +extern  int            G992p3OvhMsgIndicateRcvFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
5657 +
5658 +extern void            G992p3OvhMsgSetL3(void *gDslVars);
5659 +extern void            G992p3OvhMsgSetL0(void *gDslVars);
5660 +
5661 +#endif /* G992p3OvhMsgFramerHeader */
5662 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.gh
5663 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.gh        1970-01-01 01:00:00.000000000 +0100
5664 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.gh       2006-06-26 09:07:10.000000000 +0200
5665 @@ -0,0 +1,66 @@
5666 +/****************************************************************************
5667 + *
5668 + * G997.gh 
5669 + *
5670 + * Description:
5671 + *     This is a header file which defines the type for the G997 Framer
5672 + *     global variable structure.
5673 + *
5674 + *
5675 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
5676 + * Authors: Ilya Stomakhin
5677 + *
5678 + * $Revision: 1.5 $
5679 + *
5680 + * $Id: G997.gh,v 1.5 2004/07/21 01:39:41 ilyas Exp $
5681 + *
5682 + * $Log: G997.gh,v $
5683 + * Revision 1.5  2004/07/21 01:39:41  ilyas
5684 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
5685 + *
5686 + * Revision 1.4  2004/04/27 00:27:16  ilyas
5687 + * Implemented double buffering to ensure G.997 HDLC frame is continuous
5688 + *
5689 + * Revision 1.3  2003/07/18 18:56:59  ilyas
5690 + * Added support for shared TX buffer (for ADSL driver)
5691 + *
5692 + * Revision 1.2  2002/01/11 06:48:27  ilyas
5693 + * Added command handler pointer
5694 + *
5695 + * Revision 1.1  2001/12/13 02:28:27  ilyas
5696 + * Added common framer (DslPacket and G997) and G997 module
5697 + *
5698 + *
5699 + *****************************************************************************/
5700 +
5701 +#ifndef        G997FramerGlobals
5702 +#define        G997FramerGlobals
5703 +
5704 +#include "DslFramer.h"
5705 +#include "HdlcFramer.h"
5706 +
5707 +#define        kG997MsgBufSize         64
5708 +
5709 +typedef struct
5710 +       {
5711 +       bitMap                                  setup;
5712 +       dslFramerControl                dslFramer;
5713 +       hdlcByteControl                 hdlcByte;
5714 +       dslCommandHandlerType   commandHandler;
5715 +
5716 +       ulong                                   timeMs;
5717 +       ulong                                   timeCmdOut;
5718 +
5719 +       uchar                                   rxMsgNum;               
5720 +       uchar                                   txMsgNum;
5721 +       Boolean                                 txIdle;         
5722 +       uchar                                   txMsgBuf[kG997MsgBufSize];
5723 +       ulong                                   txMsgBufLen;
5724 +       uchar                                   *txMsgBufPtr;
5725 +       ulong                                   txMsgLen;
5726 +       ulong                                   txMsgBufs;
5727 +       ulong                                   txMsgBufNum;
5728 +       }
5729 +       g997VarsStruct;
5730 +
5731 +#endif /* G997FramerGlobals */
5732 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.h
5733 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.h 1970-01-01 01:00:00.000000000 +0100
5734 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/G997.h        2006-06-26 09:07:10.000000000 +0200
5735 @@ -0,0 +1,68 @@
5736 +/*
5737 +<:copyright-broadcom 
5738
5739 + Copyright (c) 2002 Broadcom Corporation 
5740 + All Rights Reserved 
5741 + No portions of this material may be reproduced in any form without the 
5742 + written permission of: 
5743 +          Broadcom Corporation 
5744 +          16215 Alton Parkway 
5745 +          Irvine, California 92619 
5746 + All information contained in this document is Broadcom Corporation 
5747 + company private, proprietary, and trade secret. 
5748
5749 +:>
5750 +*/
5751 +/****************************************************************************
5752 + *
5753 + * G997.h 
5754 + *
5755 + * Description:
5756 + *     This file contains the exported functions and definitions for G97Framer
5757 + *
5758 + *
5759 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
5760 + * Authors: Ilya Stomakhin
5761 + *
5762 + * $Revision: 1.3 $
5763 + *
5764 + * $Id: G997.h,v 1.3 2003/07/18 18:56:59 ilyas Exp $
5765 + *
5766 + * $Log: G997.h,v $
5767 + * Revision 1.3  2003/07/18 18:56:59  ilyas
5768 + * Added support for shared TX buffer (for ADSL driver)
5769 + *
5770 + * Revision 1.2  2002/07/20 00:51:41  ilyas
5771 + * Merged witchanges made for VxWorks/Linux driver.
5772 + *
5773 + * Revision 1.1  2001/12/13 02:28:27  ilyas
5774 + * Added common framer (DslPacket and G997) and G997 module
5775 + *
5776 + *
5777 + *
5778 + *****************************************************************************/
5779 +
5780 +#ifndef        G997FramerHeader
5781 +#define        G997FramerHeader
5782 +
5783 +extern Boolean  G997Init(
5784 +               void                                    *gDslVars, 
5785 +               bitMap                                  setup, 
5786 +               ulong                                   rxBufNum,
5787 +               ulong                                   rxBufSize,
5788 +               ulong                                   rxPacketNum,
5789 +               upperLayerFunctions             *pUpperLayerFunctions,
5790 +               dslCommandHandlerType   g997PhyCommandHandler);
5791 +
5792 +extern void            G997Close(void *gDslVars);
5793 +extern void            G997Timer(void *gDslVars, long timeQ24ms);
5794 +extern Boolean G997CommandHandler (void *gDslVars, dslCommandStruct *cmd);
5795 +extern void            G997StatusSnooper (void *gDslVars, dslStatusStruct *status);
5796 +
5797 +extern int             G997SendFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
5798 +extern  int            G997ReturnFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
5799 +
5800 +extern  Boolean G997SetTxBuffer(void *gDslVars, ulong len, void *bufPtr);
5801 +extern void *  G997GetFramePoolHandler(void *gDslVars);
5802 +
5803 +#endif /* G997FramerHeader */
5804 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/HdlcFramer.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/HdlcFramer.h
5805 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/HdlcFramer.h   1970-01-01 01:00:00.000000000 +0100
5806 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/HdlcFramer.h  2006-06-26 09:07:10.000000000 +0200
5807 @@ -0,0 +1,237 @@
5808 +/*
5809 +<:copyright-broadcom 
5810
5811 + Copyright (c) 2002 Broadcom Corporation 
5812 + All Rights Reserved 
5813 + No portions of this material may be reproduced in any form without the 
5814 + written permission of: 
5815 +          Broadcom Corporation 
5816 +          16215 Alton Parkway 
5817 +          Irvine, California 92619 
5818 + All information contained in this document is Broadcom Corporation 
5819 + company private, proprietary, and trade secret. 
5820
5821 +:>
5822 +*/
5823 +/****************************************************************************
5824 + *
5825 + * HdlcFramer.h 
5826 + *
5827 + * Description:
5828 + *     This file contains common HDLC definitions for bit/byte stuffing
5829 + *
5830 + *
5831 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
5832 + * Authors: Ilya Stomakhin
5833 + *
5834 + * $Revision: 1.3 $
5835 + *
5836 + * $Id: HdlcFramer.h,v 1.3 2004/07/21 01:39:41 ilyas Exp $
5837 + *
5838 + * $Log: HdlcFramer.h,v $
5839 + * Revision 1.3  2004/07/21 01:39:41  ilyas
5840 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
5841 + *
5842 + * Revision 1.2  2003/07/18 18:51:05  ilyas
5843 + * Added mode (default) to pass address and control field
5844 + *
5845 + * Revision 1.1  2001/12/13 02:28:27  ilyas
5846 + * Added common framer (DslPacket and G997) and G997 module
5847 + *
5848 + *
5849 + *
5850 + *****************************************************************************/
5851 +
5852 +#ifndef        HdlcFramerHeader
5853 +#define        HdlcFramerHeader
5854 +
5855 +/* setup bitmap definitions */
5856 +
5857 +#define        kHdlcSetupShift                 16
5858 +#define        kHdlcSetupMask                  ((long)0xFFFF << kHdlcSetupShift)
5859 +
5860 +#define        kHdlcCrcMask                    0x00030000
5861 +#define        kHdlcCrcNone                    0x00000000
5862 +#define        kHdlcCrc16                              0x00010000
5863 +#define        kHdlcCrc32                              0x00020000
5864 +
5865 +#define        kHdlcTxIdleStop                 0x00040000
5866 +#define        kHdlcSpecialAddrCtrl    0x00080000
5867 +
5868 +extern ushort HdlcCrc16Table[];
5869 +
5870 +#define HDLC16_CRC_INIT                        0xFFFF
5871 +#define HDLC16_CRC_FINAL(crc)  ((crc) ^ 0xFFFF)
5872 +#define HDLC16_GOOD_CRC                        0xF0B8
5873 +#define        Hdlc16UpdateCrc(crc,b)  ((crc) >> 8) ^ HdlcCrc16Table[((crc) ^ (b)) & 0xFF]
5874 +
5875 +extern ulong  HdlcCrc32Table[];
5876 +
5877 +#define HDLC32_CRC_INIT                        0xFFFFFFFF
5878 +#define HDLC32_CRC_FINAL(crc)  ((crc) ^ 0xFFFFFFFF)
5879 +#define HDLC32_GOOD_CRC                        0xDEBB20E3
5880 +#define        Hdlc32UpdateCrc(crc,b)  ((crc) >> 8) ^ HdlcCrc32Table[((crc) ^ (b)) & 0xFF]
5881 +
5882 +extern ulong  HdlcCrc32Table[];
5883 +
5884 +/* HDLC common fields */
5885 +
5886 +#define        HDLC_ADDR                               0xFF
5887 +#define        HDLC_CTRL                               0x3
5888 +
5889 +#define        HDLC_BYTE_FLAG                  0x7E
5890 +#define        HDLC_BYTE_ESC                   0x7D
5891 +
5892 +/* HDLC frame assembly states */
5893 +
5894 +#define        HDLC_STATE_START_FLAG   0
5895 +#define        HDLC_STATE_ADDRESS              (HDLC_STATE_START_FLAG + 1)
5896 +#define        HDLC_STATE_CONTROL              (HDLC_STATE_START_FLAG + 2)
5897 +#define        HDLC_STATE_DATA                 (HDLC_STATE_START_FLAG + 3)
5898 +#define        HDLC_STATE_FCS1                 (HDLC_STATE_START_FLAG + 4)
5899 +#define        HDLC_STATE_FCS2                 (HDLC_STATE_START_FLAG + 5)
5900 +#define        HDLC_STATE_END_FLAG             (HDLC_STATE_START_FLAG + 6)
5901 +
5902 +
5903 +/* HDLC common types */
5904 +
5905 +typedef struct _hdlcByteControl {
5906 +       bitMap                                  setup;
5907 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
5908 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
5909 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
5910 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
5911 +
5912 +       /* RX working data set */
5913 +
5914 +       uchar                                   rxFrameState;
5915 +       int                                             rxFrameLen;
5916 +       ulong                                   rxCrc;
5917 +       Boolean                                 rxEscChar;
5918 +
5919 +       uchar                                   *pRxData;
5920 +       uchar                                   *pRxDataEnd;
5921 +       long                                    rxDataLen;
5922 +
5923 +       /* TX working data set */
5924 +
5925 +       uchar                                   txFrameState;
5926 +       int                                             txFrameLen;
5927 +       ulong                                   txCrc;
5928 +       int                                             txCharPending;
5929 +
5930 +       uchar                                   *pTxData;
5931 +       uchar                                   *pTxDataEnd;
5932 +       long                                    txDataLen;
5933 +} hdlcByteControl;
5934 +
5935 +typedef struct _hdlcBitControl {
5936 +       bitMap                                  setup;
5937 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
5938 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
5939 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
5940 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
5941 +
5942 +       /* RX working data set */
5943 +
5944 +       uchar                                   rxFrameState;
5945 +       int                                             rxFrameLen;
5946 +       ulong                                   rxCrc;
5947 +       int                                             rxNibblePending;
5948 +       int                                             rxOutVal;
5949 +       uchar                                   rxOutBits;
5950 +       uchar                                   rxRem1Bits;
5951 +       Boolean                                 rxEscChar; /* ???? */
5952 +
5953 +       uchar                                   *pRxData;
5954 +       uchar                                   *pRxDataEnd;
5955 +       long                                    rxDataLen;
5956 +
5957 +       /* TX working data set */
5958 +
5959 +       uchar                                   txFrameState;
5960 +       int                                             txFrameLen;
5961 +       ulong                                   txCrc;
5962 +       int                                             txOutVal;
5963 +       uchar                                   txOutBits;
5964 +       uchar                                   txLast1Bits;
5965 +       int                                             txCharPending;  /* ???? */
5966 +
5967 +       uchar                                   *pTxData;
5968 +       uchar                                   *pTxDataEnd;
5969 +       long                                    txDataLen;
5970 +} hdlcBitControl;
5971 +
5972 +/* HDLC common functions */
5973 +
5974 +#define HdlcFramerTxFrameInit(ctrl)    do {                    \
5975 +       ctrl->txFrameState = HDLC_STATE_START_FLAG;             \
5976 +       ctrl->txFrameLen   = 0;                                                 \
5977 +       ctrl->txCrc                = HDLC16_CRC_INIT;                   \
5978 +       ctrl->txCharPending= -1;                                                \
5979 +} while (0)
5980 +
5981 +#define HdlcFramerRxFrameInit(ctrl) do {                       \
5982 +       ctrl->rxFrameState = HDLC_STATE_START_FLAG;             \
5983 +       ctrl->rxFrameLen   = 0;                                                 \
5984 +       ctrl->rxCrc                = HDLC16_CRC_INIT;                   \
5985 +       ctrl->rxEscChar    = false;                                             \
5986 +} while (0)
5987 +
5988 +#define HdlcFramerTxGetData(ctrl)  do {                                                                \
5989 +       dslFramerBufDesc        bufDesc;                                                                        \
5990 +                                                                                                                                       \
5991 +       if ((ctrl->txDataGetPtrHandler) (gDslVars, &bufDesc)) {                 \
5992 +               ctrl->pTxData = bufDesc.bufPtr;                                                         \
5993 +               ctrl->pTxDataEnd = (uchar*)bufDesc.bufPtr + bufDesc.bufLen;     \
5994 +               ctrl->txDataLen  = bufDesc.bufLen;                                                      \
5995 +               if (bufDesc.bufFlags & kDslFramerStartNewFrame)                         \
5996 +                       HdlcFramerTxFrameInit(ctrl);                                                    \
5997 +       }                                                                                                                               \
5998 +       else {                                                                                                                  \
5999 +               HdlcFramerTxFrameInit(ctrl);                                                            \
6000 +       }                                                                                                                               \
6001 +} while (0);
6002 +
6003 +#define HdlcFramerRxGetData(ctrl, frFlag)  do {                                                \
6004 +       dslFramerBufDesc                bufDesc;                                                                \
6005 +                                                                                                                                       \
6006 +       bufDesc.bufFlags = frFlag;                                                                              \
6007 +       if ((ctrl->rxDataGetPtrHandler) (gDslVars, &bufDesc)) {                 \
6008 +               ctrl->pRxData = bufDesc.bufPtr;                                                         \
6009 +               ctrl->pRxDataEnd = (uchar*)bufDesc.bufPtr + bufDesc.bufLen;     \
6010 +               ctrl->rxDataLen  = bufDesc.bufLen;                                                      \
6011 +       }                                                                                                                               \
6012 +} while (0);
6013 +
6014 +/* HDLC functions headers */
6015 +
6016 +extern Boolean HdlcByteInit(
6017 +       void                                                    *gDslVars, 
6018 +       hdlcByteControl                                 *hbyCtrl,
6019 +       bitMap                                                  setup, 
6020 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler,
6021 +       dslFramerDataDoneHandlerType    rxDataDoneHandler,
6022 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler,
6023 +       dslFramerDataDoneHandlerType    txDataDoneHandler);
6024 +
6025 +extern void HdlcByteReset(void *gDslVars, hdlcByteControl *hbyCtrl);
6026 +extern void HdlcByteRxFlush(void *gDslVars, hdlcByteControl *hbyCtrl);
6027 +extern int HdlcByteRx(void *gDslVars, hdlcByteControl *hbyCtrl, int nBytes, uchar *srcPtr) FAST_TEXT;
6028 +extern int HdlcByteTx(void *gDslVars, hdlcByteControl *hbyCtrl, int nBytes, uchar *dstPtr) FAST_TEXT;
6029 +extern Boolean HdlcByteTxIdle(void *gDslVars, hdlcByteControl *hbyCtrl);
6030 +
6031 +extern Boolean HdlcBitInit(
6032 +       void                                                    *gDslVars, 
6033 +       hdlcBitControl                                  *hbiCtrl,
6034 +       bitMap                                                  setup, 
6035 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler,
6036 +       dslFramerDataDoneHandlerType    rxDataDoneHandler,
6037 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler,
6038 +       dslFramerDataDoneHandlerType    txDataDoneHandler);
6039 +
6040 +extern void HdlcBitReset(void *gDslVars, hdlcByteControl *hbiCtrl);
6041 +extern int HdlcBitRx(void *gDslVars, hdlcBitControl *hbiCtrl, int nBytes, uchar *srcPtr) FAST_TEXT;
6042 +extern int HdlcBitTx(void *gDslVars, hdlcBitControl *hbiCtrl, int nBytes, uchar *dstPtr) FAST_TEXT;
6043 +
6044 +#endif /* HdlcFramerHeader */
6045 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MathUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MathUtil.h
6046 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MathUtil.h     1970-01-01 01:00:00.000000000 +0100
6047 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MathUtil.h    2006-06-26 09:07:10.000000000 +0200
6048 @@ -0,0 +1,135 @@
6049 +/*
6050 +<:copyright-broadcom 
6051
6052 + Copyright (c) 2002 Broadcom Corporation 
6053 + All Rights Reserved 
6054 + No portions of this material may be reproduced in any form without the 
6055 + written permission of: 
6056 +          Broadcom Corporation 
6057 +          16215 Alton Parkway 
6058 +          Irvine, California 92619 
6059 + All information contained in this document is Broadcom Corporation 
6060 + company private, proprietary, and trade secret. 
6061
6062 +:>
6063 +*/
6064 +/************************************************************************
6065 + *
6066 + *     MathUtil.h:
6067 + *
6068 + *     Description:
6069 + *     This file contains the exported interface for MathUtil.c module.
6070 + *
6071 + *
6072 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
6073 + * Authors: Mark Gonikberg, Haixiang Liang.
6074 + *
6075 + * $Revision: 1.6 $
6076 + *
6077 + * $Id: MathUtil.h,v 1.6 2004/04/13 00:21:13 ilyas Exp $
6078 + *
6079 + * $Log: MathUtil.h,v $
6080 + * Revision 1.6  2004/04/13 00:21:13  ilyas
6081 + * Added standard header for shared ADSL driver files
6082 + *
6083 + * Revision 1.5  2001/08/16 02:18:08  khp
6084 + * - mark functions with FAST_TEXT to reduce cycle counts for QPROC targets
6085 + *   (replaces use of LMEM_INSN)
6086 + *
6087 + * Revision 1.4  1999/10/06 04:55:22  liang
6088 + * Added function to multiply two long values to save result as VeryLong.
6089 + *
6090 + * Revision 1.3  1999/08/05 19:42:52  liang
6091 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
6092 + *
6093 + * Revision 1.2  1999/03/26 03:29:59  liang
6094 + * Export CosSin table.
6095 + *
6096 + * Revision 1.1  1998/10/28 01:28:07  liang
6097 + * *** empty log message ***
6098 + *
6099 + * Revision 1.12  1998/02/10  17:19:49  scott
6100 + * Changed MathVL routines to return arguments using pointers
6101 + *
6102 + * Revision 1.11  1997/12/13 06:12:07  mwg
6103 + * Added more Atan2 flavors
6104 + *
6105 + * Revision 1.10  1997/11/18 01:11:48  mwg
6106 + * Removed <CR> symbols which accidently slipped in.
6107 + *
6108 + * Revision 1.9  1997/11/03  19:07:52  scott
6109 + * No longer redefine max() and min() if already defined
6110 + *
6111 + * Revision 1.8  1997/07/30 01:35:20  liang
6112 + * Add more accurate atan2 function UtilLongLongAtan2.
6113 + *
6114 + * Revision 1.7  1997/07/21  20:23:19  mwg
6115 + * Added new function: UtilBlockCos()
6116 + *
6117 + * Revision 1.6  1997/03/21  23:50:10  liang
6118 + * Added initial version of V8bis module to CVS tree.
6119 + *
6120 + * Revision 1.5  1997/03/19  18:35:34  mwg
6121 + * Changed copyright notice.
6122 + *
6123 + * Revision 1.4  1997/01/21  00:36:15  mwg
6124 + * Added new function: UtilBlockCosSin()
6125 + *
6126 + * Revision 1.3  1996/06/18  21:14:45  mwg
6127 + * Modified VLDivVL by allowing to specify the result scaling.
6128 + *
6129 + * Revision 1.2  1996/06/12  02:31:59  mwg
6130 + * Added 64bit arithmetic functions.
6131 + *
6132 + * Revision 1.1.1.1  1996/02/14  02:35:15  mwg
6133 + * Redesigned the project directory structure. Merged V.34 into the project.
6134 + *
6135 + * Revision 1.4  1995/12/04  23:08:15  liang
6136 + * Add file Math/LinearToLog.c.
6137 + *
6138 + ************************************************************************/
6139 +#ifndef        MathUtilPh
6140 +#define        MathUtilPh
6141 +
6142 +/* Exported tables */
6143 +extern const short             UtilCosTable[];
6144 +
6145 +/* Exported functions */
6146 +extern ComplexShort    UtilCosSin(ushort angle);
6147 +extern long                    UtilBlockCosSin (int nValues, long angle, long delta, ComplexShort *dstPtr);
6148 +extern long                    UtilBlockCos (int nValues, long angle, long delta, short *dstPtr);
6149 +extern ushort                  UtilShortShortAtan2(ComplexShort point);
6150 +extern ushort                  UtilLongShortAtan2(ComplexLong point);
6151 +extern ulong                   UtilShortLongAtan2(ComplexShort point) FAST_TEXT;
6152 +extern ulong                   UtilLongLongAtan2(ComplexLong point) FAST_TEXT;
6153 +extern ushort                  UtilSqrt(ulong y);
6154 +extern ushort                  UtilMaxMagnitude(int blkSize, ComplexShort *dataPtr);
6155 +extern short                   UtilQ0LinearToQ4dB (ulong x);
6156 +extern ulong                   UtilQ4dBToQ12Linear (short x);
6157 +extern void                    UtilAdjustComplexMagnitude(ComplexShort *srcPtr, short mag, short adjustment);
6158 +
6159 +extern void VLMultLongByLong(long x, long y, VeryLong *dst);
6160 +extern void VLMultShort        (VeryLong x, short y, VeryLong *dst);
6161 +extern void VLAddVL            (VeryLong x, VeryLong y, VeryLong *dst);
6162 +extern void VLAddLong  (VeryLong x, long y, VeryLong *dst);
6163 +extern void VLSubVL            (VeryLong x, VeryLong y, VeryLong *dst);
6164 +extern void VLSubLong  (VeryLong x, long y, VeryLong *dst);
6165 +extern void VLDivVL            (VeryLong x, VeryLong y, int scale, long *dst);
6166 +extern void VLShiftLeft(VeryLong x, int shift, VeryLong *dst);
6167 +extern void VLShiftRight(VeryLong x, int shift, VeryLong *dst);
6168 +
6169 +
6170 +#define        UtilAtan2               UtilShortShortAtan2
6171 +#define        UtilLongAtan2   UtilLongShortAtan2
6172 +
6173 +/* Standard Macros     */
6174 +#undef abs
6175 +#define                abs(x)                  ((x) >= 0   ? (x) : -(x))
6176 +
6177 +#undef max
6178 +#define                max(x, y)               ((x) >= (y) ? (x) : (y))
6179 +
6180 +#undef min
6181 +#define                min(x, y)               ((x) <= (y) ? (x) : (y))
6182 +
6183 +#endif /* MathUtilPh */
6184 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MipsAsm.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MipsAsm.h
6185 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MipsAsm.h      1970-01-01 01:00:00.000000000 +0100
6186 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MipsAsm.h     2006-06-26 09:07:10.000000000 +0200
6187 @@ -0,0 +1,264 @@
6188 +/*
6189 +<:copyright-broadcom 
6190
6191 + Copyright (c) 2002 Broadcom Corporation 
6192 + All Rights Reserved 
6193 + No portions of this material may be reproduced in any form without the 
6194 + written permission of: 
6195 +          Broadcom Corporation 
6196 +          16215 Alton Parkway 
6197 +          Irvine, California 92619 
6198 + All information contained in this document is Broadcom Corporation 
6199 + company private, proprietary, and trade secret. 
6200
6201 +:>
6202 +*/
6203 +/************************************************************************
6204 + *
6205 + *     MipsAsm.h:
6206 + *
6207 + *     Description:
6208 + *     This file contains definitions specific to MIPS assembly 
6209 + *
6210 + *
6211 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
6212 + * Authors: Mark Gonikberg, Haixiang Liang.
6213 + *
6214 + * $Revision: 1.5 $
6215 + *
6216 + * $Id: MipsAsm.h,v 1.5 2004/04/13 00:16:59 ilyas Exp $
6217 + *
6218 + * $Log: MipsAsm.h,v $
6219 + * Revision 1.5  2004/04/13 00:16:59  ilyas
6220 + * Merged the latest ADSL driver changes
6221 + *
6222 + * Revision 1.4  2002/09/12 04:08:50  ilyas
6223 + * Added macros for BCM MIPS specific instructions
6224 + *
6225 + * Revision 1.3  2000/11/18 21:28:19  mprahlad
6226 + * ifdef bcm47xx -
6227 + * define MSUB(src1,src2) msub src1, src2
6228 + * change Mult(dst, src1, src2) to use "mul" instead of "mult; mflo"
6229 + * define Mul(src1, src2) mult src1, src2
6230 + *
6231 + * Revision 1.2  2000/07/28 21:05:05  mprahlad
6232 + * Macros specific to bcm47xx added.
6233 + *
6234 + * Revision 1.1  1999/08/05 19:52:57  liang
6235 + * Copied from the softmodem top of the tree on 08/04/99.
6236 + *
6237 + * Revision 1.5  1999/04/02 23:16:21  mwg
6238 + * Fixed a minor comatibility issue with mult
6239 + *
6240 + * Revision 1.4  1999/02/03 20:25:43  mwg
6241 + * Added an option for R4010
6242 + *
6243 + * Revision 1.3  1998/10/30 02:21:34  mwg
6244 + * Added targets for 4640
6245 + *
6246 + * Revision 1.2  1998/10/16 18:52:09  ilyas
6247 + * Added ASM_PROLOG[5-7] macros to save on stores
6248 + *
6249 + * Revision 1.1  1998/06/03 23:28:39  mwg
6250 + * Renamed from DinoDefs.h
6251 + *
6252 + * Revision 1.6  1998/02/09  18:23:11  scott
6253 + * Added EMBEDDED_CALLING_CONVENTION (GreenHill) and R3900/R4102
6254 + *
6255 + * Revision 1.5  1997/03/19 18:35:02  mwg
6256 + * Changed copyright notice.
6257 + *
6258 + * Revision 1.4  1996/10/02  20:28:41  liang
6259 + * Remove parameter "acc" from the non-DINO version of MAD.
6260 + *
6261 + * Revision 1.3  1996/10/02  19:44:36  liang
6262 + * Separated MultAdd into MAD and MADW, added NO_DINO_WRITEBACK option.
6263 + *
6264 + * Revision 1.2  1996/08/14  03:06:07  liang
6265 + * Modified macro MultAdd so that the assembly code build works.
6266 + *
6267 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
6268 + * Redesigned the project directory structure. Merged V.34 into the project.
6269 + *
6270 + * Revision 1.5  1994/11/04  22:41:29  mwg
6271 + * Added #ifdefs for different targets.
6272 + *
6273 + ************************************************************************/
6274 +
6275 +#ifndef _MIPS_ASM_H_
6276 +#define        _MIPS_ASM_H_
6277 +
6278 +#define zero   $0
6279 +#define v0     $2
6280 +#define v1     $3
6281 +#define a0     $4
6282 +#define a1     $5
6283 +#define a2     $6
6284 +#define a3     $7
6285 +#define t0     $8
6286 +#define t1     $9
6287 +#define t2     $10
6288 +#define t3     $11
6289 +#define t4     $12
6290 +#define t5     $13
6291 +#define t6     $14
6292 +#define t7     $15
6293 +#define s0     $16     
6294 +#define s1     $17
6295 +#define s2     $18
6296 +#define s3     $19
6297 +#define s4     $20
6298 +#define s5     $21
6299 +#define s6     $22
6300 +#define s7     $23
6301 +#define t8     $24
6302 +#define t9     $25
6303 +#define k0     $26
6304 +#define k1     $27
6305 +#define gp     $28
6306 +#define sp     $29
6307 +#define fp     $30
6308 +#define s8     $30
6309 +#define ra     $31
6310 +
6311 +#ifdef EMBEDDED_CALLING_CONVENTION
6312 +
6313 +/* Support for GreenHills embedded calling convention */
6314 +
6315 +#define ASM_PROLOG     subu    sp, 32; \
6316 +                                       sw              $8, 16(sp); \
6317 +                                       sw              $9, 20(sp); \
6318 +                                       sw              $10, 24(sp); \
6319 +                                       sw              $11, 28(sp);
6320 +
6321 +#define ASM_PROLOG5    subu    sp, 32; \
6322 +                                       sw              $8, 16(sp);
6323 +
6324 +#define ASM_PROLOG6    subu    sp, 32; \
6325 +                                       sw              $8, 16(sp); \
6326 +                                       sw              $9, 20(sp);
6327 +
6328 +#define ASM_PROLOG7    subu    sp, 32; \
6329 +                                       sw              $8, 16(sp); \
6330 +                                       sw              $9, 20(sp); \
6331 +                                       sw              $10, 24(sp);
6332 +
6333 +#define ASM_EPILOG     addu    sp, 32
6334 +
6335 +#else
6336 +#define ASM_PROLOG
6337 +#define ASM_PROLOG5
6338 +#define ASM_PROLOG6
6339 +#define ASM_PROLOG7
6340 +#define ASM_EPILOG
6341 +#endif
6342 +
6343 +#ifdef DINO    /* Special DSP extensions to MIPS core */
6344 +
6345 +#ifndef        NO_DINO_WRITEBACK       /* DSP extensions with writeback register */
6346 +
6347 +#define        MAD(src1, src2)                 .set    noreorder       ; mad   $0, src1, src2  ; .set  reorder
6348 +#define        MADW(acc, src1, src2)   .set    noreorder       ; mad   acc, src1, src2 ; .set  reorder
6349 +#define        Mult(dst, src1, src2)   .set    noreorder       ; mult  dst, src1, src2 ; .set  reorder 
6350 +#define        MultU(dst, src1, src2)  .set    noreorder       ; multu dst, src1, src2 ; .set  reorder         
6351 +
6352 +#else  /* NO_DINO_WRITEBACK */
6353 +
6354 +#define        MAD(src1, src2)                 .set    noreorder       ; mad   $0, src1, src2  ; .set  reorder
6355 +#define        MADW(acc, src1, src2)   .set    noreorder       ; mad   $0, src1, src2  ; mflo acc ; .set       reorder
6356 +#define        Mult(dst, src1, src2)   multu   src1, src2 ; mflo dst
6357 +#define        MultU(dst, src1, src2)  multu   src1, src2 ; mflo dst           
6358 +
6359 +#endif /* NO_DINO_WRITEBACK */
6360 +
6361 +#else  /* DINO */
6362 +
6363 +#if defined(R3900)
6364 +
6365 +#define        MAD(src1, src2)         madd    $0, src1, src2
6366 +#define        MADW(acc, src1, src2)   madd    acc, src1, src2
6367 +#define        Mult(dst, src1, src2)   mult    dst, src1, src2
6368 +#define        MultU(dst, src1, src2)  multu   dst, src1, src2
6369 +
6370 +#elif defined(bcm47xx_INSTR_MACROS) && defined(bcm47xx)
6371 +
6372 +#define mips_froo(s1,s2,s3)                    s1##s2##s3
6373 +#define        MSUB(s1,s2)                                     .set noreorder ; mips_froo(msub_,s1,s2) ; .set reorder
6374 +#define MAD(s1,s2)                                     .set noreorder ; mips_froo(mad_,s1,s2) ; .set reorder
6375 +#define MADW(acc, s1,s2)                       .set noreorder ; mips_froo(mad_,s1,s2) ; mflo acc ; .set reorder
6376 +
6377 +#include "BCM4710.h"
6378 +
6379 +#define        Mult(dst, src1, src2)           mul             dst, src1, src2
6380 +#define        Mul( src1, src2)                        mult    src1, src2 ; 
6381 +#define        MultU(dst, src1, src2)          multu   src1, src2      ; mflo dst
6382 +
6383 +#elif defined(bcm47xx)
6384 +#define        MSUB(src1, src2)                        msub    src1, src2
6385 +#define        MAD(src1, src2)                 madd    src1, src2
6386 +#define        MADW(acc, src1, src2)   .set noreorder ; madd   src1, src2; mflo acc ; .set reorder
6387 +/*
6388 +#define        Mult(dst, src1, src2)   mult    src1, src2 ; mflo dst
6389 +*/
6390 +#define        Mult(dst, src1, src2)   mul     dst , src1, src2 ; 
6391 +#define        Mul( src1, src2)        mult    src1, src2 ; 
6392 +#define        MultU(dst, src1, src2)  multu   src1, src2 ; mflo dst
6393 +
6394 +#else
6395 +
6396 +#ifdef R4102
6397 +#define        MAD(src1, src2)                 madd16  src1, src2
6398 +#define        MADW(acc, src1, src2)   madd16  src1, src2      ; mflo acc
6399 +#else /* R4102 */
6400 +
6401 +#ifdef R4640
6402 +
6403 +#define        MAD(src1, src2)                 madd    $0, src1, src2
6404 +#define        MADW(acc, src1, src2)   madd    src1, src2; mflo acc
6405 +
6406 +#else /* R4640 */
6407 +
6408 +#ifdef R4010
6409 +
6410 +#define        MAD(src1, src2)                 madd    src1, src2
6411 +#define        MADW(acc, src1, src2)   madd    src1, src2; mflo acc
6412 +
6413 +#else
6414 +#define        MAD(src1, src2)                         .set    noat            ;\
6415 +                                                                       mflo    $at                     ;\
6416 +                                                                       sw              $2,   -4(sp)    ;\
6417 +                                                                       multu   src1, src2      ;\
6418 +                                                                       mflo    $2                      ;\
6419 +                                                                       addu    $at, $2, $at    ;\
6420 +                                                                       lw              $2,   -4(sp)    ;\
6421 +                                                                       mtlo    $at             ;\
6422 +                                                                       .set    at
6423 +
6424 +#define        MADW(acc, src1, src2)           .set    noat            ;\
6425 +                                                                       mflo    $at                     ;\
6426 +                                                                       sw              $2,   -4(sp)    ;\
6427 +                                                                       multu   src1, src2      ;\
6428 +                                                                       mflo    $2                      ;\
6429 +                                                                       addu    $at, $2, $at    ;\
6430 +                                                                       lw              $2,   -4(sp)    ;\
6431 +                                                                       move    acc, $at        ;\
6432 +                                                                       mtlo    $at             ;\
6433 +                                                                       .set    at
6434 +#endif /* R4010 */
6435 +#endif /* R4102 */
6436 +#endif /* R4640 */
6437 +
6438 +#define        Mult(dst, src1, src2)           mul             dst, src1, src2
6439 +#define        MultU(dst, src1, src2)          multu   src1, src2      ; mflo dst
6440 +
6441 +#endif /* !3900 */
6442 +#endif /* DINO */
6443 +
6444 +
6445 +
6446 +
6447 +
6448 +
6449 +
6450 +
6451 +#endif /* _MIPS_ASM_H_ */
6452 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MiscUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MiscUtil.h
6453 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MiscUtil.h     1970-01-01 01:00:00.000000000 +0100
6454 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/MiscUtil.h    2006-06-26 09:07:10.000000000 +0200
6455 @@ -0,0 +1,65 @@
6456 +/*
6457 +<:copyright-broadcom 
6458
6459 + Copyright (c) 2002 Broadcom Corporation 
6460 + All Rights Reserved 
6461 + No portions of this material may be reproduced in any form without the 
6462 + written permission of: 
6463 +          Broadcom Corporation 
6464 +          16215 Alton Parkway 
6465 +          Irvine, California 92619 
6466 + All information contained in this document is Broadcom Corporation 
6467 + company private, proprietary, and trade secret. 
6468
6469 +:>
6470 +*/
6471 +/****************************************************************************
6472 + *
6473 + * MiscUtil.h -- Miscellaneous utilities
6474 + *
6475 + * Description:
6476 + *
6477 + *
6478 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
6479 + * Authors: Mark Gonikberg Haixiang Liang
6480 + *
6481 + * $Revision: 1.4 $
6482 + *
6483 + * $Id: MiscUtil.h,v 1.4 2004/04/13 00:21:46 ilyas Exp $
6484 + *
6485 + * $Log: MiscUtil.h,v $
6486 + * Revision 1.4  2004/04/13 00:21:46  ilyas
6487 + * Added standard header for shared ADSL driver files
6488 + *
6489 + * Revision 1.3  2001/07/21 01:21:06  ilyas
6490 + * Added more functions for int to string conversion used by log file
6491 + *
6492 + * Revision 1.2  1999/08/05 19:42:56  liang
6493 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
6494 + *
6495 + * Revision 1.1  1999/01/27 22:10:12  liang
6496 + * Initial version.
6497 + *
6498 + * Revision 1.1  1997/07/10 01:18:45  mwg
6499 + * Initial revision.
6500 + *
6501 + *
6502 + *
6503 + *****************************************************************************/
6504 +#ifndef _MISC_UTIL_H_
6505 +#define _MISC_UTIL_H_
6506 +
6507 +extern long            SM_DECL GetRateValue(dataRateMap rate);
6508 +extern int             SM_DECL DecToString(ulong value, uchar *dstPtr, uint nDigits);
6509 +extern int             SM_DECL HexToString(ulong value, uchar *dstPtr, uint nDigits);
6510 +extern char *  SM_DECL DecToStr(char *s, ulong num);
6511 +extern char *  SM_DECL SignedToStr(char *s, long num);
6512 +extern char *  SM_DECL HexToStr(char *s, ulong num);
6513 +
6514 +#define        EvenParityBit(x)        ((z = (y = x ^ (x >> 4)) ^ (y >> 2)) ^ (z >> 1))
6515 +#define        OddParityBit(x)         (EvenParityBit(x) ^ 1)
6516 +
6517 +extern void    ParityApply(int nBytes, int nDataBits, int parity, uchar *srcPtr, uchar *dstPtr);
6518 +extern void    ParityStrip(int nBytes, int nDataBits, int parity, uchar *srcPtr, uchar *dstPtr, statusHandlerType      statusHandler);
6519 +
6520 +#endif
6521 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Que.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Que.h
6522 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Que.h  1970-01-01 01:00:00.000000000 +0100
6523 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/Que.h 2006-06-26 09:07:10.000000000 +0200
6524 @@ -0,0 +1,106 @@
6525 +/*
6526 +<:copyright-broadcom 
6527
6528 + Copyright (c) 2002 Broadcom Corporation 
6529 + All Rights Reserved 
6530 + No portions of this material may be reproduced in any form without the 
6531 + written permission of: 
6532 +          Broadcom Corporation 
6533 +          16215 Alton Parkway 
6534 +          Irvine, California 92619 
6535 + All information contained in this document is Broadcom Corporation 
6536 + company private, proprietary, and trade secret. 
6537
6538 +:>
6539 +*/
6540 +/****************************************************************************
6541 + *
6542 + * Que.h
6543 + *
6544 + * Description:
6545 + *     Definition and implementation (via macros and inline functions)
6546 + *  of a simple queue
6547 + *
6548 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
6549 + * Authors: Ilya Stomakhin
6550 + *
6551 + *****************************************************************************/
6552 +
6553 +#ifndef        QueHeader_H_
6554 +#define        QueHeader_H_
6555 +
6556 +typedef void *         _QueItem;
6557 +
6558 +typedef struct _QueHeader
6559 +       {
6560 +       _QueItem        *head;          /* first item in the queue */
6561 +       _QueItem        *tail;          /* last item in the queue */
6562 +       } QueHeader;
6563 +
6564 +/* Queue management macros */
6565 +
6566 +#define QueInit(pqHdr)         (((QueHeader *)(pqHdr))->head = ((QueHeader *)(pqHdr))->tail = NULL)
6567 +#define QueEmpty(pqHdr)     (NULL == ((QueHeader *)(pqHdr))->head)
6568 +
6569 +#define QueFirst(pqHdr)                ((QueHeader *)(pqHdr))->head
6570 +#define QueLast(pqHdr)         ((QueHeader *)(pqHdr))->tail 
6571 +#define QueNext(pqItem)                (*((void **)(pqItem)))
6572 +
6573 +
6574 +#define QueRemoveFirst(pqHdr)  do {                                                                            \
6575 +    if (!QueEmpty(pqHdr)) {                                                                                                    \
6576 +      ((QueHeader *)(pqHdr))->head = *((QueHeader *)(pqHdr))->head;                    \
6577 +      if (QueEmpty(pqHdr))                                                                                                     \
6578 +        ((QueHeader *)(pqHdr))->tail = NULL;                                                           \
6579 +    }                                                                                                                                          \
6580 +} while (0)
6581 +#define QueRemove(pqHdr)               QueRemoveFirst(pqHdr)
6582 +
6583 +
6584 +#define QueAddLast(pqHdr,pqItem) do {                                          \
6585 +    QueNext(pqItem) = NULL;                                                                    \
6586 +    if (NULL != ((QueHeader *)(pqHdr))->tail)                          \
6587 +      *((QueHeader *)(pqHdr))->tail = (pqItem);                                \
6588 +    else                                                                                                       \
6589 +      ((QueHeader *)(pqHdr))->head = (_QueItem *)(pqItem);  \
6590 +    ((QueHeader *)(pqHdr))->tail = (_QueItem *)(pqItem);    \
6591 +} while (0)
6592 +#define QueAdd(pqHdr,pItem)    QueAddLast(pqHdr,pItem)
6593 +
6594 +#define QueAddFirst(pqHdr,pqItem)      do {                                    \
6595 +    if (NULL == ((QueHeader *)(pqHdr))->tail)                          \
6596 +         ((QueHeader *)(pqHdr))->tail = (_QueItem *)(pqItem);  \
6597 +    QueNext(pqItem) = ((QueHeader *)(pqHdr))->head;                    \
6598 +    ((QueHeader *)(pqHdr))->head = (_QueItem *)(pqItem);       \
6599 +} while (0)
6600 +
6601 +
6602 +#define QueGet(pqHdr)                  \
6603 +  (void *) QueFirst(pqHdr);            \
6604 +  QueRemove(pqHdr);
6605 +
6606 +#define QueMerge(pqHdr1,pqHdr2)        do {                                                                                    \
6607 +  if (NULL == ((QueHeader *)(pqHdr1))->tail)                                                                   \
6608 +       ((QueHeader *)(pqHdr1))->head = ((QueHeader *)(pqHdr2))->head;                          \
6609 +  else                                                                                                                                                 \
6610 +    QueNext(((QueHeader *)(pqHdr1))->tail) = ((QueHeader *)(pqHdr2))->head;            \
6611 +  if (NULL != ((QueHeader *)(pqHdr2))->tail)                                                   \
6612 +       ((QueHeader *)(pqHdr1))->tail = ((QueHeader *)(pqHdr2))->tail;                          \
6613 +} while (0)
6614 +
6615 +#define QueCopy(pqHdr1,pqHdr2) do {                                                                                    \
6616 +       ((QueHeader *)(pqHdr1))->head = ((QueHeader *)(pqHdr2))->head;                          \
6617 +       ((QueHeader *)(pqHdr1))->tail = ((QueHeader *)(pqHdr2))->tail;                          \
6618 +} while (0)
6619 +
6620 +#define        QueForEach(pqHdr,f,ref)         do {                    \
6621 +       _QueItem        *p = ((QueHeader *)(pqHdr))->head;      \
6622 +                                                                                                       \
6623 +       while (NULL != p) {                                                             \
6624 +         if ( (f)((void *)p, ref) ) break;                             \
6625 +         p = QueNext(p);                                                               \
6626 +       }                                                                                               \
6627 +} while (0)
6628 +
6629 +#endif /* QueHeader_H_ */
6630 +
6631 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftAtmVc.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftAtmVc.h
6632 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftAtmVc.h    1970-01-01 01:00:00.000000000 +0100
6633 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftAtmVc.h   2006-06-26 09:07:10.000000000 +0200
6634 @@ -0,0 +1,569 @@
6635 +/*
6636 +<:copyright-broadcom 
6637
6638 + Copyright (c) 2002 Broadcom Corporation 
6639 + All Rights Reserved 
6640 + No portions of this material may be reproduced in any form without the 
6641 + written permission of: 
6642 +          Broadcom Corporation 
6643 +          16215 Alton Parkway 
6644 +          Irvine, California 92619 
6645 + All information contained in this document is Broadcom Corporation 
6646 + company private, proprietary, and trade secret. 
6647
6648 +:>
6649 +*/
6650 +/****************************************************************************
6651 + *
6652 + * SoftAtmVc.h 
6653 + *
6654 + * Description:
6655 + *     This file contains ATM VC definitions
6656 + *
6657 + *
6658 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
6659 + * Authors: Ilya Stomakhin
6660 + *
6661 + * $Revision: 1.27 $
6662 + *
6663 + * $Id: SoftAtmVc.h,v 1.27 2004/06/02 22:26:17 ilyas Exp $
6664 + *
6665 + * $Log: SoftAtmVc.h,v $
6666 + * Revision 1.27  2004/06/02 22:26:17  ilyas
6667 + * Added ATM counters for G.992.3
6668 + *
6669 + * Revision 1.26  2004/03/10 22:57:20  ilyas
6670 + * Added I.432 scramling control
6671 + *
6672 + * Revision 1.25  2003/09/23 00:21:59  ilyas
6673 + * Added status to indicate ATM header compression
6674 + *
6675 + * Revision 1.24  2003/08/27 02:00:50  ilyas
6676 + * Original implementation of ATM header compression
6677 + *
6678 + * Revision 1.23  2003/02/25 04:13:15  ilyas
6679 + * Added standard Broadcom header
6680 + *
6681 + * Revision 1.22  2003/01/10 23:25:48  ilyas
6682 + * Added ATM status definition
6683 + *
6684 + * Revision 1.21  2002/09/12 21:07:19  ilyas
6685 + * Added HEC, OCD and LCD counters
6686 + *
6687 + * Revision 1.20  2002/04/02 09:58:00  ilyas
6688 + * Initial implementatoin of BERT
6689 + *
6690 + * Revision 1.19  2001/10/09 22:35:14  ilyas
6691 + * Added more ATM statistics and OAM support
6692 + *
6693 + * Revision 1.18  2001/06/18 19:49:36  ilyas
6694 + * Changes to include support for HOST_ONLY mode
6695 + *
6696 + * Revision 1.17  2001/02/23 05:49:57  ilyas
6697 + * Added routed 1483 encapsulation
6698 + *
6699 + * Revision 1.16  2001/02/09 04:18:18  ilyas
6700 + * Added framer for bridged ethernet PDUs
6701 + *
6702 + * Revision 1.15  2001/02/09 01:55:27  ilyas
6703 + * Added status codes and macros to support printing of AAL packets
6704 + *
6705 + * Revision 1.14  2000/09/21 17:28:35  ilyas
6706 + * Added VBR support to traffic management code, separated UBR to a different
6707 + * Tx list, changed some of the algorithms
6708 + *
6709 + * Revision 1.13  2000/08/23 18:42:13  ilyas
6710 + * Added AAL2, added VcConfigure functions, moved commonly used look-up
6711 + * tables for CRC calculation to AtmLayer
6712 + *
6713 + * Revision 1.12  2000/08/02 03:06:22  ilyas
6714 + * Added support for reserving space in RX packets for ATm protocols
6715 + *
6716 + * Revision 1.11  2000/07/28 17:23:39  ilyas
6717 + * Added ATM connect/disconnect statuses
6718 + *
6719 + * Revision 1.10  2000/07/25 02:16:12  ilyas
6720 + * Added EClip (with Eth to ATM ARP translation) implementation
6721 + *
6722 + * Revision 1.9  2000/07/23 20:57:14  ilyas
6723 + * Added ATM framer and protocol layers
6724 + *
6725 + * Revision 1.8  2000/07/17 21:08:16  lkaplan
6726 + * removed global pointer
6727 + *
6728 + * Revision 1.7  2000/06/09 18:33:04  liang
6729 + * Fixed Irix compiler warnings.
6730 + *
6731 + * Revision 1.6  2000/05/18 21:47:31  ilyas
6732 + * Added detection of preassigned cells such as OAM F4, F5
6733 + *
6734 + * Revision 1.5  2000/05/14 01:50:11  ilyas
6735 + * Added more statuses to ATM code
6736 + *
6737 + * Revision 1.4  2000/05/10 02:41:28  liang
6738 + * Added status report for no cell memory
6739 + *
6740 + * Revision 1.3  2000/05/09 23:00:27  ilyas
6741 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
6742 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
6743 + *
6744 + * Revision 1.2  2000/05/03 03:53:00  ilyas
6745 + * Added support for pVc to vcID translation needed for LOG file and other
6746 + * definitions for ATM data in LOG file
6747 + *
6748 + * Revision 1.1  2000/04/19 00:21:35  ilyas
6749 + * Fixed some problems and added Out Of Band (OOB) support to ATM packets
6750 + *
6751 + *
6752 + *****************************************************************************/
6753 +
6754 +#ifndef        SoftAtmVcHeader
6755 +#define        SoftAtmVcHeader
6756 +
6757 +/*
6758 +**
6759 +**             ATM UNI types
6760 +**
6761 +*/
6762 +
6763 +#define AtmLinkFlags(bMap,name)                (((bMap) >> name##Shift) & name##Mask)
6764 +
6765 +/* ATM service category types */
6766 +
6767 +#define        kAtmSrvcCBR             1       /* Constant Bit Rate    */
6768 +#define        kAtmSrvcVBR             2       /* Variable Bit Rate    */
6769 +#define        kAtmSrvcUBR             4       /* Unspecified Bit Rate */
6770 +#define        kAtmSrvcABR             8       /* Available Bit Rate   */
6771 +#define        kAtmSrvcUnknown 0xFF
6772 +
6773 +/* ATM AAL types (as encoded at UNI) */
6774 +
6775 +#define        kAtmAalIE               0x58
6776 +
6777 +#define        kAtmRaw                 0
6778 +#define        kAtmAal1                1
6779 +#define        kAtmAal2                2
6780 +#define        kAtmAal34               3
6781 +#define        kAtmAal5                5
6782 +#define        kAtmAalUser             16
6783 +#define        kAtmAalUnknown  0xFF
6784 +
6785 +/* ATM AAL1 parameters  */
6786 +
6787 +#define        kAal1SubTypeId                  0x85
6788 +
6789 +#define        kAal1TransportShift             0
6790 +#define        kAal1TransportMask              0x7
6791 +
6792 +#define        kAal1NullTransport              0
6793 +#define        kAal1VoiceTransport             1
6794 +#define        kAal1CircuitTransport   2
6795 +#define        kAal1AudioTransport             4
6796 +#define        kAal1VideoTransport             5
6797 +
6798 +
6799 +#define        kAal1CBRId                              0x86
6800 +
6801 +#define        kAal1CBRShift                   24
6802 +#define        kAal1CBRMask                    0xFF
6803 +
6804 +#define        kAal1CBR64                              1
6805 +#define        kAal1CBR1544                    4               /* DS1 */
6806 +#define        kAal1CBR6312                    5               /* DS2 */
6807 +#define        kAal1CBR32064                   6
6808 +#define        kAal1CBR44736                   7               /* DS3 */
6809 +#define        kAal1CBR97728                   8
6810 +#define        kAal1CBR2048                    0x10    /* E1 */
6811 +#define        kAal1CBR8448                    0x11    /* E2 */
6812 +#define        kAal1CBR34368                   0x12    /* E3 */
6813 +#define        kAal1CBR139264                  0x13
6814 +#define        kAal1CBR64xN                    0x40
6815 +#define        kAal1CBR8xN                             0x41
6816 +
6817 +
6818 +#define        kAal1MultiplierId               0x87
6819 +
6820 +#define        kAal1ClockRecoveryId    0x88
6821 +
6822 +#define        kAal1ClockRecoveryShift 3
6823 +#define        kAal1ClockRecoveryMask  0x3
6824 +
6825 +#define        kAal1ClockRecoveryNull  1               /* synchronous transport */
6826 +#define        kAal1ClockRecoverySRTS  1               /* asynchronous transport */
6827 +#define        kAal1ClockRecoveryAdaptive      2
6828 +
6829 +
6830 +#define        kAal1ECMId                              0x89    /* Error correction method */
6831 +
6832 +#define        kAal1ECMShift                   (kAal1ClockRecoveryShift + 2)
6833 +#define        kAal1ECMMask                    0x3
6834 +
6835 +#define        kAal1ECMNull                    0
6836 +#define        kAal1ECMLossSensitive   1
6837 +#define        kAal1ECMDelaySensitive  2
6838 +
6839 +
6840 +#define        kAal1SDTBlockSizeId             0x8A
6841 +
6842 +#define        kAal1CellFillId                 0x8B
6843 +
6844 +/* ATM AAL34 and AAL5 parameters  */
6845 +
6846 +#define        kAalFwdMaxSDUSizeId             0x8C
6847 +#define        kAalBacMaxkSDUSizeId    0x81
6848 +
6849 +#define        kAal34MidRangeId                0x82
6850 +
6851 +#define        kAalSSCSTypeId                  0x84
6852 +
6853 +#define        kAalSSCSAssured                 1
6854 +#define        kAalSSCSNonAssured              2
6855 +#define        kAalSSCSFrameRelay              4
6856 +
6857 +/* ATM AAL2 parameters  */
6858 +
6859 +#define        kAal2SSNone                             0
6860 +#define        kAal2SSSAR                              1
6861 +#define        kAal2SSTED                              2
6862 +#define        kAal2SSSARMask                  3
6863 +#define        kAal2SSType1                    4
6864 +#define        kAal2SSType3                    5
6865 +
6866 +typedef struct {
6867 +  uchar                        aalType;
6868 +  union {
6869 +       struct {
6870 +         bitMap        aal1Flags;
6871 +         ulong         cbrRate;
6872 +         ushort        blkSize;
6873 +         uchar         sarUsed;
6874 +       } aal1Params;
6875 +       struct {
6876 +         ushort        fwdMaxCpSize;                   /* Max "common part" packet size */
6877 +         ushort        backMaxCpSize;
6878 +         ushort        cidLow;
6879 +         ushort        cidHigh;
6880 +         ushort        fwdMaxSsSize;                   /* Max "service specific" packet size */
6881 +         ushort        backMaxSsSize;
6882 +         uchar         sscsType;
6883 +       } aal2Params;
6884 +       struct {
6885 +         ushort        fwdMaxSDUSize;
6886 +         ushort        backMaxSDUSize;
6887 +         ushort        midLow;
6888 +         ushort        midHigh;
6889 +         uchar         sscsType;
6890 +       } aal34Params;
6891 +       struct {
6892 +         ushort        fwdMaxSDUSize;
6893 +         ushort        backMaxSDUSize;
6894 +         uchar         sscsType;
6895 +       } aal5Params;
6896 +  } param;
6897 +} atmAalParams;
6898 +
6899 +/* ATM Traffic Descriptor types (as encoded at UNI) */
6900 +
6901 +#define        kAtmTrafficIE           0x59
6902 +
6903 +#define        kTrafficFwdPeakCellRateId0      0x82
6904 +#define        kTrafficBackPeakCellRateId0     0x83
6905 +#define        kTrafficFwdPeakCellRateId       0x84
6906 +#define        kTrafficBackPeakCellRateId      0x85
6907 +
6908 +#define        kTrafficFwdSustainCellRateId0   0x88
6909 +#define        kTrafficBackSustainCellRateId0  0x89
6910 +#define        kTrafficFwdSustainCellRateId    0x90
6911 +#define        kTrafficBackSustainCellRateId   0x91
6912 +
6913 +#define        kTrafficFwdMaxBurstSizeId0      0xA0
6914 +#define        kTrafficBackMaxBurstSizeId0     0xA1
6915 +#define        kTrafficFwdMaxBurstSizeId       0xB0
6916 +#define        kTrafficBackMaxBurstSizeId      0xB1
6917 +
6918 +#define        kTrafficBestEffortId            0xBE
6919 +#define        kTrafficMgrOptionsId            0xBF
6920 +
6921 +#define        kTrafficMaxTolerance            0x7FFFFFFF
6922 +
6923 +/*     trafficFlags coding */
6924 +
6925 +#define        kTrafficTagFwd                          1
6926 +#define        kTrafficTagBack                         2
6927 +#define        kTrafficBestEffort                      4
6928 +
6929 +typedef struct {
6930 +  ulong                        tPCR0;                                  /* CLP = 0, time between cells in us */
6931 +  ulong                        tPCR;                                   /* CLP = 0+1 */
6932 +  ulong                        tolPCR;                                 /* tolerance for PCR in us */
6933 +
6934 +  ulong                        tSCR0;                                  /* CLP = 0 */
6935 +  ulong                        tSCR;                                   /* CLP = 0+1 */
6936 +  ulong                        tolSCR;                                 /* tolerance for SCR in us */
6937 +
6938 +  uchar                        atmServiceType;                 /* CBR, VBR, UBR, etc. */
6939 +  uchar                        trafficFlags;
6940 +} atmTrafficParams;
6941 +
6942 +/* ATM Broadband Bearer Capabilty (BBC) types (as encoded at UNI) */
6943 +
6944 +#define        kAtmBBCIE                       0x5E
6945 +
6946 +#define        kBBCClassShift          0
6947 +#define        kBBCClassMask           0x1F
6948 +
6949 +#define        kBBCClassA                      0x1
6950 +#define        kBBCClassC                      0x3
6951 +#define        kBBCClassX                      0x10
6952 +
6953 +
6954 +#define        kBBCTrafficShift        (kBBCClassShift + 5)
6955 +#define        kBBCTrafficMask         0x7
6956 +
6957 +#define        kBBCTrafficNull         0
6958 +#define        kBBCTrafficCBR          1
6959 +#define        kBBCTrafficVBR          2
6960 +
6961 +
6962 +#define        kBBCTimingShift         (kBBCTrafficShift + 3)
6963 +#define        kBBCTimingMask          0x3
6964 +
6965 +#define        kBBCTimingNull                  0
6966 +#define        kBBCTimingRequired              1
6967 +#define        kBBCTimingNotRequired   2
6968 +
6969 +
6970 +#define        kBBCClippingShift       (kBBCTimingShift + 2)
6971 +#define        kBBCClippingMask        0x3
6972 +
6973 +#define        kBBCNoClipping          0
6974 +#define        kBBCClippingOk          1
6975 +
6976 +#define        kBBCConnectionShift     (kBBCClippingShift + 2)
6977 +#define        kBBCConnectionMask      0x3
6978 +
6979 +#define        kBBCPoint2Point         0
6980 +#define        kBBCPoint2MPoint        1
6981 +
6982 +/* ATM Broadband High/Low Layer Information (BHLI/BLLI) types (as encoded at UNI) */
6983 +
6984 +#define        kAtmBHLIIE                      0x5D
6985 +#define        kAtmBLLIIE                      0x5F
6986 +
6987 +/* ATM QoS types (as encoded at UNI) */
6988 +
6989 +#define        kAtmQoSIE                       0x5C
6990 +
6991 +#define        kQoSNull                        0
6992 +#define        kQoSClass1                      1
6993 +#define        kQoSClass2                      2
6994 +#define        kQoSClass3                      3
6995 +#define        kQoSClass4                      4
6996 +#define        kQoSReserved            0xFF
6997 +
6998 +typedef struct {
6999 +  uchar                                fwdQoSClass;
7000 +  uchar                                backQoSClass;
7001 +} atmQoSParams;
7002 +
7003 +/* ATM MID definitions (ConfigureHandler) */
7004 +
7005 +#define        kAtmMidEntireVc         ((ulong) -1)
7006 +
7007 +typedef struct {
7008 +  void                         *pUserVc;                       /* VC id from the caller: has to be 1st !!! */
7009 +  ulong                                vci;
7010 +  uchar                                defaultCLP;                     /* default CLP for tx packets on this VC */
7011 +  uchar                                framerId;
7012 +  uchar                                protoId;
7013 +  uchar                                protoRxBytesReserved; /* # bytes reserved by protocol in the beginning of Rx packet */
7014 +  uchar                                protoTxBytesReserved; /* # bytes reserved by protocol in the beginning of Tx packet */
7015 +
7016 +  atmAalParams         aalParams;
7017 +  atmTrafficParams     rxTrafficParams;
7018 +  atmTrafficParams     txTrafficParams;
7019 +  bitMap                       bbcFlags;
7020 +  atmQoSParams         qosParams;
7021 +} atmVcParams;
7022 +
7023 +/*
7024 +**
7025 +**             ATM Out of Band (OOB) packet information
7026 +**
7027 +*/
7028 +
7029 +typedef struct {
7030 +  Boolean                      clp;                            /* Cell Loss Prioroty */
7031 +  uchar                                aalType;
7032 +  union {
7033 +       struct {
7034 +         uchar                 payloadType;
7035 +       } aalRawParams;
7036 +       struct {
7037 +         uchar                 payloadType;
7038 +         ushort                mid;
7039 +       } aal34Params;
7040 +       struct {
7041 +         uchar                 uui;                            /* Uses to user indicator */
7042 +         uchar                 cpi;                            /* common part indicator */
7043 +       } aal5Params;
7044 +  } aalParam;
7045 +} atmOobPacketInfo;
7046 +
7047 +/*
7048 +**
7049 +**             ATM setup bit definition
7050 +**
7051 +*/
7052 +
7053 +#define        kAtmCorrectHecErrors            1
7054 +#define        kCorrectHecErrors                       kAtmCorrectHecErrors
7055 +#define        kAtmPhyHeaderCompression        2
7056 +#define        kAtmPhyNoDataScrambling         4
7057 +
7058 +#define        kAtmTxIdleTimeoutMask   0x6
7059 +#define        kAtmTxIdleNoTimeout             0
7060 +#define        kAtmTxIdleTimeout10s    2
7061 +#define        kAtmTxIdleTimeout30s    4
7062 +#define        kAtmTxIdleTimeout60s    6
7063 +
7064 +/*
7065 +**
7066 +**             ATM framer modes and protocol definitions
7067 +**
7068 +*/
7069 +
7070 +#define        kAtmFramerNone                  0
7071 +#define        kAtmFramerISO                   1
7072 +#define        kAtmFramerIP                    2
7073 +#define        kAtmFramerEth                   3
7074 +#define        kAtmFramerEthWithCRC    4
7075 +
7076 +#define        kAtmProtoNone                   0
7077 +#define        kAtmProtoEClip                  1
7078 +#define kAtmProtoERouted1483   2
7079 +#define        kAtmProtoPPP                    3
7080 +
7081 +
7082 +/*
7083 +**
7084 +**             ATM status codes
7085 +**
7086 +*/
7087 +
7088 +typedef        void (*atmStatusHandler) (void *gDslVars, ulong statusCode, ...);
7089 +
7090 +/* physical layer I.432 */
7091 +
7092 +#define        kAtmStatRxHunt                                  1
7093 +#define        kAtmStatRxPreSync                               2
7094 +#define        kAtmStatRxSync                                  3
7095 +#define        kAtmStatRxPlOamCell                             4
7096 +#define        kAtmStatBertResult                              5
7097 +#define        kAtmStatHec                                             6
7098 +#define        kAtmStatHdrCompr                                7
7099 +#define        kAtmStatCounters                                8
7100 +
7101 +/* ATM layer */
7102 +
7103 +#define        kAtmLayerStatFirst                              100
7104 +#define        kAtmStatRxDiscarded                             100
7105 +#define        kAtmStatTxDelayed                               101
7106 +
7107 +#define        kAtmStatVcCreated                               102
7108 +#define        kAtmStatVcStarted                               103
7109 +#define        kAtmStatVcStopped                               104
7110 +#define        kAtmStatVcDeleted                               105
7111 +
7112 +#define        kAtmStatTimeout                                 106
7113 +#define        kAtmStatNoCellMemory                    107
7114 +#define        kAtmStatPrintCell                               108
7115 +#define kAtmStatInvalidCell                            109
7116 +#define kAtmStatUnassignedCell                 110
7117 +#define kAtmStatOamF4SegmentCell               111
7118 +#define kAtmStatOamF4End2EndCell               112
7119 +#define kAtmStatOamI371Cell                            113
7120 +#define kAtmStatOamF5SegmentCell               114
7121 +#define kAtmStatOamF5End2EndCell               115
7122 +#define kAtmStatReservedCell                   116
7123 +
7124 +#define        kAtmStatConnected                               117
7125 +#define        kAtmStatDisconnected                    118
7126 +
7127 +#define        kAtmStatRxPacket                                119
7128 +#define        kAtmStatTxPacket                                120
7129 +
7130 +#define        kAtmStatOamLoopback                             121
7131 +
7132 +
7133 +typedef struct _atmPhyCounters {
7134 +       ushort                                          id;
7135 +       ushort                                          bertStatus;
7136 +       ulong                                           bertCellTotal;
7137 +       ulong                                           bertCellCnt;
7138 +       ulong                                           bertBitErrors;
7139 +
7140 +       ulong                                           rxHecCnt;
7141 +       ulong                                           rxCellTotal;
7142 +       ulong                                           rxCellData;
7143 +       ulong                                           rxCellDrop;
7144 +} atmPhyCounters;
7145 +
7146 +/* AAL layer */
7147 +
7148 +
7149 +
7150 +/*
7151 +**
7152 +**             ATM log file definitions
7153 +**
7154 +*/
7155 +
7156 +/* ATM log file flags */
7157 +
7158 +#define                kAtmLogFrameFlagMask            3               /* mask */
7159 +
7160 +#define                kAtmLogFrameFlagNone            0               /* nothing */
7161 +#define                kAtmLogFrameFlagNoData          1               /* no data only frame size */
7162 +#define                kAtmLogFrameFlagBinData         2               /* data in binary form */
7163 +#define                kAtmLogFrameFlagTextData        3               /* data in text form */
7164 +
7165 +#define                kAtmLogSendFrameShift           0
7166 +#define                kAtmLogSendFrameNoData          (kAtmLogFrameFlagNoData << kAtmLogSendFrameShift)
7167 +#define                kAtmLogSendFrameBinData         (kAtmLogFrameFlagBinData << kAtmLogSendFrameShift)
7168 +#define                kAtmLogSendFrameTextData        (kAtmLogFrameFlagTextData << kAtmLogSendFrameShift)
7169 +
7170 +#define                kAtmLogRcvFrameShift            2
7171 +#define                kAtmLogRcvFrameNone                     (kAtmLogFrameFlagNone << kAtmLogRcvFrameShift)
7172 +#define                kAtmLogRcvFrameNoData           (kAtmLogFrameFlagNoData << kAtmLogRcvFrameShift)
7173 +#define                kAtmLogRcvFrameBinData          (kAtmLogFrameFlagBinData << kAtmLogRcvFrameShift)
7174 +#define                kAtmLogRcvFrameTextData         (kAtmLogFrameFlagTextData << kAtmLogRcvFrameShift)              
7175 +
7176 +#define                kAtmLogSendCompleteFrameShift   4
7177 +#define                kAtmLogSendCompleteFrameNone    (kAtmLogFrameFlagNone << kAtmLogSendCompleteFrameShift)
7178 +#define                kAtmLogSendCompleteFrameNoData  (kAtmLogFrameFlagNoData << kAtmLogSendCompleteFrameShift)
7179 +
7180 +#define                kAtmLogReturnFrameShift         6
7181 +#define                kAtmLogReturnFrameNoData        (kAtmLogFrameFlagNoData << kAtmLogReturnFrameShift)
7182 +
7183 +#define                kAtmLogCellFlag                         (1 << 8)
7184 +
7185 +/* ATM log codes */
7186 +
7187 +#define                kAtmLogSendFrame                                        1
7188 +#define                kAtmLogRcvFrame                                         2
7189 +#define                kAtmLogSendFrameComplete                        3
7190 +#define                kAtmLogReturnFrame                                      4
7191 +#define                kAtmLogVcAllocate                                       5
7192 +#define                kAtmLogVcFree                                           6
7193 +#define                kAtmLogVcActivate                                       7
7194 +#define                kAtmLogVcDeactivate                                     8
7195 +#define                kAtmLogTimer                                            9
7196 +#define                kAtmLogCell                                                     10
7197 +#define                kAtmLogVcConfigure                                      11
7198 +
7199 +#define                kAtmLogRxCellHeader                                     12
7200 +#define                kAtmLogRxCellData                                       13
7201 +#define                kAtmLogTxCell                                           14
7202 +
7203 +#endif /* SoftAtmVcHeader */
7204 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.gh
7205 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.gh     1970-01-01 01:00:00.000000000 +0100
7206 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.gh    2006-06-26 09:07:10.000000000 +0200
7207 @@ -0,0 +1,675 @@
7208 +/****************************************************************************
7209 + *
7210 + * SoftDsl.gh 
7211 + *
7212 + * Description:
7213 + *     This is a header file which defines the type for the DSL
7214 + *     global variable structure.
7215 + *
7216 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
7217 + * Authors: Ilya Stomakhin
7218 + *
7219 + * $Revision: 1.72 $
7220 + *
7221 + * $Id: SoftDsl.gh,v 1.72 2004/04/30 23:05:19 kdu Exp $
7222 + *
7223 + * $Log: SoftDsl.gh,v $
7224 + * Revision 1.72  2004/04/30 23:05:19  kdu
7225 + * Fixed interop issues in TDC lab for TMM.
7226 + *
7227 + * Revision 1.70  2004/04/10 23:30:48  ilyas
7228 + * Defined gloval structure for slow (SDRAM) data
7229 + *
7230 + * Revision 1.69  2004/04/02 18:33:45  gsyu
7231 + * Share MuxFramer buffers with scratch memory
7232 + *
7233 + * Revision 1.68  2004/02/04 20:12:38  linyin
7234 + * Support adsl2plus
7235 + *
7236 + * Revision 1.67  2004/02/03 19:10:37  gsyu
7237 + * Added separated carrierInfo structures for G992P5
7238 + *
7239 + * Revision 1.66  2004/01/26 04:21:06  yongbing
7240 + * Merge changes in ADSL2 branch into Annex A branch
7241 + *
7242 + * Revision 1.65  2004/01/13 19:12:07  gsyu
7243 + * Added two more variables for Double upstream
7244 + *
7245 + * Revision 1.64  2003/12/04 02:10:37  linyin
7246 + * Add a variable for FbmsOL mode
7247 + *
7248 + * Revision 1.63  2003/11/20 00:57:50  yongbing
7249 + * Merge ADSL2 functionalities into Annex A branch
7250 + *
7251 + * Revision 1.62  2003/11/05 01:59:12  liang
7252 + * Add vendor ID code for Infineon.
7253 + *
7254 + * Revision 1.61  2003/08/12 22:59:41  khp
7255 + * - for Haixiang: added support for ADSL_MARGIN_TWEAK_TEST
7256 + *
7257 + * Revision 1.60  2003/08/01 00:08:19  liang
7258 + * Added firmware ID for Samsung ADI 930 DSLAM.
7259 + *
7260 + * Revision 1.59  2003/07/14 14:40:08  khp
7261 + * - AnnexB: added bad SNR2 retrain counter to connectin setup
7262 + *
7263 + * Revision 1.58  2003/06/25 02:40:22  liang
7264 + * Added firmware ID for Annex A UE9000 ADI918 (from Aliant, Canada).
7265 + *
7266 + * Revision 1.57  2003/06/25 00:00:40  ilyas
7267 + * -added firmware IDs for TI 4000C and AC5 (Annex B)
7268 + *
7269 + * Revision 1.56  2003/05/31 01:50:38  khp
7270 + * -add firmware IDs for ECI16 and ECI16A
7271 + *
7272 + * Revision 1.55  2003/03/27 19:30:52  liang
7273 + * Add and initialize new connectionSetup field coVendorFirmwareID under module ADSL_IDENTIFY_VENDOR_FIRMWARE.
7274 + *
7275 + * Revision 1.54  2002/12/13 18:35:48  yongbing
7276 + * Add support for G.992.2 Annex C in start up
7277 + *
7278 + * Revision 1.53  2002/12/06 02:06:33  liang
7279 + * Moved the T1.413 RAck1/RAck2 switching variables to connection setup structure.
7280 + *
7281 + * Revision 1.52  2002/11/26 02:49:46  liang
7282 + * Added variable codingGainDecrement to the connectionSetup structure to solve the C-Rates-RA option failure problem.
7283 + *
7284 + * Revision 1.51  2002/10/20 18:56:16  khp
7285 + * - for linyin:
7286 + *   - #ifdef NEC_NSIF_WORKAROUND:
7287 + *     - add status and fail counter for NSIF
7288 + *
7289 + * Revision 1.50  2002/09/28 02:36:50  yongbing
7290 + * Add retrain in T1.413 with R-Ack1 tone
7291 + *
7292 + * Revision 1.49  2002/09/12 21:07:19  ilyas
7293 + * Added HEC, OCD and LCD counters
7294 + *
7295 + * Revision 1.48  2002/07/19 01:51:35  liang
7296 + * Added vendor ID constant for Alcatel.
7297 + *
7298 + * Revision 1.47  2002/06/27 21:51:08  liang
7299 + * Added xmt and rcv tone selection bitmap in connection setup.
7300 + *
7301 + * Revision 1.46  2002/06/11 20:48:06  liang
7302 + * Added CO vendor ID field to connectionSetup structure.
7303 + *
7304 + * Revision 1.45  2002/06/06 03:05:43  khp
7305 + * -use boolean in connectup setup instead of localCapabilities.features to indicate FBM mode
7306 + *
7307 + * Revision 1.44  2002/03/22 19:38:58  yongbing
7308 + * Modify for co-exist of G994P1 and T1P413
7309 + *
7310 + * Revision 1.43  2002/03/02 00:52:40  ilyas
7311 + * AnnexC delay needs to be long for prototype
7312 + *
7313 + * Revision 1.42  2002/01/19 23:59:17  ilyas
7314 + * Added support for LOG and eye data to ADSL core target
7315 + *
7316 + * Revision 1.41  2002/01/16 19:03:59  ilyas
7317 + * Added HOST_ONLY ifdefs around ADSL core data
7318 + *
7319 + * Revision 1.40  2002/01/14 17:41:04  liang
7320 + * Move xmt & rcv sample buffers to top level.
7321 + *
7322 + * Revision 1.39  2001/12/21 22:45:34  ilyas
7323 + * Added support for ADSL MIB data object
7324 + *
7325 + * Revision 1.38  2001/12/13 02:24:22  ilyas
7326 + * Added G997 (Clear EOC and G997 framer) support
7327 + *
7328 + * Revision 1.37  2001/11/30 05:56:31  liang
7329 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
7330 + *
7331 + * Revision 1.36  2001/10/19 00:12:07  ilyas
7332 + * Added support for frame oriented (no ATM) data link layer
7333 + *
7334 + * Revision 1.29.2.5  2001/10/03 01:44:00  liang
7335 + * Merged with codes from main tree (tag SoftDsl_2_18).
7336 + *
7337 + * Revision 1.29.2.4  2001/08/18 00:00:36  georgep
7338 + * Add variable to store annexC pathDelay
7339 + *
7340 + * Revision 1.29.2.3  2001/08/08 17:33:27  yongbing
7341 + * Merge with tag SoftDsl_2_17
7342 + *
7343 + * Revision 1.35  2001/08/29 02:56:01  ilyas
7344 + * Added tests for flattening/unflatenning command and statuses (dual mode)
7345 + *
7346 + * Revision 1.34  2001/08/28 03:26:32  ilyas
7347 + * Added support for running host and adsl core parts separately ("dual" mode)
7348 + *
7349 + * Revision 1.33  2001/06/18 19:49:36  ilyas
7350 + * Changes to include support for HOST_ONLY mode
7351 + *
7352 + * Revision 1.32  2001/05/18 21:21:44  liang
7353 + * Save the current number of rcv samples to line handler for QProc test.
7354 + *
7355 + * Revision 1.31  2001/04/25 01:20:11  ilyas
7356 + *
7357 + * Don't use DSL frame functions if ATM_LAYER is not defined
7358 + *
7359 + * Revision 1.30  2001/03/25 06:11:20  liang
7360 + * Combined separate loop attenuation status for ATUR & ATUC into one status.
7361 + * Replace separate hardware AGC info status for ATUR & ATUC into hardware AGC
7362 + * request status and hardware AGC obtained status.
7363 + * Use store AGC command to save hardware AGC value instead of returning value
7364 + * from status report.
7365 + *
7366 + * Revision 1.29  2001/03/17 03:00:46  georgep
7367 + * Added agcInfo to connectionSetupStruct
7368 + *
7369 + * Revision 1.28  2001/02/10 03:03:09  ilyas
7370 + * Added one more DslFrame function
7371 + *
7372 + * Revision 1.27  2000/08/31 19:04:24  liang
7373 + * Added scratch buffer structure definition.
7374 + *
7375 + * Revision 1.26  2000/07/23 20:52:52  ilyas
7376 + * Added xxxFrameBufSetAddress() function for ATM framer layers
7377 + * Rearranged linkLayer functions in one structure which is passed as a
7378 + * parameter to xxxLinkLayerInit() function to be set there
7379 + *
7380 + * Revision 1.25  2000/07/18 21:42:25  ilyas
7381 + * Fixed compiler warning about pointer casting
7382 + *
7383 + * Revision 1.24  2000/07/18 21:18:45  ilyas
7384 + * Added GLOBAL_PTR_BIAS feature to utilize full 64K MIPS relative addressing space
7385 + *
7386 + * Revision 1.23  2000/07/18 20:03:24  ilyas
7387 + * Changed DslFrame functions definitions to macros,
7388 + * Removed gDslVars from their parameter list
7389 + *
7390 + * Revision 1.22  2000/07/17 21:08:15  lkaplan
7391 + * removed global pointer
7392 + *
7393 + * Revision 1.21  2000/05/09 23:00:26  ilyas
7394 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
7395 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
7396 + *
7397 + * Revision 1.20  2000/05/03 03:57:04  ilyas
7398 + * Added LOG file support for writing ATM data
7399 + *
7400 + * Revision 1.19  2000/04/19 00:31:47  ilyas
7401 + * Added global SoftDsl functions for Vc, added OOB info functions
7402 + *
7403 + * Revision 1.18  2000/04/13 08:36:22  yura
7404 + * Added SoftDslSetRefData, SoftDslGetRefData functions
7405 + *
7406 + * Revision 1.17  2000/04/13 05:38:54  georgep
7407 + * Added T1p413 "Activation and Acknowledgement" which can substitute G994P1
7408 + *
7409 + * Revision 1.16  2000/04/05 22:30:42  liang
7410 + * Changed function & constant names from G992p2 to G992 for the Main module.
7411 + *
7412 + * Revision 1.15  2000/04/04 04:16:06  liang
7413 + * Merged with SoftDsl_0_03 from old tree.
7414 + *
7415 + * Revision 1.15  2000/04/04 01:47:21  ilyas
7416 + * Implemented abstract dslFrame and dslFrameBuffer objects
7417 + *
7418 + * Revision 1.14  2000/04/01 02:53:33  georgep
7419 + * Added pointer to G992p2Profile inside connectionSetup
7420 + *
7421 + * Revision 1.13  2000/03/18 01:27:56  georgep
7422 + * Changed connectionSetup to include G992p1 Capabilities
7423 + *
7424 + * Revision 1.12  2000/02/29 01:39:05  georgep
7425 + * put variable haveRemoteCapabilities inside connectionSetupStruct
7426 + *
7427 + * Revision 1.11  2000/02/08 00:44:36  liang
7428 + * Fix the gDslVars definition for Irix environment.
7429 + *
7430 + * Revision 1.10  1999/11/19 00:59:29  george
7431 + * Define physicalLayerVars as a union
7432 + *
7433 + * Revision 1.9  1999/11/11 19:19:42  george
7434 + * Porting to 16Bit Compiler
7435 + *
7436 + * Revision 1.8  1999/11/09 20:26:17  george
7437 + * Added G992P2_PROFILE to modules list
7438 + *
7439 + * Revision 1.7  1999/10/27 23:01:54  wan
7440 + * Add G.994.1 setup in dslConnectionSetupStruct for setting up Initiation side
7441 + *
7442 + * Revision 1.6  1999/08/12 21:16:27  george
7443 + * Move profileVars definition to G992p2/G992p2Profile.gh
7444 + *
7445 + * Revision 1.5  1999/08/10 18:20:43  george
7446 + * Define fastRetrainVars
7447 + *
7448 + * Revision 1.4  1999/07/16 02:03:02  liang
7449 + * Added Tx & Rx data handler function pointers.
7450 + *
7451 + * Revision 1.3  1999/07/03 01:40:15  liang
7452 + * Redefined dsl command parameter list and added connection setup struct.
7453 + *
7454 + * Revision 1.2  1999/02/10 01:56:37  liang
7455 + * Added hooks for G994.1 and G992.2.
7456 + *
7457 + *
7458 + *****************************************************************************/
7459 +
7460 +#ifndef        SoftDslGlobals
7461 +#define        SoftDslGlobals
7462 +
7463 +#include "SoftDsl.h"
7464 +
7465 +#ifdef G992P2_PROFILE
7466 +#include "G992p2Profile.gh"
7467 +#endif
7468 +
7469 +typedef enum
7470 +       {
7471 +       kVendorUnknown = 0,
7472 +       kVendorBroadcom,
7473 +       kVendorGlobespan,
7474 +       kVendorADI,
7475 +       kVendorTI,
7476 +       kVendorCentillium,
7477 +       kVendorAlcatel,
7478 +       kVendorInfineon
7479 +       } VendorIDType;
7480 +
7481 +#define        kDslVendorFirwareUnknown        0
7482 +typedef        enum
7483 +       {
7484 +       kVendorADI_Anaconda = 1,
7485 +       kVendorADI_ECI918,
7486 +       kVendorADI_ECI930,
7487 +       kVendorADI_Cisco,
7488 +       kVendorADI_UE9000_918,
7489 +       kVendorADI_Samsung_930,
7490 +       kVendorTI_4000C_ERICSSON_350,
7491 +       kVendorTI_4000C_SEIMENS,
7492 +       kVendorADI_ECI16_AnnexB = 50,           /* leave space for more Annex A types */
7493 +       kVendorADI_ECI16A_AnnexB,
7494 +       kVendorTI_4000C_AnnexB,
7495 +       kVendorTI_AC5_AnnexB
7496 +       } VendorFirmwareIDType;
7497 +
7498 +#define        kDslXmtToneSelectionStartTone           0
7499 +#ifdef G992P1_ANNEX_B
7500 +#define        kDslXmtToneSelectionEndTone                     63
7501 +#else
7502 +#define        kDslXmtToneSelectionEndTone                     31
7503 +#endif
7504 +#define        kDslXmtToneSelectionNumOfTones          (kDslXmtToneSelectionEndTone-kDslXmtToneSelectionStartTone+1)
7505 +#define        kDslXmtToneSelectionNumOfBytes          ((kDslXmtToneSelectionNumOfTones+7)/8)
7506 +#define        kDslRcvToneSelectionStartTone           32
7507 +#define        kDslRcvToneSelectionEndTone                     255
7508 +#define        kDslRcvToneSelectionNumOfTones          (kDslRcvToneSelectionEndTone-kDslRcvToneSelectionStartTone+1)
7509 +#define        kDslRcvToneSelectionNumOfBytes          ((kDslRcvToneSelectionNumOfTones+7)/8)
7510 +
7511 +#define        kDslT1p413RAckModeTryRAck1                              0x01
7512 +#define        kDslT1p413RAckModeTryRAck2                              0x02
7513 +#define        kDslT1p413RAckModeTrialMask                             0x0F
7514 +#define        kDslT1p413RAckModeSelected                              0x10
7515 +#define        kDslT1p413RAckModeTrialCount                    10              /* when in trial mode */
7516 +#define        kDslT1p413RAckModeSwitchCount                   20              /* when mode is selected */
7517 +
7518 +#ifdef ADSL_MARGIN_TWEAK_TEST
7519 +#define        kDslMarginTweakNumOfTones                               256
7520 +#endif
7521 +
7522 +typedef struct
7523 +       {
7524 +       Boolean                         haveRemoteCapabilities;         
7525 +       dslModulationType                               selectedModulation;
7526 +       dslModulationType                               startupModulation;
7527 +#if defined(G992P1_ANNEX_I) || defined(G992P5)
7528 +       ushort                                                  downstreamMinCarr, downstreamMaxCarr;
7529 +#else
7530 +       uchar                                                   downstreamMinCarr, downstreamMaxCarr;
7531 +#endif
7532 +       uchar                                                   upstreamMinCarr, upstreamMaxCarr;
7533 +#if defined(DOUBLE_UP_STREAM)                                                  
7534 +    Boolean                         isDoubleUsEnabled;
7535 +    short                           selectedPilotTone;
7536 +#endif
7537 +       dslDataPumpCapabilities                 localCapabilities, remoteCapabilities;
7538 +#ifdef G992P3
7539 +       g992p3DataPumpCapabilities              localCarrierInfoG992p3AnnexA;
7540 +       g992p3DataPumpCapabilities              remoteCarrierInfoG992p3AnnexA;
7541 +       g992p3DataPumpCapabilities              selectedCarrierInfoG992p3AnnexA;
7542 +       uchar                                                   xmtG992p3State;
7543 +#ifdef G992P5
7544 +       g992p3DataPumpCapabilities              localCarrierInfoG992p5AnnexA;
7545 +       g992p3DataPumpCapabilities              remoteCarrierInfoG992p5AnnexA;
7546 +       g992p3DataPumpCapabilities              selectedCarrierInfoG992p5AnnexA;
7547 +#endif  /* G992P5 */
7548 +#endif  /* G992P3 */
7549 +       uchar                                                   handshakingDuplexMode;
7550 +       Boolean                                                 handshakingClientInitiation;
7551 +       short                                                   handshakingXmtPowerLevel;
7552 +       uchar                                                   handshakingXmtCarrierSet;
7553 +       short                                                   hwAgcQ4dB;      /* for loop attenuation calculation */
7554 +       uchar                                                   coVendorID;
7555 +#ifdef ADSL_IDENTIFY_VENDOR_FIRMWARE
7556 +       uchar                                                   coVendorFirmwareID;
7557 +#endif
7558 +       uchar                                                   codingGainDecrement;    /* coding gain decrement in Q4dB for initial rate calculation */
7559 +       uchar                                                   xmtToneSelection[kDslXmtToneSelectionNumOfBytes];
7560 +       uchar                                                   rcvToneSelection[kDslRcvToneSelectionNumOfBytes];
7561 +#ifdef G992_ANNEXC     
7562 +       Boolean                                                 isFbmMode;
7563 +       Boolean                                                 isFbmsOLMode;
7564 +       long                                                    xmtToRcvPathDelay;
7565 +#endif 
7566 +#if defined(T1P413) && defined(XMT_RACT2_FOR_ADI_COMPATIBILITY)
7567 +       uchar                                                   t1p413RAckModeUsed;
7568 +       uchar                                                   t1p413RAckModeCounter;
7569 +#endif
7570 +#ifdef G992P1_ANNEX_B
7571 +       uchar                                                   badSNR2RetrainCounter;
7572 +#endif
7573 +#ifdef ADSL_MARGIN_TWEAK_TEST
7574 +       short                                                   marginTweakExtraPowerQ4dB;
7575 +       char                                                    marginTweakTableQ4dB[kDslMarginTweakNumOfTones];
7576 +#endif
7577 +#ifdef G992P2_PROFILE  
7578 +       G992p2ProfileVarsStruct*                profileVarsPtr;
7579 +#endif
7580 +#ifdef TDC_IOP_FIX_SEIMENS_TI
7581 +       char                                    t1p413RetrainCounter;           /* 0: no retrain needed; 1: force to T1.413 mode and retrain after R-MSG1; 2: 2nd T1.413 session, go to showtime */
7582 +#endif
7583 +#ifdef ANSI_CACT12_PING_PONG
7584 +    char t1p413SkipToneIndex; /* to alternate between CAct1 and CAct2 detection */
7585 +#endif
7586 +       } dslConnectionSetupStruct;
7587 +
7588 +#ifdef ADSL_FRAMER
7589 +#include "MuxFramer.gh"
7590 +#endif
7591 +
7592 +#ifdef ATM
7593 +#include "SoftAtm.gh"
7594 +#endif
7595 +
7596 +#ifdef DSL_PACKET
7597 +#include "DslPacket.gh"
7598 +#endif
7599 +
7600 +#ifdef G997_1_FRAMER
7601 +#include "G997.gh"
7602 +#ifdef G992P3
7603 +#include "G992p3OvhMsg.gh"
7604 +#endif
7605 +#endif
7606 +
7607 +#ifdef ADSL_MIB
7608 +#include "AdslMib.gh"
7609 +#endif
7610 +
7611 +#ifndef HOST_ONLY
7612 +#ifdef T1P413
7613 +#include "T1p413Main.gh"
7614 +#endif
7615 +
7616 +#ifdef G994P1
7617 +#include "G994p1Main.gh"
7618 +#endif
7619 +
7620 +#ifdef G992
7621 +#include "G992Main.gh"
7622 +#endif
7623 +
7624 +#include "SoftDslSampleBuffers.gh"
7625 +#endif
7626 +
7627 +typedef struct __dslSlowVarsStruct
7628 +       {
7629 +       int                                                             tmp;
7630 +       }
7631 +        dslSlowVarsStruct;
7632 +
7633 +typedef struct __dslVarsStruct
7634 +       {
7635 +       bitMap                                                  setup;
7636 +       eyeHandlerType                                  eyeHandlerPtr;
7637 +       logHandlerType                                  logHandlerPtr;
7638 +       dslDriverCallbackType                   driverCallback;
7639 +
7640 +       rcvHandlerType                                  rcvHandlerPtr;
7641 +       xmtHandlerType                                  xmtHandlerPtr;
7642 +
7643 +#ifndef ADSLCORE_ONLY
7644 +       dslCommandHandlerType                   adslCoreCommandHandlerPtr;
7645 +#endif
7646 +       dslCommandHandlerType                   dataPumpCommandHandlerPtr;
7647 +
7648 +       dslStatusHandlerType                    internalStatusHandlerPtr;
7649 +       dslStatusHandlerType                    externalStatusHandlerPtr;
7650 +#ifndef ADSLCORE_ONLY
7651 +       dslStatusHandlerType                    externalLinkLayerStatusHandlerPtr;
7652 +#endif
7653 +
7654 +       dslDirectionType                                direction;
7655 +       dslConnectionSetupStruct                connectionSetup;
7656 +
7657 +#ifdef NEC_NSIF_WORKAROUND
7658 +       uchar                                   G994NsStatus;
7659 +       uchar                                   G994NsFailCounter;
7660 +#endif
7661 +
7662 +       dslFrameHandlerType                             rxIndicateHandlerPtr;
7663 +       dslFrameHandlerType                             txCompleteHandlerPtr;
7664 +
7665 +       linkLayerFunctions                              LinkLayerFunctions;
7666 +       dslSlowVarsStruct                               *dslSlowVars;
7667 +
7668 +#ifdef DSL_FRAME_FUNCTIONS
7669 +       dslFrameFunctions                               DslFrameFunctions;
7670 +#endif
7671 +       ulong                                                   refData;
7672 +       ulong                                                   execTime;
7673 +       int                                                             currRcvNSamps;
7674 +
7675 +#ifndef HOST_ONLY
7676 +       DslSampleBuffersStruct                  sampleBuffersVars;
7677 +
7678 +#ifdef G992P2_PROFILE
7679 +       G992p2ProfileVarsStruct                 G992p2ProfileVars;
7680 +#endif
7681 +                       
7682 +#ifdef ADSL_FRAMER
7683 +       muxFramerVarsStruct                             muxFramerVars;
7684 +#endif
7685 +#endif /* HOST_ONLY */
7686 +
7687 +#ifdef DSL_LINKLAYER
7688 +       union
7689 +               {
7690 +#ifdef ATM
7691 +               atmVarsStruct                           atmVars;
7692 +#endif
7693 +#ifdef DSL_PACKET
7694 +               dslPacketVarsStruct                     dslPacketVars;
7695 +#endif
7696 +               } linkLayerVars;
7697 +#endif
7698 +
7699 +#ifdef G997_1_FRAMER
7700 +       g997VarsStruct                                  G997Vars;
7701 +#ifdef G992P3
7702 +       g992p3OvhMsgVarsStruct                  G992p3OvhMsgVars;
7703 +#endif
7704 +#endif
7705 +
7706 +#ifdef ADSL_MIB
7707 +       adslMibVarsStruct                               adslMibVars;
7708 +#endif
7709 +
7710 +#ifndef HOST_ONLY
7711 +       union
7712 +               {
7713 +#ifdef T1P413
7714 +               T1p413VarsStruct                        T1p413Vars;             
7715 +#endif         
7716 +#ifdef G994P1
7717 +               G994p1VarsStruct                        G994p1Vars;                     
7718 +#endif
7719 +#ifdef G992
7720 +               G992VarsStruct                          G992Vars;
7721 +#endif
7722 +               } physicalLayerVars;
7723 +       union
7724 +               {
7725 +#ifdef G992
7726 +               G992ScratchVarsStruct           G992ScratchVars;
7727 +#endif
7728 +#if defined(ADSL_FRAMER) && defined(SHARE_MUX_FRAMER_VARS)
7729 +        muxFramerSharedVarsStruct      muxFramerSharedVars;
7730 +#endif
7731 +               } scratchVars;
7732 +#endif /* HOST_ONLY */
7733 +
7734 +       }
7735 +        dslVarsStruct;
7736 +
7737 +#ifndef GLOBAL_PTR_BIAS
7738 +#define        gDslGlobalVarPtr                        ((struct __dslVarsStruct *)gDslVars)
7739 +#define        gDslGlobalSlowVarPtr            (gDslGlobalVarPtr->dslSlowVars)
7740 +#else
7741 +#define        gDslGlobalVarPtr                        ((struct __dslVarsStruct *) (void*)((uchar*)(gDslVars) - GLOBAL_PTR_BIAS))
7742 +#define        gDslGlobalSlowVarPtr            ((struct __dslSlowVarsStruct *) (void*)((uchar*)(gDslGlobalVarPtr->dslSlowVars) - GLOBAL_PTR_BIAS))
7743 +#endif
7744 +
7745 +#define        gDslSampleBuffersVars           (gDslGlobalVarPtr->sampleBuffersVars)
7746 +
7747 +#define        gDslMuxFramerVars                       (gDslGlobalVarPtr->muxFramerVars)
7748 +#define        gDslMuxFramerSharedVars         (gDslGlobalVarPtr->scratchVars.muxFramerSharedVars)
7749 +#define        gDslLinkLayerVars                       (gDslGlobalVarPtr->linkLayerVars)
7750 +#define        gDslAtmVars                                     (gDslGlobalVarPtr->linkLayerVars.atmVars)
7751 +#define        gDslPacketVars                          (gDslGlobalVarPtr->linkLayerVars.dslPacketVars)
7752 +#define        gG997Vars                                       (gDslGlobalVarPtr->G997Vars)
7753 +
7754 +#ifdef G992P3
7755 +#define        gG992p3OvhMsgVars                       (gDslGlobalVarPtr->G992p3OvhMsgVars)
7756 +#endif
7757 +
7758 +#define        gAdslMibVars                            (gDslGlobalVarPtr->adslMibVars)
7759 +
7760 +#define        gT1p413Vars                                     (gDslGlobalVarPtr->physicalLayerVars.T1p413Vars)
7761 +#define        gG994p1Vars                                     (gDslGlobalVarPtr->physicalLayerVars.G994p1Vars)
7762 +#define        gG992Vars                                       (gDslGlobalVarPtr->physicalLayerVars.G992Vars)
7763 +#define gG992p2ProfileVars                     (gDslGlobalVarPtr->G992p2ProfileVars)
7764 +
7765 +#define        gG992ScratchVars                        (gDslGlobalVarPtr->scratchVars.G992ScratchVars)
7766 +
7767 +#ifndef gEyeHandlerPtr
7768 +#define        gEyeHandlerPtr                          (gDslGlobalVarPtr->eyeHandlerPtr)
7769 +#endif
7770 +
7771 +#ifndef gLogHandlerPtr
7772 +#define        gLogHandlerPtr                          (gDslGlobalVarPtr->logHandlerPtr)
7773 +#endif
7774 +
7775 +#ifdef VP_SIMULATOR
7776 +#define        gDriverCallback(x)                      (gDslGlobalVarPtr->driverCallback)(x)
7777 +#else
7778 +#define        gDriverCallback(x)
7779 +#endif
7780 +
7781 +/*
7782 +**
7783 +**             Frame functions callouts
7784 +**
7785 +*/
7786 +
7787 +#define        gDslFrameFunc                           (gDslGlobalVarPtr->DslFrameFunctions)
7788 +
7789 +#define        DslFrameBufferGetLength(gDslVars, fb) \
7790 +       gDslFrameFunc.__DslFrameBufferGetLength(fb)
7791 +
7792 +#define DslFrameBufferGetAddress(gDslVars, fb) \
7793 +       gDslFrameFunc.__DslFrameBufferGetAddress(fb)
7794 +
7795 +#define DslFrameBufferSetLength(gDslVars, fb, l) \
7796 +       gDslFrameFunc.__DslFrameBufferSetLength(fb, l)
7797 +
7798 +#define DslFrameBufferSetAddress(gDslVars, fb, p) \
7799 +       gDslFrameFunc.__DslFrameBufferSetAddress(fb, p)
7800 +
7801 +#define DslFrameInit(gDslVars, f) \
7802 +       gDslFrameFunc.__DslFrameInit(f)
7803 +
7804 +#define DslFrameGetLength(gDslVars, pFrame) \
7805 +       gDslFrameFunc.__DslFrameGetLength(pFrame)
7806 +
7807 +#define DslFrameGetBufCnt(gDslVars, pFrame) \
7808 +       gDslFrameFunc.__DslFrameGetBufCnt(pFrame)
7809 +
7810 +#define DslFrameGetFirstBuffer(gDslVars, pFrame) \
7811 +       gDslFrameFunc.__DslFrameGetFirstBuffer(pFrame)
7812 +
7813 +#define DslFrameGetNextBuffer(gDslVars, pFrBuffer) \
7814 +       gDslFrameFunc.__DslFrameGetNextBuffer(pFrBuffer)
7815 +
7816 +#define DslFrameSetNextBuffer(gDslVars, pFrBuf, pFrBufNext) \
7817 +       gDslFrameFunc.__DslFrameSetNextBuffer(pFrBuf, pFrBufNext)
7818 +
7819 +#define DslFrameGetLastBuffer(gDslVars, pFrame) \
7820 +       gDslFrameFunc.__DslFrameGetLastBuffer(pFrame)
7821 +
7822 +#define DslFrameGetLinkFieldAddress(gDslVars, f) \
7823 +       gDslFrameFunc.__DslFrameGetLinkFieldAddress(f)
7824 +
7825 +#define DslFrameGetFrameAddressFromLink(gDslVars, lnk) \
7826 +       gDslFrameFunc.__DslFrameGetFrameAddressFromLink(lnk)
7827 +
7828 +
7829 +#define DslFrameGetOobInfo(gDslVars, f, pOobInfo) \
7830 +       gDslFrameFunc.__DslFrameGetOobInfo(f, pOobInfo)
7831 +
7832 +#define DslFrameSetOobInfo(gDslVars, f, pOobInfo) \
7833 +       gDslFrameFunc.__DslFrameSetOobInfo(f, pOobInfo)
7834 +
7835 +
7836 +#define DslFrameEnqueBufferAtBack(gDslVars, f, b) \
7837 +       gDslFrameFunc.__DslFrameEnqueBufferAtBack(f, b)
7838 +
7839 +#define DslFrameEnqueFrameAtBack(gDslVars, fMain, f) \
7840 +       gDslFrameFunc.__DslFrameEnqueFrameAtBack(fMain, f)
7841 +
7842 +#define DslFrameEnqueBufferAtFront(gDslVars, f, b) \
7843 +       gDslFrameFunc.__DslFrameEnqueBufferAtFront(f, b)
7844 +
7845 +#define DslFrameEnqueFrameAtFront(gDslVars, fMain, f) \
7846 +       gDslFrameFunc.__DslFrameEnqueFrameAtFront(fMain, f)
7847 +
7848 +#define DslFrameDequeBuffer(gDslVars, pFrame) \
7849 +       gDslFrameFunc.__DslFrameDequeBuffer(pFrame)
7850 +
7851 +#define DslFrameAllocMemForFrames(gDslVars, frameNum) \
7852 +       gDslFrameFunc.__DslFrameAllocMemForFrames(frameNum)
7853 +
7854 +#define DslFrameFreeMemForFrames(gDslVars, hMem) \
7855 +       gDslFrameFunc.__DslFrameFreeMemForFrames(hMem)
7856 +
7857 +#define DslFrameAllocFrame(gDslVars, handle) \
7858 +       gDslFrameFunc.__DslFrameAllocFrame(handle)
7859 +
7860 +#define DslFrameFreeFrame(gDslVars, handle, pFrame) \
7861 +       gDslFrameFunc.__DslFrameFreeFrame(handle, pFrame)
7862 +
7863 +#define DslFrameAllocMemForBuffers(gDslVars, ppMemPool, bufNum, memSize) \
7864 +       gDslFrameFunc.__DslFrameAllocMemForBuffers(ppMemPool, bufNum, memSize)
7865 +
7866 +#define DslFrameFreeMemForBuffers(gDslVars, hMem, memSize, pMemPool) \
7867 +       gDslFrameFunc.__DslFrameFreeMemForBuffers(hMem, memSize, pMemPool)
7868 +
7869 +#define DslFrameAllocBuffer(gDslVars, handle, pMem, length) \
7870 +       gDslFrameFunc.__DslFrameAllocBuffer(handle, pMem, length)
7871 +
7872 +#define DslFrameFreeBuffer(gDslVars, handle, pBuf) \
7873 +       gDslFrameFunc.__DslFrameFreeBuffer(handle, pBuf)
7874 +
7875 +#define DslFrame2Id(gDslVars, handle, pFrame) \
7876 +       gDslFrameFunc.__DslFrame2Id(handle, pFrame)
7877 +
7878 +#define DslFrameId2Frame(gDslVars, handle, frameId) \
7879 +       gDslFrameFunc.__DslFrameId2Frame (handle, frameId)
7880 +
7881 +
7882 +#endif /* SoftDslGlobals */
7883 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.h
7884 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.h      1970-01-01 01:00:00.000000000 +0100
7885 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftDsl.h     2006-06-26 09:07:10.000000000 +0200
7886 @@ -0,0 +1,2920 @@
7887 +/****************************************************************************
7888 + *
7889 + * SoftDsl.h 
7890 + *
7891 + *
7892 + * Description:
7893 + *     This file contains the exported interface for SoftDsl.c
7894 + *
7895 + *
7896 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
7897 + * Authors: Ilya Stomakhin
7898 + *
7899 + * $Revision: 1.275 $
7900 + *
7901 + * $Id: SoftDsl.h,v 1.275 2005/04/28 22:55:36 ilyas Exp $
7902 + *
7903 + * $Log: SoftDsl.h,v $
7904 + * Revision 1.275  2005/04/28 22:55:36  ilyas
7905 + * Cleaned up kDslG992RunAnnexaP3ModeInAnnexaP5, kG992EnableAnnexM and kDslAtuChangeTxFilterRequest definitions
7906 + *
7907 + * Revision 1.274  2005/04/27 20:57:32  yongbing
7908 + * Implement 32 frequency break points for TSSI, PR 30211
7909 + *
7910 + * Revision 1.273  2005/04/02 03:27:52  kdu
7911 + * PR30236: Define kDslEnableRoundUpDSLoopAttn, this is shared with kDslCentilliumCRCWorkAroundEnabled.
7912 + *
7913 + * Revision 1.272  2005/04/01 21:56:39  ilyas
7914 + * Added more test commands definitions
7915 + *
7916 + * Revision 1.271  2005/02/11 05:03:57  ilyas
7917 + * Added support for DslOs
7918 + *
7919 + * Revision 1.270  2005/02/11 03:33:22  lke
7920 + * Support 2X, 4X, and 8X spectrum in ANNEX_I DS
7921 + *
7922 + * Revision 1.269  2005/01/08 00:11:58  ilyas
7923 + * Added definition for AnnexL status
7924 + *
7925 + * Revision 1.268  2004/12/18 00:52:35  mprahlad
7926 + * Add Dig US Pwr cutback status
7927 + *
7928 + * Revision 1.267  2004/11/08 22:21:38  ytan
7929 + * init swap state after retrain
7930 + *
7931 + * Revision 1.266  2004/11/05 21:16:50  ilyas
7932 + * Added support for pwmSyncClock
7933 + *
7934 + * Revision 1.265  2004/10/28 20:05:17  gsyu
7935 + * Fixed compilation errors for simulation targets
7936 + *
7937 + * Revision 1.264  2004/10/23 00:16:35  nino
7938 + * Added kDslHardwareSetRcvAGC status to set absolute rcv agc gain.
7939 + *
7940 + * Revision 1.263  2004/10/22 21:21:06  ilyas
7941 + * Fixed bit definition overlap in demodCapabilities
7942 + *
7943 + * Revision 1.262  2004/10/20 00:43:20  gsyu
7944 + * Added constants to support new xmt sample buffer control scheme
7945 + *
7946 + * Revision 1.261  2004/10/12 01:09:28  nino
7947 + * Remove kDslHardwareEnablePwmSyncClk and kDslHardwareSetPwmSyncClkFreq
7948 + * status definitions. Add kDslEnablePwmSyncClk and kDslSetPwmSyncClkFreq
7949 + * command definitions.
7950 + *
7951 + * Revision 1.260  2004/10/11 20:21:26  nino
7952 + * Added kDslHardwareEnablePwmSyncClk and kDslHardwareSetPwmSynClkFreq hardware statuses.
7953 + *
7954 + * Revision 1.259  2004/10/07 19:17:29  nino
7955 + * Added kDslHardwareGetRcvAGC status.
7956 + *
7957 + * Revision 1.258  2004/10/02 00:17:14  nino
7958 + * Added kDslHardwareAGCSetPga2 and kDslSetPilotEyeDisplay status definitions.
7959 + *
7960 + * Revision 1.257  2004/08/27 01:00:30  mprahlad
7961 + *
7962 + * Keep kDslAtuChangeTxFilterRequest defined by default so ADSL1 only targets can
7963 + * build
7964 + *
7965 + * Revision 1.256  2004/08/20 19:00:34  ilyas
7966 + * Added power management code for 2+
7967 + *
7968 + * Revision 1.255  2004/08/17 23:18:25  kdu
7969 + * Merged interop changes for TDC lab from a023e9.
7970 + *
7971 + * Revision 1.254  2004/07/22 00:56:03  yongbing
7972 + * Add ADSL2 Annex B modulation definition
7973 + *
7974 + * Revision 1.253  2004/07/16 22:23:28  nino
7975 + * - Defined macros to extract subcarrier and supported set information
7976 + *   for tssi. Subcarrier and suported set indicator is packed into
7977 + *   dsSubcarrier index array.
7978 + *
7979 + * Revision 1.252  2004/07/01 00:11:22  nino
7980 + * Added preliminary code for debugDataHandler (inside of #if DEBUG_DATA_HANDLER).
7981 + *
7982 + * Revision 1.251  2004/06/24 03:08:39  ilyas
7983 + * Added GFC mapping control for ATM bonding
7984 + *
7985 + * Revision 1.250  2004/06/23 00:03:20  khp
7986 + * - shorten self test result register length to 1 (satisfied requirement
7987 + *   at DT, no known requirement anywhere else)
7988 + *
7989 + * Revision 1.249  2004/06/15 20:18:33  ilyas
7990 + * Made D uchar again for compatibility with older ADSl drivers that use this structure. ADSL driver will rely on G992p3 parameters for large D
7991 + *
7992 + * Revision 1.248  2004/06/12 00:26:03  gsyu
7993 + * Added constants for AnnexM
7994 + *
7995 + * Revision 1.247  2004/06/10 18:53:24  yjchen
7996 + * add large D support
7997 + *
7998 + * Revision 1.246  2004/06/04 01:55:00  linyin
7999 + * Add a constant for SRA enable/disable
8000 + *
8001 + * Revision 1.245  2004/05/19 23:22:23  linyin
8002 + * Support L2
8003 + *
8004 + * Revision 1.244  2004/05/15 03:04:58  ilyas
8005 + * Added L3 test definition
8006 + *
8007 + * Revision 1.243  2004/05/14 03:04:38  ilyas
8008 + * Fixed structure name typo
8009 + *
8010 + * Revision 1.242  2004/05/14 02:01:01  ilyas
8011 + * Fixed structure name typo
8012 + *
8013 + * Revision 1.241  2004/05/14 01:21:49  nino
8014 + * Added kDslSignalAttenuation, kDslAttainableNetDataRate kDslHLinScale constant definitions.
8015 + *
8016 + * Revision 1.240  2004/05/13 19:07:58  ilyas
8017 + * Added new statuses for ADSL2
8018 + *
8019 + * Revision 1.239  2004/05/01 01:09:51  ilyas
8020 + * Added power management command and statuses
8021 + *
8022 + * Revision 1.238  2004/04/23 22:50:38  ilyas
8023 + * Implemented double buffering to ensure G.997 HDLC frame (OvhMsg) is continuous
8024 + *
8025 + * Revision 1.237  2004/03/31 18:57:39  ilyas
8026 + * Added drop on data error capability control
8027 + *
8028 + * Revision 1.236  2004/03/30 03:11:30  ilyas
8029 + * Added #ifdef for CFE build
8030 + *
8031 + * Revision 1.235  2004/03/29 23:06:39  ilyas
8032 + * Added status for BG table update
8033 + *
8034 + * Revision 1.234  2004/03/17 02:49:49  ilyas
8035 + * Turn off ATM bit reversal for Alcatel DSLAM only
8036 + *
8037 + * Revision 1.233  2004/03/11 03:09:48  mprahlad
8038 + * Add test mode for afeloopback test
8039 + *
8040 + * Revision 1.232  2004/03/10 23:15:53  ilyas
8041 + * Added ETSI modem support
8042 + *
8043 + * Revision 1.231  2004/03/04 19:28:14  linyin
8044 + * Support adsl2plus
8045 + *
8046 + * Revision 1.230  2004/02/28 00:06:21  ilyas
8047 + * Added OLR message definitions for ADSL2+
8048 + *
8049 + * Revision 1.229  2004/02/13 03:21:15  mprahlad
8050 + * define kDslAturHwAgcMaxGain correctly for 6348
8051 + *
8052 + * Revision 1.228  2004/02/09 05:06:17  yongbing
8053 + * Add ADSL2 bit swap function
8054 + *
8055 + * Revision 1.227  2004/02/04 02:08:19  linyin
8056 + * remove the redefined kG992p5AnnexA
8057 + *
8058 + * Revision 1.226  2004/02/04 01:41:48  linyin
8059 + * Add some variables for G992P5
8060 + *
8061 + * Revision 1.225  2004/02/03 19:12:22  gsyu
8062 + * Added a dedicate structure and constants for G992P5
8063 + *
8064 + * Revision 1.224  2004/01/24 01:18:34  ytan
8065 + * add multi-section swapping flag
8066 + *
8067 + * Revision 1.223  2004/01/17 00:21:48  ilyas
8068 + * Added commands and statuses for OLR
8069 + *
8070 + * Revision 1.222  2004/01/13 19:12:37  gsyu
8071 + * Added more constants for Double upstream
8072 + *
8073 + * Revision 1.221  2003/12/23 21:19:04  mprahlad
8074 + * Define BCM6348_TEMP_MOVE_TO_LMEM to FAST_TEXT for 6348 targets - this is for
8075 + * ADSL2/AnnexA multimode builds - move a few functions to Lmem for now to avoid
8076 + * changes for swap on 6348.
8077 + *
8078 + * Revision 1.220  2003/12/19 21:21:53  ilyas
8079 + * Added dying gasp support for ADSL2
8080 + *
8081 + * Revision 1.219  2003/12/05 02:09:51  mprahlad
8082 + * Leave the AnalogEC defs in - saves ifdef-ing all uses of these defines.
8083 + * Include Bcm6345_To_Bcm6348.h - to be able to pick up macros for the
8084 + * transition
8085 + *
8086 + * Revision 1.218  2003/12/04 02:10:58  linyin
8087 + * Redefine some constants for supporting different pilot and TTR
8088 + *
8089 + * Revision 1.217  2003/12/03 02:24:39  gsyu
8090 + * Reverse previous check in for Double Upstream demo
8091 + *
8092 + * Revision 1.215  2003/11/20 00:58:47  yongbing
8093 + * Merge ADSL2 functionalities into Annex A branch
8094 + *
8095 + * Revision 1.214  2003/11/06 00:35:06  nino
8096 + * Added kDslWriteAfeRegCmd and kDslReadAfeRegCmd commands.
8097 + *
8098 + * Revision 1.213  2003/11/05 21:04:23  ilyas
8099 + * Added more codes for LOG data
8100 + *
8101 + * Revision 1.212  2003/10/22 00:51:52  yjchen
8102 + * define constant for quiet line noise
8103 + *
8104 + * Revision 1.211  2003/10/20 22:08:57  nino
8105 + * Added kDslSetRcvGainCmd and kDslBypassRcvHpfCmd debug commands.
8106 + *
8107 + * Revision 1.210  2003/10/18 00:04:59  yjchen
8108 + * define constants for G992P3 diagnostic mode channel response
8109 + *
8110 + * Revision 1.209  2003/10/17 22:41:29  yongbing
8111 + * Add INP message support
8112 + *
8113 + * Revision 1.208  2003/10/16 00:06:09  uid1249
8114 + * Moved G.994 definitions from G.994p1MainTypes.h
8115 + *
8116 + * Revision 1.207  2003/10/15 20:45:11  linyin
8117 + * Add some constants for support Revision 2
8118 + *
8119 + * Revision 1.206  2003/10/14 22:04:02  ilyas
8120 + * Added Nino's AFE statuses for 6348
8121 + *
8122 + * Revision 1.205  2003/10/10 18:49:26  gsyu
8123 + * Added test modes to workaround the clock domain crossing bug, PR18038
8124 + *
8125 + * Revision 1.204  2003/09/30 19:27:46  mprahlad
8126 + * ifdef AnalogEC definies with #ifndef BCM6348_SRC
8127 + *
8128 + * Revision 1.203  2003/09/26 19:36:34  linyin
8129 + * Add annexi constant and vars
8130 + *
8131 + * Revision 1.202  2003/09/25 20:16:13  yjchen
8132 + * remove featureNTR definition
8133 + *
8134 + * Revision 1.201  2003/09/08 20:29:51  ilyas
8135 + * Added test commands for chip regression tests
8136 + *
8137 + * Revision 1.200  2003/08/26 00:58:14  ilyas
8138 + * Added I432 reset command (for header compression)
8139 + * Fixed SoftDsl time (for I432 header compression)
8140 + *
8141 + * Revision 1.199  2003/08/26 00:37:29  ilyas
8142 + * #ifdef'ed DslFrameFunctions in dslCommand structure to save space
8143 + *
8144 + * Revision 1.198  2003/08/22 22:45:00  liang
8145 + * Change the NF field in G992CodingParams from uchar to ushort to support K=256 (dataRate=255*32kbps) in fast path.
8146 + *
8147 + * Revision 1.197  2003/08/21 21:19:05  ilyas
8148 + * Changed dataPumpCapabilities structure for G992P3
8149 + *
8150 + * Revision 1.196  2003/08/12 22:44:28  khp
8151 + * - for Haixiang: added kDslTestMarginTweak command and marginTweakSpec
8152 + *
8153 + * Revision 1.195  2003/07/24 17:28:16  ovandewi
8154 + * added Tx filter change request code
8155 + *
8156 + * Revision 1.194  2003/07/24 15:48:55  yongbing
8157 + * Reduce TSSI buffer size to avoid crash at the beginning of G.994.1. Need to find out why
8158 + *
8159 + * Revision 1.193  2003/07/19 07:11:47  nino
8160 + * Revert back to version 1.191.
8161 + *
8162 + * Revision 1.191  2003/07/17 21:25:25  yongbing
8163 + * Add support for READSL2 and TSSI
8164 + *
8165 + * Revision 1.190  2003/07/14 19:42:33  yjchen
8166 + * add constants for G992P3
8167 + *
8168 + * Revision 1.189  2003/07/10 23:07:11  liang
8169 + * Add demodCapability bit to minimize showtime ATUC xmt power through b&g table.
8170 + *
8171 + * Revision 1.188  2003/07/08 22:18:50  liang
8172 + * Added demodCapability bit for G.994.1 Annex A multimode operation.
8173 + *
8174 + * Revision 1.187  2003/07/07 23:24:43  ilyas
8175 + * Added G.dmt.bis definitions
8176 + *
8177 + * Revision 1.186  2003/06/25 02:44:02  liang
8178 + * Added demod capability bit kDslUE9000ADI918FECFixEnabled.
8179 + * Added back kDslHWEnableAnalogECUpdate & kDslHWEnableAnalogEC for backward compatibility (annex A).
8180 + *
8181 + * Revision 1.185  2003/06/18 01:39:19  ilyas
8182 + * Added AFE test commands. Add #defines for driver's builds
8183 + *
8184 + * Revision 1.184  2003/06/06 23:58:09  ilyas
8185 + * Added command and status for standalone AFE tests
8186 + *
8187 + * Revision 1.183  2003/05/29 21:09:32  nino
8188 + * - kDslHWEnableAnalogECUpdate define replaced with kDslHWSetDigitalEcUpdateMode
8189 + * - kDslHWEnableAnalogEC       define replaced with kDslHWDisableDigitalECUpdate
8190 + *
8191 + * Revision 1.182  2003/04/15 22:08:15  liang
8192 + * Changed one of the demodCapability bit name from last checkin.
8193 + *
8194 + * Revision 1.181  2003/04/13 19:25:54  liang
8195 + * Added three more demodCapability bits.
8196 + *
8197 + * Revision 1.180  2003/04/02 02:09:17  liang
8198 + * Added demodCapability bit for ADI low rate option fix disable.
8199 + *
8200 + * Revision 1.179  2003/03/18 18:22:06  yongbing
8201 + * Use 32 tap TEQ for Annex I
8202 + *
8203 + * Revision 1.178  2003/03/06 00:58:07  ilyas
8204 + * Added SetStausBuffer command
8205 + *
8206 + * Revision 1.177  2003/02/25 00:46:26  ilyas
8207 + * Added T1.413 EOC vendor ID
8208 + *
8209 + * Revision 1.176  2003/02/21 23:30:54  ilyas
8210 + * Added Xmtgain command framing mode status and T1413VendorId parameters
8211 + *
8212 + * Revision 1.175  2003/02/07 22:13:55  liang
8213 + * Add demodCapabilities bits for sub-sample alignment and higher T1.413 level (used internally only).
8214 + *
8215 + * Revision 1.174  2003/01/23 02:54:07  liang
8216 + * Added demod capability bit for bitswap enable.
8217 + *
8218 + * Revision 1.173  2002/12/13 18:36:33  yongbing
8219 + * Add support for G.992.2 Annex C
8220 + *
8221 + * Revision 1.172  2002/12/10 23:27:12  ilyas
8222 + * Extended dslException parameter structure to allow printout from DslDiags
8223 + *
8224 + * Revision 1.171  2002/12/06 02:10:19  liang
8225 + * Moved the T1.413 RAck1/RAck2 switching variables to connection setup structure.
8226 + * Added/Modified the training progress codes for T1.413 RAck1/RAck2 and upstream 2x IFFT disable.
8227 + *
8228 + * Revision 1.170  2002/11/11 00:20:05  liang
8229 + * Add demod capability constant for internally disabling upstream 2x IFFT in T1.413 mode.
8230 + *
8231 + * Revision 1.169  2002/11/06 03:46:19  liang
8232 + * Add training progress code for upstream 2x IFFT disable.
8233 + *
8234 + * Revision 1.168  2002/11/01 01:41:06  ilyas
8235 + * Added flags for Centillium 4103 workarround
8236 + *
8237 + * Revision 1.167  2002/10/26 01:26:11  gsyu
8238 + * Move SoftDslLineHandler from SDRAM to LMEM
8239 + *
8240 + * Revision 1.166  2002/10/20 18:56:20  khp
8241 + * - for linyin
8242 + *   - #ifdef NEC_NSIF_WORKAROUND:
8243 + *     - add macros to extract NSIF status and fail counter vars
8244 + *
8245 + * Revision 1.165  2002/10/14 05:24:35  liang
8246 + * Add training status code to request alternate xmt filter (for Samsung 6-port ADI918 DSLAMs) to meet KT 2km spec.
8247 + *
8248 + * Revision 1.164  2002/10/08 21:44:50  ilyas
8249 + * Fixed EOC stuffing byte to indicate "no synchronization" action
8250 + *
8251 + * Revision 1.163  2002/10/03 19:34:24  ilyas
8252 + * Added size for EOC serial number register
8253 + *
8254 + * Revision 1.162  2002/09/28 02:42:27  yongbing
8255 + * Add retrain in T1.413 with R-Ack1 tone
8256 + *
8257 + * Revision 1.161  2002/09/28 01:23:35  gsyu
8258 + * Reverse us2xifft change so that we can install new us2xifft on the tree
8259 + *
8260 + * Revision 1.160  2002/09/26 23:30:48  yongbing
8261 + * Add synch symbol detection in Showtime
8262 + *
8263 + * Revision 1.159  2002/09/20 23:47:52  khp
8264 + * - for gsyu: enable 2X IFFT for Annex A (XMT_FFT_SIZE_2X)
8265 + *
8266 + * Revision 1.158  2002/09/14 03:26:39  ilyas
8267 + * Changed far-end RDI reporting
8268 + *
8269 + * Revision 1.157  2002/09/13 21:10:54  ilyas
8270 + * Added reporting of remote modem LOS and RDI.
8271 + * Moved G992CodingParams definition to SoftDsl.h
8272 + *
8273 + * Revision 1.156  2002/09/12 21:07:19  ilyas
8274 + * Added HEC, OCD and LCD counters
8275 + *
8276 + * Revision 1.155  2002/09/09 21:31:30  linyin
8277 + * Add two constant to support long reach
8278 + *
8279 + * Revision 1.154  2002/09/07 01:31:51  ilyas
8280 + * Added support for OEM parameters
8281 + *
8282 + * Revision 1.153  2002/09/04 22:36:14  mprahlad
8283 + * defines for non standard info added
8284 + *
8285 + * Revision 1.152  2002/08/02 21:59:09  liang
8286 + * Enable G.992.2 carrierInfo in capabitilities when G.992.1 annex A is used for G.992.2.
8287 + *
8288 + * Revision 1.151  2002/07/29 20:01:03  ilyas
8289 + * Added command for Atm VC map table change
8290 + *
8291 + * Revision 1.150  2002/07/18 22:30:47  liang
8292 + * Add xmt power and power cutback related constants.
8293 + *
8294 + * Revision 1.149  2002/07/11 01:30:58  ilyas
8295 + * Changed status for ShowtimeMargin reporting
8296 + *
8297 + * Revision 1.148  2002/07/09 19:19:09  ilyas
8298 + * Added status parameters for ShowtimeSNRMargin info and command to filter
8299 + * out SNR margin data
8300 + *
8301 + * Revision 1.147  2002/06/27 21:50:24  liang
8302 + * Added test command related demodCapabilities bits.
8303 + *
8304 + * Revision 1.146  2002/06/26 21:29:00  liang
8305 + * Added dsl test cmd structure and showtime margin connection info status.
8306 + *
8307 + * Revision 1.145  2002/06/15 05:15:51  ilyas
8308 + * Added definitions for Ping, Dying Gasp and other test commands
8309 + *
8310 + * Revision 1.144  2002/05/30 19:55:15  ilyas
8311 + * Added status for ADSL PHY MIPS exception
8312 + * Changed conflicting definition for higher rates (S=1/2)
8313 + *
8314 + * Revision 1.143  2002/05/21 23:41:07  yongbing
8315 + * First check-in of Annex C S=1/2 codes
8316 + *
8317 + * Revision 1.142  2002/04/29 22:25:09  georgep
8318 + * Merge from branch annexC_demo - add status message constants
8319 + *
8320 + * Revision 1.141  2002/04/18 19:00:35  ilyas
8321 + * Added include file for builds in CommEngine environment
8322 + *
8323 + * Revision 1.140  2002/04/18 00:18:36  yongbing
8324 + * Add detailed timeout error messages
8325 + *
8326 + * Revision 1.139  2002/04/02 10:03:18  ilyas
8327 + * Merged BERT from AnnexA branch
8328 + *
8329 + * Revision 1.138  2002/03/26 01:42:29  ilyas
8330 + * Added timeout message constants for annex C
8331 + *
8332 + * Revision 1.137  2002/03/22 19:39:22  yongbing
8333 + * Modify for co-exist of G994P1 and T1P413
8334 + *
8335 + * Revision 1.136  2002/03/22 01:19:40  ilyas
8336 + * Add status message constants for total FEXT Bits, NEXT bits
8337 + *
8338 + * Revision 1.135  2002/03/10 22:32:24  liang
8339 + * Added report constants for LOS recovery and timing tone index.
8340 + *
8341 + * Revision 1.134  2002/03/07 22:06:32  georgep
8342 + * Replace ifdef G992P1 with G992P1_ANNEX_A for annex A variables
8343 + *
8344 + * Revision 1.133  2002/02/16 01:08:18  georgep
8345 + * Add log constant for showtime mse
8346 + *
8347 + * Revision 1.132  2002/02/08 04:36:27  ilyas
8348 + * Added commands for LOG file and fixed Idle mode pointer update
8349 + *
8350 + * Revision 1.131  2002/01/24 20:21:30  georgep
8351 + * Add logging defines, remove fast retrain defines
8352 + *
8353 + * Revision 1.130  2002/01/19 23:59:17  ilyas
8354 + * Added support for LOG and eye data to ADSL core target
8355 + *
8356 + * Revision 1.129  2002/01/16 23:43:54  liang
8357 + * Remove the carriage return character from last checkin.
8358 + *
8359 + * Revision 1.128  2002/01/15 22:27:13  ilyas
8360 + * Added command for ADSL loopback
8361 + *
8362 + * Revision 1.127  2002/01/10 07:18:22  ilyas
8363 + * Added status for printf (mainly for ADSL core debugging)
8364 + *
8365 + * Revision 1.126  2001/12/21 22:45:34  ilyas
8366 + * Added support for ADSL MIB data object
8367 + *
8368 + * Revision 1.125  2001/12/13 02:24:22  ilyas
8369 + * Added G997 (Clear EOC and G997 framer) support
8370 + *
8371 + * Revision 1.124  2001/11/30 05:56:31  liang
8372 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
8373 + *
8374 + * Revision 1.123  2001/11/15 19:01:07  yongbing
8375 + * Modify only T1.413 part to the top of tree based on AnnexBDevelopment branch
8376 + *
8377 + * Revision 1.122  2001/10/19 00:12:07  ilyas
8378 + * Added support for frame oriented (no ATM) data link layer
8379 + *
8380 + * Revision 1.121  2001/10/09 22:35:13  ilyas
8381 + * Added more ATM statistics and OAM support
8382 + *
8383 + * Revision 1.105.2.20  2001/11/27 02:32:03  liang
8384 + * Combine vendor ID, serial #, and version number into SoftModemVersionNumber.c.
8385 + *
8386 + * Revision 1.105.2.19  2001/11/21 01:29:14  georgep
8387 + * Add a status message define for annexC
8388 + *
8389 + * Revision 1.105.2.18  2001/11/08 23:26:28  yongbing
8390 + * Add carrier selection function for Annex A and B
8391 + *
8392 + * Revision 1.105.2.17  2001/11/07 22:55:30  liang
8393 + * Report G992 rcv msg CRC error as what it is instead of time out.
8394 + *
8395 + * Revision 1.105.2.16  2001/11/05 19:56:21  liang
8396 + * Add DC offset info code.
8397 + *
8398 + * Revision 1.105.2.15  2001/10/16 00:47:16  yongbing
8399 + * Add return-to-T1p413 starting point if in error
8400 + *
8401 + * Revision 1.105.2.14  2001/10/15 23:14:01  yjchen
8402 + * remove ADSL_SINGLE_SYMBOL_BLOCK
8403 + *
8404 + * Revision 1.105.2.13  2001/10/12 18:07:16  yongbing
8405 + * Add support for T1.413
8406 + *
8407 + * Revision 1.105.2.12  2001/10/04 00:23:52  liang
8408 + * Add connection info constants for TEQ coef and PSD.
8409 + *
8410 + * Revision 1.105.2.11  2001/10/03 01:44:01  liang
8411 + * Merged with codes from main tree (tag SoftDsl_2_18).
8412 + *
8413 + * Revision 1.105.2.10  2001/09/28 22:10:04  liang
8414 + * Add G994 exchange message status reports.
8415 + *
8416 + * Revision 1.105.2.9  2001/09/26 18:08:21  georgep
8417 + * Send status error message in case features field is not setup properly
8418 + *
8419 + * Revision 1.105.2.8  2001/09/05 01:58:13  georgep
8420 + * Added status message for annexC measured delay
8421 + *
8422 + * Revision 1.105.2.7  2001/08/29 00:37:52  georgep
8423 + * Add log constants for annexC
8424 + *
8425 + * Revision 1.105.2.6  2001/08/18 00:01:34  georgep
8426 + * Add constants for annexC
8427 + *
8428 + * Revision 1.105.2.5  2001/08/08 17:33:28  yongbing
8429 + * Merge with tag SoftDsl_2_17
8430 + *
8431 + * Revision 1.120  2001/08/29 02:56:01  ilyas
8432 + * Added tests for flattening/unflatenning command and statuses (dual mode)
8433 + *
8434 + * Revision 1.119  2001/08/28 03:26:32  ilyas
8435 + * Added support for running host and adsl core parts separately ("dual" mode)
8436 + *
8437 + * Revision 1.118  2001/08/16 02:16:10  khp
8438 + * - mark functions with FAST_TEXT to reduce cycle counts for QPROC targets
8439 + *   (replaces use of LMEM_INSN)
8440 + *
8441 + * Revision 1.117  2001/06/18 20:06:35  ilyas
8442 + * Added forward declaration of dslCommandStruc to avoid gcc warnings
8443 + *
8444 + * Revision 1.116  2001/06/18 19:49:36  ilyas
8445 + * Changes to include support for HOST_ONLY mode
8446 + *
8447 + * Revision 1.115  2001/06/01 22:00:33  ilyas
8448 + * Changed ATM PHY interface to accomodate UTOPIA needs
8449 + *
8450 + * Revision 1.114  2001/05/16 06:22:24  liang
8451 + * Added status reports for xmt & rcv prefix enable position.
8452 + *
8453 + * Revision 1.113  2001/05/02 20:34:32  georgep
8454 + * Added log constants for snr1 calculation
8455 + *
8456 + * Revision 1.112  2001/04/25 01:20:11  ilyas
8457 + *
8458 + * Don't use DSL frame functions if ATM_LAYER is not defined
8459 + *
8460 + * Revision 1.111  2001/04/17 21:13:00  georgep
8461 + * Define status constant kDslHWSetDigitalEcUpdateShift
8462 + *
8463 + * Revision 1.110  2001/04/16 23:38:36  georgep
8464 + * Add HW AGC constants for ATUR
8465 + *
8466 + * Revision 1.109  2001/04/06 23:44:53  georgep
8467 + * Added status constant for setting up digitalEcGainShift
8468 + *
8469 + * Revision 1.108  2001/03/29 05:58:34  liang
8470 + * Replaced the Aware compatibility codes with automatic detection codes.
8471 + *
8472 + * Revision 1.107  2001/03/25 06:11:22  liang
8473 + * Combined separate loop attenuation status for ATUR & ATUC into one status.
8474 + * Replace separate hardware AGC info status for ATUR & ATUC into hardware AGC
8475 + * request status and hardware AGC obtained status.
8476 + * Use store AGC command to save hardware AGC value instead of returning value
8477 + * from status report.
8478 + *
8479 + * Revision 1.106  2001/03/24 00:43:22  liang
8480 + * Report more checksum results (NumOfCalls, txSignal, rxSignal & eyeData).
8481 + *
8482 + * Revision 1.105  2001/03/16 23:57:31  georgep
8483 + * Added more loop attenuation reporting status constants
8484 + *
8485 + * Revision 1.104  2001/03/15 00:22:07  liang
8486 + * Back to version 1.101.
8487 + *
8488 + * Revision 1.103  2001/03/15 00:03:44  yjchen
8489 + * use kDslATURHardwareAGCInfo for AltoE14 AGC as well
8490 + *
8491 + * Revision 1.102  2001/03/14 23:10:56  yjchen
8492 + * add defns for AltoE14 AGC
8493 + *
8494 + * Revision 1.101  2001/03/08 23:31:34  georgep
8495 + * Added R, S, D, coding parameters to dslDataPumpCapabilities
8496 + *
8497 + * Revision 1.100  2001/02/10 03:03:09  ilyas
8498 + * Added one more DslFrame function
8499 + *
8500 + * Revision 1.99  2001/02/09 01:55:27  ilyas
8501 + * Added status codes and macros to support printing of AAL packets
8502 + *
8503 + * Revision 1.98  2001/01/30 23:28:10  georgep
8504 + * Added kDslDspControlStatus for handling changes to dsp params
8505 + *
8506 + * Revision 1.97  2001/01/12 01:17:18  georgep
8507 + * Added bit in demodCapabilities for analog echo cancellor
8508 + *
8509 + * Revision 1.96  2001/01/04 05:51:03  ilyas
8510 + * Added more dslStatuses
8511 + *
8512 + * Revision 1.95  2000/12/21 05:46:07  ilyas
8513 + * Added name for struct _dslFrame
8514 + *
8515 + * Revision 1.94  2000/12/13 22:04:39  liang
8516 + * Add Reed-Solomon coding enable bit in demodCapabilities.
8517 + *
8518 + * Revision 1.93  2000/11/29 20:42:02  liang
8519 + * Add defines for SNR & max achivable rate status and DEC enable demodCapabilities bit.
8520 + *
8521 + * Revision 1.92  2000/09/22 21:55:13  ilyas
8522 + * Added support for DSL + Atm physical layer only (I.432) simulations
8523 + *
8524 + * Revision 1.91  2000/09/10 09:20:53  lkaplan
8525 + * Improve interface for sending Eoc messages
8526 + *
8527 + * Revision 1.90  2000/09/08 19:37:58  lkaplan
8528 + * Added code for handling EOC messages
8529 + *
8530 + * Revision 1.89  2000/09/07 23:02:27  georgep
8531 + * Add HarwareAGC Bit to demod Capabilities
8532 + *
8533 + * Revision 1.88  2000/09/01 00:57:34  georgep
8534 + * Added Hardware AGC status defines
8535 + *
8536 + * Revision 1.87  2000/08/31 19:04:26  liang
8537 + * Added external reference for stack size requirement test functions.
8538 + *
8539 + * Revision 1.86  2000/08/24 23:16:46  liang
8540 + * Increased sample block size for noBlock.
8541 + *
8542 + * Revision 1.85  2000/08/23 18:34:39  ilyas
8543 + * Added XxxVcConfigure function
8544 + *
8545 + * Revision 1.84  2000/08/05 00:25:04  georgep
8546 + * Redefine sampling freq constants
8547 + *
8548 + * Revision 1.83  2000/08/03 14:04:00  liang
8549 + * Add hardware time tracking clock error reset code.
8550 + *
8551 + * Revision 1.82  2000/07/23 20:52:52  ilyas
8552 + * Added xxxFrameBufSetAddress() function for ATM framer layers
8553 + * Rearranged linkLayer functions in one structure which is passed as a
8554 + * parameter to xxxLinkLayerInit() function to be set there
8555 + *
8556 + * Revision 1.81  2000/07/18 20:03:24  ilyas
8557 + * Changed DslFrame functions definitions to macros,
8558 + * Removed gDslVars from their parameter list
8559 + *
8560 + * Revision 1.80  2000/07/17 21:08:15  lkaplan
8561 + * removed global pointer
8562 + *
8563 + * Revision 1.79  2000/06/21 20:38:44  georgep
8564 + * Added bit to demodCapabilities for HW_TIME_TRACKING
8565 + *
8566 + * Revision 1.78  2000/06/19 19:57:55  georgep
8567 + * Added constants for logging of HWResampler data
8568 + *
8569 + * Revision 1.77  2000/06/02 18:57:21  ilyas
8570 + * Added support for DSL buffers consisting of many ATM cells
8571 + *
8572 + * Revision 1.76  2000/05/27 02:19:28  liang
8573 + * G992MonitorParams structure is moved here, and Tx/Rx data handler type definitions changed.
8574 + *
8575 + * Revision 1.75  2000/05/15 18:17:21  liang
8576 + * Added statuses for sent and received frames
8577 + *
8578 + * Revision 1.74  2000/05/14 01:56:38  ilyas
8579 + * Added ATM cell printouts
8580 + *
8581 + * Revision 1.73  2000/05/09 23:00:26  ilyas
8582 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
8583 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
8584 + *
8585 + * Revision 1.72  2000/05/03 18:01:18  georgep
8586 + * Removed old function declarations for Eoc/Aoc
8587 + *
8588 + * Revision 1.71  2000/05/03 03:57:04  ilyas
8589 + * Added LOG file support for writing ATM data
8590 + *
8591 + * Revision 1.70  2000/05/02 00:04:36  liang
8592 + * Add showtime monitoring and message exchange info constants.
8593 + *
8594 + * Revision 1.69  2000/04/28 23:34:20  yongbing
8595 + * Add constants for reporting error events in performance monitoring
8596 + *
8597 + * Revision 1.68  2000/04/21 23:09:04  liang
8598 + * Added G992 time out training progress constant.
8599 + *
8600 + * Revision 1.67  2000/04/19 00:31:47  ilyas
8601 + * Added global SoftDsl functions for Vc, added OOB info functions
8602 + *
8603 + * Revision 1.66  2000/04/18 00:45:31  yongbing
8604 + * Add G.DMT new frame structure, define G992P1_NEWFRAME to enable, need ATM layer to work
8605 + *
8606 + * Revision 1.65  2000/04/15 01:48:34  georgep
8607 + * Added T1p413 status constants
8608 + *
8609 + * Revision 1.64  2000/04/13 08:36:22  yura
8610 + * Added SoftDslSetRefData, SoftDslGetRefData functions
8611 + *
8612 + * Revision 1.63  2000/04/13 05:42:35  georgep
8613 + * Added constant for T1p413
8614 + *
8615 + * Revision 1.62  2000/04/05 21:49:54  liang
8616 + * minor change.
8617 + *
8618 + * Revision 1.61  2000/04/04 04:16:06  liang
8619 + * Merged with SoftDsl_0_03 from old tree.
8620 + *
8621 + * Revision 1.65  2000/04/04 01:47:21  ilyas
8622 + * Implemented abstract dslFrame and dslFrameBuffer objects
8623 + *
8624 + * Revision 1.64  2000/04/01 08:12:10  yura
8625 + * Added preliminary revision of the SoftDsl driver architecture
8626 + *
8627 + * Revision 1.63  2000/04/01 02:55:33  georgep
8628 + * New defines for G992p2Profile Structure
8629 + *
8630 + * Revision 1.62  2000/04/01 00:50:36  yongbing
8631 + * Add initial version of new frame structure for full-rate
8632 + *
8633 + * Revision 1.61  2000/03/24 03:30:45  georgep
8634 + * Define new constant kDslUpstreamSamplingFreq
8635 + *
8636 + * Revision 1.60  2000/03/23 19:51:30  georgep
8637 + * Define new features bits for G992p1
8638 + *
8639 + * Revision 1.59  2000/03/18 01:28:41  georgep
8640 + * Changed connectionSetup to include G992p1 Capabilities
8641 + *
8642 + * Revision 1.58  2000/02/29 01:40:03  georgep
8643 + * Changed modulationtype defines to be the same as SPAR1 in G994p1
8644 + *
8645 + * Revision 1.57  1999/11/19 01:03:19  george
8646 + * Use Block Size 256 for single symbol Mode
8647 + *
8648 + * Revision 1.56  1999/11/18 02:37:43  george
8649 + * Porting to 16Bit
8650 + *
8651 + * Revision 1.55  1999/11/12 02:12:55  george
8652 + * Added status constant for reporting of profile channel matching calculation
8653 + *
8654 + * Revision 1.54  1999/11/11 19:19:42  george
8655 + * Porting to 16Bit Compiler
8656 + *
8657 + * Revision 1.53  1999/11/05 01:27:06  liang
8658 + * Add recovery-from-inpulse-noise progress report.
8659 + *
8660 + * Revision 1.52  1999/11/02 02:06:27  george
8661 + * Added SNRMargin training status value
8662 + *
8663 + * Revision 1.51  1999/10/27 23:02:03  wan
8664 + * Add G.994.1 setup in dslConnectionSetupStruct for setting up Initiation side
8665 + *
8666 + * Revision 1.50  1999/10/25 21:55:36  liang
8667 + * Renamed the constant for FEQ output error.
8668 + *
8669 + * Revision 1.49  1999/10/23 02:20:55  george
8670 + * Add debug data codes
8671 + *
8672 + * Revision 1.48  1999/10/19 23:59:06  liang
8673 + * Change line handler interface to work with nonsymmetric sampling freq.
8674 + *
8675 + * Revision 1.47  1999/10/09 01:38:04  george
8676 + * Define maxProfileNumber
8677 + *
8678 + * Revision 1.46  1999/10/07 23:30:51  wan
8679 + * Add G.994.1 Tone and Fast Retrain Recov detections in G.992p2 SHOWTIME and Fast Retrain
8680 + *
8681 + * Revision 1.45  1999/10/06 13:59:27  liang
8682 + * Escape to G994.1 should be done through status instead of command.
8683 + *
8684 + * Revision 1.44  1999/10/06 02:01:28  george
8685 + * Add kDslReturnToG994p1Cmd
8686 + *
8687 + * Revision 1.43  1999/09/30 19:29:58  george
8688 + * Add reporting constant for Fast Retrain
8689 + *
8690 + * Revision 1.42  1999/09/16 23:41:56  liang
8691 + * Added command for host forced retrain.
8692 + *
8693 + * Revision 1.41  1999/08/20 00:47:25  wan
8694 + * Add constants for Fast Retrain progress status
8695 + *
8696 + * Revision 1.40  1999/08/16 18:06:01  wan
8697 + * Add more reporting constants for Fast Retrain
8698 + *
8699 + * Revision 1.39  1999/08/12 00:18:10  wan
8700 + * Add several Fast Retrain Status constants
8701 + *
8702 + * Revision 1.38  1999/08/10 18:25:38  george
8703 + * Define constants used for Fast Retrain
8704 + *
8705 + * Revision 1.37  1999/07/31 01:47:43  george
8706 + * Add status constants for eoc/aoc
8707 + *
8708 + * Revision 1.36  1999/07/27 18:19:52  george
8709 + * declare aoc/eoc functions
8710 + *
8711 + * Revision 1.35  1999/07/19 22:44:47  george
8712 + * Add constants for G994p1 Message Exchange
8713 + *
8714 + * Revision 1.34  1999/07/16 02:03:03  liang
8715 + * Modified Dsl link layer command spec structure.
8716 + *
8717 + * Revision 1.33  1999/07/14 22:53:16  george
8718 + * Add Constants for G994p1
8719 + *
8720 + * Revision 1.32  1999/07/13 00:02:26  liang
8721 + * Added more feature bits.
8722 + *
8723 + * Revision 1.31  1999/07/09 01:58:14  wan
8724 + * Added more constants G.994.1 testing reports
8725 + *
8726 + * Revision 1.30  1999/07/07 23:51:04  liang
8727 + * Added rcv power and loop attenuation reports.
8728 + *
8729 + * Revision 1.29  1999/07/06 21:32:01  liang
8730 + * Added some aux. feature bits, and field performanceMargin was changed to noiseMargin in Capabilities.
8731 + *
8732 + * Revision 1.28  1999/07/03 01:40:17  liang
8733 + * Redefined dsl command parameter list and added connection setup struct.
8734 + *
8735 + * Revision 1.27  1999/07/02 00:41:18  liang
8736 + * Add bit and gain logging as well as rcv carrier range status.
8737 + *
8738 + * Revision 1.26  1999/06/25 21:37:10  wan
8739 + * Work in progress for G994.1.
8740 + *
8741 + * Revision 1.25  1999/06/16 00:54:36  liang
8742 + * Added Tx/Rx SHOWTIME active training progress codes.
8743 + *
8744 + * Revision 1.24  1999/06/11 21:59:37  wan
8745 + * Added G994.1 fail status constant.
8746 + *
8747 + * Revision 1.23  1999/06/11 21:29:01  liang
8748 + * Constants for C/R-Msgs was changed to C/R-Msg.
8749 + *
8750 + * Revision 1.22  1999/06/08 02:49:42  liang
8751 + * Added SNR data logging.
8752 + *
8753 + * Revision 1.21  1999/06/07 21:05:08  liang
8754 + * Added more training status values.
8755 + *
8756 + * Revision 1.20  1999/05/22 02:18:26  liang
8757 + * More constant defines.
8758 + *
8759 + * Revision 1.19  1999/05/14 22:49:35  liang
8760 + * Added more status codes and debug data codes.
8761 + *
8762 + * Revision 1.18  1999/04/12 22:41:39  liang
8763 + * Work in progress.
8764 + *
8765 + * Revision 1.17  1999/04/01 20:28:07  liang
8766 + * Added RReverb detect event status.
8767 + *
8768 + * Revision 1.16  1999/03/26 03:29:54  liang
8769 + * Add DSL debug data constants.
8770 + *
8771 + * Revision 1.15  1999/03/08 21:58:00  liang
8772 + * Added more constant definitions.
8773 + *
8774 + * Revision 1.14  1999/03/02 01:49:36  liang
8775 + * Added more connection info codes.
8776 + *
8777 + * Revision 1.13  1999/03/02 00:25:55  liang
8778 + * Added DSL tx and rx data handler type definitions.
8779 + *
8780 + * Revision 1.12  1999/02/27 01:16:55  liang
8781 + * Increase allowable static memory size to a VERY large number for now.
8782 + *
8783 + * Revision 1.11  1999/02/25 00:24:06  liang
8784 + * Increased symbol block size to 16.
8785 + *
8786 + * Revision 1.10  1999/02/23 22:03:26  liang
8787 + * Increased maximal static memory size allowed.
8788 + *
8789 + * Revision 1.9  1999/02/17 02:39:21  ilyas
8790 + * Changes for NDIS
8791 + *
8792 + * Revision 1.8  1999/02/11 22:44:30  ilyas
8793 + * More definitions for ATM
8794 + *
8795 + * Revision 1.7  1999/02/10 01:56:38  liang
8796 + * Added hooks for G994.1 and G992.2.
8797 + *
8798 + *
8799 + *****************************************************************************/
8800 +
8801 +#ifndef        SoftDslHeader
8802 +#define        SoftDslHeader
8803 +
8804 +/* for builds in Linux/VxWorks CommEngine environment */
8805 +#if (defined(__KERNEL__) && !defined(LINUX_DRIVER)) || defined(VXWORKS) || defined(_WIN32_WCE) || defined(TARG_OS_RTEMS) || defined(_CFE_)
8806 +#include "AdslCoreDefs.h"
8807 +#else
8808 +#include "Bcm6345_To_Bcm6348.h"                /* File for 45->48 changes */
8809 +#endif
8810 +
8811 +#ifndef        SoftModemPh
8812 +#include "SoftModem.h"
8813 +#endif
8814 +
8815 +#ifdef DSL_OS
8816 +#include "DslOs.h"
8817 +#endif
8818 +
8819 +/*
8820 +**
8821 +**             Type definitions 
8822 +**
8823 +*/
8824 +
8825 +#if defined(ATM) || defined(DSL_PACKET)
8826 +#define DSL_LINKLAYER
8827 +#endif
8828 +
8829 +#if defined(ATM_LAYER) || defined(DSL_PACKET_LAYER) || defined(G997_1_FRAMER)
8830 +#define DSL_FRAME_FUNCTIONS
8831 +#endif
8832 +
8833 +#define FLD_OFFSET(type,fld)   ((int)(void *)&(((type *)0)->fld))
8834 +
8835 +#include "Que.h"
8836 +#include "SoftAtmVc.h"
8837 +
8838 +typedef struct _dslFrameBuffer
8839 +       {
8840 +       struct _dslFrameBuffer *next;   /* link to the next buffer in the frame */
8841 +       void                               *pData;      /* pointer to data */
8842 +       ulong                              length;      /* size (in bytes) of data */
8843 +       } dslFrameBuffer;
8844 +
8845 +typedef struct _dslFrame
8846 +       {
8847 +       ulong                   Reserved[3];
8848 +
8849 +       ulong                   totalLength;    /* total amount of data in the packet */
8850 +       int                             bufCnt;                 /* buffer counter */
8851 +       struct _dslFrameBuffer *head;   /* first buffer in the chain */
8852 +       struct _dslFrameBuffer *tail;   /* last buffer in the chain  */
8853 +       } dslFrame;
8854 +
8855 +
8856 +/* VC types and parameters */
8857 +
8858 +#define        kDslVcAtm               1
8859 +
8860 +typedef        struct
8861 +       {
8862 +       ulong   vcType;
8863 +       union
8864 +               {
8865 +               atmVcParams     atmParams;
8866 +               } params;
8867 +       } dslVcParams;
8868 +
8869 +/*
8870 +**     Assuming that dslVcParams.params is the first field in VC
8871 +**     and RefData is the first field in dslVcParams.params
8872 +*/
8873 +
8874 +#define        DslVcGetRefData(pVc)    (*(void **) (pVc))
8875 +
8876 +/* Frame OOB types */
8877 +
8878 +#define        kDslFrameAtm    1
8879 +
8880 +typedef        struct
8881 +       {
8882 +       ulong   frameType;              
8883 +       union
8884 +               {
8885 +               atmOobPacketInfo        atmInfo;
8886 +               } param;
8887 +       } dslOobFrameInfo;
8888 +
8889 +
8890 +typedef struct
8891 +       {
8892 +       ulong (SM_DECL *__DslFrameBufferGetLength) (dslFrameBuffer *fb);
8893 +       void * (SM_DECL *__DslFrameBufferGetAddress) (dslFrameBuffer *fb);
8894 +       void (SM_DECL *__DslFrameBufferSetLength) (dslFrameBuffer *fb, ulong l);
8895 +       void (SM_DECL *__DslFrameBufferSetAddress) (dslFrameBuffer *fb, void *p);
8896 +
8897 +       void (SM_DECL *__DslFrameInit) (dslFrame *f);
8898 +       ulong (SM_DECL *__DslFrameGetLength) (dslFrame *pFrame);
8899 +       ulong (SM_DECL *__DslFrameGetBufCnt) (dslFrame *pFrame);
8900 +       dslFrameBuffer * (SM_DECL *__DslFrameGetFirstBuffer) (dslFrame *pFrame);
8901 +       dslFrameBuffer * (SM_DECL *__DslFrameGetNextBuffer) (dslFrameBuffer *pFrBuffer);
8902 +       void  (SM_DECL *__DslFrameSetNextBuffer) (dslFrameBuffer *pFrBuf, dslFrameBuffer *pFrBufNext);
8903 +       dslFrameBuffer * (SM_DECL *__DslFrameGetLastBuffer) (dslFrame *pFrame);
8904 +       void * (SM_DECL *__DslFrameGetLinkFieldAddress) (dslFrame *f);
8905 +       dslFrame * (SM_DECL *__DslFrameGetFrameAddressFromLink) (void *lnk);
8906 +
8907 +       Boolean (SM_DECL *__DslFrameGetOobInfo) (dslFrame *f, dslOobFrameInfo   *pOobInfo);
8908 +       Boolean (SM_DECL *__DslFrameSetOobInfo) (dslFrame *f, dslOobFrameInfo   *pOobInfo);
8909 +
8910 +       void (SM_DECL *__DslFrameEnqueBufferAtBack) (dslFrame *f, dslFrameBuffer *b);
8911 +       void (SM_DECL *__DslFrameEnqueFrameAtBack) (dslFrame *fMain, dslFrame *f);
8912 +       void (SM_DECL *__DslFrameEnqueBufferAtFront) (dslFrame *f, dslFrameBuffer *b);
8913 +       void (SM_DECL *__DslFrameEnqueFrameAtFront) (dslFrame *fMain, dslFrame *f);
8914 +       dslFrameBuffer * (SM_DECL *__DslFrameDequeBuffer) (dslFrame *pFrame);
8915 +
8916 +       void * (SM_DECL *__DslFrameAllocMemForFrames) (ulong frameNum);
8917 +       void (SM_DECL *__DslFrameFreeMemForFrames) (void *hMem);
8918 +       dslFrame * (SM_DECL *__DslFrameAllocFrame) (void *handle);
8919 +       void (SM_DECL *__DslFrameFreeFrame) (void *handle, dslFrame *pFrame);
8920 +       void * (SM_DECL *__DslFrameAllocMemForBuffers) (void **ppMemPool, ulong bufNum, ulong memSize);
8921 +       void (SM_DECL *__DslFrameFreeMemForBuffers) (void *hMem, ulong memSize, void *pMemPool);
8922 +       dslFrameBuffer * (SM_DECL *__DslFrameAllocBuffer) (void *handle, void *pMem, ulong length);
8923 +       void (SM_DECL *__DslFrameFreeBuffer) (void *handle, dslFrameBuffer *pBuf);
8924 +
8925 +       /* for LOG file support */
8926 +
8927 +       ulong (SM_DECL *__DslFrame2Id)(void *handle, dslFrame *pFrame);
8928 +       void * (SM_DECL *__DslFrameId2Frame)(void *handle, ulong frameId);
8929 +       } dslFrameFunctions;
8930 +
8931 +#define         DslFrameDeclareFunctions( name_prefix )                                                                \
8932 +extern ulong SM_DECL name_prefix##BufferGetLength(dslFrameBuffer *fb);                 \
8933 +extern void * SM_DECL name_prefix##BufferGetAddress(dslFrameBuffer *fb);               \
8934 +extern void SM_DECL name_prefix##BufferSetLength(dslFrameBuffer *fb, ulong l); \
8935 +extern void SM_DECL name_prefix##BufferSetAddress(dslFrameBuffer *fb, void *p); \
8936 +                                                                                                                                                               \
8937 +extern void SM_DECL name_prefix##Init(dslFrame *f);                                                            \
8938 +extern ulong SM_DECL name_prefix##GetLength (dslFrame *pFrame);                                        \
8939 +extern ulong SM_DECL name_prefix##GetBufCnt(dslFrame *pFrame);                                 \
8940 +extern dslFrameBuffer * SM_DECL name_prefix##GetFirstBuffer(dslFrame *pFrame); \
8941 +extern dslFrameBuffer * SM_DECL name_prefix##GetNextBuffer(dslFrameBuffer *pFrBuffer); \
8942 +extern void SM_DECL name_prefix##SetNextBuffer(dslFrameBuffer *pFrBuf, dslFrameBuffer *pFrBufNext);    \
8943 +extern dslFrameBuffer * SM_DECL name_prefix##GetLastBuffer(dslFrame *pFrame);                  \
8944 +extern void * SM_DECL name_prefix##GetLinkFieldAddress(dslFrame *f);                                   \
8945 +extern Boolean SM_DECL name_prefix##GetOobInfo(dslFrame *f, dslOobFrameInfo *pOobInfo);        \
8946 +extern Boolean SM_DECL name_prefix##SetOobInfo(dslFrame *f, dslOobFrameInfo *pOobInfo);        \
8947 +extern dslFrame* SM_DECL name_prefix##GetFrameAddressFromLink(void *lnk);                              \
8948 +extern void SM_DECL name_prefix##EnqueBufferAtBack(dslFrame *f, dslFrameBuffer *b);            \
8949 +extern void SM_DECL name_prefix##EnqueFrameAtBack(dslFrame *fMain, dslFrame *f);               \
8950 +extern void SM_DECL name_prefix##EnqueBufferAtFront(dslFrame *f, dslFrameBuffer *b);   \
8951 +extern void SM_DECL name_prefix##EnqueFrameAtFront(dslFrame *fMain, dslFrame *f);              \
8952 +extern dslFrameBuffer * SM_DECL name_prefix##DequeBuffer(dslFrame *pFrame);                            \
8953 +                                                                                                                                                                               \
8954 +extern void * SM_DECL name_prefix##AllocMemForFrames(ulong frameNum);                                  \
8955 +extern void SM_DECL name_prefix##FreeMemForFrames(void *hMem);                                                 \
8956 +extern dslFrame * SM_DECL name_prefix##AllocFrame(void *handle);                                               \
8957 +extern void SM_DECL name_prefix##FreeFrame(void *handle, dslFrame *pFrame);                            \
8958 +extern void * SM_DECL name_prefix##AllocMemForBuffers(void **ppMemPool, ulong bufNum, ulong memSize);  \
8959 +extern void SM_DECL name_prefix##FreeMemForBuffers(void *hMem, ulong memSize, void *pMemPool);                 \
8960 +extern dslFrameBuffer * SM_DECL name_prefix##AllocBuffer(void *handle, void *pMem, ulong length);              \
8961 +extern void SM_DECL name_prefix##FreeBuffer(void *handle, dslFrameBuffer *pBuf);               \
8962 +extern ulong SM_DECL name_prefix##2Id(void *handle, dslFrame *pFrame);                                 \
8963 +extern void * SM_DECL name_prefix##Id2Frame(void *handle, ulong frameId);
8964 +
8965 +
8966 +#define         DslFrameAssignFunctions( var, name_prefix )    do {                    \
8967 +       (var).__DslFrameBufferGetLength = name_prefix##BufferGetLength;         \
8968 +       (var).__DslFrameBufferGetAddress= name_prefix##BufferGetAddress;        \
8969 +       (var).__DslFrameBufferSetLength = name_prefix##BufferSetLength;         \
8970 +       (var).__DslFrameBufferSetAddress= name_prefix##BufferSetAddress;        \
8971 +                                                                                                                                               \
8972 +       (var).__DslFrameInit                    = name_prefix##Init;                            \
8973 +       (var).__DslFrameGetLength               = name_prefix##GetLength;                       \
8974 +       (var).__DslFrameGetBufCnt               = name_prefix##GetBufCnt;                       \
8975 +       (var).__DslFrameGetFirstBuffer  = name_prefix##GetFirstBuffer;          \
8976 +       (var).__DslFrameGetNextBuffer   = name_prefix##GetNextBuffer;           \
8977 +       (var).__DslFrameSetNextBuffer   = name_prefix##SetNextBuffer;           \
8978 +       (var).__DslFrameGetLastBuffer   = name_prefix##GetLastBuffer;           \
8979 +       (var).__DslFrameGetLinkFieldAddress             = name_prefix##GetLinkFieldAddress;             \
8980 +       (var).__DslFrameGetFrameAddressFromLink = name_prefix##GetFrameAddressFromLink; \
8981 +                                                                                                                                               \
8982 +       (var).__DslFrameGetOobInfo              = name_prefix##GetOobInfo;                      \
8983 +       (var).__DslFrameSetOobInfo              = name_prefix##SetOobInfo;                      \
8984 +                                                                                                                                               \
8985 +       (var).__DslFrameEnqueBufferAtBack       = name_prefix##EnqueBufferAtBack;       \
8986 +       (var).__DslFrameEnqueFrameAtBack        = name_prefix##EnqueFrameAtBack;        \
8987 +       (var).__DslFrameEnqueBufferAtFront= name_prefix##EnqueBufferAtFront;    \
8988 +       (var).__DslFrameEnqueFrameAtFront       = name_prefix##EnqueFrameAtFront;       \
8989 +       (var).__DslFrameDequeBuffer             = name_prefix##DequeBuffer;                     \
8990 +                                                                                                                                               \
8991 +       (var).__DslFrameAllocMemForFrames       = name_prefix##AllocMemForFrames;       \
8992 +       (var).__DslFrameFreeMemForFrames        = name_prefix##FreeMemForFrames;        \
8993 +       (var).__DslFrameAllocFrame                      = name_prefix##AllocFrame;                      \
8994 +       (var).__DslFrameFreeFrame                       = name_prefix##FreeFrame;                       \
8995 +       (var).__DslFrameAllocMemForBuffers= name_prefix##AllocMemForBuffers;    \
8996 +       (var).__DslFrameFreeMemForBuffers = name_prefix##FreeMemForBuffers;     \
8997 +       (var).__DslFrameAllocBuffer             = name_prefix##AllocBuffer;                     \
8998 +       (var).__DslFrameFreeBuffer              = name_prefix##FreeBuffer;                      \
8999 +                                                                                                                                               \
9000 +       (var).__DslFrame2Id                             = name_prefix##2Id;                                     \
9001 +       (var).__DslFrameId2Frame                = name_prefix##Id2Frame;                        \
9002 +} while (0)
9003 +
9004 +typedef        struct
9005 +       {
9006 +       Boolean         febe_I;
9007 +       Boolean         fecc_I;
9008 +       Boolean         los, rdi;
9009 +       Boolean         ncd_I;
9010 +       Boolean         hec_I;
9011 +#ifdef G992P3 
9012 +       Boolean         lpr;
9013 +#endif
9014 +
9015 +#ifdef G992P1_NEWFRAME
9016 +
9017 +       Boolean         febe_F;
9018 +       Boolean         fecc_F;
9019 +       Boolean         ncd_F;
9020 +       Boolean         hec_F;
9021 +       
9022 +#endif
9023 +       } G992MonitorParams;
9024 +
9025 +typedef struct
9026 +       {
9027 +       ushort  K;
9028 +       uchar   S, R;
9029 +       uchar   D;
9030 +#ifdef G992P3 
9031 +       uchar   T, SEQ;
9032 +#endif
9033 +       directionType   direction;
9034 +
9035 +#ifdef         G992P1_NEWFRAME
9036 +
9037 +       ushort  N;
9038 +       ushort  NF;
9039 +       uchar   RSF;
9040 +
9041 +       uchar   AS0BF, AS1BF, AS2BF, AS3BF, AEXAF;
9042 +       ushort  AS0BI;
9043 +       uchar   AS1BI, AS2BI, AS3BI, AEXAI;
9044 +
9045 +       uchar   LS0CF, LS1BF, LS2BF, LEXLF;
9046 +       uchar   LS0CI, LS1BI, LS2BI, LEXLI;
9047 +       
9048 +       uchar   mergedModeEnabled;
9049 +       
9050 +#endif
9051 +
9052 +       } G992CodingParams;
9053 +
9054 +typedef struct
9055 +       {
9056 +       uchar   Nlp;
9057 +       uchar   Nbc;
9058 +       uchar   MSGlp;
9059 +       ushort  MSGc;
9060 +
9061 +       ulong   L;
9062 +       ushort  M;
9063 +       ushort  T;
9064 +       ushort  D;
9065 +       ushort  R;
9066 +       ushort  B;
9067 +       } G992p3CodingParams;
9068 +
9069 +/* Power Management Message definitions (used in command and status) */
9070 +
9071 +typedef struct
9072 +       {
9073 +       long                    msgType;
9074 +       union
9075 +               {
9076 +               long            value;
9077 +               struct
9078 +                       {
9079 +                       long    msgLen;
9080 +                       void    *msgData;
9081 +                       } msg;
9082 +               } param;
9083 +       } dslPwrMessage;
9084 +
9085 +/* Power Management commands and responses */
9086 +
9087 +#define        kPwrSimpleRequest                                                       1
9088 +#define        kPwrL2Request                                                           2
9089 +#define        kPwrL2TrimRequest                                                       3
9090 +
9091 +#define        kPwrGrant                                                                       0x80
9092 +#define        kPwrReject                                                                      0x81
9093 +#define        kPwrL2Grant                                                                     0x82
9094 +#define        kPwrL2Reject                                                            0x83
9095 +#define        kPwrL2TrimGrant                                                         0x84
9096 +#define        kPwrL2TrimReject                                                        0x85
9097 +#define        kPwrL2Grant2p                                                           0x86
9098 +
9099 +#define        kPwrBusy                                                                        0x01
9100 +#define        kPwrInvalid                                                                     0x02
9101 +#define        kPwrNotDesired                                                          0x03
9102 +#define        kPwrInfeasibleParam                                                     0x04
9103 +
9104 +/* Power Management reason codes */
9105 +
9106 +/* OLR definitions (used in command and status) */
9107 +
9108 +typedef struct
9109 +       {
9110 +       ushort  msgType;
9111 +       ushort  nCarrs;
9112 +       ushort  L[4];
9113 +       uchar   B[4];
9114 +       void    *carrParamPtr;
9115 +       } dslOLRMessage;
9116 +
9117 +typedef struct
9118 +       {
9119 +       uchar   ind;
9120 +       uchar   gain;
9121 +       uchar   gb;
9122 +       } dslOLRCarrParam;
9123 +
9124 +typedef struct
9125 +       {
9126 +       ushort  ind;
9127 +       uchar   gain;
9128 +       uchar   gb;
9129 +       } dslOLRCarrParam2p;
9130 +
9131 +/* OLR messages */
9132 +
9133 +#define        kOLRRequestType1                                                        1
9134 +#define        kOLRRequestType2                                                        2
9135 +#define        kOLRRequestType3                                                        3
9136 +#define        kOLRRequestType4                                                        4
9137 +#define        kOLRRequestType5                                                        5
9138 +#define        kOLRRequestType6                                                        6
9139 +
9140 +#define        kOLRDeferType1                                                          0x81
9141 +#define        kOLRRejectType2                                                         0x82
9142 +#define        kOLRRejectType3                                                         0x83
9143 +
9144 +/* OLR reason codes */
9145 +
9146 +#define        kOLRBusy                                                                        1
9147 +#define        kOLRInvalidParam                                                        2
9148 +#define        kOLRNotEnabled                                                          3
9149 +#define        kOLRNotSupported                                                        4
9150 +
9151 +/* common EOC definitions  */
9152 +#define        kG992EocStuffingByte                                            0x0C
9153 +
9154 +/* showtime monitor counters */
9155 +#define        kG992ShowtimeRSCodewordsRcved                           0       /* number of Reed-Solomon codewords received */
9156 +#define kG992ShowtimeRSCodewordsRcvedOK                                1       /* number of Reed-Solomon codewords received with all symdromes zero */
9157 +#define        kG992ShowtimeRSCodewordsRcvedCorrectable        2       /* number of Reed-Solomon codewords received with correctable errors */
9158 +#define        kG992ShowtimeRSCodewordsRcvedUncorrectable      3       /* number of Reed-Solomon codewords received with un-correctable errors */
9159 +#define        kG992ShowtimeSuperFramesRcvd                            4       /* number of super frames received */
9160 +#define        kG992ShowtimeSuperFramesRcvdWrong                       5       /* number of super frames received with CRC error */
9161 +#define        kG992ShowtimeLastUncorrectableRSCount           6       /* last recorded value for kG992ShowtimeRSCodewordsRcvedUncorrectable */
9162 +#define        kG992ShowtimeLastWrongSuperFrameCount           7       /* last recorded value for kG992ShowtimeSuperFramesRcvdWrong */
9163 +#define        kG992ShowtimeNumOfShortResync                           8       /* number of short interrupt recoveries by FEQ */
9164 +
9165 +#define        kG992ShowtimeNumOfFEBE                                          9       /* number of other side superframe errors */
9166 +#define        kG992ShowtimeNumOfFECC                                          10      /* number of other side superframe FEC errors */
9167 +#define        kG992ShowtimeNumOfFHEC                                          11      /* number of far-end ATM header CRC errors */
9168 +#define        kG992ShowtimeNumOfFOCD                                          12      /* number of far-end OCD events */
9169 +#define        kG992ShowtimeNumOfFLCD                                          13      /* number of far-end LCD events */
9170 +#define        kG992ShowtimeNumOfHEC                                           14      /* number of ATM header CRC errors */
9171 +#define        kG992ShowtimeNumOfOCD                                           15      /* number of OCD events */
9172 +#define        kG992ShowtimeNumOfLCD                                           16      /* number of LCD events */
9173 +
9174 +#define        kG992ShowtimeNumOfMonitorCounters                       (kG992ShowtimeNumOfLCD+1)       /* always last number + 1 */
9175 +#define        kG992ShowtimeMonitorReportNumber                        9
9176 +
9177 +#define        kG992ShowtimeLCDNumShift                                        1
9178 +#define        kG992ShowtimeLCDFlag                                            1
9179 +
9180 +typedef        int             (SM_DECL *dslFrameHandlerType)  (void *gDslVars, void *pVc, ulong mid, dslFrame *);
9181 +
9182 +typedef        void*   (SM_DECL *dslHeaderHandlerType) (void *gDslVars, ulong hdr, uchar hdrHec);
9183 +typedef        void*   (SM_DECL *dslTxFrameBufferHandlerType)  (void *gDslVars, int*,  void*);
9184 +typedef        void*   (SM_DECL *dslRxFrameBufferHandlerType)  (void *gDslVars, int,   void*);
9185 +
9186 +typedef        void*   (SM_DECL *dslVcAllocateHandlerType)     (void *gDslVars, void *);
9187 +typedef        void    (SM_DECL *dslVcFreeHandlerType) (void *gDslVars, void *);
9188 +typedef        Boolean (SM_DECL *dslVcActivateHandlerType)     (void *gDslVars, void *);
9189 +typedef        void    (SM_DECL *dslVcDeactivateHandlerType) (void *gDslVars, void *);
9190 +typedef        Boolean (SM_DECL *dslVcConfigureHandlerType) (void *gDslVars, void *pVc, ulong mid, void *);
9191 +
9192 +typedef        ulong   (SM_DECL *dslLinkVc2IdHandlerType) (void *gDslVars, void *);
9193 +typedef        void*   (SM_DECL *dslLinkVcId2VcHandlerType) (void *gDslVars, ulong);
9194 +typedef void*  (SM_DECL *dslGetFramePoolHandlerType) (void *gDslVars);
9195 +
9196 +typedef        void    (SM_DECL *dslLinkCloseHandlerType) (void *gDslVars);
9197 +typedef        int             (SM_DECL *dslTxDataHandlerType)(void *gDslVars, int, int, uchar*, G992MonitorParams*);
9198 +typedef        int             (SM_DECL *dslRxDataHandlerType)(void *gDslVars, int, uchar*, G992MonitorParams*);
9199 +
9200 +typedef        void    (SM_DECL *dslLinkStatusHandler) (void *gDslVars, ulong statusCode, ...);
9201 +
9202 +typedef Boolean (SM_DECL *dslPhyInitType) (
9203 +       void                                            *gDslVars, 
9204 +       bitMap                                          setupMap,
9205 +       dslHeaderHandlerType            rxCellHeaderHandlerPtr,
9206 +       dslRxFrameBufferHandlerType     rxFrameHandlerPtr,  
9207 +       dslTxFrameBufferHandlerType txFrameHandlerPtr,
9208 +       atmStatusHandler                        statusHandlerPtr);
9209 +
9210 +struct _dslFramerBufDesc;
9211 +
9212 +typedef        Boolean (SM_DECL *dslFramerDataGetPtrHandlerType) (void *gDslVars, struct _dslFramerBufDesc *pBufDesc);
9213 +typedef        void    (SM_DECL *dslFramerDataDoneHandlerType) (void *gDslVars, struct _dslFramerBufDesc *pBufDesc);
9214 +
9215 +typedef        void    (SM_DECL *dslDriverCallbackType) (void *gDslVars);
9216 +
9217 +#ifdef DSL_PACKET
9218 +
9219 +typedef        struct 
9220 +       {
9221 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
9222 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
9223 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
9224 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
9225 +       } dslPacketPhyFunctions;
9226 +
9227 +typedef Boolean (SM_DECL *dslPacketPhyInitType) (
9228 +       void                                            *gDslVars, 
9229 +       bitMap                                          setupMap,
9230 +       dslPacketPhyFunctions           dslPhyFunctions,
9231 +       dslLinkStatusHandler            statusHandlerPtr);
9232 +
9233 +
9234 +#endif /* DSL_PACKET */
9235 +
9236 +
9237 +typedef        int                     dslDirectionType;
9238 +typedef        bitMap          dslModulationType;
9239 +typedef        bitMap          dslLinkLayerType;
9240 +
9241 +/*
9242 +**
9243 +**             Log data codes 
9244 +**
9245 +*/
9246 +
9247 +#define        kDslEyeData                                     eyeData
9248 +
9249 +#define        kDslLogComplete                         (inputSignalData - 1)
9250 +#define        kDslLogInputData                        inputSignalData
9251 +#define        kDslLogInputData1                       (inputSignalData + 1)
9252 +#define        kDslLogInputData2                       (inputSignalData + 2)
9253 +#define        kDslLogInputData3                       (inputSignalData + 3)
9254 +
9255 +/*
9256 +**
9257 +**             Status codes 
9258 +**
9259 +*/
9260 +
9261 +typedef long                                           dslStatusCode;
9262 +#define        kFirstDslStatusCode                     256
9263 +#define        kDslError                                       (kFirstDslStatusCode + 0)
9264 +#define        kAtmStatus                                      (kFirstDslStatusCode + 1)
9265 +#define        kDslTrainingStatus                      (kFirstDslStatusCode + 2)
9266 +#define        kDslConnectInfoStatus           (kFirstDslStatusCode + 3)
9267 +#define        kDslEscapeToG994p1Status        (kFirstDslStatusCode + 4)
9268 +#define        kDslFrameStatus                         (kFirstDslStatusCode + 5)
9269 +#define kDslReceivedEocCommand         (kFirstDslStatusCode + 6)
9270 +#define kDslSendEocCommandDone         (kFirstDslStatusCode + 7)
9271 +#define kDslSendEocCommandFailed       (kFirstDslStatusCode + 8)
9272 +#define kDslWriteRemoteRegisterDone    (kFirstDslStatusCode + 9)
9273 +#define kDslReadRemoteRegisterDone     (kFirstDslStatusCode + 10)
9274 +#define        kDslExternalError                       (kFirstDslStatusCode + 11)
9275 +#define kDslDspControlStatus           (kFirstDslStatusCode + 12)
9276 +#define kDslATUHardwareAGCRequest      (kFirstDslStatusCode + 13)
9277 +#define        kDslPacketStatus                        (kFirstDslStatusCode + 14)
9278 +#define        kDslG997Status                          (kFirstDslStatusCode + 15)
9279 +#define        kDslPrintfStatus                        (kFirstDslStatusCode + 16)
9280 +#define        kDslPrintfStatus1                       (kFirstDslStatusCode + 17)
9281 +#define        kDslExceptionStatus                     (kFirstDslStatusCode + 18)
9282 +#define        kDslPingResponse                        (kFirstDslStatusCode + 19)
9283 +#define        kDslShowtimeSNRMarginInfo       (kFirstDslStatusCode + 20)
9284 +#define        kDslGetOemParameter                     (kFirstDslStatusCode + 21)
9285 +#define        kDslOemDataAddrStatus           (kFirstDslStatusCode + 22)
9286 +#define        kDslDataAvailStatus                     (kFirstDslStatusCode + 23)
9287 +/* #define kDslAtuChangeTxFilterRequest (kFirstDslStatusCode + 24) */
9288 +#define kDslTestPllPhaseResult      (kFirstDslStatusCode + 25)
9289 +#ifdef BCM6348_SRC
9290 +#define kDslHardwareAGCSetPga1      (kFirstDslStatusCode + 26)
9291 +#define kDslHardwareAGCDecPga1      (kFirstDslStatusCode + 27)
9292 +#define kDslHardwareAGCIncPga1      (kFirstDslStatusCode + 28)
9293 +#define kDslHardwareAGCSetPga2Delta (kFirstDslStatusCode + 29)
9294 +#endif
9295 +#define        kDslOLRRequestStatus            (kFirstDslStatusCode + 30)
9296 +#define        kDslOLRResponseStatus           (kFirstDslStatusCode + 31)
9297 +#define        kDslOLRBitGainUpdateStatus      (kFirstDslStatusCode + 32)
9298 +#define        kDslPwrMgrStatus                    (kFirstDslStatusCode + 33)
9299 +#define        kDslEscapeToT1p413Status        (kFirstDslStatusCode + 34)
9300 +#ifdef BCM6348_SRC
9301 +#define kDslHardwareAGCSetPga2      (kFirstDslStatusCode + 35)
9302 +#define kDslHardwareGetRcvAGC       (kFirstDslStatusCode + 36)
9303 +#endif
9304 +#define kDslUpdateXmtReadPtr        (kFirstDslStatusCode + 37)
9305 +#define kDslHardwareSetRcvAGC       (kFirstDslStatusCode + 38)
9306 +#ifdef BCM6348_SRC
9307 +#define kDslSetDigUsPwrCutback      (kFirstDslStatusCode + 39)
9308 +#endif
9309 +
9310 +#define        kClientSideInitiation           0
9311 +#define        kClientSideRespond                      1
9312 +#define        kCentralSideInitiation          2
9313 +#define        kCentralSideRespond                     3
9314 +
9315 +/* OEM parameter ID definition */
9316 +
9317 +#define        kDslOemG994VendorId                     1
9318 +#define        kDslOemG994XmtNSInfo            2
9319 +#define        kDslOemG994RcvNSInfo            3
9320 +#define        kDslOemEocVendorId                      4
9321 +#define        kDslOemEocVersion                       5
9322 +#define        kDslOemEocSerNum                        6
9323 +#define        kDslOemT1413VendorId            7
9324 +#define        kDslOemT1413EocVendorId         8
9325 +
9326 +typedef long   dslErrorCode;
9327 +
9328 +typedef long   atmStatusCode;
9329 +typedef long   dslFramerStatusCode;
9330 +
9331 +typedef long   atmErrorCode;
9332 +
9333 +typedef long   dslTrainingStatusCode;
9334 +
9335 +#define kDslStartedG994p1                                      0
9336 +#define kDslStartedT1p413HS                                    1
9337 +
9338 +/* reserved for G.994.1: 1 ~ 8 */
9339 +
9340 +#define        kDslG994p1MessageDet                            100
9341 +#define        kDslG994p1ToneDet                                       101
9342 +#define        kDslG994p1RToneDet                                      102
9343 +#define        kDslG994p1FlagDet                                       103
9344 +#define        kDslG994p1GalfDet                                       104
9345 +#define        kDslG994p1ErrorFrameDet                         105
9346 +#define        kDslG994p1BadFrameDet                           106
9347 +#define        kDslG994p1SilenceDet                            107
9348 +#define        kDslG994p1RcvTimeout                            108
9349 +#define        kDslG994p1XmtFinished                           109
9350 +#define        kDslG994p1ReturntoStartup                       110
9351 +#define        kDslG994p1InitiateCleardown                     111
9352 +#define        kDslG994p1StartupFinished                       112
9353 +#define        kDslG994p1RcvNonStandardInfo            113
9354 +#define        kDslG994p1XmtNonStandardInfo            114
9355 +
9356 +#define        kG994p1MaxNonstdMessageLength           64
9357 +
9358 +#define kDslFinishedT1p413                                     1100
9359 +#define kDslT1p413DetectedCTone                                1101
9360 +#define kDslT1p413DetectedCAct                         1102
9361 +#define kDslT1p413DetectedCReveille                    1103
9362 +#define kDslT1p413DetectedRActReq                      1104
9363 +#define kDslT1p413DetectedRQuiet1                      1105
9364 +#define kDslT1p413DetectedRAct                         1106
9365 +#define kDslT1p413TimeoutCReveille                     1107
9366 +#define        kDslT1p413ReturntoStartup                       1108
9367 +
9368 +#define        kDslG994p1Timeout                                       8
9369 +#define kDslFinishedG994p1                                     9
9370 +#define kDslStartedG992p2Training                      10
9371 +#define        kDslG992p2DetectedPilotSymbol           11
9372 +#define        kDslG992p2DetectedReverbSymbol          12
9373 +#define        kDslG992p2TEQCalculationDone            13
9374 +#define        kDslG992p2TrainingFEQ                           14
9375 +#define        kDslG992p2Phase3Started                         15
9376 +#define        kDslG992p2ReceivedRates1                        16
9377 +#define        kDslG992p2ReceivedMsg1                          17
9378 +#define        kDslG992p2Phase4Started                         18
9379 +#define        kDslG992p2ReceivedRatesRA                       19
9380 +#define        kDslG992p2ReceivedMsgRA                         20
9381 +#define        kDslG992p2ReceivedRates2                        21
9382 +#define        kDslG992p2ReceivedMsg2                          22
9383 +#define        kDslG992p2ReceivedBitGainTable          23
9384 +#define        kDslG992p2TxShowtimeActive                      24
9385 +#define        kDslG992p2RxShowtimeActive                      25
9386 +#define        kDslG992p2TxAocMessage                          26
9387 +#define        kDslG992p2RxAocMessage                          27
9388 +#define        kDslG992p2TxEocMessage                          28
9389 +#define        kDslG992p2RxEocMessage                          29
9390 +#define kDslFinishedG992p2Training                     30
9391 +#define        kDslRecoveredFromImpulseNoise           31
9392 +#define        kDslG992Timeout                                         32
9393 +#define        kDslT1p413Isu1SglByteSymDetected        33      /* detected T1.413 Issue 1 single byte per symbol mode */
9394 +#define        kDslG992RxPrefixOnInAFewSymbols         34
9395 +#define        kDslG992TxPrefixOnInAFewSymbols         35
9396 +#define        kDslAnnexCXmtCPilot1Starting            36
9397 +#define        kDslXmtToRcvPathDelay                           37
9398 +#define kDslFeaturesUnsupported                                38
9399 +#define        kDslG992RcvMsgCrcError                          39
9400 +#define        kDslAnnexCDetectedStartHyperframe       40
9401 +
9402 +#define kDslG992AnnexCTimeoutCPilot1Detection  41
9403 +#define kDslG992AnnexCTimeoutCReverb1Detection 42
9404 +#define kDslG992AnnexCTimeoutECTraining                        43
9405 +#define kDslG992AnnexCTimeoutHyperframeDetector        44
9406 +#define kDslG992AnnexCTimeoutSendRSegue2               45
9407 +#define kDslG992AnnexCTimeoutDetectCSegue1             46
9408 +#define kDslG992AnnexCAlignmentErrDetected             47
9409 +#define kDslG992AnnexCTimeoutSendRSegueRA              48
9410 +#define kDslG992AnnexCTimeoutSendRSegue4               49
9411 +#define kDslG992AnnexCTimeoutCSegue2Detection  50
9412 +#define kDslG992AnnexCTimeoutCSegue3Detection  51
9413 +/* Progress report for fast retrain */
9414 +
9415 +#define        kG994p1EventToneDetected                                54
9416 +#define        kDslG992p2RcvVerifiedBitAndGain         55
9417 +#define        kDslG992p2ProfileChannelResponseCalc    56
9418 +#define kDslG992AnnexCTotalFEXTBits                            57
9419 +#define kDslG992AnnexCTotalNEXTBits                            58
9420 +#define kDslG992AnnexCTotalFEXTCarrs                   59
9421 +#define kDslG992AnnexCTotalNEXTCarrs                   60
9422 +
9423 +#define        kDslG992p3ReceivedMsgFmt                                61
9424 +#define        kDslG992p3ReceivedMsgPcb                                62
9425 +
9426 +#define        kDslG992p3AnnexLMode                                    63
9427 +
9428 +/* performance monitoring report */
9429 +
9430 +#define        kG992DataRcvDetectFastRSCorrection                              70
9431 +#define        kG992DataRcvDetectInterleaveRSCorrection                71
9432 +#define        kG992DataRcvDetectFastCRCError                                  72
9433 +#define        kG992DataRcvDetectInterleaveCRCError                    73
9434 +#define        kG992DataRcvDetectFastRSError                                   74
9435 +#define        kG992DataRcvDetectInterleaveRSError                             75
9436 +#define        kG992DataRcvDetectLOS                                                   76
9437 +#define        kG992DecoderDetectRDI                                                   77
9438 +#define        kG992DataRcvDetectLOSRecovery                                   78
9439 +#define        kG992AtmDetectHEC                                                               79
9440 +#define        kG992AtmDetectOCD                                                               180
9441 +#define        kG992AtmDetectCD                                                                181
9442 +#define        kG992DecoderDetectRemoteLOS                                             182
9443 +#define        kG992DecoderDetectRemoteLOSRecovery                             183
9444 +#define        kG992DecoderDetectRemoteRDI                                             184
9445 +#define        kG992DecoderDetectRemoteRDIRecovery                             185
9446 +#define        kG992RcvDetectSyncSymbolOffset                                  186
9447 +#define        kG992Upstream2xIfftDisabled                                             187
9448 +#if defined(G992P5)
9449 +#define        kDslG992RunAnnexaP3ModeInAnnexaP5                       188      /* run Annex C mode in Annex I compiled codes */
9450 +#else
9451 +#define        kDslG992RunAnnexCModeInAnnexI                           188      /* run Annex C mode in Annex I compiled codes */
9452 +#endif
9453 +
9454 +/* OLR PHY status */
9455 +
9456 +#define        kG992EventSynchSymbolDetected                                   189
9457 +#define        kG992EventReverseSynchSymbolDetected                    190
9458 +#define        kG992EventL2CReverbSymbolDetected                               191
9459 +#define        kG992EventL2CSegueSymbolDetected                                192
9460 +
9461 +/* ANNEX_M */
9462 +#define kG992EnableAnnexM                               191
9463 +
9464 +#define kDslAtuChangeTxFilterRequest                                   192
9465 +
9466 +/* detailed error messages reports */
9467 +
9468 +#define        kDslG992XmtRReverbRAOver4000                    80
9469 +#define        kDslG992XmtRReverb5Over4000                             81
9470 +#define        kDslG992RcvCSegue2Failed                                82
9471 +#define        kDslG992RcvCSegueRAFailed                               83
9472 +#define        kDslG992RcvCSegue3Failed                                84
9473 +#define        kDslG992RcvShowtimeStartedTooLate               85
9474 +#define        kDslG992XmtRReverb3Over4000                             86
9475 +#define        kDslG992RcvFailDetCSegue1InWindow               87
9476 +#define        kDslG992RcvCPilot1Failed                                88
9477 +#define        kDslG992RcvCReverb1Failed                               89
9478 +#define        kG992ControlAllRateOptionsFailedErr             90
9479 +#define        kG992ControlInvalidRateOptionErr                91
9480 +#define        kDslG992XmtInvalidXmtDErr                               92
9481 +#define        kDslG992BitAndGainCalcFailed                    93
9482 +#define        kDslG992BitAndGainVerifyFailed                  94
9483 +
9484 +#define        kDslT1p413RetrainToUseCorrectRAck               95
9485 +#define        kDslUseAlternateTxFilter                                96
9486 +#define        kDslT1p413RetrainToUseCorrectIFFT               97
9487 +
9488 +typedef        long    dslConnectInfoStatusCode;
9489 +#define        kG992p2XmtToneOrderingInfo                      0
9490 +#define        kG992p2RcvToneOrderingInfo                      1
9491 +#define        kG992p2XmtCodingParamsInfo                      2
9492 +#define        kG992p2RcvCodingParamsInfo                      3
9493 +#define        kG992p2TrainingRcvCarrEdgeInfo          4
9494 +#define        kG992ShowtimeMonitoringStatus           5
9495 +#define        kG992MessageExchangeRcvInfo                     6
9496 +#define        kG992MessageExchangeXmtInfo                     7
9497 +#define        kG994MessageExchangeRcvInfo                     8
9498 +#define        kG994MessageExchangeXmtInfo                     9
9499 +
9500 +#define        kDslATURClockErrorInfo                          10
9501 +#define        kDslATURcvPowerInfo                                     11
9502 +#define        kDslATUAvgLoopAttenuationInfo           12
9503 +#define        kDslHWTimeTrackingResetClockError       13
9504 +#define        kDslHWTimeTrackingClockTweak            14
9505 +#define kDslATUHardwareAGCObtained                     15
9506 +#define        kDslTEQCoefInfo                                         16
9507 +#define        kDslRcvCarrierSNRInfo                           17
9508 +#define        kDslMaxReceivableBitRateInfo            18
9509 +#define kDslHWSetDigitalEcUpdateMode           19
9510 +#define kDslHWEnableDigitalECUpdate                    20
9511 +#define kDslHWDisableDigitalECUpdate           21
9512 +#define kDslHWEnableDigitalEC                          22
9513 +#define kDslHWSetDigitalEcGainShift                    23
9514 +#define kDslHWSetDigitalEcUpdateShift          24
9515 +#define        kDslRcvPsdInfo                                          25
9516 +#define        kDslHWdcOffsetInfo                                      26
9517 +#define        kG994SelectedG994p1CarrierIndex         27
9518 +#define        kDslSelectedTimingTone                          28
9519 +
9520 +#define        kDslHWEnableAnalogECUpdate                      kDslHWSetDigitalEcUpdateMode    
9521 +#define        kDslHWEnableAnalogEC                            kDslHWDisableDigitalECUpdate
9522 +
9523 +#define        kG992AocMessageExchangeRcvInfo          29
9524 +#define        kG992AocMessageExchangeXmtInfo          30
9525 +#define        kG992AocBitswapTxStarted                        31
9526 +#define        kG992AocBitswapRxStarted                        32
9527 +#define        kG992AocBitswapTxCompleted                      33
9528 +#define        kG992AocBitswapRxCompleted                      34
9529 +#define kDslChannelResponseLog                         35
9530 +#define kDslChannelResponseLinear                      36
9531 +#define kDslChannelQuietLineNoise                      37
9532 +
9533 +#define        kDslATUCXmtPowerCutbackInfo                     40
9534 +#define        kDslATURXmtPowerCutbackInfo                     41
9535 +#define        kDslATUCXmtPowerInfo                            42
9536 +#define        kDslATURXmtPowerInfo                            43
9537 +
9538 +#define        kDslFramingModeInfo                                     50
9539 +#define        kDslG992VendorID                                        51
9540 +
9541 +#ifdef BCM6348_SRC
9542 +#define kDslHWSetRcvFir2OutputScale                    52
9543 +#endif
9544 +
9545 +#define kDslSignalAttenuation               53
9546 +#define kDslAttainableNetDataRate           54
9547 +#define kDslHLinScale                       55
9548 +
9549 +#define        kG992p3XmtCodingParamsInfo                      60
9550 +#define        kG992p3RcvCodingParamsInfo                      61
9551 +#define        kG992p3PwrStateInfo                                     62
9552 +#define        kG992PilotToneInfo                                      63
9553 +
9554 +#define kDslSetPilotEyeDisplay              64
9555 +
9556 +#define kDslAturHwAgcResolutionMask                    (0xFFFFFFF8)
9557 +#define kDslAturHwAgcMinGain                           ((-12)<<4)
9558 +#ifndef BCM6348_SRC
9559 +#define kDslAturHwAgcMaxGain                           (30<<4)
9560 +#else
9561 +#define kDslAturHwAgcMaxGain                           (36<<4)
9562 +#endif
9563 +
9564 +#define        kDslFrameStatusSend                                     1
9565 +#define        kDslFrameStatusSendComplete                     2
9566 +#define        kDslFrameStatusRcv                                      3
9567 +#define        kDslFrameStatusReturn                           4
9568 +
9569 +typedef struct _dslFramerStatus
9570 +       {
9571 +       dslFramerStatusCode             code;
9572 +       union
9573 +               {
9574 +               long                            value;
9575 +               dslErrorCode            error;
9576 +               struct
9577 +                       {
9578 +                       long    length;
9579 +                       uchar   *framePtr;
9580 +                       } frame;
9581 +               struct
9582 +                       {
9583 +                       long    nRxFrameTotal;
9584 +                       long    nRxFrameError;
9585 +                       long    nTxFrameTotal;
9586 +                       } statistic;
9587 +               } param;
9588 +       } dslFramerStatus;
9589 +
9590 +typedef        struct
9591 +       {
9592 +       dslStatusCode                                   code;
9593 +       union
9594 +               {
9595 +               long                                            value;
9596 +               dslErrorCode                            error;
9597 +               struct
9598 +                       {
9599 +                       atmStatusCode                   code;
9600 +                       union
9601 +                               {
9602 +                               long                            value;
9603 +                               dslErrorCode            error;
9604 +                               struct
9605 +                                       {
9606 +                                       long    vci;
9607 +                                       long    mid;
9608 +                                       long    aalType;
9609 +                                       long    length;
9610 +                                       uchar   *framePtr;
9611 +                                       } frame;
9612 +                               struct
9613 +                                       {
9614 +                                       long    nFrames;
9615 +                                       long    nFrameErrors;
9616 +                                       } statistic;
9617 +                               struct
9618 +                                       {
9619 +                                       long    vcId;
9620 +                                       long    vci;
9621 +                                       long    aalType;
9622 +                                       ulong   fwdPeakCellTime;
9623 +                                       ulong   backPeakCellTime;
9624 +                                       } vcInfo;
9625 +                               struct
9626 +                                       {
9627 +                                       long    cellHdr;
9628 +                                       long    oamCmd;
9629 +                                       } oamInfo;
9630 +                               struct 
9631 +                                       {
9632 +                                       void    *pVc;
9633 +                                       char    *pHdr;
9634 +                                       void    *cellHdr;
9635 +                                       void    *cellData;
9636 +                                       } cellInfo;
9637 +                               struct 
9638 +                                       {
9639 +                                       long    totalBits;
9640 +                                       long    errBits;
9641 +                                       } bertInfo;
9642 +                               } param;                        
9643 +                       } atmStatus;
9644 +#ifdef DSL_PACKET
9645 +               dslFramerStatus         dslPacketStatus;
9646 +#endif
9647 +#ifdef G997_1_FRAMER
9648 +               dslFramerStatus         g997Status;
9649 +#endif
9650 +               struct
9651 +                       {
9652 +                       dslTrainingStatusCode           code;
9653 +                       long                                            value;
9654 +                       } dslTrainingInfo;
9655 +               struct
9656 +                       {
9657 +                       dslConnectInfoStatusCode        code;
9658 +                       long                                            value;
9659 +                       void                                            *buffPtr;
9660 +                       } dslConnectInfo;
9661 +               struct
9662 +                       {
9663 +                       long                                            maxMarginCarrier;
9664 +                       long                                            maxSNRMargin;
9665 +                       long                                            minMarginCarrier;
9666 +                       long                                            minSNRMargin;
9667 +                       long                                            avgSNRMargin;
9668 +                       long                                            nCarriers;
9669 +                       void                                            *buffPtr;
9670 +                       } dslShowtimeSNRMarginInfo;
9671 +               struct 
9672 +                       {
9673 +                       long                                            code;
9674 +                       long                                            vcId;
9675 +                       long                                            timeStamp;
9676 +                       } dslFrameInfo;
9677 +#ifdef G997_1
9678 +               struct
9679 +                       {
9680 +                       long    msgId;
9681 +                       long    msgType;
9682 +                       char    *dataPtr;
9683 +                       } dslClearEocMsg;
9684 +#endif
9685 +               struct
9686 +                       {
9687 +                       char    *fmt;
9688 +                       long    argNum;
9689 +                       void    *argPtr;
9690 +                       } dslPrintfMsg;
9691 +               struct
9692 +                       {
9693 +                       ulong   nBits;
9694 +                       ulong   nBlocks;
9695 +                       ulong   nBitErrors;
9696 +                       ulong   nBlockErrors;
9697 +
9698 +                       ulong   nAudioBits;
9699 +                       ulong   nAudioBlocks;
9700 +                       ulong   nAudioSyncErrors;
9701 +                       ulong   nAudioBlockErrors;
9702 +                       } testResults;
9703 +               struct
9704 +                       {
9705 +                       ulong   code;
9706 +                       uchar   *valuePtr;
9707 +                       ulong   length;
9708 +                       } dslDataRegister;
9709 +               struct
9710 +                       {
9711 +                       ulong   code;
9712 +                       char    *desc;
9713 +                       } dslExternalError;
9714 +               struct
9715 +                       {
9716 +                       ulong   numberOfCalls;
9717 +                       ulong   txSignalChecksum;
9718 +                       ulong   rxSignalChecksum;
9719 +                       ulong   eyeDataChecksum;
9720 +                       } checksums;
9721 +               struct
9722 +                       {
9723 +                       int             sp;
9724 +                       int             argc;
9725 +                       int             *argv;
9726 +                       int             *stackPtr;
9727 +                       int             stackLen;
9728 +                       } dslException;
9729 +               struct
9730 +                       {
9731 +                       ulong   paramId;
9732 +                       void    *dataPtr;
9733 +                       ulong   dataLen;
9734 +                       } dslOemParameter;
9735 +               struct
9736 +                       {
9737 +                       void    *dataPtr;
9738 +                       ulong   dataLen;
9739 +                       } dslDataAvail;
9740 +               dslOLRMessage           dslOLRRequest;
9741 +               dslPwrMessage           dslPwrMsg;
9742 +               } param;
9743 +       } dslStatusStruct;
9744 +       
9745 +typedef        void    (SM_DECL *dslStatusHandlerType)         (void *gDslVars, dslStatusStruct*);
9746 +
9747 +
9748 +/*
9749 +**
9750 +**             Command codes 
9751 +**
9752 +*/
9753 +
9754 +typedef long                                           dslCommandCode;
9755 +#define        kFirstDslCommandCode            256
9756 +#define kDslIdleCmd                                    (kFirstDslCommandCode + 0)
9757 +#define kDslIdleRcvCmd                         (kFirstDslCommandCode + 1)
9758 +#define kDslIdleXmtCmd                         (kFirstDslCommandCode + 2)
9759 +#define        kDslStartPhysicalLayerCmd       (kFirstDslCommandCode + 3)
9760 +#define        kDslStartRetrainCmd                     (kFirstDslCommandCode + 4)
9761 +#define        kDslSetFrameFunctions           (kFirstDslCommandCode + 5)
9762 +#define kDslSendEocCommand                     (kFirstDslCommandCode + 6)
9763 +#define kDslWriteRemoteRegister                (kFirstDslCommandCode + 7)
9764 +#define kDslReadRemoteRegister         (kFirstDslCommandCode + 8)
9765 +#define kDslWriteLocalRegister         (kFirstDslCommandCode + 9)
9766 +#define kDslReadLocalRegister          (kFirstDslCommandCode + 10)
9767 +#define        kDslStoreHardwareAGCCmd         (kFirstDslCommandCode + 11)
9768 +#define kDslSetCommandHandlerCmd       (kFirstDslCommandCode + 12)
9769 +#define kSetLinkLayerStatusHandlerCmd (kFirstDslCommandCode + 13)
9770 +#define kDslSetG997Cmd                         (kFirstDslCommandCode + 14)
9771 +#define kDslLoopbackCmd                                (kFirstDslCommandCode + 15)
9772 +#define kDslDiagSetupCmd                       (kFirstDslCommandCode + 16)
9773 +#define kDslSetDriverCallbackCmd       (kFirstDslCommandCode + 17)
9774 +#define kDslDiagStopLogCmd                     (kFirstDslCommandCode + 18)
9775 +#define kDslDiagStartBERT                      (kFirstDslCommandCode + 19)
9776 +#define kDslDiagStopBERT                       (kFirstDslCommandCode + 20)
9777 +#define kDslPingCmd                                    (kFirstDslCommandCode + 21)
9778 +#define kDslDyingGaspCmd                       (kFirstDslCommandCode + 22)
9779 +#define kDslTestCmd                                    (kFirstDslCommandCode + 23)
9780 +#define kDslFilterSNRMarginCmd         (kFirstDslCommandCode + 24)
9781 +#define kDslAtmVcMapTableChanged       (kFirstDslCommandCode + 25)
9782 +#define        kDslGetOemDataAddrCmd           (kFirstDslCommandCode + 26)
9783 +#define kDslAtmReportHEC                       (kFirstDslCommandCode + 27)
9784 +#define kDslAtmReportCD                                (kFirstDslCommandCode + 28)
9785 +#define kDslSetXmtGainCmd                      (kFirstDslCommandCode + 29)
9786 +#define kDslSetStatusBufferCmd         (kFirstDslCommandCode + 30)
9787 +#define kDslAfeTestCmd                         (kFirstDslCommandCode + 31)
9788 +#define kDslI432ResetCmd                       (kFirstDslCommandCode + 32)
9789 +#define kDslSetRcvGainCmd           (kFirstDslCommandCode + 33)
9790 +#define kDslBypassRcvHpfCmd         (kFirstDslCommandCode + 34)
9791 +#define kDslWriteAfeRegCmd          (kFirstDslCommandCode + 35)
9792 +#define kDslReadAfeRegCmd           (kFirstDslCommandCode + 36)
9793 +#define        kDslOLRRequestCmd                       (kFirstDslCommandCode + 37)
9794 +#define        kDslOLRResponseCmd                      (kFirstDslCommandCode + 38)
9795 +#define kDslI432SetScrambleCmd         (kFirstDslCommandCode + 39)
9796 +#define        kDslPwrMgrCmd                           (kFirstDslCommandCode + 40)
9797 +#define kDslAtmGfcMappingCmd           (kFirstDslCommandCode + 41)
9798 +
9799 +#ifdef BCM6348_SRC
9800 +#define kDslEnablePwmSyncClk        (kFirstDslCommandCode + 42)
9801 +#define kDslSetPwmSyncClkFreq       (kFirstDslCommandCode + 43)
9802 +#endif
9803 +
9804 +#define        kG994p1Duplex                                                           1
9805 +#define        kG994p1HalfDuplex                                                       2
9806 +
9807 +/* Eoc Messages from ATU-C to ATU-R */
9808 +#define kDslEocHoldStateCmd                                            1
9809 +#define kDslEocReturnToNormalCmd                               2
9810 +#define kDslEocPerformSelfTestCmd                              3
9811 +#define kDslEocRequestCorruptCRCCmd                            4
9812 +#define kDslEocRequestEndCorruptCRCCmd                 5
9813 +#define kDslEocNotifyCorruptCRCCmd                             6
9814 +#define kDslEocNotifyEndCorruptCRCCmd                  7
9815 +#define kDslEocRequestTestParametersUpdateCmd  8
9816 +#define kDslEocGrantPowerDownCmd                               9
9817 +#define kDslEocRejectPowerDownCmd                              10
9818 +
9819 +/* Eoc Messages  from ATU-R to ATU-C */
9820 +#define kDslEocRequestPowerDownCmd                             11
9821 +#define kDslEocDyingGaspCmd                                            12
9822 +
9823 +/* Clear Eoc Messages  */
9824 +#define kDslClearEocFirstCmd                                   100
9825 +#define kDslClearEocSendFrame                                  100
9826 +#define kDslClearEocSendComplete                               101
9827 +#define kDslClearEocRcvedFrame                                 102
9828 +#define kDslClearEocSendComplete2                              103
9829 +
9830 +#define kDslClearEocMsgLengthMask                              0xFFFF
9831 +#define kDslClearEocMsgNumMask                                 0xFF0000
9832 +#define kDslClearEocMsgDataVolatileMask                        0x1000000
9833 +#define kDslClearEocMsgDataVolatile                            kDslClearEocMsgDataVolatileMask
9834 +#define kDslClearEocMsgExtraSendComplete               0x2000000
9835 +
9836 +/* ADSL Link Power States */
9837 +#define kDslPowerFullOn                                                0
9838 +#define kDslPowerLow                                           1
9839 +#define kDslPowerIdle                                          3
9840 +
9841 +/* ATU-R Data Registers */
9842 +#define kDslVendorIDRegister                           1
9843 +#define kDslRevisionNumberRegister                     2
9844 +#define kDslSerialNumberRegister                       3
9845 +#define kDslSelfTestResultsRegister                    4
9846 +#define kDslLineAttenuationRegister                    5
9847 +#define kDslSnrMarginRegister                          6
9848 +#define kDslAturConfigurationRegister          7
9849 +#define kDslLinkStateRegister                          8
9850 +
9851 +#define kDslVendorIDRegisterLength                     8
9852 +#define kDslRevisionNumberRegisterLength       32
9853 +#define kDslSerialNumberRegisterLength         32
9854 +#define kDslSelfTestResultsRegisterLength      1
9855 +#define kDslLineAttenuationRegisterLength      1
9856 +#define kDslSnrMarginRegisterLength                    1
9857 +#define kDslAturConfigurationRegisterLength    30
9858 +#define kDslLinkStateRegisterLength                    1
9859 +
9860 +/* Dsl Diags setup flags */
9861 +#define kDslDiagEnableEyeData                          1
9862 +#define kDslDiagEnableLogData                          2
9863 +
9864 +/* Dsl test commands */
9865 +typedef        long                                                            dslTestCmdType;
9866 +#define        kDslTestBackToNormal                            0
9867 +#define kDslTestReverb                                         1
9868 +#define kDslTestMedley                                         2
9869 +#define kDslTestToneSelection                          3
9870 +#define        kDslTestNoAutoRetrain                           4
9871 +#define        kDslTestMarginTweak                                     5
9872 +#define kDslTestEstimatePllPhase            6
9873 +#define kDslTestReportPllPhaseStatus        7
9874 +#define kDslTestAfeLoopback                                    8
9875 +#define kDslTestL3                                                     9
9876 +#define kDslTestAdsl2DiagMode                          10
9877 +#define kDslTestRetL0                                          11
9878 +
9879 +/* Xmt gain default setting */
9880 +#define        kDslXmtGainAuto                                         0x80000000
9881 +
9882 +/* Unit (AFE) test commands */
9883 +#define        kDslAfeTestLoadImage                            0
9884 +#define        kDslAfeTestPatternSend                          1
9885 +#define        kDslAfeTestLoadImageOnly                        2
9886 +#define        kDslAfeTestPhyRun                                       3
9887 +#define        kDslAfeTestLoadBuffer                           4
9888 +
9889 +typedef struct
9890 +       {
9891 +#if defined(G992P1_ANNEX_I) || defined(G992P5) 
9892 +       ushort                          downstreamMinCarr, downstreamMaxCarr;
9893 +#else
9894 +       uchar                           downstreamMinCarr, downstreamMaxCarr;
9895 +#endif
9896 +       uchar                   upstreamMinCarr, upstreamMaxCarr;
9897 +       }carrierInfo;
9898 +
9899 +#if defined(G992P3) && !defined(BCM6348_SRC) 
9900 +#define        FAST_TEXT_TYPE
9901 +#else
9902 +#define        FAST_TEXT_TYPE                  FAST_TEXT
9903 +#endif
9904 +
9905 +#if defined(BCM6348_SRC) 
9906 +#define BCM6348_TEMP_MOVE_TO_LMEM 
9907 +#else
9908 +#define BCM6348_TEMP_MOVE_TO_LMEM
9909 +#endif
9910 +
9911 +#ifdef G992P3
9912 +#define        PRINT_DEBUG_INFO
9913 +#else
9914 +#define        PRINT_DEBUG_INFO
9915 +#endif
9916 +
9917 +#ifdef G992P3
9918 +
9919 +#define                kG992p3MaxSpectBoundsUpSize             16
9920 +#define                kG992p3MaxSpectBoundsDownSize   16
9921 +
9922 +/* G.994 definitions */
9923 +
9924 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 1 ***/
9925 +
9926 +#define        kG994p1G992p3AnnexASpectrumBoundsUpstream       0x01
9927 +#define        kG994p1G992p3AnnexASpectrumShapingUpstream      0x02
9928 +#define        kG994p1G992p3AnnexASpectrumBoundsDownstream     0x04
9929 +#define        kG994p1G992p3AnnexASpectrumShapingDownstream    0x08
9930 +#define        kG994p1G992p3AnnexATxImageAboveNyquistFreq      0x10
9931 +#define        kG994p1G992p3AnnexLReachExtended                        0x20
9932 +#define kG994p1G992p3AnnexMSubModePSDMasks          0x20
9933 +
9934 +#define        kG994p1G992p3AnnexLUpNarrowband                         0x02
9935 +#define        kG994p1G992p3AnnexLUpWideband                           0x01
9936 +#define        kG994p1G992p3AnnexLDownNonoverlap                       0x01
9937 +
9938 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 2 ***/
9939 +
9940 +#define        kG994p1G992p3AnnexADownOverheadDataRate         0x01
9941 +#define        kG994p1G992p3AnnexAUpOverheadDataRate           0x02
9942 +#define        kG994p1G992p3AnnexAMaxNumberDownTPSTC           0x04
9943 +#define        kG994p1G992p3AnnexAMaxNumberUpTPSTC                     0x08
9944 +
9945 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 3,5,7,9 ***/
9946 +
9947 +#define        kG994p1G992p3AnnexADownSTM_TPS_TC                       0x01
9948 +#define        kG994p1G992p3AnnexAUpSTM_TPS_TC                         0x02
9949 +#define        kG994p1G992p3AnnexADownATM_TPS_TC                       0x04
9950 +#define        kG994p1G992p3AnnexAUpATM_TPS_TC                         0x08
9951 +#define        kG994p1G992p3AnnexADownPTM_TPS_TC                       0x10
9952 +#define        kG994p1G992p3AnnexAUpPTM_TPS_TC                         0x20
9953 +
9954 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 4,6,8,10 ***/
9955 +
9956 +#define        kG994p1G992p3AnnexADownPMS_TC_Latency           0x01
9957 +#define        kG994p1G992p3AnnexAUpPMS_TC_Latency                     0x02
9958 +
9959 +/*** 
9960 + *   TSSI
9961 + *
9962 + *   TSSI information is specified in 2 parts: subcarrier index,
9963 + *   tssi value, and an indication of whether or no the tone specified
9964 + *   is part of the supported set.
9965 + *
9966 + *   The subcarrier index information is currently stored in the
9967 + *   dsSubcarrierIndex array defined below. The tssi value are stored
9968 + *   in the dsLog_tss array.
9969 + *
9970 + *   The subcarrier index information only occupies the lower 12 bits
9971 + *   of the available 16 bits (short type). Therefore, we will pack the
9972 + *   supported set information in bit 15.
9973 + */
9974 +#define kG992DsSubCarrierIndexMask          (0x0fff)   /* AND mask to ectract ds subcarrier index */
9975 +#define kG992DsSubCarrierSuppSetMask        (0x8000)   /* AND mask to extract supported set indication */
9976 +
9977 +#define G992GetDsSubCarrierIndex(arg)               ((arg)  & kG992DsSubCarrierIndexMask)
9978 +#define G992GetDsSubCarrierSuppSetIndication(arg)   (((arg) & kG992DsSubCarrierSuppSetMask) >> 15)
9979 +
9980 +/* Caution: Do not change anything in this structure definition, including associated constant */
9981 +/* This structure definition is used only by the driver and any change impose incompatibility issue in driver */
9982 +/* The structure following this structure (g992p3PhyDataPumpCapabilities) can be changed in PHY application */
9983 +
9984 +typedef struct
9985 +       {
9986 +       Boolean                         rcvNTREnabled, shortInitEnabled, diagnosticsModeEnabled;
9987 +       
9988 +       char                            featureSpectrum, featureOverhead;
9989 +       char                            featureTPS_TC[4], featurePMS_TC[4];
9990 +       
9991 +       short                           rcvNOMPSDus, rcvMAXNOMPSDus, rcvMAXNOMATPus;
9992 +       short                           usSubcarrierIndex[kG992p3MaxSpectBoundsUpSize],
9993 +                                               usLog_tss[kG992p3MaxSpectBoundsUpSize];
9994 +       short                           numUsSubcarrier;
9995 +       short                           rcvNOMPSDds, rcvMAXNOMPSDds, rcvMAXNOMATPds;
9996 +       short                           dsSubcarrierIndex[kG992p3MaxSpectBoundsDownSize],
9997 +                                               dsLog_tss[kG992p3MaxSpectBoundsDownSize];
9998 +       short                           numDsSubcarrier;
9999 +       uchar                           sizeIDFT, fillIFFT;
10000 +       uchar                           readsl2Upstream, readsl2Downstream;
10001 +       uchar                           minDownOverheadDataRate, minUpOverheadDataRate;
10002 +       uchar                           maxDownSTM_TPSTC, maxDownATM_TPSTC, maxDownPTM_TPSTC;
10003 +       uchar                           maxUpSTM_TPSTC, maxUpATM_TPSTC, maxUpPTM_TPSTC;
10004 +
10005 +       short                           minDownSTM_TPS_TC[4], maxDownSTM_TPS_TC[4],
10006 +                                               minRevDownSTM_TPS_TC[4], maxDelayDownSTM_TPS_TC[4];
10007 +       uchar                           maxErrorDownSTM_TPS_TC[4], minINPDownSTM_TPS_TC[4];
10008 +       short                           minUpSTM_TPS_TC[4], maxUpSTM_TPS_TC[4],
10009 +                                               minRevUpSTM_TPS_TC[4], maxDelayUpSTM_TPS_TC[4];
10010 +       uchar                           maxErrorUpSTM_TPS_TC[4], minINPUpSTM_TPS_TC[4];
10011 +
10012 +       short                           maxDownPMS_TC_Latency[4], maxUpPMS_TC_Latency[4];
10013 +       short                           maxDownR_PMS_TC_Latency[4], maxDownD_PMS_TC_Latency[4];
10014 +       short                           maxUpR_PMS_TC_Latency[4], maxUpD_PMS_TC_Latency[4];
10015 +
10016 +       short                           minDownATM_TPS_TC[4], maxDownATM_TPS_TC[4],
10017 +                                               minRevDownATM_TPS_TC[4], maxDelayDownATM_TPS_TC[4];
10018 +       uchar                           maxErrorDownATM_TPS_TC[4], minINPDownATM_TPS_TC[4];
10019 +       short                           minUpATM_TPS_TC[4], maxUpATM_TPS_TC[4],
10020 +                                               minRevUpATM_TPS_TC[4], maxDelayUpATM_TPS_TC[4];
10021 +       uchar                           maxErrorUpATM_TPS_TC[4], minINPUpATM_TPS_TC[4];
10022 +
10023 +       short                           minDownPTM_TPS_TC[4], maxDownPTM_TPS_TC[4],
10024 +                                               minRevDownPTM_TPS_TC[4], maxDelayDownPTM_TPS_TC[4];
10025 +       uchar                           maxErrorDownPTM_TPS_TC[4], minINPDownPTM_TPS_TC[4];
10026 +       short                           minUpPTM_TPS_TC[4], maxUpPTM_TPS_TC[4],
10027 +                                               minRevUpPTM_TPS_TC[4], maxDelayUpPTM_TPS_TC[4];
10028 +       uchar                           maxErrorUpPTM_TPS_TC[4], minINPUpPTM_TPS_TC[4];
10029 +
10030 +    ushort              subModePSDMasks;
10031 +       } g992p3DataPumpCapabilities;
10032 +
10033 +#define                kG992p3p5MaxSpectBoundsUpSize           16
10034 +#define                kG992p3p5MaxSpectBoundsDownSize         32
10035 +
10036 +typedef struct
10037 +       {
10038 +       Boolean                         rcvNTREnabled, shortInitEnabled, diagnosticsModeEnabled;
10039 +       
10040 +       char                            featureSpectrum, featureOverhead;
10041 +       char                            featureTPS_TC[4], featurePMS_TC[4];
10042 +       
10043 +       short                           rcvNOMPSDus, rcvMAXNOMPSDus, rcvMAXNOMATPus;
10044 +       short                           usSubcarrierIndex[kG992p3p5MaxSpectBoundsUpSize],
10045 +                                               usLog_tss[kG992p3p5MaxSpectBoundsUpSize];
10046 +       short                           numUsSubcarrier;
10047 +       short                           rcvNOMPSDds, rcvMAXNOMPSDds, rcvMAXNOMATPds;
10048 +       short                           dsSubcarrierIndex[kG992p3p5MaxSpectBoundsDownSize],
10049 +                                               dsLog_tss[kG992p3p5MaxSpectBoundsDownSize];
10050 +       short                           numDsSubcarrier;
10051 +       uchar                           sizeIDFT, fillIFFT;
10052 +       uchar                           readsl2Upstream, readsl2Downstream;
10053 +       uchar                           minDownOverheadDataRate, minUpOverheadDataRate;
10054 +       uchar                           maxDownSTM_TPSTC, maxDownATM_TPSTC, maxDownPTM_TPSTC;
10055 +       uchar                           maxUpSTM_TPSTC, maxUpATM_TPSTC, maxUpPTM_TPSTC;
10056 +
10057 +       short                           minDownSTM_TPS_TC[4], maxDownSTM_TPS_TC[4],
10058 +                                               minRevDownSTM_TPS_TC[4], maxDelayDownSTM_TPS_TC[4];
10059 +       uchar                           maxErrorDownSTM_TPS_TC[4], minINPDownSTM_TPS_TC[4];
10060 +       short                           minUpSTM_TPS_TC[4], maxUpSTM_TPS_TC[4],
10061 +                                               minRevUpSTM_TPS_TC[4], maxDelayUpSTM_TPS_TC[4];
10062 +       uchar                           maxErrorUpSTM_TPS_TC[4], minINPUpSTM_TPS_TC[4];
10063 +
10064 +       short                           maxDownPMS_TC_Latency[4], maxUpPMS_TC_Latency[4];
10065 +       short                           maxDownR_PMS_TC_Latency[4], maxDownD_PMS_TC_Latency[4];
10066 +       short                           maxUpR_PMS_TC_Latency[4], maxUpD_PMS_TC_Latency[4];
10067 +
10068 +       short                           minDownATM_TPS_TC[4], maxDownATM_TPS_TC[4],
10069 +                                               minRevDownATM_TPS_TC[4], maxDelayDownATM_TPS_TC[4];
10070 +       uchar                           maxErrorDownATM_TPS_TC[4], minINPDownATM_TPS_TC[4];
10071 +       short                           minUpATM_TPS_TC[4], maxUpATM_TPS_TC[4],
10072 +                                               minRevUpATM_TPS_TC[4], maxDelayUpATM_TPS_TC[4];
10073 +       uchar                           maxErrorUpATM_TPS_TC[4], minINPUpATM_TPS_TC[4];
10074 +
10075 +       short                           minDownPTM_TPS_TC[4], maxDownPTM_TPS_TC[4],
10076 +                                               minRevDownPTM_TPS_TC[4], maxDelayDownPTM_TPS_TC[4];
10077 +       uchar                           maxErrorDownPTM_TPS_TC[4], minINPDownPTM_TPS_TC[4];
10078 +       short                           minUpPTM_TPS_TC[4], maxUpPTM_TPS_TC[4],
10079 +                                               minRevUpPTM_TPS_TC[4], maxDelayUpPTM_TPS_TC[4];
10080 +       uchar                           maxErrorUpPTM_TPS_TC[4], minINPUpPTM_TPS_TC[4];
10081 +
10082 +    ushort              subModePSDMasks;
10083 +       } g992p3PhyDataPumpCapabilities;
10084 +#endif
10085 +
10086 +typedef struct
10087 +       {
10088 +       dslModulationType       modulations;
10089 +       bitMap                          auxFeatures;
10090 +       bitMap                  features;       
10091 +       bitMap                          demodCapabilities;
10092 +       bitMap                          demodCapabilities2;
10093 +       ushort                          noiseMargin;            /* Q4 dB */
10094 +#ifdef G992_ATUC
10095 +       short                           xmtRSf, xmtRS, xmtS, xmtD;
10096 +       short                           rcvRSf, rcvRS, rcvS, rcvD;
10097 +#endif 
10098 +#ifdef G992P1_ANNEX_A  
10099 +       bitMap                  subChannelInfo;
10100 +       carrierInfo             carrierInfoG992p1;
10101 +#endif
10102 +#ifdef G992P1_ANNEX_B  
10103 +       bitMap                  subChannelInfoAnnexB;
10104 +       carrierInfo             carrierInfoG992p1AnnexB;
10105 +#endif
10106 +#ifdef G992_ANNEXC     
10107 +       bitMap                  subChannelInfoAnnexC;
10108 +       carrierInfo             carrierInfoG992p1AnnexC;
10109 +#endif
10110 +#if defined(G992P1_ANNEX_I)
10111 +       bitMap                  subChannelInfoAnnexI;
10112 +       carrierInfo             carrierInfoG992p1AnnexI;
10113 +#endif
10114 +#ifdef G992P5
10115 +       bitMap                  subChannelInfop5;
10116 +       carrierInfo             carrierInfoG992p5;
10117 +#endif
10118 +#if defined(G992P2) || (defined(G992P1_ANNEX_A) && defined(G992P1_ANNEX_A_USED_FOR_G992P2))
10119 +       carrierInfo             carrierInfoG992p2;
10120 +#endif
10121 +       ushort                  maxDataRate;
10122 +       uchar                   minDataRate;         
10123 +#ifdef G992P3
10124 +       g992p3DataPumpCapabilities      *carrierInfoG992p3AnnexA;
10125 +#endif
10126 +#ifdef G992P5
10127 +       g992p3DataPumpCapabilities      *carrierInfoG992p5AnnexA;
10128 +#endif
10129 +       } dslDataPumpCapabilities;
10130 +               
10131 +struct __dslCommandStruct;
10132 +typedef        Boolean (*dslCommandHandlerType)        (void *gDslVars, struct __dslCommandStruct*);
10133 +typedef        struct __dslCommandStruct
10134 +       {
10135 +       dslCommandCode                                          command;
10136 +       union
10137 +               {
10138 +               long                                                    value;
10139 +               Boolean                                                 flag;
10140 +               struct
10141 +                       {
10142 +                       dslTestCmdType                          type;
10143 +                       union
10144 +                               {
10145 +                               struct
10146 +                                       {
10147 +                                       ulong                           xmtStartTone, xmtNumOfTones;
10148 +                                       ulong                           rcvStartTone, rcvNumOfTones;
10149 +                                       uchar                           *xmtMap, *rcvMap;
10150 +                                       } toneSelectSpec;
10151 +                               struct
10152 +                                       {
10153 +                                       long                            extraPowerRequestQ4dB;
10154 +                                       long                            numOfCarriers;
10155 +                                       char                            *marginTweakTableQ4dB;
10156 +                                       } marginTweakSpec;
10157 +                               } param;
10158 +                       } dslTestSpec;
10159 +               struct
10160 +                       {
10161 +                       dslDirectionType                        direction;                      
10162 +                       dslDataPumpCapabilities         capabilities;
10163 +                       } dslModeSpec;
10164 +               struct
10165 +                       {
10166 +                       bitMap                                          setup;                  
10167 +                       ulong                                           eyeConstIndex1;
10168 +                       ulong                                           eyeConstIndex2;
10169 +                       ulong                                           logTime;
10170 +                       } dslDiagSpec;
10171 +               struct
10172 +                       {
10173 +                       void                                            *pBuf;                  
10174 +                       ulong                                           bufSize;
10175 +                       } dslStatusBufSpec;
10176 +               struct
10177 +                       {
10178 +                       ulong                                           type;
10179 +                       void                                            *afeParamPtr;
10180 +                       ulong                                           afeParamSize;
10181 +                       void                                            *imagePtr;
10182 +                       ulong                                           imageSize;
10183 +                       } dslAfeTestSpec;
10184 +               struct
10185 +                       {
10186 +                       dslLinkLayerType                        type;
10187 +                       bitMap                                          setup;
10188 +                       union
10189 +                               {
10190 +                               struct
10191 +                                       {
10192 +                                       dataRateMap                                     rxDataRate;
10193 +                                       dataRateMap                                     txDataRate;
10194 +                                       long                                            rtDelayQ4ms;                            
10195 +                                       ulong                                           rxBufNum;
10196 +                                       ulong                                           rxCellsInBuf;
10197 +                                       ulong                                           rxPacketNum;
10198 +                                       dslFrameHandlerType                     rxIndicateHandlerPtr;
10199 +                                       dslFrameHandlerType             txCompleteHandlerPtr;
10200 +                                       dslPhyInitType                          atmPhyInitPtr;
10201 +                                       } atmLinkSpec;
10202 +                               struct
10203 +                                       {
10204 +                                       dslHeaderHandlerType            rxHeaderHandlerPtr;
10205 +                                       dslRxFrameBufferHandlerType     rxDataHandlerPtr;
10206 +                                       dslTxFrameBufferHandlerType txHandlerPtr;
10207 +                                       } atmPhyLinkSpec;
10208 +#ifdef DSL_PACKET
10209 +                               struct
10210 +                                       {
10211 +                                       ulong                                           rxBufNum;
10212 +                                       ulong                                           rxBufSize;
10213 +                                       ulong                                           rxPacketNum;
10214 +                                       dslFrameHandlerType                     rxIndicateHandlerPtr;
10215 +                                       dslFrameHandlerType             txCompleteHandlerPtr;
10216 +                                       dslPacketPhyInitType            dslPhyInitPtr;
10217 +                                       } dslPacketLinkSpec;
10218 +                               dslPacketPhyFunctions                   dslPacketPhyLinkSpec;
10219 +#endif
10220 +                               struct
10221 +                                       {
10222 +                                       txDataHandlerType                       txDataHandlerPtr;
10223 +                                       rxDataHandlerType                       rxDataHandlerPtr;
10224 +                                       } nullLinkSpec;
10225 +                               } param;
10226 +                       } dslLinkLayerSpec;
10227 +#ifdef G997_1
10228 +#ifdef G997_1_FRAMER
10229 +               struct
10230 +                       {
10231 +                       bitMap                                          setup;
10232 +                       ulong                                           rxBufNum;
10233 +                       ulong                                           rxBufSize;
10234 +                       ulong                                           rxPacketNum;
10235 +                       dslFrameHandlerType                     rxIndicateHandlerPtr;
10236 +                       dslFrameHandlerType             txCompleteHandlerPtr;
10237 +                       } dslG997Cmd;
10238 +#endif
10239 +               struct
10240 +                       {
10241 +                       long    msgId;
10242 +                       long    msgType;
10243 +                       char    *dataPtr;
10244 +                       } dslClearEocMsg;
10245 +#endif
10246 +               struct
10247 +                       {
10248 +                       ulong                                           code;
10249 +                       uchar                                           *valuePtr;
10250 +                       ulong                                           length;
10251 +                       } dslDataRegister;
10252 +               union
10253 +                       {
10254 +                       dslStatusHandlerType            statusHandlerPtr;
10255 +                       dslCommandHandlerType           commandHandlerPtr;
10256 +                       eyeHandlerType                          eyeHandlerPtr;
10257 +                       logHandlerType                          logHandlerPtr;
10258 +#if defined(DEBUG_DATA_HANDLER)
10259 +            debugDataHandlerType        debugDataHandlerPtr;
10260 +#endif
10261 +                       dslFrameHandlerType                     rxIndicateHandlerPtr;
10262 +                       dslFrameHandlerType                     txCompleteHandlerPtr;
10263 +                       dslDriverCallbackType           driverCallback;
10264 +                       } handlerSpec;
10265 +#if !defined(CHIP_SRC) || defined(DSL_FRAME_FUNCTIONS)
10266 +               dslFrameFunctions                               DslFunctions;
10267 +#endif
10268 +               dslOLRMessage                                   dslOLRRequest;
10269 +               dslPwrMessage                                   dslPwrMsg;
10270 +               } param;
10271 +       } dslCommandStruct;
10272 +       
10273 +
10274 +
10275 +
10276 +typedef struct
10277 +       {
10278 +       dslCommandHandlerType                   linkCommandHandlerPtr;
10279 +       timerHandlerType                                linkTimerHandlerPtr;
10280 +       dslLinkCloseHandlerType                 linkCloseHandlerPtr;
10281 +
10282 +       dslFrameHandlerType                             linkSendHandlerPtr;
10283 +       dslFrameHandlerType                             linkReturnHandlerPtr;
10284 +
10285 +       dslVcAllocateHandlerType                linkVcAllocateHandlerPtr;
10286 +       dslVcFreeHandlerType                    linkVcFreeHandlerPtr;
10287 +       dslVcActivateHandlerType                linkVcActivateHandlerPtr;
10288 +       dslVcDeactivateHandlerType              linkVcDeactivateHandlerPtr;
10289 +       dslVcConfigureHandlerType               linkVcConfigureHandlerPtr;
10290 +
10291 +       dslLinkVc2IdHandlerType                 linkVc2IdHandlerPtr;
10292 +       dslLinkVcId2VcHandlerType               linkVcId2VcHandlerPtr;
10293 +       dslGetFramePoolHandlerType              linkGetFramePoolHandlerPtr;
10294 +
10295 +#ifndef ADSLCORE_ONLY
10296 +       dslHeaderHandlerType                    linkRxCellHeaderHandlerPtr;
10297 +       dslRxFrameBufferHandlerType             linkRxCellDataHandlerPtr;
10298 +       dslTxFrameBufferHandlerType             linkTxCellHandlerPtr;
10299 +#endif
10300 +
10301 +       txDataHandlerType                               linkTxDataHandlerPtr;
10302 +       rxDataHandlerType                               linkRxDataHandlerPtr;
10303 +       } linkLayerFunctions;
10304 +
10305 +#ifndef ADSLCORE_ONLY
10306 +
10307 +#define         LinkLayerAssignFunctions( var, name_prefix )   do {                                    \
10308 +       (var).linkCommandHandlerPtr = name_prefix##CommandHandler;                                      \
10309 +       (var).linkTimerHandlerPtr       = name_prefix##TimerHandler;                                    \
10310 +       (var).linkCloseHandlerPtr       = name_prefix##CloseHandler;                                    \
10311 +                                                                                                                                                               \
10312 +       (var).linkSendHandlerPtr        = name_prefix##SendFrameHandler;                                \
10313 +       (var).linkReturnHandlerPtr      = name_prefix##ReturnFrameHandler;                              \
10314 +                                                                                                                                                               \
10315 +       (var).linkVcAllocateHandlerPtr          = name_prefix##VcAllocateHandler;               \
10316 +       (var).linkVcFreeHandlerPtr                      = name_prefix##VcFreeHandler;                   \
10317 +       (var).linkVcActivateHandlerPtr          = name_prefix##VcActivateHandler;               \
10318 +       (var).linkVcDeactivateHandlerPtr        = name_prefix##VcDeactivateHandler;             \
10319 +       (var).linkVcConfigureHandlerPtr         = name_prefix##VcConfigureHandler;              \
10320 +                                                                                                                                                               \
10321 +       (var).linkVc2IdHandlerPtr                       = name_prefix##Vc2IdHandler;                    \
10322 +       (var).linkVcId2VcHandlerPtr                     = name_prefix##VcId2VcHandler;                  \
10323 +       (var).linkGetFramePoolHandlerPtr        = name_prefix##GetFramePoolHandler;             \
10324 +                                                                                                                                                               \
10325 +       (var).linkRxCellHeaderHandlerPtr        = name_prefix##RxCellHeaderHandler;             \
10326 +       (var).linkRxCellDataHandlerPtr          = name_prefix##RxCellDataHandler;               \
10327 +       (var).linkTxCellHandlerPtr                      = name_prefix##TxCellHandler;                   \
10328 +                                                                                                                                                               \
10329 +       (var).linkTxDataHandlerPtr      = name_prefix##TxDataHandler;                                   \
10330 +       (var).linkRxDataHandlerPtr      = name_prefix##RxDataHandler;                                   \
10331 +} while (0)
10332 +
10333 +#else
10334 +
10335 +#define         LinkLayerAssignFunctions( var, name_prefix )   do {                                    \
10336 +       (var).linkCommandHandlerPtr = name_prefix##CommandHandler;                                      \
10337 +       (var).linkTimerHandlerPtr       = name_prefix##TimerHandler;                                    \
10338 +       (var).linkCloseHandlerPtr       = name_prefix##CloseHandler;                                    \
10339 +                                                                                                                                                               \
10340 +       (var).linkSendHandlerPtr        = name_prefix##SendFrameHandler;                                \
10341 +       (var).linkReturnHandlerPtr      = name_prefix##ReturnFrameHandler;                              \
10342 +                                                                                                                                                               \
10343 +       (var).linkVcAllocateHandlerPtr          = name_prefix##VcAllocateHandler;               \
10344 +       (var).linkVcFreeHandlerPtr                      = name_prefix##VcFreeHandler;                   \
10345 +       (var).linkVcActivateHandlerPtr          = name_prefix##VcActivateHandler;               \
10346 +       (var).linkVcDeactivateHandlerPtr        = name_prefix##VcDeactivateHandler;             \
10347 +       (var).linkVcConfigureHandlerPtr         = name_prefix##VcConfigureHandler;              \
10348 +                                                                                                                                                               \
10349 +       (var).linkVc2IdHandlerPtr                       = name_prefix##Vc2IdHandler;                    \
10350 +       (var).linkVcId2VcHandlerPtr                     = name_prefix##VcId2VcHandler;                  \
10351 +       (var).linkGetFramePoolHandlerPtr        = name_prefix##GetFramePoolHandler;             \
10352 +                                                                                                                                                               \
10353 +       (var).linkTxDataHandlerPtr      = name_prefix##TxDataHandler;                                   \
10354 +       (var).linkRxDataHandlerPtr      = name_prefix##RxDataHandler;                                   \
10355 +} while (0)
10356 +
10357 +#endif
10358 +
10359 +typedef struct
10360 +       {
10361 +       dslFrameHandlerType                             rxIndicateHandlerPtr;
10362 +       dslFrameHandlerType                             txCompleteHandlerPtr;
10363 +       dslStatusHandlerType                    statusHandlerPtr;
10364 +       } upperLayerFunctions;
10365 +
10366 +
10367 +/*
10368 + * Debug data
10369 + */
10370 +#define        kDslFirstDebugData                                      1000
10371 +#define        kDslXmtPerSymTimeCompData                       (kDslFirstDebugData + 0)
10372 +#define        kDslRcvPerSymTimeCompData                       (kDslFirstDebugData + 1)
10373 +#define        kDslXmtAccTimeCompData                          (kDslFirstDebugData + 2)
10374 +#define        kDslRcvAccTimeCompData                          (kDslFirstDebugData + 3)
10375 +#define        kDslRcvPilotToneData                            (kDslFirstDebugData + 4)
10376 +#define        kDslTEQCoefData                                         (kDslFirstDebugData + 5)
10377 +#define        kDslTEQInputData                                        (kDslFirstDebugData + 6)
10378 +#define        kDslTEQOutputData                                       (kDslFirstDebugData + 7)
10379 +#define        kDslRcvFFTInputData                                     (kDslFirstDebugData + 8)
10380 +#define        kDslRcvFFTOutputData                            (kDslFirstDebugData + 9)
10381 +#define        kDslRcvCarrierSNRData                           (kDslFirstDebugData + 10)
10382 +#define        kDslXmtToneOrderingData                         (kDslFirstDebugData + 11)
10383 +#define        kDslRcvToneOrderingData                         (kDslFirstDebugData + 12)
10384 +#define        kDslXmtGainData                                         (kDslFirstDebugData + 13)
10385 +#define        kDslRcvGainData                                         (kDslFirstDebugData + 14)
10386 +#define        kDslMseData                                                     (kDslFirstDebugData + 15)
10387 +#define        kDslFEQOutErrData                                       (kDslFirstDebugData + 16)
10388 +#define kDslFEQCoefData                                        (kDslFirstDebugData + 17)
10389 +#define kDslShowtimeMseData                                    (kDslFirstDebugData + 18)
10390 +#define kDslTimeEstimationHWPhaseTweak         (kDslFirstDebugData + 24)
10391 +#define        kDslSlicerInput                                         (kDslFirstDebugData + 40)
10392 +#define        kDslXmtConstellations                           (kDslFirstDebugData + 41)
10393 +#define kDslSnr1ShiftData                                      (kDslFirstDebugData + 50)
10394 +#define kDslSnr1InputData                                      (kDslFirstDebugData + 51)
10395 +#define kDslSnr1ReverbAvgData                          (kDslFirstDebugData + 52)
10396 +#define kDslAnnexCFextSnrData                          (kDslFirstDebugData + 53)
10397 +#define kDslAnnexCNextSnrData                          (kDslFirstDebugData + 54)
10398 +#define        kG994p1OutputXmtSample                          (kDslFirstDebugData + 100)
10399 +#define        kG994p1OutputMicroBit                           (kDslFirstDebugData + 101)
10400 +#define        kG994p1OutputBit                                        (kDslFirstDebugData + 102)
10401 +#define        kG994p1OutputTimer                                      (kDslFirstDebugData + 103)
10402 +
10403 +/****************************************************************************/
10404 +/*     2.      Constant definitions.                                                                                           */
10405 +/*                                                                                                                                                     */
10406 +/*     2.1     Defininitive constants                                                                                          */
10407 +/****************************************************************************/
10408 +
10409 +/* dslDirectionType */
10410 +
10411 +#define        kATU_C          0
10412 +#define        kATU_R          1
10413 +
10414 +/* ATM setup maps      */
10415 +
10416 +#define        kAtmCallMgrEnabled                      0x00000001              /* Bit 0  */
10417 +#define        kAtmAAL1FecEnabledMask          0x00000006              /* Bit 1  */
10418 +#define        kAtmAAL1HiDelayFecEnabled       0x00000002              /* Bit 2  */
10419 +#define        kAtmAAL1LoDelayFecEnabled       0x00000004              /* Bit 3  */
10420 +
10421 +/* dslLinkLayerType */
10422 +
10423 +#define kNoDataLink                    0
10424 +#define kAtmLink                       0x00000001
10425 +#define kAtmPhyLink                    0x00000002
10426 +#define kDslPacketLink         0x00000003
10427 +#define kDslPacketPhyLink      0x00000004
10428 +
10429 +/* dslModulationType */
10430 +#define        kNoCommonModulation     0x00000000                              
10431 +#define        kG994p1                         0x00000020                              /* G.994.1 or G.hs */
10432 +#define        kT1p413                         0x00000040                              /* T1.413 handshaking */
10433 +#define        kG992p1AnnexA           0x00000001                              /* G.992.1 or G.dmt Annex A */
10434 +#define        kG992p1AnnexB           0x00000002                              /* G.992.1 or G.dmt Annex B */
10435 +#define        kG992p1AnnexC           0x00000004                              /* G.992.1 or G.dmt Annex C */
10436 +#define        kG992p2AnnexAB          0x00000008                              /* G.992.2 or G.lite Annex A/B */
10437 +#define        kG992p2AnnexC           0x00000010                              /* G.992.2 or G.lite Annex C */
10438 +#define        kG992p3AnnexA           0x00000100                              /* G.992.3 or G.DMTbis Annex A */
10439 +#define        kG992p3AnnexB           0x00000200                              /* G.992.3 or G.DMTbis Annex A */
10440 +#define        kG992p1AnnexI           0x00000400                              /* G.992.1 Annex I */
10441 +#define kG992p5AnnexA       0x00010000              /* G.992.5 Annex A */
10442 +#define kG992p5AnnexB       0x00020000              /* G.992.5 Annex B */
10443 +#define kG992p5AnnexI       0x00040000              /* G.992.5 Annex I */
10444 +#define kG992p3AnnexM       0x00080000              /* G.992.3 Annex M */
10445 +#define kG992p5AnnexM       0x01000000              /* G.992.5 Annex M */
10446 +
10447 +/* demodCapabilities bitmap */
10448 +#define        kEchoCancellorEnabled                                   0x00000001
10449 +#define        kSoftwareTimeErrorDetectionEnabled              0x00000002
10450 +#define        kSoftwareTimeTrackingEnabled                    0x00000004
10451 +#define kDslTrellisEnabled                                 0x00000008
10452 +#define        kHardwareTimeTrackingEnabled                    0x00000010
10453 +#define kHardwareAGCEnabled                                            0x00000020
10454 +#define kDigitalEchoCancellorEnabled                   0x00000040
10455 +#define kReedSolomonCodingEnabled                              0x00000080
10456 +#define kAnalogEchoCancellorEnabled                            0x00000100
10457 +#define        kT1p413Issue1SingleByteSymMode                  0x00000200
10458 +#define        kDslAturXmtPowerCutbackEnabled                  0x00000400
10459 +#ifdef G992_ANNEXC_LONG_REACH
10460 +#define kDslAnnexCPilot48                       0x00000800
10461 +#define kDslAnnexCReverb33_63                   0x00001000
10462 +#endif
10463 +#ifdef G992_ANNEXC
10464 +#define kDslCentilliumCRCWorkAroundEnabled             0x00002000
10465 +#else
10466 +#define kDslEnableRoundUpDSLoopAttn                    0x00002000
10467 +#endif
10468 +#define        kDslBitSwapEnabled                                              0x00004000
10469 +#define        kDslADILowRateOptionFixDisabled                 0x00008000
10470 +#define        kDslAnymediaGSPNCrcFixEnabled                   0x00010000
10471 +#define        kDslMultiModesPreferT1p413                              0x00020000
10472 +#define        kDslT1p413UseRAck1Only                                  0x00040000
10473 +#define        kDslUE9000ADI918FECFixEnabled                   0x00080000
10474 +#define        kDslG994AnnexAMultimodeEnabled                  0x00100000
10475 +#define        kDslATUCXmtPowerMinimizeEnabled                 0x00200000
10476 +#define        kDropOnDataErrorsDisabled                           0x00400000
10477 +#define        kDslSRAEnabled                                              0x00800000
10478 +
10479 +#define        kDslT1p413HigherToneLevelNeeded                 0x01000000
10480 +#define        kDslT1p413SubsampleAlignmentEnabled             0x02000000
10481 +#define        kDslT1p413DisableUpstream2xIfftMode             0x04000000
10482 +
10483 +/* test mode related demodCapabilities, for internal use only */
10484 +#define        kDslTestDemodCapMask                                    0xF8000000
10485 +#define        kDslSendReverbModeEnabled                               0x10000000
10486 +#define        kDslSendMedleyModeEnabled                               0x20000000
10487 +#define        kDslAutoRetrainDisabled                                 0x40000000
10488 +#define kDslPllWorkaroundEnabled                0x80000000
10489 +#define kDslAfeLoopbackModeEnabled              0x08000000
10490 +
10491 +/* demodCapabilities bitmap2 */
10492 +
10493 +#define kDslAnnexCProfile1                                 0x00000001
10494 +#define kDslAnnexCProfile2                                 0x00000002
10495 +#define kDslAnnexCProfile3                                 0x00000004
10496 +#define kDslAnnexCProfile4                                 0x00000008
10497 +#define kDslAnnexCProfile5                                 0x00000010
10498 +#define kDslAnnexCProfile6                                 0x00000020
10499 +#define kDslAnnexCPilot64                                      0x00000040
10500 +#define kDslAnnexCPilot48                       0x00000080
10501 +#define kDslAnnexCPilot32                                      0x00000100
10502 +#define kDslAnnexCPilot16                                      0x00000200
10503 +#define kDslAnnexCA48B48                                           0x00000400
10504 +#define kDslAnnexCA24B24                                   0x00000800
10505 +#define kDslAnnexCReverb33_63                   0x00001000
10506 +#define kDslAnnexCCReverb6_31                          0x00002000
10507 +
10508 +#define kDslAnnexIShapedSSVI                    0x00004000
10509 +#define kDslAnnexIFlatSSVI                      0x00008000
10510 +
10511 +#define kDslAnnexIPilot64                                      0x00010000
10512 +#define kDslAnnexIA48B48                                           0x00020000
10513 +#define kDslAnnexIPilot128                                     0x00040000
10514 +#define kDslAnnexIPilot96                                      0x00080000
10515 +
10516 +/* Features bitmap */
10517 +#define        kG992p2RACK1                                                0x00000001
10518 +#define        kG992p2RACK2                                                    0x00000002
10519 +#define        kG992p2DBM                                                              0x00000004
10520 +#define        kG992p2FastRetrain                                              0x00000008
10521 +#define        kG992p2RS16                                                             0x00000010
10522 +#define        kG992p2ClearEOCOAM                                              0x00000020
10523 +#define        kG992NTREnabled                                                 0x00000040
10524 +#define        kG992p2EraseAllStoredProfiles                   0x00000080
10525 +#define kG992p2FeaturesNPar2Mask                0x0000003B
10526 +#define kG992p2FeaturesNPar2Shift                        0
10527 +
10528 +#define kG992p1RACK1                            0x00000100
10529 +#define kG992p1RACK2                            0x00000200
10530 +#define kG992p1STM                              0x00000800
10531 +#define kG992p1ATM                              0x00001000
10532 +#define        kG992p1ClearEOCOAM                                              0x00002000
10533 +#define kG992p1FeaturesNPar2Mask                0x00003B00
10534 +#define kG992p1FeaturesNPar2Shift                        8     
10535 +#define kG992p1DualLatencyUpstream                             0x00004000
10536 +#define kG992p1DualLatencyDownstream                   0x00008000
10537 +#define kG992p1HigherBitRates                                  0x40000000
10538 +
10539 +#if defined(G992P1_ANNEX_I)
10540 +#define kG992p1HigherBitRates1over3                            0x80000000
10541 +#define kG992p1AnnexIShapedSSVI                 0x00000001
10542 +#define kG992p1AnnexIFlatSSVI                   0x00000002
10543 +#define kG992p1AnnexIPilotFlag                                 0x00000008
10544 +#define kG992p1AnnexIPilot64                                   0x00000001
10545 +#define kG992p1AnnexIPilot128                                  0x00000004
10546 +#define kG992p1AnnexIPilot96                                   0x00000008
10547 +#define kG992p1AnnexIPilotA48B48                0x00000010
10548 +#endif
10549 +
10550 +#define kG992p1AnnexBRACK1                      0x00010000
10551 +#define kG992p1AnnexBRACK2                      0x00020000
10552 +#define kG992p1AnnexBUpstreamTones1to32                        0x00040000
10553 +#define kG992p1AnnexBSTM                        0x00080000
10554 +#define kG992p1AnnexBATM                        0x00100000
10555 +#define        kG992p1AnnexBClearEOCOAM                                0x00200000
10556 +#define kG992p1AnnexBFeaturesNPar2Mask          0x003F0000
10557 +#define kG992p1AnnexBFeaturesNPar2Shift                 16     
10558 +
10559 +#define kG992p1AnnexCRACK1                      0x01000000
10560 +#define kG992p1AnnexCRACK2                      0x02000000
10561 +#define kG992p1AnnexCDBM                                               0x04000000
10562 +#define kG992p1AnnexCSTM                        0x08000000
10563 +#define kG992p1AnnexCATM                        0x10000000
10564 +#define        kG992p1AnnexCClearEOCOAM                                0x20000000
10565 +#define kG992p1AnnexCFeaturesNPar2Mask          0x3F000000
10566 +#define kG992p1AnnexCFeaturesNPar2Shift                 24     
10567 +
10568 +#define kG992p1HigherBitRates1over3                            0x80000000
10569 +
10570 +/* auxFeatures bitmap */
10571 +#define        kG994p1PreferToExchangeCaps                             0x00000001
10572 +#define        kG994p1PreferToDecideMode                               0x00000002
10573 +#define        kG994p1PreferToMPMode                               0x00000004
10574 +#define        kAfePwmSyncClockShift                                   3
10575 +#define        kAfePwmSyncClockMask                                    (0xF << kAfePwmSyncClockShift)
10576 +#define        AfePwmSyncClockEnabled(val)                             (((val) & kAfePwmSyncClockMask) != 0)
10577 +#define        AfePwmGetSyncClockFreq(val)                             ((((val) & kAfePwmSyncClockMask) >> kAfePwmSyncClockShift) - 1)
10578 +#define        AfePwmSetSyncClockFreq(val,freq)                ((val) |= ((((freq)+1) << kAfePwmSyncClockShift) & kAfePwmSyncClockMask))
10579 +
10580 +/* SubChannel Info bitMap for G992p1 */
10581 +#define kSubChannelASODownstream                0x00000001
10582 +#define kSubChannelAS1Downstream                0x00000002
10583 +#define kSubChannelAS2Downstream                0x00000004
10584 +#define kSubChannelAS3Downstream                0x00000008
10585 +#define kSubChannelLSODownstream                0x00000010
10586 +#define kSubChannelLS1Downstream                0x00000020
10587 +#define kSubChannelLS2Downstream                0x00000040
10588 +#define kSubChannelLS0Upstream                  0x00000080
10589 +#define kSubChannelLS1Upstream                  0x00000100
10590 +#define kSubChannelLS2Upstream                  0x00000200
10591 +#define kSubChannelInfoOctet1Mask               0x0000001F
10592 +#define kSubChannelInfoOctet2Mask               0x000003E0
10593 +#define kSubChannelInfoOctet1Shift                              0      
10594 +#define kSubChannelInfoOctet2Shift                              5      
10595 +
10596 +/****************************************************************************/
10597 +/*     3.      Interface functions.                                                                                            */
10598 +/*                                                                                                                                                     */
10599 +/****************************************************************************/
10600 +
10601 +#ifdef G992P1
10602 +#if defined(G992P1_ANNEX_I2X) || defined(G992P5) 
10603 +/* lke */
10604 +#define        kDslSamplingFreq                        4416000
10605 +#define        kDslMaxFFTSize                          1024    
10606 +#define        kDslMaxFFTSizeShift                     10
10607 +#elif defined(G992P1_ANNEX_I4X)
10608 +#define        kDslSamplingFreq                        8832000
10609 +#define        kDslMaxFFTSize                          2048    
10610 +#define        kDslMaxFFTSizeShift                     11
10611 +#elif defined(G992P1_ANNEX_I8X)
10612 +#define        kDslSamplingFreq                        17664000
10613 +#define        kDslMaxFFTSize                          4096    
10614 +#define        kDslMaxFFTSizeShift                     12
10615 +#else
10616 +#define        kDslSamplingFreq                        2208000
10617 +#define        kDslMaxFFTSize                          512
10618 +#define        kDslMaxFFTSizeShift                     9
10619 +#endif
10620 +#else
10621 +#define        kDslSamplingFreq                        1104000
10622 +#define        kDslMaxFFTSize                          256
10623 +#define        kDslMaxFFTSizeShift                     8
10624 +#endif
10625 +
10626 +#if defined(G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ)
10627 +#define kDslATURUpstreamSamplingFreq    276000
10628 +#define        kDslATURFFTSizeShiftUpstream    6
10629 +#elif defined(G992_ATUR_UPSTREAM_SAMPLING_FREQ_552KHZ)
10630 +#define kDslATURUpstreamSamplingFreq    552000
10631 +#define        kDslATURFFTSizeShiftUpstream    7
10632 +#else
10633 +#define kDslATURUpstreamSamplingFreq    kDslSamplingFreq
10634 +#define        kDslATURFFTSizeShiftUpstream    kDslMaxFFTSizeShift
10635 +#endif 
10636 +
10637 +#if defined(G992_ATUC_UPSTREAM_SAMPLING_FREQ_276KHZ)
10638 +#define kDslATUCUpstreamSamplingFreq    276000
10639 +#define        kDslATUCFFTSizeShiftUpstream    6
10640 +#elif defined(G992_ATUC_UPSTREAM_SAMPLING_FREQ_552KHZ)
10641 +#define kDslATUCUpstreamSamplingFreq    552000
10642 +#define        kDslATUCFFTSizeShiftUpstream    7
10643 +#else
10644 +#define kDslATUCUpstreamSamplingFreq    kDslSamplingFreq
10645 +#define        kDslATUCFFTSizeShiftUpstream    kDslMaxFFTSizeShift
10646 +#endif 
10647 +
10648 +#define        kDslMaxSamplesPerSymbol         (kDslMaxFFTSize+kDslMaxFFTSize/16)
10649 +
10650 +#if defined(G992P1_ANNEX_I) || defined(G992P5)
10651 +#define kDslMaxTEQLength               32
10652 +#else
10653 +#define kDslMaxTEQLength               16
10654 +#endif
10655 +
10656 +#define        kDslMaxSymbolBlockSize          1
10657 +#define        kDslMaxSampleBlockSize          (kDslMaxSymbolBlockSize*kDslMaxSamplesPerSymbol)
10658 +
10659 +#ifdef G992_ANNEXC
10660 +#define        kG992AnnexCXmtToRcvPathDelay    512   /* In samples at kDslSamplingFreq */
10661 +#endif
10662 +
10663 +/*** For compatibility with existing test codes ***/
10664 +#if !defined(TARG_OS_RTEMS)
10665 +typedef dslStatusCode                          modemStatusCode;
10666 +typedef        dslStatusStruct                         modemStatusStruct;
10667 +typedef        dslStatusHandlerType            statusHandlerType;
10668 +typedef dslCommandCode                         modemCommandCode;
10669 +typedef        dslCommandStruct                        modemCommandStruct;
10670 +typedef        dslCommandHandlerType           commandHandlerType;
10671 +#endif
10672 +
10673 +extern void            SM_DECL SoftDslSetRefData       (void *gDslVars, ulong refData);
10674 +extern ulong   SM_DECL SoftDslGetRefData       (void *gDslVars);
10675 +extern int             SM_DECL SoftDslGetMemorySize(void);
10676 +extern void            SM_DECL SoftDslInit                     (void *gDslVars);
10677 +extern void            SM_DECL SoftDslReset            (void *gDslVars);
10678 +extern void            SM_DECL SoftDslLineHandler      (void *gDslVars, int rxNSamps, int txNSamps, short *rcvPtr, short *xmtPtr) FAST_TEXT;
10679 +extern Boolean SM_DECL SoftDslCommandHandler (void *gDslVars, dslCommandStruct *cmdPtr);
10680 +
10681 +/* swap Lmem functions */
10682 +#if defined(bcm47xx) && defined(SWAP_LMEM)
10683 +extern int SoftDslSwapLmem(void *gDslVars, int sectionN, int imageN);
10684 +extern void init_SoftDslSwapLmem(void);
10685 +#endif
10686 +
10687 +/* SoftDsl time functions      */
10688 +
10689 +extern ulong   SM_DECL SoftDslGetTime(void *gDslVars);
10690 +#define                        __SoftDslGetTime(gv)            gDslGlobalVarPtr->execTime
10691 +
10692 +extern void            SM_DECL SoftDslTimer(void *gDslVars, ulong timeMs);
10693 +
10694 +/* SoftDsl IO functions        */
10695 +
10696 +extern void            SM_DECL SoftDslClose (void *gDslVars);
10697 +extern int             SM_DECL SoftDslSendFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
10698 +extern int             SM_DECL SoftDslReturnFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
10699 +
10700 +/* SoftDsl connection functions        */
10701 +
10702 +extern void*   SM_DECL SoftDslVcAllocate(void *gDslVars, dslVcParams *pVcParams);
10703 +extern void    SM_DECL SoftDslVcFree(void *gDslVars, void *pVc);
10704 +extern Boolean SM_DECL SoftDslVcActivate(void *gDslVars, void *pVc);
10705 +extern  void   SM_DECL SoftDslVcDeactivate(void *gDslVars, void *pVc);
10706 +extern  Boolean SM_DECL SoftDslVcConfigure(void *gDslVars, void *pVc, ulong mid, dslVcParams *pVcParams);
10707 +
10708 +/* Special functions for LOG support */
10709 +
10710 +extern  ulong  SM_DECL SoftDslVc2Id(void *gDslVars, void *pVc);
10711 +extern  void*  SM_DECL SoftDslVcId2Vc(void *gDslVars, ulong vcId);
10712 +extern void*   SM_DECL SoftDslGetFramePool(void *gDslVars);
10713 +
10714 +/* Functions for host mode execution */
10715 +
10716 +extern  void*   SM_DECL SoftDslRxCellHeaderHandler (void *gDslVars, ulong hdr, uchar hdrHec);
10717 +extern void*   SM_DECL SoftDslRxCellDataHandler (void *gDslVars, int,  void*);
10718 +extern  void*  SM_DECL SoftDslTxCellHandler    (void *gDslVars, int*,  void*);
10719 +extern  Boolean        SM_DECL SoftDslPhyCommandHandler (void *gDslVars, dslCommandStruct *cmdPtr);
10720 +
10721 +/* Functions getting OEM parameters including G994 non standard info management */
10722 +
10723 +extern char*   SM_DECL SoftDslGetTrainingVendorIDString(void *gDslVars);
10724 +extern char*   SM_DECL SoftDslGetVendorIDString(void *gDslVars);
10725 +extern char*   SM_DECL SoftDslGetSerialNumberString(void *gDslVars);
10726 +extern char*   SM_DECL SoftDslGetRevString(void *gDslVars);
10727 +extern int             SM_DECL SoftDslRevStringSize(void *gDslVars);
10728 +extern int             SM_DECL SoftDslSerNumStringSize(void *gDslVars);
10729 +                                                          
10730 +extern  void*  SM_DECL SoftDslGetG994p1RcvNonStdInfo(void *gDslVars, ulong *pLen);
10731 +extern  void*  SM_DECL SoftDslGetG994p1XmtNonStdInfo(void *gDslVars, ulong *pLen);
10732 +
10733 +#ifdef G997_1_FRAMER
10734 +
10735 +/* G997 functions */
10736 +
10737 +extern int             SM_DECL SoftDslG997SendFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
10738 +extern int             SM_DECL SoftDslG997ReturnFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
10739 +
10740 +#endif
10741 +
10742 +#ifdef ADSL_MIB
10743 +extern void     *      SM_DECL SoftDslMibGetData (void *gDslVars, int dataId, void *pAdslMibData);
10744 +#endif
10745 +
10746 +#define        SoftDsl                                 SoftDslLineHandler
10747 +#define        kSoftDslMaxMemorySize   (32768*16384)
10748 +
10749 +/*
10750 + * Internal functions
10751 + */
10752 +
10753 +extern  void   SoftDslStatusHandler    (void *gDslVars, dslStatusStruct *status) FAST_TEXT;
10754 +extern  void   SoftDslInternalStatusHandler (void *gDslVars, dslStatusStruct *status);
10755 +
10756 +/*
10757 + *             DSL OS functions
10758 + */
10759 +
10760 +#ifdef DSL_OS
10761 +
10762 +#define        SoftDslIsBgAvailable(gDslVars)          (DSLOS_THREAD_INACTIVE == DslOsGetThreadState(&(gDslGlobalVarPtr->tcbDslBg)))
10763 +#define        SoftDslGetBgThread(gDslVars)            \
10764 +       ((DSLOS_THREAD_INACTIVE != DslOsGetThreadState(&(gDslGlobalVarPtr->tcbDslBg))) ? &gDslGlobalVarPtr->tcbDslBg : NULL)
10765 +#define        SoftDslBgStart(gDslVars, pFunc)         \
10766 +       DslOsCreateThread(&gDslGlobalVarPtr->tcbDslBg, DSLOS_PRIO_HIGHEST - 10, pFunc, gDslVars,        \
10767 +       WB_ADDR(gDslGlobalVarPtr->bgStack), sizeof(gDslGlobalVarPtr->bgStack))
10768 +#define        SoftDslBgStop(gDslVars)                         DslOsDeleteThread(&gDslGlobalVarPtr->tcbDslBg)
10769 +
10770 +#define        SoftDslEnterCritical()                          DslOsEnterCritical()
10771 +#define        SoftDslLeaveCritical(id)                        DslOsLeaveCritical(id)
10772 +
10773 +#else
10774 +
10775 +#define        SoftDslIsBgAvailable(gDslVars)          1
10776 +#define        SoftDslGetBgThread(gDslVars)            1
10777 +#define        SoftDslBgStart(gDslVars, pFunc)         (*pFunc)(gDslVars)
10778 +#define        SoftDslBgStop(gDslVars)
10779 +
10780 +#define        SoftDslEnterCritical()                          0
10781 +#define        SoftDslLeaveCritical(id)
10782 +
10783 +#endif
10784 +
10785 +/*
10786 + *             DSL frames and native frame functions
10787 + */
10788 +
10789 +DslFrameDeclareFunctions (DslFrameNative)
10790 +
10791 +/*
10792 + * These functions are for testing purpose, they are defined outside.
10793 + */
10794 +#ifdef STACK_SIZE_REQUIREMENT_TEST
10795 +extern void            StackSizeTestInitializeStackBeforeEntry(void);
10796 +extern void            StackSizeTestCheckStackAfterExit(void);
10797 +extern void            StackSizeTestBackupStack(void);
10798 +extern void            StackSizeTestRestoreStack(void);
10799 +#endif /* STACK_SIZE_REQUIREMENT_TEST */
10800 +
10801 +#ifdef NEC_NSIF_WORKAROUND
10802 +#define        SoftDslGetG994NsStatus(gDslVars)                        (gDslGlobalVarPtr->G994NsStatus)
10803 +#define        SoftDslGetG994NsFailCounter(gDslVars)               (gDslGlobalVarPtr->G994NsFailCounter)
10804 +#endif
10805 +
10806 +#endif /* SoftDslHeader */
10807 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModem.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModem.h
10808 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModem.h    1970-01-01 01:00:00.000000000 +0100
10809 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModem.h   2006-06-26 09:07:10.000000000 +0200
10810 @@ -0,0 +1,3128 @@
10811 +/*
10812 +<:copyright-broadcom 
10813
10814 + Copyright (c) 2002 Broadcom Corporation 
10815 + All Rights Reserved 
10816 + No portions of this material may be reproduced in any form without the 
10817 + written permission of: 
10818 +          Broadcom Corporation 
10819 +          16215 Alton Parkway 
10820 +          Irvine, California 92619 
10821 + All information contained in this document is Broadcom Corporation 
10822 + company private, proprietary, and trade secret. 
10823
10824 +:>
10825 +*/
10826 +/****************************************************************************
10827 + *
10828 + * SoftModem.h 
10829 + *
10830 + *
10831 + * Description:
10832 + *     This file contains the exported interface for SoftModem.c
10833 + *
10834 + *
10835 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
10836 + * Authors: Mark Gonikberg, Haixiang Liang.
10837 + *
10838 + * $Revision: 1.16 $
10839 + *
10840 + * $Id: SoftModem.h,v 1.16 2004/04/14 21:16:51 ilyas Exp $
10841 + *
10842 + * $Log: SoftModem.h,v $
10843 + * Revision 1.16  2004/04/14 21:16:51  ilyas
10844 + * Merged with the latest changes in ADSL driver
10845 + *
10846 + * Revision 1.15  2004/04/13 00:56:10  ilyas
10847 + * Merged the latest ADSL driver changes for RTEMS
10848 + *
10849 + * Revision 1.14  2004/04/13 00:16:59  ilyas
10850 + * Merged the latest ADSL driver changes
10851 + *
10852 + * Revision 1.13  2003/02/22 05:07:11  ilyas
10853 + * Added VendorID for T1.413 mode
10854 + *
10855 + * Revision 1.12  2002/10/03 19:34:24  ilyas
10856 + * Added size for EOC serial number register
10857 + *
10858 + * Revision 1.11  2002/09/07 01:37:22  ilyas
10859 + * Added support for OEM parameters
10860 + *
10861 + * Revision 1.10  2001/12/13 02:25:34  ilyas
10862 + * Added definitions for G997
10863 + *
10864 + * Revision 1.9  2001/11/30 05:56:34  liang
10865 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
10866 + *
10867 + * Revision 1.7.2.2  2001/11/27 02:32:05  liang
10868 + * Combine vendor ID, serial #, and version number into SoftModemVersionNumber.c.
10869 + *
10870 + * Revision 1.7.2.1  2001/10/03 01:44:10  liang
10871 + * Merged with codes from main tree (tag SoftDsl_2_18).
10872 + *
10873 + * Revision 1.8  2001/09/21 19:19:01  ilyas
10874 + * Minor fixes for VxWorks build
10875 + *
10876 + * Revision 1.7  2000/07/17 21:08:16  lkaplan
10877 + * removed global pointer
10878 + *
10879 + * Revision 1.6  2000/05/03 04:09:11  ilyas
10880 + * Added ID for ATM log data
10881 + *
10882 + * Revision 1.5  2000/04/01 01:07:44  liang
10883 + * Changed file names and some module names.
10884 + *
10885 + * Revision 1.4  2000/03/02 20:18:12  ilyas
10886 + * Added test status code for ATM VC finished
10887 + *
10888 + * Revision 1.3  1999/08/05 20:02:11  liang
10889 + * Merged with the softmodem top of the tree on 08/04/99.
10890 + *
10891 + * Revision 1.2  1999/01/27 22:19:08  liang
10892 + * Merge with SoftModem_3_1_02.
10893 + * Include SoftDsl.h conditionlly so that the test utilities from SoftModem
10894 + * can be used without major change. It can be merged easily to SoftModem.
10895 + *
10896 + * Revision 1.170  1998/12/22 00:52:52  liang
10897 + * Added auxFeatures bit kV8HoldANSamUntilDetCI. When it is set, ANSam won't be
10898 + * sent until CI is detected (normally ANSam will be sent after 200ms). This is
10899 + * useful in V34 half duplex fax mode.
10900 + *
10901 + * Revision 1.169  1998/12/19 04:46:52  mwg
10902 + * Added bits for fax/data calling tones
10903 + *
10904 + * Revision 1.168  1998/12/17 02:46:10  scott
10905 + * Removed overlay-related commands/statuses and added
10906 + * kSetTrainingDelayReductionCmd
10907 + *
10908 + * Revision 1.167  1998/12/12 03:17:42  scott
10909 + * Added overlay commands and statuses
10910 + *
10911 + * Revision 1.166  1998/12/02 05:34:23  mwg
10912 + * Fixed a problem with bong tone detection
10913 + *
10914 + * Revision 1.165  1998/11/26 00:22:44  yura
10915 + * Added two more log data types: modulatorInputData & modulatorOutputData
10916 + *
10917 + * Revision 1.164  1998/11/19 03:08:04  mwg
10918 + * Added kSetCallProgressParamsCmd
10919 + *
10920 + * Revision 1.163  1998/11/18 23:00:03  liang
10921 + * Added a separate command kLoopbackTestAutoRespEnableCmd to enable or disable
10922 + * the loopback test auto respond feature when the modem is already on-line.
10923 + *
10924 + * Revision 1.162  1998/11/13 20:50:21  scott
10925 + * SoftModemInternalStatusHandler is now SM_DECL as well
10926 + *
10927 + * Revision 1.161  1998/11/13 20:42:25  scott
10928 + * Added SM_DECL type to entrypoint functions
10929 + *
10930 + * Revision 1.160  1998/11/13 03:02:54  scott
10931 + * Added SoftModemTimer prototype.
10932 + * Also include V.8bis types if AT_COMMANDS_V8BIS is defined.
10933 + *
10934 + * Revision 1.159  1998/11/12 01:22:46  scott
10935 + * Increased number of AT registers to 46
10936 + *
10937 + * Revision 1.158  1998/11/05 22:35:18  yura
10938 + * Added two more S-registers
10939 + *
10940 + * Revision 1.157  1998/11/05 03:09:54  mwg
10941 + * Added kLapmRetryFailed to the list of LAPM errors
10942 + *
10943 + * Revision 1.156  1998/11/05 00:13:20  liang
10944 + * Add new connectionInfo status kLoopbackSelfTestNewErrs to report
10945 + * new bit errors whenever it happens.
10946 + *
10947 + * Revision 1.155  1998/11/04 07:11:33  mwg
10948 + * Moved declaration for SoftModemATPrintf() to SoftModem.h
10949 + *
10950 + * Revision 1.154  1998/10/29 07:24:49  mwg
10951 + * *** empty log message ***
10952 + *
10953 + * Revision 1.153  1998/10/15 02:09:37  luisgm
10954 + * added separate data rate mask for Flex to dataPumpCapabilities structure
10955 + *
10956 + * Revision 1.152  1998/10/14 00:12:15  scott
10957 + * Added kMnpOOBFrameCmd and command.frameSpec
10958 + *
10959 + * Revision 1.151  1998/10/09 02:19:22  luisgm
10960 + * added FlexV8bisStruct member to dataPumpCapabilities struc to store flex v8bis info, added define for kFlexSkipV8bis
10961 + *
10962 + * Revision 1.150  1998/10/06 19:36:33  mwg
10963 + * Limited 56K rates to 53K
10964 + *
10965 + * Revision 1.149  1998/10/03 03:43:38  ilyas
10966 + * Added status codes for Audio
10967 + *
10968 + * Revision 1.148  1998/10/01 02:03:17  mwg
10969 + * Added external pulse dialer option
10970 + *
10971 + * Revision 1.147  1998/09/30 01:44:26  mwg
10972 + * Added new functions SoftModemGetWriteBufferSize() & SoftModemGetReadBufferSize()
10973 + *
10974 + * Revision 1.146  1998/09/22 03:44:38  scott
10975 + * Added ALWAYS_LONG_ALIGN() macro
10976 + *
10977 + * Revision 1.145  1998/09/21 21:49:22  scott
10978 + * Added logDataCodes for mnpDecoder(Input/Output)Data
10979 + *
10980 + * Revision 1.144  1998/08/31 22:57:21  luisgm
10981 + * added constants for Flex data rates + kFlexEventTRN2AFinished
10982 + *
10983 + * Revision 1.143  1998/08/18 05:09:53  mwg
10984 + * Increased AT command buffer size to 128
10985 + *
10986 + * Revision 1.142  1998/08/18 03:45:54  ilyas
10987 + * Integrated Audio into V70 test
10988 + *
10989 + * Revision 1.141  1998/08/14 17:46:04  ilyas
10990 + * Integrated Audio and G729a
10991 + *
10992 + * Revision 1.140  1998/08/10 21:42:19  mwg
10993 + * Added space and mark parity
10994 + *
10995 + * Revision 1.139  1998/08/08 03:39:33  scott
10996 + * Moved the C6xDefs and PentiumDefs includes before the internal function
10997 + * prototypes (to permit their redefinitions)
10998 + *
10999 + * Revision 1.138  1998/08/07 20:37:27  yura
11000 + * Added new S-register for &T commands
11001 + *
11002 + * Revision 1.137  1998/08/01 05:22:09  mwg
11003 + * Implemented split memory model
11004 + *
11005 + * Revision 1.136  1998/07/22 02:12:22  liang
11006 + * Added self test mode for loopback test.
11007 + *
11008 + * Revision 1.135  1998/07/21 01:19:03  liang
11009 + * Changed loopback test command parameter interface to use regular modeSpec.
11010 + *
11011 + * Revision 1.134  1998/07/18 03:52:10  liang
11012 + * Added V54 loop 2 test for V22.
11013 + *
11014 + * Revision 1.133  1998/07/15 02:45:03  mwg
11015 + * Added new connection info code: kPCMSpectralShapingBits
11016 + *
11017 + * Revision 1.132  1998/07/15 00:18:48  liang
11018 + * Add special turn off command for V34 fax to handle different turn off procedures.
11019 + *
11020 + * Revision 1.131  1998/07/13 22:19:49  liang
11021 + * Add V8 CI detection status and ANSam disable aux feature.
11022 + *
11023 + * Revision 1.130  1998/07/08 17:09:13  scott
11024 + * Added USE_LONG_ALIGN; support for 6 and PentiumDefs.h files
11025 + *
11026 + * Revision 1.129  1998/07/03 23:28:13  mwg
11027 + * Added Fax Class 2 defines
11028 + *
11029 + * Revision 1.128  1998/07/03 23:17:33  mwg
11030 + * Insuread command/status structures are long aligned
11031 + *
11032 + * Revision 1.127  1998/06/23 16:48:01  mwg
11033 + * Fixed a longstanding problem typical for Win95 VxD: whenever new
11034 + * VxD is intalled the confuguration profile may not match the old one but
11035 + * since the crc is correct it is still being downloaded. To avoid the problem
11036 + * a crc for the version number was added to avoid confusion between profiles
11037 + * of different versions.
11038 + *
11039 + * Revision 1.126  1998/06/19 21:04:06  liang
11040 + * Add auxiliary feature bit kV90ServerNotDetSbarAfterJdbarFix.
11041 + *
11042 + * Revision 1.125  1998/06/11 22:48:14  liang
11043 + * Add kPCM28000bpsShift constant.
11044 + *
11045 + * Revision 1.124  1998/06/05 22:11:51  liang
11046 + * New V90 DIL works through data mode.
11047 + *
11048 + * Revision 1.123  1998/06/01 23:03:41  liang
11049 + * Add v90RcvdDilDiffData logging.
11050 + *
11051 + * Revision 1.122  1998/06/01 21:24:38  mwg
11052 + * Changed some of the names.
11053 + *
11054 + * Revision 1.121  1998/05/13 04:55:22  mwg
11055 + * Now passing the number of spectral shaping bits in aux features
11056 + *
11057 + * Revision 1.120  1998/05/13 02:53:13  liang
11058 + * Add field "value" to command param structure.
11059 + *
11060 + * Revision 1.119  1998/05/12 04:42:23  mwg
11061 + * Replaced some of the status messages
11062 + *
11063 + * Revision 1.118  1998/05/11 23:36:10  mwg
11064 + * Added 8000Hz symbol rate to the map
11065 + *
11066 + * Revision 1.117  1998/05/05 04:28:39  liang
11067 + * V90 works up to data mode first version.
11068 + *
11069 + * Revision 1.116  1998/04/21 09:36:45  mwg
11070 + * Fixed a few problems for 16Khz and added 32Khz.
11071 + *
11072 + * Revision 1.115  1998/04/17  22:33:54  liang
11073 + * Added V90 DIL for mu-law PCM.
11074 + *
11075 + * Revision 1.114  1998/04/15  22:36:39  mwg
11076 + * Added new parameters to kDialCmd to allow individual control of each
11077 + * DTMF group attenuation.
11078 + *
11079 + * Revision 1.113  1998/04/15 18:16:22  ilyas
11080 + * Integrated V.8bis and changed coding of LinkLayerType to bitMap
11081 + *
11082 + * Revision 1.112  1998/04/15 07:59:06  mwg
11083 + * Added new status codes for V.90
11084 + *
11085 + * Revision 1.111  1998/04/11 00:29:16  mwg
11086 + * Fixed the warnings which appeared when Irix builds were upgraded to
11087 + * gcc 2.8.1
11088 + *
11089 + * Revision 1.110  1998/04/11  00:25:01  ilyas
11090 + * More V.70 statuses
11091 + *
11092 + * Revision 1.109  1998/04/10 23:29:31  mwg
11093 + * Added new field to capabilities: dataRates56K
11094 + *
11095 + * Revision 1.108  1998/04/09 02:02:56  mwg
11096 + * Added status for Ja detection.
11097 + *
11098 + * Revision 1.107  1998/04/03 02:05:30  ilyas
11099 + * More V.70 commands added
11100 + *
11101 + * Revision 1.106  1998/04/02 06:15:39  mwg
11102 + * Added coding type (Mu-law/A-law) status reporting.
11103 + *
11104 + * Revision 1.105  1998/03/30 09:53:57  mwg
11105 + * Added definition for k56Flex modulation for future use.
11106 + *
11107 + * Revision 1.104  1998/03/27  17:56:09  ilyas
11108 + * Added definitions for V.70
11109 + *
11110 + * Revision 1.103  1998/03/26 23:29:04  liang
11111 + * Added first version of IMD estimation.
11112 + *
11113 + * Revision 1.102  1998/03/20  04:37:26  mwg
11114 + * Increased the size of the nominal variance to 32 bit.
11115 + *
11116 + * Revision 1.101  1998/03/06 01:22:04  yura
11117 + * Improved Win95 VxD segmentation handling
11118 + *
11119 + * Revision 1.100  1998/03/06  01:06:18  liang
11120 + * Add initial version of V90 phase 1 and 2.
11121 + *
11122 + * Revision 1.99  1998/03/05  23:42:22  mwg
11123 + * (hxl) Implemented enable/disable call waiting command.
11124 + *
11125 + * Revision 1.98  1998/02/26  06:13:06  mwg
11126 + * Increased the number of AT S-registers to account for newly introduced
11127 + * S9 and S10.
11128 + *
11129 + * Revision 1.97  1998/02/25  18:18:25  scott
11130 + * Added v42bisCycleCount for V42BIS_THROUGHPUT_CONTROL
11131 + *
11132 + * Revision 1.96  1998/02/24 05:31:20  mwg
11133 + * Added stuff required by international version of AT command processor.
11134 + *
11135 + * Revision 1.95  1998/02/17  01:14:10  scott
11136 + * Reenabled sys/types.h for Linux builds
11137 + *
11138 + * Revision 1.94  1998/02/16 22:32:23  scott
11139 + * Changed copyright notice
11140 + *
11141 + * Revision 1.93  1998/02/16 22:17:44  scott
11142 + * Turned off include of sys/types.h for normal builds
11143 + *
11144 + * Revision 1.92  1998/02/16 21:53:28  scott
11145 + * Exclude sys/types.h for another compiler
11146 + *
11147 + * Revision 1.91  1998/02/09 18:24:10  scott
11148 + * Fixed ComplexShort type to work around bugs in MS and GreenHill compilers
11149 + *
11150 + * Revision 1.90  1998/01/27 01:37:36  mwg
11151 + * Added new log identifier for pcm infidelity data.
11152 + *
11153 + * Revision 1.89  1998/01/22  19:49:32  liang
11154 + * Add auxFeature bit kFaxV34HDXAllowAsymCtrlChan.
11155 + *
11156 + * Revision 1.88  1998/01/21  02:32:01  liang
11157 + * Add more V34 half duplex training progress codes.
11158 + *
11159 + * Revision 1.87  1997/12/23  03:28:25  liang
11160 + * Add more half duplex V34 related constants.
11161 + *
11162 + * Revision 1.86  1997/12/18  19:38:50  scott
11163 + * Added agcData log type.
11164 + * Added kDisableFaxFastClearDown demod capability
11165 + *
11166 + * Revision 1.85  1997/12/18 06:02:45  mwg
11167 + * Added a function to reenable DC offset tracking.
11168 + *
11169 + * Revision 1.84  1997/12/17  22:46:30  mwg
11170 + * Minor modifications to X2 escape status reporting.
11171 + *
11172 + * Revision 1.83  1997/12/16  06:49:45  mwg
11173 + * Implemented proper data rate reporting for PCM modem.
11174 + *
11175 + * Revision 1.82  1997/12/13  06:11:08  mwg
11176 + * Added X2 interface hooks
11177 + *
11178 + * Revision 1.81  1997/12/02 06:21:33  mwg
11179 + * Implemented kSetATRegister command.
11180 + *
11181 + * Revision 1.80  1997/11/27  02:11:41  liang
11182 + * Add code for half duplex V34 control channel.
11183 + *
11184 + * Revision 1.79  1997/11/19  19:52:48  guy
11185 + * Added constant to define V.34 half duplex operation
11186 + *
11187 + * Revision 1.78  1997/10/24 05:15:53  scott
11188 + * Added AGC and phase hit recovery to demodCapabilities
11189 + *
11190 + * Revision 1.77  1997/10/01 02:47:50  liang
11191 + * Add PCM interface.
11192 + *
11193 + * Revision 1.76  1997/09/29  15:48:04  yura
11194 + * Added #pragma statement for W95 Vxd
11195 + *
11196 + * Revision 1.75  1997/09/18 20:32:39  scott
11197 + * Do not include VxD support files if GENERATE_DEPENDENCIES is defined.
11198 + *
11199 + * Revision 1.74  1997/09/18 12:40:55  yura
11200 + * Removed #ifdef statments to be more robust
11201 + *
11202 + * Revision 1.73  1997/09/17 17:32:41  scott
11203 + * Do not include sys/types.h for 6
11204 + *
11205 + * Revision 1.72  1997/08/08 00:53:48  mwg
11206 + * Added fields for LAP-M frames printout.
11207 + * Added fields in auxFeatures to pass preemphasis filter parameters
11208 + * to V.34 phase 3 when doing PTT testing.
11209 + *
11210 + * Revision 1.71  1997/08/06  03:41:45  yura
11211 + * Added a few includes and defines needed by Win 95 driver.
11212 + *
11213 + * Revision 1.70  1997/08/05  03:22:10  liang
11214 + * Add equalizer center tap adjustment calculation related constants.
11215 + *
11216 + * Revision 1.69  1997/07/29  02:44:19  mwg
11217 + * Added new field to dataPumpCapabilities structure. This field is not
11218 + * yet exposed to external interface and currently is only used to
11219 + * enable PTT testing.
11220 + * Added new commands: kStartDataModemPTTTestCmd & kStartDataModemLoopbackTestCmd
11221 + *
11222 + * Revision 1.68  1997/07/22  22:05:10  liang
11223 + * Change sample rate setup as a normal command.
11224 + *
11225 + * Revision 1.67  1997/07/21  23:23:30  liang
11226 + * Define SoftModemSetSampleRate as null when SAMPLE_RATE_CONVERSION is not defined.
11227 + *
11228 + * Revision 1.66  1997/07/21  22:38:36  liang
11229 + * Change sample rate converter structure so that sample rate can be changed
11230 + * on the fly (at very begining) to either 8KHz or 9600Hz.
11231 + *
11232 + * Revision 1.65  1997/07/21  20:22:01  mwg
11233 + * Added statusInfoData to the log identifiers.
11234 + *
11235 + * Revision 1.64  1997/07/16  20:40:07  scott
11236 + * Added multitone monitor fields
11237 + *
11238 + * Revision 1.63  1997/07/10 02:31:08  mwg
11239 + * 1. Added kRxFrameHDLCFlags detected status for the
11240 + *    framingInfo.
11241 + * 2. Added kLapmMNPFrameDetected status to lapmStatusCode.
11242 + * 3. Increased the number of AT registers to 35
11243 + * 4. Modified LinkLayerSpec structure in modemCommandStruc
11244 + *    to provide the initial values of rxDataRate &
11245 + *    txDataRate and RT delay for the cases when
11246 + *    link layer is started *after* the data connection
11247 + *    is established and the status snooper is unable
11248 + *    to determine the rates and RT delay.
11249 + * 5. Added a few extra *empty* constant definitions for
11250 + *    disabled features.
11251 + *
11252 + * Revision 1.62  1997/07/02  19:15:05  scott
11253 + * Added bits for Bel103 & Bel212 modulations.
11254 + *
11255 + * Revision 1.61  1997/07/02 05:15:16  mwg
11256 + * Added MNP code.
11257 + *
11258 + * Revision 1.60  1997/07/01  23:52:48  mwg
11259 + * Modified the record test setup to log and use all the commands.
11260 + *
11261 + * Revision 1.59  1997/06/25  19:11:26  mwg
11262 + * 1. Added new framingInfoCode values for Async framing error reporting;
11263 + * 2. Added a substructure to pass serial data format for kSetDTERate cmd;
11264 + *
11265 + * Revision 1.58  1997/05/28  02:05:08  liang
11266 + * Add PCM modem phase 2 codes.
11267 + *
11268 + * Revision 1.57  1997/05/12  21:55:08  liang
11269 + * Add call waiting tone detector module.
11270 + *
11271 + * Revision 1.56  1997/03/21  23:50:08  liang
11272 + * Added initial version of V8bis module to CVS tree.
11273 + *
11274 + * Revision 1.55  1997/03/19  18:35:05  mwg
11275 + * Changed copyright notice.
11276 + *
11277 + * Revision 1.54  1997/03/11  11:11:45  mwg
11278 + * Added code to report V42bis statistics.
11279 + *
11280 + * Revision 1.53  1997/03/04  06:21:08  mwg
11281 + * Added logging of most commands.
11282 + *
11283 + * Revision 1.52  1997/02/28  23:45:13  liang
11284 + * Added training progress status report kPhaseJitterDeactivated.
11285 + *
11286 + * Revision 1.51  1997/02/28  22:23:22  mwg
11287 + * Implemented the following features:
11288 + * - Cleardown for fax modulations V.27, V.29 V.17
11289 + * - Rockwell compatible bitmap report (needed by a customer)
11290 + *
11291 + * Revision 1.50  1997/02/28  03:05:31  mwg
11292 + * Added more logging data types.
11293 + *
11294 + * Revision 1.49  1997/02/27  05:28:58  mwg
11295 + * Added RxFrameOK report.
11296 + *
11297 + * Revision 1.48  1997/02/27  01:48:53  liang
11298 + * Add kV8MenuDataWord1 and kV8MenuDataWord2 connectionInfo status.
11299 + *
11300 + * Revision 1.47  1997/02/24  02:30:27  mwg
11301 + * Added new log  data: predictorErrData
11302 + *
11303 + * Revision 1.46  1997/02/22  03:00:22  liang
11304 + * Add echoCancelledSignalData.
11305 + *
11306 + * Revision 1.45  1997/02/21  01:26:42  liang
11307 + * Add six more bits for the Demodulator capabilities to deal with 2nd order
11308 + * time tracking & PLLs, as well as shorter NEEC & PFEEC, and front end HBF.
11309 + *
11310 + * Revision 1.44  1997/02/17  03:09:00  mwg
11311 + * Added LAPM statistics printout.
11312 + *
11313 + * Revision 1.43  1997/02/04  08:38:47  mwg
11314 + * Added dc cancelled samples printout.
11315 + *
11316 + * Revision 1.42  1997/01/29  21:40:28  mwg
11317 + * Changed the way timers work: now time is passed as Q4 ms instead of ticks.
11318 + * Completed the 8KHz front end implementation.
11319 + * Got rid of kSamplesPerSecond constant.
11320 + *
11321 + * Revision 1.41  1997/01/24  07:13:50  mwg
11322 + * Added new statuses for automoder.
11323 + *
11324 + * Revision 1.40  1997/01/23  02:03:08  mwg
11325 + * Replaced old sample rate conversion with the newer one.
11326 + * Still has to resolve the automoding issue.
11327 + *
11328 + * Revision 1.39  1997/01/21  00:55:04  mwg
11329 + * Added 8KHz front end functionality.
11330 + *
11331 + * Revision 1.38  1996/11/13  00:30:55  liang
11332 + * Add kAutoLoadReductionEnabled to demodCapabilities so that PFEEC, FEEC, IEEC
11333 + * can be disabled automatically, but for worst processor loading test they
11334 + * won't be disabled when this bit is not set.
11335 + *
11336 + * Revision 1.37  1996/11/07  23:07:18  mwg
11337 + * Rearranged global variables to allow V.17 short training.
11338 + *
11339 + * Revision 1.36  1996/09/17  23:55:05  liang
11340 + * Change kMaxDataBlockSize from 16 to 24 to handle high data rates.
11341 + *
11342 + * Revision 1.35  1996/09/05  19:43:39  liang
11343 + * Removed caller ID error status code kCallerIDUnknownMessageType, and
11344 + * added caller ID status codes kCallerIDUnknownMessage & kCallerIDWholeMessage.
11345 + * Changed the callerIDStatus report structure.
11346 + *
11347 + * Revision 1.34  1996/08/29  00:36:57  liang
11348 + * Added kLapmTxFrameStatus and kLapmRxFrameStatus.
11349 + *
11350 + * Revision 1.33  1996/08/27  22:56:01  liang
11351 + * Added kResetHardware status code.
11352 + *
11353 + * Revision 1.32  1996/08/23  23:35:35  liang
11354 + * Add kATDebugStatus and function SoftModemGetHybridDelay.
11355 + *
11356 + * Revision 1.31  1996/08/22  01:13:19  yg
11357 + * Added AT command processor.
11358 + *
11359 + * Revision 1.30  1996/08/12  21:46:47  mwg
11360 + * Added code to report capabilities.
11361 + *
11362 + * Revision 1.29  1996/08/10  01:59:59  mwg
11363 + * Added report of the sent rate sequence;
11364 + *
11365 + * Revision 1.28  1996/08/07  22:15:02  mwg
11366 + * Added new status reports:
11367 + * kRemoteFreqOffset
11368 + * kIEECDeactivated
11369 + * kPFEECDeactivated
11370 + *
11371 + * Revision 1.27  1996/06/27  05:15:48  mwg
11372 + * Added V.24 circuit status.
11373 + *
11374 + * Revision 1.26  1996/06/27  02:12:43  mwg
11375 + * Cleaned the code.
11376 + *
11377 + * Revision 1.25  1996/06/20  23:57:30  mwg
11378 + * Added new training progress status.
11379 + *
11380 + * Revision 1.24  1996/06/18  21:13:50  mwg
11381 + * Added trellis MSE data logging.
11382 + *
11383 + * Revision 1.23  1996/06/12  02:31:10  mwg
11384 + * Added new type: VeryLong
11385 + *
11386 + * Revision 1.22  1996/06/08  22:15:39  mwg
11387 + * Added new status report: kCleardownStarted
11388 + * Added new field for the features: kV34bisEnabled
11389 + *
11390 + * Revision 1.21  1996/05/31  00:29:11  liang
11391 + * Add feature bit kV34ExtraINFOPreamble.
11392 + *
11393 + * Revision 1.20  1996/05/30  23:28:31  mwg
11394 + * Replaced enums with #defines
11395 + *
11396 + * Revision 1.19  1996/05/25  00:38:27  mwg
11397 + * Added kProjectedDataRate training progress report.
11398 + *
11399 + * Revision 1.18  1996/05/24  23:27:15  mwg
11400 + * Added mode status codes.
11401 + *
11402 + * Revision 1.17  1996/05/10  05:39:59  liang
11403 + * Move the includes for DEBUG inside "ifndef SoftModemTypes" so that
11404 + * cap build won't break.
11405 + *
11406 + * Revision 1.16  1996/05/08  01:49:34  mwg
11407 + * Added capability to setup auxiliary data channel handlers.
11408 + *
11409 + * Revision 1.15  1996/05/07  22:51:08  liang
11410 + * Added group delay estimation and improved symbol rate selection process.
11411 + *
11412 + * Revision 1.14  1996/05/06  06:49:09  mwg
11413 + * Fixed linux problems.
11414 + *
11415 + * Revision 1.13  1996/05/02  08:40:16  mwg
11416 + * Merged in Chromatic bug fixes.
11417 + *
11418 + * Revision 1.12  1996/05/02  02:26:21  mwg
11419 + * Added code to implement dozing functionality for v.34.
11420 + *
11421 + * Revision 1.11  1996/05/01  22:43:13  mwg
11422 + * Added new command: kDozeCmd;
11423 + *
11424 + * Revision 1.10  1996/05/01  19:20:16  liang
11425 + * Add command codes kInitiateRetrainCmd and kInitiateRateRenegotiationCmd.
11426 + *
11427 + * Revision 1.9  1996/04/25  01:12:37  mwg
11428 + * Added new flag: rapid preliminary EC training.
11429 + *
11430 + * Revision 1.8  1996/04/20  02:26:22  mwg
11431 + * Added preliminary far-end echo support
11432 + *
11433 + * Revision 1.7  1996/04/15  23:26:16  mwg
11434 + * Changed flag definitions for v34 modem.
11435 + *
11436 + * Revision 1.6  1996/04/04  02:35:50  liang
11437 + * Change kCid from 0x0080 to 0x0004 (0x0080 is defined as kV32).
11438 + *
11439 + * Revision 1.5  1996/03/08  23:07:01  mwg
11440 + * Added name for the struct.
11441 + *
11442 + * Revision 1.4  1996/03/02  00:59:27  liang
11443 + * Added typedef for V34CodingParameters structure.
11444 + *
11445 + * Revision 1.3  1996/02/27  02:28:31  mwg
11446 + * Fixed a bug in kLapmLongADPEnabled definition.
11447 + *
11448 + * Revision 1.2  1996/02/19  23:50:59  liang
11449 + * Removed compressionSetup parameter from the link layer command structure.
11450 + *
11451 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
11452 + * Redesigned the project directory structure. Merged V.34 into the project.
11453 + *
11454 + * Revision 1.5  1996/01/15  23:26:04  liang
11455 + * Change the softmodem command structure name from SoftwareModemCommand
11456 + * to SoftwareModemCommandParameters.
11457 + *
11458 + *****************************************************************************/
11459 +#ifndef        SoftModemPh
11460 +#define        SoftModemPh
11461 +
11462 +/****************************************************************************/
11463 +/*     1.      Type definitions.                                                                                                       */
11464 +/*                                                                                                                                                     */
11465 +/*     1.1     General types                                                                                                           */
11466 +/****************************************************************************/
11467 +
11468 +#ifndef SM_DECL
11469 +#define SM_DECL
11470 +#endif
11471 +
11472 +#ifdef __VxWORKS__
11473 +#include <types/vxTypesOld.h>
11474 +#endif
11475 +
11476 +#ifdef DEBUG
11477 +/* We have to define __wchar_t for Linux       */
11478 +#if defined __linux__ && !defined _NO_WHCAR_DEF_
11479 +typedef        long int __wchar_t;
11480 +#endif
11481 +#if !defined(__KERNEL__) && !defined(_CFE_)
11482 +#include <stdio.h>
11483 +#include <stdlib.h>
11484 +#endif
11485 +
11486 +#if defined(__linux__) || defined (__unix__) || defined (__unix) || (defined (__mips__) && !defined(_CFE_) && !defined(VXWORKS) && !defined(TARG_OS_RTEMS))/* enable if necessary, but not for dos-based builds */
11487 +#include <linux/types.h>
11488 +#endif
11489 +
11490 +
11491 +#endif /* DEBUG */
11492 +
11493 +#if defined(W95_DRIVER) 
11494 +#pragma code_seg("_LTEXT", "LCODE")
11495 +#pragma data_seg("_LDATA", "LCODE")
11496 +#pragma const_seg("_LDATA", "LCODE")
11497 +#pragma bss_seg("_LDATA", "LCODE")
11498 +#pragma pack(1)
11499 +#endif /* W95_DRIVER */
11500 +
11501 +#ifndef SoftModemTypes
11502 +#include "SoftModemTypes.h"
11503 +#endif /* SoftModemTypes */
11504 +
11505 +
11506 +typedef struct
11507 +       {
11508 +       schar x, y;
11509 +       } ComplexByte;
11510 +
11511 +typedef struct
11512 +       {
11513 +       uchar numerator;
11514 +       uchar denominator;
11515 +       } Ratio;
11516 +
11517 +#ifdef PEGASUS
11518 +typedef union
11519 +       {
11520 +       struct
11521 +               {
11522 +               short x, y;
11523 +               };
11524 +       
11525 +       long foo;
11526 +       } ComplexShort;
11527 +#else
11528 +typedef struct
11529 +       {
11530 +       short x, y;
11531 +#ifdef GREENHILL
11532 +    long a[0];
11533 +#endif
11534 +       } ComplexShort;
11535 +#endif
11536 +
11537 +typedef struct
11538 +       {
11539 +       long x, y;
11540 +       } ComplexLong;
11541 +
11542 +typedef struct
11543 +       {
11544 +       ushort  x0, x1, x2;
11545 +       short   x3;
11546 +       } VeryLong;
11547 +
11548 +typedef union
11549 +       {
11550 +       struct
11551 +               {
11552 +               uchar number;
11553 +               uchar defaultValue;                     /* default value */                     
11554 +               uchar maxValue;                 /* max allowed value */
11555 +               uchar minValue;                 /* should be greater then maxValue to make reg readonly */
11556 +               } param;
11557 +       long alignment;
11558 +       } SRegisterDefinition;
11559 +
11560 +#define MacroPaste2(a,b) a##b
11561 +#define MacroPaste(a,b) MacroPaste2(a,b)
11562 +#define ALWAYS_LONG_ALIGN() long MacroPaste(ALIGNMENT,__LINE__);
11563 +
11564 +#ifdef USE_LONG_ALIGN
11565 +#define LONG_ALIGN() ALWAYS_LONG_ALIGN()
11566 +#else
11567 +#define LONG_ALIGN()
11568 +#endif
11569 +
11570 +typedef        ulong   bitMap;
11571 +
11572 +typedef        int     pace;
11573 +#define kStop          0
11574 +#define kVerySlow      1
11575 +#define kSlow          2
11576 +#define kMedium                3
11577 +#define kFast          4
11578 +
11579 +
11580 +/****************************************************************************/
11581 +/*     1.      Type definitions.                                                                                                       */
11582 +/*                                                                                                                                                     */
11583 +/*     1.2     Modem specific types                                                                                            */
11584 +/****************************************************************************/
11585 +
11586 +typedef        long directionType;
11587 +#define kXmt   0
11588 +#define kRcv   1
11589 +#define kXmtRcv        2
11590 +
11591 +
11592 +#define        originating             kXmt
11593 +#define        answering               kRcv
11594 +#define        kOrg                    kXmt
11595 +#define        kAns                    kRcv
11596 +#define        kOrgAns                 kXmtRcv
11597 +
11598 +#define        ORIGINATING             originating
11599 +#define        ANSWERING               answering
11600 +
11601 +typedef        int     pcmCodingType;
11602 +#define        kMuLawPCM       0
11603 +#define        kALawPCM        1
11604 +
11605 +#define        kMuLawPCMScaleShift             2
11606 +#define        kALawPCMScaleShift              3
11607 +
11608 +/* link layer and framer share defines */
11609 +typedef        bitMap  framerType;
11610 +typedef        bitMap  linkLayerType;
11611 +#define kNoFramer      0
11612 +#define kSync          0x00000001
11613 +#define kAsync         0x00000002
11614 +#define kHDLC          0x00000004
11615 +#define kLapm          0x00000008
11616 +#define kMnp           0x00000010
11617 +#define kV70           0x00000020
11618 +#define kSAM           0x00000040
11619 +
11620 +       
11621 +typedef        bitMap  modulationMap;
11622 +typedef        bitMap  symbolRateMap;
11623 +typedef        bitMap  dataRateMap;
11624 +typedef        bitMap  featureMap;
11625 +typedef        bitMap  breakType;
11626 +
11627 +typedef        bitMap  audioType;
11628 +#define        kRawAudio               0
11629 +#define        kAudioG729A             1
11630 +#define        kAudioG729              2
11631 +#define        kAudioG723              3
11632 +
11633 +
11634 +#ifndef ADSL_MODEM
11635 +typedef long   modemStatusCode;
11636 +#endif
11637 +       /* Information status Codes: 1-31               */
11638 +#define kSetSampleRate                         1
11639 +#define kModulationKnown                       2
11640 +#define kRxSymbolRate                          3
11641 +#define kTxSymbolRate                          4
11642 +#define kRxCarrierFreq                         5
11643 +#define kTxCarrierFreq                         6
11644 +#define kTxPreemphasisFilter           7
11645 +#define kTxPowerAdjustment                     8
11646 +#define kRemoteTxPreemphasisFilter     9
11647 +#define kRemoteTxPowerAdjustment       10
11648 +#define kRxRateKnown                           11
11649 +#define kTxRateKnown                           12
11650 +#define kRxDataModeActive                      13
11651 +#define kTxDataModeActive                      14
11652 +#define kTxSignalCompleted                     15
11653 +#define kDTMFSignalDetected                    16
11654 +#define kModemSignalDetected           17
11655 +#define kCallProgressSignalDetected    18
11656 +#define kCustomSignalDetected          19
11657 +#define kFaxPreambleDetected           20
11658 +#define kV24CircuitStatusChange                21
11659 +#define kHookStateChange                       22
11660 +#define kCallWaitingToneDetected       23
11661 +#define kMultiToneSignalDetected       24
11662 +#define kPulseShuntStateChange         25
11663 +#define kRingFrequency              26
11664 +
11665 +
11666 +       /* Warning status Codes:                32-64   */
11667 +#define kError                                         32
11668 +#define kV34Exception                          33
11669 +#define kClearDownLocal                                34
11670 +#define kClearDownRemote                       35
11671 +#define kCarrierPresent                                36
11672 +#define kCarrierLost                           37
11673 +#define kRetrainingLocal                       38
11674 +#define kRetrainingRemote                      39
11675 +#define kRateRenegotiationLocal                40
11676 +#define kRateRenegotiationRemote       41
11677 +#define kFallbackStarted                       42
11678 +#define kFallForwardStarted                    43
11679 +#define kCleardownStarted                      44
11680 +#define kIllegalCommand                                45
11681 +       
11682 +       /* Auxiliary status Codes:      64-..   */      
11683 +#define kTrainingProgress                      64
11684 +#define kConnectionInfo                                65
11685 +#define kDialerStatus                          66
11686 +#define kFramingInfo                           67
11687 +#define kBreakReceived                         68
11688 +#define kLapmStatus                                    69
11689 +#define kLapmParameter                         70
11690 +#define kV42bisStatus                          71
11691 +#define kCallerIDStatus                                72
11692 +#define kIOStatus                                      73
11693 +#define kCapabilitiesStatus                    74
11694 +#define kSpeakerStatus                         75
11695 +#define kATProfileChanged                      76
11696 +#define kATDebugStatus                         77
11697 +#define        kResetHardware                          78
11698 +#define        kV8bisStatus                            79
11699 +#define kMnpStatus                                     80
11700 +#define kMnpParameter                          81
11701 +#define kV70Status                                     82
11702 +#define kV70Parameter                          83
11703 +#define kFaxClass2Status                       84
11704 +#define kAudioStatus                           85
11705 +#define kAudioParameter                                86
11706 +#define kOverlayStatus                         87
11707 +#define kCallerIDCircuitStatus         88
11708 +#define kV80Status                                     89
11709 +#define kV80Parameter                          90
11710 +#define kLocalCountryChanged           91
11711 +#define kDTERateChanged                                92
11712 +#define kATResponse                                    93
11713 +#define kFramerConfigured                      94
11714 +#define kA8RStatus                                     95
11715 +#define kA8TStatus                                     96
11716 +#define        kVersionStatus                          97
11717 +
11718 +       /* Testing status codes:        128-... */
11719 +       /* These statuses are generated by modem test suit      */
11720 +#define kTestFinished                          128
11721 +#define kConnectivityTestFinished      129
11722 +#define kTestCheckSum                          130
11723 +#define kLogFileControl                                131
11724 +#define kTestAtmVcFinished                     132
11725 +#define kTestClearEocFinished          133
11726 +#define kTestG997Finished                      134
11727 +
11728 +typedef long   modemErrorCode;
11729 +#define kNoError                               0
11730 +#define kErrorTimerExpired             1
11731 +#define kErrorNoSReceived              2
11732 +#define kErrorNoSbarReceived   3
11733 +
11734 +
11735 +typedef long   dialerStatusCode;
11736 +#define kDialCompleted                         0
11737 +#define kNoDialToneDetected                    1
11738 +#define kBongToneDetected                      2
11739 +#define kNoBongToneDetected                    3
11740 +#define kErrorIllegalDialModifier      5
11741 +#define kDialStarted                           6
11742 +#define kExternalPulseDialDigit                7
11743 +
11744 +
11745 +typedef long   framingInfoCode;
11746 +#define kRxFrameOK                                     0
11747 +#define kRxFrameTooLong                                1
11748 +#define kRxFrameCRCError                       2
11749 +#define kTxFrameUnderrun                       3
11750 +#define kRxFrameOverrun                                4
11751 +#define kRxFrameAborted                                5
11752 +#define kRxFrameParityError                    6
11753 +#define kRxFrameFormatError                    7
11754 +#define        kRxFrameHDLCFlagsDetected       8
11755 +
11756 +
11757 +typedef long   IOStatusCode;
11758 +#define kRxDataReady           0
11759 +#define kRxBufferOverflow      1
11760 +#define kTxSpaceAvailable      2
11761 +#define kTxBufferEmpty         3
11762 +
11763 +typedef long   capabilitiesStatusCode;
11764 +#define kSymbolRates                           0
11765 +#define kDataRates                                     1
11766 +#define kFeatures                                      2
11767 +#define kDemodCapabilities                     3
11768 +#define kRateThresholdAdjustment       4
11769 +#define kXmtLevel                                      5
11770 +#define kHybridDelay                           6
11771 +#define kAuxFeatures                           7
11772 +
11773 +
11774 +typedef long   A8TStatusCode;
11775 +#define kA8TFinished                           0
11776 +
11777 +typedef long   callerIDStatusCode;
11778 +#define kCallerIDError                                 0
11779 +#define kCallerIDChannelSeizureReceived        1
11780 +#define kCallerIDMarkSignalReceived            2
11781 +#define kCallerIDTime                                  3
11782 +#define kCallerIDTelnum                                        4
11783 +#define kCallerIDName                                  5
11784 +#define kCallerIDEnd                                   6
11785 +#define kCallerIDUnknownMessage                        7
11786 +#define kCallerIDWholeMessage                  8
11787 +
11788 +
11789 +typedef long   callerIDErrorCode;
11790 +#define kCallerIDNoError                       0
11791 +#define kCallerIDMarkSignalError       1
11792 +#define kCallerIDTooManyMarkBits       2
11793 +#define kCallerIDMessageTooLong                3
11794 +#define kCallerIDChecksumError         4
11795 +
11796 +
11797 +typedef long   connectionInfoCode;
11798 +#define kRTDelay                       1
11799 +#define kRxSignalLevel         2
11800 +#define kTimingOffset          3
11801 +#define kFreqOffset                    4
11802 +#define kPhaseJitter           5
11803 +#define kSNR                           6
11804 +#define kNearEchoLevel         7
11805 +#define kSER                           8
11806 +#define kNearEndDelay          9
11807 +#define kFarEchoLevel          10
11808 +#define kL1L2SNRDifference     11
11809 +#define        kDCOffset                       12
11810 +#define        kTotalRxPower           13
11811 +#define        kRemoteFreqOffset       14
11812 +/* obsolete    #define kV8MenuDataWord1        15 */
11813 +/* obsolete    #define kV8MenuDataWord2        16 */
11814 +#define        kPCMP2AnalogDetSNR      17
11815 +#define        kPCMP2DigitalDetSNR     18
11816 +#define        kPCMP2RBSDetSNR         19
11817 +#define        kEqCenterTapOffset      20
11818 +#define        kPCMPadValue            21
11819 +#define        kPCMRBSMap                      22
11820 +#define        kPCMCodingType          23
11821 +#define        kPCMSpectralShapingBits                 24
11822 +#define        kLoopbackSelfTestResult                 25
11823 +#define        kEyeQuality                                             26
11824 +#define        kLoopbackSelfTestNewErrs                27
11825 +#define kV34EqlLengthStatus 28
11826 +#define kV34EqlOffsetStatus 29
11827 +#define        kV8CallMenuData         30
11828 +#define        kV8JointMenuData        31
11829 +#define kPCMClientIeecLengthStatus 32
11830 +#define kPCMClientIeecOffsetStatus 33
11831 +#define        kSeamlessRateChange     34
11832 +
11833 +typedef long   trainingProgressCode;
11834 +#define kPeriodicalSignalDetected              0
11835 +#define kPhaseReversalDetected                 1
11836 +#define kSignalStartDetected                   2
11837 +#define kSignalEndDetected                             3
11838 +#define kSSignalDetected                               4
11839 +#define kSbarSignalDetected                            5
11840 +#define kJ4SignalDetected                              6
11841 +#define kJ16SignalDetected                             7
11842 +#define kJprimeSignalDetected                  8
11843 +#define kMPSignalDetected                              9
11844 +#define kMPprimeSignalDetected                 10
11845 +#define kMPSignalSent                                  11
11846 +#define kMPprimeSignalSent                             12
11847 +#define kRateSignalDetected                            13
11848 +#define kESignalDetected                               14
11849 +#define kRateSignalSent                                        15
11850 +
11851 +#define        kAutomodingTryModulation                16
11852 +#define        kAutomodingCompleted                    17
11853 +#define        kRCFaxBitMapStatus                              18
11854 +       
11855 +#define kV8CIDetected                                  19
11856 +#define kV8ANSToneDetected                             20
11857 +#define kV8ANSamDetected                               21
11858 +#define kV8CMDetected                                  22
11859 +#define kV8JMDetected                                  23
11860 +#define kV8CJDetected                                  24
11861 +#define kV8Finished                                            25
11862 +       
11863 +#define kV34Phase2Started                              26
11864 +#define kV34Phase2INFOSequenceDetected 27
11865 +#define kV34Phase2NearEndEchoDetected  28
11866 +#define kV34Phase2L1Receiving                  29
11867 +#define kV34Phase2L2Receiving                  30
11868 +#define kV34Phase2Finished                             31
11869 +#define kV34Phase3Started                              32
11870 +#define kV34Phase3Finished                             33
11871 +#define kV34Phase4Started                              34
11872 +#define kV34Phase4Finished                             35
11873 +#define kV34DecoderParameters                  36
11874 +#define kV34EncoderParameters                  37
11875 +
11876 +#define kMaxLocalRxDataRate                            38
11877 +#define kMaxLocalTxDataRate                            39
11878 +#define kMaxRemoteRxDataRate                   40
11879 +#define kMaxRemoteTxDataRate                   41
11880 +#define kProjectedDataRate                             42
11881 +#define kFEECDeactivated                               43
11882 +#define kIEECDeactivated                               44
11883 +#define kPFEECDeactivated                              45
11884 +#define kPhaseJitterDeactivated                        46
11885 +
11886 +#define        kPCMP2DetectedDigitalConnection 47
11887 +#define        kPCMP2DetectedRBS                               48
11888 +#define        kX2DetectedPhase1Escape                 49
11889 +
11890 +#define kStarted1200BpsTraining                        50
11891 +#define kStarted2400BpsTraining                        51
11892 +#define kUnscrambledOneDetected                        52
11893 +#define kScrambled1200BpsOneDetected   53
11894 +#define kScrambled2400BpsOneDetected   54
11895 +#define kV22BisS1Detected                              55
11896 +#define        kV22InitiateLoop2Test                   56
11897 +#define        kV22RespondLoop2Test                    57
11898 +#define        kV22Loop2TestAlt01Detected              58
11899 +
11900 +#define        kDataModemLoop1TestStarted              59
11901 +#define        kDataModemLoop1TestFinished             60
11902 +#define        kDataModemLoop2TestStarted              61
11903 +#define        kDataModemLoop2TestFinished             62
11904 +#define        kDataModemLoop3TestStarted              63
11905 +#define        kDataModemLoop3TestFinished             64
11906 +#define        kDataModemSelfLoopTestEnabled   65
11907 +
11908 +#define kPCMPhase3Started                              70
11909 +#define kPCMPhase3Finished                             71
11910 +#define kPCMPhase4Started                              72
11911 +#define kPCMPhase4Finished                             73
11912 +
11913 +#define        kV90JaSignalDetected                    74              
11914 +#define        kV90JdSignalDetected                    75              
11915 +#define        kV90JdPrimeSignalDetected               76              
11916 +#define        kV90RSignalDetected                             77              
11917 +#define        kV90RBarSignalDetected                  78      
11918 +#define        kV90CPSignalDetected                    79      
11919 +
11920 +#define        kV90CPtSignalSent                               80
11921 +#define        kV90CPSignalSent                                81
11922 +#define        kV90CPprimeSignalSent                   82
11923 +
11924 +
11925 +#define        kV34SeamlessRateChangeRequestSent               83
11926 +#define        kV34SeamlessRateChangeUpdateSent                84
11927 +#define        kV34SeamlessRateChangeRequestReceived   85
11928 +#define        kV34SeamlessRateChangeUpdateReceived    86
11929 +#define        kV34SeamlessRateChangeUpdateTimeout             87
11930 +
11931 +#define kV90JaSignalAcknowledged                               88
11932 +
11933 +#define        kV34HCtrlChanPPhDetected                100
11934 +#define        kV34HCtrlChanMPhDetected                101
11935 +#define        kV34HCtrlChanRatesKnown                 102
11936 +#define        kV34HDXCtrlChanBinary1Detected  103
11937 +#define        kV34HDXPhase3Started                    104
11938 +#define        kV34HDXPhase3Finished                   105
11939 +#define        kV34HDXPrimChanBinary1Detected  106
11940 +#define kFlexEventTRN2AFinished         107
11941 +
11942 +#define kV32RanginigStarted                            108
11943 +#define kV32RangingStarted                             108
11944 +#define kV32RanginigFinished                   109
11945 +#define kV32RangingFinished                            109
11946 +
11947 +
11948 +typedef long   lapmStatusCode;
11949 +#define kLapmDisconnected                      0       /* LAPM disconnected */
11950 +#define kLapmConnected                         1       /* LAPM is connected */
11951 +#define kLapmV42ODPDetected                    2       /* LAPM ODP is detected */
11952 +#define kLapmV42ADPDetected                    3       /* LAPM V.42 ADP is detected    */
11953 +#define kLapmUnknownADPDetected                4       /* LAPM Unsupported ADP is detected     */
11954 +#define kLapmTimeout                           5       /* LAPM Timeout         */
11955 +#define        kLapmMNPFrameDetected           6       /* LAPM detected MNP frame      */
11956 +#define kLapmDPDetectionTimedOut       7       /* LAPM Unsupported ADP is detected     */
11957 +#define kLapmError                                     8       /* LAPM Error   */
11958 +#define kLapmTestResult                                9       /* LAPM loopback test result */
11959 +#define        kLapmTxFrameStatus                      10
11960 +#define        kLapmRxFrameStatus                      11
11961 +#define        kLapmTxStatistics                       12
11962 +#define        kLapmRxStatistics                       13
11963 +
11964 +typedef long   lapmTakedownReason;
11965 +#define kLapmRemoteDisconnect  0
11966 +#define kLapmLocalDisconnect   1
11967 +#define kLapmCannotConnect             2
11968 +#define kLapmProtocolError             3
11969 +#define kLapmCompressionError  4
11970 +#define kLapmInactivityTimer   5
11971 +#define kLapmRetryFailed               6
11972 +
11973 +
11974 +typedef long   lapmParameterCode;
11975 +#define kLapmXmtK                      0
11976 +#define kLapmRcvK                      1
11977 +#define kLapmXmtN401           2
11978 +#define kLapmRcvN401           3
11979 +#define kLapmTESTSupport       4
11980 +#define kLapmSREJSupport       5
11981 +#define kLapmCompDir           6
11982 +#define kLapmCompDictSize      7
11983 +#define kLapmCompStringSize    8
11984 +
11985 +
11986 +typedef long   lapmErrorCode;
11987 +#define kLapmNoError           0
11988 +#define kLapmBufferOverflow    1
11989 +#define kLapmFrameTooLong      2
11990 +#define kLapmBadFrame          3
11991 +#define kLapmUnknownEvent      4
11992 +/* 6 is reserved for kLapmRetryFailed defined above */
11993 +
11994 +
11995 +typedef long   lapmTestResultCode;
11996 +#define kLapmTestPassed                                0
11997 +#define kLapmTestRequestIgnored                1
11998 +#define kLapmTestAlreadyInProgress     2
11999 +#define kLapmTestNotSupported          3
12000 +#define kLapmTestFailed                                4
12001 +
12002 +
12003 +typedef long   v42bisStatusCode;
12004 +#define kV42bisEncoderTransparentMode  0       /* V.42bis encoder transparent mode active */
12005 +#define kV42bisEncoderCompressedMode   1       /* V.42bis encoder compressed mode active */
12006 +#define kV42bisDecoderTransparentMode  2       /* V.42bis decoder transparent mode active */
12007 +#define kV42bisDecoderCompressedMode   3       /* V.42bis decoder compressed mode active */
12008 +#define kV42bisError                                   4       /* V.42bis error */
12009 +#define        kV42bisEncoderStatistics                5
12010 +#define        kV42bisDecoderStatistics                6
12011 +
12012 +
12013 +typedef long   v42bisErrorCode;
12014 +#define kV42bisUndefinedEscSequence    0       /* V.42bis undefined escape sequence            */
12015 +#define kV42bisCodewordSizeOverflow    1       /* V.42bis codeword size overflow                       */
12016 +#define kV42bisUndefinedCodeword       2       /* V.42bis undefined codeword                           */
12017 +
12018 +typedef long   mnpStatusCode;
12019 +#define kMnpDisconnected                       0       /* Mnp disconnected */
12020 +#define kMnpConnected                          1       /* Mnp is connected */
12021 +#define kMnpFallback                           2       /* Mnp is falling back to buffer mode */
12022 +#define kMnpError                                      3       /* Mnp Error    */
12023 +#define        kMnpTimeout                                     4       /* Mnp Timeout */
12024 +#define        kMnpInvalidLT                           5       /* Invalid LT received */
12025 +#define        kMnpRetransmitFrame                     6
12026 +#define        kMnpNack                                        7
12027 +#define        kMnpTxFrameStatus                       8
12028 +#define        kMnpRxFrameStatus                       9
12029 +#define        kMnpTxStatistics                        10
12030 +#define        kMnpRxStatistics                        11
12031 +
12032 +typedef long   mnpTakedownReason;
12033 +#define kMnpRemoteDisconnect           0
12034 +#define kMnpLocalDisconnect                    1
12035 +#define kMnpCannotConnect                      2
12036 +#define kMnpProtocolError                      3
12037 +#define kMnpCompressionError           4
12038 +#define kMnpInactivityTimer                    5
12039 +#define kMnpRetryFailed                                6
12040 +
12041 +
12042 +typedef long   mnpParameterCode;
12043 +#define kMnpProtocolLevel                      0
12044 +#define kMnpServiceClass                       1
12045 +#define kMnpOptimizationSupport                2
12046 +#define kMnpCompressionSupport         3
12047 +#define kMnpN401                                       4
12048 +#define kMnpK                                          5
12049 +
12050 +
12051 +typedef long   mnpErrorCode;
12052 +#define kMnpNoError                                    0                       
12053 +#define kMnpBufferOverflow                     1
12054 +#define kMnpFrameTooLong                       2
12055 +#define kMnpBadFrame                           3
12056 +#define kMnpUnknownEvent                       4
12057 +
12058 +
12059 +typedef long   v70StatusCode;
12060 +#define kV70Disconnected                       0       /* V70 disconnected */
12061 +#define kV70Connected                          1       /* V70 is connected */
12062 +#define kV70Error                                      2       /* V70 Error    */
12063 +#define        kV70Timeout                                     3       /* V70 Timeout */
12064 +#define kV70ChannelDown             4  /* V70 channel released */
12065 +#define kV70ChannelUp               5  /* V70 channel established */
12066 +#define kV70AudioChannelDown        6  /* V70 audio channel released */
12067 +#define kV70AudioChannelUp          7  /* V70 audio channel established */
12068 +#define kV70DataChannelDown         8  /* V70 data channel released */
12069 +#define kV70DataChannelUp           9  /* V70 data channel established */
12070 +#define kV70OOBChannelDown          10 /* V70 out-of-band channel released */
12071 +#define kV70OOBChannelUp            11  /* V70 out-of-band channel established */
12072 +#define        kV70TxFrameStatus                       12
12073 +#define        kV70RxFrameStatus                       13
12074 +#define        kV70TxStatistics                        14
12075 +#define        kV70RxStatistics                        15
12076 +#define        kV70StateTransition                     16
12077 +
12078 +typedef long   v70TakedownReason;
12079 +#define kV70RemoteDisconnect           0
12080 +#define kV70LocalDisconnect                    1
12081 +#define kV70CannotConnect                      2
12082 +#define kV70ProtocolError                      3
12083 +#define kV70CompressionError           4
12084 +#define kV70InactivityTimer                    5
12085 +#define kV70RetryFailed                                6
12086 +
12087 +
12088 +typedef long   v70ParameterCode;
12089 +#define kV70SuspendResume              0
12090 +#define kV70CrcLength              1
12091 +#define kV70NumberOfDLCs               2
12092 +#define kV70uIH                            3
12093 +
12094 +#define kV70LapmXmtK                           10
12095 +#define kV70LapmRcvK                           11
12096 +#define kV70LapmXmtN401                                12
12097 +#define kV70LapmRcvN401                                13
12098 +#define kV70LapmTESTSupport                    14
12099 +#define kV70LapmSREJSupport                    15
12100 +#define kV70LapmCompDir                                16
12101 +#define kV70LapmCompDictSize           17
12102 +#define kV70LapmCompStringSize         18
12103 +
12104 +#define kV70AudioHeader                    20   /* if audio header is present in audio frames */
12105 +#define kV70BlockingFactor             21   /* audio blocking factor (default 1)  */
12106 +#define kV70SilenceSuppression      22   /* audio silence suppression */
12107 +
12108 +
12109 +
12110 +typedef long   v70ErrorCode;
12111 +#define kV70NoError                                    0                       
12112 +#define kV70BadFrame                           1                       
12113 +
12114 +typedef long   audioStatusCode;
12115 +#define kAudioFramesLost                       0        /* One or more audio frames were lost */
12116 +#define kAudioTxBufferOverflow         1
12117 +#define kAudioRxBufferOverflow         2
12118 +#define kAudioRxBufferUnderflow                3
12119 +
12120 +
12121 +typedef long   v80StatusCode;
12122 +#define kV80Disconnected                       0       /* V80 disconnected */
12123 +#define kV80Connected                          1       /* V80 is connected */
12124 +#define kV80Error                                      2       /* V80 Error    */
12125 +#define kV80InBandStatus                       3       /* V80 in-band SAM status */
12126 +#define        kV80TxFrameStatus                       12
12127 +#define        kV80RxFrameStatus                       13
12128 +#define        kV80TxStatistics                        14
12129 +#define        kV80RxStatistics                        15
12130 +
12131 +typedef long   v80TakedownReason;
12132 +#define kV80RemoteDisconnect           0
12133 +#define kV80LocalDisconnect                    1
12134 +
12135 +typedef long   v80ErrorCode;
12136 +#define kV80NoError                                    0                       
12137 +#define kV80BadFrame                           1                       
12138 +
12139 +typedef long   overlayStatusCode;
12140 +#define kOverlayBegin                          0       /* DSP has halted */
12141 +#define kOverlayEnd                                    1       /* DSP has received entire overlay */
12142 +#define kOverlayElapsedTime                    2       /* time elapsed(as viewed by datapump) during overlay */
12143 +#define kOverlayRecordingData          3       /* ms of data that we are recording */
12144 +#define kOverlayReplayingData          4       /* ms of data that we have replayed so far */
12145 +#define kOverlayReplayDone                     5       /* playback is done */
12146 +
12147 +/* types for kOverlayRecording/ReplayingData */
12148 +#define kOverlayTxData                         0
12149 +#define kOverlayRxData                         1
12150 +
12151 +/*
12152 + * Rockwell faxmodem compatible bitmap (kRCFaxBitMapStatus)
12153 + */
12154 +#define        kRCFaxFCD       0x01
12155 +#define        kRCFaxP2        0x02
12156 +#define        kRCFaxPN        0x04
12157 +#define        kRCFaxDCD       0x08
12158 +#define        kRCFaxTX        0x10
12159 +#define        kRCFaxCTS       0x20
12160 +
12161 +
12162 +#ifndef ADSL_MODEM
12163 +typedef long   modemCommandCode;
12164 +#endif
12165 +       /* Basic Action commands                00-63           */
12166 +#define kIdleCmd                                               0
12167 +#define kStartFaxModemCmd                              1
12168 +#define kStartDataModemCmd                             2
12169 +#define kStartCallProgressMonitorCmd   3
12170 +#define kSendTonesCmd                                  4
12171 +#define kStartCallerIDRcvCmd                   5
12172 +#define kSetLinkLayerCmd                               6
12173 +#define kSetFramerCmd                                  7
12174 +#define kTestLinkLayerCmd                              8
12175 +#define kIdleRcvCmd                                            9
12176 +#define kIdleXmtCmd                                            10
12177 +#define kSetStatusHandlerCmd                   11
12178 +#define kSetEyeHandlerCmd                              12
12179 +#define kSetLogHandlerCmd                              13
12180 +#define kSendBreakCmd                                  14
12181 +#define kSendTestCmd                                   15
12182 +#define kDisconnectLinkCmd                             16
12183 +#define kSetXmtGainCmd                                 17
12184 +#define kStartADSICmd                                  18
12185 +#define kSetHybridDelayCmd                             19
12186 +#define kCleardownCmd                                  20
12187 +#define kInitiateRetrainCmd                            21
12188 +#define kInitiateRateRenegotiationCmd  22
12189 +#define        kDialToneIndicator                              23
12190 +#define kSetRxDataHandler                              24      /* not used yet */
12191 +#define kSetTxDataHandler                              25      /* not used yet */
12192 +#define kSetAuxRxDataHandler                   26
12193 +#define kSetAuxTxDataHandler                   27
12194 +#define kRingIndicatorCmd                              28
12195 +#define kDTERateIndicatorCmd                   29
12196 +#define        kStartV8bisCmd                                  30
12197 +#define kSendMultiTonesCmd                             31
12198 +#define kSetMultiToneParamsCmd                 32
12199 +#define kSetModemSampleRateCmd                 33
12200 +#define kStartDataModemPTTTestCmd              34
12201 +#define kStartDataModemLoopbackTestCmd 35
12202 +#define kRingFrequencyCmd                              36
12203 +#define kSetCallWaitingDetectorStateCmd        37
12204 +#define kV34HDXTurnOffCurrentModeCmd   38
12205 +#define        kSetAudioCmd                                    39
12206 +#define        kLoopbackTestAutoRespEnableCmd  40
12207 +#define kSetCallProgressParamsCmd              41
12208 +#define kSetTrainingDelayReductionCmd  42
12209 +#define        kSetFaxECMPageBufferPtrCmd              43
12210 +#define kSetLineCurrentStateCmd                        44
12211 +#define        kSetFramerParameterCmd                  45
12212 +#define kStartDozeCmd                   46
12213 +#define kEndDozeCmd                     47
12214 +#define kStartRingFrequencyDetectorCmd  48
12215 +#define        kSetBufferingDelayAdjustmentCmd 49
12216 +
12217 +       /* Composite action commands    64-127          */
12218 +#define kDialCmd                                               64
12219 +#define kSendCallingToneCmd                            65
12220 +#define kV24CircuitChangeCmd                   66
12221 +#define        kStartATModeCmd                                 67
12222 +#define        kStopATModeCmd                                  68
12223 +#define        kSetATRegister                                  69
12224 +#define        kSetATRegisterLimits                    70
12225 +#define        kSetATIResponse                                 71
12226 +#define        kEnableATDebugMode                              72
12227 +#define        kSetWhiteListEntry                              73
12228 +#define        kSetBlackListEntry                              74
12229 +
12230 +#define kV70Setup                                          75      /* additional V70 configuration */
12231 +#define kEstablishChannel                          76      /* Establish new link layer channel (V70) */
12232 +#define kReleaseChannel                                        77      /* Release link layer channel (V70) */
12233 +#define kWaitChannelEstablished                        78      /* Wait for establishment of the new link layer channel (V70) */
12234 +
12235 +/* unused      79 */
12236 +#define kMnpOOBFrameCmd                                        80
12237 +#define kV80InBandCmd                                  81              /* V80 In-band commands */
12238 +#define kSetV250IdString                               82
12239 +#define        kSetInternationalTablesCmd              83
12240 +#define        kConfigureCountryCmd                    84
12241 +#define        kConigureCountryCmd                             84
12242 +#define        kV8ControlCmd                                   85
12243 +#define kV8bisSendMessage                              86
12244 +#define        kSetHWIdCmd                                             87
12245 +#define        kSetCodecIdCmd                                  88
12246 +#define        kOverCurrentDetected                    89
12247 +
12248 +
12249 +
12250 +typedef long v8ControlType;
12251 +#define kEnableDTEControl                              1
12252 +#define kSetV8ControlTimeout                   2
12253 +#define kSetCIValue                                            3
12254 +#define kSetCMValue                                            4
12255 +#define kSetJMValue                                            5
12256 +#define kSendCJ                                                        6
12257 +#define kSetCallFunctionCategory               7
12258 +
12259 +typedef long v250IdStringCode;
12260 +#define kGMIString                                             1
12261 +#define kGMMString                                             2
12262 +#define kGMRString                                             3
12263 +#define kGSNString                                             4
12264 +#define kGOIString                                             5
12265 +
12266 +typedef long   kCallProgressParameterCode;
12267 +#define        kModemSignalPowerThreshold              1
12268 +#define        kDialtonePowerThreshold                 2
12269 +#define        kRingBackPowerThreshold                 3
12270 +#define        kBusyPowerThreshold                             4
12271 +#define        kReorderPowerThreshold                  5
12272 +#define        k2ndDTnPowerThreshold                   6
12273 +#define        kMinDialtoneTime                                7
12274 +#define        kDialtoneFreqRange                              8
12275 +#define        kRingBackFreqRange                              9
12276 +#define        kBusyFreqRange                                  10
12277 +#define        kReorderFreqRange                               11
12278 +#define        k2ndDTnFreqRange                                12
12279 +
12280 +
12281 +typedef        long    framerParameterCode;
12282 +#define        kSetHDLCLeadingFlags            0
12283 +#define        kHDLCResetFlagDetection         1
12284 +#define        kSyncFramerSetup                        2
12285 +#define        kHDLCSendCRC                            3
12286 +#define kHDLCSendFlags                         4
12287 +#define        kHDLCSendAborts                         5
12288 +
12289 +
12290 +typedef        long logDataCode;
12291 +#define eyeData                                0
12292 +#define mseData                                1
12293 +#define rxData                         2
12294 +#define txData                         3
12295 +#define neecData                       4
12296 +#define eqlData                                5
12297 +#define ieecData                       6
12298 +#define feecData                       7
12299 +#define eqlPllData                     8
12300 +#define feecPllData                    9
12301 +#define timingData                     10
12302 +#define pjPhaseErrData         11
12303 +#define pjEstimateData         12
12304 +#define pjEstDiffData          13
12305 +#define pjCoefData                     14
12306 +#define inputSignalData                15
12307 +#define outputSignalData       16
12308 +#define agcGainData                    17
12309 +#define automoderData          18
12310 +#define v8CMData                       19
12311 +#define v8JMData                       20
12312 +#define inputAfterNeecData     21
12313 +#define eqlErrData                     22
12314 +#define dpskMicrobitsData      23
12315 +#define v34P2LSamplesData      24
12316 +#define phaseSplittedLData     25
12317 +#define fftedLData                     26
12318 +#define channelSNRData         27
12319 +#define noiseEstimateData      28
12320 +#define signalEstimateData     29
12321 +#define v34INFOData                    30
12322 +#define v34ChanProbData                31
12323 +#define v34P2OutputData                32
12324 +#define v8ANSamDetectData      33
12325 +#define pFeecData                      34
12326 +#define channelDelayData       35
12327 +#define timingOffsetData       36
12328 +#define trellisMSEData         37
12329 +#define interpolatedSignalData         38
12330 +#define dcCancelledSignalData          39
12331 +#define echoCancelledSignalData                40
12332 +#define predictorErrData                       41
12333 +#define commandInfoData                                42
12334 +#define unusedInfoData                         43
12335 +#define atCommandInfoData                      44
12336 +#define atResponseInfoData                     45
12337 +#define hwTerminalTxData                       46
12338 +#define hwTerminalRxData                       47
12339 +#define statusInfoData                         48
12340 +#define        channelResponseData                     49
12341 +#define        channelImpulseRespData          50
12342 +#define        x2PcmP1DetectorInData           51
12343 +#define        x2PcmP1DetectorOutData          52
12344 +#define eqlRealData                                    53
12345 +#define ieecRealData                           54
12346 +#define neecOutputData                         55
12347 +#define precodedEqlOutputData          56
12348 +#define eqlRealErrData                         57
12349 +#define idealEqlOutputData                     58
12350 +#define agcData                                                59
12351 +#define pcmInfidelityData                      60
12352 +#define v42bisCycleCount                       61
12353 +#define pcmImdOffsetCoefData           62
12354 +#define pcmImdOffsetData                       63
12355 +#define        v90RcvdDilLongData                      64
12356 +#define        v90RcvdDilShortData                     65
12357 +#define        v90DilProducedData                      66
12358 +#define        pcmEncoderKbitsData                     67
12359 +#define        pcmEncoderMbitsData                     68
12360 +#define        pcmEncoderSbitsData                     69
12361 +#define        pcmDecoderKbitsData                     70
12362 +#define        pcmDecoderMbitsData                     71
12363 +#define        pcmDecoderSbitsData                     72
12364 +#define        v90CPorCPtData                          73
12365 +#define        mnpDecoderInputData                     74
12366 +#define        mnpDecoderOutputData            75
12367 +#define        v42bisEncoderInputData          76
12368 +#define        v42bisDecoderInputData          77
12369 +#define        modulatorInputData                      78
12370 +#define        modulatorOutputData                     79
12371 +#define encodedStatusData                      80
12372 +#define blockFramerTxData                      81
12373 +#define blockFramerRxData                      82
12374 +#define framerTxData                           83
12375 +#define framerRxData                           84
12376 +#define        dpskBasebandData                        85
12377 +#define        dpskBasebandLPFedData           86
12378 +#define        dpskRealData                            87
12379 +#define bandEdgeCorrectedSignalData    88
12380 +#define atmLogData                                     89
12381 +#define clearEocLogData                                90
12382 +#define g997LogData                                    91
12383 +
12384 +
12385 +#define        kLogDataDelimiter       0xFEFEFEFE
12386 +
12387 +/****************************************************************************/
12388 +/*     1.      Type definitions.                                                                                                       */
12389 +/*                                                                                                                                                     */
12390 +/*     1.3     Handlers                                                                                                                        */
12391 +/****************************************************************************/
12392 +
12393 +typedef        void    (SM_DECL *rcvHandlerType)                       (void *gDslVars, int, short*);
12394 +typedef        void    (SM_DECL *xmtHandlerType)                       (void *gDslVars, int, short*);
12395 +typedef        int             (SM_DECL *xmtHandlerWithRtnValType)     (void *gDslVars, int, short*);
12396 +typedef        void    (SM_DECL *timerHandlerType)                     (void *gDslVars, long);
12397 +typedef        int             (SM_DECL *interpolatorHandlerType)      (void *gDslVars, int, short*, short*);
12398 +typedef        void    (SM_DECL *controlHandlerType)           (void *gDslVars, int);
12399 +
12400 +typedef        int             (SM_DECL *txDataHandlerType)    (void *gDslVars, int,   uchar*);
12401 +typedef        int             (SM_DECL *rxDataHandlerType)    (void *gDslVars, int,   uchar*);
12402 +
12403 +typedef        bitMap  (SM_DECL *signalDetectorType)   (void *gDslVars, int, long, long*);
12404 +
12405 +
12406 +typedef        void    (SM_DECL *hookHandlerType)              (void *gDslVars, Boolean);
12407 +
12408 +typedef        short*  (SM_DECL *sampBuffPtrType)              (void *gDslVars, int);
12409 +
12410 +typedef        void    (SM_DECL *eyeHandlerType)               (void *gDslVars, int, ComplexShort*);
12411 +typedef        void    (SM_DECL *logHandlerType)               (void *gDslVars, logDataCode, ...);
12412 +
12413 +typedef        void    (SM_DECL *voidFuncType)                 (void *gDslVars);
12414 +
12415 +typedef        int             (SM_DECL *txAudioHandlerType)   (void *gDslVars, int,   short*);
12416 +typedef        int             (SM_DECL *rxAudioHandlerType)   (void *gDslVars, int,   short*);
12417 +
12418 +
12419 +/****************************************************************************/
12420 +/*     1.      Type definitions.                                                                                                       */
12421 +/*                                                                                                                                                     */
12422 +/*     1.4     Structures                                                                                                                      */
12423 +/****************************************************************************/
12424 +
12425 +/*
12426 + * AT command processor definitions
12427 + */
12428 +#define kATRegistersNumber                             56
12429 +#define        kFirstConfigurationRegister             500
12430 +#define        kLastConfigurationRegister              515
12431 +#define        kFirstInternationalRegister             516
12432 +#define        kLastInternationalRegister              595
12433 +
12434 +
12435 +
12436 +#define kATMaxDialStringSize   128
12437 +typedef struct
12438 +       {
12439 +       struct 
12440 +               {
12441 +               uchar loadNumber;                                                               /* Which profile to load upon powerup/reset */
12442 +               uchar countryCode;                                                              /* T.35 Country Code */
12443 +               uchar profile[2][kATRegistersNumber];
12444 +               uchar dialString[4][kATMaxDialStringSize + 1];
12445 +               } config;
12446 +       ulong versionCode;
12447 +       ulong crcCheckSum;
12448 +       } NVRAMConfiguration;
12449 +
12450 +/* Structure to hold international settings */
12451 +typedef        struct
12452 +       {
12453 +       char                                            *name;
12454 +       int                                                     countryCode;
12455 +       const SRegisterDefinition       *userRegisters;
12456 +       const ulong                                     *configRegisters;
12457 +       } CountryDescriptor;
12458 +
12459 +/*
12460 + * V.34 coding parameters structure
12461 + */
12462 +
12463 +typedef struct
12464 +       {
12465 +       /* DO NOT CHANGE THE ORDER OF FIELDS IN THIS STRUCTURE!
12466 +        * (Some assembly code depends on it!)  If you
12467 +        * must add fields, please do so at the bottom.
12468 +        */
12469 +
12470 +       int                                     symbolRateIndex,
12471 +                                               dataRateIndex,
12472 +                                               userSNRAdjustment;
12473 +       Boolean                         auxChannel, 
12474 +                                               expConstellation, 
12475 +                                               precoding,
12476 +                                               nonlinearCoding; 
12477 +       schar   J,                      /* number of data frames in superframe                          */
12478 +                       P,                      /* number of mapping frames in a data frame                     */
12479 +                       r,                      /* number of high mapping frames in a data frame        */
12480 +                       b,                      /* number of data bits in a mapping frame                       */
12481 +                       W,                      /* number of aux bits in a data frame                           */
12482 +                       K,                      /* number of S bits in a mapping frame                          */
12483 +                       q,                      /* number of Q bits in a 2D symbol                                      */
12484 +                       M;                      /* number of rings in shell mapping                                     */
12485 +       long    nominalVariance;        /* the signal variance which gives 1e-2 BLER Q10 */
12486 +       int             bitsPerDataFrame;
12487 +       short   quantRoundOff,
12488 +                       quantMask;
12489 +       uchar   nTrellisStates, 
12490 +                       log2NTrellisStates; 
12491 +       short   gain1xmt,
12492 +                       gain2xmt,
12493 +                       gain1rcv,
12494 +                       gain2rcv;
12495 +       ushort  bitInversionPattern;
12496 +       } V34CodingParams;
12497 +
12498 +typedef        long                            v8bisStatusCode;
12499 +typedef        bitMap                          v8bisConnectionSetup;
12500 +#if defined(V8BIS) || defined(AT_COMMANDS_V8BIS)
12501 +#include "V8bisMainTypes.h"
12502 +#endif
12503 +
12504 +#define kMaxMultiTones                         4       /* MultiTone: search for up to this many tones at once */
12505 +
12506 +#ifndef ADSL_MODEM
12507 +typedef        struct
12508 +       {
12509 +       modemStatusCode         code;
12510 +       union
12511 +               {
12512 +               long                                            value;
12513 +               long                                            freq;
12514 +               modemErrorCode                          error;
12515 +               modulationMap                           modulation;
12516 +               modulationMap                           modemSignal;
12517 +               dataRateMap                                     dataRate;
12518 +               long                                            dtmfSignal;
12519 +               bitMap                                          callProgressSignal;
12520 +               bitMap                                          customSignal;
12521 +               void                                            *ptr;
12522 +               struct
12523 +                       {
12524 +                       long                            detected;
12525 +                       long                            numTones;
12526 +                       long                            tones[kMaxMultiTones];
12527 +                       } multiToneInfo;
12528 +               struct
12529 +                       {
12530 +                       v8bisStatusCode         code;
12531 +                       long                            value;
12532 +                       } v8bisStatus;
12533 +               struct
12534 +                       {
12535 +                       trainingProgressCode    code;   
12536 +                       long                                    value;                  
12537 +                       } trainingInfo;
12538 +               struct
12539 +                       {
12540 +                       long                                    code;   
12541 +                       long                                    value;                  
12542 +                       } v24Circuit;
12543 +               struct
12544 +                       {
12545 +                       trainingProgressCode    code;   
12546 +                       void*                                   ptr;                    
12547 +                       } advancedTrainingInfo;
12548 +               struct
12549 +                       {
12550 +                       capabilitiesStatusCode  code;   
12551 +                       long                                    value;                  
12552 +                       } capabilitiesStatusInfo;
12553 +               struct
12554 +                       {
12555 +                       connectionInfoCode              code;
12556 +                       long                                    value;                  
12557 +                       } connectionInfo;
12558 +               struct
12559 +                       {
12560 +                       connectionInfoCode              code;
12561 +                       int                                             length;
12562 +                       uchar                                   *ptr;
12563 +                       } advancedConnectionInfo;
12564 +               struct
12565 +                       {
12566 +                       dialerStatusCode                code;
12567 +                       long                                    value;
12568 +                       long                                    makeTime;                       
12569 +                       long                                    breakTime;                      
12570 +                       } dialerStatus;
12571 +               struct
12572 +                       {
12573 +                       long                                    enabled;
12574 +                       long                                    volume;                 
12575 +                       } speakerStatus;
12576 +               framingInfoCode                         framingInfo;
12577 +               IOStatusCode                            ioStatus;
12578 +               struct
12579 +                       {
12580 +                       lapmStatusCode                  code;
12581 +                       union
12582 +                               {
12583 +                               long                            value;
12584 +                               lapmTakedownReason      reason;
12585 +                               lapmErrorCode           error;
12586 +                               lapmTestResultCode      testResult;
12587 +                               struct
12588 +                                       {
12589 +                                       long    length;
12590 +                                       uchar   *framePtr;
12591 +                                       } frame;
12592 +                               struct
12593 +                                       {
12594 +                                       long    nFrames;
12595 +                                       long    nFrameErrors;
12596 +                                       } statistic;
12597 +                               } param;                        
12598 +                       } lapmStatus;
12599 +               struct
12600 +                       {
12601 +                       lapmParameterCode               code;
12602 +                       long                                    value;
12603 +                       } lapmParameter;
12604 +               struct
12605 +                       {
12606 +                       v42bisStatusCode                code;
12607 +                       union
12608 +                               {
12609 +                               long                            value;
12610 +                               v42bisErrorCode         error;
12611 +                               struct
12612 +                                       {
12613 +                                       long    nBytesIn;
12614 +                                       long    nBytesOut;
12615 +                                       } statistic;
12616 +                               } param;                        
12617 +                       } v42bisStatus;
12618 +               struct
12619 +                       {
12620 +                       mnpStatusCode                   code;
12621 +                       union
12622 +                               {
12623 +                               long                            value;
12624 +                               mnpTakedownReason       reason;
12625 +                               mnpErrorCode            error;
12626 +                               struct
12627 +                                       {
12628 +                                       long    nFrames;
12629 +                                       long    nFrameErrors;
12630 +                                       } statistic;
12631 +                               struct
12632 +                                       {
12633 +                                       ulong   nSize;
12634 +                                       uchar  *Buffer;
12635 +                                       } fallback;
12636 +                               struct
12637 +                                       {
12638 +                                       char    *header;
12639 +                                       void    *frame;
12640 +                                       } frame;
12641 +                               struct
12642 +                                       {
12643 +                                       long    nack;
12644 +                                       long    rFrameNo;
12645 +                                       } timeout;
12646 +                               struct
12647 +                                       {
12648 +                                       long    frameNo;
12649 +                                       long    framesPending;
12650 +                                       } retrFrame;
12651 +                               } param;                        
12652 +                       } mnpStatus;
12653 +               struct
12654 +                       {
12655 +                       mnpParameterCode                code;
12656 +                       long                                    value;
12657 +                       } mnpParameter;
12658 +               struct
12659 +                       {
12660 +                       v70StatusCode                   code;
12661 +                       union
12662 +                               {
12663 +                               long                            value;
12664 +                               v70TakedownReason       reason;
12665 +                               v70ErrorCode            error;
12666 +                               struct
12667 +                                       {
12668 +                                       long    nFrames;
12669 +                                       long    nFrameErrors;
12670 +                                       } statistic;
12671 +                               struct
12672 +                                       {
12673 +                                       long    length;
12674 +                                       uchar   *framePtr;
12675 +                                       } frame;
12676 +                               struct
12677 +                                       {
12678 +                                       long    nack;
12679 +                                       long    rFrameNo;
12680 +                                       } timeout;
12681 +                               struct
12682 +                                       {
12683 +                                       long    frameNo;
12684 +                                       long    framesPending;
12685 +                                       } retrFrame;
12686 +                               struct  
12687 +                                       {
12688 +                                       long    ChannelId;
12689 +                                       long    DLCI;
12690 +                                       ulong   LcNum;
12691 +                                       v70TakedownReason       reason;
12692 +                                       } channelInfo;                  
12693 +                               struct  
12694 +                                       {
12695 +                                       long    ChannelId;
12696 +                                       long    stateOld;
12697 +                                       long    stateNew;
12698 +                                       } stateInfo;                    
12699 +                               } param;
12700 +                       ulong   v70Time;
12701 +                       } v70Status;
12702 +               struct
12703 +                       {
12704 +                       audioStatusCode                 code;
12705 +                       union
12706 +                               {
12707 +                               long            value;
12708 +                               struct
12709 +                                       {
12710 +                                       long    nReq;
12711 +                                       long    nAvail;
12712 +                                       } buffer;
12713 +                               struct
12714 +                                       {
12715 +                                       long    nFrames;
12716 +                                       long    nFrameErrors;
12717 +                                       } statistic;
12718 +                               struct
12719 +                                       {
12720 +                                       long    length;
12721 +                                       uchar   *framePtr;
12722 +                                       } frame;
12723 +                               } param;
12724 +                       } audioStatus;
12725 +               struct
12726 +                       {
12727 +                       v80StatusCode                   code;
12728 +                       union
12729 +                               {
12730 +                               long                            value;
12731 +                               v80TakedownReason       reason;
12732 +                               v80ErrorCode            error;
12733 +                               struct
12734 +                                       {
12735 +                                       long    nFrames;
12736 +                                       long    nFrameErrors;
12737 +                                       } statistic;
12738 +                               struct
12739 +                                       {
12740 +                                       long    length;
12741 +                                       uchar   *framePtr;
12742 +                                       } frame;
12743 +                               struct
12744 +                                       {
12745 +                                       long    code;
12746 +                                       long    value;
12747 +                                       } inBand;
12748 +                               } param;
12749 +                       ulong   v80Time;
12750 +                       } v80Status;
12751 +               struct
12752 +                       {
12753 +                       v70ParameterCode                code;
12754 +                       long                                    value;
12755 +                       } v70Parameter;
12756 +               struct
12757 +                       {
12758 +                       breakType                       type;
12759 +                       long                            length;
12760 +                       } breakStatus;
12761 +               struct
12762 +                       {
12763 +                       callerIDStatusCode                      code;
12764 +                       union
12765 +                               {
12766 +                               long                            value;
12767 +                               struct
12768 +                                       {
12769 +                                       callerIDErrorCode       code;
12770 +                                       long                            value;  
12771 +                                       } callerIDError;
12772 +                               struct
12773 +                                       {
12774 +                                       long                    length;
12775 +                                       char*                   ptr;    
12776 +                                       } message;
12777 +                               } param;                        
12778 +                       } callerIDStatus;
12779 +               struct
12780 +                       {
12781 +                       ulong           signal;
12782 +                       uchar           *msg1;
12783 +                       long            msg1Length;     
12784 +                       uchar           *msg2;
12785 +                       long            msg2Length;     
12786 +                       } A8RStatus;
12787 +               struct
12788 +                       {
12789 +                       overlayStatusCode               code;
12790 +                       long                                    value;
12791 +                       long                                    value2;
12792 +                       } overlayStatus;
12793 +               struct
12794 +                       {
12795 +                       ulong   nBits;
12796 +                       ulong   nBlocks;
12797 +                       ulong   nBitErrors;
12798 +                       ulong   nBlockErrors;
12799 +
12800 +                       ulong   nAudioBits;
12801 +                       ulong   nAudioBlocks;
12802 +                       ulong   nAudioSyncErrors;
12803 +                       ulong   nAudioBlockErrors;
12804 +                       } testResults;
12805 +               ulong                                   checksum;
12806 +               struct
12807 +                       {
12808 +                       ulong   sizeM;
12809 +                       uchar   *filename;
12810 +                       } logFileControlStatus;
12811 +               struct
12812 +                       {
12813 +                       long    direction;
12814 +                       long    module;
12815 +                       long    message;
12816 +                       long    data;
12817 +                       }
12818 +               faxClass2Status;
12819 +               
12820 +               } param;
12821 +       } modemStatusStruct;
12822 +       
12823 +typedef        void    (SM_DECL *statusHandlerType)    (void *gDslVars, modemStatusStruct*);
12824 +#endif /* ADSL_MODEM */
12825 +
12826 +/****************************************************************************/
12827 +/*     1.      Type definitions.                                                                                                       */
12828 +/*                                                                                                                                                     */
12829 +/*     1.5     Command structure                                                                                                       */
12830 +/****************************************************************************/
12831 +
12832 +typedef struct
12833 +       {
12834 +    Boolean remoteModemIsFlex;
12835 +    uchar   countryCode;
12836 +    ushort  manufacturerId;
12837 +    uchar   licenseeId;
12838 +    uchar   productCapabilities;
12839 +    Boolean digitalModeFlag;
12840 +    Boolean prototypeFlag;
12841 +    uchar   version;
12842 +       }
12843 +FlexV8bisStruct;
12844 +
12845 +typedef struct
12846 +       {
12847 +       symbolRateMap   symbolRates;
12848 +       dataRateMap             dataRates;
12849 +       dataRateMap             dataRates56k;
12850 +       dataRateMap     dataRatesFlex;
12851 +       featureMap              features;
12852 +       bitMap                  auxFeatures;
12853 +       bitMap                  demodCapabilities;
12854 +       long                    rateThresholdAdjustment;        /* dB Q4        */
12855 +    FlexV8bisStruct flexRemoteV8bisInfo;
12856 +       }       dataPumpCapabilities;
12857 +
12858 +#ifndef ADSL_MODEM
12859 +typedef        struct  SoftwareModemCommandParameters
12860 +       {
12861 +       modemCommandCode                command;
12862 +       union
12863 +               {
12864 +               long                            xmtGain;
12865 +               ulong                           hybridDelayQ4ms;
12866 +               long                            modemSampleRate;
12867 +               long                            timeInMs;
12868 +               long                            state;
12869 +               long                            freq;
12870 +               NVRAMConfiguration      *nvramConfigurationPtr;
12871 +               long                            enabled;
12872 +               long                            value;
12873 +               uchar                           *phoneNumber;
12874 +               uchar                           *faxECMPageBufferPtr;
12875 +               CountryDescriptor       *countryDescriptorTable;
12876 +               struct
12877 +                       {
12878 +                       dataRateMap                     dteRate;
12879 +                       bitMap                          format;
12880 +                       } dteRateSpec;
12881 +               struct
12882 +                       {
12883 +                       v8ControlType           code;
12884 +                       long                            value;
12885 +                       uchar                           *buffer;
12886 +                       } v8ControlSpec;
12887 +               struct
12888 +                       {
12889 +                       directionType                   direction;
12890 +                       v8bisConnectionSetup    setup;
12891 +                       void                                    *capPtr;
12892 +                       voidFuncType                    confirmMsFunc;
12893 +                       voidFuncType                    genMsFunc;
12894 +                       xmtHandlerWithRtnValType        ogmFunc;
12895 +                       } v8bisSpec;
12896 +               struct
12897 +                       {
12898 +                       directionType   direction;
12899 +                       } ADSISpec;
12900 +               struct
12901 +                       {
12902 +                       directionType                   direction;
12903 +                       modulationMap                   modulations;
12904 +                       dataPumpCapabilities    capabilities;
12905 +                       } modeSpec;
12906 +               struct
12907 +                       {
12908 +                       long                    time, 
12909 +                                                       freq1, 
12910 +                                                       freq2, 
12911 +                                                       freq3, 
12912 +                                                       freq4,
12913 +                                                       mag1, 
12914 +                                                       mag2,
12915 +                                                       mag3,
12916 +                                                       mag4;
12917 +                       } toneSpec;
12918 +               struct
12919 +                       {
12920 +                       long            signal;
12921 +                       uchar           *msg1;
12922 +                       long            msg1Length;     
12923 +                       uchar           *msg2;
12924 +                       long            msg2Length;     
12925 +                       long            sig_en;
12926 +                       long            msg_en;
12927 +                       long            supp_delay;
12928 +                       }
12929 +                       v8bisMessageSpec;
12930 +               struct
12931 +                       {
12932 +                       linkLayerType           type;
12933 +                       bitMap                          setup;
12934 +                       dataRateMap                     rxDataRate;
12935 +                       dataRateMap                     txDataRate;
12936 +                       long                            rtDelayQ4ms;                            
12937 +                       rxDataHandlerType       rxDataHandlerPtr;
12938 +                       txDataHandlerType       txDataHandlerPtr;
12939 +                       } linkLayerSpec;
12940 +               struct
12941 +                       {
12942 +                       framerType                      type;
12943 +                       bitMap                          setup;
12944 +                       directionType           direction;
12945 +                       long                            fill[2]; /* need to match linkLayerSpec */
12946 +                       rxDataHandlerType       rxDataHandlerPtr;
12947 +                       txDataHandlerType       txDataHandlerPtr;
12948 +                       } framerSpec;
12949 +               struct
12950 +                       {
12951 +                       framerParameterCode     code;
12952 +                       long                            value;
12953 +                       } framerParameterSpec;
12954 +               struct
12955 +                       {
12956 +                       bitMap                          callProgressDetectorSetup;
12957 +                       signalDetectorType      callProgressDetectorPtr;        /* if nil, use defaults                 */
12958 +                       signalDetectorType      customDetectorPtr;                      /* if nil, no custom detector   */
12959 +                       } callProgressMonitorSpec;
12960 +               struct
12961 +                       {
12962 +                       ulong                   maxTones;                                       /* maximum number of simultaneous tones to detect */
12963 +                       ulong                   allowableVariance;                      /* maximum cumulative variance in the eight interpolated frequencies */
12964 +                       ulong                   totalPowerThreshold;            /* ignore complete block if power less than this */
12965 +                       ulong                   powerShiftThreshold;            /* ignore a bin if its power is less than (totalPowerValue >> powerShiftThreshold) */
12966 +                       ulong                   toneMatchThresholdHz;           /* tones within +/- this many Hz of original tone are considered the same tone */
12967 +                       ulong                   binSeparation;                          /* ignore tones with a spacing of less than this */
12968 +                       ulong                   outsideFreqDeviation;           /* an individual value in the interpolated array can be up to this many Hz outside of the expected angle range */
12969 +                       } multiToneSpec;
12970 +               struct
12971 +                       {
12972 +                       uchar                           *dialString;    /* nil limited string for DTMF dialing sequence */
12973 +                       long                            pulseBreakTime, 
12974 +                                                               pulseMakeTime, 
12975 +                                                               pulseInterDigitTime,
12976 +                                                               toneDigitTime, 
12977 +                                                               toneInterDigitTime, 
12978 +                                                               toneLoGroupMag,
12979 +                                                               toneHiGroupMag,
12980 +                                                               flashTime, 
12981 +                                                               pauseTime,
12982 +                                                               signalWaitTimeout,      
12983 +                                                               blindDialingTimeout;    
12984 +                       bitMap                          dialerSetup;
12985 +                       bitMap                          callProgressDetectorSetup;
12986 +                       signalDetectorType      callProgressDetectorPtr;        /* if nil, use defaults                 */      
12987 +                       signalDetectorType      customDetectorPtr;                      /* if nil, no custom detector   */
12988 +                       hookHandlerType         hookHandlerPtr;                         /* nil if DTMF dialing specified*/
12989 +                       } dialSpec;
12990 +               struct
12991 +                       {
12992 +                       long                    timeOn, 
12993 +                                                       timeOff, 
12994 +                                                       freq;
12995 +                       } callingToneSpec;
12996 +               union
12997 +                       {
12998 +                       statusHandlerType       statusHandlerPtr;
12999 +                       eyeHandlerType          eyeHandlerPtr;
13000 +                       logHandlerType          logHandlerPtr;
13001 +                       rxDataHandlerType       rxDataHandlerPtr;
13002 +                       txDataHandlerType       txDataHandlerPtr;
13003 +                       } handlerSpec;
13004 +               struct
13005 +                       {
13006 +                       breakType                       type;
13007 +                       long                            length;
13008 +                       } breakSpec;
13009 +               struct
13010 +                       {
13011 +                       long                            length;
13012 +                       uchar                           *dataPtr;
13013 +                       } lapmTestSpec;
13014 +               struct
13015 +                       {
13016 +                       bitMap                          setupLapm;
13017 +                       rxDataHandlerType       rxAudioHandlerPtr;
13018 +                       txDataHandlerType       txAudioHandlerPtr;
13019 +            } v70SetupSpec;
13020 +               struct
13021 +                       {
13022 +                       ulong                           ChannelId;
13023 +                       ulong                           LogChannelNum;
13024 +                       ulong                           PortNum;
13025 +            } EstChannelSpec;
13026 +               struct
13027 +                       {
13028 +                       ulong                           ChannelId;
13029 +            } WaitChannelSpec;
13030 +               struct
13031 +                       {
13032 +                       ulong                           ChannelId;
13033 +                       ulong                           LogChannelNum;
13034 +                       ulong                           PortNum;
13035 +                       ulong                           DLCI;
13036 +            } RelChannelSpec;
13037 +               struct
13038 +                       {
13039 +                       audioType                       type;
13040 +                       bitMap                          setup;
13041 +                       dataRateMap                     rxAudioRate;
13042 +                       dataRateMap                     txAudioRate;
13043 +                       rxAudioHandlerType      rxAudioHandlerPtr;
13044 +                       txAudioHandlerType      txAudioHandlerPtr;
13045 +                       } audioSpec;
13046 +               struct
13047 +                       {
13048 +                       long                                    code;   
13049 +                       long                                    value;                  
13050 +                       } v24Circuit;
13051 +               struct
13052 +                       {
13053 +                       ulong                                   code;   
13054 +                       ulong                                   value;                  
13055 +                       ulong                                   minValue;
13056 +                       ulong                                   maxValue;
13057 +                       } atRegister;
13058 +               struct
13059 +                       {
13060 +                       long                                    code;   
13061 +                       uchar                                   *response;
13062 +                       } atiSpec;
13063 +               struct
13064 +                       {
13065 +                       long                                    length;
13066 +                       uchar                                   *framePtr;
13067 +                       } frameSpec;
13068 +               struct
13069 +                       {
13070 +                       long                                    code;
13071 +                       union
13072 +                               {
13073 +                               long                            value;
13074 +                               struct
13075 +                                       {
13076 +                                       long                    loFreq1;
13077 +                                       long                    hiFreq1;
13078 +                                       long                    loFreq2;
13079 +                                       long                    hiFreq2;
13080 +                                       } freqRange;
13081 +                               } params;
13082 +                       } callProgressParamSpec;
13083 +               struct
13084 +                       {
13085 +                       v250IdStringCode        v250IdCode;
13086 +                       uchar                           *v250IdString;
13087 +                       } v250IdSpec;
13088 +
13089 +               } param;
13090 +       } modemCommandStruct;
13091 +       
13092 +typedef        Boolean (*commandHandlerType)   (modemCommandStruct*);
13093 +#endif /* ADSL_MODEM */
13094 +
13095 +
13096 +
13097 +/****************************************************************************/
13098 +/*     2.      Constant definitions.                                                                                           */
13099 +/*                                                                                                                                                     */
13100 +/*     2.1     Definitive constants                                                                                            */
13101 +/****************************************************************************/
13102 +
13103 +#define kMaxSampleBlockSize                    48
13104 +#define kMaxDataBlockSize                      48
13105 +
13106 +#define        kMaxDialStringLength            127
13107 +#define        kCallProgressSampleRate         7200
13108 +
13109 +#define        kMaxCallerIDMessageLength       80
13110 +
13111 +/****************************************************************************/
13112 +/*     2.      Constant definitions.                                                                                           */
13113 +/*                                                                                                                                                     */
13114 +/*     2.2     Bit maps                                                                                                                */
13115 +/****************************************************************************/
13116 +
13117 +/* modulationMap */
13118 +
13119 +#define        kIdle                                   0x00000000
13120 +#define        kV25                                    0x00000001
13121 +#define        kV8                                             0x00000002
13122 +#define        kCid                                    0x00000004
13123 +#define        kV8bis                                  0x00000008
13124 +#define        kV21                                    0x00000010
13125 +#define        kV22                                    0x00000020
13126 +#define        kV23                                    0x00000040
13127 +#define        kV32                                    0x00000080
13128 +#define        kV34                                    0x00000100
13129 +#define        kX2                                             0x00000200
13130 +#define        kV90                                    0x00000400
13131 +#define        k56Flex                                 0x00000800
13132 +#define        kV27                                    0x00001000
13133 +#define        kV29                                    0x00002000
13134 +#define        kV17                                    0x00004000
13135 +#define        kV34HDX                                 0x00008000
13136 +#define        kV34HDXC                                0x00010000
13137 +#define        kBell103                                0x00100000
13138 +#define        kBell212                                0x00200000
13139 +#define        kDataCallingTone                0x01000000
13140 +#define        kFaxCallingTone                 0x02000000
13141 +
13142 +#define        kV22FastNZConnect           0x04000000
13143 +#define kV22FastNNZConnect      0x08000000
13144 +#define kV22FastConnect         (kV22FastNZConnect|kV22FastNNZConnect)
13145 +#define kV22bisFastConnect      0x10000000
13146 +
13147 +
13148 +#define        kDataModulations        (kV25 | kV8 | kV21 | kV22FastConnect | kV22bisFastConnect | kV22 | kV23 | kV32 | kV34 | kBell103 | kBell212)
13149 +#define        kDataOnlyModulations (kV21 | kV22 | kV23 | kV32 | kBell103 | kBell212)
13150 +#define        kPCMModulations         (kV90 | kX2 | k56Flex)
13151 +
13152 +#define        kFaxModulations         (kV25 | kV21 | kV27 | kV29 | kV17)
13153 +#define        kFaxOnlyModulations     (kV27 | kV29 | kV17)
13154 +#define        kFaxModulationShift             12
13155 +
13156 +/* symbolRateMap       */
13157 +
13158 +#define        k1200Hz                 0x00000001
13159 +#define        k1600Hz                 0x00000002
13160 +#define        k2400Hz                 0x00000004
13161 +#define        k2743Hz                 0x00000008
13162 +#define        k2800Hz                 0x00000010
13163 +#define        k3000Hz                 0x00000020
13164 +#define        k3200Hz                 0x00000040
13165 +#define        k3429Hz                 0x00000080
13166 +#define        k8000Hz                 0x00000100
13167 +
13168 +#define        kAllSymbolRates (       k1200Hz | k1600Hz | k2400Hz | k2743Hz | \
13169 +                                                       k2800Hz | k3000Hz | k3429Hz | k8000Hz )
13170 +
13171 +/* dataRateMap */
13172 +
13173 +#define        k75bps                  0x00000002
13174 +#define        k300bps                 0x00000004
13175 +#define        k600bps                 0x00000008
13176 +#define        k1200bps                0x00000010
13177 +#define        k2400bps                0x00000020
13178 +#define        k4800bps                0x00000040
13179 +#define        k7200bps                0x00000080
13180 +#define        k9600bps                0x00000100
13181 +#define        k12000bps               0x00000200
13182 +#define        k14400bps               0x00000400
13183 +#define        k16800bps               0x00000800
13184 +#define        k19200bps               0x00001000
13185 +#define        k21600bps               0x00002000
13186 +#define        k24000bps               0x00004000
13187 +#define        k26400bps               0x00008000
13188 +#define        k28800bps               0x00010000
13189 +#define        k31200bps               0x00020000
13190 +#define        k33600bps               0x00040000
13191 +#define        k36000bps               0x00080000
13192 +#define        k38400bps               0x00100000
13193 +#define        k57600bps               0x00200000
13194 +#define        k115200bps              0x00400000
13195 +#define        k230400bps              0x00800000
13196 +#define        k460800bps              0x01000000
13197 +#define        k921600bps              0x02000000
13198 +/*
13199 + * kPCMRate is used to identify that the reported rate is
13200 + * PCM modulation rate, and is only used for PCM modulation while
13201 + * reporting rate !!!!
13202 + */
13203 +#define        kPCMRate                0x40000000
13204 +#define kPCMFlexRate    0x80000000
13205 +#define        kAllDataRates   0x0FFFFFFF
13206 +
13207 +/* rates specific for X2  and V.90 */
13208 +#define        kPCM25333bps    0x00000001
13209 +#define        kPCM26666bps    0x00000002
13210 +#define        kPCM28000bps    0x00000004
13211 +#define        kPCM29333bps    0x00000008
13212 +#define        kPCM30666bps    0x00000010
13213 +#define        kPCM32000bps    0x00000020
13214 +#define        kPCM33333bps    0x00000040
13215 +#define        kPCM34666bps    0x00000080
13216 +#define        kPCM36000bps    0x00000100
13217 +#define        kPCM37333bps    0x00000200
13218 +#define        kPCM38666bps    0x00000400
13219 +#define        kPCM40000bps    0x00000800
13220 +#define        kPCM41333bps    0x00001000
13221 +#define        kPCM42666bps    0x00002000
13222 +#define        kPCM44000bps    0x00004000
13223 +#define        kPCM45333bps    0x00008000
13224 +#define        kPCM46666bps    0x00010000
13225 +#define        kPCM48000bps    0x00020000
13226 +#define        kPCM49333bps    0x00040000
13227 +#define        kPCM50666bps    0x00080000
13228 +#define        kPCM52000bps    0x00100000
13229 +#define        kPCM53333bps    0x00200000
13230 +#define        kPCM54666bps    0x00400000
13231 +#define        kPCM56000bps    0x00800000
13232 +#define        kPCM57333bps    0x01000000
13233 +
13234 +#define        kV90ServerToClientDataRates     \
13235 +                                               (       kPCM28000bps | kPCM29333bps | kPCM30666bps | \
13236 +                                                       kPCM32000bps | kPCM33333bps | kPCM34666bps | \
13237 +                                                       kPCM36000bps | kPCM37333bps | kPCM38666bps | \
13238 +                                                       kPCM40000bps | kPCM41333bps | kPCM42666bps | \
13239 +                                                       kPCM44000bps | kPCM45333bps | kPCM46666bps | \
13240 +                                                       kPCM48000bps | kPCM49333bps | kPCM50666bps | \
13241 +                                                       kPCM52000bps | kPCM53333bps | kPCM54666bps | \
13242 +                                                       kPCM56000bps | kPCM57333bps )
13243 +
13244 +#define        kV90ClientToServerDataRates     \
13245 +                                               (       k4800bps  | k7200bps  | k9600bps  | k12000bps | \
13246 +                                                       k14400bps | k16800bps | k19200bps | k21600bps | \
13247 +                                                       k24000bps | k26400bps | k28800bps | k31200bps | \
13248 +                                                       k33600bps )     
13249 +
13250 +
13251 +
13252 +#define        kX2ServerToClientDataRates      \
13253 +                                               (       kPCM25333bps | kPCM26666bps | kPCM28000bps | \
13254 +                                                       kPCM29333bps | kPCM30666bps | kPCM32000bps | \
13255 +                                                       kPCM33333bps | \
13256 +                                                       kPCM34666bps | kPCM36000bps | kPCM37333bps | \
13257 +                                                       kPCM38666bps | kPCM40000bps | kPCM41333bps | \
13258 +                                                       kPCM42666bps | kPCM44000bps | kPCM45333bps | \
13259 +                                                       kPCM46666bps | kPCM48000bps | kPCM49333bps | \
13260 +                                                       kPCM50666bps | kPCM52000bps | kPCM53333bps | \
13261 +                                                       kPCM54666bps | kPCM56000bps | kPCM57333bps )
13262 +#define        kX2ClientToServerDataRates      \
13263 +                                               (       k4800bps | k7200bps | k9600bps | k12000bps | k14400bps | \
13264 +                                                               k16800bps | k19200bps | k21600bps | k24000bps | k26400bps | k28800bps | \
13265 +                                                               k31200bps )
13266 +
13267 +  /*
13268 +  Rates specific for Flex
13269 +  */
13270 +#define kPCMFlex32000bps  0x00000001
13271 +#define kPCMFlex34000bps  0x00000002
13272 +#define kPCMFlex36000bps  0x00000004
13273 +#define kPCMFlex38000bps  0x00000008
13274 +#define kPCMFlex40000bps  0x00000010
13275 +#define kPCMFlex42000bps  0x00000020
13276 +#define kPCMFlex44000bps  0x00000040
13277 +#define kPCMFlex46000bps  0x00000080
13278 +#define kPCMFlex48000bps  0x00000100
13279 +#define kPCMFlex50000bps  0x00000200
13280 +#define kPCMFlex52000bps  0x00000400
13281 +#define kPCMFlex54000bps  0x00000800
13282 +#define kPCMFlex56000bps  0x00001000
13283 +#define kPCMFlex58000bps  0x00002000
13284 +#define kPCMFlex60000bps  0x00004000
13285 +
13286 +#define        kFlexServerToClientDataRates \
13287 +                        (   kPCMFlex32000bps | kPCMFlex34000bps | kPCMFlex36000bps | kPCMFlex38000bps | \
13288 +                                                       kPCMFlex40000bps | kPCMFlex42000bps | kPCMFlex44000bps | kPCMFlex46000bps | \
13289 +                                                       kPCMFlex48000bps | kPCMFlex50000bps | kPCMFlex52000bps | kPCMFlex52000bps | \
13290 +                                                       kPCMFlex54000bps | kPCMFlex56000bps | kPCMFlex58000bps | kPCMFlex60000bps )
13291 +
13292 +#define        kFlexClientToServerDataRates    \
13293 +                                               (       k4800bps  | k7200bps  | k9600bps  | k12000bps | \
13294 +                                                       k14400bps | k16800bps | k19200bps | k21600bps | \
13295 +                                                       k24000bps | k26400bps | k28800bps | k31200bps )
13296 +
13297 +
13298 +#define        k2400BitShift   5
13299 +#define        k4800BitShift   6
13300 +
13301 +#define        kPCM28000bpsShift       2
13302 +
13303 +#define        kV21Rates                       k300bps
13304 +#define        kV22Rates                       k1200bps
13305 +#define        kV22bisRates            (k1200bps | k2400bps)
13306 +#define        kV23Rates                       (k75bps | k1200bps)
13307 +#define        kCidRates                       (k1200bps)
13308 +#define        kV32Rates                       (k4800bps | k9600bps)
13309 +#define        kV32bisRates            (kV32Rates | k7200bps | k12000bps | k14400bps)
13310 +#define        kV32terboRates          (kV32bisRates | k16800bps | k19200bps)  
13311 +#define        kV34Rates                       (       k2400bps | k4800bps | k7200bps | k9600bps | k12000bps | k14400bps | \
13312 +                                                               k16800bps | k19200bps | k21600bps | k24000bps | k26400bps | k28800bps | \
13313 +                                                               k31200bps | k33600bps ) 
13314 +
13315 +#define        kV27Rates                       (k2400bps | k4800bps)
13316 +#define        kV29Rates                       (k4800bps | k7200bps | k9600bps)
13317 +#define        kBell103Rates       k300bps
13318 +#define        kBell212Rates       k1200bps
13319 +
13320 +
13321 +/* Demodulator capabilities    */
13322 +#define        kNeecEnabled                                    0x00000001
13323 +#define        kPFeecEnabled                                   0x00000002
13324 +#define        kIeecEnabled                                    0x00000004
13325 +#define        kFeecEnabled                                    0x00000008
13326 +
13327 +#define        kRapidEqualizerTraining                 0x00000010
13328 +#define        kRapidPECTraining                               0x00000020
13329 +#define        kRapidECTraining                                0x00000040
13330 +#define        kAutoLoadReductionEnabled               0x00000080
13331 +
13332 +#define        kTimingTrackingEnabled                  0x00000100
13333 +#define        kPhaseLockedLoopEnabled                 0x00000200
13334 +#define        kFeecPhaseLockedLoopEnabled             0x00000400
13335 +#define        kPhaseJitterTrackingEnabled             0x00000800
13336 +
13337 +#define        kClockErrorTrackingEnabled              0x00001000
13338 +#define        kFreqOffsetTrackingEnabled              0x00002000
13339 +#define        kFeecFreqOffsetTrackingEnabled  0x00004000
13340 +
13341 +#define        kShorterNeecEnabled                             0x00008000
13342 +#define        kShorterPFeecEnabled                    0x00010000
13343 +#define        kFrondEndHPFilterEnabled                0x00020000
13344 +#define kGainControlEnabled                            0x00040000
13345 +#define kPhaseHitControlEnabled                        0x00080000
13346 +#define        kBandEdgeCorrectorEnabled               0x00100000
13347 +#define kDisableFaxFastClearDown               0x00200000
13348 +
13349 +#define kImdOffsetCompensationEnabled  0x00400000
13350 +
13351 +#define kV34ShortEqlLengthExtShift  23
13352 +#define kV34ShortEqlLengthExtMask      (0x3<<kV34ShortEqlLengthExtShift)
13353 +#define kV34EqlLengthReductionEnabled  (1<<(kV34ShortEqlLengthExtShift+2))
13354 +#define kPCMIeecLengthReductionEnabled (1<<(kV34ShortEqlLengthExtShift+3))
13355 +
13356 +/* featureMap  */
13357 +
13358 +#define        kAllFeatures                            0xFFFFFFFF
13359 +
13360 +#define        kAutomodingEnabled                      0x00000001      /* bit 1        */
13361 +#define        kAutomodingDisabled                     0x00000000      /* bit 1        */
13362 +
13363 +#define        kV8SendCIEnabled                        0x00000002      /* bit 2        */
13364 +#define        kV8SendCIDisabled                       0x00000000      /* bit 2        */
13365 +
13366 +#define        kV34CMEModem                            0x00000004      /* bit 3        */
13367 +#define        kV34NotCMEModem                         0x00000000      /* bit 3        */
13368 +
13369 +#define        kV34ExtraINFOPreamble           0x00000008      /* bit 4        */
13370 +
13371 +#define        kRetrainingEnabled                      0x00000010
13372 +#define        kRateRenegotiationEnabled       0x00000020
13373 +#define        kTrellisCodingEnabled           0x00000040
13374 +
13375 +/* Fax specific features       */
13376 +#define        kFaxShortTraining                       0x00000080
13377 +#define        kFaxEchoSuppressionEnabled      0x00000100
13378 +
13379 +/* V.22/V.22bis specific features      */
13380 +#define        kV22GuardTone1800HzEnabled      0x00000200
13381 +#define        kV22GuardTone550HzEnabled       0x00000400
13382 +
13383 +
13384 +/* V.34 specific features      */
13385 +
13386 +#define        kV34bisEnabled                          0x00000800
13387 +
13388 +#define        kV34PowerReductionAllowed       0x00001000
13389 +#define        kAuxChannelEnabled                      0x00002000
13390 +#define        kAuxChannelDisabled                     0x00000000
13391 +#define        kV34TrellisEncoderTypeMask      0x0000C000
13392 +#define        kV34TrellisEncoderTypeShift     14
13393 +
13394 +#define        kTRN16                                          0x00010000
13395 +#define        kAssymDataRatesEnabled          0x00020000
13396 +#define        kNonLinearCodingEnabled         0x00040000
13397 +#define        kConstShapingEnabled            0x00080000
13398 +#define        kPrecodingEnabled                       0x00100000
13399 +
13400 +#define        kV34LoFcAt2400HzEnabled         0x00200000
13401 +#define        kV34HiFcAt2400HzEnabled         0x00400000
13402 +#define        kV34LoFcAt2743HzEnabled         0x00800000
13403 +#define        kV34HiFcAt2743HzEnabled         0x01000000
13404 +#define        kV34LoFcAt2800HzEnabled         0x02000000
13405 +#define        kV34HiFcAt2800HzEnabled         0x04000000
13406 +#define        kV34LoFcAt3000HzEnabled         0x08000000
13407 +#define        kV34HiFcAt3000HzEnabled         0x10000000
13408 +#define        kV34LoFcAt3200HzEnabled         0x20000000
13409 +#define        kV34HiFcAt3200HzEnabled         0x40000000
13410 +#define        kV34LoFcAt3429HzEnabled         0x80000000
13411 +#define        kV34HiFcAt3429HzEnabled         0x80000000
13412 +
13413 +/* auxiliary features definintions map */
13414 +
13415 +#define        kLoopbackTestFinish                             0x00000000
13416 +#define        kLoopbackTestV54Loop1                   0x00000001
13417 +#define        kLoopbackTestV54Loop2                   0x00000002
13418 +#define        kLoopbackTestV54Loop3                   0x00000003
13419 +#define        kLoopbackTestTypeMask                   0x00000003
13420 +#define        kLoopbackTestAutoRespondEnabled 0x00000004
13421 +#define        kLoopbackSelfTest                               0x00000008
13422 +
13423 +#define        kPreempFilterMask                       0x000000F0
13424 +#define        kPreempFilterShift                      4
13425 +
13426 +#define        kPcmCodingTypeMuLaw                     0x00000100
13427 +#define        kPcmServerToServerEnabled       0x00000200
13428 +#define        kPcmIsServerModem                       0x00000400
13429 +#define        kPcmAnalogModemAvailable        0x00000800
13430 +#define        kPcmDigitalModemAvailable       0x00001000
13431 +#define        kPcmDceOnDigitalNetwork         0x00002000
13432 +#define        kPcmDModemPwrCalAtCodecOut      0x00004000
13433 +#define        kPcm3429UpstreamAvailable       0x00008000
13434 +
13435 +#define        kPcmSpectralShapingBitsMask             0x00070000
13436 +#define        kPcmSpectralShapingBitsShift    16
13437 +#define        kV90ServerNotDetSbarAfterJdbarFix       0x00080000
13438 +
13439 +#define kAutomoderPassive                      0x00400000
13440 +
13441 +#define        kV8HoldANSamUntilDetCI          0x00800000
13442 +#define        kFaxSendFromOrgSide                     0x01000000
13443 +#define        kFaxV34HDX2400bpsCtrlChan       0x02000000
13444 +#define        kFaxV34HDXAllowAsymCtrlChan     0x04000000
13445 +#define        kV8ANSamStageDisabled           0x08000000
13446 +
13447 +#define kFlexSkipV8bis              0x10000000
13448 +#define kV34ControlChannelEnabled   0x20000000
13449 +#define kV34SeamlessRateChangeEnabled 0x40000000
13450 +
13451 +#define        kPTTTest                                        0x80000000
13452 +
13453 +/* call progress detection Map */
13454 +
13455 +#define        kDialTone                               0x00000001
13456 +#define        kRingBack                               0x00000002
13457 +#define        kBusy                                   0x00000004
13458 +#define        kReorder                                0x00000008
13459 +#define        k2ndDTn                                 0x00000010
13460 +#define        kBongTone                               0x00000020
13461 +
13462 +/* Break type bit settings     */
13463 +#define        kExpedited              0x0001
13464 +#define        kDestructive    0x0002
13465 +
13466 +/* async Framer setup map              */
13467 +
13468 +#define        kNDataBitsMask  0x03
13469 +#define        k5DataBits              0x00
13470 +#define        k6DataBits              0x01
13471 +#define        k7DataBits              0x02
13472 +#define        k8DataBits              0x03
13473 +
13474 +#define        kNDataBitsShift         0
13475 +#define        kNDataBitsOffset        5
13476 +
13477 +#define        kParityTypeMask 0x1C
13478 +#define        kNoParity               0x00
13479 +#define        kOddParity              0x04
13480 +#define        kEvenParity             0x08
13481 +#define        kMarkParity             0x0C
13482 +#define        kSpaceParity    0x10
13483 +
13484 +#define        kNStopBitsMask  0x60
13485 +#define        k1StopBits              0x00
13486 +#define        k2StopBits              0x20
13487 +
13488 +#define        kNStopBitsShift         5
13489 +#define        kNStopBitsOffset        1
13490 +
13491 +/* Sync Framer setup map               */
13492 +
13493 +#define kUnderrunCharMask                      0xff
13494 +#define kRepeatLastCharOnUnderrun      0x100
13495 +
13496 +/* HDLC sync framer setup maps */
13497 +#define        kNFlagsBeforeFramesMask         0x3F
13498 +#define        kNFlagsBeforeFramesShift        0
13499 +
13500 +#define        kNFlagsBetweenFramesMask        0x3F
13501 +#define        kNFlagsBetweenFramesShift       6
13502 +
13503 +#define        k32BitCRC                                       0x1000
13504 +#define        kFlagSharingEnabled                     0x2000
13505 +
13506 +#define kNFlagsBeforeReportMask                0x03    /* no. of *extra* flags reqd before frame */
13507 +#define kNFlagsBeforeReportShift       14
13508 +
13509 +#define        kTxDeferredCRC                          0x10000
13510 +#define        kRxDeferredCRC                          0x20000
13511 +#define        kTxIdleMarks                            0x40000
13512 +#define kNoCRC                                         0x80000
13513 +
13514 +/* SAM framer setup maps       */
13515 +
13516 +#define        kSAMTransparentIdleTypeMask             0x00000003
13517 +#define        kSAMTransparentIdleTypeShift    0
13518 +#define        kSAMFramedIdleTypeMask                  0x00000004
13519 +#define        kSAMFramedIdleTypeShift                 2
13520 +#define        kSAMFramedOverrunActionMask             0x00000010
13521 +#define        kSAMFramedOverrunActionShift    4
13522 +#define        kSAMHalfDuplexModeMask                  0x00000020
13523 +#define        kSAMHalfDuplexModeShift                 5
13524 +#define        kSAMCRCTypeMask                                 0x000000C0
13525 +#define        kSAMCRCTypeShift                                6
13526 +#define        kSAMNRZIEnabledMask                             0x00000100
13527 +#define        kSAMNRZIEnabledShift                    8
13528 +#define        kSAMSyn1Mask                                    0x00FF0000
13529 +#define        kSAMSyn1Shift                                   16
13530 +#define        kSAMSyn2Mask                                    0xFF000000
13531 +#define        kSAMSyn2Shift                                   24
13532 +
13533 +/* <trans_idle> */
13534 +#define        kSAM8bitSYNHuntDisabled         0
13535 +#define        kSAM8bitSYNHuntEnabled          ((ulong)1 << kSAMTransparentIdleTypeShift)
13536 +#define        kSAM16bitSYNHuntEnabled         ((ulong)2 << kSAMTransparentIdleTypeShift)
13537 +
13538 +/* <framed_idle> */
13539 +#define        kSAMSendFlagsOnIdle                     0
13540 +#define        kSAMSendMarksOnIdle                     ((ulong)1 << kSAMFramedIdleTypeShift)
13541 +
13542 +/* <framed_un_ov> */
13543 +#define        kSAMAbortOnUnderrun                     0
13544 +#define        kSAMFlagsOnUnderrun                     ((ulong)1 << kSAMFramedOverrunActionShift)
13545 +
13546 +/* <hd_auto> */
13547 +#define        kSAMHalfDuplexNoAuto            0
13548 +#define        kSAMHalfDuplexAuto                      ((ulong)1 << kSAMHalfDuplexModeShift)
13549 +
13550 +
13551 +/* <crc_type> */
13552 +#define        kSAMNoCRC                                       0
13553 +#define        kSAM16bitCRC                            ((ulong)1 << kSAMCRCTypeShift) 
13554 +#define        kSAM32bitCRC                            ((ulong)2 << kSAMCRCTypeShift) 
13555 +                               
13556 +/* <nrzi_en> */
13557 +#define        kSAMNRZIDisabled                        0
13558 +#define        kSAMNRZIEnabled                         ((ulong)1 << kSAMNRZIEnabledShift)
13559 +
13560 +
13561 +/* LAPM setup maps     */
13562 +#define        kLapmDirection                          0x00000001              /* Bit 0  */
13563 +#define        kLapmSREJEnabled                        0x00000002              /* Bit 1  */
13564 +#define        kLapmDetectionEnabled           0x00000004              /* Bit 2  */
13565 +#define        kLapmLongADPEnabled                     0x00000008              /* Bit 3  */
13566 +
13567 +#define        kLapmCompressionEnabledMask     0x00000030
13568 +#define        kLapmTxCompressionEnabled       0x00000010              /* Bit 4  */
13569 +#define        kLapmRxCompressionEnabled       0x00000020              /* Bit 5  */
13570 +#define        kLapmCompressionEnabledShift            4
13571 +
13572 +#define        kLapmRetryLimitMask                     0x000000C0              /* Bits 6,7  */
13573 +
13574 +#define        kLapmNoRetryLimit                       0x00000000
13575 +#define        kLapm4Retries                           0x00000040
13576 +#define        kLapm8Retries                           0x00000080
13577 +#define        kLapm20Retries                          0x000000C0
13578 +
13579 +#define        kLapmWindowSizeMask                     0x00001F00              /* Bits 8-12  */
13580 +#define        kLapmWindowSizeShift            8
13581 +
13582 +#define        kLapmWindowSize8                        0x00000800
13583 +#define        kLapmWindowSize15                       0x00000F00
13584 +
13585 +
13586 +#define        kLapmInfoFieldSizeMask          0x0000E000              /* Bits 13-15  */
13587 +#define        kLapmInfoField8Bytes            0x00000000
13588 +#define        kLapmInfoField16Bytes           0x00002000
13589 +#define        kLapmInfoField32Bytes           0x00004000
13590 +#define        kLapmInfoField64Bytes           0x00006000
13591 +#define        kLapmInfoField128Bytes          0x00008000
13592 +#define        kLapmInfoField192Bytes          0x0000A000
13593 +#define        kLapmInfoField256Bytes          0x0000C000
13594 +#define        kLapmInfoField512Bytes          0x0000E000
13595 +#define        kLapmInfoFieldSizeShift         13
13596 +
13597 +#define        kLapmT400Mask                           0x00030000              /* Bits 16-17   */
13598 +#define        kLapmAutoT400                           0x00000000
13599 +#define        kLapm750msT400                          0x00010000
13600 +#define        kLapm3secT400                           0x00020000
13601 +#define        kLapm30secT400                          0x00030000
13602 +
13603 +#define        kLapmT401Mask                           0x000C0000              /* Bits 18-19   */
13604 +#define        kLapmAutoT401                           0x00000000
13605 +#define        kLapm750msT401                          0x00040000
13606 +#define        kLapm3secT401                           0x00080000
13607 +#define        kLapm6secT401                           0x000C0000
13608 +
13609 +#define        kLapmT403Mask                           0x00300000              /* Bits 20-21   */
13610 +#define        kLapmAutoT403                           0x00000000
13611 +#define        kLapm750msT403                          0x00100000
13612 +#define        kLapm2secT403                           0x00200000
13613 +#define        kLapm4secT403                           0x00300000
13614 +
13615 +
13616 +
13617 +#define        kLapmDictSizeMask                       0x00C00000              /* Bits 22-23  */
13618 +#define        kLapmDictSize512                        0x00000000
13619 +#define        kLapmDictSize1024                       0x00400000
13620 +#define        kLapmDictSize2048                       0x00800000
13621 +#define        kLapmDictSize4096                       0x00C00000
13622 +
13623 +#define        kLapmStringSizeMask                     0xFF000000              /* Bits 24-31  */
13624 +#define        kLapmStringSizeShift            24
13625 +
13626 +/* MNP setup maps      */
13627 +
13628 +#define        kMnpMinPLevel                           0x00000001              /* Bit 0: 1 - Minimal, 0 - Standard */
13629 +#define        kMnpStdPLevel                           0x00000000              /* Bit 0: 1 - Minimal, 0 - Standard */
13630 +
13631 +#define        kMnpOptimizationEnabled         0x00000002              /* Bit 1  */
13632 +#define        kMnpOptimizationDisabled        0x00000000              /* Bit 1  */
13633 +
13634 +#define        kMnpCompressionEnabled          0x00000004              /* Bit 2  */
13635 +#define        kMnpCompressionDisabled         0x00000000              /* Bit 2  */
13636 +
13637 +#define        kMnpClassMask                           0x00000018
13638 +#define        kMnpClassShift                                           3
13639 +#define        kMnpClass1                                      0x00000008
13640 +#define        kMnpClass2                                      0x00000010
13641 +#define        kMnpClass3                                      0x00000018              /* Bits 3,4 */
13642 +
13643 +#define kMnpMaxRetryMask                   0x00000060          /* Bits 5,6 */
13644 +#define kMnpMaxRetryShift                                       5
13645 +#define        kMnpNoRetryLimit                        0x00000000
13646 +#define        kMnp4Retries                            0x00000020
13647 +#define        kMnp8Retries                            0x00000040
13648 +#define        kMnp20Retries                           0x00000060
13649 +
13650 +#define        kMnpInfoFieldSizeMask           0x00000380              /* Bits 7-9  */
13651 +#define        kMnpInfoFieldSizeShift                           7
13652 +#define        kMnpInfoField8Bytes                     0x00000000
13653 +#define        kMnpInfoField16Bytes            0x00000080
13654 +#define        kMnpInfoField32Bytes            0x00000100
13655 +#define        kMnpInfoField64Bytes            0x00000180
13656 +#define        kMnpInfoField128Bytes           0x00000200
13657 +#define        kMnpInfoField192Bytes           0x00000280
13658 +#define        kMnpInfoField256Bytes           0x00000300
13659 +#define        kMnpInfoField260Bytes           0x00000380
13660 +
13661 +#define        kMnpT400Mask                            0x00003000              /* Bits 12,13 */
13662 +#define        kMnpT400Shift                                           12
13663 +#define        kMnpAutoT400                            0x00000000
13664 +#define        kMnp750msT400                           0x00001000
13665 +#define        kMnp3secT400                            0x00002000
13666 +#define        kMnp6secT400                            0x00003000
13667 +
13668 +#define        kMnpT401Mask                            0x0000C000              /* Bits 14,15 */
13669 +#define        kMnpT401Shift                                           14
13670 +#define        kMnpAutoT401                            0x00000000
13671 +#define        kMnp750msT401                           0x00004000
13672 +#define        kMnp3secT401                            0x00008000
13673 +#define        kMnp6secT401                            0x0000C000
13674 +
13675 +#define        kMnpT403Mask                            0x00030000              /* Bits 16,17 */
13676 +#define        kMnpT403Shift                                           16
13677 +#define        kMnpAutoT403                            0x00000000
13678 +#define        kMnp60secT403                           0x00010000
13679 +#define        kMnp600secT403                          0x00020000
13680 +#define        kMnp3600secT403                         0x00030000
13681 +
13682 +#define kMnpFallbackTypeMask           0x000C0000              /* Bits 18,19 */
13683 +#define kMnpFallbackTypeShift                          18
13684 +#define kMnpNoFallback                         0x00000000
13685 +#define kMnpFallbackTime                       0x00040000
13686 +#define kMnpFallback200                                0x00080000
13687 +#define kMnpFallbackChar                       0x000C0000
13688 +
13689 +#define        kMnpWindowSizeMask                      0x00300000              /* Bits 20,21  */
13690 +#define        kMnpWindowSizeShift                                     20
13691 +#define        kMnp1Frame                                      0x00000000
13692 +#define        kMnp4Frames                             0x00100000
13693 +#define        kMnp8Frames                             0x00200000
13694 +#define        kMnp16Frames                            0x00300000
13695 +
13696 +#define        kMnpDirection                           0x00800000              /* Bit 22  */
13697 +
13698 +#define kMnpFallbackCharMask           0xFF000000              /* Bit 24-31  */
13699 +#define kMnpFallbackCharShift                          24
13700 +
13701 +/* kV34HDXTurnOffCurrentModeCmd state parameter values */
13702 +
13703 +#define        kV34HDXTurnOffAsClearDown                               0
13704 +#define        kV34HDXTurnOffFromControlSource                 1
13705 +#define        kV34HDXTurnOffFromControlDestination    2
13706 +#define        kV34HDXTurnOffFromPrimarySource                 3
13707 +#define        kV34HDXTurnOffFromPrimaryDestination    4
13708 +
13709 +/* V70 setup maps */
13710 +
13711 +#define        kV70Direction                           0x00000001              /* Bit 0  */
13712 +#define        kV70uIHEnabled                      0x00000002          /* Bit 1  */
13713 +#define        kV70AudioHeaderEnabled      0x00000004          /* Bit 2  */
13714 +#define kV70SilenceSupprEnabled     0x00000008         /* Bit 3  */
13715 +
13716 +#define        kV70SuspendResumeShift      4 
13717 +#define        kV70SuspendResumeMask       (3 << kV70SuspendResumeShift)
13718 +#define        kV70SuspendResumeDisabled   0x00000000          /* Bit 4,5  */
13719 +#define        kV70SuspendResumeWAddr      0x00000010          /* Bit 4  */
13720 +#define        kV70SuspendResumeWoAddr     0x00000020          /* Bit 5  */
13721 +
13722 +#define        kV70CrcLengthShift          6 
13723 +#define        kV70CrcLengthMask               (3 << kV70CrcLengthShift)
13724 +#define        kV70CrcLength16             0x00000000          /* Bit 6,7  */
13725 +#define        kV70CrcLength8              0x00000040          /* Bit 6  */
13726 +#define        kV70CrcLength32             0x00000080          /* Bit 7  */
13727 +
13728 +#define        kV70BlockingFactorShift     8 
13729 +#define        kV70BlockingFactorMask      (3 << kV70BlockingFactorShift)
13730 +#define        kV70BlockingFactor1         0x00000000          /* Bit 8,9  */
13731 +#define        kV70BlockingFactor2         0x00000100          /* Bit 8  */
13732 +#define        kV70BlockingFactor3                     0x00000200              /* Bit 9  */
13733 +#define        kV70BlockingFactor4                     0x00000300              /* Bit 8,9  */
13734 +
13735 +#define kV70InitChannelsShift          10
13736 +#define kV70InitChannelsMask           (1 << kV70InitChannelsShift)
13737 +#define        kV70InitNoChannels                      0x00000000              /* Bit 10,11  */
13738 +#define        kV70InitDataChannel                     0x00000400              /* Bit 10,11  */
13739 +#define        kV70InitAudioChannel            0x00000800              /* Bit 10,11  */
13740 +#define        kV70InitBothChannels            0x00000C00              /* Bit 10,11  */
13741 +
13742 +#define kV70OOBEnabled                         0x00001000              /* Bit 12 */
13743 +
13744 +/* V80 setup maps */
13745 +
13746 +#define        kV80Direction                           0x00000001              /* Bit 0  */
13747 +
13748 +#define        kV80ModeShift                           1 
13749 +#define        kV80ModeMask                            (3 << kV80ModeShift)
13750 +#define        kV80SyncMode                            (0 << kV80ModeShift)
13751 +#define        kV80TunnellingMode                      (1 << kV80ModeShift)
13752 +#define        kV80SamMode                                     (2 << kV80ModeShift)
13753 +#define        kV80SamTransparentMode          (2 << kV80ModeShift)
13754 +#define        kV80SamFramedMode                       (3 << kV80ModeShift)
13755 +
13756 +#define        kV80TransIdleShift                      3 
13757 +#define        kV80TransIdleMask                       (3 << kV80TransIdleShift)
13758 +#define        kV80TransIdleNoHunt                     (0 << kV80TransIdleShift)
13759 +#define        kV80TransIdleHunt8                      (1 << kV80TransIdleShift)
13760 +#define        kV80TransIdleHunt16                     (2 << kV80TransIdleShift)
13761 +
13762 +#define        kV80FrameIdleShift                      5 
13763 +#define        kV80FrameIdleMask                       (1 << kV80FrameIdleShift)
13764 +#define        kV80FrameIdleFlags                      (0 << kV80FrameIdleShift)
13765 +#define        kV80FrameIdleMarks                      (1 << kV80FrameIdleShift)
13766 +
13767 +#define        kV80FrameUnOvShift                      6 
13768 +#define        kV80FrameUnOvMask                       (1 << kV80FrameUnOvShift)
13769 +#define        kV80FrameUnOvAbort                      (0 << kV80FrameUnOvShift)
13770 +#define        kV80FrameUnOvFlag                       (1 << kV80FrameUnOvShift)
13771
13772 +#define        kV80HdAutoShift                         7 
13773 +#define        kV80HdAutoMask                          (1 << kV80HdAutoShift)
13774 +#define        kV80HdAutoNormal                        (0 << kV80HdAutoShift)
13775 +#define        kV80HdAutoExtended                      (1 << kV80HdAutoShift)
13776 +
13777 +#define        kV80CrcTypeShift                        8 
13778 +#define        kV80CrcTypeMask                         (3 << kV80CrcTypeShift)
13779 +#define        kV80NoCrc                                       (0 << kV80CrcTypeShift)
13780 +#define        kV80Crc16                                       (1 << kV80CrcTypeShift)
13781 +#define        kV80Crc32                                       (2 << kV80CrcTypeShift)
13782 +
13783 +#define        kV80NrziShift                           10
13784 +#define        kV80NrziMask                            (1 << kV80NrziShift)
13785 +#define        kV80NrziDisabled                        (0 << kV80NrziShift)
13786 +#define        kV80NrziEnabled                         (1 << kV80NrziShift)
13787 +
13788 +#define kV80Syn1Mask                           0x00FF0000              /* Bit 16-23  */
13789 +#define kV80Syn1Shift                          16
13790 +#define kV80Syn2Mask                           0xFF000000              /* Bit 24-31  */
13791 +#define kV80Syn2Shift                          24
13792 +
13793 +/* kStartCallProgressMonitorCmd setup masks */
13794 +
13795 +#define        kDTMFDetectorDebouncerEnabled                   0x0001
13796 +#define        kModemSignalDetectorDebouncerEnabled    0x0002
13797 +#define        kCallProgressDetectorDebouncerEnabled   0x0004
13798 +#define        kCustomSignalDebouncerEnabled                   0x0008
13799 +#define        kFaxCallingToneSuppressionEnabled               0x0010
13800 +#define        kDataCallingToneSuppressionEnabled              0x0020
13801 +#define        kCISuppressionEnabled                                   0x0040
13802 +#define        kAnsSuppressionEnabled                                  0x0080
13803 +
13804 +/* kDialCmd setup masks (dialerSetup bit fields) */
13805 +
13806 +#define        kDTMFDialingEnabled                                             0x0001
13807 +#define        kPulseDialingEnabled                                    0x0002
13808 +#define        kModeSwitchEnabled                                              0x0004
13809 +#define        kBlindDialingEnabled                                    0x0008
13810 +#define        kPulseDialingMethodMask                                 0x0030
13811 +#define        kDialModifierTranslationMask                    0x00C0
13812 +#define        kFlashWhilePulseDialingEnabled                  0x0100
13813 +
13814 +/* Pulse dialing method */
13815 +#define        kPulseDialingNPulsesPerDigit                    0x0000
13816 +#define        kPulseDialingNplusOnePulsesPerDigit             0x0010
13817 +#define        kPulseDialingTenMinusNPulsesPerDigit    0x0020
13818 +
13819 +/* Dial modifier translation */
13820 +#define        kTreatWasPause                                                  0x0040  /* Tread 'W' modifier as pause */
13821 +#define        kTreatCommaAsWaitForDialtone                    0x0080
13822 +
13823 +#ifdef TI_C6X
13824 +#include "C6xDefs.h"
13825 +#endif
13826 +#ifdef PENTIUM_MMX
13827 +#include "PentiumDefs.h"
13828 +#endif
13829 +
13830 +
13831 +#if defined(DSP16K) && !defined(SoftModemGlobals)
13832 +/* ensure that code generator does not use r5 */
13833 +register int *softmodem_h_should_not_be_included_after_softmodem_gh asm("r5");
13834 +#endif
13835 +
13836 +/****************************************************************************/
13837 +/*     3.      Interface functions.                                                                                            */
13838 +/*                                                                                                                                                     */
13839 +/****************************************************************************/
13840 +
13841 +#ifdef ADSL_MODEM
13842 +
13843 +#ifndef SoftDslHeader
13844 +#include "SoftDsl.h"
13845 +#endif
13846 +extern char*   SM_DECL SoftModemGetRevString(void);
13847 +extern char*   SM_DECL SoftModemGetProductName(void);
13848 +extern char*   SM_DECL SoftModemGetBuildDate(void);
13849 +extern char*   SM_DECL SoftModemGetFullManufacturerName(void);
13850 +extern char*   SM_DECL SoftModemGetShortManufacturerName(void);
13851 +extern int             SM_DECL SoftModemRevStringSize(void);
13852 +extern char*   SM_DECL SoftModemGetVendorIDString(void);
13853 +extern char*   SM_DECL SoftModemGetT1413VendorIDString(void);
13854 +extern char*   SM_DECL SoftModemGetSerialNumberString(void);
13855 +extern int             SM_DECL SoftModemSerNumStringSize(void);
13856 +#define        SoftDslGetProductName                   SoftModemGetProductName
13857 +#define        SoftDslGetBuildDate                             SoftModemGetBuildDate
13858 +#define        SoftDslGetFullManufacturerName  SoftModemGetFullManufacturerName
13859 +#define        SoftDslGetShortManufacturerName SoftModemGetShortManufacturerName
13860 +
13861 +#else /* !ADSL_MODEM */
13862 +
13863 +extern void            SM_DECL SoftModemSetMemoryPtr   (void   *varsPtr);
13864 +extern void*   SM_DECL SoftModemGetMemoryPtr   (void);
13865 +extern void            SM_DECL SoftModemSetRefData             (void   *varsPtr);
13866 +extern void*   SM_DECL SoftModemGetRefData             (void);
13867 +extern int             SM_DECL SoftModemGetMemorySize  (void);
13868 +extern void            SM_DECL SoftModemInit                   (void);
13869 +extern void            SM_DECL SoftModemReset                  (void);
13870 +extern void            SM_DECL SoftModemLineHandler    (int sampleCount, short *srcPtr, short *dstPtr);
13871 +extern void            SM_DECL SoftModemTimer                  (long timeQ24ms);
13872 +extern Boolean SM_DECL SoftModemCommandHandler (modemCommandStruct *cmdPtr);
13873 +extern int             SM_DECL SoftModemGetExternalMemorySize(void);
13874 +extern void            SM_DECL SoftModemSetExternalMemoryPtr(void      *varsPtr);
13875 +
13876 +extern void            SM_DECL SoftModemSetPcmCoding   (pcmCodingType pcmCoding);
13877 +extern void            SM_DECL SoftModemPcmLineHandler (int sampleCount, uchar *srcPtr, uchar *dstPtr);
13878 +
13879 +/* SoftModem IO functions      */
13880 +extern int             SM_DECL SoftModemWrite(int nBytes, uchar* srcPtr);
13881 +extern int             SM_DECL SoftModemRead(int nBytes, uchar* dstPtr);
13882 +extern int             SM_DECL SoftModemWriteFrame(int nBytes, uchar* srcPtr);
13883 +extern int             SM_DECL SoftModemReadFrame(int maxFrameSize, uchar* dstPtr);
13884 +extern int             SM_DECL SoftModemCountWritePending(void);
13885 +extern int             SM_DECL SoftModemCountReadPending(void);
13886 +extern int             SM_DECL SoftModemWriteSpaceAvailable(void);
13887 +extern void            SM_DECL SoftModemWriteFlush(void);
13888 +extern void            SM_DECL SoftModemReadFlush(void);
13889 +extern int             SM_DECL SoftModemGetWriteBufferSize(void);
13890 +extern int             SM_DECL SoftModemGetReadBufferSize(void);
13891 +
13892 +#ifdef AUDIO
13893 +extern int             SM_DECL SoftModemAudioHandler(int sampleCount, short *srcPtr, short *dstPtr);
13894 +extern int             SM_DECL SoftModemAudioRxDataHandler(int nBytes, uchar* srcPtr);
13895 +extern int             SM_DECL SoftModemAudioTxDataHandler(int nBytes, uchar* dstPtr);
13896 +#endif
13897 +
13898 +
13899 +#define        SoftModemSetGlobalPtr   SoftModemSetMemoryPtr
13900 +#define        SoftModem                               SoftModemLineHandler
13901 +#ifndef LINKLAYER_V42BIS_LARGE_DICTIONARY
13902 +#define        kSoftModemMaxMemorySize (65536)
13903 +#else
13904 +#define        kSoftModemMaxMemorySize (65536 + 8192)
13905 +#endif
13906 +
13907 +/*
13908 + * Internal functions
13909 + */
13910 +extern long    SM_DECL SoftModemGetDCOffset(void);
13911 +extern void    SM_DECL SoftModemDisableDCOffsetTracking(void);
13912 +extern void    SM_DECL SoftModemEnableDCOffsetTracking(void);
13913 +extern long    SM_DECL SoftModemGetRcvPower(void);
13914 +extern ulong   SM_DECL SoftModemGetHybridDelay(void);
13915 +extern  void   SM_DECL SoftModemStatusHandler  (modemStatusStruct *status);
13916 +extern Boolean SM_DECL SoftModemInternalCommandHandler (modemCommandStruct *cmdPtr);
13917 +extern  void   SM_DECL SoftModemInternalStatusHandler  (modemStatusStruct *status);
13918 +extern void    SM_DECL SoftModemSetControllerOnlyMode(commandHandlerType externalDataPumpCommandHandlerPtr);
13919 +extern char*   SM_DECL SoftModemGetRevString(void);
13920 +extern char*   SM_DECL SoftModemGetProductName(void);
13921 +extern char*   SM_DECL SoftModemGetBuildDate(void);
13922 +extern char*   SM_DECL SoftModemGetFullManufacturerName(void);
13923 +extern char*   SM_DECL SoftModemGetShortManufacturerName(void);
13924 +extern int             SM_DECL SoftModemRevStringSize(void);
13925 +extern char*   SM_DECL SoftModemGetVendorIDString(void);
13926 +extern char*   SM_DECL SoftModemGetSerialNumberString(void);
13927 +extern  void   SM_DECL SoftModemAuxTxDataHandler(int nBytes, uchar *dataPtr);
13928 +extern void    SM_DECL SoftModemAuxRxDataHandler(int nBytes, uchar *dataPtr);
13929 +extern  void   SM_DECL SoftModemTxDataHandler(int nBytes, uchar *dataPtr);
13930 +extern void    SM_DECL SoftModemRxDataHandler(int nBytes, uchar *dataPtr);
13931 +extern void    SM_DECL SoftModemATPrintf(uchar *format, void *arg1, void *arg2, void *arg3);
13932 +
13933 +#define        SoftModemSetInputSaturationLimit(limit)         (gSystemVars.inputSignalLimit = limit)  
13934 +#define        SoftModemResetInputSaturationLimit()            (gSystemVars.inputSignalLimit = 0)
13935 +
13936 +#endif /* !ADSL_MODEM */
13937 +
13938 +#endif /* SoftModemPh */
13939 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModemTypes.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModemTypes.h
13940 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModemTypes.h       1970-01-01 01:00:00.000000000 +0100
13941 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/bcm96348/softdsl/SoftModemTypes.h      2006-06-26 09:07:10.000000000 +0200
13942 @@ -0,0 +1,292 @@
13943 +/*
13944 +<:copyright-broadcom 
13945
13946 + Copyright (c) 2002 Broadcom Corporation 
13947 + All Rights Reserved 
13948 + No portions of this material may be reproduced in any form without the 
13949 + written permission of: 
13950 +          Broadcom Corporation 
13951 +          16215 Alton Parkway 
13952 +          Irvine, California 92619 
13953 + All information contained in this document is Broadcom Corporation 
13954 + company private, proprietary, and trade secret. 
13955
13956 +:>
13957 +*/
13958 +/****************************************************************************
13959 + *
13960 + * SoftModemTypes.h 
13961 + *
13962 + *
13963 + * Description:
13964 + *     This file contains some of the type declarations for SoftModem
13965 + *
13966 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
13967 + * Authors: Mark Gonikberg, Haixiang Liang.
13968 + *
13969 + * $Revision: 1.9 $
13970 + *
13971 + * $Id: SoftModemTypes.h,v 1.9 2004/04/13 00:16:59 ilyas Exp $
13972 + *
13973 + * $Log: SoftModemTypes.h,v $
13974 + * Revision 1.9  2004/04/13 00:16:59  ilyas
13975 + * Merged the latest ADSL driver changes
13976 + *
13977 + * Revision 1.8  2004/01/24 01:35:33  ytan
13978 + * add multi-section lmem swap
13979 + *
13980 + * Revision 1.7  2001/09/21 19:19:01  ilyas
13981 + * Minor fixes for VxWorks build
13982 + *
13983 + * Revision 1.6  2001/08/16 02:16:39  khp
13984 + * - added definitions for SLOW_DATA and FAST_TEXT, defined to nothing
13985 + *   except when bcm47xx && USE_SLOW_DATA or USE_FAST_TEXT.  Any function
13986 + *   that needs to run fast should be marked with FAST_TEXT.  Any data that
13987 + *   is not referenced often should be marked with SLOW_DATA.
13988 + *
13989 + * Revision 1.5  2001/03/30 00:49:59  liang
13990 + * Changed warning output message.
13991 + *
13992 + * Revision 1.4  2000/06/21 22:24:40  yongbing
13993 + * Modify WARN micro to limit the number of same warnings printed
13994 + *
13995 + * Revision 1.3  1999/08/05 20:02:13  liang
13996 + * Merged with the softmodem top of the tree on 08/04/99.
13997 + *
13998 + * Revision 1.2  1999/01/27 22:14:29  liang
13999 + * Merge with SoftModem_3_1_02.
14000 + *
14001 + * Revision 1.19  1998/11/17 04:02:39  yura
14002 + * Fixed WARN and ASSERT redefinition warning for WinNT targets
14003 + *
14004 + * Revision 1.18  1998/08/26 19:20:43  scott
14005 + * Commented out EXCLUDE_CYGWIN32_TYPES define
14006 + *
14007 + * Revision 1.17  1998/08/13 19:03:06  scott
14008 + * Added BitField definition and INT_IS_LONG
14009 + *
14010 + * Revision 1.16  1998/08/08 03:39:55  scott
14011 + * The DEBUG_PTR_ENABLED macro can be used to enable only the DEBUG_PTR macros
14012 + *
14013 + * Revision 1.15  1998/07/28 22:21:31  mwg
14014 + * Fixed problems with NULL & nil being defined incorrectly
14015 + *
14016 + * Revision 1.14  1998/07/08 17:09:17  scott
14017 + * Define ASSERT and WARN only if not already defined
14018 + *
14019 + * Revision 1.13  1998/07/02 20:46:34  scott
14020 + * Added workaround for building certain builds with older SunOS
14021 + *
14022 + * Revision 1.12  1998/02/09 18:24:49  scott
14023 + * Defined "Private" as nothing for GreenHill (to prevent erroneous section
14024 + * allocations for data)
14025 + *
14026 + * Revision 1.11  1997/08/29 21:39:24  scott
14027 + * Added check for LONG_IS_INT define (for TI C6X support)
14028 + *
14029 + * Revision 1.10  1997/05/29 19:50:23  mwg
14030 + * Added code to avoid type redefintions under SunOS.
14031 + *
14032 + * Revision 1.9  1997/03/19 18:35:08  mwg
14033 + * Changed copyright notice.
14034 + *
14035 + * Revision 1.8  1997/02/11  00:05:53  mwg
14036 + * Minor adjustments for Pentium optimization.
14037 + *
14038 + * Revision 1.7  1997/01/11  01:30:47  mwg
14039 + * Added new macro WARN -- the same as ASSERT but without exit.
14040 + *
14041 + * Revision 1.6  1996/08/22  20:07:39  liang
14042 + * When ASSERT fires, only print out information, don't exit.
14043 + *
14044 + * Revision 1.5  1996/05/06  06:49:10  mwg
14045 + * Fixed linux problems.
14046 + *
14047 + * Revision 1.4  1996/05/02  08:40:16  mwg
14048 + * Merged in Chromatic bug fixes.
14049 + *
14050 + * Revision 1.3  1996/04/01  20:59:53  mwg
14051 + * Added macros to setup and use debug pointer.
14052 + *
14053 + * Revision 1.2  1996/02/27  01:50:04  mwg
14054 + * Added ASSERT() macro.
14055 + *
14056 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
14057 + * Redesigned the project directory structure. Merged V.34 into the project.
14058 + *
14059 + * Revision 1.2  1995/12/03  06:59:31  mwg
14060 + * Fixed all gcc varnings. We are now running under Linux on a PC!
14061 + *
14062 + *****************************************************************************/
14063 +#ifndef        SoftModemTypesh
14064 +#define        SoftModemTypesh
14065 +
14066 +#ifdef LONG_SHORTS
14067 +#define        short   long
14068 +#define        ushort  unsigned long
14069 +#endif
14070 +
14071 +typedef signed char                    schar;
14072 +typedef unsigned char          uchar;
14073 +
14074 +#if 0 /* This is not currently required */
14075 +#if defined(_CYGWIN32) && defined(DEBUG)
14076 +#define EXCLUDE_CYGWIN32_TYPES
14077 +#endif
14078 +#endif
14079 +
14080 +#if !defined(_SYS_TYPES_H) || !defined(TARG_OS_RTEMS)
14081 +#if defined(_CFE_)
14082 + typedef unsigned int          uint;
14083 + typedef unsigned long         ulong;
14084 + typedef unsigned short                ushort;
14085 +#elif defined(TARG_OS_RTEMS)
14086 +#if defined(HOST_ARCH_LINUX)
14087 + typedef unsigned int          uint;
14088 +#endif
14089 + typedef unsigned long         ulong;
14090 +#if defined(HOST_ARCH_LINUX)
14091 + typedef unsigned short                ushort;
14092 +#endif
14093 +#elif defined(EXCLUDE_CYGWIN32_TYPES) || (!defined _NO_TYPE_DEFS_ && !defined _SYS_TYPES_H && !defined __SYS_TYPES_H__ && !defined _SYS_BSD_TYPES_H && !defined _LINUX_TYPES_H) || defined(__sparc__)
14094 +#ifndef EXCLUDE_CYGWIN32_TYPES
14095 + typedef unsigned int          uint;
14096 +#endif
14097 +#ifndef _LINUX_TYPES_H
14098 + typedef unsigned long         ulong;
14099 +#endif
14100 +#if !defined(ushort) && !defined(EXCLUDE_CYGWIN32_TYPES) && !defined(__INCvxTypesOldh)
14101 + typedef unsigned short                ushort;
14102 +#endif
14103 +#endif
14104 +#else
14105 +typedef unsigned long          ulong;
14106 +#endif
14107 +
14108 +#if defined(GREENHILL) || defined(GNUTX39) /* GH allocates private data to incorrect section */
14109 +#define Private
14110 +#else
14111 +#define Private             static
14112 +#endif
14113 +
14114 +#define Public
14115 +
14116 +#ifdef NULL
14117 +#undef NULL
14118 +#endif
14119 +#ifdef nil
14120 +#undef nil
14121 +#endif
14122 +
14123 +#define NULL 0
14124 +#define nil 0
14125 +
14126 +#define false 0
14127 +#define true 1
14128 +typedef unsigned char Boolean;
14129 +typedef unsigned int BitField; /* this must occur BEFORE long_is_int/int_is_long defs */
14130 +
14131 +#ifdef LONG_IS_INT
14132 +#define long int
14133 +#define ulong uint
14134 +#endif
14135 +
14136 +#ifdef INT_IS_LONG
14137 +#define int long
14138 +#define uint ulong
14139 +#endif
14140 +
14141 +#define POSTULATE(postulate)                                                                                   \
14142 +   do                                                                                                                                  \
14143 +          {                                                                                                                            \
14144 +          typedef struct                                                                                                       \
14145 +                  {                                                                                                                    \
14146 +                  char NegativeSizeIfPostulateFalse[((int)(postulate))*2 - 1]; \
14147 +                  } PostulateCheckStruct;                                                                              \
14148 +          }                                                                                                                            \
14149 +   while (0)
14150 +
14151 +#if defined(DEBUG) && !defined(__KERNEL__)
14152 +#ifndef WARN
14153 +#define        kDSLNumberWarnTimes     10
14154 +#define WARN(assertion) \
14155 +       { static int    warnSeveralTimes=0;     \
14156 +         if ((!(assertion))&(warnSeveralTimes<kDSLNumberWarnTimes)) \
14157 +               { \
14158 +               fprintf(stderr, "Warning, failed: %s\n", #assertion); \
14159 +               fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); \
14160 +               warnSeveralTimes++;     \
14161 +               } \
14162 +       }
14163 +#endif
14164 +#ifndef ASSERT
14165 +#define ASSERT(assertion) \
14166 +       { if (!(assertion)) \
14167 +               { \
14168 +               fprintf(stderr, "Assertion failed: %s\n", #assertion); \
14169 +               fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); \
14170 +               exit(1); \
14171 +               } \
14172 +       }
14173 +#endif
14174 +#else
14175 +
14176 +#undef WARN
14177 +#define        WARN(a)
14178 +
14179 +#undef ASSERT
14180 +#define        ASSERT(a)
14181 +
14182 +#endif
14183 +
14184 +/*
14185 + * memory allocation macros
14186 + */
14187 +
14188 +#if defined(bcm47xx) && defined(USE_SLOW_DATA)
14189 +#define SLOW_DATA __attribute__ ((section(".slow_data")))
14190 +#else
14191 +#define SLOW_DATA
14192 +#endif
14193 +
14194 +#if defined(bcm47xx) && defined(USE_FAST_TEXT)
14195 +#define FAST_TEXT __attribute__ ((section(".fast_text")))
14196 +#else
14197 +#define FAST_TEXT
14198 +#endif
14199 +
14200 +#if defined(bcm47xx) && defined(SWAP_LMEM)
14201 +#define SWAP_TEXT1_1 __attribute__ ((section(".swap_text1_1")))
14202 +#define SWAP_TEXT1_2 __attribute__ ((section(".swap_text1_2")))
14203 +#define SWAP_TEXT2_1 __attribute__ ((section(".swap_text2_1")))
14204 +#define SWAP_TEXT2_2 __attribute__ ((section(".swap_text2_2")))
14205 +#define SWAP_TEXT3_1 __attribute__ ((section(".swap_text3_1")))
14206 +#define SWAP_TEXT3_2 __attribute__ ((section(".swap_text3_2")))
14207 +#else
14208 +#define SWAP_TEXT1_1 FAST_TEXT
14209 +#define SWAP_TEXT1_2 FAST_TEXT
14210 +#define SWAP_TEXT2_1 FAST_TEXT
14211 +#define SWAP_TEXT2_2 FAST_TEXT
14212 +#define SWAP_TEXT3_1 FAST_TEXT
14213 +#define SWAP_TEXT3_2 FAST_TEXT
14214 +#endif
14215 +
14216 +/*
14217 + * Debug stuff
14218 + */
14219 +#if defined(DEBUG) || defined(DEBUG_PTR_ENABLED)
14220 +#define        DECLARE_DEBUG_PTR(type)         static  type    *gv;
14221 +#define        SETUP_DEBUG_PTR()                       gv = &globalVar
14222 +#else
14223 +#define        DECLARE_DEBUG_PTR(type)
14224 +#define        SETUP_DEBUG_PTR()
14225 +#endif
14226 +/*
14227 + * Obsolete stuff
14228 + */
14229 +#ifdef DEBUG
14230 +#define        HereIsTheGlobalVarPointerMacro          SETUP_DEBUG_PTR();
14231 +#else
14232 +#define        HereIsTheGlobalVarPointerMacro
14233 +#endif
14234 +#endif
14235 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_defs.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_defs.h
14236 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_defs.h  1970-01-01 01:00:00.000000000 +0100
14237 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_defs.h 2006-06-26 09:07:10.000000000 +0200
14238 @@ -0,0 +1,133 @@
14239 +/* TARGET=bcm6348-dmt-T1-dmtbis-adsl2plus-L2-SRA-firmware-Qproc-HW-RTL-pipeline-IncOneBit-Readsl2-doubleUS  */
14240 +
14241 +#define SOURCE_FILE_ 
14242 +#define BCM6348_SRC 
14243 +#define G994_T1P413_1024_FFT 
14244 +#define ENABLE_DIG_USPWR_CUTBACK 
14245 +#define ADSLCORE_ONLY 
14246 +#define TEQ_DF 
14247 +#define LOOP_TIMING_PLL 
14248 +#define RCV_PHASE_TWEAK_ONLY 
14249 +#define ADSL_MAX_POSSIBLE_RCV_RATE 
14250 +#define HARDWARE_CHANNEL 
14251 +#define ADSL_HARDWARE_AGC 
14252 +#define HW_CHANNEL_ADC 
14253 +#define HW_CHANNEL_DAC 
14254 +#define HW_PGA 
14255 +#define DIGITALEC_SINGLE_TAP_UPDATE 
14256 +#define ANALOGEC_SINGLE_TAP_UPDATE 
14257 +#define HWLOG 
14258 +#define G992_TRELLIS_CODE_CLAMPING 
14259 +#define G992DECODERTRELLISBOUNDARY 
14260 +#define MEMORYLIMIT64K 
14261 +#define bcm47xx 
14262 +#define DSL_BIG_ENDIAN 
14263 +#define MIPS_SRC 
14264 +#define VP_INLINE -Winline 
14265 +#define USE_ASM_API 
14266 +#define RTL_SRC 
14267 +#define RSENC_INLINE 
14268 +#define BITENC_INLINE 
14269 +#define USE_SLOW_DATA 
14270 +#define USE_FAST_TEXT 
14271 +#define PROFILE_INLINE 
14272 +#define CHIP_SRC 
14273 +#define G992_RESYNC_PILOT_PHASE_IN_SHOWTIME 
14274 +#define G992_APPLY_SSVI 
14275 +#define SHARE_TEQ_VARS 
14276 +#define ANNEX_M 
14277 +#define DOUBLE_UP_STREAM 
14278 +#define G994P1_SUPPORT_A43C 
14279 +#define USE_ASM_API 
14280 +#define MIPS_ASM 
14281 +#define MEMORYLIMIT64K 
14282 +#define ADSL_FIRMWARE 
14283 +#define G992DATA_XMT_COMPACT_WORD 
14284 +#define ADSL_MAX_POSSIBLE_RCV_RATE 
14285 +#define DSP_FRONTEND_ONLY 
14286 +#define G992P3_ONE_BIT_CONSTELLATION 
14287 +#define ADSL_MODEM 
14288 +#define ATM 
14289 +#define ADSL_ATUR 
14290 +#define ADSL_SOFTWARE_TIME_ERROR_CALCULATION 
14291 +#define DSL_REPORT_ALL_COUNTERS 
14292 +#define ADSL_MONITOR_LCD 
14293 +#define G994P1 
14294 +#define G994P1_ATUR 
14295 +#define G992 
14296 +#define G992_ATUR 
14297 +#define ADSL_FRAMER 
14298 +#define G997_1 
14299 +#define ATM_I432 
14300 +#define TEQ_DF 
14301 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
14302 +#define G994P1_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
14303 +#define G992_TRELLISCODE 
14304 +#define ADSL_HARDWARE_ECHO_CANCELLOR 
14305 +#define G992P1 
14306 +#define G992P1_ATUR 
14307 +#define G992P1_ANNEX_A 
14308 +#define ADSL_HARDWARE_TIME_ERROR_TRACKING 
14309 +#define G992P1_NEWFRAME 
14310 +#define G992P1_NEWFRAME_ATUR 
14311 +#define G992P1_ANNEX_A_USED_FOR_G992P2 
14312 +#define T1P413 
14313 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
14314 +#define G992_CALC_DEBUG_SNR_BEFORE_TEQ 
14315 +#define G992P3 
14316 +#define RATE_SELECT_E14 
14317 +#define G992P3_ATUR 
14318 +#define G992P3AMENDMENT 
14319 +#define GLOBESPAN_DM 
14320 +#define G992P3_COMB_MSG_THREE_COPIES 
14321 +#define G992P3_POWER_MANAGEMENT 
14322 +#define G992P3_SRA 
14323 +#define G992P5 
14324 +#define G992P5_ATUR 
14325 +#define ADSL_PIPELINE_CODE 
14326 +#define ADSL_HARDWARE_TIME_ERROR_TRACKING 
14327 +#define G994P1RCV_QPROC 
14328 +#define G994P1XMT_QPROC 
14329 +#define G992RCV_QPROC 
14330 +#define G992XMT_QPROC 
14331 +#define G992RCV_RS 
14332 +#define VP_SIMULATOR 
14333 +#define T1P413RCV_QPROC 
14334 +#define T1P413XMT_QPROC 
14335 +#define G992ENC_HW_DATAMODE 
14336 +#define G992DATA_XMT_HW_RS 
14337 +#define G992DATA_XMT_COMPACT_WORD 
14338 +#define G992RCV_QPROC_FAST 
14339 +#define G992_BIT_SWAP 
14340 +#define ADSL_IDENTIFY_VENDOR_FIRMWARE 
14341 +#define ADSL_ATUR_FORCE_BIGGER_UPSTREAM_MARGIN 
14342 +#define G992_MORE_FRAME_MODE 
14343 +#define XMT_RACT2_FOR_ADI_COMPATIBILITY 
14344 +#define XMT_FFT_SIZE_2X 
14345 +#define SYNCH_SYMBOL_DETECTION 
14346 +#define ANSI_CACT12_PING_PONG 
14347 +#define ADSL_SPECIAL_FIX_FOR_FRENCH_TELECOM 
14348 +#define G994P1_CHECK_SECURITY 
14349 +#define G994P1_NON_STD_INFO 
14350 +#define I432_HEADER_COMPRESSION 
14351 +#define TDC_IOP_FIX_ERICSSON_TI_4000C_350 
14352 +#define TDC_IOP_FIX_SEIMENS_TI 
14353 +#define FT_ADI_US_RATE_FIX 
14354 +#define ANSI_CACT12_PING_PONG 
14355 +#define G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
14356 +#define G994P1_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ 
14357 +#define READSL2 
14358 +#define G992_APPLY_SSVI 
14359 +#define READSL2_FILTERS
14360 +
14361 +
14362 +#define ADSL_PHY_XFACE_OFFSET 0x21F90
14363 +
14364 +
14365 +#define ADSL_PHY_SDRAM_BIAS 0x1A0000
14366 +
14367 +
14368 +#define ADSL_PHY_SDRAM_LINK_OFFSET 0x1A0000
14369 +
14370 +
14371 +#define ADSL_PHY_SDRAM_PAGE_SIZE 0x200000
14372 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_lmem.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_lmem.h
14373 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_lmem.h  1970-01-01 01:00:00.000000000 +0100
14374 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_lmem.h 2006-06-26 09:07:10.000000000 +0200
14375 @@ -0,0 +1,6 @@
14376 +/*
14377 +**     Don't change!
14378 +**     This file has been generated automatically by bin2c program
14379 +*/
14380 +
14381 +extern const unsigned char adsl_lmem[51036];
14382 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_sdram.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_sdram.h
14383 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_sdram.h 1970-01-01 01:00:00.000000000 +0100
14384 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/adslcore6348/adsl_sdram.h        2006-06-26 09:07:10.000000000 +0200
14385 @@ -0,0 +1,6 @@
14386 +/*
14387 +**     Don't change!
14388 +**     This file has been generated automatically by bin2c program
14389 +*/
14390 +
14391 +extern const unsigned char adsl_sdram[364348];
14392 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslCoreDefs.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslCoreDefs.h
14393 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslCoreDefs.h    1970-01-01 01:00:00.000000000 +0100
14394 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslCoreDefs.h   2006-06-26 09:07:10.000000000 +0200
14395 @@ -0,0 +1,245 @@
14396 +/*
14397 +<:copyright-broadcom 
14398
14399 + Copyright (c) 2002 Broadcom Corporation 
14400 + All Rights Reserved 
14401 + No portions of this material may be reproduced in any form without the 
14402 + written permission of: 
14403 +          Broadcom Corporation 
14404 +          16215 Alton Parkway 
14405 +          Irvine, California 92619 
14406 + All information contained in this document is Broadcom Corporation 
14407 + company private, proprietary, and trade secret. 
14408
14409 +:>
14410 +*/
14411 +/****************************************************************************
14412 + *
14413 + * AdslCore.c -- Bcm ADSL core driver
14414 + *
14415 + * Description:
14416 + *     This file contains BCM ADSL core driver 
14417 + *
14418 + *
14419 + * Copyright (c) 2000-2001  Broadcom Corporation
14420 + * All Rights Reserved
14421 + * No portions of this material may be reproduced in any form without the
14422 + * written permission of:
14423 + *          Broadcom Corporation
14424 + *          16215 Alton Parkway
14425 + *          Irvine, California 92619
14426 + * All information contained in this document is Broadcom Corporation
14427 + * company private, proprietary, and trade secret.
14428 + * Authors: Ilya Stomakhin
14429 + *
14430 + * $Revision: 1.4 $
14431 + *
14432 + * $Id: AdslCoreDefs.h,v 1.4 2004/07/20 23:45:48 ilyas Exp $
14433 + *
14434 + * $Log: AdslCoreDefs.h,v $
14435 + * Revision 1.4  2004/07/20 23:45:48  ilyas
14436 + * Added driver version info, SoftDslPrintf support. Fixed G.997 related issues
14437 + *
14438 + * Revision 1.3  2004/06/10 00:20:33  ilyas
14439 + * Added L2/L3 and SRA
14440 + *
14441 + * Revision 1.2  2004/04/12 23:24:38  ilyas
14442 + * Added default G992P5 PHY definition
14443 + *
14444 + * Revision 1.1  2004/04/08 23:59:15  ilyas
14445 + * Initial CVS checkin
14446 + *
14447 + ****************************************************************************/
14448 +
14449 +#ifndef _ADSL_CORE_DEFS_H
14450 +#define _ADSL_CORE_DEFS_H
14451 +
14452 +#if defined(__KERNEL__)
14453 +#include <linux/config.h>
14454 +#endif
14455 +
14456 +#if defined(CONFIG_BCM96348) || defined(BOARD_bcm96348) || defined(_BCM96348_) ||  defined(CONFIG_BCM96338) || defined(BOARD_bcm96338) || defined(_BCM96338_)
14457 +#ifdef ADSL_ANNEXC
14458 +#include "../adslcore6348C/adsl_defs.h"
14459 +#elif defined(ADSL_ANNEXB)
14460 +#include "../adslcore6348B/adsl_defs.h"
14461 +#elif defined(ADSL_SADSL)
14462 +#include "../adslcore6348SA/adsl_defs.h"
14463 +#else
14464 +#include "../adslcore6348/adsl_defs.h"
14465 +#endif
14466 +#endif
14467 +
14468 +#if defined(__KERNEL__) || defined(TARG_OS_RTEMS) || defined(_CFE_)
14469 +#if defined(CONFIG_BCM96345) || defined(BOARD_bcm96345) || defined(_BCM96345_)
14470 +#ifdef ADSL_ANNEXC
14471 +#include "../adslcore6345C/adsl_defs.h"
14472 +#elif defined(ADSL_ANNEXB)
14473 +#include "../adslcore6345B/adsl_defs.h"
14474 +#elif defined(ADSL_SADSL)
14475 +#include "../adslcore6345SA/adsl_defs.h"
14476 +#else
14477 +#include "../adslcore6345/adsl_defs.h"
14478 +#endif
14479 +#endif /* of CONFIG_BCM96345 */
14480 +#else
14481 +#if defined(CONFIG_BCM96345)
14482 +#ifdef ADSL_ANNEXC
14483 +#include "../adslcoreC/adsl_defs.h"
14484 +#elif defined(ADSL_ANNEXB)
14485 +#include "../adslcoreB/adsl_defs.h"
14486 +#elif defined(ADSL_SADSL)
14487 +#include "../adslcoreSA/adsl_defs.h"
14488 +#else
14489 +#include "../adslcore/adsl_defs.h"
14490 +#endif
14491 +#endif /* of CONFIG_BCM96345 */
14492 +#endif /* __KERNEL__ */
14493 +
14494 +#ifdef _WIN32_WCE
14495 +#define        ASSERT(a)
14496 +#endif
14497 +
14498 +#include "AdslXfaceData.h"
14499 +
14500 +/* adjust some definitions for the HOST */
14501 +
14502 +#undef GLOBAL_PTR_BIAS
14503 +#undef ADSLCORE_ONLY
14504 +#undef USE_SLOW_DATA 
14505 +#undef USE_FAST_TEXT 
14506 +#undef VP_SIMULATOR 
14507 +#undef bcm47xx 
14508 +#undef ADSL_FRAMER
14509 +#undef ATM
14510 +#undef ATM_I432 
14511 +#undef DSL_OS
14512 +
14513 +#define HOST_ONLY
14514 +#define G997_1_FRAMER
14515 +#define ADSL_MIB
14516 +
14517 +#ifndef FLATTEN_ADDR_ADJUST
14518 +#define FLATTEN_ADDR_ADJUST    0xFFF00000
14519 +#endif
14520 +
14521 +/* definitions for combo PHY (AnnexA(ADSL2) and AnnexB) */
14522
14523 +#if !(defined(ADSL_SINGLE_PHY) || defined(G992_ANNEXC))
14524 +
14525 +#undef G992P1_ANNEX_A
14526 +#define        G992P1_ANNEX_A
14527 +#undef G992P3
14528 +#define        G992P3
14529 +#undef G992P5
14530 +#define        G992P5
14531 +#define        G992P1_ANNEX_A
14532 +#undef READSL2
14533 +#define        READSL2
14534 +#undef G992P1_ANNEX_A_USED_FOR_G992P2
14535 +#define        G992P1_ANNEX_A_USED_FOR_G992P2
14536 +#undef T1P413
14537 +#define        T1P413
14538 +
14539 +#undef G992P1_ANNEX_B
14540 +#define        G992P1_ANNEX_B
14541 +
14542 +#endif
14543 +
14544 +/* ADSL PHY definition */
14545 +
14546 +typedef struct {
14547 +       unsigned long   sdramPageAddr;
14548 +       unsigned long   sdramImageAddr;
14549 +       unsigned long   sdramImageSize;
14550 +       unsigned long   sdramPhyImageAddr;
14551 +       unsigned short  fwType;
14552 +       unsigned short  chipType;
14553 +       unsigned short  mjVerNum;
14554 +       unsigned short  mnVerNum;
14555 +       char                    *pVerStr;
14556 +       unsigned long   features[4];
14557 +} adslPhyInfo;
14558 +extern adslPhyInfo     adslCorePhyDesc;
14559 +
14560 +/* chip list */ 
14561 +
14562 +#define        kAdslPhyChipMjMask                      0xFF00
14563 +#define        kAdslPhyChipMnMask                      0x00FF
14564 +#define        kAdslPhyChipUnknown                     0
14565 +#define        kAdslPhyChip6345                        0x100
14566 +#define        kAdslPhyChip6348                        0x200
14567 +#define        kAdslPhyChipRev0                        0
14568 +#define        kAdslPhyChipRev1                        1
14569 +#define        kAdslPhyChipRev2                        2
14570 +#define        kAdslPhyChipRev3                        3
14571 +#define        kAdslPhyChipRev4                        4
14572 +#define        kAdslPhyChipRev5                        5
14573 +
14574 +#define        ADSL_PHY_SUPPORT(f)                     AdslFeatureSupported(adslCorePhyDesc.features,f)
14575 +#define        ADSL_PHY_SET_SUPPORT(p,f)       AdslFeatureSet((p)->features,f)
14576 +
14577 +/* ADSL Driver to/from PHY address and data conversion macros */
14578 +
14579 +#ifdef  ADSLDRV_LITTLE_ENDIAN
14580 +#define        ADSL_ENDIAN_CONV_LONG(x)        ( ((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((unsigned long)(x) >> 24) )
14581 +#define        ADSL_ENDIAN_CONV_SHORT(x)       ( ((x) << 8) | ((unsigned short)(x) >> 8) )
14582 +#define ADSL_ENDIAN_CONV_2SHORTS(x)    ( ((x) << 16) | ((unsigned long)(x) >> 16) )
14583 +#else
14584 +#define        ADSL_ENDIAN_CONV_LONG(x)        x
14585 +#define        ADSL_ENDIAN_CONV_SHORT(x)       x
14586 +#define ADSL_ENDIAN_CONV_2SHORTS(x)    x
14587 +#endif
14588 +
14589 +#ifndef ADSL_PHY_XFACE_OFFSET
14590 +#define ADSL_PHY_XFACE_OFFSET                  0x00017F90
14591 +#endif
14592 +#define ADSL_LMEM_XFACE_DATA                   (0xFFF00000 | ADSL_PHY_XFACE_OFFSET)
14593 +
14594 +#ifndef ADSL_PHY_SDRAM_START
14595 +#define ADSL_PHY_SDRAM_START                   0x10000000
14596 +#endif
14597 +#ifndef ADSL_PHY_SDRAM_BIAS
14598 +#define ADSL_PHY_SDRAM_BIAS                            0x00040000
14599 +#endif
14600 +#define        ADSL_PHY_SDRAM_START_4                  (ADSL_PHY_SDRAM_START + ADSL_PHY_SDRAM_BIAS)
14601 +
14602 +#ifndef        ADSL_PHY_SDRAM_PAGE_SIZE
14603 +#define ADSL_PHY_SDRAM_PAGE_SIZE               0x00080000
14604 +#endif
14605 +
14606 +#ifdef ADSL_PHY_SDRAM_BIAS
14607 +#define ADSL_SDRAM_IMAGE_SIZE                  (ADSL_PHY_SDRAM_PAGE_SIZE - ADSL_PHY_SDRAM_BIAS)
14608 +#else
14609 +#define ADSL_SDRAM_IMAGE_SIZE                  (256*1024)
14610 +#endif
14611 +
14612 +
14613 +#ifndef        ADSL_PHY_SDRAM_LINK_OFFSET
14614 +#define ADSL_PHY_SDRAM_LINK_OFFSET             0x00040000
14615 +#endif
14616 +
14617 +#define ADSL_SDRAM_TOTAL_SIZE                  0x00800000
14618 +#define ADSL_SDRAM_HOST_MIPS_DEFAULT   (0xA0000000 | (ADSL_SDRAM_TOTAL_SIZE - ADSL_PHY_SDRAM_PAGE_SIZE + ADSL_PHY_SDRAM_BIAS))
14619 +
14620 +#define ADSLXF                                                 ((AdslXfaceData *) ADSL_LMEM_XFACE_DATA)
14621 +
14622 +#define ADSL_MIPS_LMEM_ADDR(a) (((ulong)(a) & 0x19000000) == 0x19000000)
14623 +#define        SDRAM_ADDR_TO_HOST(a)   ((void *) ((ulong)(a) - adslCorePhyDesc.sdramPhyImageAddr + \
14624 +       (ADSLXF->sdramBaseAddr ? (unsigned long) ADSLXF->sdramBaseAddr : ADSL_SDRAM_HOST_MIPS_DEFAULT)))
14625 +#define        SDRAM_ADDR_TO_ADSL(a)   ((void *) (adslCorePhyDesc.sdramPhyImageAddr + ((ulong)(a) - \
14626 +       (ADSLXF->sdramBaseAddr ? (unsigned long) ADSLXF->sdramBaseAddr : ADSL_SDRAM_HOST_MIPS_DEFAULT))))
14627 +
14628 +#define ADSL_ADDR_TO_HOST(addr)                ADSL_MIPS_LMEM_ADDR(addr) ? (void *) ((ulong) (addr) | FLATTEN_ADDR_ADJUST) : SDRAM_ADDR_TO_HOST(addr)
14629 +
14630 +
14631 +#ifndef DEBUG
14632 +#define DEBUG
14633 +#endif
14634 +
14635 +#ifndef __SoftDslPrintf
14636 +void __SoftDslPrintf(void *gDslVars, char *fmt, int argNum, ...);
14637 +#endif
14638 +
14639 +#endif
14640 +
14641 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.gh
14642 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.gh        1970-01-01 01:00:00.000000000 +0100
14643 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.gh       2006-06-26 09:07:10.000000000 +0200
14644 @@ -0,0 +1,94 @@
14645 +/****************************************************************************
14646 + *
14647 + * AdslMib.gh 
14648 + *
14649 + * Description:
14650 + *     This is a header file which defines the type for AdslMib
14651 + *     global variable structure.
14652 + *
14653 + *
14654 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
14655 + * Authors: Ilya Stomakhin
14656 + *
14657 + * $Revision: 1.8 $
14658 + *
14659 + * $Id: AdslMib.gh,v 1.8 2004/06/04 18:56:01 ilyas Exp $
14660 + *
14661 + * $Log: AdslMib.gh,v $
14662 + * Revision 1.8  2004/06/04 18:56:01  ilyas
14663 + * Added counter for ADSL2 framing and performance
14664 + *
14665 + * Revision 1.7  2003/10/17 21:02:12  ilyas
14666 + * Added more data for ADSL2
14667 + *
14668 + * Revision 1.6  2003/10/14 00:55:27  ilyas
14669 + * Added UAS, LOSS, SES error seconds counters.
14670 + * Support for 512 tones (AnnexI)
14671 + *
14672 + * Revision 1.5  2003/07/18 19:07:15  ilyas
14673 + * Merged with ADSL driver
14674 + *
14675 + * Revision 1.4  2002/11/13 21:32:49  ilyas
14676 + * Added adjustK support for Centillium non-standard framing mode
14677 + *
14678 + * Revision 1.3  2002/10/31 20:27:13  ilyas
14679 + * Merged with the latest changes for VxWorks/Linux driver
14680 + *
14681 + * Revision 1.2  2002/07/20 00:51:41  ilyas
14682 + * Merged witchanges made for VxWorks/Linux driver.
14683 + *
14684 + * Revision 1.1  2001/12/21 22:39:30  ilyas
14685 + * Added support for ADSL MIB data objects (RFC2662)
14686 + *
14687 + *
14688 + *****************************************************************************/
14689 +
14690 +#ifndef        AdslMibGlobals
14691 +#define        AdslMibGlobals
14692 +
14693 +#include "AdslMib.h"
14694 +
14695 +typedef struct
14696 +       {
14697 +       /* MIB data */
14698 +
14699 +       adslMibInfo                             adslMib;
14700 +
14701 +       /* ADSL state data */
14702 +
14703 +       adslMibNotifyHandlerType notifyHandlerPtr;
14704 +       ulong                                   timeSec;
14705 +       ulong                                   timeMs;
14706 +       Boolean                                 currSecondErrored;
14707 +       Boolean                                 currSecondLOS;
14708 +       Boolean                                 currSecondSES;
14709 +       Boolean                                 currSecondFEC;
14710 +       ulong                                   rcvPower;
14711 +       ulong                                   rcvRateBps;
14712 +       ulong                                   xmtRateBps;
14713 +       ulong                                   linkStatus;
14714 +       G992CodingParams                rcvParams;
14715 +       G992CodingParams                xmtParams;
14716 +       ulong                                   shtCounters[kG992ShowtimeNumOfMonitorCounters];
14717 +       ulong                                   scratchData;
14718 +       long                                    showtimeMarginThld;
14719 +
14720 +       /* ADSL diag data */
14721 +
14722 +       short                                   snr[kAdslMibMaxToneNum];
14723 +       short                                   showtimeMargin[kAdslMibMaxToneNum];
14724 +       uchar                                   bitAlloc[kAdslMibMaxToneNum];
14725 +       short                                   gain[kAdslMibMaxToneNum];
14726 +       ComplexShort                    chanCharLin[kAdslMibMaxToneNum];
14727 +       short                                   chanCharLog[kAdslMibMaxToneNum];
14728 +       short                                   quietLineNoise[kAdslMibMaxToneNum];
14729 +
14730 +       ushort                                  nTones;
14731 +       uchar                                   nMsgCnt;
14732 +       ulong                                   g992MsgType;
14733 +       uchar                                   rsOption[1+4];
14734 +       Boolean                                 rsOptionValid;
14735 +       }
14736 +       adslMibVarsStruct;
14737 +
14738 +#endif /* AdslMibGlobals */
14739 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.h
14740 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.h 1970-01-01 01:00:00.000000000 +0100
14741 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMib.h        2006-06-26 09:07:10.000000000 +0200
14742 @@ -0,0 +1,114 @@
14743 +/*
14744 +<:copyright-broadcom 
14745
14746 + Copyright (c) 2002 Broadcom Corporation 
14747 + All Rights Reserved 
14748 + No portions of this material may be reproduced in any form without the 
14749 + written permission of: 
14750 +          Broadcom Corporation 
14751 +          16215 Alton Parkway 
14752 +          Irvine, California 92619 
14753 + All information contained in this document is Broadcom Corporation 
14754 + company private, proprietary, and trade secret. 
14755
14756 +:>
14757 +*/
14758 +/****************************************************************************
14759 + *
14760 + * AdslMib.h 
14761 + *
14762 + * Description:
14763 + *     This file contains the exported functions and definitions for AdslMib
14764 + *
14765 + *
14766 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
14767 + * Authors: Ilya Stomakhin
14768 + *
14769 + * $Revision: 1.9 $
14770 + *
14771 + * $Id: AdslMib.h,v 1.9 2004/04/12 23:34:52 ilyas Exp $
14772 + *
14773 + * $Log: AdslMib.h,v $
14774 + * Revision 1.9  2004/04/12 23:34:52  ilyas
14775 + * Merged the latest ADSL driver chnages for ADSL2+
14776 + *
14777 + * Revision 1.8  2004/03/03 20:14:05  ilyas
14778 + * Merged changes for ADSL2+ from ADSL driver
14779 + *
14780 + * Revision 1.7  2003/10/14 00:55:27  ilyas
14781 + * Added UAS, LOSS, SES error seconds counters.
14782 + * Support for 512 tones (AnnexI)
14783 + *
14784 + * Revision 1.6  2003/07/18 19:07:15  ilyas
14785 + * Merged with ADSL driver
14786 + *
14787 + * Revision 1.5  2002/10/31 20:27:13  ilyas
14788 + * Merged with the latest changes for VxWorks/Linux driver
14789 + *
14790 + * Revision 1.4  2002/07/20 00:51:41  ilyas
14791 + * Merged witchanges made for VxWorks/Linux driver.
14792 + *
14793 + * Revision 1.3  2002/01/13 22:25:40  ilyas
14794 + * Added functions to get channels rate
14795 + *
14796 + * Revision 1.2  2002/01/03 06:03:36  ilyas
14797 + * Handle byte moves tha are not multiple of 2
14798 + *
14799 + * Revision 1.1  2001/12/21 22:39:30  ilyas
14800 + * Added support for ADSL MIB data objects (RFC2662)
14801 + *
14802 + *
14803 + *****************************************************************************/
14804 +
14805 +#ifndef        AdslMibHeader
14806 +#define        AdslMibHeader
14807 +
14808 +#if defined(_CFE_)
14809 +#include "lib_types.h"
14810 +#include "lib_string.h"
14811 +#endif
14812 +
14813 +#include "AdslMibDef.h"
14814 +
14815 +/* Interface functions */
14816 +
14817 +typedef        int     (SM_DECL *adslMibNotifyHandlerType)     (void *gDslVars, ulong event);
14818 +
14819 +extern Boolean  AdslMibInit(void *gDslVars);
14820 +extern void            AdslMibTimer(void *gDslVars, long timeMs);
14821 +extern void            AdslMibStatusSnooper (void *gDslVars, dslStatusStruct *status);
14822 +extern void            AdslMibSetNotifyHandler(void *gDslVars, adslMibNotifyHandlerType notifyHandlerPtr);
14823 +extern int             AdslMibGetModulationType(void *gDslVars);
14824 +extern Boolean AdslMibIsAdsl2Mod(void *gDslVars);
14825 +extern int             AdslMibGetActiveChannel(void *gDslVars);
14826 +extern int             AdslMibGetGetChannelRate(void *gDslVars, int dir, int channel);
14827 +extern Boolean  AdslMibIsLinkActive(void *gDslVars);
14828 +extern int             AdslMibPowerState(void *gDslVars);
14829 +extern int             AdslMibTrainingState (void *gDslVars);
14830 +extern void            AdslMibClearData(void *gDslVars);
14831 +extern void            AdslMibClearBertResults(void *gDslVars);
14832 +extern void            AdslMibBertStartEx(void *gDslVars, ulong bertSec);
14833 +extern void            AdslMibBertStopEx(void *gDslVars);
14834 +extern ulong   AdslMibBertContinueEx(void *gDslVars, ulong totalBits, ulong errBits);
14835 +extern void            AdslMibSetLPR(void *gDslVars);
14836 +extern void            AdslMibSetShowtimeMargin(void *gDslVars, long showtimeMargin);
14837 +extern void            AdslMibResetConectionStatCounters(void *gDslVars);
14838 +
14839 +extern void            AdslMibByteMove (int size, void* srcPtr, void* dstPtr);
14840 +extern void            AdslMibByteClear(int size, void* dstPtr);
14841 +extern int             AdslMibStrCopy(char *srcPtr, char *dstPtr);
14842 +
14843 +/* AdslMibGetData dataId codes */
14844 +
14845 +#define        kAdslMibDataAll                                 0
14846 +
14847 +extern void            *AdslMibGetData (void *gDslVars, int dataId, void *pAdslMibData);
14848 +
14849 +extern int             AdslMibGetObjectValue (
14850 +                                       void    *gDslVars, 
14851 +                                       uchar   *objId, 
14852 +                                       int             objIdLen,
14853 +                                       uchar   *dataBuf,
14854 +                                       ulong   *dataBufLen);
14855 +
14856 +#endif /* AdslMibHeader */
14857 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMibOid.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMibOid.h
14858 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMibOid.h      1970-01-01 01:00:00.000000000 +0100
14859 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslMibOid.h     2006-06-26 09:07:10.000000000 +0200
14860 @@ -0,0 +1,177 @@
14861 +/*
14862 +<:copyright-broadcom 
14863
14864 + Copyright (c) 2002 Broadcom Corporation 
14865 + All Rights Reserved 
14866 + No portions of this material may be reproduced in any form without the 
14867 + written permission of: 
14868 +          Broadcom Corporation 
14869 +          16215 Alton Parkway 
14870 +          Irvine, California 92619 
14871 + All information contained in this document is Broadcom Corporation 
14872 + company private, proprietary, and trade secret. 
14873
14874 +:>
14875 +*/
14876 +/****************************************************************************
14877 + *
14878 + * AdslMibOid.h 
14879 + *
14880 + * Description:
14881 + *     SNMP object identifiers for ADSL MIB and other related MIBs
14882 + *
14883 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
14884 + * Authors: Ilya Stomakhin
14885 + *
14886 + * $Revision: 1.5 $
14887 + *
14888 + * $Id: AdslMibOid.h,v 1.5 2004/06/04 18:56:01 ilyas Exp $
14889 + *
14890 + * $Log: AdslMibOid.h,v $
14891 + * Revision 1.5  2004/06/04 18:56:01  ilyas
14892 + * Added counter for ADSL2 framing and performance
14893 + *
14894 + * Revision 1.4  2003/10/17 21:02:12  ilyas
14895 + * Added more data for ADSL2
14896 + *
14897 + * Revision 1.3  2003/10/14 00:55:27  ilyas
14898 + * Added UAS, LOSS, SES error seconds counters.
14899 + * Support for 512 tones (AnnexI)
14900 + *
14901 + * Revision 1.2  2002/07/20 00:51:41  ilyas
14902 + * Merged witchanges made for VxWorks/Linux driver.
14903 + *
14904 + * Revision 1.1  2001/12/21 22:39:30  ilyas
14905 + * Added support for ADSL MIB data objects (RFC2662)
14906 + *
14907 + *
14908 + *****************************************************************************/
14909 +
14910 +#ifndef        AdslMibOidHeader
14911 +#define        AdslMibOidHeader
14912 +
14913 +#define kOidAdsl                                                       94
14914 +#define kOidAdslInterleave                                     124
14915 +#define kOidAdslFast                                           125
14916 +#define kOidAtm                                                                37
14917 +
14918 +#define kOidAdslLine                                           1
14919 +#define kOidAdslMibObjects                                     1
14920 +
14921 +#define kOidAdslLineTable                                      1
14922 +#define kOidAdslLineEntry                                      1
14923 +#define kOidAdslLineCoding                                     1
14924 +#define kOidAdslLineType                                       2
14925 +#define kOidAdslLineSpecific                       3
14926 +#define kOidAdslLineConfProfile                                4
14927 +#define kOidAdslLineAlarmConfProfile           5
14928 +
14929 +#define kOidAdslAtucPhysTable                          2
14930 +#define kOidAdslAturPhysTable                          3
14931 +#define kOidAdslPhysEntry                                      1
14932 +#define kOidAdslPhysInvSerialNumber            1
14933 +#define kOidAdslPhysInvVendorID             2
14934 +#define kOidAdslPhysInvVersionNumber           3
14935 +#define kOidAdslPhysCurrSnrMgn                 4
14936 +#define kOidAdslPhysCurrAtn                    5
14937 +#define kOidAdslPhysCurrStatus                 6
14938 +#define kOidAdslPhysCurrOutputPwr              7
14939 +#define kOidAdslPhysCurrAttainableRate         8
14940 +
14941 +#define kOidAdslAtucChanTable                          4
14942 +#define kOidAdslAturChanTable                          5
14943 +#define kOidAdslChanEntry                                      1
14944 +#define kOidAdslChanInterleaveDelay                    1
14945 +#define kOidAdslChanCurrTxRate                         2
14946 +#define kOidAdslChanPrevTxRate                 3
14947 +#define kOidAdslChanCrcBlockLength             4
14948 +
14949 +#define kOidAdslAtucPerfDataTable                      6
14950 +#define kOidAdslAturPerfDataTable                      7
14951 +#define kOidAdslPerfDataEntry                          1
14952 +#define kOidAdslPerfLofs                       1
14953 +#define kOidAdslPerfLoss                       2
14954 +#define kOidAdslPerfLprs                       3
14955 +#define kOidAdslPerfESs                        4
14956 +#define kOidAdslPerfValidIntervals          5
14957 +#define kOidAdslPerfInvalidIntervals           6
14958 +#define kOidAdslPerfCurr15MinTimeElapsed       7
14959 +#define kOidAdslPerfCurr15MinLofs              8
14960 +#define kOidAdslPerfCurr15MinLoss              9
14961 +#define kOidAdslPerfCurr15MinLprs              10
14962 +#define kOidAdslPerfCurr15MinESs               11
14963 +#define kOidAdslPerfCurr1DayTimeElapsed     12
14964 +#define kOidAdslPerfCurr1DayLofs               13
14965 +#define kOidAdslPerfCurr1DayLoss               14
14966 +#define kOidAdslPerfCurr1DayLprs               15
14967 +#define kOidAdslPerfCurr1DayESs                16
14968 +#define kOidAdslPerfPrev1DayMoniSecs           17
14969 +#define kOidAdslPerfPrev1DayLofs               18
14970 +#define kOidAdslPerfPrev1DayLoss            19
14971 +#define kOidAdslPerfPrev1DayLprs               20
14972 +#define kOidAdslPerfPrev1DayESs                21
14973 +
14974 +#define kOidAdslAtucPerfIntervalTable          8
14975 +#define kOidAdslAturPerfIntervalTable          9
14976 +#define kOidAdslPerfIntervalEntry                      1
14977 +#define kOidAdslIntervalNumber                         1
14978 +#define kOidAdslIntervalLofs                           2
14979 +#define kOidAdslIntervalLoss                           3
14980 +#define kOidAdslIntervalLprs                           4
14981 +#define kOidAdslIntervalESs                                    5
14982 +#define kOidAdslIntervalValidData                      6
14983 +
14984 +#define kOidAdslAtucChanPerfTable                                      10
14985 +#define kOidAdslAturChanPerfTable                                      11
14986 +#define kOidAdslChanPerfEntry                                          1
14987 +#define kOidAdslChanReceivedBlks                       1
14988 +#define kOidAdslChanTransmittedBlks                    2
14989 +#define kOidAdslChanCorrectedBlks                      3
14990 +#define kOidAdslChanUncorrectBlks                      4
14991 +#define kOidAdslChanPerfValidIntervals                 5
14992 +#define kOidAdslChanPerfInvalidIntervals               6
14993 +#define kOidAdslChanPerfCurr15MinTimeElapsed           7
14994 +#define kOidAdslChanPerfCurr15MinReceivedBlks          8
14995 +#define kOidAdslChanPerfCurr15MinTransmittedBlks       9
14996 +#define kOidAdslChanPerfCurr15MinCorrectedBlks         10
14997 +#define kOidAdslChanPerfCurr15MinUncorrectBlks         11
14998 +#define kOidAdslChanPerfCurr1DayTimeElapsed            12
14999 +#define kOidAdslChanPerfCurr1DayReceivedBlks           13
15000 +#define kOidAdslChanPerfCurr1DayTransmittedBlks        14
15001 +#define kOidAdslChanPerfCurr1DayCorrectedBlks          15
15002 +#define kOidAdslChanPerfCurr1DayUncorrectBlks          16
15003 +#define kOidAdslChanPerfPrev1DayMoniSecs               17
15004 +#define kOidAdslChanPerfPrev1DayReceivedBlks           18
15005 +#define kOidAdslChanPerfPrev1DayTransmittedBlks        19
15006 +#define kOidAdslChanPerfPrev1DayCorrectedBlks          20
15007 +#define kOidAdslChanPerfPrev1DayUncorrectBlks          21
15008 +
15009 +#define kOidAdslAtucChanIntervalTable                          12
15010 +#define kOidAdslAturChanIntervalTable                          13
15011 +#define kOidAdslChanIntervalEntry                                      1
15012 +#define kOidAdslChanIntervalNumber                                     1
15013 +#define kOidAdslChanIntervalReceivedBlks               2
15014 +#define kOidAdslChanIntervalTransmittedBlks            3
15015 +#define kOidAdslChanIntervalCorrectedBlks              4
15016 +#define kOidAdslChanIntervalUncorrectBlks              5
15017 +#define kOidAdslChanIntervalValidData                  6
15018 +
15019 +/* AdslExtra OIDs for kOidAdslPrivate, kOidAdslPrivExtraInfo (defined in AdslMibDef.h) */
15020 +
15021 +#define kOidAdslExtraConnectionInfo                                    1
15022 +#define kOidAdslExtraConnectionStat                                    2
15023 +#define kOidAdslExtraFramingMode                                       3
15024 +#define kOidAdslExtraTrainingState                                     4
15025 +#define kOidAdslExtraNonStdFramingAdjustK                      5
15026 +#define kOidAdslExtraAtmStat                                           6
15027 +#define kOidAdslExtraDiagModeData                                      7
15028 +#define kOidAdslExtraAdsl2Info                                         8
15029 +#define kOidAdslExtraTxPerfCounterInfo                         9
15030 +
15031 +#define kOidAtmMibObjects              1
15032 +#define kOidAtmTcTable                 4
15033 +#define kOidAtmTcEntry                 1
15034 +#define kOidAtmOcdEvents               1
15035 +#define kOidAtmAlarmState              2
15036 +
15037 +#endif /* AdslMibOidHeader */
15038 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslXfaceData.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslXfaceData.h
15039 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslXfaceData.h   1970-01-01 01:00:00.000000000 +0100
15040 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/AdslXfaceData.h  2006-06-26 09:07:10.000000000 +0200
15041 @@ -0,0 +1,129 @@
15042 +/*
15043 +<:copyright-broadcom 
15044
15045 + Copyright (c) 2002 Broadcom Corporation 
15046 + All Rights Reserved 
15047 + No portions of this material may be reproduced in any form without the 
15048 + written permission of: 
15049 +          Broadcom Corporation 
15050 +          16215 Alton Parkway 
15051 +          Irvine, California 92619 
15052 + All information contained in this document is Broadcom Corporation 
15053 + company private, proprietary, and trade secret. 
15054
15055 +:>
15056 +*/
15057 +/****************************************************************************
15058 + *
15059 + * AdslXfaceData.h -- ADSL Core interface data structure
15060 + *
15061 + * Description:
15062 + *     To be included both in SoftDsl and BcmAdslCore driver
15063 + *
15064 + *
15065 + * Copyright (c) 2000-2001  Broadcom Corporation
15066 + * All Rights Reserved
15067 + * No portions of this material may be reproduced in any form without the
15068 + * written permission of:
15069 + *          Broadcom Corporation
15070 + *          16215 Alton Parkway
15071 + *          Irvine, California 92619
15072 + * All information contained in this document is Broadcom Corporation
15073 + * company private, proprietary, and trade secret.
15074 + * Authors: Ilya Stomakhin
15075 + *
15076 + * $Revision: 1.9 $
15077 + *
15078 + * $Id: AdslXfaceData.h,v 1.9 2004/02/03 02:57:22 ilyas Exp $
15079 + *
15080 + * $Log: AdslXfaceData.h,v $
15081 + * Revision 1.9  2004/02/03 02:57:22  ilyas
15082 + * Added PHY feature settings
15083 + *
15084 + * Revision 1.8  2003/07/18 04:50:21  ilyas
15085 + * Added shared buffer for clEoc messages to avoid copying thru command buffer
15086 + *
15087 + * Revision 1.7  2003/02/25 00:46:32  ilyas
15088 + * Added T1.413 EOC vendor ID
15089 + *
15090 + * Revision 1.6  2003/02/21 23:29:13  ilyas
15091 + * Added OEM vendor ID parameter for T1.413 mode
15092 + *
15093 + * Revision 1.5  2002/09/13 21:17:12  ilyas
15094 + * Added pointers to version and build string to OEM interface structure
15095 + *
15096 + * Revision 1.4  2002/09/07 04:16:29  ilyas
15097 + * Fixed HOST to ADSL MIPS SDRAM address translation for relocatable images
15098 + *
15099 + * Revision 1.3  2002/09/07 01:43:59  ilyas
15100 + * Added support for OEM parameters
15101 + *
15102 + * Revision 1.2  2002/01/22 19:03:10  khp
15103 + * -put sdramBaseAddr at end of Xface struct
15104 + *
15105 + * Revision 1.1  2002/01/15 06:25:08  ilyas
15106 + * Initial implementation of ADSL core firmware
15107 + *
15108 + ****************************************************************************/
15109 +
15110 +#ifndef        AdslXfaceDataHeader
15111 +#define AdslXfaceDataHeader
15112 +
15113 +#include "CircBuf.h"
15114 +
15115 +typedef struct _AdslXfaceData {
15116 +       stretchBufferStruct sbSta;
15117 +       stretchBufferStruct sbCmd;
15118 +       unsigned long           gfcTable[15];
15119 +       void                            *sdramBaseAddr;
15120 +} AdslXfaceData;
15121 +
15122 +/* Shared SDRAM configuration data */
15123 +
15124 +#define        kAdslOemVendorIdMaxSize         8
15125 +#define        kAdslOemVersionMaxSize          32
15126 +#define        kAdslOemSerNumMaxSize           32
15127 +#define        kAdslOemNonStdInfoMaxSize       64
15128 +
15129 +typedef struct _AdslOemSharedData {
15130 +       unsigned long           g994VendorIdLen;
15131 +       unsigned long           g994XmtNonStdInfoLen;
15132 +       unsigned long           g994RcvNonStdInfoLen;
15133 +       unsigned long           eocVendorIdLen;
15134 +       unsigned long           eocVersionLen;
15135 +       unsigned long           eocSerNumLen;
15136 +       unsigned char           g994VendorId[kAdslOemVendorIdMaxSize];
15137 +       unsigned char           eocVendorId[kAdslOemVendorIdMaxSize];
15138 +       unsigned char           eocVersion[kAdslOemVersionMaxSize];
15139 +       unsigned char           eocSerNum[kAdslOemSerNumMaxSize];
15140 +       unsigned char           g994XmtNonStdInfo[kAdslOemNonStdInfoMaxSize];
15141 +       unsigned char           g994RcvNonStdInfo[kAdslOemNonStdInfoMaxSize];
15142 +       char                            *gDslVerionStringPtr;
15143 +       char                            *gDslBuildDataStringPtr;
15144 +       unsigned long           t1413VendorIdLen;
15145 +       unsigned char           t1413VendorId[kAdslOemVendorIdMaxSize];
15146 +       unsigned long           t1413EocVendorIdLen;
15147 +       unsigned char           t1413EocVendorId[kAdslOemVendorIdMaxSize];
15148 +       unsigned long           clEocBufLen;
15149 +       unsigned char           *clEocBufPtr;
15150 +} AdslOemSharedData;
15151 +
15152 +/* feature list */ 
15153 +
15154 +#define        kAdslPhyAnnexA                          0
15155 +#define        kAdslPhyAnnexB                          1
15156 +#define        kAdslPhyAnnexC                          2
15157 +#define        kAdslPhySADSL                           3
15158 +#define        kAdslPhyAdsl2                           4
15159 +#define        kAdslPhyAdslG992p3                      4
15160 +#define        kAdslPhyAdsl2p                          5
15161 +#define        kAdslPhyAdslG992p5                      5
15162 +#define        kAdslPhyAnnexI                          6
15163 +#define        kAdslPhyAdslReAdsl2                     7
15164 +#define        kAdslPhyG992p2Init                      8
15165 +#define        kAdslPhyT1P413                          9
15166 +
15167 +#define        AdslFeatureSupported(fa,f)      ((fa)[(f) >> 5] & (1 << ((f) & 0x1F)))
15168 +#define        AdslFeatureSet(fa,f)            (fa)[(f) >> 5] |= (1 << ((f) & 0x1F))
15169 +
15170 +#endif /* AdslXfaceDataHeader */
15171 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlankList.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlankList.h
15172 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlankList.h       1970-01-01 01:00:00.000000000 +0100
15173 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlankList.h      2006-06-26 09:07:10.000000000 +0200
15174 @@ -0,0 +1,87 @@
15175 +/*
15176 +<:copyright-broadcom 
15177
15178 + Copyright (c) 2002 Broadcom Corporation 
15179 + All Rights Reserved 
15180 + No portions of this material may be reproduced in any form without the 
15181 + written permission of: 
15182 +          Broadcom Corporation 
15183 +          16215 Alton Parkway 
15184 +          Irvine, California 92619 
15185 + All information contained in this document is Broadcom Corporation 
15186 + company private, proprietary, and trade secret. 
15187
15188 +:>
15189 +*/
15190 +/****************************************************************************
15191 + *
15192 + * BlankList.h 
15193 + *
15194 + * Description:
15195 + *     Definition and implementation (via macros and inline functions)
15196 + *  of blank list - list of unused items of any size (not less than 
15197 + *     sizeof(void *)
15198 + *
15199 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
15200 + * Authors: Ilya Stomakhin
15201 + *
15202 + *****************************************************************************/
15203 +
15204 +#ifndef        BlankListHeader
15205 +#define        BlankListHeader
15206 +
15207 +#define BlankListPeek(head)            ((void *) (head))
15208 +#define BlankListNext(p)               (*(void **) (p))
15209 +
15210 +#define BlankListAdd(pHead,p)  do {                    \
15211 +  BlankListNext(p)        = BlankListNext(pHead);      \
15212 +  BlankListNext(pHead) = (void *) (p);                 \
15213 +} while (0)
15214 +
15215 +#define BlankListAddList(pHead,pFirst,pLast) do {      \
15216 +  if (NULL != (pLast)) {                                                       \
15217 +       BlankListNext(pLast) = BlankListNext(pHead);    \
15218 +       BlankListNext(pHead) = (void *) (pFirst);               \
15219 +  }                                                                                                    \
15220 +} while (0)
15221 +
15222 +#define BlankListGet(pHead)                                                    \
15223 +  BlankListNext(pHead);                                                                \
15224 +  {                                                                                                    \
15225 +       void    **__p;                                                                  \
15226 +       __p = (void     **) BlankListNext(pHead);                       \
15227 +       if (NULL != __p)                                                                \
15228 +         BlankListNext(pHead) = *__p;                                  \
15229 +  }
15230 +
15231 +
15232 +#define        BlankListForEach(pHead,f,ref)   do {            \
15233 +  void *p = BlankListNext(pHead);                                      \
15234 +                                                                                                       \
15235 +  while (NULL != p) {                                                          \
15236 +       if ( (f)((p), ref) ) break;                                             \
15237 +       p = BlankListNext(p);                                                   \
15238 +  }                                                                                                    \
15239 +} while (0)
15240 +
15241 +
15242 +#include       "Que.h"
15243 +
15244 +#define BlankListAddQue(pHead,pqHdr)   do {                                                    \
15245 +  if (NULL != ((QueHeader *)(pqHdr))->tail) {                                                  \
15246 +       BlankListNext(((QueHeader *)(pqHdr))->tail) = BlankListNext(pHead);     \
15247 +       BlankListNext(pHead) = ((QueHeader *)(pqHdr))->head;                            \
15248 +  }                                                                                                                                            \
15249 +} while (0)
15250 +
15251 +#include       "DList.h"
15252 +
15253 +#define BlankListAddDList(pHead,pDListHead)    do {                                            \
15254 +  if (!DListEmpty(pDListHead)) {                                                                               \
15255 +       BlankListNext(DListLast(pDListHead)) = BlankListNext(pHead);            \
15256 +       BlankListNext(pHead) = DListFirst(pDListHead);                                          \
15257 +  }                                                                                                                                            \
15258 +} while (0)
15259 +
15260 +#endif /* BlankListHeader */
15261 +
15262 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlockUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlockUtil.h
15263 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlockUtil.h       1970-01-01 01:00:00.000000000 +0100
15264 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/BlockUtil.h      2006-06-26 09:07:10.000000000 +0200
15265 @@ -0,0 +1,235 @@
15266 +/*
15267 +<:copyright-broadcom 
15268
15269 + Copyright (c) 2002 Broadcom Corporation 
15270 + All Rights Reserved 
15271 + No portions of this material may be reproduced in any form without the 
15272 + written permission of: 
15273 +          Broadcom Corporation 
15274 +          16215 Alton Parkway 
15275 +          Irvine, California 92619 
15276 + All information contained in this document is Broadcom Corporation 
15277 + company private, proprietary, and trade secret. 
15278
15279 +:>
15280 +*/
15281 +/* BlockUtil.h
15282 + *
15283 + *     Description:
15284 + *             This file contains the interfaces for the fixed point block
15285 + *             processing utilities.
15286 + *
15287 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
15288 + * Authors: Mark Gonikberg, Haixiang Liang.
15289 + *
15290 + * $Revision: 1.23 $
15291 + *
15292 + * $Id: BlockUtil.h,v 1.23 2004/04/13 00:31:10 ilyas Exp $
15293 + *
15294 + * $Log: BlockUtil.h,v $
15295 + * Revision 1.23  2004/04/13 00:31:10  ilyas
15296 + * Added standard header for shared ADSL driver files
15297 + *
15298 + * Revision 1.22  2003/07/11 01:49:01  gsyu
15299 + * Added BlockShortClearByLong to speed up performance
15300 + *
15301 + * Revision 1.21  2003/07/10 22:35:23  gsyu
15302 + * Speed up BlockByteXXX performance
15303 + *
15304 + * Revision 1.20  2003/07/10 22:15:51  gsyu
15305 + * Added BlockByteMoveByWord to speed up performance
15306 + *
15307 + * Revision 1.19  2002/03/12 00:03:03  yongbing
15308 + * Modify cplxScaleCplxSymbols to accept a shift value instead of an array of shifts
15309 + *
15310 + * Revision 1.18  2001/03/14 00:50:25  georgep
15311 + * All targets use FEQ_PASS_FFTSHIFT, remove code for case where its not defined
15312 + *
15313 + * Revision 1.17  2000/11/30 03:54:09  khp
15314 + * -BlockRealScaleCplxSymbols instead of BlockScaleComplexSymbols
15315 + *
15316 + * Revision 1.16  2000/11/29 20:42:12  liang
15317 + * Add function for ADSL xmt gains with fixed shift.
15318 + *
15319 + * Revision 1.15  2000/10/02 19:24:08  georgep
15320 + * Modify FEQ for new fft, fft outputs a shift for each block
15321 + *
15322 + * Revision 1.14  2000/09/09 00:23:48  liang
15323 + * Add corresponding functions for the ComplexLong FEQ coef.
15324 + *
15325 + * Revision 1.13  2000/05/17 01:36:52  yongbing
15326 + * Add Pentium MMX assembly codes for more block related functions
15327 + *
15328 + * Revision 1.12  2000/04/19 19:22:22  yongbing
15329 + * Add BlockShortScaleby2 function used in G994p1
15330 + *
15331 + * Revision 1.11  2000/04/04 02:28:01  liang
15332 + * Merged with SoftDsl_0_2 from old tree.
15333 + *
15334 + * Revision 1.11  2000/03/14 23:29:01  yongbing
15335 + * Add Pentim MMX codes for BlockCplxSymbolUpdateCplxScale function
15336 + *
15337 + * Revision 1.10  2000/02/16 01:53:00  yongbing
15338 + * Add Pentium MMX module for FEQ
15339 + *
15340 + * Revision 1.9  1999/11/02 02:49:55  liang
15341 + * Add BlockComplexPower function.
15342 + *
15343 + * Revision 1.8  1999/08/05 19:42:34  liang
15344 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
15345 + *
15346 + * Revision 1.7  1999/06/16 00:54:39  liang
15347 + * BlockRealScaleComplexSymbols takes a scale shift buffer now.
15348 + *
15349 + * Revision 1.6  1999/05/22 02:18:29  liang
15350 + * Add one more parameter to BlockCplxSymbolUpdateCplxScale function.
15351 + *
15352 + * Revision 1.5  1999/05/14 22:49:39  liang
15353 + * Added two more functions.
15354 + *
15355 + * Revision 1.4  1999/03/26 03:29:57  liang
15356 + * Add function BlockComplexMultLongAcc.
15357 + *
15358 + * Revision 1.3  1999/02/22 22:40:59  liang
15359 + * BlockByteSum takes uchar inputs instead of schar.
15360 + *
15361 + * Revision 1.2  1999/02/10 01:56:44  liang
15362 + * Added BlockByteSum, BlockRealScaleComplexSymbols and BlockCplxScaleComplexSymbols.
15363 + *
15364 + * Revision 1.1  1998/10/28 01:35:38  liang
15365 + * *** empty log message ***
15366 + *
15367 + * Revision 1.12  1998/07/08 17:09:25  scott
15368 + * Removed unnecessary undefs
15369 + *
15370 + * Revision 1.11  1998/04/02 06:19:44  mwg
15371 + * Added two new utilities.
15372 + *
15373 + * Revision 1.10  1998/03/26 23:20:55  liang
15374 + * Added function BlockShortMultiply.
15375 + *
15376 + * Revision 1.9  1998/02/16  18:41:00  scott
15377 + * Added MMX autodetect support
15378 + *
15379 + * Revision 1.8  1997/12/13 06:11:35  mwg
15380 + * Added new functions:
15381 + * BlockLongSubtract()
15382 + * BlockLongAdd()
15383 + * BlockLong2ShortSubtract()
15384 + * BlockShort2LongMove()
15385 + * BlockShortInterpolate()
15386 + * BlockLongCorrelate()
15387 + * BlockMapShort2Short()
15388 + *
15389 + * Revision 1.7  1997/03/19 18:35:10  mwg
15390 + * Changed copyright notice.
15391 + *
15392 + * Revision 1.6  1997/02/11  00:08:18  mwg
15393 + * Added BlockByteMove function
15394 + *
15395 + * Revision 1.5  1997/02/04  08:40:08  mwg
15396 + * Changed interface forBlockReal2ComplexMacc()
15397 + *
15398 + * Revision 1.4  1997/01/23  02:04:28  mwg
15399 + * Added return value to BlockShortMove
15400 + *
15401 + * Revision 1.3  1996/12/19  22:34:55  mwg
15402 + * Added new function BlockFullPower().
15403 + *
15404 + * Revision 1.2  1996/02/21  03:59:15  mwg
15405 + * Added new function BlockReal2ComplexMacc
15406 + *
15407 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
15408 + * Redesigned the project directory structure. Merged V.34 into the project.
15409 + *
15410 + * Revision 1.5  1995/04/04  06:09:32  mwg
15411 + * Changed the SoftModem status reporting: now the status is a structure/union
15412 + * where different fields used for different status code. This will enable
15413 + * efficient status snooping for high level protocols on top of the softmodem.
15414 + *
15415 + */
15416 +
15417 +#ifndef        BlockUtilPh
15418 +#define        BlockUtilPh
15419 +
15420 +extern void    BlockLongAdd                            (int, long*, long*, long*);
15421 +extern void    BlockLong2ShortSubtract         (int, long*, long*, short*);
15422 +extern void    BlockShort2LongMove                     (int, short*, long*);
15423 +extern void    BlockShortMultiply                      (int, int, short*, short*, short*);
15424 +extern void    BlockByteMoveUnaligned          (int size, uchar *srcPtr, uchar *dstPtr);
15425 +extern void    BlockShortOffset                        (int, short, short*, short*);
15426 +extern long    BlockShortInterpolateWithIncrement (int size, long scaleFactor, long increment, int shift, short* src1Ptr, short* src2Ptr, short* dstPtr);
15427 +extern void    BlockReal2ComplexMult           (int, short*, ComplexShort*, ComplexShort*);
15428 +extern void    BlockComplexConjigateMult       (int, ComplexShort*, ComplexShort*, ComplexShort*);
15429 +
15430 +extern long    BlockSum                                        (int, short*);
15431 +extern long    BlockByteSum                            (int, uchar*);
15432 +extern void    BlockComplexSum                         (int, ComplexShort*, ComplexLong*);
15433 +extern void    BlockComplexPower                       (int, int, ComplexShort*, long*);
15434 +extern long    BlockFullPower                          (int, short*);
15435 +extern long    BlockLongCorrelate                      (int, long*, long*);
15436 +
15437 +extern int             BlockSymbol2Byte                        (int, int, ushort*, uchar*);
15438 +extern int             BlockByte2Symbol                        (int, int, uchar*, ushort*);
15439 +
15440 +extern void    BlockMapShort2Complex           (int, ushort*, ComplexByte*, ComplexShort*);
15441 +extern void    BlockMapShort2Short                     (int size, ushort *srcPtr, short *mapPtr, short *dstPtr);
15442 +extern void    BlockMapByte2Byte                       (int size, uchar *srcPtr, uchar *mapPtr, uchar *dstPtr);
15443 +extern void    BlockMapByte2Short                      (int size, uchar *srcPtr, short *mapPtr, short *dstPtr);
15444 +extern void    BlockShortMult                          (int size, int shift, short* src1Ptr, short* src2Ptr, short* dstPtr);
15445 +
15446 +extern int             SM_DECL Idle(void);
15447 +
15448 +extern void    BlockGenerateAngles(int size, ComplexShort *anglePtr, ComplexShort *incPtr, ComplexShort *dstPtr);
15449 +extern void    BlockExtractRealPart(int size, ComplexShort *srcPtr, short *dstPtr);
15450 +extern void    BlockShortScaleByShift (int size, int shift, short* srcPtr, short* dstPtr);
15451 +
15452 +#ifndef PENTIUM_REDEFS /* only if these have not been redefined to function pointers */
15453 +extern long    BlockPower                                      (int, short*);
15454 +extern void    BlockReal2ComplexMacc           (int, int, short*, ComplexShort*, ComplexLong*);
15455 +extern void    BlockComplexMult                        (int, ComplexShort*, ComplexShort*, ComplexShort*);
15456 +extern void    BlockShortScale                         (int, short, int, short*, short*);
15457 +extern int             SM_DECL BlockShortMove                          (int, short*, short*);
15458 +extern long    BlockCorrelate                          (int, short*, short*);
15459 +
15460 +extern void    BlockRealScaleComplexSymbols(int, int, uchar*, short*, ComplexShort*, ComplexShort*);
15461 +/* FIXME -- the following 3 functions can be removed */
15462 +extern void    BlockCplxScaleComplexSymbols(int, int, int, ComplexShort*, ComplexShort*, ComplexShort*);
15463 +extern void    BlockCplxSymbolUpdateCplxScale(int, int, int, uchar*, ComplexShort*,
15464 +                                       ComplexShort*, ComplexShort*, ComplexShort*);
15465 +extern void    BlockComplexShortFill           (int, short, short, ComplexShort*);
15466 +
15467 +
15468 +extern void    BlockRealScaleCplxSymbols(int, int, int, short*, ComplexShort*, ComplexShort*);
15469 +extern void    BlockCplxLongConjigateMultCplxShort(int, ComplexLong*, ComplexShort*, ComplexLong*);
15470 +
15471 +extern void    BlockCplxLongScaleCplxSymbols(int, int, int, ComplexLong*, ComplexShort*, short*, ComplexShort*);
15472 +extern void    BlockCplxSymbolUpdateCplxLongScale(int, int, int, int,
15473 +                                       ComplexShort*, short *, ComplexLong*, ComplexShort*);
15474 +
15475 +extern void    BlockComplexLongFill            (int, long, long, ComplexLong*);
15476 +
15477 +extern void    BlockShortSubtract                      (int, short*, short*, short*);
15478 +extern void    BlockLongSubtract                       (int, long*, long*, long*);
15479 +extern void    BlockShortAdd                           (int, short*, short*, short*);
15480 +extern void    BlockByteMove                           (int, uchar*, uchar*);
15481 +extern void    BlockByteMoveByLong                     (int, uchar*, uchar*);
15482 +extern void    SM_DECL BlockByteFill           (int, uchar, uchar*);
15483 +extern void    BlockByteFillByLong             (int, uchar, uchar*);
15484 +extern void    BlockByteClear                          (int, uchar*);
15485 +extern void    BlockByteClearByLong            (int, uchar*);
15486 +extern void    BlockShortFill                          (int, short, short*);
15487 +extern void    BlockShortClear                         (int, short*);
15488 +extern void    BlockShortClearByLong           (int, short*);
15489 +extern void    BlockLongFill                           (int, long, long*);
15490 +extern void    BlockLongClear                          (int, long*);
15491 +extern void    BlockComplexShortClear          (int, ComplexShort*);
15492 +extern void    BlockShortInvert                        (int, short*, short*);
15493 +extern void    BlockShortScaleDown                     (int, short*);
15494 +extern void    BlockLongMove                           (int, long*, long*);
15495 +extern void    BlockShortInterpolate           (int, short, int, short*, short*, short*);
15496 +extern void    BlockComplexMultLongAcc     (int, int, ComplexShort*, ComplexShort*, ComplexLong*);
15497 +
15498 +#endif
15499 +
15500 +#endif /* BlockUtilPh */
15501 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/CircBuf.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/CircBuf.h
15502 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/CircBuf.h 1970-01-01 01:00:00.000000000 +0100
15503 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/CircBuf.h        2006-06-26 09:07:10.000000000 +0200
15504 @@ -0,0 +1,217 @@
15505 +/*
15506 +<:copyright-broadcom 
15507
15508 + Copyright (c) 2002 Broadcom Corporation 
15509 + All Rights Reserved 
15510 + No portions of this material may be reproduced in any form without the 
15511 + written permission of: 
15512 +          Broadcom Corporation 
15513 +          16215 Alton Parkway 
15514 +          Irvine, California 92619 
15515 + All information contained in this document is Broadcom Corporation 
15516 + company private, proprietary, and trade secret. 
15517
15518 +:>
15519 +*/
15520 +/****************************************************************************
15521 + *
15522 + * CircBuf -- Generic Circular Buffer
15523 + *
15524 + * Description:
15525 + *     Implementation of generic circular buffer algorithms
15526 + *
15527 + *
15528 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
15529 + * Authors: Ilya Stomakhin
15530 + *
15531 + * $Revision: 1.14 $
15532 + *
15533 + * $Id: CircBuf.h,v 1.14 2004/06/24 03:10:37 ilyas Exp $
15534 + *
15535 + * $Log: CircBuf.h,v $
15536 + * Revision 1.14  2004/06/24 03:10:37  ilyas
15537 + * Added extra macro to be able to use un-cached variable (for status write)
15538 + *
15539 + * Revision 1.13  2004/02/09 23:47:02  ilyas
15540 + * Fixed last change
15541 + *
15542 + * Revision 1.12  2004/02/06 22:52:58  ilyas
15543 + * Improved stretch buffer write
15544 + *
15545 + * Revision 1.11  2002/12/30 23:27:55  ilyas
15546 + * Added macro for HostDma optimizations
15547 + *
15548 + * Revision 1.10  2002/10/26 02:15:02  ilyas
15549 + * Optimized and added new macros for HostDma
15550 + *
15551 + * Revision 1.9  2002/01/22 23:59:29  ilyas
15552 + * Added paraenthesis around macro argument
15553 + *
15554 + * Revision 1.8  2002/01/15 22:28:38  ilyas
15555 + * Extended macro to support readPtr from uncached address
15556 + *
15557 + * Revision 1.7  2001/09/21 19:47:05  ilyas
15558 + * Fixed compiler warnings for VxWorks build
15559 + *
15560 + * Revision 1.6  2001/06/07 18:47:56  ilyas
15561 + * Added more macros for circular buffer arithmetics
15562 + *
15563 + * Revision 1.5  2001/04/18 03:58:34  ilyas
15564 + * Added LOG file write granularity
15565 + *
15566 + * Revision 1.4  2001/01/19 04:34:12  ilyas
15567 + * Added more macros to circular buffer implementation
15568 + *
15569 + * Revision 1.3  2001/01/06 04:01:41  ilyas
15570 + * Changed the way we write status messages
15571 + *
15572 + * Revision 1.2  2001/01/04 05:52:21  ilyas
15573 + * Added implementation of stretchable circular buffer used in LOG and Status
15574 + * handlers
15575 + *
15576 + * Revision 1.1  2000/05/03 03:45:55  ilyas
15577 + * Original implementation
15578 + *
15579 + *
15580 + *****************************************************************************/
15581 +
15582 +#ifndef        CircBufHeader_H_
15583 +#define        CircBufHeader_H_
15584 +
15585 +
15586 +typedef struct {
15587 +       char    *pStart;
15588 +       char    *pEnd;
15589 +       char    *pRead;
15590 +       char    *pWrite;
15591 +} circBufferStruct;
15592 +
15593 +/* Initialize circular buffer */
15594 +
15595 +#define        CircBufferInit(pCB,buf,size)    do {                    \
15596 +       (pCB)->pStart = (char *) (buf);                                         \
15597 +       (pCB)->pRead = (pCB)->pWrite = (pCB)->pStart;           \
15598 +       (pCB)->pEnd = (pCB)->pStart + size;                                     \
15599 +} while (0)
15600 +
15601 +#define        CircBufferGetSize(pCB)                  ((pCB)->pEnd - (pCB)->pStart)
15602 +#define        CircBufferGetStartPtr(pCB)              ((void *) (pCB)->pStart)
15603 +#define        CircBufferGetEndPtr(pCB)                ((void *) (pCB)->pEnd)
15604 +
15605 +#define        CircBufferReset(pCB)                    (pCB)->pRead = (pCB)->pWrite = (pCB)->pStart
15606 +
15607 +
15608 +#define        CircBufferGetReadPtr(pCB)               ((void *) (pCB)->pRead)
15609 +#define        CircBufferGetWritePtr(pCB)              ((void *) (pCB)->pWrite)
15610 +
15611 +
15612 +#ifndef bcm47xx
15613 +#define        CircBufferDistance(pCB,p1,p2,d) ((char*)(p2) - (char*)(p1) - d >= 0 ?                   \
15614 +                                                                                       (char*)(p2) - (char*)(p1) - d :                 \
15615 +                                                                                       ((char*)(p2)- (char*)(p1) - d + ((pCB)->pEnd - (pCB)->pStart)))
15616 +
15617 +#define        CircBufferAddContig(pCB,p,n)    ((char*)(p) + (n) == (pCB)->pEnd ? (pCB)->pStart : (char*)(p) + (n))
15618 +#else
15619 +static __inline int CircBufferDistance(circBufferStruct *pCB, char *p1, char *p2, int d)
15620 +{
15621 +       int tmp = p2 - p1 - d;
15622 +
15623 +       return (tmp >= 0 ? tmp : tmp + (pCB->pEnd - pCB->pStart));
15624 +}
15625 +
15626 +static __inline char * CircBufferAddContig(circBufferStruct *pCB, char *p, int n)
15627 +{
15628 +       p += n;
15629 +       return (p == pCB->pEnd ? pCB->pStart : p);
15630 +}
15631 +#endif
15632 +
15633 +#define        CircBufferAdd(pCB,p,n)                  ((char*)(p) + (n) >= (pCB)->pEnd ?                                              \
15634 +                                                                                       (pCB)->pStart + ((char*)(p) + (n) - (pCB)->pEnd) :      \
15635 +                                                                                       (char*)(p) + (n))
15636 +
15637 +#define        CircBufferReadUpdate(pCB,n)             (pCB)->pRead = CircBufferAdd(pCB,(pCB)->pRead,n)
15638 +#define        CircBufferWriteUpdate(pCB,n)    (pCB)->pWrite= CircBufferAdd(pCB,(pCB)->pWrite,n)
15639 +
15640 +#define        CircBufferReadUpdateContig(pCB,n)       (pCB)->pRead = CircBufferAddContig(pCB,(pCB)->pRead,n)
15641 +#define        CircBufferWriteUpdateContig(pCB,n)      (pCB)->pWrite= CircBufferAddContig(pCB,(pCB)->pWrite,n)
15642 +
15643 +#define        CircBufferGetReadAvail(pCB)             CircBufferDistance(pCB,(pCB)->pRead,(pCB)->pWrite,0)
15644 +#define        CircBufferIsReadEmpty(pCB)              ((pCB)->pRead == (pCB)->pWrite)
15645 +#define        CircBufferGetWriteAvail(pCB)    CircBufferDistance(pCB,(pCB)->pWrite,(pCB)->pRead,1)
15646 +#define        CircBufferGetWriteAvailN(pCB,n) CircBufferDistance(pCB,(pCB)->pWrite,(pCB)->pRead,n)
15647 +
15648 +#define        CircBufferGetReadContig(pCB)    ((unsigned long)(pCB)->pWrite >= (unsigned long) (pCB)->pRead ? \
15649 +                                                                                       (pCB)->pWrite - (pCB)->pRead :          \
15650 +                                                                                       (pCB)->pEnd       - (pCB)->pRead)
15651 +
15652 +#define        CircBufferGetWriteContig(pCB)   ((pCB)->pEnd - (pCB)->pWrite > CircBufferGetWriteAvail(pCB) ?   \
15653 +                                                                                       CircBufferGetWriteAvail(pCB) :          \
15654 +                                                                                       (pCB)->pEnd - (pCB)->pWrite)
15655 +
15656 +/*
15657 +**
15658 +**             structure and macros for "strectch" buffer
15659 +**
15660 +*/
15661 +
15662 +typedef struct {
15663 +       char    *pStart;
15664 +       char    *pEnd;
15665 +       char    *pExtraEnd;
15666 +       char    *pStretchEnd;
15667 +       char    *pRead;
15668 +       char    *pWrite;
15669 +} stretchBufferStruct;
15670 +
15671 +#define        StretchBufferInit(pSB,buf,size,extra)   do {    \
15672 +       (pSB)->pStart = (char *) (buf);                                         \
15673 +       (pSB)->pRead = (pSB)->pWrite = (pSB)->pStart;           \
15674 +       (pSB)->pEnd = (pSB)->pStart + (size);                           \
15675 +       (pSB)->pStretchEnd = (pSB)->pEnd;                                       \
15676 +       (pSB)->pExtraEnd = (pSB)->pEnd+(extra);                         \
15677 +} while (0)
15678 +
15679 +#define        StretchBufferGetSize(pSB)               ((pSB)->pEnd - (pSB)->pStart)
15680 +#define        StretchBufferGetStartPtr(pSB)   ((void *) (pSB)->pStart)
15681 +#define        StretchBufferGetReadPtr(pSB)    ((void *) (pSB)->pRead)
15682 +#define        StretchBufferGetWritePtr(pSB)   ((void *) (pSB)->pWrite)
15683 +#define        StretchBufferReset(pSB)                 ((pSB)->pRead = (pSB)->pWrite = (pSB)->pStart)
15684 +
15685 +#define        StretchBufferGetReadToEnd(pSB)  ((pSB)->pStretchEnd - (pSB)->pRead)
15686 +
15687 +#define        StretchBufferGetReadAvail(pSB)          ((pSB)->pWrite - (pSB)->pRead >= 0 ?    \
15688 +                                                                                       (pSB)->pWrite - (pSB)->pRead   :                \
15689 +                                                                                       (pSB)->pStretchEnd - (pSB)->pRead)
15690 +#define        _StretchBufferGetWriteAvail(pSB,rd) ((rd) - (pSB)->pWrite > 0 ?                         \
15691 +                                                                                       (rd) - (pSB)->pWrite - 1 :                              \
15692 +                                                                                       ((pSB)->pExtraEnd - (pSB)->pWrite))
15693 +#define        StretchBufferGetWriteAvail(pSB)         _StretchBufferGetWriteAvail(pSB, (pSB)->pRead)
15694 +
15695 +#define        StretchBufferReadUpdate(pSB,n)          do {                                                            \
15696 +       char    *p;                                                                                                                                     \
15697 +                                                                                                                                                               \
15698 +       p = (pSB)->pRead + (n);                                                                                                         \
15699 +       (pSB)->pRead = (p >= (pSB)->pStretchEnd ? (pSB)->pStart : p);                           \
15700 +} while (0)
15701 +
15702 +#define        _StretchBufferWriteUpdate(pSB,rd,n)     do {                                                            \
15703 +       char    *p;                                                                                                                                     \
15704 +                                                                                                                                                               \
15705 +       p = (pSB)->pWrite + (n);                                                                                                        \
15706 +       if (p >= (pSB)->pEnd) {                                                                                                         \
15707 +         if ((rd) != (pSB)->pStart) {                                                                                          \
15708 +               (pSB)->pStretchEnd = p;                                                                                                 \
15709 +               (pSB)->pWrite = (pSB)->pStart;                                                                                  \
15710 +         }                                                                                                                                                     \
15711 +       }                                                                                                                                                       \
15712 +       else                                                                                                                                            \
15713 +               (pSB)->pWrite = p;                                                                                                              \
15714 +} while (0)
15715 +
15716 +#define        StretchBufferWriteUpdate(pSB,n)         _StretchBufferWriteUpdate(pSB,(pSB)->pRead,n)   
15717 +
15718 +#endif /* CircBufHeader_H_ */
15719 +
15720 +
15721 +
15722 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DList.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DList.h
15723 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DList.h   1970-01-01 01:00:00.000000000 +0100
15724 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DList.h  2006-06-26 09:07:10.000000000 +0200
15725 @@ -0,0 +1,131 @@
15726 +/*
15727 +<:copyright-broadcom 
15728
15729 + Copyright (c) 2002 Broadcom Corporation 
15730 + All Rights Reserved 
15731 + No portions of this material may be reproduced in any form without the 
15732 + written permission of: 
15733 +          Broadcom Corporation 
15734 +          16215 Alton Parkway 
15735 +          Irvine, California 92619 
15736 + All information contained in this document is Broadcom Corporation 
15737 + company private, proprietary, and trade secret. 
15738
15739 +:>
15740 +*/
15741 +/****************************************************************************
15742 + *
15743 + * DList.h
15744 + *
15745 + * Description:
15746 + *     Definition and implementation (via macros and inline functions)
15747 + *  of double-linked list
15748 + *
15749 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
15750 + * Authors: Ilya Stomakhin
15751 + *
15752 + *****************************************************************************/
15753 +
15754 +#ifndef        DListHeader_H_
15755 +#define        DListHeader_H_
15756 +
15757 +typedef struct _DListHeader
15758 +       {
15759 +       struct _DListHeader     *next;          /* next item in the list */
15760 +       struct _DListHeader     *prev;          /* prev item in the list */
15761 +       } DListHeader;
15762 +
15763 +typedef struct _DListUpHeader
15764 +       {
15765 +       struct _DListUpHeader   *next;  /* next item in the list */
15766 +       struct _DListUpHeader   *prev;  /* prev item in the list */
15767 +       struct _DListUpHeader   *head;  /* head of the list */
15768 +       } DListUpHeader;
15769 +
15770 +/* Double linked list DList management macros */
15771 +
15772 +#define        DListInit(pDListHead)   do {                                    \
15773 +       ((DListHeader *)(pDListHead))->next = pDListHead;       \
15774 +       ((DListHeader *)(pDListHead))->prev = pDListHead;       \
15775 +} while (0)
15776 +
15777 +#define        DListNext(pDListEntry)          (((DListHeader *)(pDListEntry))->next)
15778 +#define        DListPrev(pDListEntry)          (((DListHeader *)(pDListEntry))->prev)
15779 +
15780 +#define        DListEntryLinked(pDListEntry)   (NULL != DListNext(pDListEntry))
15781 +#define        DListUnlinkEntry(pDListEntry)   (DListNext(pDListEntry) = DListPrev(pDListEntry) = NULL)
15782 +
15783 +#define        DListFirst(pDListHead)          DListNext(pDListHead)
15784 +#define        DListLast(pDListHead)           DListPrev(pDListHead)
15785 +#define        DListValid(pDListHead,pEntry)   ((void *)(pDListHead) != (pEntry))
15786 +#define        DListEmpty(pDListHead)          ((void *)pDListHead == ((DListHeader *)pDListHead)->next)
15787 +
15788 +#define        DListInsertAfter(pDListEntry,pEntry)     do {                                           \
15789 +       ((DListHeader *)(pEntry))->next = ((DListHeader *)(pDListEntry))->next; \
15790 +       ((DListHeader *)(pEntry))->prev = (DListHeader *)(pDListEntry);                 \
15791 +       ((DListHeader *)(pDListEntry))->next->prev = (DListHeader *) (pEntry);  \
15792 +       ((DListHeader *)(pDListEntry))->next = (DListHeader *) (pEntry);                \
15793 +} while (0)
15794 +
15795 +#define        DListInsertBefore(pDListEntry,pEntry) do {                                                      \
15796 +       ((DListHeader *)(pEntry))->next = (DListHeader *)(pDListEntry);                 \
15797 +       ((DListHeader *)(pEntry))->prev = ((DListHeader *)(pDListEntry))->prev; \
15798 +       ((DListHeader *)(pDListEntry))->prev->next = (DListHeader *) (pEntry);  \
15799 +       ((DListHeader *)(pDListEntry))->prev = (DListHeader *) (pEntry);                \
15800 +} while (0)
15801 +
15802 +#define        DListInsertTail(pDListHead,pEntry)      DListInsertBefore(pDListHead,pEntry)
15803 +#define        DListInsertHead(pDListHead,pEntry)      DListInsertAfter(pDListHead,pEntry)
15804 +
15805 +#define        DListRemove(pDListEntry)        do {                            \
15806 +       ((DListHeader *)(pDListEntry))->prev->next = ((DListHeader *)(pDListEntry))->next;      \
15807 +       ((DListHeader *)(pDListEntry))->next->prev = ((DListHeader *)(pDListEntry))->prev;      \
15808 +} while (0)
15809 +
15810 +
15811 +#define        DListForEach(pDListHead,f,ref)          do {                    \
15812 +       DListHeader     *p = ((DListHeader *)(pDListHead))->next;       \
15813 +                                                                                                                       \
15814 +       while (DListValid(pDListHead,p)) {                                              \
15815 +         DListHeader *p0 = p;                                                                  \
15816 +         p = DListNext(p);                                                                             \
15817 +         if ( (f)((void *)p0, ref) ) break;                                    \
15818 +       }                                                                                                               \
15819 +} while (0)
15820 +
15821 +
15822 +/* Double linked list with up link DListUp management macros */
15823 +
15824 +#define        DListUpInit(pDListHead) do {                                                                            \
15825 +       ((DListUpHeader *)(pDListHead))->next = (DListUpHeader *) (pDListHead); \
15826 +       ((DListUpHeader *)(pDListHead))->prev = (DListUpHeader *) (pDListHead); \
15827 +       ((DListUpHeader *)(pDListHead))->head = (DListUpHeader *) (pDListHead); \
15828 +} while (0)
15829 +
15830 +#define        DListUpNext(pDListEntry)        ((DListUpHeader *) DListNext(pDListEntry))
15831 +#define        DListUpPrev(pDListEntry)        ((DListUpHeader *) DListPrev(pDListEntry))
15832 +#define        DListUpHead(pDListEntry)        (((DListUpHeader *)(pDListEntry))->head)
15833 +
15834 +#define        DListUpFirst(pDListHead)        DListUpNext(pDListHead)
15835 +#define        DListUpLast(pDListHead)         DListUpPrev(pDListHead)         
15836 +#define        DListUpValid(pEntry)            (((DListUpHeader *)(pEntry))->head != (void *) pEntry)
15837 +#define        DListUpEmpty(pDListHead)        DListEmpty(pDListHead)          
15838 +
15839 +#define        DListUpInsertAfter(pDListEntry,pEntry)   do {                                                   \
15840 +       DListInsertAfter(pDListEntry,pEntry);                                                                           \
15841 +       ((DListUpHeader *)(pEntry))->head = ((DListUpHeader *)(pDListEntry))->head;     \
15842 +} while (0)
15843 +
15844 +#define        DListUpInsertBefore(pDListEntry,pEntry)  do {                                                   \
15845 +       DListInsertBefore(pDListEntry,pEntry);                                                                          \
15846 +       ((DListUpHeader *)(pEntry))->head = ((DListUpHeader *)(pDListEntry))->head;     \
15847 +} while (0)
15848 +
15849 +#define        DListUpInsertTail(pDListHead,pEntry)    DListUpInsertBefore(pDListHead,pEntry)
15850 +#define        DListUpInsertHead(pDListHead,pEntry)    DListUpInsertAfter(pDListHead,pEntry)
15851 +
15852 +#define        DListUpRemove(pDListEntry)              DListRemove(pDListEntry)
15853 +#define        DListUpForEach(pDListHead,f,ref) DListForEach((DListHeader *)(pDListHead),f,ref)
15854 +
15855 +#endif /* DListHeader_H_ */
15856 +
15857 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DslFramer.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DslFramer.h
15858 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DslFramer.h       1970-01-01 01:00:00.000000000 +0100
15859 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/DslFramer.h      2006-06-26 09:07:10.000000000 +0200
15860 @@ -0,0 +1,159 @@
15861 +/*
15862 +<:copyright-broadcom 
15863
15864 + Copyright (c) 2002 Broadcom Corporation 
15865 + All Rights Reserved 
15866 + No portions of this material may be reproduced in any form without the 
15867 + written permission of: 
15868 +          Broadcom Corporation 
15869 +          16215 Alton Parkway 
15870 +          Irvine, California 92619 
15871 + All information contained in this document is Broadcom Corporation 
15872 + company private, proprietary, and trade secret. 
15873
15874 +:>
15875 +*/
15876 +/****************************************************************************
15877 + *
15878 + * DslFramer.h 
15879 + *
15880 + * Description:
15881 + *     This file contains common DSL framer definitions
15882 + *
15883 + *
15884 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
15885 + * Authors: Ilya Stomakhin
15886 + *
15887 + * $Revision: 1.3 $
15888 + *
15889 + * $Id: DslFramer.h,v 1.3 2004/07/21 01:39:41 ilyas Exp $
15890 + *
15891 + * $Log: DslFramer.h,v $
15892 + * Revision 1.3  2004/07/21 01:39:41  ilyas
15893 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
15894 + *
15895 + * Revision 1.2  2004/04/12 23:41:10  ilyas
15896 + * Added standard header for shared ADSL driver files
15897 + *
15898 + * Revision 1.1  2001/12/13 02:28:27  ilyas
15899 + * Added common framer (DslPacket and G997) and G997 module
15900 + *
15901 + *
15902 + *
15903 + *****************************************************************************/
15904 +
15905 +#ifndef        DslFramerHeader
15906 +#define        DslFramerHeader
15907 +
15908 +#include "DList.h"
15909 +
15910 +#define        kDslFramerInitialized                   0x80000000
15911 +
15912 +/* status codes */
15913 +
15914 +#define        kDslFramerRxFrame                               1
15915 +#define        kDslFramerRxFrameErr                    2
15916 +#define kDslFramerTxFrame                              3
15917 +#define        kDslFramerTxFrameErr                    4
15918 +
15919 +#define        kDslFramerRxFrameErrFlushed             1
15920 +#define        kDslFramerRxFrameErrAbort               2
15921 +#define        kDslFramerRxFrameErrPhy                 3
15922 +
15923 +#define        kDslFramerTxFrameErrFlushed             1
15924 +
15925 +
15926 +typedef        struct _dslFramerBufDesc {
15927 +       long            pkId;
15928 +       long            bufFlags;
15929 +       void            *bufPtr;
15930 +       long            bufLen;
15931 +} dslFramerBufDesc;
15932 +
15933 +/* data bufDesc flags */
15934 +
15935 +#define kDslFramerStartNewFrame                        1
15936 +#define kDslFramerEndOfFrame                   2
15937 +#define kDslFramerAbortFrame                   4
15938 +
15939 +#define kDslFramerExtraByteShift               3
15940 +#define kDslFramerExtraByteMask                        (0x7 << kDslFramerExtraByteShift)
15941 +
15942 +typedef struct _dslFramerControl {
15943 +       bitMap                                  setup;
15944 +       dslFrameHandlerType             rxIndicateHandlerPtr;
15945 +       dslFrameHandlerType             txCompleteHandlerPtr;
15946 +       dslStatusHandlerType    statusHandlerPtr;
15947 +       ulong                                   statusCode;
15948 +       ulong                                   statusOffset;
15949 +
15950 +       int                                             nRxBuffers;
15951 +       int                                             nRxBufSize;
15952 +       int                                             nRxPackets;
15953 +
15954 +       dslFrame                                *freeBufListPtr;
15955 +       void                                    *freeBufPool;
15956 +       void                                    *pBufMemory;
15957 +
15958 +       dslFrame                                *freePacketListPtr;
15959 +       void                                    *freePacketPool;
15960 +
15961 +       /* RX working data set */
15962 +
15963 +       dslFrame                                *pRxFrame;
15964 +       dslFrameBuffer                  *pRxBuf;
15965 +       uchar                                   *pRxBufData;
15966 +       uchar                                   *pRxBufDataEnd;
15967 +       int                                             rxFrameLen;
15968 +
15969 +       /* TX working data set */
15970 +
15971 +       DListHeader                             dlistTxWaiting;
15972 +       dslFrame                                *pTxFrame;
15973 +       dslFrameBuffer                  *pTxBuf;
15974 +       uchar                                   *pTxBufData;
15975 +       uchar                                   *pTxBufDataEnd;
15976 +
15977 +       /* stats data */
15978 +
15979 +       ulong                                   dslByteCntRxTotal;
15980 +       ulong                                   dslByteCntTxTotal;
15981 +
15982 +       ulong                                   dslFrameCntRxTotal;
15983 +       ulong                                   dslFrameCntRxErr;
15984 +       ulong                                   dslFrameCntTxTotal;
15985 +       
15986 +} dslFramerControl;
15987 +
15988 +
15989 +extern Boolean  DslFramerInit(
15990 +                       void                                    *gDslVars,
15991 +                       dslFramerControl                *dfCtrl,
15992 +                       bitMap                                  setup,
15993 +                       ulong                                   statusCode,
15994 +                       ulong                                   statusOffset,
15995 +                       dslFrameHandlerType             rxIndicateHandlerPtr,
15996 +                       dslFrameHandlerType             txCompleteHandlerPtr,
15997 +                       dslStatusHandlerType    statusHandlerPtr,
15998 +                       ulong                                   rxBufNum,
15999 +                       ulong                                   rxBufSize,
16000 +                       ulong                                   rxPacketNum);
16001 +extern void DslFramerClose(void *gDslVars, dslFramerControl *dfCtrl);
16002 +extern void DslFramerSendFrame(void *gDslVars, dslFramerControl *dfCtrl, dslFrame *pFrame);
16003 +extern void DslFramerReturnFrame(void *gDslVars, dslFramerControl *dfCtrl, dslFrame *pFrame);
16004 +
16005 +
16006 +extern Boolean DslFramerRxGetPtr(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
16007 +extern void    DslFramerRxDone  (void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
16008 +extern Boolean DslFramerTxGetPtr(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
16009 +extern void    DslFramerTxDone(void *gDslVars, dslFramerControl *dfCtrl, dslFramerBufDesc *pBufDesc);
16010 +extern Boolean DslFramerTxIdle (void *gDslVars, dslFramerControl *dfCtrl);
16011 +extern void DslFramerTxFlush(void *gDslVars, dslFramerControl *dfCtrl);
16012 +
16013 +extern void * DslFramerGetFramePoolHandler(dslFramerControl *dfCtrl);
16014 +extern void DslFramerClearStat(dslFramerControl *dfCtrl);
16015 +
16016 +extern void DslFramerRxFlushFrame (void *gDslVars, dslFramerControl *dfCtrl, int errCode);
16017 +extern void DslFramerRxFlush(void *gDslVars, dslFramerControl *dfCtrl);
16018 +
16019 +#endif /* DslFramerHeader */
16020 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Flatten.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Flatten.h
16021 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Flatten.h 1970-01-01 01:00:00.000000000 +0100
16022 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Flatten.h        2006-06-26 09:07:10.000000000 +0200
16023 @@ -0,0 +1,115 @@
16024 +/*
16025 +<:copyright-broadcom 
16026
16027 + Copyright (c) 2002 Broadcom Corporation 
16028 + All Rights Reserved 
16029 + No portions of this material may be reproduced in any form without the 
16030 + written permission of: 
16031 +          Broadcom Corporation 
16032 +          16215 Alton Parkway 
16033 +          Irvine, California 92619 
16034 + All information contained in this document is Broadcom Corporation 
16035 + company private, proprietary, and trade secret. 
16036
16037 +:>
16038 +*/
16039 +/****************************************************************************
16040 + *
16041 + * Flatten.h -- Header for Flatten/Unflatten command/status
16042 + *
16043 + * Copyright (c) 1998 AltoCom, Inc. All rights reserved.
16044 + * Authors: Ilya Stomakhin
16045 + *
16046 + * $Revision: 1.14 $
16047 + *
16048 + * $Id: Flatten.h,v 1.14 2004/03/04 19:48:52 linyin Exp $
16049 + *
16050 + * $Log: Flatten.h,v $
16051 + * Revision 1.14  2004/03/04 19:48:52  linyin
16052 + * Support adsl2plus
16053 + *
16054 + * Revision 1.13  2003/10/17 22:45:14  yongbing
16055 + * Increase buffer size for large B&G table of G992P3
16056 + *
16057 + * Revision 1.12  2003/08/12 23:16:26  khp
16058 + * - for Haixiang: added support for ADSL_MARGIN_TWEAK_TEST
16059 + *
16060 + * Revision 1.11  2003/02/27 06:33:03  ilyas
16061 + * Improved free space checking in command buffer (became a problem with
16062 + * 2 commands SetXmtgain and StartPhy)
16063 + *
16064 + * Revision 1.10  2003/01/11 01:27:07  ilyas
16065 + * Improved checking for available space in status buffer
16066 + *
16067 + * Revision 1.9  2002/09/07 01:43:59  ilyas
16068 + * Added support for OEM parameters
16069 + *
16070 + * Revision 1.8  2002/05/16 00:01:52  khp
16071 + * -added missing #endif
16072 + *
16073 + * Revision 1.7  2002/05/15 00:04:48  mprahlad
16074 + * increase the status buffer size - prevent memory overflow for annexC cases
16075 + *
16076 + * Revision 1.6  2002/04/05 04:10:33  linyin
16077 + * -hack to fit in Annex C firmware in LMEM
16078 + *
16079 + * Revision 1.5  2002/04/05 02:45:25  linyin
16080 + * Make the buffer side larger for annexC
16081 + *
16082 + * Revision 1.4  2002/01/30 07:19:06  ilyas
16083 + * Moved showtime code to LMEM
16084 + *
16085 + * Revision 1.3  2001/08/29 02:56:01  ilyas
16086 + * Added tests for flattening/unflatenning command and statuses (dual mode)
16087 + *
16088 + * Revision 1.2  2001/04/25 00:30:54  ilyas
16089 + * Adjusted MaxFrameLen
16090 + *
16091 + * Revision 1.1  2001/04/24 21:41:21  ilyas
16092 + * Implemented status flattening/unflattaning to transfer statuses between
16093 + * modules asynchronously through the circular buffer
16094 + *
16095 + *
16096 + *****************************************************************************/
16097 +
16098 +#ifndef _Flatten_H_
16099 +#define _Flatten_H_
16100 +
16101 +#include       "CircBuf.h"
16102 +
16103 +#ifdef ADSL_MARGIN_TWEAK_TEST
16104 +#define kMaxFlattenedCommandSize       272             /* maximum no. of bytes in flattened cmd */
16105 +#else
16106 +#define kMaxFlattenedCommandSize       128             /* maximum no. of bytes in flattened cmd */
16107 +#endif
16108 +#if    defined(G992_ANNEXC) || defined(G992P3)
16109 +#if defined(G992P5)
16110 +#define kMaxFlattenedStatusSize                2200    /* maximum no. of bytes in flattened status */
16111 +#else
16112 +#define kMaxFlattenedStatusSize                1100    /* maximum no. of bytes in flattened status */
16113 +#endif
16114 +#else
16115 +#define kMaxFlattenedStatusSize                 550    /* maximum no. of bytes in flattened status */
16116 +#endif
16117 +
16118 +#define        kMaxFlattenFramelength          (kMaxFlattenedStatusSize - (4*sizeof(long)) - 20)
16119 +
16120 +extern int     SM_DECL FlattenCommand  (dslCommandStruct *cmd, ulong *dstPtr, ulong nAvail);
16121 +extern int     SM_DECL UnflattenCommand(ulong *srcPtr, dslCommandStruct *cmd);
16122 +extern int     SM_DECL FlattenStatus   (dslStatusStruct *status, ulong *dstPtr, ulong nAvail);
16123 +extern int     SM_DECL UnflattenStatus (ulong *srcPtr, dslStatusStruct *status);
16124 +
16125 +#define        FlattenBufferInit(fb,fbData,bufSize,itemSize)           \
16126 +       StretchBufferInit(fb, fbData, bufSize, itemSize)
16127 +       
16128 +extern int     SM_DECL FlattenBufferStatusWrite(stretchBufferStruct *fBuf, dslStatusStruct *status);
16129 +extern int     SM_DECL FlattenBufferStatusRead(stretchBufferStruct *fBuf, dslStatusStruct *status);
16130 +
16131 +extern int     SM_DECL FlattenBufferCommandWrite(stretchBufferStruct *fBuf, dslCommandStruct *cmd);
16132 +extern int     SM_DECL FlattenBufferCommandRead(stretchBufferStruct *fBuf, dslCommandStruct *cmd);
16133 +
16134 +#define FlattenBufferReadComplete(fb,nBytes)                           \
16135 +       StretchBufferReadUpdate (fb, nBytes)
16136 +
16137 +#endif /* _Flatten_H_ */
16138 +
16139 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.gh
16140 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.gh   1970-01-01 01:00:00.000000000 +0100
16141 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.gh  2006-06-26 09:07:10.000000000 +0200
16142 @@ -0,0 +1,110 @@
16143 +/*
16144 +<:copyright-broadcom 
16145
16146 + Copyright (c) 2002 Broadcom Corporation 
16147 + All Rights Reserved 
16148 + No portions of this material may be reproduced in any form without the 
16149 + written permission of: 
16150 +          Broadcom Corporation 
16151 +          16215 Alton Parkway 
16152 +          Irvine, California 92619 
16153 + All information contained in this document is Broadcom Corporation 
16154 + company private, proprietary, and trade secret. 
16155
16156 +:>
16157 +*/
16158 +/****************************************************************************
16159 + *
16160 + * G992p3OvhMsg.gh 
16161 + *
16162 + * Description:
16163 + *     This is a header file which defines the type for the G992p3 overhead 
16164 + *  channel messages global variable structure.
16165 + *
16166 + *
16167 + * Copyright (c) 1999-2003 BroadCom, Inc. All rights reserved.
16168 + * Authors: Ilya Stomakhin
16169 + *
16170 + * $Revision: 1.5 $
16171 + *
16172 + * $Id: G992p3OvhMsg.gh,v 1.5 2004/09/11 03:52:25 ilyas Exp $
16173 + *
16174 + * $Log: G992p3OvhMsg.gh,v $
16175 + * Revision 1.5  2004/09/11 03:52:25  ilyas
16176 + * Added support for overhead message segmentation
16177 + *
16178 + * Revision 1.4  2004/07/07 01:27:20  ilyas
16179 + * Fixed OHC message stuck problem on L2 entry/exit
16180 + *
16181 + * Revision 1.3  2004/06/10 00:13:31  ilyas
16182 + * Added L2/L3 and SRA
16183 + *
16184 + * Revision 1.2  2004/04/12 23:34:52  ilyas
16185 + * Merged the latest ADSL driver chnages for ADSL2+
16186 + *
16187 + * Revision 1.1  2003/07/18 19:39:18  ilyas
16188 + * Initial G.992.3 overhead channel message implementation (from ADSL driver)
16189 + *
16190 + *
16191 + *****************************************************************************/
16192 +
16193 +#ifndef        G992p3OvhMsgFramerGlobals
16194 +#define        G992p3OvhMsgFramerGlobals
16195 +
16196 +#define        kG992p3OvhMsgMaxCmdSize                 (16 + 16)
16197 +#define        kG992p3OvhMsgMaxRspSize                 (16 + 2*512)
16198 +
16199 +typedef struct
16200 +       {
16201 +       dslFrame                                *segFrame;
16202 +       dslFrameBuffer                  *segFrBufCur;
16203 +       dslFrameBuffer                  segFrBuf;
16204 +       ulong                                   timeSegOut;
16205 +       uchar                                   tryCnt;
16206 +       uchar                                   segTotal;
16207 +       uchar                                   segId;
16208 +       }
16209 +       g992p3SegFrameCtlStruct;
16210 +
16211 +typedef struct
16212 +       {
16213 +       bitMap                                  setup;
16214 +       dslFrameHandlerType             rxReturnFramePtr;
16215 +       dslFrameHandlerType             txSendFramePtr;
16216 +       dslCommandHandlerType   cmdHandlerPtr;
16217 +       dslStatusHandlerType    statusHandlerPtr;
16218 +
16219 +       dslFrame                                txRspFrame;
16220 +       dslFrameBuffer                  txRspFrBuf;
16221 +       dslFrameBuffer                  txRspFrBuf1;
16222 +       uchar                                   txRspBuf[kG992p3OvhMsgMaxRspSize];
16223 +       dslFrame                                txPwrRspFrame;
16224 +       dslFrameBuffer                  txPwrRspFrBuf0;
16225 +       dslFrameBuffer                  txPwrRspFrBuf0a;
16226 +       dslFrameBuffer                  txPwrRspFrBuf1;
16227 +       uchar                                   txPwrRspBuf0[8];
16228 +       dslFrame                                txCmdFrame;
16229 +       dslFrameBuffer                  txCmdFrBuf0;
16230 +       dslFrameBuffer                  txCmdFrBuf0a;
16231 +       dslFrameBuffer                  txCmdFrBuf1;
16232 +       uchar                                   txCmdBuf[kG992p3OvhMsgMaxCmdSize];
16233 +       g992p3SegFrameCtlStruct txSegFrameCtl;
16234 +       ulong                                   txFlags;
16235 +       uchar                                   txL0Rq;
16236 +       uchar                                   txL3Rq;
16237 +
16238 +       ulong                                   timeMs;
16239 +       ulong                                   timeCmdOut;
16240 +       ulong                                   cmdTryCnt;
16241 +       ulong                                   cmdNum;
16242 +       ulong                                   timeRspOut;
16243 +       uchar                                   *txPmdCmd;
16244 +
16245 +       uchar                                   rxCmdMsgNum;
16246 +       uchar                                   rxRspMsgNum;
16247 +       uchar                                   txCmdMsgNum;
16248 +       uchar                                   txRspMsgNum;
16249 +       }
16250 +       g992p3OvhMsgVarsStruct;
16251 +
16252 +#endif /* G992p3OvhMsgFramerGlobals */
16253 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.h
16254 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.h    1970-01-01 01:00:00.000000000 +0100
16255 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G992p3OvhMsg.h   2006-06-26 09:07:10.000000000 +0200
16256 @@ -0,0 +1,64 @@
16257 +/*
16258 +<:copyright-broadcom 
16259
16260 + Copyright (c) 2002 Broadcom Corporation 
16261 + All Rights Reserved 
16262 + No portions of this material may be reproduced in any form without the 
16263 + written permission of: 
16264 +          Broadcom Corporation 
16265 +          16215 Alton Parkway 
16266 +          Irvine, California 92619 
16267 + All information contained in this document is Broadcom Corporation 
16268 + company private, proprietary, and trade secret. 
16269
16270 +:>
16271 +*/
16272 +/****************************************************************************
16273 + *
16274 + * G992p3OvhMsg.h 
16275 + *
16276 + * Description:
16277 + *     This file contains the exported functions and definitions for G992p3 
16278 + *  overhead channel messages
16279 + *
16280 + *
16281 + * Copyright (c) 1999-2003 BroadCom, Inc. All rights reserved.
16282 + * Authors: Ilya Stomakhin
16283 + *
16284 + * $Revision: 1.1 $
16285 + *
16286 + * $Id: G992p3OvhMsg.h,v 1.1 2003/07/18 19:39:18 ilyas Exp $
16287 + *
16288 + * $Log: G992p3OvhMsg.h,v $
16289 + * Revision 1.1  2003/07/18 19:39:18  ilyas
16290 + * Initial G.992.3 overhead channel message implementation (from ADSL driver)
16291 + *
16292 + *
16293 + *****************************************************************************/
16294 +
16295 +#ifndef        G992p3OvhMsgFramerHeader
16296 +#define        G992p3OvhMsgFramerHeader
16297 +
16298 +#define        kG992p3OvhMsgFrameBufCnt        -1
16299 +
16300 +extern Boolean  G992p3OvhMsgInit(
16301 +               void                                    *gDslVars, 
16302 +               bitMap                                  setup,
16303 +               dslFrameHandlerType             rxReturnFramePtr,
16304 +               dslFrameHandlerType             txSendFramePtr,
16305 +               dslCommandHandlerType   commandHandler,
16306 +               dslStatusHandlerType    statusHandler);
16307 +
16308 +extern void            G992p3OvhMsgReset(void *gDslVars);
16309 +extern void            G992p3OvhMsgClose(void *gDslVars);
16310 +extern void            G992p3OvhMsgTimer(void *gDslVars, long timeQ24ms);
16311 +extern Boolean G992p3OvhMsgCommandHandler (void *gDslVars, dslCommandStruct *cmd);
16312 +extern void            G992p3OvhMsgStatusSnooper (void *gDslVars, dslStatusStruct *status);
16313 +
16314 +extern int             G992p3OvhMsgSendCompleteFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
16315 +extern  int            G992p3OvhMsgIndicateRcvFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
16316 +
16317 +extern void            G992p3OvhMsgSetL3(void *gDslVars);
16318 +extern void            G992p3OvhMsgSetL0(void *gDslVars);
16319 +
16320 +#endif /* G992p3OvhMsgFramerHeader */
16321 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.gh
16322 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.gh   1970-01-01 01:00:00.000000000 +0100
16323 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.gh  2006-06-26 09:07:10.000000000 +0200
16324 @@ -0,0 +1,66 @@
16325 +/****************************************************************************
16326 + *
16327 + * G997.gh 
16328 + *
16329 + * Description:
16330 + *     This is a header file which defines the type for the G997 Framer
16331 + *     global variable structure.
16332 + *
16333 + *
16334 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
16335 + * Authors: Ilya Stomakhin
16336 + *
16337 + * $Revision: 1.5 $
16338 + *
16339 + * $Id: G997.gh,v 1.5 2004/07/21 01:39:41 ilyas Exp $
16340 + *
16341 + * $Log: G997.gh,v $
16342 + * Revision 1.5  2004/07/21 01:39:41  ilyas
16343 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
16344 + *
16345 + * Revision 1.4  2004/04/27 00:27:16  ilyas
16346 + * Implemented double buffering to ensure G.997 HDLC frame is continuous
16347 + *
16348 + * Revision 1.3  2003/07/18 18:56:59  ilyas
16349 + * Added support for shared TX buffer (for ADSL driver)
16350 + *
16351 + * Revision 1.2  2002/01/11 06:48:27  ilyas
16352 + * Added command handler pointer
16353 + *
16354 + * Revision 1.1  2001/12/13 02:28:27  ilyas
16355 + * Added common framer (DslPacket and G997) and G997 module
16356 + *
16357 + *
16358 + *****************************************************************************/
16359 +
16360 +#ifndef        G997FramerGlobals
16361 +#define        G997FramerGlobals
16362 +
16363 +#include "DslFramer.h"
16364 +#include "HdlcFramer.h"
16365 +
16366 +#define        kG997MsgBufSize         64
16367 +
16368 +typedef struct
16369 +       {
16370 +       bitMap                                  setup;
16371 +       dslFramerControl                dslFramer;
16372 +       hdlcByteControl                 hdlcByte;
16373 +       dslCommandHandlerType   commandHandler;
16374 +
16375 +       ulong                                   timeMs;
16376 +       ulong                                   timeCmdOut;
16377 +
16378 +       uchar                                   rxMsgNum;               
16379 +       uchar                                   txMsgNum;
16380 +       Boolean                                 txIdle;         
16381 +       uchar                                   txMsgBuf[kG997MsgBufSize];
16382 +       ulong                                   txMsgBufLen;
16383 +       uchar                                   *txMsgBufPtr;
16384 +       ulong                                   txMsgLen;
16385 +       ulong                                   txMsgBufs;
16386 +       ulong                                   txMsgBufNum;
16387 +       }
16388 +       g997VarsStruct;
16389 +
16390 +#endif /* G997FramerGlobals */
16391 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.h
16392 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.h    1970-01-01 01:00:00.000000000 +0100
16393 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/G997.h   2006-06-26 09:07:10.000000000 +0200
16394 @@ -0,0 +1,68 @@
16395 +/*
16396 +<:copyright-broadcom 
16397
16398 + Copyright (c) 2002 Broadcom Corporation 
16399 + All Rights Reserved 
16400 + No portions of this material may be reproduced in any form without the 
16401 + written permission of: 
16402 +          Broadcom Corporation 
16403 +          16215 Alton Parkway 
16404 +          Irvine, California 92619 
16405 + All information contained in this document is Broadcom Corporation 
16406 + company private, proprietary, and trade secret. 
16407
16408 +:>
16409 +*/
16410 +/****************************************************************************
16411 + *
16412 + * G997.h 
16413 + *
16414 + * Description:
16415 + *     This file contains the exported functions and definitions for G97Framer
16416 + *
16417 + *
16418 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
16419 + * Authors: Ilya Stomakhin
16420 + *
16421 + * $Revision: 1.3 $
16422 + *
16423 + * $Id: G997.h,v 1.3 2003/07/18 18:56:59 ilyas Exp $
16424 + *
16425 + * $Log: G997.h,v $
16426 + * Revision 1.3  2003/07/18 18:56:59  ilyas
16427 + * Added support for shared TX buffer (for ADSL driver)
16428 + *
16429 + * Revision 1.2  2002/07/20 00:51:41  ilyas
16430 + * Merged witchanges made for VxWorks/Linux driver.
16431 + *
16432 + * Revision 1.1  2001/12/13 02:28:27  ilyas
16433 + * Added common framer (DslPacket and G997) and G997 module
16434 + *
16435 + *
16436 + *
16437 + *****************************************************************************/
16438 +
16439 +#ifndef        G997FramerHeader
16440 +#define        G997FramerHeader
16441 +
16442 +extern Boolean  G997Init(
16443 +               void                                    *gDslVars, 
16444 +               bitMap                                  setup, 
16445 +               ulong                                   rxBufNum,
16446 +               ulong                                   rxBufSize,
16447 +               ulong                                   rxPacketNum,
16448 +               upperLayerFunctions             *pUpperLayerFunctions,
16449 +               dslCommandHandlerType   g997PhyCommandHandler);
16450 +
16451 +extern void            G997Close(void *gDslVars);
16452 +extern void            G997Timer(void *gDslVars, long timeQ24ms);
16453 +extern Boolean G997CommandHandler (void *gDslVars, dslCommandStruct *cmd);
16454 +extern void            G997StatusSnooper (void *gDslVars, dslStatusStruct *status);
16455 +
16456 +extern int             G997SendFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
16457 +extern  int            G997ReturnFrame(void *gDslVars, void *pVc, ulong mid, dslFrame *pFrame);
16458 +
16459 +extern  Boolean G997SetTxBuffer(void *gDslVars, ulong len, void *bufPtr);
16460 +extern void *  G997GetFramePoolHandler(void *gDslVars);
16461 +
16462 +#endif /* G997FramerHeader */
16463 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/HdlcFramer.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/HdlcFramer.h
16464 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/HdlcFramer.h      1970-01-01 01:00:00.000000000 +0100
16465 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/HdlcFramer.h     2006-06-26 09:07:10.000000000 +0200
16466 @@ -0,0 +1,237 @@
16467 +/*
16468 +<:copyright-broadcom 
16469
16470 + Copyright (c) 2002 Broadcom Corporation 
16471 + All Rights Reserved 
16472 + No portions of this material may be reproduced in any form without the 
16473 + written permission of: 
16474 +          Broadcom Corporation 
16475 +          16215 Alton Parkway 
16476 +          Irvine, California 92619 
16477 + All information contained in this document is Broadcom Corporation 
16478 + company private, proprietary, and trade secret. 
16479
16480 +:>
16481 +*/
16482 +/****************************************************************************
16483 + *
16484 + * HdlcFramer.h 
16485 + *
16486 + * Description:
16487 + *     This file contains common HDLC definitions for bit/byte stuffing
16488 + *
16489 + *
16490 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
16491 + * Authors: Ilya Stomakhin
16492 + *
16493 + * $Revision: 1.3 $
16494 + *
16495 + * $Id: HdlcFramer.h,v 1.3 2004/07/21 01:39:41 ilyas Exp $
16496 + *
16497 + * $Log: HdlcFramer.h,v $
16498 + * Revision 1.3  2004/07/21 01:39:41  ilyas
16499 + * Reset entire G.997 state on retrain. Timeout in G.997 if no ACK
16500 + *
16501 + * Revision 1.2  2003/07/18 18:51:05  ilyas
16502 + * Added mode (default) to pass address and control field
16503 + *
16504 + * Revision 1.1  2001/12/13 02:28:27  ilyas
16505 + * Added common framer (DslPacket and G997) and G997 module
16506 + *
16507 + *
16508 + *
16509 + *****************************************************************************/
16510 +
16511 +#ifndef        HdlcFramerHeader
16512 +#define        HdlcFramerHeader
16513 +
16514 +/* setup bitmap definitions */
16515 +
16516 +#define        kHdlcSetupShift                 16
16517 +#define        kHdlcSetupMask                  ((long)0xFFFF << kHdlcSetupShift)
16518 +
16519 +#define        kHdlcCrcMask                    0x00030000
16520 +#define        kHdlcCrcNone                    0x00000000
16521 +#define        kHdlcCrc16                              0x00010000
16522 +#define        kHdlcCrc32                              0x00020000
16523 +
16524 +#define        kHdlcTxIdleStop                 0x00040000
16525 +#define        kHdlcSpecialAddrCtrl    0x00080000
16526 +
16527 +extern ushort HdlcCrc16Table[];
16528 +
16529 +#define HDLC16_CRC_INIT                        0xFFFF
16530 +#define HDLC16_CRC_FINAL(crc)  ((crc) ^ 0xFFFF)
16531 +#define HDLC16_GOOD_CRC                        0xF0B8
16532 +#define        Hdlc16UpdateCrc(crc,b)  ((crc) >> 8) ^ HdlcCrc16Table[((crc) ^ (b)) & 0xFF]
16533 +
16534 +extern ulong  HdlcCrc32Table[];
16535 +
16536 +#define HDLC32_CRC_INIT                        0xFFFFFFFF
16537 +#define HDLC32_CRC_FINAL(crc)  ((crc) ^ 0xFFFFFFFF)
16538 +#define HDLC32_GOOD_CRC                        0xDEBB20E3
16539 +#define        Hdlc32UpdateCrc(crc,b)  ((crc) >> 8) ^ HdlcCrc32Table[((crc) ^ (b)) & 0xFF]
16540 +
16541 +extern ulong  HdlcCrc32Table[];
16542 +
16543 +/* HDLC common fields */
16544 +
16545 +#define        HDLC_ADDR                               0xFF
16546 +#define        HDLC_CTRL                               0x3
16547 +
16548 +#define        HDLC_BYTE_FLAG                  0x7E
16549 +#define        HDLC_BYTE_ESC                   0x7D
16550 +
16551 +/* HDLC frame assembly states */
16552 +
16553 +#define        HDLC_STATE_START_FLAG   0
16554 +#define        HDLC_STATE_ADDRESS              (HDLC_STATE_START_FLAG + 1)
16555 +#define        HDLC_STATE_CONTROL              (HDLC_STATE_START_FLAG + 2)
16556 +#define        HDLC_STATE_DATA                 (HDLC_STATE_START_FLAG + 3)
16557 +#define        HDLC_STATE_FCS1                 (HDLC_STATE_START_FLAG + 4)
16558 +#define        HDLC_STATE_FCS2                 (HDLC_STATE_START_FLAG + 5)
16559 +#define        HDLC_STATE_END_FLAG             (HDLC_STATE_START_FLAG + 6)
16560 +
16561 +
16562 +/* HDLC common types */
16563 +
16564 +typedef struct _hdlcByteControl {
16565 +       bitMap                                  setup;
16566 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
16567 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
16568 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
16569 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
16570 +
16571 +       /* RX working data set */
16572 +
16573 +       uchar                                   rxFrameState;
16574 +       int                                             rxFrameLen;
16575 +       ulong                                   rxCrc;
16576 +       Boolean                                 rxEscChar;
16577 +
16578 +       uchar                                   *pRxData;
16579 +       uchar                                   *pRxDataEnd;
16580 +       long                                    rxDataLen;
16581 +
16582 +       /* TX working data set */
16583 +
16584 +       uchar                                   txFrameState;
16585 +       int                                             txFrameLen;
16586 +       ulong                                   txCrc;
16587 +       int                                             txCharPending;
16588 +
16589 +       uchar                                   *pTxData;
16590 +       uchar                                   *pTxDataEnd;
16591 +       long                                    txDataLen;
16592 +} hdlcByteControl;
16593 +
16594 +typedef struct _hdlcBitControl {
16595 +       bitMap                                  setup;
16596 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
16597 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
16598 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
16599 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
16600 +
16601 +       /* RX working data set */
16602 +
16603 +       uchar                                   rxFrameState;
16604 +       int                                             rxFrameLen;
16605 +       ulong                                   rxCrc;
16606 +       int                                             rxNibblePending;
16607 +       int                                             rxOutVal;
16608 +       uchar                                   rxOutBits;
16609 +       uchar                                   rxRem1Bits;
16610 +       Boolean                                 rxEscChar; /* ???? */
16611 +
16612 +       uchar                                   *pRxData;
16613 +       uchar                                   *pRxDataEnd;
16614 +       long                                    rxDataLen;
16615 +
16616 +       /* TX working data set */
16617 +
16618 +       uchar                                   txFrameState;
16619 +       int                                             txFrameLen;
16620 +       ulong                                   txCrc;
16621 +       int                                             txOutVal;
16622 +       uchar                                   txOutBits;
16623 +       uchar                                   txLast1Bits;
16624 +       int                                             txCharPending;  /* ???? */
16625 +
16626 +       uchar                                   *pTxData;
16627 +       uchar                                   *pTxDataEnd;
16628 +       long                                    txDataLen;
16629 +} hdlcBitControl;
16630 +
16631 +/* HDLC common functions */
16632 +
16633 +#define HdlcFramerTxFrameInit(ctrl)    do {                    \
16634 +       ctrl->txFrameState = HDLC_STATE_START_FLAG;             \
16635 +       ctrl->txFrameLen   = 0;                                                 \
16636 +       ctrl->txCrc                = HDLC16_CRC_INIT;                   \
16637 +       ctrl->txCharPending= -1;                                                \
16638 +} while (0)
16639 +
16640 +#define HdlcFramerRxFrameInit(ctrl) do {                       \
16641 +       ctrl->rxFrameState = HDLC_STATE_START_FLAG;             \
16642 +       ctrl->rxFrameLen   = 0;                                                 \
16643 +       ctrl->rxCrc                = HDLC16_CRC_INIT;                   \
16644 +       ctrl->rxEscChar    = false;                                             \
16645 +} while (0)
16646 +
16647 +#define HdlcFramerTxGetData(ctrl)  do {                                                                \
16648 +       dslFramerBufDesc        bufDesc;                                                                        \
16649 +                                                                                                                                       \
16650 +       if ((ctrl->txDataGetPtrHandler) (gDslVars, &bufDesc)) {                 \
16651 +               ctrl->pTxData = bufDesc.bufPtr;                                                         \
16652 +               ctrl->pTxDataEnd = (uchar*)bufDesc.bufPtr + bufDesc.bufLen;     \
16653 +               ctrl->txDataLen  = bufDesc.bufLen;                                                      \
16654 +               if (bufDesc.bufFlags & kDslFramerStartNewFrame)                         \
16655 +                       HdlcFramerTxFrameInit(ctrl);                                                    \
16656 +       }                                                                                                                               \
16657 +       else {                                                                                                                  \
16658 +               HdlcFramerTxFrameInit(ctrl);                                                            \
16659 +       }                                                                                                                               \
16660 +} while (0);
16661 +
16662 +#define HdlcFramerRxGetData(ctrl, frFlag)  do {                                                \
16663 +       dslFramerBufDesc                bufDesc;                                                                \
16664 +                                                                                                                                       \
16665 +       bufDesc.bufFlags = frFlag;                                                                              \
16666 +       if ((ctrl->rxDataGetPtrHandler) (gDslVars, &bufDesc)) {                 \
16667 +               ctrl->pRxData = bufDesc.bufPtr;                                                         \
16668 +               ctrl->pRxDataEnd = (uchar*)bufDesc.bufPtr + bufDesc.bufLen;     \
16669 +               ctrl->rxDataLen  = bufDesc.bufLen;                                                      \
16670 +       }                                                                                                                               \
16671 +} while (0);
16672 +
16673 +/* HDLC functions headers */
16674 +
16675 +extern Boolean HdlcByteInit(
16676 +       void                                                    *gDslVars, 
16677 +       hdlcByteControl                                 *hbyCtrl,
16678 +       bitMap                                                  setup, 
16679 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler,
16680 +       dslFramerDataDoneHandlerType    rxDataDoneHandler,
16681 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler,
16682 +       dslFramerDataDoneHandlerType    txDataDoneHandler);
16683 +
16684 +extern void HdlcByteReset(void *gDslVars, hdlcByteControl *hbyCtrl);
16685 +extern void HdlcByteRxFlush(void *gDslVars, hdlcByteControl *hbyCtrl);
16686 +extern int HdlcByteRx(void *gDslVars, hdlcByteControl *hbyCtrl, int nBytes, uchar *srcPtr) FAST_TEXT;
16687 +extern int HdlcByteTx(void *gDslVars, hdlcByteControl *hbyCtrl, int nBytes, uchar *dstPtr) FAST_TEXT;
16688 +extern Boolean HdlcByteTxIdle(void *gDslVars, hdlcByteControl *hbyCtrl);
16689 +
16690 +extern Boolean HdlcBitInit(
16691 +       void                                                    *gDslVars, 
16692 +       hdlcBitControl                                  *hbiCtrl,
16693 +       bitMap                                                  setup, 
16694 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler,
16695 +       dslFramerDataDoneHandlerType    rxDataDoneHandler,
16696 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler,
16697 +       dslFramerDataDoneHandlerType    txDataDoneHandler);
16698 +
16699 +extern void HdlcBitReset(void *gDslVars, hdlcByteControl *hbiCtrl);
16700 +extern int HdlcBitRx(void *gDslVars, hdlcBitControl *hbiCtrl, int nBytes, uchar *srcPtr) FAST_TEXT;
16701 +extern int HdlcBitTx(void *gDslVars, hdlcBitControl *hbiCtrl, int nBytes, uchar *dstPtr) FAST_TEXT;
16702 +
16703 +#endif /* HdlcFramerHeader */
16704 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MathUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MathUtil.h
16705 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MathUtil.h        1970-01-01 01:00:00.000000000 +0100
16706 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MathUtil.h       2006-06-26 09:07:10.000000000 +0200
16707 @@ -0,0 +1,135 @@
16708 +/*
16709 +<:copyright-broadcom 
16710
16711 + Copyright (c) 2002 Broadcom Corporation 
16712 + All Rights Reserved 
16713 + No portions of this material may be reproduced in any form without the 
16714 + written permission of: 
16715 +          Broadcom Corporation 
16716 +          16215 Alton Parkway 
16717 +          Irvine, California 92619 
16718 + All information contained in this document is Broadcom Corporation 
16719 + company private, proprietary, and trade secret. 
16720
16721 +:>
16722 +*/
16723 +/************************************************************************
16724 + *
16725 + *     MathUtil.h:
16726 + *
16727 + *     Description:
16728 + *     This file contains the exported interface for MathUtil.c module.
16729 + *
16730 + *
16731 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
16732 + * Authors: Mark Gonikberg, Haixiang Liang.
16733 + *
16734 + * $Revision: 1.6 $
16735 + *
16736 + * $Id: MathUtil.h,v 1.6 2004/04/13 00:21:13 ilyas Exp $
16737 + *
16738 + * $Log: MathUtil.h,v $
16739 + * Revision 1.6  2004/04/13 00:21:13  ilyas
16740 + * Added standard header for shared ADSL driver files
16741 + *
16742 + * Revision 1.5  2001/08/16 02:18:08  khp
16743 + * - mark functions with FAST_TEXT to reduce cycle counts for QPROC targets
16744 + *   (replaces use of LMEM_INSN)
16745 + *
16746 + * Revision 1.4  1999/10/06 04:55:22  liang
16747 + * Added function to multiply two long values to save result as VeryLong.
16748 + *
16749 + * Revision 1.3  1999/08/05 19:42:52  liang
16750 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
16751 + *
16752 + * Revision 1.2  1999/03/26 03:29:59  liang
16753 + * Export CosSin table.
16754 + *
16755 + * Revision 1.1  1998/10/28 01:28:07  liang
16756 + * *** empty log message ***
16757 + *
16758 + * Revision 1.12  1998/02/10  17:19:49  scott
16759 + * Changed MathVL routines to return arguments using pointers
16760 + *
16761 + * Revision 1.11  1997/12/13 06:12:07  mwg
16762 + * Added more Atan2 flavors
16763 + *
16764 + * Revision 1.10  1997/11/18 01:11:48  mwg
16765 + * Removed <CR> symbols which accidently slipped in.
16766 + *
16767 + * Revision 1.9  1997/11/03  19:07:52  scott
16768 + * No longer redefine max() and min() if already defined
16769 + *
16770 + * Revision 1.8  1997/07/30 01:35:20  liang
16771 + * Add more accurate atan2 function UtilLongLongAtan2.
16772 + *
16773 + * Revision 1.7  1997/07/21  20:23:19  mwg
16774 + * Added new function: UtilBlockCos()
16775 + *
16776 + * Revision 1.6  1997/03/21  23:50:10  liang
16777 + * Added initial version of V8bis module to CVS tree.
16778 + *
16779 + * Revision 1.5  1997/03/19  18:35:34  mwg
16780 + * Changed copyright notice.
16781 + *
16782 + * Revision 1.4  1997/01/21  00:36:15  mwg
16783 + * Added new function: UtilBlockCosSin()
16784 + *
16785 + * Revision 1.3  1996/06/18  21:14:45  mwg
16786 + * Modified VLDivVL by allowing to specify the result scaling.
16787 + *
16788 + * Revision 1.2  1996/06/12  02:31:59  mwg
16789 + * Added 64bit arithmetic functions.
16790 + *
16791 + * Revision 1.1.1.1  1996/02/14  02:35:15  mwg
16792 + * Redesigned the project directory structure. Merged V.34 into the project.
16793 + *
16794 + * Revision 1.4  1995/12/04  23:08:15  liang
16795 + * Add file Math/LinearToLog.c.
16796 + *
16797 + ************************************************************************/
16798 +#ifndef        MathUtilPh
16799 +#define        MathUtilPh
16800 +
16801 +/* Exported tables */
16802 +extern const short             UtilCosTable[];
16803 +
16804 +/* Exported functions */
16805 +extern ComplexShort    UtilCosSin(ushort angle);
16806 +extern long                    UtilBlockCosSin (int nValues, long angle, long delta, ComplexShort *dstPtr);
16807 +extern long                    UtilBlockCos (int nValues, long angle, long delta, short *dstPtr);
16808 +extern ushort                  UtilShortShortAtan2(ComplexShort point);
16809 +extern ushort                  UtilLongShortAtan2(ComplexLong point);
16810 +extern ulong                   UtilShortLongAtan2(ComplexShort point) FAST_TEXT;
16811 +extern ulong                   UtilLongLongAtan2(ComplexLong point) FAST_TEXT;
16812 +extern ushort                  UtilSqrt(ulong y);
16813 +extern ushort                  UtilMaxMagnitude(int blkSize, ComplexShort *dataPtr);
16814 +extern short                   UtilQ0LinearToQ4dB (ulong x);
16815 +extern ulong                   UtilQ4dBToQ12Linear (short x);
16816 +extern void                    UtilAdjustComplexMagnitude(ComplexShort *srcPtr, short mag, short adjustment);
16817 +
16818 +extern void VLMultLongByLong(long x, long y, VeryLong *dst);
16819 +extern void VLMultShort        (VeryLong x, short y, VeryLong *dst);
16820 +extern void VLAddVL            (VeryLong x, VeryLong y, VeryLong *dst);
16821 +extern void VLAddLong  (VeryLong x, long y, VeryLong *dst);
16822 +extern void VLSubVL            (VeryLong x, VeryLong y, VeryLong *dst);
16823 +extern void VLSubLong  (VeryLong x, long y, VeryLong *dst);
16824 +extern void VLDivVL            (VeryLong x, VeryLong y, int scale, long *dst);
16825 +extern void VLShiftLeft(VeryLong x, int shift, VeryLong *dst);
16826 +extern void VLShiftRight(VeryLong x, int shift, VeryLong *dst);
16827 +
16828 +
16829 +#define        UtilAtan2               UtilShortShortAtan2
16830 +#define        UtilLongAtan2   UtilLongShortAtan2
16831 +
16832 +/* Standard Macros     */
16833 +#undef abs
16834 +#define                abs(x)                  ((x) >= 0   ? (x) : -(x))
16835 +
16836 +#undef max
16837 +#define                max(x, y)               ((x) >= (y) ? (x) : (y))
16838 +
16839 +#undef min
16840 +#define                min(x, y)               ((x) <= (y) ? (x) : (y))
16841 +
16842 +#endif /* MathUtilPh */
16843 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MipsAsm.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MipsAsm.h
16844 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MipsAsm.h 1970-01-01 01:00:00.000000000 +0100
16845 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MipsAsm.h        2006-06-26 09:07:10.000000000 +0200
16846 @@ -0,0 +1,264 @@
16847 +/*
16848 +<:copyright-broadcom 
16849
16850 + Copyright (c) 2002 Broadcom Corporation 
16851 + All Rights Reserved 
16852 + No portions of this material may be reproduced in any form without the 
16853 + written permission of: 
16854 +          Broadcom Corporation 
16855 +          16215 Alton Parkway 
16856 +          Irvine, California 92619 
16857 + All information contained in this document is Broadcom Corporation 
16858 + company private, proprietary, and trade secret. 
16859
16860 +:>
16861 +*/
16862 +/************************************************************************
16863 + *
16864 + *     MipsAsm.h:
16865 + *
16866 + *     Description:
16867 + *     This file contains definitions specific to MIPS assembly 
16868 + *
16869 + *
16870 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
16871 + * Authors: Mark Gonikberg, Haixiang Liang.
16872 + *
16873 + * $Revision: 1.5 $
16874 + *
16875 + * $Id: MipsAsm.h,v 1.5 2004/04/13 00:16:59 ilyas Exp $
16876 + *
16877 + * $Log: MipsAsm.h,v $
16878 + * Revision 1.5  2004/04/13 00:16:59  ilyas
16879 + * Merged the latest ADSL driver changes
16880 + *
16881 + * Revision 1.4  2002/09/12 04:08:50  ilyas
16882 + * Added macros for BCM MIPS specific instructions
16883 + *
16884 + * Revision 1.3  2000/11/18 21:28:19  mprahlad
16885 + * ifdef bcm47xx -
16886 + * define MSUB(src1,src2) msub src1, src2
16887 + * change Mult(dst, src1, src2) to use "mul" instead of "mult; mflo"
16888 + * define Mul(src1, src2) mult src1, src2
16889 + *
16890 + * Revision 1.2  2000/07/28 21:05:05  mprahlad
16891 + * Macros specific to bcm47xx added.
16892 + *
16893 + * Revision 1.1  1999/08/05 19:52:57  liang
16894 + * Copied from the softmodem top of the tree on 08/04/99.
16895 + *
16896 + * Revision 1.5  1999/04/02 23:16:21  mwg
16897 + * Fixed a minor comatibility issue with mult
16898 + *
16899 + * Revision 1.4  1999/02/03 20:25:43  mwg
16900 + * Added an option for R4010
16901 + *
16902 + * Revision 1.3  1998/10/30 02:21:34  mwg
16903 + * Added targets for 4640
16904 + *
16905 + * Revision 1.2  1998/10/16 18:52:09  ilyas
16906 + * Added ASM_PROLOG[5-7] macros to save on stores
16907 + *
16908 + * Revision 1.1  1998/06/03 23:28:39  mwg
16909 + * Renamed from DinoDefs.h
16910 + *
16911 + * Revision 1.6  1998/02/09  18:23:11  scott
16912 + * Added EMBEDDED_CALLING_CONVENTION (GreenHill) and R3900/R4102
16913 + *
16914 + * Revision 1.5  1997/03/19 18:35:02  mwg
16915 + * Changed copyright notice.
16916 + *
16917 + * Revision 1.4  1996/10/02  20:28:41  liang
16918 + * Remove parameter "acc" from the non-DINO version of MAD.
16919 + *
16920 + * Revision 1.3  1996/10/02  19:44:36  liang
16921 + * Separated MultAdd into MAD and MADW, added NO_DINO_WRITEBACK option.
16922 + *
16923 + * Revision 1.2  1996/08/14  03:06:07  liang
16924 + * Modified macro MultAdd so that the assembly code build works.
16925 + *
16926 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
16927 + * Redesigned the project directory structure. Merged V.34 into the project.
16928 + *
16929 + * Revision 1.5  1994/11/04  22:41:29  mwg
16930 + * Added #ifdefs for different targets.
16931 + *
16932 + ************************************************************************/
16933 +
16934 +#ifndef _MIPS_ASM_H_
16935 +#define        _MIPS_ASM_H_
16936 +
16937 +#define zero   $0
16938 +#define v0     $2
16939 +#define v1     $3
16940 +#define a0     $4
16941 +#define a1     $5
16942 +#define a2     $6
16943 +#define a3     $7
16944 +#define t0     $8
16945 +#define t1     $9
16946 +#define t2     $10
16947 +#define t3     $11
16948 +#define t4     $12
16949 +#define t5     $13
16950 +#define t6     $14
16951 +#define t7     $15
16952 +#define s0     $16     
16953 +#define s1     $17
16954 +#define s2     $18
16955 +#define s3     $19
16956 +#define s4     $20
16957 +#define s5     $21
16958 +#define s6     $22
16959 +#define s7     $23
16960 +#define t8     $24
16961 +#define t9     $25
16962 +#define k0     $26
16963 +#define k1     $27
16964 +#define gp     $28
16965 +#define sp     $29
16966 +#define fp     $30
16967 +#define s8     $30
16968 +#define ra     $31
16969 +
16970 +#ifdef EMBEDDED_CALLING_CONVENTION
16971 +
16972 +/* Support for GreenHills embedded calling convention */
16973 +
16974 +#define ASM_PROLOG     subu    sp, 32; \
16975 +                                       sw              $8, 16(sp); \
16976 +                                       sw              $9, 20(sp); \
16977 +                                       sw              $10, 24(sp); \
16978 +                                       sw              $11, 28(sp);
16979 +
16980 +#define ASM_PROLOG5    subu    sp, 32; \
16981 +                                       sw              $8, 16(sp);
16982 +
16983 +#define ASM_PROLOG6    subu    sp, 32; \
16984 +                                       sw              $8, 16(sp); \
16985 +                                       sw              $9, 20(sp);
16986 +
16987 +#define ASM_PROLOG7    subu    sp, 32; \
16988 +                                       sw              $8, 16(sp); \
16989 +                                       sw              $9, 20(sp); \
16990 +                                       sw              $10, 24(sp);
16991 +
16992 +#define ASM_EPILOG     addu    sp, 32
16993 +
16994 +#else
16995 +#define ASM_PROLOG
16996 +#define ASM_PROLOG5
16997 +#define ASM_PROLOG6
16998 +#define ASM_PROLOG7
16999 +#define ASM_EPILOG
17000 +#endif
17001 +
17002 +#ifdef DINO    /* Special DSP extensions to MIPS core */
17003 +
17004 +#ifndef        NO_DINO_WRITEBACK       /* DSP extensions with writeback register */
17005 +
17006 +#define        MAD(src1, src2)                 .set    noreorder       ; mad   $0, src1, src2  ; .set  reorder
17007 +#define        MADW(acc, src1, src2)   .set    noreorder       ; mad   acc, src1, src2 ; .set  reorder
17008 +#define        Mult(dst, src1, src2)   .set    noreorder       ; mult  dst, src1, src2 ; .set  reorder 
17009 +#define        MultU(dst, src1, src2)  .set    noreorder       ; multu dst, src1, src2 ; .set  reorder         
17010 +
17011 +#else  /* NO_DINO_WRITEBACK */
17012 +
17013 +#define        MAD(src1, src2)                 .set    noreorder       ; mad   $0, src1, src2  ; .set  reorder
17014 +#define        MADW(acc, src1, src2)   .set    noreorder       ; mad   $0, src1, src2  ; mflo acc ; .set       reorder
17015 +#define        Mult(dst, src1, src2)   multu   src1, src2 ; mflo dst
17016 +#define        MultU(dst, src1, src2)  multu   src1, src2 ; mflo dst           
17017 +
17018 +#endif /* NO_DINO_WRITEBACK */
17019 +
17020 +#else  /* DINO */
17021 +
17022 +#if defined(R3900)
17023 +
17024 +#define        MAD(src1, src2)         madd    $0, src1, src2
17025 +#define        MADW(acc, src1, src2)   madd    acc, src1, src2
17026 +#define        Mult(dst, src1, src2)   mult    dst, src1, src2
17027 +#define        MultU(dst, src1, src2)  multu   dst, src1, src2
17028 +
17029 +#elif defined(bcm47xx_INSTR_MACROS) && defined(bcm47xx)
17030 +
17031 +#define mips_froo(s1,s2,s3)                    s1##s2##s3
17032 +#define        MSUB(s1,s2)                                     .set noreorder ; mips_froo(msub_,s1,s2) ; .set reorder
17033 +#define MAD(s1,s2)                                     .set noreorder ; mips_froo(mad_,s1,s2) ; .set reorder
17034 +#define MADW(acc, s1,s2)                       .set noreorder ; mips_froo(mad_,s1,s2) ; mflo acc ; .set reorder
17035 +
17036 +#include "BCM4710.h"
17037 +
17038 +#define        Mult(dst, src1, src2)           mul             dst, src1, src2
17039 +#define        Mul( src1, src2)                        mult    src1, src2 ; 
17040 +#define        MultU(dst, src1, src2)          multu   src1, src2      ; mflo dst
17041 +
17042 +#elif defined(bcm47xx)
17043 +#define        MSUB(src1, src2)                        msub    src1, src2
17044 +#define        MAD(src1, src2)                 madd    src1, src2
17045 +#define        MADW(acc, src1, src2)   .set noreorder ; madd   src1, src2; mflo acc ; .set reorder
17046 +/*
17047 +#define        Mult(dst, src1, src2)   mult    src1, src2 ; mflo dst
17048 +*/
17049 +#define        Mult(dst, src1, src2)   mul     dst , src1, src2 ; 
17050 +#define        Mul( src1, src2)        mult    src1, src2 ; 
17051 +#define        MultU(dst, src1, src2)  multu   src1, src2 ; mflo dst
17052 +
17053 +#else
17054 +
17055 +#ifdef R4102
17056 +#define        MAD(src1, src2)                 madd16  src1, src2
17057 +#define        MADW(acc, src1, src2)   madd16  src1, src2      ; mflo acc
17058 +#else /* R4102 */
17059 +
17060 +#ifdef R4640
17061 +
17062 +#define        MAD(src1, src2)                 madd    $0, src1, src2
17063 +#define        MADW(acc, src1, src2)   madd    src1, src2; mflo acc
17064 +
17065 +#else /* R4640 */
17066 +
17067 +#ifdef R4010
17068 +
17069 +#define        MAD(src1, src2)                 madd    src1, src2
17070 +#define        MADW(acc, src1, src2)   madd    src1, src2; mflo acc
17071 +
17072 +#else
17073 +#define        MAD(src1, src2)                         .set    noat            ;\
17074 +                                                                       mflo    $at                     ;\
17075 +                                                                       sw              $2,   -4(sp)    ;\
17076 +                                                                       multu   src1, src2      ;\
17077 +                                                                       mflo    $2                      ;\
17078 +                                                                       addu    $at, $2, $at    ;\
17079 +                                                                       lw              $2,   -4(sp)    ;\
17080 +                                                                       mtlo    $at             ;\
17081 +                                                                       .set    at
17082 +
17083 +#define        MADW(acc, src1, src2)           .set    noat            ;\
17084 +                                                                       mflo    $at                     ;\
17085 +                                                                       sw              $2,   -4(sp)    ;\
17086 +                                                                       multu   src1, src2      ;\
17087 +                                                                       mflo    $2                      ;\
17088 +                                                                       addu    $at, $2, $at    ;\
17089 +                                                                       lw              $2,   -4(sp)    ;\
17090 +                                                                       move    acc, $at        ;\
17091 +                                                                       mtlo    $at             ;\
17092 +                                                                       .set    at
17093 +#endif /* R4010 */
17094 +#endif /* R4102 */
17095 +#endif /* R4640 */
17096 +
17097 +#define        Mult(dst, src1, src2)           mul             dst, src1, src2
17098 +#define        MultU(dst, src1, src2)          multu   src1, src2      ; mflo dst
17099 +
17100 +#endif /* !3900 */
17101 +#endif /* DINO */
17102 +
17103 +
17104 +
17105 +
17106 +
17107 +
17108 +
17109 +
17110 +#endif /* _MIPS_ASM_H_ */
17111 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MiscUtil.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MiscUtil.h
17112 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MiscUtil.h        1970-01-01 01:00:00.000000000 +0100
17113 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/MiscUtil.h       2006-06-26 09:07:10.000000000 +0200
17114 @@ -0,0 +1,65 @@
17115 +/*
17116 +<:copyright-broadcom 
17117
17118 + Copyright (c) 2002 Broadcom Corporation 
17119 + All Rights Reserved 
17120 + No portions of this material may be reproduced in any form without the 
17121 + written permission of: 
17122 +          Broadcom Corporation 
17123 +          16215 Alton Parkway 
17124 +          Irvine, California 92619 
17125 + All information contained in this document is Broadcom Corporation 
17126 + company private, proprietary, and trade secret. 
17127
17128 +:>
17129 +*/
17130 +/****************************************************************************
17131 + *
17132 + * MiscUtil.h -- Miscellaneous utilities
17133 + *
17134 + * Description:
17135 + *
17136 + *
17137 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
17138 + * Authors: Mark Gonikberg Haixiang Liang
17139 + *
17140 + * $Revision: 1.4 $
17141 + *
17142 + * $Id: MiscUtil.h,v 1.4 2004/04/13 00:21:46 ilyas Exp $
17143 + *
17144 + * $Log: MiscUtil.h,v $
17145 + * Revision 1.4  2004/04/13 00:21:46  ilyas
17146 + * Added standard header for shared ADSL driver files
17147 + *
17148 + * Revision 1.3  2001/07/21 01:21:06  ilyas
17149 + * Added more functions for int to string conversion used by log file
17150 + *
17151 + * Revision 1.2  1999/08/05 19:42:56  liang
17152 + * Merged with the softmodem top of the tree on 08/04/99 for assembly files.
17153 + *
17154 + * Revision 1.1  1999/01/27 22:10:12  liang
17155 + * Initial version.
17156 + *
17157 + * Revision 1.1  1997/07/10 01:18:45  mwg
17158 + * Initial revision.
17159 + *
17160 + *
17161 + *
17162 + *****************************************************************************/
17163 +#ifndef _MISC_UTIL_H_
17164 +#define _MISC_UTIL_H_
17165 +
17166 +extern long            SM_DECL GetRateValue(dataRateMap rate);
17167 +extern int             SM_DECL DecToString(ulong value, uchar *dstPtr, uint nDigits);
17168 +extern int             SM_DECL HexToString(ulong value, uchar *dstPtr, uint nDigits);
17169 +extern char *  SM_DECL DecToStr(char *s, ulong num);
17170 +extern char *  SM_DECL SignedToStr(char *s, long num);
17171 +extern char *  SM_DECL HexToStr(char *s, ulong num);
17172 +
17173 +#define        EvenParityBit(x)        ((z = (y = x ^ (x >> 4)) ^ (y >> 2)) ^ (z >> 1))
17174 +#define        OddParityBit(x)         (EvenParityBit(x) ^ 1)
17175 +
17176 +extern void    ParityApply(int nBytes, int nDataBits, int parity, uchar *srcPtr, uchar *dstPtr);
17177 +extern void    ParityStrip(int nBytes, int nDataBits, int parity, uchar *srcPtr, uchar *dstPtr, statusHandlerType      statusHandler);
17178 +
17179 +#endif
17180 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Que.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Que.h
17181 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Que.h     1970-01-01 01:00:00.000000000 +0100
17182 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/Que.h    2006-06-26 09:07:10.000000000 +0200
17183 @@ -0,0 +1,106 @@
17184 +/*
17185 +<:copyright-broadcom 
17186
17187 + Copyright (c) 2002 Broadcom Corporation 
17188 + All Rights Reserved 
17189 + No portions of this material may be reproduced in any form without the 
17190 + written permission of: 
17191 +          Broadcom Corporation 
17192 +          16215 Alton Parkway 
17193 +          Irvine, California 92619 
17194 + All information contained in this document is Broadcom Corporation 
17195 + company private, proprietary, and trade secret. 
17196
17197 +:>
17198 +*/
17199 +/****************************************************************************
17200 + *
17201 + * Que.h
17202 + *
17203 + * Description:
17204 + *     Definition and implementation (via macros and inline functions)
17205 + *  of a simple queue
17206 + *
17207 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
17208 + * Authors: Ilya Stomakhin
17209 + *
17210 + *****************************************************************************/
17211 +
17212 +#ifndef        QueHeader_H_
17213 +#define        QueHeader_H_
17214 +
17215 +typedef void *         _QueItem;
17216 +
17217 +typedef struct _QueHeader
17218 +       {
17219 +       _QueItem        *head;          /* first item in the queue */
17220 +       _QueItem        *tail;          /* last item in the queue */
17221 +       } QueHeader;
17222 +
17223 +/* Queue management macros */
17224 +
17225 +#define QueInit(pqHdr)         (((QueHeader *)(pqHdr))->head = ((QueHeader *)(pqHdr))->tail = NULL)
17226 +#define QueEmpty(pqHdr)     (NULL == ((QueHeader *)(pqHdr))->head)
17227 +
17228 +#define QueFirst(pqHdr)                ((QueHeader *)(pqHdr))->head
17229 +#define QueLast(pqHdr)         ((QueHeader *)(pqHdr))->tail 
17230 +#define QueNext(pqItem)                (*((void **)(pqItem)))
17231 +
17232 +
17233 +#define QueRemoveFirst(pqHdr)  do {                                                                            \
17234 +    if (!QueEmpty(pqHdr)) {                                                                                                    \
17235 +      ((QueHeader *)(pqHdr))->head = *((QueHeader *)(pqHdr))->head;                    \
17236 +      if (QueEmpty(pqHdr))                                                                                                     \
17237 +        ((QueHeader *)(pqHdr))->tail = NULL;                                                           \
17238 +    }                                                                                                                                          \
17239 +} while (0)
17240 +#define QueRemove(pqHdr)               QueRemoveFirst(pqHdr)
17241 +
17242 +
17243 +#define QueAddLast(pqHdr,pqItem) do {                                          \
17244 +    QueNext(pqItem) = NULL;                                                                    \
17245 +    if (NULL != ((QueHeader *)(pqHdr))->tail)                          \
17246 +      *((QueHeader *)(pqHdr))->tail = (pqItem);                                \
17247 +    else                                                                                                       \
17248 +      ((QueHeader *)(pqHdr))->head = (_QueItem *)(pqItem);  \
17249 +    ((QueHeader *)(pqHdr))->tail = (_QueItem *)(pqItem);    \
17250 +} while (0)
17251 +#define QueAdd(pqHdr,pItem)    QueAddLast(pqHdr,pItem)
17252 +
17253 +#define QueAddFirst(pqHdr,pqItem)      do {                                    \
17254 +    if (NULL == ((QueHeader *)(pqHdr))->tail)                          \
17255 +         ((QueHeader *)(pqHdr))->tail = (_QueItem *)(pqItem);  \
17256 +    QueNext(pqItem) = ((QueHeader *)(pqHdr))->head;                    \
17257 +    ((QueHeader *)(pqHdr))->head = (_QueItem *)(pqItem);       \
17258 +} while (0)
17259 +
17260 +
17261 +#define QueGet(pqHdr)                  \
17262 +  (void *) QueFirst(pqHdr);            \
17263 +  QueRemove(pqHdr);
17264 +
17265 +#define QueMerge(pqHdr1,pqHdr2)        do {                                                                                    \
17266 +  if (NULL == ((QueHeader *)(pqHdr1))->tail)                                                                   \
17267 +       ((QueHeader *)(pqHdr1))->head = ((QueHeader *)(pqHdr2))->head;                          \
17268 +  else                                                                                                                                                 \
17269 +    QueNext(((QueHeader *)(pqHdr1))->tail) = ((QueHeader *)(pqHdr2))->head;            \
17270 +  if (NULL != ((QueHeader *)(pqHdr2))->tail)                                                   \
17271 +       ((QueHeader *)(pqHdr1))->tail = ((QueHeader *)(pqHdr2))->tail;                          \
17272 +} while (0)
17273 +
17274 +#define QueCopy(pqHdr1,pqHdr2) do {                                                                                    \
17275 +       ((QueHeader *)(pqHdr1))->head = ((QueHeader *)(pqHdr2))->head;                          \
17276 +       ((QueHeader *)(pqHdr1))->tail = ((QueHeader *)(pqHdr2))->tail;                          \
17277 +} while (0)
17278 +
17279 +#define        QueForEach(pqHdr,f,ref)         do {                    \
17280 +       _QueItem        *p = ((QueHeader *)(pqHdr))->head;      \
17281 +                                                                                                       \
17282 +       while (NULL != p) {                                                             \
17283 +         if ( (f)((void *)p, ref) ) break;                             \
17284 +         p = QueNext(p);                                                               \
17285 +       }                                                                                               \
17286 +} while (0)
17287 +
17288 +#endif /* QueHeader_H_ */
17289 +
17290 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftAtmVc.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftAtmVc.h
17291 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftAtmVc.h       1970-01-01 01:00:00.000000000 +0100
17292 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftAtmVc.h      2006-06-26 09:07:10.000000000 +0200
17293 @@ -0,0 +1,569 @@
17294 +/*
17295 +<:copyright-broadcom 
17296
17297 + Copyright (c) 2002 Broadcom Corporation 
17298 + All Rights Reserved 
17299 + No portions of this material may be reproduced in any form without the 
17300 + written permission of: 
17301 +          Broadcom Corporation 
17302 +          16215 Alton Parkway 
17303 +          Irvine, California 92619 
17304 + All information contained in this document is Broadcom Corporation 
17305 + company private, proprietary, and trade secret. 
17306
17307 +:>
17308 +*/
17309 +/****************************************************************************
17310 + *
17311 + * SoftAtmVc.h 
17312 + *
17313 + * Description:
17314 + *     This file contains ATM VC definitions
17315 + *
17316 + *
17317 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
17318 + * Authors: Ilya Stomakhin
17319 + *
17320 + * $Revision: 1.27 $
17321 + *
17322 + * $Id: SoftAtmVc.h,v 1.27 2004/06/02 22:26:17 ilyas Exp $
17323 + *
17324 + * $Log: SoftAtmVc.h,v $
17325 + * Revision 1.27  2004/06/02 22:26:17  ilyas
17326 + * Added ATM counters for G.992.3
17327 + *
17328 + * Revision 1.26  2004/03/10 22:57:20  ilyas
17329 + * Added I.432 scramling control
17330 + *
17331 + * Revision 1.25  2003/09/23 00:21:59  ilyas
17332 + * Added status to indicate ATM header compression
17333 + *
17334 + * Revision 1.24  2003/08/27 02:00:50  ilyas
17335 + * Original implementation of ATM header compression
17336 + *
17337 + * Revision 1.23  2003/02/25 04:13:15  ilyas
17338 + * Added standard Broadcom header
17339 + *
17340 + * Revision 1.22  2003/01/10 23:25:48  ilyas
17341 + * Added ATM status definition
17342 + *
17343 + * Revision 1.21  2002/09/12 21:07:19  ilyas
17344 + * Added HEC, OCD and LCD counters
17345 + *
17346 + * Revision 1.20  2002/04/02 09:58:00  ilyas
17347 + * Initial implementatoin of BERT
17348 + *
17349 + * Revision 1.19  2001/10/09 22:35:14  ilyas
17350 + * Added more ATM statistics and OAM support
17351 + *
17352 + * Revision 1.18  2001/06/18 19:49:36  ilyas
17353 + * Changes to include support for HOST_ONLY mode
17354 + *
17355 + * Revision 1.17  2001/02/23 05:49:57  ilyas
17356 + * Added routed 1483 encapsulation
17357 + *
17358 + * Revision 1.16  2001/02/09 04:18:18  ilyas
17359 + * Added framer for bridged ethernet PDUs
17360 + *
17361 + * Revision 1.15  2001/02/09 01:55:27  ilyas
17362 + * Added status codes and macros to support printing of AAL packets
17363 + *
17364 + * Revision 1.14  2000/09/21 17:28:35  ilyas
17365 + * Added VBR support to traffic management code, separated UBR to a different
17366 + * Tx list, changed some of the algorithms
17367 + *
17368 + * Revision 1.13  2000/08/23 18:42:13  ilyas
17369 + * Added AAL2, added VcConfigure functions, moved commonly used look-up
17370 + * tables for CRC calculation to AtmLayer
17371 + *
17372 + * Revision 1.12  2000/08/02 03:06:22  ilyas
17373 + * Added support for reserving space in RX packets for ATm protocols
17374 + *
17375 + * Revision 1.11  2000/07/28 17:23:39  ilyas
17376 + * Added ATM connect/disconnect statuses
17377 + *
17378 + * Revision 1.10  2000/07/25 02:16:12  ilyas
17379 + * Added EClip (with Eth to ATM ARP translation) implementation
17380 + *
17381 + * Revision 1.9  2000/07/23 20:57:14  ilyas
17382 + * Added ATM framer and protocol layers
17383 + *
17384 + * Revision 1.8  2000/07/17 21:08:16  lkaplan
17385 + * removed global pointer
17386 + *
17387 + * Revision 1.7  2000/06/09 18:33:04  liang
17388 + * Fixed Irix compiler warnings.
17389 + *
17390 + * Revision 1.6  2000/05/18 21:47:31  ilyas
17391 + * Added detection of preassigned cells such as OAM F4, F5
17392 + *
17393 + * Revision 1.5  2000/05/14 01:50:11  ilyas
17394 + * Added more statuses to ATM code
17395 + *
17396 + * Revision 1.4  2000/05/10 02:41:28  liang
17397 + * Added status report for no cell memory
17398 + *
17399 + * Revision 1.3  2000/05/09 23:00:27  ilyas
17400 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
17401 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
17402 + *
17403 + * Revision 1.2  2000/05/03 03:53:00  ilyas
17404 + * Added support for pVc to vcID translation needed for LOG file and other
17405 + * definitions for ATM data in LOG file
17406 + *
17407 + * Revision 1.1  2000/04/19 00:21:35  ilyas
17408 + * Fixed some problems and added Out Of Band (OOB) support to ATM packets
17409 + *
17410 + *
17411 + *****************************************************************************/
17412 +
17413 +#ifndef        SoftAtmVcHeader
17414 +#define        SoftAtmVcHeader
17415 +
17416 +/*
17417 +**
17418 +**             ATM UNI types
17419 +**
17420 +*/
17421 +
17422 +#define AtmLinkFlags(bMap,name)                (((bMap) >> name##Shift) & name##Mask)
17423 +
17424 +/* ATM service category types */
17425 +
17426 +#define        kAtmSrvcCBR             1       /* Constant Bit Rate    */
17427 +#define        kAtmSrvcVBR             2       /* Variable Bit Rate    */
17428 +#define        kAtmSrvcUBR             4       /* Unspecified Bit Rate */
17429 +#define        kAtmSrvcABR             8       /* Available Bit Rate   */
17430 +#define        kAtmSrvcUnknown 0xFF
17431 +
17432 +/* ATM AAL types (as encoded at UNI) */
17433 +
17434 +#define        kAtmAalIE               0x58
17435 +
17436 +#define        kAtmRaw                 0
17437 +#define        kAtmAal1                1
17438 +#define        kAtmAal2                2
17439 +#define        kAtmAal34               3
17440 +#define        kAtmAal5                5
17441 +#define        kAtmAalUser             16
17442 +#define        kAtmAalUnknown  0xFF
17443 +
17444 +/* ATM AAL1 parameters  */
17445 +
17446 +#define        kAal1SubTypeId                  0x85
17447 +
17448 +#define        kAal1TransportShift             0
17449 +#define        kAal1TransportMask              0x7
17450 +
17451 +#define        kAal1NullTransport              0
17452 +#define        kAal1VoiceTransport             1
17453 +#define        kAal1CircuitTransport   2
17454 +#define        kAal1AudioTransport             4
17455 +#define        kAal1VideoTransport             5
17456 +
17457 +
17458 +#define        kAal1CBRId                              0x86
17459 +
17460 +#define        kAal1CBRShift                   24
17461 +#define        kAal1CBRMask                    0xFF
17462 +
17463 +#define        kAal1CBR64                              1
17464 +#define        kAal1CBR1544                    4               /* DS1 */
17465 +#define        kAal1CBR6312                    5               /* DS2 */
17466 +#define        kAal1CBR32064                   6
17467 +#define        kAal1CBR44736                   7               /* DS3 */
17468 +#define        kAal1CBR97728                   8
17469 +#define        kAal1CBR2048                    0x10    /* E1 */
17470 +#define        kAal1CBR8448                    0x11    /* E2 */
17471 +#define        kAal1CBR34368                   0x12    /* E3 */
17472 +#define        kAal1CBR139264                  0x13
17473 +#define        kAal1CBR64xN                    0x40
17474 +#define        kAal1CBR8xN                             0x41
17475 +
17476 +
17477 +#define        kAal1MultiplierId               0x87
17478 +
17479 +#define        kAal1ClockRecoveryId    0x88
17480 +
17481 +#define        kAal1ClockRecoveryShift 3
17482 +#define        kAal1ClockRecoveryMask  0x3
17483 +
17484 +#define        kAal1ClockRecoveryNull  1               /* synchronous transport */
17485 +#define        kAal1ClockRecoverySRTS  1               /* asynchronous transport */
17486 +#define        kAal1ClockRecoveryAdaptive      2
17487 +
17488 +
17489 +#define        kAal1ECMId                              0x89    /* Error correction method */
17490 +
17491 +#define        kAal1ECMShift                   (kAal1ClockRecoveryShift + 2)
17492 +#define        kAal1ECMMask                    0x3
17493 +
17494 +#define        kAal1ECMNull                    0
17495 +#define        kAal1ECMLossSensitive   1
17496 +#define        kAal1ECMDelaySensitive  2
17497 +
17498 +
17499 +#define        kAal1SDTBlockSizeId             0x8A
17500 +
17501 +#define        kAal1CellFillId                 0x8B
17502 +
17503 +/* ATM AAL34 and AAL5 parameters  */
17504 +
17505 +#define        kAalFwdMaxSDUSizeId             0x8C
17506 +#define        kAalBacMaxkSDUSizeId    0x81
17507 +
17508 +#define        kAal34MidRangeId                0x82
17509 +
17510 +#define        kAalSSCSTypeId                  0x84
17511 +
17512 +#define        kAalSSCSAssured                 1
17513 +#define        kAalSSCSNonAssured              2
17514 +#define        kAalSSCSFrameRelay              4
17515 +
17516 +/* ATM AAL2 parameters  */
17517 +
17518 +#define        kAal2SSNone                             0
17519 +#define        kAal2SSSAR                              1
17520 +#define        kAal2SSTED                              2
17521 +#define        kAal2SSSARMask                  3
17522 +#define        kAal2SSType1                    4
17523 +#define        kAal2SSType3                    5
17524 +
17525 +typedef struct {
17526 +  uchar                        aalType;
17527 +  union {
17528 +       struct {
17529 +         bitMap        aal1Flags;
17530 +         ulong         cbrRate;
17531 +         ushort        blkSize;
17532 +         uchar         sarUsed;
17533 +       } aal1Params;
17534 +       struct {
17535 +         ushort        fwdMaxCpSize;                   /* Max "common part" packet size */
17536 +         ushort        backMaxCpSize;
17537 +         ushort        cidLow;
17538 +         ushort        cidHigh;
17539 +         ushort        fwdMaxSsSize;                   /* Max "service specific" packet size */
17540 +         ushort        backMaxSsSize;
17541 +         uchar         sscsType;
17542 +       } aal2Params;
17543 +       struct {
17544 +         ushort        fwdMaxSDUSize;
17545 +         ushort        backMaxSDUSize;
17546 +         ushort        midLow;
17547 +         ushort        midHigh;
17548 +         uchar         sscsType;
17549 +       } aal34Params;
17550 +       struct {
17551 +         ushort        fwdMaxSDUSize;
17552 +         ushort        backMaxSDUSize;
17553 +         uchar         sscsType;
17554 +       } aal5Params;
17555 +  } param;
17556 +} atmAalParams;
17557 +
17558 +/* ATM Traffic Descriptor types (as encoded at UNI) */
17559 +
17560 +#define        kAtmTrafficIE           0x59
17561 +
17562 +#define        kTrafficFwdPeakCellRateId0      0x82
17563 +#define        kTrafficBackPeakCellRateId0     0x83
17564 +#define        kTrafficFwdPeakCellRateId       0x84
17565 +#define        kTrafficBackPeakCellRateId      0x85
17566 +
17567 +#define        kTrafficFwdSustainCellRateId0   0x88
17568 +#define        kTrafficBackSustainCellRateId0  0x89
17569 +#define        kTrafficFwdSustainCellRateId    0x90
17570 +#define        kTrafficBackSustainCellRateId   0x91
17571 +
17572 +#define        kTrafficFwdMaxBurstSizeId0      0xA0
17573 +#define        kTrafficBackMaxBurstSizeId0     0xA1
17574 +#define        kTrafficFwdMaxBurstSizeId       0xB0
17575 +#define        kTrafficBackMaxBurstSizeId      0xB1
17576 +
17577 +#define        kTrafficBestEffortId            0xBE
17578 +#define        kTrafficMgrOptionsId            0xBF
17579 +
17580 +#define        kTrafficMaxTolerance            0x7FFFFFFF
17581 +
17582 +/*     trafficFlags coding */
17583 +
17584 +#define        kTrafficTagFwd                          1
17585 +#define        kTrafficTagBack                         2
17586 +#define        kTrafficBestEffort                      4
17587 +
17588 +typedef struct {
17589 +  ulong                        tPCR0;                                  /* CLP = 0, time between cells in us */
17590 +  ulong                        tPCR;                                   /* CLP = 0+1 */
17591 +  ulong                        tolPCR;                                 /* tolerance for PCR in us */
17592 +
17593 +  ulong                        tSCR0;                                  /* CLP = 0 */
17594 +  ulong                        tSCR;                                   /* CLP = 0+1 */
17595 +  ulong                        tolSCR;                                 /* tolerance for SCR in us */
17596 +
17597 +  uchar                        atmServiceType;                 /* CBR, VBR, UBR, etc. */
17598 +  uchar                        trafficFlags;
17599 +} atmTrafficParams;
17600 +
17601 +/* ATM Broadband Bearer Capabilty (BBC) types (as encoded at UNI) */
17602 +
17603 +#define        kAtmBBCIE                       0x5E
17604 +
17605 +#define        kBBCClassShift          0
17606 +#define        kBBCClassMask           0x1F
17607 +
17608 +#define        kBBCClassA                      0x1
17609 +#define        kBBCClassC                      0x3
17610 +#define        kBBCClassX                      0x10
17611 +
17612 +
17613 +#define        kBBCTrafficShift        (kBBCClassShift + 5)
17614 +#define        kBBCTrafficMask         0x7
17615 +
17616 +#define        kBBCTrafficNull         0
17617 +#define        kBBCTrafficCBR          1
17618 +#define        kBBCTrafficVBR          2
17619 +
17620 +
17621 +#define        kBBCTimingShift         (kBBCTrafficShift + 3)
17622 +#define        kBBCTimingMask          0x3
17623 +
17624 +#define        kBBCTimingNull                  0
17625 +#define        kBBCTimingRequired              1
17626 +#define        kBBCTimingNotRequired   2
17627 +
17628 +
17629 +#define        kBBCClippingShift       (kBBCTimingShift + 2)
17630 +#define        kBBCClippingMask        0x3
17631 +
17632 +#define        kBBCNoClipping          0
17633 +#define        kBBCClippingOk          1
17634 +
17635 +#define        kBBCConnectionShift     (kBBCClippingShift + 2)
17636 +#define        kBBCConnectionMask      0x3
17637 +
17638 +#define        kBBCPoint2Point         0
17639 +#define        kBBCPoint2MPoint        1
17640 +
17641 +/* ATM Broadband High/Low Layer Information (BHLI/BLLI) types (as encoded at UNI) */
17642 +
17643 +#define        kAtmBHLIIE                      0x5D
17644 +#define        kAtmBLLIIE                      0x5F
17645 +
17646 +/* ATM QoS types (as encoded at UNI) */
17647 +
17648 +#define        kAtmQoSIE                       0x5C
17649 +
17650 +#define        kQoSNull                        0
17651 +#define        kQoSClass1                      1
17652 +#define        kQoSClass2                      2
17653 +#define        kQoSClass3                      3
17654 +#define        kQoSClass4                      4
17655 +#define        kQoSReserved            0xFF
17656 +
17657 +typedef struct {
17658 +  uchar                                fwdQoSClass;
17659 +  uchar                                backQoSClass;
17660 +} atmQoSParams;
17661 +
17662 +/* ATM MID definitions (ConfigureHandler) */
17663 +
17664 +#define        kAtmMidEntireVc         ((ulong) -1)
17665 +
17666 +typedef struct {
17667 +  void                         *pUserVc;                       /* VC id from the caller: has to be 1st !!! */
17668 +  ulong                                vci;
17669 +  uchar                                defaultCLP;                     /* default CLP for tx packets on this VC */
17670 +  uchar                                framerId;
17671 +  uchar                                protoId;
17672 +  uchar                                protoRxBytesReserved; /* # bytes reserved by protocol in the beginning of Rx packet */
17673 +  uchar                                protoTxBytesReserved; /* # bytes reserved by protocol in the beginning of Tx packet */
17674 +
17675 +  atmAalParams         aalParams;
17676 +  atmTrafficParams     rxTrafficParams;
17677 +  atmTrafficParams     txTrafficParams;
17678 +  bitMap                       bbcFlags;
17679 +  atmQoSParams         qosParams;
17680 +} atmVcParams;
17681 +
17682 +/*
17683 +**
17684 +**             ATM Out of Band (OOB) packet information
17685 +**
17686 +*/
17687 +
17688 +typedef struct {
17689 +  Boolean                      clp;                            /* Cell Loss Prioroty */
17690 +  uchar                                aalType;
17691 +  union {
17692 +       struct {
17693 +         uchar                 payloadType;
17694 +       } aalRawParams;
17695 +       struct {
17696 +         uchar                 payloadType;
17697 +         ushort                mid;
17698 +       } aal34Params;
17699 +       struct {
17700 +         uchar                 uui;                            /* Uses to user indicator */
17701 +         uchar                 cpi;                            /* common part indicator */
17702 +       } aal5Params;
17703 +  } aalParam;
17704 +} atmOobPacketInfo;
17705 +
17706 +/*
17707 +**
17708 +**             ATM setup bit definition
17709 +**
17710 +*/
17711 +
17712 +#define        kAtmCorrectHecErrors            1
17713 +#define        kCorrectHecErrors                       kAtmCorrectHecErrors
17714 +#define        kAtmPhyHeaderCompression        2
17715 +#define        kAtmPhyNoDataScrambling         4
17716 +
17717 +#define        kAtmTxIdleTimeoutMask   0x6
17718 +#define        kAtmTxIdleNoTimeout             0
17719 +#define        kAtmTxIdleTimeout10s    2
17720 +#define        kAtmTxIdleTimeout30s    4
17721 +#define        kAtmTxIdleTimeout60s    6
17722 +
17723 +/*
17724 +**
17725 +**             ATM framer modes and protocol definitions
17726 +**
17727 +*/
17728 +
17729 +#define        kAtmFramerNone                  0
17730 +#define        kAtmFramerISO                   1
17731 +#define        kAtmFramerIP                    2
17732 +#define        kAtmFramerEth                   3
17733 +#define        kAtmFramerEthWithCRC    4
17734 +
17735 +#define        kAtmProtoNone                   0
17736 +#define        kAtmProtoEClip                  1
17737 +#define kAtmProtoERouted1483   2
17738 +#define        kAtmProtoPPP                    3
17739 +
17740 +
17741 +/*
17742 +**
17743 +**             ATM status codes
17744 +**
17745 +*/
17746 +
17747 +typedef        void (*atmStatusHandler) (void *gDslVars, ulong statusCode, ...);
17748 +
17749 +/* physical layer I.432 */
17750 +
17751 +#define        kAtmStatRxHunt                                  1
17752 +#define        kAtmStatRxPreSync                               2
17753 +#define        kAtmStatRxSync                                  3
17754 +#define        kAtmStatRxPlOamCell                             4
17755 +#define        kAtmStatBertResult                              5
17756 +#define        kAtmStatHec                                             6
17757 +#define        kAtmStatHdrCompr                                7
17758 +#define        kAtmStatCounters                                8
17759 +
17760 +/* ATM layer */
17761 +
17762 +#define        kAtmLayerStatFirst                              100
17763 +#define        kAtmStatRxDiscarded                             100
17764 +#define        kAtmStatTxDelayed                               101
17765 +
17766 +#define        kAtmStatVcCreated                               102
17767 +#define        kAtmStatVcStarted                               103
17768 +#define        kAtmStatVcStopped                               104
17769 +#define        kAtmStatVcDeleted                               105
17770 +
17771 +#define        kAtmStatTimeout                                 106
17772 +#define        kAtmStatNoCellMemory                    107
17773 +#define        kAtmStatPrintCell                               108
17774 +#define kAtmStatInvalidCell                            109
17775 +#define kAtmStatUnassignedCell                 110
17776 +#define kAtmStatOamF4SegmentCell               111
17777 +#define kAtmStatOamF4End2EndCell               112
17778 +#define kAtmStatOamI371Cell                            113
17779 +#define kAtmStatOamF5SegmentCell               114
17780 +#define kAtmStatOamF5End2EndCell               115
17781 +#define kAtmStatReservedCell                   116
17782 +
17783 +#define        kAtmStatConnected                               117
17784 +#define        kAtmStatDisconnected                    118
17785 +
17786 +#define        kAtmStatRxPacket                                119
17787 +#define        kAtmStatTxPacket                                120
17788 +
17789 +#define        kAtmStatOamLoopback                             121
17790 +
17791 +
17792 +typedef struct _atmPhyCounters {
17793 +       ushort                                          id;
17794 +       ushort                                          bertStatus;
17795 +       ulong                                           bertCellTotal;
17796 +       ulong                                           bertCellCnt;
17797 +       ulong                                           bertBitErrors;
17798 +
17799 +       ulong                                           rxHecCnt;
17800 +       ulong                                           rxCellTotal;
17801 +       ulong                                           rxCellData;
17802 +       ulong                                           rxCellDrop;
17803 +} atmPhyCounters;
17804 +
17805 +/* AAL layer */
17806 +
17807 +
17808 +
17809 +/*
17810 +**
17811 +**             ATM log file definitions
17812 +**
17813 +*/
17814 +
17815 +/* ATM log file flags */
17816 +
17817 +#define                kAtmLogFrameFlagMask            3               /* mask */
17818 +
17819 +#define                kAtmLogFrameFlagNone            0               /* nothing */
17820 +#define                kAtmLogFrameFlagNoData          1               /* no data only frame size */
17821 +#define                kAtmLogFrameFlagBinData         2               /* data in binary form */
17822 +#define                kAtmLogFrameFlagTextData        3               /* data in text form */
17823 +
17824 +#define                kAtmLogSendFrameShift           0
17825 +#define                kAtmLogSendFrameNoData          (kAtmLogFrameFlagNoData << kAtmLogSendFrameShift)
17826 +#define                kAtmLogSendFrameBinData         (kAtmLogFrameFlagBinData << kAtmLogSendFrameShift)
17827 +#define                kAtmLogSendFrameTextData        (kAtmLogFrameFlagTextData << kAtmLogSendFrameShift)
17828 +
17829 +#define                kAtmLogRcvFrameShift            2
17830 +#define                kAtmLogRcvFrameNone                     (kAtmLogFrameFlagNone << kAtmLogRcvFrameShift)
17831 +#define                kAtmLogRcvFrameNoData           (kAtmLogFrameFlagNoData << kAtmLogRcvFrameShift)
17832 +#define                kAtmLogRcvFrameBinData          (kAtmLogFrameFlagBinData << kAtmLogRcvFrameShift)
17833 +#define                kAtmLogRcvFrameTextData         (kAtmLogFrameFlagTextData << kAtmLogRcvFrameShift)              
17834 +
17835 +#define                kAtmLogSendCompleteFrameShift   4
17836 +#define                kAtmLogSendCompleteFrameNone    (kAtmLogFrameFlagNone << kAtmLogSendCompleteFrameShift)
17837 +#define                kAtmLogSendCompleteFrameNoData  (kAtmLogFrameFlagNoData << kAtmLogSendCompleteFrameShift)
17838 +
17839 +#define                kAtmLogReturnFrameShift         6
17840 +#define                kAtmLogReturnFrameNoData        (kAtmLogFrameFlagNoData << kAtmLogReturnFrameShift)
17841 +
17842 +#define                kAtmLogCellFlag                         (1 << 8)
17843 +
17844 +/* ATM log codes */
17845 +
17846 +#define                kAtmLogSendFrame                                        1
17847 +#define                kAtmLogRcvFrame                                         2
17848 +#define                kAtmLogSendFrameComplete                        3
17849 +#define                kAtmLogReturnFrame                                      4
17850 +#define                kAtmLogVcAllocate                                       5
17851 +#define                kAtmLogVcFree                                           6
17852 +#define                kAtmLogVcActivate                                       7
17853 +#define                kAtmLogVcDeactivate                                     8
17854 +#define                kAtmLogTimer                                            9
17855 +#define                kAtmLogCell                                                     10
17856 +#define                kAtmLogVcConfigure                                      11
17857 +
17858 +#define                kAtmLogRxCellHeader                                     12
17859 +#define                kAtmLogRxCellData                                       13
17860 +#define                kAtmLogTxCell                                           14
17861 +
17862 +#endif /* SoftAtmVcHeader */
17863 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.gh linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.gh
17864 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.gh        1970-01-01 01:00:00.000000000 +0100
17865 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.gh       2006-06-26 09:07:10.000000000 +0200
17866 @@ -0,0 +1,675 @@
17867 +/****************************************************************************
17868 + *
17869 + * SoftDsl.gh 
17870 + *
17871 + * Description:
17872 + *     This is a header file which defines the type for the DSL
17873 + *     global variable structure.
17874 + *
17875 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
17876 + * Authors: Ilya Stomakhin
17877 + *
17878 + * $Revision: 1.72 $
17879 + *
17880 + * $Id: SoftDsl.gh,v 1.72 2004/04/30 23:05:19 kdu Exp $
17881 + *
17882 + * $Log: SoftDsl.gh,v $
17883 + * Revision 1.72  2004/04/30 23:05:19  kdu
17884 + * Fixed interop issues in TDC lab for TMM.
17885 + *
17886 + * Revision 1.70  2004/04/10 23:30:48  ilyas
17887 + * Defined gloval structure for slow (SDRAM) data
17888 + *
17889 + * Revision 1.69  2004/04/02 18:33:45  gsyu
17890 + * Share MuxFramer buffers with scratch memory
17891 + *
17892 + * Revision 1.68  2004/02/04 20:12:38  linyin
17893 + * Support adsl2plus
17894 + *
17895 + * Revision 1.67  2004/02/03 19:10:37  gsyu
17896 + * Added separated carrierInfo structures for G992P5
17897 + *
17898 + * Revision 1.66  2004/01/26 04:21:06  yongbing
17899 + * Merge changes in ADSL2 branch into Annex A branch
17900 + *
17901 + * Revision 1.65  2004/01/13 19:12:07  gsyu
17902 + * Added two more variables for Double upstream
17903 + *
17904 + * Revision 1.64  2003/12/04 02:10:37  linyin
17905 + * Add a variable for FbmsOL mode
17906 + *
17907 + * Revision 1.63  2003/11/20 00:57:50  yongbing
17908 + * Merge ADSL2 functionalities into Annex A branch
17909 + *
17910 + * Revision 1.62  2003/11/05 01:59:12  liang
17911 + * Add vendor ID code for Infineon.
17912 + *
17913 + * Revision 1.61  2003/08/12 22:59:41  khp
17914 + * - for Haixiang: added support for ADSL_MARGIN_TWEAK_TEST
17915 + *
17916 + * Revision 1.60  2003/08/01 00:08:19  liang
17917 + * Added firmware ID for Samsung ADI 930 DSLAM.
17918 + *
17919 + * Revision 1.59  2003/07/14 14:40:08  khp
17920 + * - AnnexB: added bad SNR2 retrain counter to connectin setup
17921 + *
17922 + * Revision 1.58  2003/06/25 02:40:22  liang
17923 + * Added firmware ID for Annex A UE9000 ADI918 (from Aliant, Canada).
17924 + *
17925 + * Revision 1.57  2003/06/25 00:00:40  ilyas
17926 + * -added firmware IDs for TI 4000C and AC5 (Annex B)
17927 + *
17928 + * Revision 1.56  2003/05/31 01:50:38  khp
17929 + * -add firmware IDs for ECI16 and ECI16A
17930 + *
17931 + * Revision 1.55  2003/03/27 19:30:52  liang
17932 + * Add and initialize new connectionSetup field coVendorFirmwareID under module ADSL_IDENTIFY_VENDOR_FIRMWARE.
17933 + *
17934 + * Revision 1.54  2002/12/13 18:35:48  yongbing
17935 + * Add support for G.992.2 Annex C in start up
17936 + *
17937 + * Revision 1.53  2002/12/06 02:06:33  liang
17938 + * Moved the T1.413 RAck1/RAck2 switching variables to connection setup structure.
17939 + *
17940 + * Revision 1.52  2002/11/26 02:49:46  liang
17941 + * Added variable codingGainDecrement to the connectionSetup structure to solve the C-Rates-RA option failure problem.
17942 + *
17943 + * Revision 1.51  2002/10/20 18:56:16  khp
17944 + * - for linyin:
17945 + *   - #ifdef NEC_NSIF_WORKAROUND:
17946 + *     - add status and fail counter for NSIF
17947 + *
17948 + * Revision 1.50  2002/09/28 02:36:50  yongbing
17949 + * Add retrain in T1.413 with R-Ack1 tone
17950 + *
17951 + * Revision 1.49  2002/09/12 21:07:19  ilyas
17952 + * Added HEC, OCD and LCD counters
17953 + *
17954 + * Revision 1.48  2002/07/19 01:51:35  liang
17955 + * Added vendor ID constant for Alcatel.
17956 + *
17957 + * Revision 1.47  2002/06/27 21:51:08  liang
17958 + * Added xmt and rcv tone selection bitmap in connection setup.
17959 + *
17960 + * Revision 1.46  2002/06/11 20:48:06  liang
17961 + * Added CO vendor ID field to connectionSetup structure.
17962 + *
17963 + * Revision 1.45  2002/06/06 03:05:43  khp
17964 + * -use boolean in connectup setup instead of localCapabilities.features to indicate FBM mode
17965 + *
17966 + * Revision 1.44  2002/03/22 19:38:58  yongbing
17967 + * Modify for co-exist of G994P1 and T1P413
17968 + *
17969 + * Revision 1.43  2002/03/02 00:52:40  ilyas
17970 + * AnnexC delay needs to be long for prototype
17971 + *
17972 + * Revision 1.42  2002/01/19 23:59:17  ilyas
17973 + * Added support for LOG and eye data to ADSL core target
17974 + *
17975 + * Revision 1.41  2002/01/16 19:03:59  ilyas
17976 + * Added HOST_ONLY ifdefs around ADSL core data
17977 + *
17978 + * Revision 1.40  2002/01/14 17:41:04  liang
17979 + * Move xmt & rcv sample buffers to top level.
17980 + *
17981 + * Revision 1.39  2001/12/21 22:45:34  ilyas
17982 + * Added support for ADSL MIB data object
17983 + *
17984 + * Revision 1.38  2001/12/13 02:24:22  ilyas
17985 + * Added G997 (Clear EOC and G997 framer) support
17986 + *
17987 + * Revision 1.37  2001/11/30 05:56:31  liang
17988 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
17989 + *
17990 + * Revision 1.36  2001/10/19 00:12:07  ilyas
17991 + * Added support for frame oriented (no ATM) data link layer
17992 + *
17993 + * Revision 1.29.2.5  2001/10/03 01:44:00  liang
17994 + * Merged with codes from main tree (tag SoftDsl_2_18).
17995 + *
17996 + * Revision 1.29.2.4  2001/08/18 00:00:36  georgep
17997 + * Add variable to store annexC pathDelay
17998 + *
17999 + * Revision 1.29.2.3  2001/08/08 17:33:27  yongbing
18000 + * Merge with tag SoftDsl_2_17
18001 + *
18002 + * Revision 1.35  2001/08/29 02:56:01  ilyas
18003 + * Added tests for flattening/unflatenning command and statuses (dual mode)
18004 + *
18005 + * Revision 1.34  2001/08/28 03:26:32  ilyas
18006 + * Added support for running host and adsl core parts separately ("dual" mode)
18007 + *
18008 + * Revision 1.33  2001/06/18 19:49:36  ilyas
18009 + * Changes to include support for HOST_ONLY mode
18010 + *
18011 + * Revision 1.32  2001/05/18 21:21:44  liang
18012 + * Save the current number of rcv samples to line handler for QProc test.
18013 + *
18014 + * Revision 1.31  2001/04/25 01:20:11  ilyas
18015 + *
18016 + * Don't use DSL frame functions if ATM_LAYER is not defined
18017 + *
18018 + * Revision 1.30  2001/03/25 06:11:20  liang
18019 + * Combined separate loop attenuation status for ATUR & ATUC into one status.
18020 + * Replace separate hardware AGC info status for ATUR & ATUC into hardware AGC
18021 + * request status and hardware AGC obtained status.
18022 + * Use store AGC command to save hardware AGC value instead of returning value
18023 + * from status report.
18024 + *
18025 + * Revision 1.29  2001/03/17 03:00:46  georgep
18026 + * Added agcInfo to connectionSetupStruct
18027 + *
18028 + * Revision 1.28  2001/02/10 03:03:09  ilyas
18029 + * Added one more DslFrame function
18030 + *
18031 + * Revision 1.27  2000/08/31 19:04:24  liang
18032 + * Added scratch buffer structure definition.
18033 + *
18034 + * Revision 1.26  2000/07/23 20:52:52  ilyas
18035 + * Added xxxFrameBufSetAddress() function for ATM framer layers
18036 + * Rearranged linkLayer functions in one structure which is passed as a
18037 + * parameter to xxxLinkLayerInit() function to be set there
18038 + *
18039 + * Revision 1.25  2000/07/18 21:42:25  ilyas
18040 + * Fixed compiler warning about pointer casting
18041 + *
18042 + * Revision 1.24  2000/07/18 21:18:45  ilyas
18043 + * Added GLOBAL_PTR_BIAS feature to utilize full 64K MIPS relative addressing space
18044 + *
18045 + * Revision 1.23  2000/07/18 20:03:24  ilyas
18046 + * Changed DslFrame functions definitions to macros,
18047 + * Removed gDslVars from their parameter list
18048 + *
18049 + * Revision 1.22  2000/07/17 21:08:15  lkaplan
18050 + * removed global pointer
18051 + *
18052 + * Revision 1.21  2000/05/09 23:00:26  ilyas
18053 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
18054 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
18055 + *
18056 + * Revision 1.20  2000/05/03 03:57:04  ilyas
18057 + * Added LOG file support for writing ATM data
18058 + *
18059 + * Revision 1.19  2000/04/19 00:31:47  ilyas
18060 + * Added global SoftDsl functions for Vc, added OOB info functions
18061 + *
18062 + * Revision 1.18  2000/04/13 08:36:22  yura
18063 + * Added SoftDslSetRefData, SoftDslGetRefData functions
18064 + *
18065 + * Revision 1.17  2000/04/13 05:38:54  georgep
18066 + * Added T1p413 "Activation and Acknowledgement" which can substitute G994P1
18067 + *
18068 + * Revision 1.16  2000/04/05 22:30:42  liang
18069 + * Changed function & constant names from G992p2 to G992 for the Main module.
18070 + *
18071 + * Revision 1.15  2000/04/04 04:16:06  liang
18072 + * Merged with SoftDsl_0_03 from old tree.
18073 + *
18074 + * Revision 1.15  2000/04/04 01:47:21  ilyas
18075 + * Implemented abstract dslFrame and dslFrameBuffer objects
18076 + *
18077 + * Revision 1.14  2000/04/01 02:53:33  georgep
18078 + * Added pointer to G992p2Profile inside connectionSetup
18079 + *
18080 + * Revision 1.13  2000/03/18 01:27:56  georgep
18081 + * Changed connectionSetup to include G992p1 Capabilities
18082 + *
18083 + * Revision 1.12  2000/02/29 01:39:05  georgep
18084 + * put variable haveRemoteCapabilities inside connectionSetupStruct
18085 + *
18086 + * Revision 1.11  2000/02/08 00:44:36  liang
18087 + * Fix the gDslVars definition for Irix environment.
18088 + *
18089 + * Revision 1.10  1999/11/19 00:59:29  george
18090 + * Define physicalLayerVars as a union
18091 + *
18092 + * Revision 1.9  1999/11/11 19:19:42  george
18093 + * Porting to 16Bit Compiler
18094 + *
18095 + * Revision 1.8  1999/11/09 20:26:17  george
18096 + * Added G992P2_PROFILE to modules list
18097 + *
18098 + * Revision 1.7  1999/10/27 23:01:54  wan
18099 + * Add G.994.1 setup in dslConnectionSetupStruct for setting up Initiation side
18100 + *
18101 + * Revision 1.6  1999/08/12 21:16:27  george
18102 + * Move profileVars definition to G992p2/G992p2Profile.gh
18103 + *
18104 + * Revision 1.5  1999/08/10 18:20:43  george
18105 + * Define fastRetrainVars
18106 + *
18107 + * Revision 1.4  1999/07/16 02:03:02  liang
18108 + * Added Tx & Rx data handler function pointers.
18109 + *
18110 + * Revision 1.3  1999/07/03 01:40:15  liang
18111 + * Redefined dsl command parameter list and added connection setup struct.
18112 + *
18113 + * Revision 1.2  1999/02/10 01:56:37  liang
18114 + * Added hooks for G994.1 and G992.2.
18115 + *
18116 + *
18117 + *****************************************************************************/
18118 +
18119 +#ifndef        SoftDslGlobals
18120 +#define        SoftDslGlobals
18121 +
18122 +#include "SoftDsl.h"
18123 +
18124 +#ifdef G992P2_PROFILE
18125 +#include "G992p2Profile.gh"
18126 +#endif
18127 +
18128 +typedef enum
18129 +       {
18130 +       kVendorUnknown = 0,
18131 +       kVendorBroadcom,
18132 +       kVendorGlobespan,
18133 +       kVendorADI,
18134 +       kVendorTI,
18135 +       kVendorCentillium,
18136 +       kVendorAlcatel,
18137 +       kVendorInfineon
18138 +       } VendorIDType;
18139 +
18140 +#define        kDslVendorFirwareUnknown        0
18141 +typedef        enum
18142 +       {
18143 +       kVendorADI_Anaconda = 1,
18144 +       kVendorADI_ECI918,
18145 +       kVendorADI_ECI930,
18146 +       kVendorADI_Cisco,
18147 +       kVendorADI_UE9000_918,
18148 +       kVendorADI_Samsung_930,
18149 +       kVendorTI_4000C_ERICSSON_350,
18150 +       kVendorTI_4000C_SEIMENS,
18151 +       kVendorADI_ECI16_AnnexB = 50,           /* leave space for more Annex A types */
18152 +       kVendorADI_ECI16A_AnnexB,
18153 +       kVendorTI_4000C_AnnexB,
18154 +       kVendorTI_AC5_AnnexB
18155 +       } VendorFirmwareIDType;
18156 +
18157 +#define        kDslXmtToneSelectionStartTone           0
18158 +#ifdef G992P1_ANNEX_B
18159 +#define        kDslXmtToneSelectionEndTone                     63
18160 +#else
18161 +#define        kDslXmtToneSelectionEndTone                     31
18162 +#endif
18163 +#define        kDslXmtToneSelectionNumOfTones          (kDslXmtToneSelectionEndTone-kDslXmtToneSelectionStartTone+1)
18164 +#define        kDslXmtToneSelectionNumOfBytes          ((kDslXmtToneSelectionNumOfTones+7)/8)
18165 +#define        kDslRcvToneSelectionStartTone           32
18166 +#define        kDslRcvToneSelectionEndTone                     255
18167 +#define        kDslRcvToneSelectionNumOfTones          (kDslRcvToneSelectionEndTone-kDslRcvToneSelectionStartTone+1)
18168 +#define        kDslRcvToneSelectionNumOfBytes          ((kDslRcvToneSelectionNumOfTones+7)/8)
18169 +
18170 +#define        kDslT1p413RAckModeTryRAck1                              0x01
18171 +#define        kDslT1p413RAckModeTryRAck2                              0x02
18172 +#define        kDslT1p413RAckModeTrialMask                             0x0F
18173 +#define        kDslT1p413RAckModeSelected                              0x10
18174 +#define        kDslT1p413RAckModeTrialCount                    10              /* when in trial mode */
18175 +#define        kDslT1p413RAckModeSwitchCount                   20              /* when mode is selected */
18176 +
18177 +#ifdef ADSL_MARGIN_TWEAK_TEST
18178 +#define        kDslMarginTweakNumOfTones                               256
18179 +#endif
18180 +
18181 +typedef struct
18182 +       {
18183 +       Boolean                         haveRemoteCapabilities;         
18184 +       dslModulationType                               selectedModulation;
18185 +       dslModulationType                               startupModulation;
18186 +#if defined(G992P1_ANNEX_I) || defined(G992P5)
18187 +       ushort                                                  downstreamMinCarr, downstreamMaxCarr;
18188 +#else
18189 +       uchar                                                   downstreamMinCarr, downstreamMaxCarr;
18190 +#endif
18191 +       uchar                                                   upstreamMinCarr, upstreamMaxCarr;
18192 +#if defined(DOUBLE_UP_STREAM)                                                  
18193 +    Boolean                         isDoubleUsEnabled;
18194 +    short                           selectedPilotTone;
18195 +#endif
18196 +       dslDataPumpCapabilities                 localCapabilities, remoteCapabilities;
18197 +#ifdef G992P3
18198 +       g992p3DataPumpCapabilities              localCarrierInfoG992p3AnnexA;
18199 +       g992p3DataPumpCapabilities              remoteCarrierInfoG992p3AnnexA;
18200 +       g992p3DataPumpCapabilities              selectedCarrierInfoG992p3AnnexA;
18201 +       uchar                                                   xmtG992p3State;
18202 +#ifdef G992P5
18203 +       g992p3DataPumpCapabilities              localCarrierInfoG992p5AnnexA;
18204 +       g992p3DataPumpCapabilities              remoteCarrierInfoG992p5AnnexA;
18205 +       g992p3DataPumpCapabilities              selectedCarrierInfoG992p5AnnexA;
18206 +#endif  /* G992P5 */
18207 +#endif  /* G992P3 */
18208 +       uchar                                                   handshakingDuplexMode;
18209 +       Boolean                                                 handshakingClientInitiation;
18210 +       short                                                   handshakingXmtPowerLevel;
18211 +       uchar                                                   handshakingXmtCarrierSet;
18212 +       short                                                   hwAgcQ4dB;      /* for loop attenuation calculation */
18213 +       uchar                                                   coVendorID;
18214 +#ifdef ADSL_IDENTIFY_VENDOR_FIRMWARE
18215 +       uchar                                                   coVendorFirmwareID;
18216 +#endif
18217 +       uchar                                                   codingGainDecrement;    /* coding gain decrement in Q4dB for initial rate calculation */
18218 +       uchar                                                   xmtToneSelection[kDslXmtToneSelectionNumOfBytes];
18219 +       uchar                                                   rcvToneSelection[kDslRcvToneSelectionNumOfBytes];
18220 +#ifdef G992_ANNEXC     
18221 +       Boolean                                                 isFbmMode;
18222 +       Boolean                                                 isFbmsOLMode;
18223 +       long                                                    xmtToRcvPathDelay;
18224 +#endif 
18225 +#if defined(T1P413) && defined(XMT_RACT2_FOR_ADI_COMPATIBILITY)
18226 +       uchar                                                   t1p413RAckModeUsed;
18227 +       uchar                                                   t1p413RAckModeCounter;
18228 +#endif
18229 +#ifdef G992P1_ANNEX_B
18230 +       uchar                                                   badSNR2RetrainCounter;
18231 +#endif
18232 +#ifdef ADSL_MARGIN_TWEAK_TEST
18233 +       short                                                   marginTweakExtraPowerQ4dB;
18234 +       char                                                    marginTweakTableQ4dB[kDslMarginTweakNumOfTones];
18235 +#endif
18236 +#ifdef G992P2_PROFILE  
18237 +       G992p2ProfileVarsStruct*                profileVarsPtr;
18238 +#endif
18239 +#ifdef TDC_IOP_FIX_SEIMENS_TI
18240 +       char                                    t1p413RetrainCounter;           /* 0: no retrain needed; 1: force to T1.413 mode and retrain after R-MSG1; 2: 2nd T1.413 session, go to showtime */
18241 +#endif
18242 +#ifdef ANSI_CACT12_PING_PONG
18243 +    char t1p413SkipToneIndex; /* to alternate between CAct1 and CAct2 detection */
18244 +#endif
18245 +       } dslConnectionSetupStruct;
18246 +
18247 +#ifdef ADSL_FRAMER
18248 +#include "MuxFramer.gh"
18249 +#endif
18250 +
18251 +#ifdef ATM
18252 +#include "SoftAtm.gh"
18253 +#endif
18254 +
18255 +#ifdef DSL_PACKET
18256 +#include "DslPacket.gh"
18257 +#endif
18258 +
18259 +#ifdef G997_1_FRAMER
18260 +#include "G997.gh"
18261 +#ifdef G992P3
18262 +#include "G992p3OvhMsg.gh"
18263 +#endif
18264 +#endif
18265 +
18266 +#ifdef ADSL_MIB
18267 +#include "AdslMib.gh"
18268 +#endif
18269 +
18270 +#ifndef HOST_ONLY
18271 +#ifdef T1P413
18272 +#include "T1p413Main.gh"
18273 +#endif
18274 +
18275 +#ifdef G994P1
18276 +#include "G994p1Main.gh"
18277 +#endif
18278 +
18279 +#ifdef G992
18280 +#include "G992Main.gh"
18281 +#endif
18282 +
18283 +#include "SoftDslSampleBuffers.gh"
18284 +#endif
18285 +
18286 +typedef struct __dslSlowVarsStruct
18287 +       {
18288 +       int                                                             tmp;
18289 +       }
18290 +        dslSlowVarsStruct;
18291 +
18292 +typedef struct __dslVarsStruct
18293 +       {
18294 +       bitMap                                                  setup;
18295 +       eyeHandlerType                                  eyeHandlerPtr;
18296 +       logHandlerType                                  logHandlerPtr;
18297 +       dslDriverCallbackType                   driverCallback;
18298 +
18299 +       rcvHandlerType                                  rcvHandlerPtr;
18300 +       xmtHandlerType                                  xmtHandlerPtr;
18301 +
18302 +#ifndef ADSLCORE_ONLY
18303 +       dslCommandHandlerType                   adslCoreCommandHandlerPtr;
18304 +#endif
18305 +       dslCommandHandlerType                   dataPumpCommandHandlerPtr;
18306 +
18307 +       dslStatusHandlerType                    internalStatusHandlerPtr;
18308 +       dslStatusHandlerType                    externalStatusHandlerPtr;
18309 +#ifndef ADSLCORE_ONLY
18310 +       dslStatusHandlerType                    externalLinkLayerStatusHandlerPtr;
18311 +#endif
18312 +
18313 +       dslDirectionType                                direction;
18314 +       dslConnectionSetupStruct                connectionSetup;
18315 +
18316 +#ifdef NEC_NSIF_WORKAROUND
18317 +       uchar                                   G994NsStatus;
18318 +       uchar                                   G994NsFailCounter;
18319 +#endif
18320 +
18321 +       dslFrameHandlerType                             rxIndicateHandlerPtr;
18322 +       dslFrameHandlerType                             txCompleteHandlerPtr;
18323 +
18324 +       linkLayerFunctions                              LinkLayerFunctions;
18325 +       dslSlowVarsStruct                               *dslSlowVars;
18326 +
18327 +#ifdef DSL_FRAME_FUNCTIONS
18328 +       dslFrameFunctions                               DslFrameFunctions;
18329 +#endif
18330 +       ulong                                                   refData;
18331 +       ulong                                                   execTime;
18332 +       int                                                             currRcvNSamps;
18333 +
18334 +#ifndef HOST_ONLY
18335 +       DslSampleBuffersStruct                  sampleBuffersVars;
18336 +
18337 +#ifdef G992P2_PROFILE
18338 +       G992p2ProfileVarsStruct                 G992p2ProfileVars;
18339 +#endif
18340 +                       
18341 +#ifdef ADSL_FRAMER
18342 +       muxFramerVarsStruct                             muxFramerVars;
18343 +#endif
18344 +#endif /* HOST_ONLY */
18345 +
18346 +#ifdef DSL_LINKLAYER
18347 +       union
18348 +               {
18349 +#ifdef ATM
18350 +               atmVarsStruct                           atmVars;
18351 +#endif
18352 +#ifdef DSL_PACKET
18353 +               dslPacketVarsStruct                     dslPacketVars;
18354 +#endif
18355 +               } linkLayerVars;
18356 +#endif
18357 +
18358 +#ifdef G997_1_FRAMER
18359 +       g997VarsStruct                                  G997Vars;
18360 +#ifdef G992P3
18361 +       g992p3OvhMsgVarsStruct                  G992p3OvhMsgVars;
18362 +#endif
18363 +#endif
18364 +
18365 +#ifdef ADSL_MIB
18366 +       adslMibVarsStruct                               adslMibVars;
18367 +#endif
18368 +
18369 +#ifndef HOST_ONLY
18370 +       union
18371 +               {
18372 +#ifdef T1P413
18373 +               T1p413VarsStruct                        T1p413Vars;             
18374 +#endif         
18375 +#ifdef G994P1
18376 +               G994p1VarsStruct                        G994p1Vars;                     
18377 +#endif
18378 +#ifdef G992
18379 +               G992VarsStruct                          G992Vars;
18380 +#endif
18381 +               } physicalLayerVars;
18382 +       union
18383 +               {
18384 +#ifdef G992
18385 +               G992ScratchVarsStruct           G992ScratchVars;
18386 +#endif
18387 +#if defined(ADSL_FRAMER) && defined(SHARE_MUX_FRAMER_VARS)
18388 +        muxFramerSharedVarsStruct      muxFramerSharedVars;
18389 +#endif
18390 +               } scratchVars;
18391 +#endif /* HOST_ONLY */
18392 +
18393 +       }
18394 +        dslVarsStruct;
18395 +
18396 +#ifndef GLOBAL_PTR_BIAS
18397 +#define        gDslGlobalVarPtr                        ((struct __dslVarsStruct *)gDslVars)
18398 +#define        gDslGlobalSlowVarPtr            (gDslGlobalVarPtr->dslSlowVars)
18399 +#else
18400 +#define        gDslGlobalVarPtr                        ((struct __dslVarsStruct *) (void*)((uchar*)(gDslVars) - GLOBAL_PTR_BIAS))
18401 +#define        gDslGlobalSlowVarPtr            ((struct __dslSlowVarsStruct *) (void*)((uchar*)(gDslGlobalVarPtr->dslSlowVars) - GLOBAL_PTR_BIAS))
18402 +#endif
18403 +
18404 +#define        gDslSampleBuffersVars           (gDslGlobalVarPtr->sampleBuffersVars)
18405 +
18406 +#define        gDslMuxFramerVars                       (gDslGlobalVarPtr->muxFramerVars)
18407 +#define        gDslMuxFramerSharedVars         (gDslGlobalVarPtr->scratchVars.muxFramerSharedVars)
18408 +#define        gDslLinkLayerVars                       (gDslGlobalVarPtr->linkLayerVars)
18409 +#define        gDslAtmVars                                     (gDslGlobalVarPtr->linkLayerVars.atmVars)
18410 +#define        gDslPacketVars                          (gDslGlobalVarPtr->linkLayerVars.dslPacketVars)
18411 +#define        gG997Vars                                       (gDslGlobalVarPtr->G997Vars)
18412 +
18413 +#ifdef G992P3
18414 +#define        gG992p3OvhMsgVars                       (gDslGlobalVarPtr->G992p3OvhMsgVars)
18415 +#endif
18416 +
18417 +#define        gAdslMibVars                            (gDslGlobalVarPtr->adslMibVars)
18418 +
18419 +#define        gT1p413Vars                                     (gDslGlobalVarPtr->physicalLayerVars.T1p413Vars)
18420 +#define        gG994p1Vars                                     (gDslGlobalVarPtr->physicalLayerVars.G994p1Vars)
18421 +#define        gG992Vars                                       (gDslGlobalVarPtr->physicalLayerVars.G992Vars)
18422 +#define gG992p2ProfileVars                     (gDslGlobalVarPtr->G992p2ProfileVars)
18423 +
18424 +#define        gG992ScratchVars                        (gDslGlobalVarPtr->scratchVars.G992ScratchVars)
18425 +
18426 +#ifndef gEyeHandlerPtr
18427 +#define        gEyeHandlerPtr                          (gDslGlobalVarPtr->eyeHandlerPtr)
18428 +#endif
18429 +
18430 +#ifndef gLogHandlerPtr
18431 +#define        gLogHandlerPtr                          (gDslGlobalVarPtr->logHandlerPtr)
18432 +#endif
18433 +
18434 +#ifdef VP_SIMULATOR
18435 +#define        gDriverCallback(x)                      (gDslGlobalVarPtr->driverCallback)(x)
18436 +#else
18437 +#define        gDriverCallback(x)
18438 +#endif
18439 +
18440 +/*
18441 +**
18442 +**             Frame functions callouts
18443 +**
18444 +*/
18445 +
18446 +#define        gDslFrameFunc                           (gDslGlobalVarPtr->DslFrameFunctions)
18447 +
18448 +#define        DslFrameBufferGetLength(gDslVars, fb) \
18449 +       gDslFrameFunc.__DslFrameBufferGetLength(fb)
18450 +
18451 +#define DslFrameBufferGetAddress(gDslVars, fb) \
18452 +       gDslFrameFunc.__DslFrameBufferGetAddress(fb)
18453 +
18454 +#define DslFrameBufferSetLength(gDslVars, fb, l) \
18455 +       gDslFrameFunc.__DslFrameBufferSetLength(fb, l)
18456 +
18457 +#define DslFrameBufferSetAddress(gDslVars, fb, p) \
18458 +       gDslFrameFunc.__DslFrameBufferSetAddress(fb, p)
18459 +
18460 +#define DslFrameInit(gDslVars, f) \
18461 +       gDslFrameFunc.__DslFrameInit(f)
18462 +
18463 +#define DslFrameGetLength(gDslVars, pFrame) \
18464 +       gDslFrameFunc.__DslFrameGetLength(pFrame)
18465 +
18466 +#define DslFrameGetBufCnt(gDslVars, pFrame) \
18467 +       gDslFrameFunc.__DslFrameGetBufCnt(pFrame)
18468 +
18469 +#define DslFrameGetFirstBuffer(gDslVars, pFrame) \
18470 +       gDslFrameFunc.__DslFrameGetFirstBuffer(pFrame)
18471 +
18472 +#define DslFrameGetNextBuffer(gDslVars, pFrBuffer) \
18473 +       gDslFrameFunc.__DslFrameGetNextBuffer(pFrBuffer)
18474 +
18475 +#define DslFrameSetNextBuffer(gDslVars, pFrBuf, pFrBufNext) \
18476 +       gDslFrameFunc.__DslFrameSetNextBuffer(pFrBuf, pFrBufNext)
18477 +
18478 +#define DslFrameGetLastBuffer(gDslVars, pFrame) \
18479 +       gDslFrameFunc.__DslFrameGetLastBuffer(pFrame)
18480 +
18481 +#define DslFrameGetLinkFieldAddress(gDslVars, f) \
18482 +       gDslFrameFunc.__DslFrameGetLinkFieldAddress(f)
18483 +
18484 +#define DslFrameGetFrameAddressFromLink(gDslVars, lnk) \
18485 +       gDslFrameFunc.__DslFrameGetFrameAddressFromLink(lnk)
18486 +
18487 +
18488 +#define DslFrameGetOobInfo(gDslVars, f, pOobInfo) \
18489 +       gDslFrameFunc.__DslFrameGetOobInfo(f, pOobInfo)
18490 +
18491 +#define DslFrameSetOobInfo(gDslVars, f, pOobInfo) \
18492 +       gDslFrameFunc.__DslFrameSetOobInfo(f, pOobInfo)
18493 +
18494 +
18495 +#define DslFrameEnqueBufferAtBack(gDslVars, f, b) \
18496 +       gDslFrameFunc.__DslFrameEnqueBufferAtBack(f, b)
18497 +
18498 +#define DslFrameEnqueFrameAtBack(gDslVars, fMain, f) \
18499 +       gDslFrameFunc.__DslFrameEnqueFrameAtBack(fMain, f)
18500 +
18501 +#define DslFrameEnqueBufferAtFront(gDslVars, f, b) \
18502 +       gDslFrameFunc.__DslFrameEnqueBufferAtFront(f, b)
18503 +
18504 +#define DslFrameEnqueFrameAtFront(gDslVars, fMain, f) \
18505 +       gDslFrameFunc.__DslFrameEnqueFrameAtFront(fMain, f)
18506 +
18507 +#define DslFrameDequeBuffer(gDslVars, pFrame) \
18508 +       gDslFrameFunc.__DslFrameDequeBuffer(pFrame)
18509 +
18510 +#define DslFrameAllocMemForFrames(gDslVars, frameNum) \
18511 +       gDslFrameFunc.__DslFrameAllocMemForFrames(frameNum)
18512 +
18513 +#define DslFrameFreeMemForFrames(gDslVars, hMem) \
18514 +       gDslFrameFunc.__DslFrameFreeMemForFrames(hMem)
18515 +
18516 +#define DslFrameAllocFrame(gDslVars, handle) \
18517 +       gDslFrameFunc.__DslFrameAllocFrame(handle)
18518 +
18519 +#define DslFrameFreeFrame(gDslVars, handle, pFrame) \
18520 +       gDslFrameFunc.__DslFrameFreeFrame(handle, pFrame)
18521 +
18522 +#define DslFrameAllocMemForBuffers(gDslVars, ppMemPool, bufNum, memSize) \
18523 +       gDslFrameFunc.__DslFrameAllocMemForBuffers(ppMemPool, bufNum, memSize)
18524 +
18525 +#define DslFrameFreeMemForBuffers(gDslVars, hMem, memSize, pMemPool) \
18526 +       gDslFrameFunc.__DslFrameFreeMemForBuffers(hMem, memSize, pMemPool)
18527 +
18528 +#define DslFrameAllocBuffer(gDslVars, handle, pMem, length) \
18529 +       gDslFrameFunc.__DslFrameAllocBuffer(handle, pMem, length)
18530 +
18531 +#define DslFrameFreeBuffer(gDslVars, handle, pBuf) \
18532 +       gDslFrameFunc.__DslFrameFreeBuffer(handle, pBuf)
18533 +
18534 +#define DslFrame2Id(gDslVars, handle, pFrame) \
18535 +       gDslFrameFunc.__DslFrame2Id(handle, pFrame)
18536 +
18537 +#define DslFrameId2Frame(gDslVars, handle, frameId) \
18538 +       gDslFrameFunc.__DslFrameId2Frame (handle, frameId)
18539 +
18540 +
18541 +#endif /* SoftDslGlobals */
18542 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.h
18543 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.h 1970-01-01 01:00:00.000000000 +0100
18544 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftDsl.h        2006-06-26 09:07:10.000000000 +0200
18545 @@ -0,0 +1,2920 @@
18546 +/****************************************************************************
18547 + *
18548 + * SoftDsl.h 
18549 + *
18550 + *
18551 + * Description:
18552 + *     This file contains the exported interface for SoftDsl.c
18553 + *
18554 + *
18555 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
18556 + * Authors: Ilya Stomakhin
18557 + *
18558 + * $Revision: 1.275 $
18559 + *
18560 + * $Id: SoftDsl.h,v 1.275 2005/04/28 22:55:36 ilyas Exp $
18561 + *
18562 + * $Log: SoftDsl.h,v $
18563 + * Revision 1.275  2005/04/28 22:55:36  ilyas
18564 + * Cleaned up kDslG992RunAnnexaP3ModeInAnnexaP5, kG992EnableAnnexM and kDslAtuChangeTxFilterRequest definitions
18565 + *
18566 + * Revision 1.274  2005/04/27 20:57:32  yongbing
18567 + * Implement 32 frequency break points for TSSI, PR 30211
18568 + *
18569 + * Revision 1.273  2005/04/02 03:27:52  kdu
18570 + * PR30236: Define kDslEnableRoundUpDSLoopAttn, this is shared with kDslCentilliumCRCWorkAroundEnabled.
18571 + *
18572 + * Revision 1.272  2005/04/01 21:56:39  ilyas
18573 + * Added more test commands definitions
18574 + *
18575 + * Revision 1.271  2005/02/11 05:03:57  ilyas
18576 + * Added support for DslOs
18577 + *
18578 + * Revision 1.270  2005/02/11 03:33:22  lke
18579 + * Support 2X, 4X, and 8X spectrum in ANNEX_I DS
18580 + *
18581 + * Revision 1.269  2005/01/08 00:11:58  ilyas
18582 + * Added definition for AnnexL status
18583 + *
18584 + * Revision 1.268  2004/12/18 00:52:35  mprahlad
18585 + * Add Dig US Pwr cutback status
18586 + *
18587 + * Revision 1.267  2004/11/08 22:21:38  ytan
18588 + * init swap state after retrain
18589 + *
18590 + * Revision 1.266  2004/11/05 21:16:50  ilyas
18591 + * Added support for pwmSyncClock
18592 + *
18593 + * Revision 1.265  2004/10/28 20:05:17  gsyu
18594 + * Fixed compilation errors for simulation targets
18595 + *
18596 + * Revision 1.264  2004/10/23 00:16:35  nino
18597 + * Added kDslHardwareSetRcvAGC status to set absolute rcv agc gain.
18598 + *
18599 + * Revision 1.263  2004/10/22 21:21:06  ilyas
18600 + * Fixed bit definition overlap in demodCapabilities
18601 + *
18602 + * Revision 1.262  2004/10/20 00:43:20  gsyu
18603 + * Added constants to support new xmt sample buffer control scheme
18604 + *
18605 + * Revision 1.261  2004/10/12 01:09:28  nino
18606 + * Remove kDslHardwareEnablePwmSyncClk and kDslHardwareSetPwmSyncClkFreq
18607 + * status definitions. Add kDslEnablePwmSyncClk and kDslSetPwmSyncClkFreq
18608 + * command definitions.
18609 + *
18610 + * Revision 1.260  2004/10/11 20:21:26  nino
18611 + * Added kDslHardwareEnablePwmSyncClk and kDslHardwareSetPwmSynClkFreq hardware statuses.
18612 + *
18613 + * Revision 1.259  2004/10/07 19:17:29  nino
18614 + * Added kDslHardwareGetRcvAGC status.
18615 + *
18616 + * Revision 1.258  2004/10/02 00:17:14  nino
18617 + * Added kDslHardwareAGCSetPga2 and kDslSetPilotEyeDisplay status definitions.
18618 + *
18619 + * Revision 1.257  2004/08/27 01:00:30  mprahlad
18620 + *
18621 + * Keep kDslAtuChangeTxFilterRequest defined by default so ADSL1 only targets can
18622 + * build
18623 + *
18624 + * Revision 1.256  2004/08/20 19:00:34  ilyas
18625 + * Added power management code for 2+
18626 + *
18627 + * Revision 1.255  2004/08/17 23:18:25  kdu
18628 + * Merged interop changes for TDC lab from a023e9.
18629 + *
18630 + * Revision 1.254  2004/07/22 00:56:03  yongbing
18631 + * Add ADSL2 Annex B modulation definition
18632 + *
18633 + * Revision 1.253  2004/07/16 22:23:28  nino
18634 + * - Defined macros to extract subcarrier and supported set information
18635 + *   for tssi. Subcarrier and suported set indicator is packed into
18636 + *   dsSubcarrier index array.
18637 + *
18638 + * Revision 1.252  2004/07/01 00:11:22  nino
18639 + * Added preliminary code for debugDataHandler (inside of #if DEBUG_DATA_HANDLER).
18640 + *
18641 + * Revision 1.251  2004/06/24 03:08:39  ilyas
18642 + * Added GFC mapping control for ATM bonding
18643 + *
18644 + * Revision 1.250  2004/06/23 00:03:20  khp
18645 + * - shorten self test result register length to 1 (satisfied requirement
18646 + *   at DT, no known requirement anywhere else)
18647 + *
18648 + * Revision 1.249  2004/06/15 20:18:33  ilyas
18649 + * Made D uchar again for compatibility with older ADSl drivers that use this structure. ADSL driver will rely on G992p3 parameters for large D
18650 + *
18651 + * Revision 1.248  2004/06/12 00:26:03  gsyu
18652 + * Added constants for AnnexM
18653 + *
18654 + * Revision 1.247  2004/06/10 18:53:24  yjchen
18655 + * add large D support
18656 + *
18657 + * Revision 1.246  2004/06/04 01:55:00  linyin
18658 + * Add a constant for SRA enable/disable
18659 + *
18660 + * Revision 1.245  2004/05/19 23:22:23  linyin
18661 + * Support L2
18662 + *
18663 + * Revision 1.244  2004/05/15 03:04:58  ilyas
18664 + * Added L3 test definition
18665 + *
18666 + * Revision 1.243  2004/05/14 03:04:38  ilyas
18667 + * Fixed structure name typo
18668 + *
18669 + * Revision 1.242  2004/05/14 02:01:01  ilyas
18670 + * Fixed structure name typo
18671 + *
18672 + * Revision 1.241  2004/05/14 01:21:49  nino
18673 + * Added kDslSignalAttenuation, kDslAttainableNetDataRate kDslHLinScale constant definitions.
18674 + *
18675 + * Revision 1.240  2004/05/13 19:07:58  ilyas
18676 + * Added new statuses for ADSL2
18677 + *
18678 + * Revision 1.239  2004/05/01 01:09:51  ilyas
18679 + * Added power management command and statuses
18680 + *
18681 + * Revision 1.238  2004/04/23 22:50:38  ilyas
18682 + * Implemented double buffering to ensure G.997 HDLC frame (OvhMsg) is continuous
18683 + *
18684 + * Revision 1.237  2004/03/31 18:57:39  ilyas
18685 + * Added drop on data error capability control
18686 + *
18687 + * Revision 1.236  2004/03/30 03:11:30  ilyas
18688 + * Added #ifdef for CFE build
18689 + *
18690 + * Revision 1.235  2004/03/29 23:06:39  ilyas
18691 + * Added status for BG table update
18692 + *
18693 + * Revision 1.234  2004/03/17 02:49:49  ilyas
18694 + * Turn off ATM bit reversal for Alcatel DSLAM only
18695 + *
18696 + * Revision 1.233  2004/03/11 03:09:48  mprahlad
18697 + * Add test mode for afeloopback test
18698 + *
18699 + * Revision 1.232  2004/03/10 23:15:53  ilyas
18700 + * Added ETSI modem support
18701 + *
18702 + * Revision 1.231  2004/03/04 19:28:14  linyin
18703 + * Support adsl2plus
18704 + *
18705 + * Revision 1.230  2004/02/28 00:06:21  ilyas
18706 + * Added OLR message definitions for ADSL2+
18707 + *
18708 + * Revision 1.229  2004/02/13 03:21:15  mprahlad
18709 + * define kDslAturHwAgcMaxGain correctly for 6348
18710 + *
18711 + * Revision 1.228  2004/02/09 05:06:17  yongbing
18712 + * Add ADSL2 bit swap function
18713 + *
18714 + * Revision 1.227  2004/02/04 02:08:19  linyin
18715 + * remove the redefined kG992p5AnnexA
18716 + *
18717 + * Revision 1.226  2004/02/04 01:41:48  linyin
18718 + * Add some variables for G992P5
18719 + *
18720 + * Revision 1.225  2004/02/03 19:12:22  gsyu
18721 + * Added a dedicate structure and constants for G992P5
18722 + *
18723 + * Revision 1.224  2004/01/24 01:18:34  ytan
18724 + * add multi-section swapping flag
18725 + *
18726 + * Revision 1.223  2004/01/17 00:21:48  ilyas
18727 + * Added commands and statuses for OLR
18728 + *
18729 + * Revision 1.222  2004/01/13 19:12:37  gsyu
18730 + * Added more constants for Double upstream
18731 + *
18732 + * Revision 1.221  2003/12/23 21:19:04  mprahlad
18733 + * Define BCM6348_TEMP_MOVE_TO_LMEM to FAST_TEXT for 6348 targets - this is for
18734 + * ADSL2/AnnexA multimode builds - move a few functions to Lmem for now to avoid
18735 + * changes for swap on 6348.
18736 + *
18737 + * Revision 1.220  2003/12/19 21:21:53  ilyas
18738 + * Added dying gasp support for ADSL2
18739 + *
18740 + * Revision 1.219  2003/12/05 02:09:51  mprahlad
18741 + * Leave the AnalogEC defs in - saves ifdef-ing all uses of these defines.
18742 + * Include Bcm6345_To_Bcm6348.h - to be able to pick up macros for the
18743 + * transition
18744 + *
18745 + * Revision 1.218  2003/12/04 02:10:58  linyin
18746 + * Redefine some constants for supporting different pilot and TTR
18747 + *
18748 + * Revision 1.217  2003/12/03 02:24:39  gsyu
18749 + * Reverse previous check in for Double Upstream demo
18750 + *
18751 + * Revision 1.215  2003/11/20 00:58:47  yongbing
18752 + * Merge ADSL2 functionalities into Annex A branch
18753 + *
18754 + * Revision 1.214  2003/11/06 00:35:06  nino
18755 + * Added kDslWriteAfeRegCmd and kDslReadAfeRegCmd commands.
18756 + *
18757 + * Revision 1.213  2003/11/05 21:04:23  ilyas
18758 + * Added more codes for LOG data
18759 + *
18760 + * Revision 1.212  2003/10/22 00:51:52  yjchen
18761 + * define constant for quiet line noise
18762 + *
18763 + * Revision 1.211  2003/10/20 22:08:57  nino
18764 + * Added kDslSetRcvGainCmd and kDslBypassRcvHpfCmd debug commands.
18765 + *
18766 + * Revision 1.210  2003/10/18 00:04:59  yjchen
18767 + * define constants for G992P3 diagnostic mode channel response
18768 + *
18769 + * Revision 1.209  2003/10/17 22:41:29  yongbing
18770 + * Add INP message support
18771 + *
18772 + * Revision 1.208  2003/10/16 00:06:09  uid1249
18773 + * Moved G.994 definitions from G.994p1MainTypes.h
18774 + *
18775 + * Revision 1.207  2003/10/15 20:45:11  linyin
18776 + * Add some constants for support Revision 2
18777 + *
18778 + * Revision 1.206  2003/10/14 22:04:02  ilyas
18779 + * Added Nino's AFE statuses for 6348
18780 + *
18781 + * Revision 1.205  2003/10/10 18:49:26  gsyu
18782 + * Added test modes to workaround the clock domain crossing bug, PR18038
18783 + *
18784 + * Revision 1.204  2003/09/30 19:27:46  mprahlad
18785 + * ifdef AnalogEC definies with #ifndef BCM6348_SRC
18786 + *
18787 + * Revision 1.203  2003/09/26 19:36:34  linyin
18788 + * Add annexi constant and vars
18789 + *
18790 + * Revision 1.202  2003/09/25 20:16:13  yjchen
18791 + * remove featureNTR definition
18792 + *
18793 + * Revision 1.201  2003/09/08 20:29:51  ilyas
18794 + * Added test commands for chip regression tests
18795 + *
18796 + * Revision 1.200  2003/08/26 00:58:14  ilyas
18797 + * Added I432 reset command (for header compression)
18798 + * Fixed SoftDsl time (for I432 header compression)
18799 + *
18800 + * Revision 1.199  2003/08/26 00:37:29  ilyas
18801 + * #ifdef'ed DslFrameFunctions in dslCommand structure to save space
18802 + *
18803 + * Revision 1.198  2003/08/22 22:45:00  liang
18804 + * Change the NF field in G992CodingParams from uchar to ushort to support K=256 (dataRate=255*32kbps) in fast path.
18805 + *
18806 + * Revision 1.197  2003/08/21 21:19:05  ilyas
18807 + * Changed dataPumpCapabilities structure for G992P3
18808 + *
18809 + * Revision 1.196  2003/08/12 22:44:28  khp
18810 + * - for Haixiang: added kDslTestMarginTweak command and marginTweakSpec
18811 + *
18812 + * Revision 1.195  2003/07/24 17:28:16  ovandewi
18813 + * added Tx filter change request code
18814 + *
18815 + * Revision 1.194  2003/07/24 15:48:55  yongbing
18816 + * Reduce TSSI buffer size to avoid crash at the beginning of G.994.1. Need to find out why
18817 + *
18818 + * Revision 1.193  2003/07/19 07:11:47  nino
18819 + * Revert back to version 1.191.
18820 + *
18821 + * Revision 1.191  2003/07/17 21:25:25  yongbing
18822 + * Add support for READSL2 and TSSI
18823 + *
18824 + * Revision 1.190  2003/07/14 19:42:33  yjchen
18825 + * add constants for G992P3
18826 + *
18827 + * Revision 1.189  2003/07/10 23:07:11  liang
18828 + * Add demodCapability bit to minimize showtime ATUC xmt power through b&g table.
18829 + *
18830 + * Revision 1.188  2003/07/08 22:18:50  liang
18831 + * Added demodCapability bit for G.994.1 Annex A multimode operation.
18832 + *
18833 + * Revision 1.187  2003/07/07 23:24:43  ilyas
18834 + * Added G.dmt.bis definitions
18835 + *
18836 + * Revision 1.186  2003/06/25 02:44:02  liang
18837 + * Added demod capability bit kDslUE9000ADI918FECFixEnabled.
18838 + * Added back kDslHWEnableAnalogECUpdate & kDslHWEnableAnalogEC for backward compatibility (annex A).
18839 + *
18840 + * Revision 1.185  2003/06/18 01:39:19  ilyas
18841 + * Added AFE test commands. Add #defines for driver's builds
18842 + *
18843 + * Revision 1.184  2003/06/06 23:58:09  ilyas
18844 + * Added command and status for standalone AFE tests
18845 + *
18846 + * Revision 1.183  2003/05/29 21:09:32  nino
18847 + * - kDslHWEnableAnalogECUpdate define replaced with kDslHWSetDigitalEcUpdateMode
18848 + * - kDslHWEnableAnalogEC       define replaced with kDslHWDisableDigitalECUpdate
18849 + *
18850 + * Revision 1.182  2003/04/15 22:08:15  liang
18851 + * Changed one of the demodCapability bit name from last checkin.
18852 + *
18853 + * Revision 1.181  2003/04/13 19:25:54  liang
18854 + * Added three more demodCapability bits.
18855 + *
18856 + * Revision 1.180  2003/04/02 02:09:17  liang
18857 + * Added demodCapability bit for ADI low rate option fix disable.
18858 + *
18859 + * Revision 1.179  2003/03/18 18:22:06  yongbing
18860 + * Use 32 tap TEQ for Annex I
18861 + *
18862 + * Revision 1.178  2003/03/06 00:58:07  ilyas
18863 + * Added SetStausBuffer command
18864 + *
18865 + * Revision 1.177  2003/02/25 00:46:26  ilyas
18866 + * Added T1.413 EOC vendor ID
18867 + *
18868 + * Revision 1.176  2003/02/21 23:30:54  ilyas
18869 + * Added Xmtgain command framing mode status and T1413VendorId parameters
18870 + *
18871 + * Revision 1.175  2003/02/07 22:13:55  liang
18872 + * Add demodCapabilities bits for sub-sample alignment and higher T1.413 level (used internally only).
18873 + *
18874 + * Revision 1.174  2003/01/23 02:54:07  liang
18875 + * Added demod capability bit for bitswap enable.
18876 + *
18877 + * Revision 1.173  2002/12/13 18:36:33  yongbing
18878 + * Add support for G.992.2 Annex C
18879 + *
18880 + * Revision 1.172  2002/12/10 23:27:12  ilyas
18881 + * Extended dslException parameter structure to allow printout from DslDiags
18882 + *
18883 + * Revision 1.171  2002/12/06 02:10:19  liang
18884 + * Moved the T1.413 RAck1/RAck2 switching variables to connection setup structure.
18885 + * Added/Modified the training progress codes for T1.413 RAck1/RAck2 and upstream 2x IFFT disable.
18886 + *
18887 + * Revision 1.170  2002/11/11 00:20:05  liang
18888 + * Add demod capability constant for internally disabling upstream 2x IFFT in T1.413 mode.
18889 + *
18890 + * Revision 1.169  2002/11/06 03:46:19  liang
18891 + * Add training progress code for upstream 2x IFFT disable.
18892 + *
18893 + * Revision 1.168  2002/11/01 01:41:06  ilyas
18894 + * Added flags for Centillium 4103 workarround
18895 + *
18896 + * Revision 1.167  2002/10/26 01:26:11  gsyu
18897 + * Move SoftDslLineHandler from SDRAM to LMEM
18898 + *
18899 + * Revision 1.166  2002/10/20 18:56:20  khp
18900 + * - for linyin
18901 + *   - #ifdef NEC_NSIF_WORKAROUND:
18902 + *     - add macros to extract NSIF status and fail counter vars
18903 + *
18904 + * Revision 1.165  2002/10/14 05:24:35  liang
18905 + * Add training status code to request alternate xmt filter (for Samsung 6-port ADI918 DSLAMs) to meet KT 2km spec.
18906 + *
18907 + * Revision 1.164  2002/10/08 21:44:50  ilyas
18908 + * Fixed EOC stuffing byte to indicate "no synchronization" action
18909 + *
18910 + * Revision 1.163  2002/10/03 19:34:24  ilyas
18911 + * Added size for EOC serial number register
18912 + *
18913 + * Revision 1.162  2002/09/28 02:42:27  yongbing
18914 + * Add retrain in T1.413 with R-Ack1 tone
18915 + *
18916 + * Revision 1.161  2002/09/28 01:23:35  gsyu
18917 + * Reverse us2xifft change so that we can install new us2xifft on the tree
18918 + *
18919 + * Revision 1.160  2002/09/26 23:30:48  yongbing
18920 + * Add synch symbol detection in Showtime
18921 + *
18922 + * Revision 1.159  2002/09/20 23:47:52  khp
18923 + * - for gsyu: enable 2X IFFT for Annex A (XMT_FFT_SIZE_2X)
18924 + *
18925 + * Revision 1.158  2002/09/14 03:26:39  ilyas
18926 + * Changed far-end RDI reporting
18927 + *
18928 + * Revision 1.157  2002/09/13 21:10:54  ilyas
18929 + * Added reporting of remote modem LOS and RDI.
18930 + * Moved G992CodingParams definition to SoftDsl.h
18931 + *
18932 + * Revision 1.156  2002/09/12 21:07:19  ilyas
18933 + * Added HEC, OCD and LCD counters
18934 + *
18935 + * Revision 1.155  2002/09/09 21:31:30  linyin
18936 + * Add two constant to support long reach
18937 + *
18938 + * Revision 1.154  2002/09/07 01:31:51  ilyas
18939 + * Added support for OEM parameters
18940 + *
18941 + * Revision 1.153  2002/09/04 22:36:14  mprahlad
18942 + * defines for non standard info added
18943 + *
18944 + * Revision 1.152  2002/08/02 21:59:09  liang
18945 + * Enable G.992.2 carrierInfo in capabitilities when G.992.1 annex A is used for G.992.2.
18946 + *
18947 + * Revision 1.151  2002/07/29 20:01:03  ilyas
18948 + * Added command for Atm VC map table change
18949 + *
18950 + * Revision 1.150  2002/07/18 22:30:47  liang
18951 + * Add xmt power and power cutback related constants.
18952 + *
18953 + * Revision 1.149  2002/07/11 01:30:58  ilyas
18954 + * Changed status for ShowtimeMargin reporting
18955 + *
18956 + * Revision 1.148  2002/07/09 19:19:09  ilyas
18957 + * Added status parameters for ShowtimeSNRMargin info and command to filter
18958 + * out SNR margin data
18959 + *
18960 + * Revision 1.147  2002/06/27 21:50:24  liang
18961 + * Added test command related demodCapabilities bits.
18962 + *
18963 + * Revision 1.146  2002/06/26 21:29:00  liang
18964 + * Added dsl test cmd structure and showtime margin connection info status.
18965 + *
18966 + * Revision 1.145  2002/06/15 05:15:51  ilyas
18967 + * Added definitions for Ping, Dying Gasp and other test commands
18968 + *
18969 + * Revision 1.144  2002/05/30 19:55:15  ilyas
18970 + * Added status for ADSL PHY MIPS exception
18971 + * Changed conflicting definition for higher rates (S=1/2)
18972 + *
18973 + * Revision 1.143  2002/05/21 23:41:07  yongbing
18974 + * First check-in of Annex C S=1/2 codes
18975 + *
18976 + * Revision 1.142  2002/04/29 22:25:09  georgep
18977 + * Merge from branch annexC_demo - add status message constants
18978 + *
18979 + * Revision 1.141  2002/04/18 19:00:35  ilyas
18980 + * Added include file for builds in CommEngine environment
18981 + *
18982 + * Revision 1.140  2002/04/18 00:18:36  yongbing
18983 + * Add detailed timeout error messages
18984 + *
18985 + * Revision 1.139  2002/04/02 10:03:18  ilyas
18986 + * Merged BERT from AnnexA branch
18987 + *
18988 + * Revision 1.138  2002/03/26 01:42:29  ilyas
18989 + * Added timeout message constants for annex C
18990 + *
18991 + * Revision 1.137  2002/03/22 19:39:22  yongbing
18992 + * Modify for co-exist of G994P1 and T1P413
18993 + *
18994 + * Revision 1.136  2002/03/22 01:19:40  ilyas
18995 + * Add status message constants for total FEXT Bits, NEXT bits
18996 + *
18997 + * Revision 1.135  2002/03/10 22:32:24  liang
18998 + * Added report constants for LOS recovery and timing tone index.
18999 + *
19000 + * Revision 1.134  2002/03/07 22:06:32  georgep
19001 + * Replace ifdef G992P1 with G992P1_ANNEX_A for annex A variables
19002 + *
19003 + * Revision 1.133  2002/02/16 01:08:18  georgep
19004 + * Add log constant for showtime mse
19005 + *
19006 + * Revision 1.132  2002/02/08 04:36:27  ilyas
19007 + * Added commands for LOG file and fixed Idle mode pointer update
19008 + *
19009 + * Revision 1.131  2002/01/24 20:21:30  georgep
19010 + * Add logging defines, remove fast retrain defines
19011 + *
19012 + * Revision 1.130  2002/01/19 23:59:17  ilyas
19013 + * Added support for LOG and eye data to ADSL core target
19014 + *
19015 + * Revision 1.129  2002/01/16 23:43:54  liang
19016 + * Remove the carriage return character from last checkin.
19017 + *
19018 + * Revision 1.128  2002/01/15 22:27:13  ilyas
19019 + * Added command for ADSL loopback
19020 + *
19021 + * Revision 1.127  2002/01/10 07:18:22  ilyas
19022 + * Added status for printf (mainly for ADSL core debugging)
19023 + *
19024 + * Revision 1.126  2001/12/21 22:45:34  ilyas
19025 + * Added support for ADSL MIB data object
19026 + *
19027 + * Revision 1.125  2001/12/13 02:24:22  ilyas
19028 + * Added G997 (Clear EOC and G997 framer) support
19029 + *
19030 + * Revision 1.124  2001/11/30 05:56:31  liang
19031 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
19032 + *
19033 + * Revision 1.123  2001/11/15 19:01:07  yongbing
19034 + * Modify only T1.413 part to the top of tree based on AnnexBDevelopment branch
19035 + *
19036 + * Revision 1.122  2001/10/19 00:12:07  ilyas
19037 + * Added support for frame oriented (no ATM) data link layer
19038 + *
19039 + * Revision 1.121  2001/10/09 22:35:13  ilyas
19040 + * Added more ATM statistics and OAM support
19041 + *
19042 + * Revision 1.105.2.20  2001/11/27 02:32:03  liang
19043 + * Combine vendor ID, serial #, and version number into SoftModemVersionNumber.c.
19044 + *
19045 + * Revision 1.105.2.19  2001/11/21 01:29:14  georgep
19046 + * Add a status message define for annexC
19047 + *
19048 + * Revision 1.105.2.18  2001/11/08 23:26:28  yongbing
19049 + * Add carrier selection function for Annex A and B
19050 + *
19051 + * Revision 1.105.2.17  2001/11/07 22:55:30  liang
19052 + * Report G992 rcv msg CRC error as what it is instead of time out.
19053 + *
19054 + * Revision 1.105.2.16  2001/11/05 19:56:21  liang
19055 + * Add DC offset info code.
19056 + *
19057 + * Revision 1.105.2.15  2001/10/16 00:47:16  yongbing
19058 + * Add return-to-T1p413 starting point if in error
19059 + *
19060 + * Revision 1.105.2.14  2001/10/15 23:14:01  yjchen
19061 + * remove ADSL_SINGLE_SYMBOL_BLOCK
19062 + *
19063 + * Revision 1.105.2.13  2001/10/12 18:07:16  yongbing
19064 + * Add support for T1.413
19065 + *
19066 + * Revision 1.105.2.12  2001/10/04 00:23:52  liang
19067 + * Add connection info constants for TEQ coef and PSD.
19068 + *
19069 + * Revision 1.105.2.11  2001/10/03 01:44:01  liang
19070 + * Merged with codes from main tree (tag SoftDsl_2_18).
19071 + *
19072 + * Revision 1.105.2.10  2001/09/28 22:10:04  liang
19073 + * Add G994 exchange message status reports.
19074 + *
19075 + * Revision 1.105.2.9  2001/09/26 18:08:21  georgep
19076 + * Send status error message in case features field is not setup properly
19077 + *
19078 + * Revision 1.105.2.8  2001/09/05 01:58:13  georgep
19079 + * Added status message for annexC measured delay
19080 + *
19081 + * Revision 1.105.2.7  2001/08/29 00:37:52  georgep
19082 + * Add log constants for annexC
19083 + *
19084 + * Revision 1.105.2.6  2001/08/18 00:01:34  georgep
19085 + * Add constants for annexC
19086 + *
19087 + * Revision 1.105.2.5  2001/08/08 17:33:28  yongbing
19088 + * Merge with tag SoftDsl_2_17
19089 + *
19090 + * Revision 1.120  2001/08/29 02:56:01  ilyas
19091 + * Added tests for flattening/unflatenning command and statuses (dual mode)
19092 + *
19093 + * Revision 1.119  2001/08/28 03:26:32  ilyas
19094 + * Added support for running host and adsl core parts separately ("dual" mode)
19095 + *
19096 + * Revision 1.118  2001/08/16 02:16:10  khp
19097 + * - mark functions with FAST_TEXT to reduce cycle counts for QPROC targets
19098 + *   (replaces use of LMEM_INSN)
19099 + *
19100 + * Revision 1.117  2001/06/18 20:06:35  ilyas
19101 + * Added forward declaration of dslCommandStruc to avoid gcc warnings
19102 + *
19103 + * Revision 1.116  2001/06/18 19:49:36  ilyas
19104 + * Changes to include support for HOST_ONLY mode
19105 + *
19106 + * Revision 1.115  2001/06/01 22:00:33  ilyas
19107 + * Changed ATM PHY interface to accomodate UTOPIA needs
19108 + *
19109 + * Revision 1.114  2001/05/16 06:22:24  liang
19110 + * Added status reports for xmt & rcv prefix enable position.
19111 + *
19112 + * Revision 1.113  2001/05/02 20:34:32  georgep
19113 + * Added log constants for snr1 calculation
19114 + *
19115 + * Revision 1.112  2001/04/25 01:20:11  ilyas
19116 + *
19117 + * Don't use DSL frame functions if ATM_LAYER is not defined
19118 + *
19119 + * Revision 1.111  2001/04/17 21:13:00  georgep
19120 + * Define status constant kDslHWSetDigitalEcUpdateShift
19121 + *
19122 + * Revision 1.110  2001/04/16 23:38:36  georgep
19123 + * Add HW AGC constants for ATUR
19124 + *
19125 + * Revision 1.109  2001/04/06 23:44:53  georgep
19126 + * Added status constant for setting up digitalEcGainShift
19127 + *
19128 + * Revision 1.108  2001/03/29 05:58:34  liang
19129 + * Replaced the Aware compatibility codes with automatic detection codes.
19130 + *
19131 + * Revision 1.107  2001/03/25 06:11:22  liang
19132 + * Combined separate loop attenuation status for ATUR & ATUC into one status.
19133 + * Replace separate hardware AGC info status for ATUR & ATUC into hardware AGC
19134 + * request status and hardware AGC obtained status.
19135 + * Use store AGC command to save hardware AGC value instead of returning value
19136 + * from status report.
19137 + *
19138 + * Revision 1.106  2001/03/24 00:43:22  liang
19139 + * Report more checksum results (NumOfCalls, txSignal, rxSignal & eyeData).
19140 + *
19141 + * Revision 1.105  2001/03/16 23:57:31  georgep
19142 + * Added more loop attenuation reporting status constants
19143 + *
19144 + * Revision 1.104  2001/03/15 00:22:07  liang
19145 + * Back to version 1.101.
19146 + *
19147 + * Revision 1.103  2001/03/15 00:03:44  yjchen
19148 + * use kDslATURHardwareAGCInfo for AltoE14 AGC as well
19149 + *
19150 + * Revision 1.102  2001/03/14 23:10:56  yjchen
19151 + * add defns for AltoE14 AGC
19152 + *
19153 + * Revision 1.101  2001/03/08 23:31:34  georgep
19154 + * Added R, S, D, coding parameters to dslDataPumpCapabilities
19155 + *
19156 + * Revision 1.100  2001/02/10 03:03:09  ilyas
19157 + * Added one more DslFrame function
19158 + *
19159 + * Revision 1.99  2001/02/09 01:55:27  ilyas
19160 + * Added status codes and macros to support printing of AAL packets
19161 + *
19162 + * Revision 1.98  2001/01/30 23:28:10  georgep
19163 + * Added kDslDspControlStatus for handling changes to dsp params
19164 + *
19165 + * Revision 1.97  2001/01/12 01:17:18  georgep
19166 + * Added bit in demodCapabilities for analog echo cancellor
19167 + *
19168 + * Revision 1.96  2001/01/04 05:51:03  ilyas
19169 + * Added more dslStatuses
19170 + *
19171 + * Revision 1.95  2000/12/21 05:46:07  ilyas
19172 + * Added name for struct _dslFrame
19173 + *
19174 + * Revision 1.94  2000/12/13 22:04:39  liang
19175 + * Add Reed-Solomon coding enable bit in demodCapabilities.
19176 + *
19177 + * Revision 1.93  2000/11/29 20:42:02  liang
19178 + * Add defines for SNR & max achivable rate status and DEC enable demodCapabilities bit.
19179 + *
19180 + * Revision 1.92  2000/09/22 21:55:13  ilyas
19181 + * Added support for DSL + Atm physical layer only (I.432) simulations
19182 + *
19183 + * Revision 1.91  2000/09/10 09:20:53  lkaplan
19184 + * Improve interface for sending Eoc messages
19185 + *
19186 + * Revision 1.90  2000/09/08 19:37:58  lkaplan
19187 + * Added code for handling EOC messages
19188 + *
19189 + * Revision 1.89  2000/09/07 23:02:27  georgep
19190 + * Add HarwareAGC Bit to demod Capabilities
19191 + *
19192 + * Revision 1.88  2000/09/01 00:57:34  georgep
19193 + * Added Hardware AGC status defines
19194 + *
19195 + * Revision 1.87  2000/08/31 19:04:26  liang
19196 + * Added external reference for stack size requirement test functions.
19197 + *
19198 + * Revision 1.86  2000/08/24 23:16:46  liang
19199 + * Increased sample block size for noBlock.
19200 + *
19201 + * Revision 1.85  2000/08/23 18:34:39  ilyas
19202 + * Added XxxVcConfigure function
19203 + *
19204 + * Revision 1.84  2000/08/05 00:25:04  georgep
19205 + * Redefine sampling freq constants
19206 + *
19207 + * Revision 1.83  2000/08/03 14:04:00  liang
19208 + * Add hardware time tracking clock error reset code.
19209 + *
19210 + * Revision 1.82  2000/07/23 20:52:52  ilyas
19211 + * Added xxxFrameBufSetAddress() function for ATM framer layers
19212 + * Rearranged linkLayer functions in one structure which is passed as a
19213 + * parameter to xxxLinkLayerInit() function to be set there
19214 + *
19215 + * Revision 1.81  2000/07/18 20:03:24  ilyas
19216 + * Changed DslFrame functions definitions to macros,
19217 + * Removed gDslVars from their parameter list
19218 + *
19219 + * Revision 1.80  2000/07/17 21:08:15  lkaplan
19220 + * removed global pointer
19221 + *
19222 + * Revision 1.79  2000/06/21 20:38:44  georgep
19223 + * Added bit to demodCapabilities for HW_TIME_TRACKING
19224 + *
19225 + * Revision 1.78  2000/06/19 19:57:55  georgep
19226 + * Added constants for logging of HWResampler data
19227 + *
19228 + * Revision 1.77  2000/06/02 18:57:21  ilyas
19229 + * Added support for DSL buffers consisting of many ATM cells
19230 + *
19231 + * Revision 1.76  2000/05/27 02:19:28  liang
19232 + * G992MonitorParams structure is moved here, and Tx/Rx data handler type definitions changed.
19233 + *
19234 + * Revision 1.75  2000/05/15 18:17:21  liang
19235 + * Added statuses for sent and received frames
19236 + *
19237 + * Revision 1.74  2000/05/14 01:56:38  ilyas
19238 + * Added ATM cell printouts
19239 + *
19240 + * Revision 1.73  2000/05/09 23:00:26  ilyas
19241 + * Added ATM status messages, ATM timer, Tx frames flush on timeout
19242 + * Fixed a bug - adding flushed Tx frames to the list of free Rx frames
19243 + *
19244 + * Revision 1.72  2000/05/03 18:01:18  georgep
19245 + * Removed old function declarations for Eoc/Aoc
19246 + *
19247 + * Revision 1.71  2000/05/03 03:57:04  ilyas
19248 + * Added LOG file support for writing ATM data
19249 + *
19250 + * Revision 1.70  2000/05/02 00:04:36  liang
19251 + * Add showtime monitoring and message exchange info constants.
19252 + *
19253 + * Revision 1.69  2000/04/28 23:34:20  yongbing
19254 + * Add constants for reporting error events in performance monitoring
19255 + *
19256 + * Revision 1.68  2000/04/21 23:09:04  liang
19257 + * Added G992 time out training progress constant.
19258 + *
19259 + * Revision 1.67  2000/04/19 00:31:47  ilyas
19260 + * Added global SoftDsl functions for Vc, added OOB info functions
19261 + *
19262 + * Revision 1.66  2000/04/18 00:45:31  yongbing
19263 + * Add G.DMT new frame structure, define G992P1_NEWFRAME to enable, need ATM layer to work
19264 + *
19265 + * Revision 1.65  2000/04/15 01:48:34  georgep
19266 + * Added T1p413 status constants
19267 + *
19268 + * Revision 1.64  2000/04/13 08:36:22  yura
19269 + * Added SoftDslSetRefData, SoftDslGetRefData functions
19270 + *
19271 + * Revision 1.63  2000/04/13 05:42:35  georgep
19272 + * Added constant for T1p413
19273 + *
19274 + * Revision 1.62  2000/04/05 21:49:54  liang
19275 + * minor change.
19276 + *
19277 + * Revision 1.61  2000/04/04 04:16:06  liang
19278 + * Merged with SoftDsl_0_03 from old tree.
19279 + *
19280 + * Revision 1.65  2000/04/04 01:47:21  ilyas
19281 + * Implemented abstract dslFrame and dslFrameBuffer objects
19282 + *
19283 + * Revision 1.64  2000/04/01 08:12:10  yura
19284 + * Added preliminary revision of the SoftDsl driver architecture
19285 + *
19286 + * Revision 1.63  2000/04/01 02:55:33  georgep
19287 + * New defines for G992p2Profile Structure
19288 + *
19289 + * Revision 1.62  2000/04/01 00:50:36  yongbing
19290 + * Add initial version of new frame structure for full-rate
19291 + *
19292 + * Revision 1.61  2000/03/24 03:30:45  georgep
19293 + * Define new constant kDslUpstreamSamplingFreq
19294 + *
19295 + * Revision 1.60  2000/03/23 19:51:30  georgep
19296 + * Define new features bits for G992p1
19297 + *
19298 + * Revision 1.59  2000/03/18 01:28:41  georgep
19299 + * Changed connectionSetup to include G992p1 Capabilities
19300 + *
19301 + * Revision 1.58  2000/02/29 01:40:03  georgep
19302 + * Changed modulationtype defines to be the same as SPAR1 in G994p1
19303 + *
19304 + * Revision 1.57  1999/11/19 01:03:19  george
19305 + * Use Block Size 256 for single symbol Mode
19306 + *
19307 + * Revision 1.56  1999/11/18 02:37:43  george
19308 + * Porting to 16Bit
19309 + *
19310 + * Revision 1.55  1999/11/12 02:12:55  george
19311 + * Added status constant for reporting of profile channel matching calculation
19312 + *
19313 + * Revision 1.54  1999/11/11 19:19:42  george
19314 + * Porting to 16Bit Compiler
19315 + *
19316 + * Revision 1.53  1999/11/05 01:27:06  liang
19317 + * Add recovery-from-inpulse-noise progress report.
19318 + *
19319 + * Revision 1.52  1999/11/02 02:06:27  george
19320 + * Added SNRMargin training status value
19321 + *
19322 + * Revision 1.51  1999/10/27 23:02:03  wan
19323 + * Add G.994.1 setup in dslConnectionSetupStruct for setting up Initiation side
19324 + *
19325 + * Revision 1.50  1999/10/25 21:55:36  liang
19326 + * Renamed the constant for FEQ output error.
19327 + *
19328 + * Revision 1.49  1999/10/23 02:20:55  george
19329 + * Add debug data codes
19330 + *
19331 + * Revision 1.48  1999/10/19 23:59:06  liang
19332 + * Change line handler interface to work with nonsymmetric sampling freq.
19333 + *
19334 + * Revision 1.47  1999/10/09 01:38:04  george
19335 + * Define maxProfileNumber
19336 + *
19337 + * Revision 1.46  1999/10/07 23:30:51  wan
19338 + * Add G.994.1 Tone and Fast Retrain Recov detections in G.992p2 SHOWTIME and Fast Retrain
19339 + *
19340 + * Revision 1.45  1999/10/06 13:59:27  liang
19341 + * Escape to G994.1 should be done through status instead of command.
19342 + *
19343 + * Revision 1.44  1999/10/06 02:01:28  george
19344 + * Add kDslReturnToG994p1Cmd
19345 + *
19346 + * Revision 1.43  1999/09/30 19:29:58  george
19347 + * Add reporting constant for Fast Retrain
19348 + *
19349 + * Revision 1.42  1999/09/16 23:41:56  liang
19350 + * Added command for host forced retrain.
19351 + *
19352 + * Revision 1.41  1999/08/20 00:47:25  wan
19353 + * Add constants for Fast Retrain progress status
19354 + *
19355 + * Revision 1.40  1999/08/16 18:06:01  wan
19356 + * Add more reporting constants for Fast Retrain
19357 + *
19358 + * Revision 1.39  1999/08/12 00:18:10  wan
19359 + * Add several Fast Retrain Status constants
19360 + *
19361 + * Revision 1.38  1999/08/10 18:25:38  george
19362 + * Define constants used for Fast Retrain
19363 + *
19364 + * Revision 1.37  1999/07/31 01:47:43  george
19365 + * Add status constants for eoc/aoc
19366 + *
19367 + * Revision 1.36  1999/07/27 18:19:52  george
19368 + * declare aoc/eoc functions
19369 + *
19370 + * Revision 1.35  1999/07/19 22:44:47  george
19371 + * Add constants for G994p1 Message Exchange
19372 + *
19373 + * Revision 1.34  1999/07/16 02:03:03  liang
19374 + * Modified Dsl link layer command spec structure.
19375 + *
19376 + * Revision 1.33  1999/07/14 22:53:16  george
19377 + * Add Constants for G994p1
19378 + *
19379 + * Revision 1.32  1999/07/13 00:02:26  liang
19380 + * Added more feature bits.
19381 + *
19382 + * Revision 1.31  1999/07/09 01:58:14  wan
19383 + * Added more constants G.994.1 testing reports
19384 + *
19385 + * Revision 1.30  1999/07/07 23:51:04  liang
19386 + * Added rcv power and loop attenuation reports.
19387 + *
19388 + * Revision 1.29  1999/07/06 21:32:01  liang
19389 + * Added some aux. feature bits, and field performanceMargin was changed to noiseMargin in Capabilities.
19390 + *
19391 + * Revision 1.28  1999/07/03 01:40:17  liang
19392 + * Redefined dsl command parameter list and added connection setup struct.
19393 + *
19394 + * Revision 1.27  1999/07/02 00:41:18  liang
19395 + * Add bit and gain logging as well as rcv carrier range status.
19396 + *
19397 + * Revision 1.26  1999/06/25 21:37:10  wan
19398 + * Work in progress for G994.1.
19399 + *
19400 + * Revision 1.25  1999/06/16 00:54:36  liang
19401 + * Added Tx/Rx SHOWTIME active training progress codes.
19402 + *
19403 + * Revision 1.24  1999/06/11 21:59:37  wan
19404 + * Added G994.1 fail status constant.
19405 + *
19406 + * Revision 1.23  1999/06/11 21:29:01  liang
19407 + * Constants for C/R-Msgs was changed to C/R-Msg.
19408 + *
19409 + * Revision 1.22  1999/06/08 02:49:42  liang
19410 + * Added SNR data logging.
19411 + *
19412 + * Revision 1.21  1999/06/07 21:05:08  liang
19413 + * Added more training status values.
19414 + *
19415 + * Revision 1.20  1999/05/22 02:18:26  liang
19416 + * More constant defines.
19417 + *
19418 + * Revision 1.19  1999/05/14 22:49:35  liang
19419 + * Added more status codes and debug data codes.
19420 + *
19421 + * Revision 1.18  1999/04/12 22:41:39  liang
19422 + * Work in progress.
19423 + *
19424 + * Revision 1.17  1999/04/01 20:28:07  liang
19425 + * Added RReverb detect event status.
19426 + *
19427 + * Revision 1.16  1999/03/26 03:29:54  liang
19428 + * Add DSL debug data constants.
19429 + *
19430 + * Revision 1.15  1999/03/08 21:58:00  liang
19431 + * Added more constant definitions.
19432 + *
19433 + * Revision 1.14  1999/03/02 01:49:36  liang
19434 + * Added more connection info codes.
19435 + *
19436 + * Revision 1.13  1999/03/02 00:25:55  liang
19437 + * Added DSL tx and rx data handler type definitions.
19438 + *
19439 + * Revision 1.12  1999/02/27 01:16:55  liang
19440 + * Increase allowable static memory size to a VERY large number for now.
19441 + *
19442 + * Revision 1.11  1999/02/25 00:24:06  liang
19443 + * Increased symbol block size to 16.
19444 + *
19445 + * Revision 1.10  1999/02/23 22:03:26  liang
19446 + * Increased maximal static memory size allowed.
19447 + *
19448 + * Revision 1.9  1999/02/17 02:39:21  ilyas
19449 + * Changes for NDIS
19450 + *
19451 + * Revision 1.8  1999/02/11 22:44:30  ilyas
19452 + * More definitions for ATM
19453 + *
19454 + * Revision 1.7  1999/02/10 01:56:38  liang
19455 + * Added hooks for G994.1 and G992.2.
19456 + *
19457 + *
19458 + *****************************************************************************/
19459 +
19460 +#ifndef        SoftDslHeader
19461 +#define        SoftDslHeader
19462 +
19463 +/* for builds in Linux/VxWorks CommEngine environment */
19464 +#if (defined(__KERNEL__) && !defined(LINUX_DRIVER)) || defined(VXWORKS) || defined(_WIN32_WCE) || defined(TARG_OS_RTEMS) || defined(_CFE_)
19465 +#include "AdslCoreDefs.h"
19466 +#else
19467 +#include "Bcm6345_To_Bcm6348.h"                /* File for 45->48 changes */
19468 +#endif
19469 +
19470 +#ifndef        SoftModemPh
19471 +#include "SoftModem.h"
19472 +#endif
19473 +
19474 +#ifdef DSL_OS
19475 +#include "DslOs.h"
19476 +#endif
19477 +
19478 +/*
19479 +**
19480 +**             Type definitions 
19481 +**
19482 +*/
19483 +
19484 +#if defined(ATM) || defined(DSL_PACKET)
19485 +#define DSL_LINKLAYER
19486 +#endif
19487 +
19488 +#if defined(ATM_LAYER) || defined(DSL_PACKET_LAYER) || defined(G997_1_FRAMER)
19489 +#define DSL_FRAME_FUNCTIONS
19490 +#endif
19491 +
19492 +#define FLD_OFFSET(type,fld)   ((int)(void *)&(((type *)0)->fld))
19493 +
19494 +#include "Que.h"
19495 +#include "SoftAtmVc.h"
19496 +
19497 +typedef struct _dslFrameBuffer
19498 +       {
19499 +       struct _dslFrameBuffer *next;   /* link to the next buffer in the frame */
19500 +       void                               *pData;      /* pointer to data */
19501 +       ulong                              length;      /* size (in bytes) of data */
19502 +       } dslFrameBuffer;
19503 +
19504 +typedef struct _dslFrame
19505 +       {
19506 +       ulong                   Reserved[3];
19507 +
19508 +       ulong                   totalLength;    /* total amount of data in the packet */
19509 +       int                             bufCnt;                 /* buffer counter */
19510 +       struct _dslFrameBuffer *head;   /* first buffer in the chain */
19511 +       struct _dslFrameBuffer *tail;   /* last buffer in the chain  */
19512 +       } dslFrame;
19513 +
19514 +
19515 +/* VC types and parameters */
19516 +
19517 +#define        kDslVcAtm               1
19518 +
19519 +typedef        struct
19520 +       {
19521 +       ulong   vcType;
19522 +       union
19523 +               {
19524 +               atmVcParams     atmParams;
19525 +               } params;
19526 +       } dslVcParams;
19527 +
19528 +/*
19529 +**     Assuming that dslVcParams.params is the first field in VC
19530 +**     and RefData is the first field in dslVcParams.params
19531 +*/
19532 +
19533 +#define        DslVcGetRefData(pVc)    (*(void **) (pVc))
19534 +
19535 +/* Frame OOB types */
19536 +
19537 +#define        kDslFrameAtm    1
19538 +
19539 +typedef        struct
19540 +       {
19541 +       ulong   frameType;              
19542 +       union
19543 +               {
19544 +               atmOobPacketInfo        atmInfo;
19545 +               } param;
19546 +       } dslOobFrameInfo;
19547 +
19548 +
19549 +typedef struct
19550 +       {
19551 +       ulong (SM_DECL *__DslFrameBufferGetLength) (dslFrameBuffer *fb);
19552 +       void * (SM_DECL *__DslFrameBufferGetAddress) (dslFrameBuffer *fb);
19553 +       void (SM_DECL *__DslFrameBufferSetLength) (dslFrameBuffer *fb, ulong l);
19554 +       void (SM_DECL *__DslFrameBufferSetAddress) (dslFrameBuffer *fb, void *p);
19555 +
19556 +       void (SM_DECL *__DslFrameInit) (dslFrame *f);
19557 +       ulong (SM_DECL *__DslFrameGetLength) (dslFrame *pFrame);
19558 +       ulong (SM_DECL *__DslFrameGetBufCnt) (dslFrame *pFrame);
19559 +       dslFrameBuffer * (SM_DECL *__DslFrameGetFirstBuffer) (dslFrame *pFrame);
19560 +       dslFrameBuffer * (SM_DECL *__DslFrameGetNextBuffer) (dslFrameBuffer *pFrBuffer);
19561 +       void  (SM_DECL *__DslFrameSetNextBuffer) (dslFrameBuffer *pFrBuf, dslFrameBuffer *pFrBufNext);
19562 +       dslFrameBuffer * (SM_DECL *__DslFrameGetLastBuffer) (dslFrame *pFrame);
19563 +       void * (SM_DECL *__DslFrameGetLinkFieldAddress) (dslFrame *f);
19564 +       dslFrame * (SM_DECL *__DslFrameGetFrameAddressFromLink) (void *lnk);
19565 +
19566 +       Boolean (SM_DECL *__DslFrameGetOobInfo) (dslFrame *f, dslOobFrameInfo   *pOobInfo);
19567 +       Boolean (SM_DECL *__DslFrameSetOobInfo) (dslFrame *f, dslOobFrameInfo   *pOobInfo);
19568 +
19569 +       void (SM_DECL *__DslFrameEnqueBufferAtBack) (dslFrame *f, dslFrameBuffer *b);
19570 +       void (SM_DECL *__DslFrameEnqueFrameAtBack) (dslFrame *fMain, dslFrame *f);
19571 +       void (SM_DECL *__DslFrameEnqueBufferAtFront) (dslFrame *f, dslFrameBuffer *b);
19572 +       void (SM_DECL *__DslFrameEnqueFrameAtFront) (dslFrame *fMain, dslFrame *f);
19573 +       dslFrameBuffer * (SM_DECL *__DslFrameDequeBuffer) (dslFrame *pFrame);
19574 +
19575 +       void * (SM_DECL *__DslFrameAllocMemForFrames) (ulong frameNum);
19576 +       void (SM_DECL *__DslFrameFreeMemForFrames) (void *hMem);
19577 +       dslFrame * (SM_DECL *__DslFrameAllocFrame) (void *handle);
19578 +       void (SM_DECL *__DslFrameFreeFrame) (void *handle, dslFrame *pFrame);
19579 +       void * (SM_DECL *__DslFrameAllocMemForBuffers) (void **ppMemPool, ulong bufNum, ulong memSize);
19580 +       void (SM_DECL *__DslFrameFreeMemForBuffers) (void *hMem, ulong memSize, void *pMemPool);
19581 +       dslFrameBuffer * (SM_DECL *__DslFrameAllocBuffer) (void *handle, void *pMem, ulong length);
19582 +       void (SM_DECL *__DslFrameFreeBuffer) (void *handle, dslFrameBuffer *pBuf);
19583 +
19584 +       /* for LOG file support */
19585 +
19586 +       ulong (SM_DECL *__DslFrame2Id)(void *handle, dslFrame *pFrame);
19587 +       void * (SM_DECL *__DslFrameId2Frame)(void *handle, ulong frameId);
19588 +       } dslFrameFunctions;
19589 +
19590 +#define         DslFrameDeclareFunctions( name_prefix )                                                                \
19591 +extern ulong SM_DECL name_prefix##BufferGetLength(dslFrameBuffer *fb);                 \
19592 +extern void * SM_DECL name_prefix##BufferGetAddress(dslFrameBuffer *fb);               \
19593 +extern void SM_DECL name_prefix##BufferSetLength(dslFrameBuffer *fb, ulong l); \
19594 +extern void SM_DECL name_prefix##BufferSetAddress(dslFrameBuffer *fb, void *p); \
19595 +                                                                                                                                                               \
19596 +extern void SM_DECL name_prefix##Init(dslFrame *f);                                                            \
19597 +extern ulong SM_DECL name_prefix##GetLength (dslFrame *pFrame);                                        \
19598 +extern ulong SM_DECL name_prefix##GetBufCnt(dslFrame *pFrame);                                 \
19599 +extern dslFrameBuffer * SM_DECL name_prefix##GetFirstBuffer(dslFrame *pFrame); \
19600 +extern dslFrameBuffer * SM_DECL name_prefix##GetNextBuffer(dslFrameBuffer *pFrBuffer); \
19601 +extern void SM_DECL name_prefix##SetNextBuffer(dslFrameBuffer *pFrBuf, dslFrameBuffer *pFrBufNext);    \
19602 +extern dslFrameBuffer * SM_DECL name_prefix##GetLastBuffer(dslFrame *pFrame);                  \
19603 +extern void * SM_DECL name_prefix##GetLinkFieldAddress(dslFrame *f);                                   \
19604 +extern Boolean SM_DECL name_prefix##GetOobInfo(dslFrame *f, dslOobFrameInfo *pOobInfo);        \
19605 +extern Boolean SM_DECL name_prefix##SetOobInfo(dslFrame *f, dslOobFrameInfo *pOobInfo);        \
19606 +extern dslFrame* SM_DECL name_prefix##GetFrameAddressFromLink(void *lnk);                              \
19607 +extern void SM_DECL name_prefix##EnqueBufferAtBack(dslFrame *f, dslFrameBuffer *b);            \
19608 +extern void SM_DECL name_prefix##EnqueFrameAtBack(dslFrame *fMain, dslFrame *f);               \
19609 +extern void SM_DECL name_prefix##EnqueBufferAtFront(dslFrame *f, dslFrameBuffer *b);   \
19610 +extern void SM_DECL name_prefix##EnqueFrameAtFront(dslFrame *fMain, dslFrame *f);              \
19611 +extern dslFrameBuffer * SM_DECL name_prefix##DequeBuffer(dslFrame *pFrame);                            \
19612 +                                                                                                                                                                               \
19613 +extern void * SM_DECL name_prefix##AllocMemForFrames(ulong frameNum);                                  \
19614 +extern void SM_DECL name_prefix##FreeMemForFrames(void *hMem);                                                 \
19615 +extern dslFrame * SM_DECL name_prefix##AllocFrame(void *handle);                                               \
19616 +extern void SM_DECL name_prefix##FreeFrame(void *handle, dslFrame *pFrame);                            \
19617 +extern void * SM_DECL name_prefix##AllocMemForBuffers(void **ppMemPool, ulong bufNum, ulong memSize);  \
19618 +extern void SM_DECL name_prefix##FreeMemForBuffers(void *hMem, ulong memSize, void *pMemPool);                 \
19619 +extern dslFrameBuffer * SM_DECL name_prefix##AllocBuffer(void *handle, void *pMem, ulong length);              \
19620 +extern void SM_DECL name_prefix##FreeBuffer(void *handle, dslFrameBuffer *pBuf);               \
19621 +extern ulong SM_DECL name_prefix##2Id(void *handle, dslFrame *pFrame);                                 \
19622 +extern void * SM_DECL name_prefix##Id2Frame(void *handle, ulong frameId);
19623 +
19624 +
19625 +#define         DslFrameAssignFunctions( var, name_prefix )    do {                    \
19626 +       (var).__DslFrameBufferGetLength = name_prefix##BufferGetLength;         \
19627 +       (var).__DslFrameBufferGetAddress= name_prefix##BufferGetAddress;        \
19628 +       (var).__DslFrameBufferSetLength = name_prefix##BufferSetLength;         \
19629 +       (var).__DslFrameBufferSetAddress= name_prefix##BufferSetAddress;        \
19630 +                                                                                                                                               \
19631 +       (var).__DslFrameInit                    = name_prefix##Init;                            \
19632 +       (var).__DslFrameGetLength               = name_prefix##GetLength;                       \
19633 +       (var).__DslFrameGetBufCnt               = name_prefix##GetBufCnt;                       \
19634 +       (var).__DslFrameGetFirstBuffer  = name_prefix##GetFirstBuffer;          \
19635 +       (var).__DslFrameGetNextBuffer   = name_prefix##GetNextBuffer;           \
19636 +       (var).__DslFrameSetNextBuffer   = name_prefix##SetNextBuffer;           \
19637 +       (var).__DslFrameGetLastBuffer   = name_prefix##GetLastBuffer;           \
19638 +       (var).__DslFrameGetLinkFieldAddress             = name_prefix##GetLinkFieldAddress;             \
19639 +       (var).__DslFrameGetFrameAddressFromLink = name_prefix##GetFrameAddressFromLink; \
19640 +                                                                                                                                               \
19641 +       (var).__DslFrameGetOobInfo              = name_prefix##GetOobInfo;                      \
19642 +       (var).__DslFrameSetOobInfo              = name_prefix##SetOobInfo;                      \
19643 +                                                                                                                                               \
19644 +       (var).__DslFrameEnqueBufferAtBack       = name_prefix##EnqueBufferAtBack;       \
19645 +       (var).__DslFrameEnqueFrameAtBack        = name_prefix##EnqueFrameAtBack;        \
19646 +       (var).__DslFrameEnqueBufferAtFront= name_prefix##EnqueBufferAtFront;    \
19647 +       (var).__DslFrameEnqueFrameAtFront       = name_prefix##EnqueFrameAtFront;       \
19648 +       (var).__DslFrameDequeBuffer             = name_prefix##DequeBuffer;                     \
19649 +                                                                                                                                               \
19650 +       (var).__DslFrameAllocMemForFrames       = name_prefix##AllocMemForFrames;       \
19651 +       (var).__DslFrameFreeMemForFrames        = name_prefix##FreeMemForFrames;        \
19652 +       (var).__DslFrameAllocFrame                      = name_prefix##AllocFrame;                      \
19653 +       (var).__DslFrameFreeFrame                       = name_prefix##FreeFrame;                       \
19654 +       (var).__DslFrameAllocMemForBuffers= name_prefix##AllocMemForBuffers;    \
19655 +       (var).__DslFrameFreeMemForBuffers = name_prefix##FreeMemForBuffers;     \
19656 +       (var).__DslFrameAllocBuffer             = name_prefix##AllocBuffer;                     \
19657 +       (var).__DslFrameFreeBuffer              = name_prefix##FreeBuffer;                      \
19658 +                                                                                                                                               \
19659 +       (var).__DslFrame2Id                             = name_prefix##2Id;                                     \
19660 +       (var).__DslFrameId2Frame                = name_prefix##Id2Frame;                        \
19661 +} while (0)
19662 +
19663 +typedef        struct
19664 +       {
19665 +       Boolean         febe_I;
19666 +       Boolean         fecc_I;
19667 +       Boolean         los, rdi;
19668 +       Boolean         ncd_I;
19669 +       Boolean         hec_I;
19670 +#ifdef G992P3 
19671 +       Boolean         lpr;
19672 +#endif
19673 +
19674 +#ifdef G992P1_NEWFRAME
19675 +
19676 +       Boolean         febe_F;
19677 +       Boolean         fecc_F;
19678 +       Boolean         ncd_F;
19679 +       Boolean         hec_F;
19680 +       
19681 +#endif
19682 +       } G992MonitorParams;
19683 +
19684 +typedef struct
19685 +       {
19686 +       ushort  K;
19687 +       uchar   S, R;
19688 +       uchar   D;
19689 +#ifdef G992P3 
19690 +       uchar   T, SEQ;
19691 +#endif
19692 +       directionType   direction;
19693 +
19694 +#ifdef         G992P1_NEWFRAME
19695 +
19696 +       ushort  N;
19697 +       ushort  NF;
19698 +       uchar   RSF;
19699 +
19700 +       uchar   AS0BF, AS1BF, AS2BF, AS3BF, AEXAF;
19701 +       ushort  AS0BI;
19702 +       uchar   AS1BI, AS2BI, AS3BI, AEXAI;
19703 +
19704 +       uchar   LS0CF, LS1BF, LS2BF, LEXLF;
19705 +       uchar   LS0CI, LS1BI, LS2BI, LEXLI;
19706 +       
19707 +       uchar   mergedModeEnabled;
19708 +       
19709 +#endif
19710 +
19711 +       } G992CodingParams;
19712 +
19713 +typedef struct
19714 +       {
19715 +       uchar   Nlp;
19716 +       uchar   Nbc;
19717 +       uchar   MSGlp;
19718 +       ushort  MSGc;
19719 +
19720 +       ulong   L;
19721 +       ushort  M;
19722 +       ushort  T;
19723 +       ushort  D;
19724 +       ushort  R;
19725 +       ushort  B;
19726 +       } G992p3CodingParams;
19727 +
19728 +/* Power Management Message definitions (used in command and status) */
19729 +
19730 +typedef struct
19731 +       {
19732 +       long                    msgType;
19733 +       union
19734 +               {
19735 +               long            value;
19736 +               struct
19737 +                       {
19738 +                       long    msgLen;
19739 +                       void    *msgData;
19740 +                       } msg;
19741 +               } param;
19742 +       } dslPwrMessage;
19743 +
19744 +/* Power Management commands and responses */
19745 +
19746 +#define        kPwrSimpleRequest                                                       1
19747 +#define        kPwrL2Request                                                           2
19748 +#define        kPwrL2TrimRequest                                                       3
19749 +
19750 +#define        kPwrGrant                                                                       0x80
19751 +#define        kPwrReject                                                                      0x81
19752 +#define        kPwrL2Grant                                                                     0x82
19753 +#define        kPwrL2Reject                                                            0x83
19754 +#define        kPwrL2TrimGrant                                                         0x84
19755 +#define        kPwrL2TrimReject                                                        0x85
19756 +#define        kPwrL2Grant2p                                                           0x86
19757 +
19758 +#define        kPwrBusy                                                                        0x01
19759 +#define        kPwrInvalid                                                                     0x02
19760 +#define        kPwrNotDesired                                                          0x03
19761 +#define        kPwrInfeasibleParam                                                     0x04
19762 +
19763 +/* Power Management reason codes */
19764 +
19765 +/* OLR definitions (used in command and status) */
19766 +
19767 +typedef struct
19768 +       {
19769 +       ushort  msgType;
19770 +       ushort  nCarrs;
19771 +       ushort  L[4];
19772 +       uchar   B[4];
19773 +       void    *carrParamPtr;
19774 +       } dslOLRMessage;
19775 +
19776 +typedef struct
19777 +       {
19778 +       uchar   ind;
19779 +       uchar   gain;
19780 +       uchar   gb;
19781 +       } dslOLRCarrParam;
19782 +
19783 +typedef struct
19784 +       {
19785 +       ushort  ind;
19786 +       uchar   gain;
19787 +       uchar   gb;
19788 +       } dslOLRCarrParam2p;
19789 +
19790 +/* OLR messages */
19791 +
19792 +#define        kOLRRequestType1                                                        1
19793 +#define        kOLRRequestType2                                                        2
19794 +#define        kOLRRequestType3                                                        3
19795 +#define        kOLRRequestType4                                                        4
19796 +#define        kOLRRequestType5                                                        5
19797 +#define        kOLRRequestType6                                                        6
19798 +
19799 +#define        kOLRDeferType1                                                          0x81
19800 +#define        kOLRRejectType2                                                         0x82
19801 +#define        kOLRRejectType3                                                         0x83
19802 +
19803 +/* OLR reason codes */
19804 +
19805 +#define        kOLRBusy                                                                        1
19806 +#define        kOLRInvalidParam                                                        2
19807 +#define        kOLRNotEnabled                                                          3
19808 +#define        kOLRNotSupported                                                        4
19809 +
19810 +/* common EOC definitions  */
19811 +#define        kG992EocStuffingByte                                            0x0C
19812 +
19813 +/* showtime monitor counters */
19814 +#define        kG992ShowtimeRSCodewordsRcved                           0       /* number of Reed-Solomon codewords received */
19815 +#define kG992ShowtimeRSCodewordsRcvedOK                                1       /* number of Reed-Solomon codewords received with all symdromes zero */
19816 +#define        kG992ShowtimeRSCodewordsRcvedCorrectable        2       /* number of Reed-Solomon codewords received with correctable errors */
19817 +#define        kG992ShowtimeRSCodewordsRcvedUncorrectable      3       /* number of Reed-Solomon codewords received with un-correctable errors */
19818 +#define        kG992ShowtimeSuperFramesRcvd                            4       /* number of super frames received */
19819 +#define        kG992ShowtimeSuperFramesRcvdWrong                       5       /* number of super frames received with CRC error */
19820 +#define        kG992ShowtimeLastUncorrectableRSCount           6       /* last recorded value for kG992ShowtimeRSCodewordsRcvedUncorrectable */
19821 +#define        kG992ShowtimeLastWrongSuperFrameCount           7       /* last recorded value for kG992ShowtimeSuperFramesRcvdWrong */
19822 +#define        kG992ShowtimeNumOfShortResync                           8       /* number of short interrupt recoveries by FEQ */
19823 +
19824 +#define        kG992ShowtimeNumOfFEBE                                          9       /* number of other side superframe errors */
19825 +#define        kG992ShowtimeNumOfFECC                                          10      /* number of other side superframe FEC errors */
19826 +#define        kG992ShowtimeNumOfFHEC                                          11      /* number of far-end ATM header CRC errors */
19827 +#define        kG992ShowtimeNumOfFOCD                                          12      /* number of far-end OCD events */
19828 +#define        kG992ShowtimeNumOfFLCD                                          13      /* number of far-end LCD events */
19829 +#define        kG992ShowtimeNumOfHEC                                           14      /* number of ATM header CRC errors */
19830 +#define        kG992ShowtimeNumOfOCD                                           15      /* number of OCD events */
19831 +#define        kG992ShowtimeNumOfLCD                                           16      /* number of LCD events */
19832 +
19833 +#define        kG992ShowtimeNumOfMonitorCounters                       (kG992ShowtimeNumOfLCD+1)       /* always last number + 1 */
19834 +#define        kG992ShowtimeMonitorReportNumber                        9
19835 +
19836 +#define        kG992ShowtimeLCDNumShift                                        1
19837 +#define        kG992ShowtimeLCDFlag                                            1
19838 +
19839 +typedef        int             (SM_DECL *dslFrameHandlerType)  (void *gDslVars, void *pVc, ulong mid, dslFrame *);
19840 +
19841 +typedef        void*   (SM_DECL *dslHeaderHandlerType) (void *gDslVars, ulong hdr, uchar hdrHec);
19842 +typedef        void*   (SM_DECL *dslTxFrameBufferHandlerType)  (void *gDslVars, int*,  void*);
19843 +typedef        void*   (SM_DECL *dslRxFrameBufferHandlerType)  (void *gDslVars, int,   void*);
19844 +
19845 +typedef        void*   (SM_DECL *dslVcAllocateHandlerType)     (void *gDslVars, void *);
19846 +typedef        void    (SM_DECL *dslVcFreeHandlerType) (void *gDslVars, void *);
19847 +typedef        Boolean (SM_DECL *dslVcActivateHandlerType)     (void *gDslVars, void *);
19848 +typedef        void    (SM_DECL *dslVcDeactivateHandlerType) (void *gDslVars, void *);
19849 +typedef        Boolean (SM_DECL *dslVcConfigureHandlerType) (void *gDslVars, void *pVc, ulong mid, void *);
19850 +
19851 +typedef        ulong   (SM_DECL *dslLinkVc2IdHandlerType) (void *gDslVars, void *);
19852 +typedef        void*   (SM_DECL *dslLinkVcId2VcHandlerType) (void *gDslVars, ulong);
19853 +typedef void*  (SM_DECL *dslGetFramePoolHandlerType) (void *gDslVars);
19854 +
19855 +typedef        void    (SM_DECL *dslLinkCloseHandlerType) (void *gDslVars);
19856 +typedef        int             (SM_DECL *dslTxDataHandlerType)(void *gDslVars, int, int, uchar*, G992MonitorParams*);
19857 +typedef        int             (SM_DECL *dslRxDataHandlerType)(void *gDslVars, int, uchar*, G992MonitorParams*);
19858 +
19859 +typedef        void    (SM_DECL *dslLinkStatusHandler) (void *gDslVars, ulong statusCode, ...);
19860 +
19861 +typedef Boolean (SM_DECL *dslPhyInitType) (
19862 +       void                                            *gDslVars, 
19863 +       bitMap                                          setupMap,
19864 +       dslHeaderHandlerType            rxCellHeaderHandlerPtr,
19865 +       dslRxFrameBufferHandlerType     rxFrameHandlerPtr,  
19866 +       dslTxFrameBufferHandlerType txFrameHandlerPtr,
19867 +       atmStatusHandler                        statusHandlerPtr);
19868 +
19869 +struct _dslFramerBufDesc;
19870 +
19871 +typedef        Boolean (SM_DECL *dslFramerDataGetPtrHandlerType) (void *gDslVars, struct _dslFramerBufDesc *pBufDesc);
19872 +typedef        void    (SM_DECL *dslFramerDataDoneHandlerType) (void *gDslVars, struct _dslFramerBufDesc *pBufDesc);
19873 +
19874 +typedef        void    (SM_DECL *dslDriverCallbackType) (void *gDslVars);
19875 +
19876 +#ifdef DSL_PACKET
19877 +
19878 +typedef        struct 
19879 +       {
19880 +       dslFramerDataGetPtrHandlerType  rxDataGetPtrHandler;
19881 +       dslFramerDataDoneHandlerType    rxDataDoneHandler;
19882 +       dslFramerDataGetPtrHandlerType  txDataGetPtrHandler;
19883 +       dslFramerDataDoneHandlerType    txDataDoneHandler;
19884 +       } dslPacketPhyFunctions;
19885 +
19886 +typedef Boolean (SM_DECL *dslPacketPhyInitType) (
19887 +       void                                            *gDslVars, 
19888 +       bitMap                                          setupMap,
19889 +       dslPacketPhyFunctions           dslPhyFunctions,
19890 +       dslLinkStatusHandler            statusHandlerPtr);
19891 +
19892 +
19893 +#endif /* DSL_PACKET */
19894 +
19895 +
19896 +typedef        int                     dslDirectionType;
19897 +typedef        bitMap          dslModulationType;
19898 +typedef        bitMap          dslLinkLayerType;
19899 +
19900 +/*
19901 +**
19902 +**             Log data codes 
19903 +**
19904 +*/
19905 +
19906 +#define        kDslEyeData                                     eyeData
19907 +
19908 +#define        kDslLogComplete                         (inputSignalData - 1)
19909 +#define        kDslLogInputData                        inputSignalData
19910 +#define        kDslLogInputData1                       (inputSignalData + 1)
19911 +#define        kDslLogInputData2                       (inputSignalData + 2)
19912 +#define        kDslLogInputData3                       (inputSignalData + 3)
19913 +
19914 +/*
19915 +**
19916 +**             Status codes 
19917 +**
19918 +*/
19919 +
19920 +typedef long                                           dslStatusCode;
19921 +#define        kFirstDslStatusCode                     256
19922 +#define        kDslError                                       (kFirstDslStatusCode + 0)
19923 +#define        kAtmStatus                                      (kFirstDslStatusCode + 1)
19924 +#define        kDslTrainingStatus                      (kFirstDslStatusCode + 2)
19925 +#define        kDslConnectInfoStatus           (kFirstDslStatusCode + 3)
19926 +#define        kDslEscapeToG994p1Status        (kFirstDslStatusCode + 4)
19927 +#define        kDslFrameStatus                         (kFirstDslStatusCode + 5)
19928 +#define kDslReceivedEocCommand         (kFirstDslStatusCode + 6)
19929 +#define kDslSendEocCommandDone         (kFirstDslStatusCode + 7)
19930 +#define kDslSendEocCommandFailed       (kFirstDslStatusCode + 8)
19931 +#define kDslWriteRemoteRegisterDone    (kFirstDslStatusCode + 9)
19932 +#define kDslReadRemoteRegisterDone     (kFirstDslStatusCode + 10)
19933 +#define        kDslExternalError                       (kFirstDslStatusCode + 11)
19934 +#define kDslDspControlStatus           (kFirstDslStatusCode + 12)
19935 +#define kDslATUHardwareAGCRequest      (kFirstDslStatusCode + 13)
19936 +#define        kDslPacketStatus                        (kFirstDslStatusCode + 14)
19937 +#define        kDslG997Status                          (kFirstDslStatusCode + 15)
19938 +#define        kDslPrintfStatus                        (kFirstDslStatusCode + 16)
19939 +#define        kDslPrintfStatus1                       (kFirstDslStatusCode + 17)
19940 +#define        kDslExceptionStatus                     (kFirstDslStatusCode + 18)
19941 +#define        kDslPingResponse                        (kFirstDslStatusCode + 19)
19942 +#define        kDslShowtimeSNRMarginInfo       (kFirstDslStatusCode + 20)
19943 +#define        kDslGetOemParameter                     (kFirstDslStatusCode + 21)
19944 +#define        kDslOemDataAddrStatus           (kFirstDslStatusCode + 22)
19945 +#define        kDslDataAvailStatus                     (kFirstDslStatusCode + 23)
19946 +/* #define kDslAtuChangeTxFilterRequest (kFirstDslStatusCode + 24) */
19947 +#define kDslTestPllPhaseResult      (kFirstDslStatusCode + 25)
19948 +#ifdef BCM6348_SRC
19949 +#define kDslHardwareAGCSetPga1      (kFirstDslStatusCode + 26)
19950 +#define kDslHardwareAGCDecPga1      (kFirstDslStatusCode + 27)
19951 +#define kDslHardwareAGCIncPga1      (kFirstDslStatusCode + 28)
19952 +#define kDslHardwareAGCSetPga2Delta (kFirstDslStatusCode + 29)
19953 +#endif
19954 +#define        kDslOLRRequestStatus            (kFirstDslStatusCode + 30)
19955 +#define        kDslOLRResponseStatus           (kFirstDslStatusCode + 31)
19956 +#define        kDslOLRBitGainUpdateStatus      (kFirstDslStatusCode + 32)
19957 +#define        kDslPwrMgrStatus                    (kFirstDslStatusCode + 33)
19958 +#define        kDslEscapeToT1p413Status        (kFirstDslStatusCode + 34)
19959 +#ifdef BCM6348_SRC
19960 +#define kDslHardwareAGCSetPga2      (kFirstDslStatusCode + 35)
19961 +#define kDslHardwareGetRcvAGC       (kFirstDslStatusCode + 36)
19962 +#endif
19963 +#define kDslUpdateXmtReadPtr        (kFirstDslStatusCode + 37)
19964 +#define kDslHardwareSetRcvAGC       (kFirstDslStatusCode + 38)
19965 +#ifdef BCM6348_SRC
19966 +#define kDslSetDigUsPwrCutback      (kFirstDslStatusCode + 39)
19967 +#endif
19968 +
19969 +#define        kClientSideInitiation           0
19970 +#define        kClientSideRespond                      1
19971 +#define        kCentralSideInitiation          2
19972 +#define        kCentralSideRespond                     3
19973 +
19974 +/* OEM parameter ID definition */
19975 +
19976 +#define        kDslOemG994VendorId                     1
19977 +#define        kDslOemG994XmtNSInfo            2
19978 +#define        kDslOemG994RcvNSInfo            3
19979 +#define        kDslOemEocVendorId                      4
19980 +#define        kDslOemEocVersion                       5
19981 +#define        kDslOemEocSerNum                        6
19982 +#define        kDslOemT1413VendorId            7
19983 +#define        kDslOemT1413EocVendorId         8
19984 +
19985 +typedef long   dslErrorCode;
19986 +
19987 +typedef long   atmStatusCode;
19988 +typedef long   dslFramerStatusCode;
19989 +
19990 +typedef long   atmErrorCode;
19991 +
19992 +typedef long   dslTrainingStatusCode;
19993 +
19994 +#define kDslStartedG994p1                                      0
19995 +#define kDslStartedT1p413HS                                    1
19996 +
19997 +/* reserved for G.994.1: 1 ~ 8 */
19998 +
19999 +#define        kDslG994p1MessageDet                            100
20000 +#define        kDslG994p1ToneDet                                       101
20001 +#define        kDslG994p1RToneDet                                      102
20002 +#define        kDslG994p1FlagDet                                       103
20003 +#define        kDslG994p1GalfDet                                       104
20004 +#define        kDslG994p1ErrorFrameDet                         105
20005 +#define        kDslG994p1BadFrameDet                           106
20006 +#define        kDslG994p1SilenceDet                            107
20007 +#define        kDslG994p1RcvTimeout                            108
20008 +#define        kDslG994p1XmtFinished                           109
20009 +#define        kDslG994p1ReturntoStartup                       110
20010 +#define        kDslG994p1InitiateCleardown                     111
20011 +#define        kDslG994p1StartupFinished                       112
20012 +#define        kDslG994p1RcvNonStandardInfo            113
20013 +#define        kDslG994p1XmtNonStandardInfo            114
20014 +
20015 +#define        kG994p1MaxNonstdMessageLength           64
20016 +
20017 +#define kDslFinishedT1p413                                     1100
20018 +#define kDslT1p413DetectedCTone                                1101
20019 +#define kDslT1p413DetectedCAct                         1102
20020 +#define kDslT1p413DetectedCReveille                    1103
20021 +#define kDslT1p413DetectedRActReq                      1104
20022 +#define kDslT1p413DetectedRQuiet1                      1105
20023 +#define kDslT1p413DetectedRAct                         1106
20024 +#define kDslT1p413TimeoutCReveille                     1107
20025 +#define        kDslT1p413ReturntoStartup                       1108
20026 +
20027 +#define        kDslG994p1Timeout                                       8
20028 +#define kDslFinishedG994p1                                     9
20029 +#define kDslStartedG992p2Training                      10
20030 +#define        kDslG992p2DetectedPilotSymbol           11
20031 +#define        kDslG992p2DetectedReverbSymbol          12
20032 +#define        kDslG992p2TEQCalculationDone            13
20033 +#define        kDslG992p2TrainingFEQ                           14
20034 +#define        kDslG992p2Phase3Started                         15
20035 +#define        kDslG992p2ReceivedRates1                        16
20036 +#define        kDslG992p2ReceivedMsg1                          17
20037 +#define        kDslG992p2Phase4Started                         18
20038 +#define        kDslG992p2ReceivedRatesRA                       19
20039 +#define        kDslG992p2ReceivedMsgRA                         20
20040 +#define        kDslG992p2ReceivedRates2                        21
20041 +#define        kDslG992p2ReceivedMsg2                          22
20042 +#define        kDslG992p2ReceivedBitGainTable          23
20043 +#define        kDslG992p2TxShowtimeActive                      24
20044 +#define        kDslG992p2RxShowtimeActive                      25
20045 +#define        kDslG992p2TxAocMessage                          26
20046 +#define        kDslG992p2RxAocMessage                          27
20047 +#define        kDslG992p2TxEocMessage                          28
20048 +#define        kDslG992p2RxEocMessage                          29
20049 +#define kDslFinishedG992p2Training                     30
20050 +#define        kDslRecoveredFromImpulseNoise           31
20051 +#define        kDslG992Timeout                                         32
20052 +#define        kDslT1p413Isu1SglByteSymDetected        33      /* detected T1.413 Issue 1 single byte per symbol mode */
20053 +#define        kDslG992RxPrefixOnInAFewSymbols         34
20054 +#define        kDslG992TxPrefixOnInAFewSymbols         35
20055 +#define        kDslAnnexCXmtCPilot1Starting            36
20056 +#define        kDslXmtToRcvPathDelay                           37
20057 +#define kDslFeaturesUnsupported                                38
20058 +#define        kDslG992RcvMsgCrcError                          39
20059 +#define        kDslAnnexCDetectedStartHyperframe       40
20060 +
20061 +#define kDslG992AnnexCTimeoutCPilot1Detection  41
20062 +#define kDslG992AnnexCTimeoutCReverb1Detection 42
20063 +#define kDslG992AnnexCTimeoutECTraining                        43
20064 +#define kDslG992AnnexCTimeoutHyperframeDetector        44
20065 +#define kDslG992AnnexCTimeoutSendRSegue2               45
20066 +#define kDslG992AnnexCTimeoutDetectCSegue1             46
20067 +#define kDslG992AnnexCAlignmentErrDetected             47
20068 +#define kDslG992AnnexCTimeoutSendRSegueRA              48
20069 +#define kDslG992AnnexCTimeoutSendRSegue4               49
20070 +#define kDslG992AnnexCTimeoutCSegue2Detection  50
20071 +#define kDslG992AnnexCTimeoutCSegue3Detection  51
20072 +/* Progress report for fast retrain */
20073 +
20074 +#define        kG994p1EventToneDetected                                54
20075 +#define        kDslG992p2RcvVerifiedBitAndGain         55
20076 +#define        kDslG992p2ProfileChannelResponseCalc    56
20077 +#define kDslG992AnnexCTotalFEXTBits                            57
20078 +#define kDslG992AnnexCTotalNEXTBits                            58
20079 +#define kDslG992AnnexCTotalFEXTCarrs                   59
20080 +#define kDslG992AnnexCTotalNEXTCarrs                   60
20081 +
20082 +#define        kDslG992p3ReceivedMsgFmt                                61
20083 +#define        kDslG992p3ReceivedMsgPcb                                62
20084 +
20085 +#define        kDslG992p3AnnexLMode                                    63
20086 +
20087 +/* performance monitoring report */
20088 +
20089 +#define        kG992DataRcvDetectFastRSCorrection                              70
20090 +#define        kG992DataRcvDetectInterleaveRSCorrection                71
20091 +#define        kG992DataRcvDetectFastCRCError                                  72
20092 +#define        kG992DataRcvDetectInterleaveCRCError                    73
20093 +#define        kG992DataRcvDetectFastRSError                                   74
20094 +#define        kG992DataRcvDetectInterleaveRSError                             75
20095 +#define        kG992DataRcvDetectLOS                                                   76
20096 +#define        kG992DecoderDetectRDI                                                   77
20097 +#define        kG992DataRcvDetectLOSRecovery                                   78
20098 +#define        kG992AtmDetectHEC                                                               79
20099 +#define        kG992AtmDetectOCD                                                               180
20100 +#define        kG992AtmDetectCD                                                                181
20101 +#define        kG992DecoderDetectRemoteLOS                                             182
20102 +#define        kG992DecoderDetectRemoteLOSRecovery                             183
20103 +#define        kG992DecoderDetectRemoteRDI                                             184
20104 +#define        kG992DecoderDetectRemoteRDIRecovery                             185
20105 +#define        kG992RcvDetectSyncSymbolOffset                                  186
20106 +#define        kG992Upstream2xIfftDisabled                                             187
20107 +#if defined(G992P5)
20108 +#define        kDslG992RunAnnexaP3ModeInAnnexaP5                       188      /* run Annex C mode in Annex I compiled codes */
20109 +#else
20110 +#define        kDslG992RunAnnexCModeInAnnexI                           188      /* run Annex C mode in Annex I compiled codes */
20111 +#endif
20112 +
20113 +/* OLR PHY status */
20114 +
20115 +#define        kG992EventSynchSymbolDetected                                   189
20116 +#define        kG992EventReverseSynchSymbolDetected                    190
20117 +#define        kG992EventL2CReverbSymbolDetected                               191
20118 +#define        kG992EventL2CSegueSymbolDetected                                192
20119 +
20120 +/* ANNEX_M */
20121 +#define kG992EnableAnnexM                               191
20122 +
20123 +#define kDslAtuChangeTxFilterRequest                                   192
20124 +
20125 +/* detailed error messages reports */
20126 +
20127 +#define        kDslG992XmtRReverbRAOver4000                    80
20128 +#define        kDslG992XmtRReverb5Over4000                             81
20129 +#define        kDslG992RcvCSegue2Failed                                82
20130 +#define        kDslG992RcvCSegueRAFailed                               83
20131 +#define        kDslG992RcvCSegue3Failed                                84
20132 +#define        kDslG992RcvShowtimeStartedTooLate               85
20133 +#define        kDslG992XmtRReverb3Over4000                             86
20134 +#define        kDslG992RcvFailDetCSegue1InWindow               87
20135 +#define        kDslG992RcvCPilot1Failed                                88
20136 +#define        kDslG992RcvCReverb1Failed                               89
20137 +#define        kG992ControlAllRateOptionsFailedErr             90
20138 +#define        kG992ControlInvalidRateOptionErr                91
20139 +#define        kDslG992XmtInvalidXmtDErr                               92
20140 +#define        kDslG992BitAndGainCalcFailed                    93
20141 +#define        kDslG992BitAndGainVerifyFailed                  94
20142 +
20143 +#define        kDslT1p413RetrainToUseCorrectRAck               95
20144 +#define        kDslUseAlternateTxFilter                                96
20145 +#define        kDslT1p413RetrainToUseCorrectIFFT               97
20146 +
20147 +typedef        long    dslConnectInfoStatusCode;
20148 +#define        kG992p2XmtToneOrderingInfo                      0
20149 +#define        kG992p2RcvToneOrderingInfo                      1
20150 +#define        kG992p2XmtCodingParamsInfo                      2
20151 +#define        kG992p2RcvCodingParamsInfo                      3
20152 +#define        kG992p2TrainingRcvCarrEdgeInfo          4
20153 +#define        kG992ShowtimeMonitoringStatus           5
20154 +#define        kG992MessageExchangeRcvInfo                     6
20155 +#define        kG992MessageExchangeXmtInfo                     7
20156 +#define        kG994MessageExchangeRcvInfo                     8
20157 +#define        kG994MessageExchangeXmtInfo                     9
20158 +
20159 +#define        kDslATURClockErrorInfo                          10
20160 +#define        kDslATURcvPowerInfo                                     11
20161 +#define        kDslATUAvgLoopAttenuationInfo           12
20162 +#define        kDslHWTimeTrackingResetClockError       13
20163 +#define        kDslHWTimeTrackingClockTweak            14
20164 +#define kDslATUHardwareAGCObtained                     15
20165 +#define        kDslTEQCoefInfo                                         16
20166 +#define        kDslRcvCarrierSNRInfo                           17
20167 +#define        kDslMaxReceivableBitRateInfo            18
20168 +#define kDslHWSetDigitalEcUpdateMode           19
20169 +#define kDslHWEnableDigitalECUpdate                    20
20170 +#define kDslHWDisableDigitalECUpdate           21
20171 +#define kDslHWEnableDigitalEC                          22
20172 +#define kDslHWSetDigitalEcGainShift                    23
20173 +#define kDslHWSetDigitalEcUpdateShift          24
20174 +#define        kDslRcvPsdInfo                                          25
20175 +#define        kDslHWdcOffsetInfo                                      26
20176 +#define        kG994SelectedG994p1CarrierIndex         27
20177 +#define        kDslSelectedTimingTone                          28
20178 +
20179 +#define        kDslHWEnableAnalogECUpdate                      kDslHWSetDigitalEcUpdateMode    
20180 +#define        kDslHWEnableAnalogEC                            kDslHWDisableDigitalECUpdate
20181 +
20182 +#define        kG992AocMessageExchangeRcvInfo          29
20183 +#define        kG992AocMessageExchangeXmtInfo          30
20184 +#define        kG992AocBitswapTxStarted                        31
20185 +#define        kG992AocBitswapRxStarted                        32
20186 +#define        kG992AocBitswapTxCompleted                      33
20187 +#define        kG992AocBitswapRxCompleted                      34
20188 +#define kDslChannelResponseLog                         35
20189 +#define kDslChannelResponseLinear                      36
20190 +#define kDslChannelQuietLineNoise                      37
20191 +
20192 +#define        kDslATUCXmtPowerCutbackInfo                     40
20193 +#define        kDslATURXmtPowerCutbackInfo                     41
20194 +#define        kDslATUCXmtPowerInfo                            42
20195 +#define        kDslATURXmtPowerInfo                            43
20196 +
20197 +#define        kDslFramingModeInfo                                     50
20198 +#define        kDslG992VendorID                                        51
20199 +
20200 +#ifdef BCM6348_SRC
20201 +#define kDslHWSetRcvFir2OutputScale                    52
20202 +#endif
20203 +
20204 +#define kDslSignalAttenuation               53
20205 +#define kDslAttainableNetDataRate           54
20206 +#define kDslHLinScale                       55
20207 +
20208 +#define        kG992p3XmtCodingParamsInfo                      60
20209 +#define        kG992p3RcvCodingParamsInfo                      61
20210 +#define        kG992p3PwrStateInfo                                     62
20211 +#define        kG992PilotToneInfo                                      63
20212 +
20213 +#define kDslSetPilotEyeDisplay              64
20214 +
20215 +#define kDslAturHwAgcResolutionMask                    (0xFFFFFFF8)
20216 +#define kDslAturHwAgcMinGain                           ((-12)<<4)
20217 +#ifndef BCM6348_SRC
20218 +#define kDslAturHwAgcMaxGain                           (30<<4)
20219 +#else
20220 +#define kDslAturHwAgcMaxGain                           (36<<4)
20221 +#endif
20222 +
20223 +#define        kDslFrameStatusSend                                     1
20224 +#define        kDslFrameStatusSendComplete                     2
20225 +#define        kDslFrameStatusRcv                                      3
20226 +#define        kDslFrameStatusReturn                           4
20227 +
20228 +typedef struct _dslFramerStatus
20229 +       {
20230 +       dslFramerStatusCode             code;
20231 +       union
20232 +               {
20233 +               long                            value;
20234 +               dslErrorCode            error;
20235 +               struct
20236 +                       {
20237 +                       long    length;
20238 +                       uchar   *framePtr;
20239 +                       } frame;
20240 +               struct
20241 +                       {
20242 +                       long    nRxFrameTotal;
20243 +                       long    nRxFrameError;
20244 +                       long    nTxFrameTotal;
20245 +                       } statistic;
20246 +               } param;
20247 +       } dslFramerStatus;
20248 +
20249 +typedef        struct
20250 +       {
20251 +       dslStatusCode                                   code;
20252 +       union
20253 +               {
20254 +               long                                            value;
20255 +               dslErrorCode                            error;
20256 +               struct
20257 +                       {
20258 +                       atmStatusCode                   code;
20259 +                       union
20260 +                               {
20261 +                               long                            value;
20262 +                               dslErrorCode            error;
20263 +                               struct
20264 +                                       {
20265 +                                       long    vci;
20266 +                                       long    mid;
20267 +                                       long    aalType;
20268 +                                       long    length;
20269 +                                       uchar   *framePtr;
20270 +                                       } frame;
20271 +                               struct
20272 +                                       {
20273 +                                       long    nFrames;
20274 +                                       long    nFrameErrors;
20275 +                                       } statistic;
20276 +                               struct
20277 +                                       {
20278 +                                       long    vcId;
20279 +                                       long    vci;
20280 +                                       long    aalType;
20281 +                                       ulong   fwdPeakCellTime;
20282 +                                       ulong   backPeakCellTime;
20283 +                                       } vcInfo;
20284 +                               struct
20285 +                                       {
20286 +                                       long    cellHdr;
20287 +                                       long    oamCmd;
20288 +                                       } oamInfo;
20289 +                               struct 
20290 +                                       {
20291 +                                       void    *pVc;
20292 +                                       char    *pHdr;
20293 +                                       void    *cellHdr;
20294 +                                       void    *cellData;
20295 +                                       } cellInfo;
20296 +                               struct 
20297 +                                       {
20298 +                                       long    totalBits;
20299 +                                       long    errBits;
20300 +                                       } bertInfo;
20301 +                               } param;                        
20302 +                       } atmStatus;
20303 +#ifdef DSL_PACKET
20304 +               dslFramerStatus         dslPacketStatus;
20305 +#endif
20306 +#ifdef G997_1_FRAMER
20307 +               dslFramerStatus         g997Status;
20308 +#endif
20309 +               struct
20310 +                       {
20311 +                       dslTrainingStatusCode           code;
20312 +                       long                                            value;
20313 +                       } dslTrainingInfo;
20314 +               struct
20315 +                       {
20316 +                       dslConnectInfoStatusCode        code;
20317 +                       long                                            value;
20318 +                       void                                            *buffPtr;
20319 +                       } dslConnectInfo;
20320 +               struct
20321 +                       {
20322 +                       long                                            maxMarginCarrier;
20323 +                       long                                            maxSNRMargin;
20324 +                       long                                            minMarginCarrier;
20325 +                       long                                            minSNRMargin;
20326 +                       long                                            avgSNRMargin;
20327 +                       long                                            nCarriers;
20328 +                       void                                            *buffPtr;
20329 +                       } dslShowtimeSNRMarginInfo;
20330 +               struct 
20331 +                       {
20332 +                       long                                            code;
20333 +                       long                                            vcId;
20334 +                       long                                            timeStamp;
20335 +                       } dslFrameInfo;
20336 +#ifdef G997_1
20337 +               struct
20338 +                       {
20339 +                       long    msgId;
20340 +                       long    msgType;
20341 +                       char    *dataPtr;
20342 +                       } dslClearEocMsg;
20343 +#endif
20344 +               struct
20345 +                       {
20346 +                       char    *fmt;
20347 +                       long    argNum;
20348 +                       void    *argPtr;
20349 +                       } dslPrintfMsg;
20350 +               struct
20351 +                       {
20352 +                       ulong   nBits;
20353 +                       ulong   nBlocks;
20354 +                       ulong   nBitErrors;
20355 +                       ulong   nBlockErrors;
20356 +
20357 +                       ulong   nAudioBits;
20358 +                       ulong   nAudioBlocks;
20359 +                       ulong   nAudioSyncErrors;
20360 +                       ulong   nAudioBlockErrors;
20361 +                       } testResults;
20362 +               struct
20363 +                       {
20364 +                       ulong   code;
20365 +                       uchar   *valuePtr;
20366 +                       ulong   length;
20367 +                       } dslDataRegister;
20368 +               struct
20369 +                       {
20370 +                       ulong   code;
20371 +                       char    *desc;
20372 +                       } dslExternalError;
20373 +               struct
20374 +                       {
20375 +                       ulong   numberOfCalls;
20376 +                       ulong   txSignalChecksum;
20377 +                       ulong   rxSignalChecksum;
20378 +                       ulong   eyeDataChecksum;
20379 +                       } checksums;
20380 +               struct
20381 +                       {
20382 +                       int             sp;
20383 +                       int             argc;
20384 +                       int             *argv;
20385 +                       int             *stackPtr;
20386 +                       int             stackLen;
20387 +                       } dslException;
20388 +               struct
20389 +                       {
20390 +                       ulong   paramId;
20391 +                       void    *dataPtr;
20392 +                       ulong   dataLen;
20393 +                       } dslOemParameter;
20394 +               struct
20395 +                       {
20396 +                       void    *dataPtr;
20397 +                       ulong   dataLen;
20398 +                       } dslDataAvail;
20399 +               dslOLRMessage           dslOLRRequest;
20400 +               dslPwrMessage           dslPwrMsg;
20401 +               } param;
20402 +       } dslStatusStruct;
20403 +       
20404 +typedef        void    (SM_DECL *dslStatusHandlerType)         (void *gDslVars, dslStatusStruct*);
20405 +
20406 +
20407 +/*
20408 +**
20409 +**             Command codes 
20410 +**
20411 +*/
20412 +
20413 +typedef long                                           dslCommandCode;
20414 +#define        kFirstDslCommandCode            256
20415 +#define kDslIdleCmd                                    (kFirstDslCommandCode + 0)
20416 +#define kDslIdleRcvCmd                         (kFirstDslCommandCode + 1)
20417 +#define kDslIdleXmtCmd                         (kFirstDslCommandCode + 2)
20418 +#define        kDslStartPhysicalLayerCmd       (kFirstDslCommandCode + 3)
20419 +#define        kDslStartRetrainCmd                     (kFirstDslCommandCode + 4)
20420 +#define        kDslSetFrameFunctions           (kFirstDslCommandCode + 5)
20421 +#define kDslSendEocCommand                     (kFirstDslCommandCode + 6)
20422 +#define kDslWriteRemoteRegister                (kFirstDslCommandCode + 7)
20423 +#define kDslReadRemoteRegister         (kFirstDslCommandCode + 8)
20424 +#define kDslWriteLocalRegister         (kFirstDslCommandCode + 9)
20425 +#define kDslReadLocalRegister          (kFirstDslCommandCode + 10)
20426 +#define        kDslStoreHardwareAGCCmd         (kFirstDslCommandCode + 11)
20427 +#define kDslSetCommandHandlerCmd       (kFirstDslCommandCode + 12)
20428 +#define kSetLinkLayerStatusHandlerCmd (kFirstDslCommandCode + 13)
20429 +#define kDslSetG997Cmd                         (kFirstDslCommandCode + 14)
20430 +#define kDslLoopbackCmd                                (kFirstDslCommandCode + 15)
20431 +#define kDslDiagSetupCmd                       (kFirstDslCommandCode + 16)
20432 +#define kDslSetDriverCallbackCmd       (kFirstDslCommandCode + 17)
20433 +#define kDslDiagStopLogCmd                     (kFirstDslCommandCode + 18)
20434 +#define kDslDiagStartBERT                      (kFirstDslCommandCode + 19)
20435 +#define kDslDiagStopBERT                       (kFirstDslCommandCode + 20)
20436 +#define kDslPingCmd                                    (kFirstDslCommandCode + 21)
20437 +#define kDslDyingGaspCmd                       (kFirstDslCommandCode + 22)
20438 +#define kDslTestCmd                                    (kFirstDslCommandCode + 23)
20439 +#define kDslFilterSNRMarginCmd         (kFirstDslCommandCode + 24)
20440 +#define kDslAtmVcMapTableChanged       (kFirstDslCommandCode + 25)
20441 +#define        kDslGetOemDataAddrCmd           (kFirstDslCommandCode + 26)
20442 +#define kDslAtmReportHEC                       (kFirstDslCommandCode + 27)
20443 +#define kDslAtmReportCD                                (kFirstDslCommandCode + 28)
20444 +#define kDslSetXmtGainCmd                      (kFirstDslCommandCode + 29)
20445 +#define kDslSetStatusBufferCmd         (kFirstDslCommandCode + 30)
20446 +#define kDslAfeTestCmd                         (kFirstDslCommandCode + 31)
20447 +#define kDslI432ResetCmd                       (kFirstDslCommandCode + 32)
20448 +#define kDslSetRcvGainCmd           (kFirstDslCommandCode + 33)
20449 +#define kDslBypassRcvHpfCmd         (kFirstDslCommandCode + 34)
20450 +#define kDslWriteAfeRegCmd          (kFirstDslCommandCode + 35)
20451 +#define kDslReadAfeRegCmd           (kFirstDslCommandCode + 36)
20452 +#define        kDslOLRRequestCmd                       (kFirstDslCommandCode + 37)
20453 +#define        kDslOLRResponseCmd                      (kFirstDslCommandCode + 38)
20454 +#define kDslI432SetScrambleCmd         (kFirstDslCommandCode + 39)
20455 +#define        kDslPwrMgrCmd                           (kFirstDslCommandCode + 40)
20456 +#define kDslAtmGfcMappingCmd           (kFirstDslCommandCode + 41)
20457 +
20458 +#ifdef BCM6348_SRC
20459 +#define kDslEnablePwmSyncClk        (kFirstDslCommandCode + 42)
20460 +#define kDslSetPwmSyncClkFreq       (kFirstDslCommandCode + 43)
20461 +#endif
20462 +
20463 +#define        kG994p1Duplex                                                           1
20464 +#define        kG994p1HalfDuplex                                                       2
20465 +
20466 +/* Eoc Messages from ATU-C to ATU-R */
20467 +#define kDslEocHoldStateCmd                                            1
20468 +#define kDslEocReturnToNormalCmd                               2
20469 +#define kDslEocPerformSelfTestCmd                              3
20470 +#define kDslEocRequestCorruptCRCCmd                            4
20471 +#define kDslEocRequestEndCorruptCRCCmd                 5
20472 +#define kDslEocNotifyCorruptCRCCmd                             6
20473 +#define kDslEocNotifyEndCorruptCRCCmd                  7
20474 +#define kDslEocRequestTestParametersUpdateCmd  8
20475 +#define kDslEocGrantPowerDownCmd                               9
20476 +#define kDslEocRejectPowerDownCmd                              10
20477 +
20478 +/* Eoc Messages  from ATU-R to ATU-C */
20479 +#define kDslEocRequestPowerDownCmd                             11
20480 +#define kDslEocDyingGaspCmd                                            12
20481 +
20482 +/* Clear Eoc Messages  */
20483 +#define kDslClearEocFirstCmd                                   100
20484 +#define kDslClearEocSendFrame                                  100
20485 +#define kDslClearEocSendComplete                               101
20486 +#define kDslClearEocRcvedFrame                                 102
20487 +#define kDslClearEocSendComplete2                              103
20488 +
20489 +#define kDslClearEocMsgLengthMask                              0xFFFF
20490 +#define kDslClearEocMsgNumMask                                 0xFF0000
20491 +#define kDslClearEocMsgDataVolatileMask                        0x1000000
20492 +#define kDslClearEocMsgDataVolatile                            kDslClearEocMsgDataVolatileMask
20493 +#define kDslClearEocMsgExtraSendComplete               0x2000000
20494 +
20495 +/* ADSL Link Power States */
20496 +#define kDslPowerFullOn                                                0
20497 +#define kDslPowerLow                                           1
20498 +#define kDslPowerIdle                                          3
20499 +
20500 +/* ATU-R Data Registers */
20501 +#define kDslVendorIDRegister                           1
20502 +#define kDslRevisionNumberRegister                     2
20503 +#define kDslSerialNumberRegister                       3
20504 +#define kDslSelfTestResultsRegister                    4
20505 +#define kDslLineAttenuationRegister                    5
20506 +#define kDslSnrMarginRegister                          6
20507 +#define kDslAturConfigurationRegister          7
20508 +#define kDslLinkStateRegister                          8
20509 +
20510 +#define kDslVendorIDRegisterLength                     8
20511 +#define kDslRevisionNumberRegisterLength       32
20512 +#define kDslSerialNumberRegisterLength         32
20513 +#define kDslSelfTestResultsRegisterLength      1
20514 +#define kDslLineAttenuationRegisterLength      1
20515 +#define kDslSnrMarginRegisterLength                    1
20516 +#define kDslAturConfigurationRegisterLength    30
20517 +#define kDslLinkStateRegisterLength                    1
20518 +
20519 +/* Dsl Diags setup flags */
20520 +#define kDslDiagEnableEyeData                          1
20521 +#define kDslDiagEnableLogData                          2
20522 +
20523 +/* Dsl test commands */
20524 +typedef        long                                                            dslTestCmdType;
20525 +#define        kDslTestBackToNormal                            0
20526 +#define kDslTestReverb                                         1
20527 +#define kDslTestMedley                                         2
20528 +#define kDslTestToneSelection                          3
20529 +#define        kDslTestNoAutoRetrain                           4
20530 +#define        kDslTestMarginTweak                                     5
20531 +#define kDslTestEstimatePllPhase            6
20532 +#define kDslTestReportPllPhaseStatus        7
20533 +#define kDslTestAfeLoopback                                    8
20534 +#define kDslTestL3                                                     9
20535 +#define kDslTestAdsl2DiagMode                          10
20536 +#define kDslTestRetL0                                          11
20537 +
20538 +/* Xmt gain default setting */
20539 +#define        kDslXmtGainAuto                                         0x80000000
20540 +
20541 +/* Unit (AFE) test commands */
20542 +#define        kDslAfeTestLoadImage                            0
20543 +#define        kDslAfeTestPatternSend                          1
20544 +#define        kDslAfeTestLoadImageOnly                        2
20545 +#define        kDslAfeTestPhyRun                                       3
20546 +#define        kDslAfeTestLoadBuffer                           4
20547 +
20548 +typedef struct
20549 +       {
20550 +#if defined(G992P1_ANNEX_I) || defined(G992P5) 
20551 +       ushort                          downstreamMinCarr, downstreamMaxCarr;
20552 +#else
20553 +       uchar                           downstreamMinCarr, downstreamMaxCarr;
20554 +#endif
20555 +       uchar                   upstreamMinCarr, upstreamMaxCarr;
20556 +       }carrierInfo;
20557 +
20558 +#if defined(G992P3) && !defined(BCM6348_SRC) 
20559 +#define        FAST_TEXT_TYPE
20560 +#else
20561 +#define        FAST_TEXT_TYPE                  FAST_TEXT
20562 +#endif
20563 +
20564 +#if defined(BCM6348_SRC) 
20565 +#define BCM6348_TEMP_MOVE_TO_LMEM 
20566 +#else
20567 +#define BCM6348_TEMP_MOVE_TO_LMEM
20568 +#endif
20569 +
20570 +#ifdef G992P3
20571 +#define        PRINT_DEBUG_INFO
20572 +#else
20573 +#define        PRINT_DEBUG_INFO
20574 +#endif
20575 +
20576 +#ifdef G992P3
20577 +
20578 +#define                kG992p3MaxSpectBoundsUpSize             16
20579 +#define                kG992p3MaxSpectBoundsDownSize   16
20580 +
20581 +/* G.994 definitions */
20582 +
20583 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 1 ***/
20584 +
20585 +#define        kG994p1G992p3AnnexASpectrumBoundsUpstream       0x01
20586 +#define        kG994p1G992p3AnnexASpectrumShapingUpstream      0x02
20587 +#define        kG994p1G992p3AnnexASpectrumBoundsDownstream     0x04
20588 +#define        kG994p1G992p3AnnexASpectrumShapingDownstream    0x08
20589 +#define        kG994p1G992p3AnnexATxImageAboveNyquistFreq      0x10
20590 +#define        kG994p1G992p3AnnexLReachExtended                        0x20
20591 +#define kG994p1G992p3AnnexMSubModePSDMasks          0x20
20592 +
20593 +#define        kG994p1G992p3AnnexLUpNarrowband                         0x02
20594 +#define        kG994p1G992p3AnnexLUpWideband                           0x01
20595 +#define        kG994p1G992p3AnnexLDownNonoverlap                       0x01
20596 +
20597 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 2 ***/
20598 +
20599 +#define        kG994p1G992p3AnnexADownOverheadDataRate         0x01
20600 +#define        kG994p1G992p3AnnexAUpOverheadDataRate           0x02
20601 +#define        kG994p1G992p3AnnexAMaxNumberDownTPSTC           0x04
20602 +#define        kG994p1G992p3AnnexAMaxNumberUpTPSTC                     0x08
20603 +
20604 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 3,5,7,9 ***/
20605 +
20606 +#define        kG994p1G992p3AnnexADownSTM_TPS_TC                       0x01
20607 +#define        kG994p1G992p3AnnexAUpSTM_TPS_TC                         0x02
20608 +#define        kG994p1G992p3AnnexADownATM_TPS_TC                       0x04
20609 +#define        kG994p1G992p3AnnexAUpATM_TPS_TC                         0x08
20610 +#define        kG994p1G992p3AnnexADownPTM_TPS_TC                       0x10
20611 +#define        kG994p1G992p3AnnexAUpPTM_TPS_TC                         0x20
20612 +
20613 +/*** Standard Info SPar2:  G.992.3 Annex A  Octet 4,6,8,10 ***/
20614 +
20615 +#define        kG994p1G992p3AnnexADownPMS_TC_Latency           0x01
20616 +#define        kG994p1G992p3AnnexAUpPMS_TC_Latency                     0x02
20617 +
20618 +/*** 
20619 + *   TSSI
20620 + *
20621 + *   TSSI information is specified in 2 parts: subcarrier index,
20622 + *   tssi value, and an indication of whether or no the tone specified
20623 + *   is part of the supported set.
20624 + *
20625 + *   The subcarrier index information is currently stored in the
20626 + *   dsSubcarrierIndex array defined below. The tssi value are stored
20627 + *   in the dsLog_tss array.
20628 + *
20629 + *   The subcarrier index information only occupies the lower 12 bits
20630 + *   of the available 16 bits (short type). Therefore, we will pack the
20631 + *   supported set information in bit 15.
20632 + */
20633 +#define kG992DsSubCarrierIndexMask          (0x0fff)   /* AND mask to ectract ds subcarrier index */
20634 +#define kG992DsSubCarrierSuppSetMask        (0x8000)   /* AND mask to extract supported set indication */
20635 +
20636 +#define G992GetDsSubCarrierIndex(arg)               ((arg)  & kG992DsSubCarrierIndexMask)
20637 +#define G992GetDsSubCarrierSuppSetIndication(arg)   (((arg) & kG992DsSubCarrierSuppSetMask) >> 15)
20638 +
20639 +/* Caution: Do not change anything in this structure definition, including associated constant */
20640 +/* This structure definition is used only by the driver and any change impose incompatibility issue in driver */
20641 +/* The structure following this structure (g992p3PhyDataPumpCapabilities) can be changed in PHY application */
20642 +
20643 +typedef struct
20644 +       {
20645 +       Boolean                         rcvNTREnabled, shortInitEnabled, diagnosticsModeEnabled;
20646 +       
20647 +       char                            featureSpectrum, featureOverhead;
20648 +       char                            featureTPS_TC[4], featurePMS_TC[4];
20649 +       
20650 +       short                           rcvNOMPSDus, rcvMAXNOMPSDus, rcvMAXNOMATPus;
20651 +       short                           usSubcarrierIndex[kG992p3MaxSpectBoundsUpSize],
20652 +                                               usLog_tss[kG992p3MaxSpectBoundsUpSize];
20653 +       short                           numUsSubcarrier;
20654 +       short                           rcvNOMPSDds, rcvMAXNOMPSDds, rcvMAXNOMATPds;
20655 +       short                           dsSubcarrierIndex[kG992p3MaxSpectBoundsDownSize],
20656 +                                               dsLog_tss[kG992p3MaxSpectBoundsDownSize];
20657 +       short                           numDsSubcarrier;
20658 +       uchar                           sizeIDFT, fillIFFT;
20659 +       uchar                           readsl2Upstream, readsl2Downstream;
20660 +       uchar                           minDownOverheadDataRate, minUpOverheadDataRate;
20661 +       uchar                           maxDownSTM_TPSTC, maxDownATM_TPSTC, maxDownPTM_TPSTC;
20662 +       uchar                           maxUpSTM_TPSTC, maxUpATM_TPSTC, maxUpPTM_TPSTC;
20663 +
20664 +       short                           minDownSTM_TPS_TC[4], maxDownSTM_TPS_TC[4],
20665 +                                               minRevDownSTM_TPS_TC[4], maxDelayDownSTM_TPS_TC[4];
20666 +       uchar                           maxErrorDownSTM_TPS_TC[4], minINPDownSTM_TPS_TC[4];
20667 +       short                           minUpSTM_TPS_TC[4], maxUpSTM_TPS_TC[4],
20668 +                                               minRevUpSTM_TPS_TC[4], maxDelayUpSTM_TPS_TC[4];
20669 +       uchar                           maxErrorUpSTM_TPS_TC[4], minINPUpSTM_TPS_TC[4];
20670 +
20671 +       short                           maxDownPMS_TC_Latency[4], maxUpPMS_TC_Latency[4];
20672 +       short                           maxDownR_PMS_TC_Latency[4], maxDownD_PMS_TC_Latency[4];
20673 +       short                           maxUpR_PMS_TC_Latency[4], maxUpD_PMS_TC_Latency[4];
20674 +
20675 +       short                           minDownATM_TPS_TC[4], maxDownATM_TPS_TC[4],
20676 +                                               minRevDownATM_TPS_TC[4], maxDelayDownATM_TPS_TC[4];
20677 +       uchar                           maxErrorDownATM_TPS_TC[4], minINPDownATM_TPS_TC[4];
20678 +       short                           minUpATM_TPS_TC[4], maxUpATM_TPS_TC[4],
20679 +                                               minRevUpATM_TPS_TC[4], maxDelayUpATM_TPS_TC[4];
20680 +       uchar                           maxErrorUpATM_TPS_TC[4], minINPUpATM_TPS_TC[4];
20681 +
20682 +       short                           minDownPTM_TPS_TC[4], maxDownPTM_TPS_TC[4],
20683 +                                               minRevDownPTM_TPS_TC[4], maxDelayDownPTM_TPS_TC[4];
20684 +       uchar                           maxErrorDownPTM_TPS_TC[4], minINPDownPTM_TPS_TC[4];
20685 +       short                           minUpPTM_TPS_TC[4], maxUpPTM_TPS_TC[4],
20686 +                                               minRevUpPTM_TPS_TC[4], maxDelayUpPTM_TPS_TC[4];
20687 +       uchar                           maxErrorUpPTM_TPS_TC[4], minINPUpPTM_TPS_TC[4];
20688 +
20689 +    ushort              subModePSDMasks;
20690 +       } g992p3DataPumpCapabilities;
20691 +
20692 +#define                kG992p3p5MaxSpectBoundsUpSize           16
20693 +#define                kG992p3p5MaxSpectBoundsDownSize         32
20694 +
20695 +typedef struct
20696 +       {
20697 +       Boolean                         rcvNTREnabled, shortInitEnabled, diagnosticsModeEnabled;
20698 +       
20699 +       char                            featureSpectrum, featureOverhead;
20700 +       char                            featureTPS_TC[4], featurePMS_TC[4];
20701 +       
20702 +       short                           rcvNOMPSDus, rcvMAXNOMPSDus, rcvMAXNOMATPus;
20703 +       short                           usSubcarrierIndex[kG992p3p5MaxSpectBoundsUpSize],
20704 +                                               usLog_tss[kG992p3p5MaxSpectBoundsUpSize];
20705 +       short                           numUsSubcarrier;
20706 +       short                           rcvNOMPSDds, rcvMAXNOMPSDds, rcvMAXNOMATPds;
20707 +       short                           dsSubcarrierIndex[kG992p3p5MaxSpectBoundsDownSize],
20708 +                                               dsLog_tss[kG992p3p5MaxSpectBoundsDownSize];
20709 +       short                           numDsSubcarrier;
20710 +       uchar                           sizeIDFT, fillIFFT;
20711 +       uchar                           readsl2Upstream, readsl2Downstream;
20712 +       uchar                           minDownOverheadDataRate, minUpOverheadDataRate;
20713 +       uchar                           maxDownSTM_TPSTC, maxDownATM_TPSTC, maxDownPTM_TPSTC;
20714 +       uchar                           maxUpSTM_TPSTC, maxUpATM_TPSTC, maxUpPTM_TPSTC;
20715 +
20716 +       short                           minDownSTM_TPS_TC[4], maxDownSTM_TPS_TC[4],
20717 +                                               minRevDownSTM_TPS_TC[4], maxDelayDownSTM_TPS_TC[4];
20718 +       uchar                           maxErrorDownSTM_TPS_TC[4], minINPDownSTM_TPS_TC[4];
20719 +       short                           minUpSTM_TPS_TC[4], maxUpSTM_TPS_TC[4],
20720 +                                               minRevUpSTM_TPS_TC[4], maxDelayUpSTM_TPS_TC[4];
20721 +       uchar                           maxErrorUpSTM_TPS_TC[4], minINPUpSTM_TPS_TC[4];
20722 +
20723 +       short                           maxDownPMS_TC_Latency[4], maxUpPMS_TC_Latency[4];
20724 +       short                           maxDownR_PMS_TC_Latency[4], maxDownD_PMS_TC_Latency[4];
20725 +       short                           maxUpR_PMS_TC_Latency[4], maxUpD_PMS_TC_Latency[4];
20726 +
20727 +       short                           minDownATM_TPS_TC[4], maxDownATM_TPS_TC[4],
20728 +                                               minRevDownATM_TPS_TC[4], maxDelayDownATM_TPS_TC[4];
20729 +       uchar                           maxErrorDownATM_TPS_TC[4], minINPDownATM_TPS_TC[4];
20730 +       short                           minUpATM_TPS_TC[4], maxUpATM_TPS_TC[4],
20731 +                                               minRevUpATM_TPS_TC[4], maxDelayUpATM_TPS_TC[4];
20732 +       uchar                           maxErrorUpATM_TPS_TC[4], minINPUpATM_TPS_TC[4];
20733 +
20734 +       short                           minDownPTM_TPS_TC[4], maxDownPTM_TPS_TC[4],
20735 +                                               minRevDownPTM_TPS_TC[4], maxDelayDownPTM_TPS_TC[4];
20736 +       uchar                           maxErrorDownPTM_TPS_TC[4], minINPDownPTM_TPS_TC[4];
20737 +       short                           minUpPTM_TPS_TC[4], maxUpPTM_TPS_TC[4],
20738 +                                               minRevUpPTM_TPS_TC[4], maxDelayUpPTM_TPS_TC[4];
20739 +       uchar                           maxErrorUpPTM_TPS_TC[4], minINPUpPTM_TPS_TC[4];
20740 +
20741 +    ushort              subModePSDMasks;
20742 +       } g992p3PhyDataPumpCapabilities;
20743 +#endif
20744 +
20745 +typedef struct
20746 +       {
20747 +       dslModulationType       modulations;
20748 +       bitMap                          auxFeatures;
20749 +       bitMap                  features;       
20750 +       bitMap                          demodCapabilities;
20751 +       bitMap                          demodCapabilities2;
20752 +       ushort                          noiseMargin;            /* Q4 dB */
20753 +#ifdef G992_ATUC
20754 +       short                           xmtRSf, xmtRS, xmtS, xmtD;
20755 +       short                           rcvRSf, rcvRS, rcvS, rcvD;
20756 +#endif 
20757 +#ifdef G992P1_ANNEX_A  
20758 +       bitMap                  subChannelInfo;
20759 +       carrierInfo             carrierInfoG992p1;
20760 +#endif
20761 +#ifdef G992P1_ANNEX_B  
20762 +       bitMap                  subChannelInfoAnnexB;
20763 +       carrierInfo             carrierInfoG992p1AnnexB;
20764 +#endif
20765 +#ifdef G992_ANNEXC     
20766 +       bitMap                  subChannelInfoAnnexC;
20767 +       carrierInfo             carrierInfoG992p1AnnexC;
20768 +#endif
20769 +#if defined(G992P1_ANNEX_I)
20770 +       bitMap                  subChannelInfoAnnexI;
20771 +       carrierInfo             carrierInfoG992p1AnnexI;
20772 +#endif
20773 +#ifdef G992P5
20774 +       bitMap                  subChannelInfop5;
20775 +       carrierInfo             carrierInfoG992p5;
20776 +#endif
20777 +#if defined(G992P2) || (defined(G992P1_ANNEX_A) && defined(G992P1_ANNEX_A_USED_FOR_G992P2))
20778 +       carrierInfo             carrierInfoG992p2;
20779 +#endif
20780 +       ushort                  maxDataRate;
20781 +       uchar                   minDataRate;         
20782 +#ifdef G992P3
20783 +       g992p3DataPumpCapabilities      *carrierInfoG992p3AnnexA;
20784 +#endif
20785 +#ifdef G992P5
20786 +       g992p3DataPumpCapabilities      *carrierInfoG992p5AnnexA;
20787 +#endif
20788 +       } dslDataPumpCapabilities;
20789 +               
20790 +struct __dslCommandStruct;
20791 +typedef        Boolean (*dslCommandHandlerType)        (void *gDslVars, struct __dslCommandStruct*);
20792 +typedef        struct __dslCommandStruct
20793 +       {
20794 +       dslCommandCode                                          command;
20795 +       union
20796 +               {
20797 +               long                                                    value;
20798 +               Boolean                                                 flag;
20799 +               struct
20800 +                       {
20801 +                       dslTestCmdType                          type;
20802 +                       union
20803 +                               {
20804 +                               struct
20805 +                                       {
20806 +                                       ulong                           xmtStartTone, xmtNumOfTones;
20807 +                                       ulong                           rcvStartTone, rcvNumOfTones;
20808 +                                       uchar                           *xmtMap, *rcvMap;
20809 +                                       } toneSelectSpec;
20810 +                               struct
20811 +                                       {
20812 +                                       long                            extraPowerRequestQ4dB;
20813 +                                       long                            numOfCarriers;
20814 +                                       char                            *marginTweakTableQ4dB;
20815 +                                       } marginTweakSpec;
20816 +                               } param;
20817 +                       } dslTestSpec;
20818 +               struct
20819 +                       {
20820 +                       dslDirectionType                        direction;                      
20821 +                       dslDataPumpCapabilities         capabilities;
20822 +                       } dslModeSpec;
20823 +               struct
20824 +                       {
20825 +                       bitMap                                          setup;                  
20826 +                       ulong                                           eyeConstIndex1;
20827 +                       ulong                                           eyeConstIndex2;
20828 +                       ulong                                           logTime;
20829 +                       } dslDiagSpec;
20830 +               struct
20831 +                       {
20832 +                       void                                            *pBuf;                  
20833 +                       ulong                                           bufSize;
20834 +                       } dslStatusBufSpec;
20835 +               struct
20836 +                       {
20837 +                       ulong                                           type;
20838 +                       void                                            *afeParamPtr;
20839 +                       ulong                                           afeParamSize;
20840 +                       void                                            *imagePtr;
20841 +                       ulong                                           imageSize;
20842 +                       } dslAfeTestSpec;
20843 +               struct
20844 +                       {
20845 +                       dslLinkLayerType                        type;
20846 +                       bitMap                                          setup;
20847 +                       union
20848 +                               {
20849 +                               struct
20850 +                                       {
20851 +                                       dataRateMap                                     rxDataRate;
20852 +                                       dataRateMap                                     txDataRate;
20853 +                                       long                                            rtDelayQ4ms;                            
20854 +                                       ulong                                           rxBufNum;
20855 +                                       ulong                                           rxCellsInBuf;
20856 +                                       ulong                                           rxPacketNum;
20857 +                                       dslFrameHandlerType                     rxIndicateHandlerPtr;
20858 +                                       dslFrameHandlerType             txCompleteHandlerPtr;
20859 +                                       dslPhyInitType                          atmPhyInitPtr;
20860 +                                       } atmLinkSpec;
20861 +                               struct
20862 +                                       {
20863 +                                       dslHeaderHandlerType            rxHeaderHandlerPtr;
20864 +                                       dslRxFrameBufferHandlerType     rxDataHandlerPtr;
20865 +                                       dslTxFrameBufferHandlerType txHandlerPtr;
20866 +                                       } atmPhyLinkSpec;
20867 +#ifdef DSL_PACKET
20868 +                               struct
20869 +                                       {
20870 +                                       ulong                                           rxBufNum;
20871 +                                       ulong                                           rxBufSize;
20872 +                                       ulong                                           rxPacketNum;
20873 +                                       dslFrameHandlerType                     rxIndicateHandlerPtr;
20874 +                                       dslFrameHandlerType             txCompleteHandlerPtr;
20875 +                                       dslPacketPhyInitType            dslPhyInitPtr;
20876 +                                       } dslPacketLinkSpec;
20877 +                               dslPacketPhyFunctions                   dslPacketPhyLinkSpec;
20878 +#endif
20879 +                               struct
20880 +                                       {
20881 +                                       txDataHandlerType                       txDataHandlerPtr;
20882 +                                       rxDataHandlerType                       rxDataHandlerPtr;
20883 +                                       } nullLinkSpec;
20884 +                               } param;
20885 +                       } dslLinkLayerSpec;
20886 +#ifdef G997_1
20887 +#ifdef G997_1_FRAMER
20888 +               struct
20889 +                       {
20890 +                       bitMap                                          setup;
20891 +                       ulong                                           rxBufNum;
20892 +                       ulong                                           rxBufSize;
20893 +                       ulong                                           rxPacketNum;
20894 +                       dslFrameHandlerType                     rxIndicateHandlerPtr;
20895 +                       dslFrameHandlerType             txCompleteHandlerPtr;
20896 +                       } dslG997Cmd;
20897 +#endif
20898 +               struct
20899 +                       {
20900 +                       long    msgId;
20901 +                       long    msgType;
20902 +                       char    *dataPtr;
20903 +                       } dslClearEocMsg;
20904 +#endif
20905 +               struct
20906 +                       {
20907 +                       ulong                                           code;
20908 +                       uchar                                           *valuePtr;
20909 +                       ulong                                           length;
20910 +                       } dslDataRegister;
20911 +               union
20912 +                       {
20913 +                       dslStatusHandlerType            statusHandlerPtr;
20914 +                       dslCommandHandlerType           commandHandlerPtr;
20915 +                       eyeHandlerType                          eyeHandlerPtr;
20916 +                       logHandlerType                          logHandlerPtr;
20917 +#if defined(DEBUG_DATA_HANDLER)
20918 +            debugDataHandlerType        debugDataHandlerPtr;
20919 +#endif
20920 +                       dslFrameHandlerType                     rxIndicateHandlerPtr;
20921 +                       dslFrameHandlerType                     txCompleteHandlerPtr;
20922 +                       dslDriverCallbackType           driverCallback;
20923 +                       } handlerSpec;
20924 +#if !defined(CHIP_SRC) || defined(DSL_FRAME_FUNCTIONS)
20925 +               dslFrameFunctions                               DslFunctions;
20926 +#endif
20927 +               dslOLRMessage                                   dslOLRRequest;
20928 +               dslPwrMessage                                   dslPwrMsg;
20929 +               } param;
20930 +       } dslCommandStruct;
20931 +       
20932 +
20933 +
20934 +
20935 +typedef struct
20936 +       {
20937 +       dslCommandHandlerType                   linkCommandHandlerPtr;
20938 +       timerHandlerType                                linkTimerHandlerPtr;
20939 +       dslLinkCloseHandlerType                 linkCloseHandlerPtr;
20940 +
20941 +       dslFrameHandlerType                             linkSendHandlerPtr;
20942 +       dslFrameHandlerType                             linkReturnHandlerPtr;
20943 +
20944 +       dslVcAllocateHandlerType                linkVcAllocateHandlerPtr;
20945 +       dslVcFreeHandlerType                    linkVcFreeHandlerPtr;
20946 +       dslVcActivateHandlerType                linkVcActivateHandlerPtr;
20947 +       dslVcDeactivateHandlerType              linkVcDeactivateHandlerPtr;
20948 +       dslVcConfigureHandlerType               linkVcConfigureHandlerPtr;
20949 +
20950 +       dslLinkVc2IdHandlerType                 linkVc2IdHandlerPtr;
20951 +       dslLinkVcId2VcHandlerType               linkVcId2VcHandlerPtr;
20952 +       dslGetFramePoolHandlerType              linkGetFramePoolHandlerPtr;
20953 +
20954 +#ifndef ADSLCORE_ONLY
20955 +       dslHeaderHandlerType                    linkRxCellHeaderHandlerPtr;
20956 +       dslRxFrameBufferHandlerType             linkRxCellDataHandlerPtr;
20957 +       dslTxFrameBufferHandlerType             linkTxCellHandlerPtr;
20958 +#endif
20959 +
20960 +       txDataHandlerType                               linkTxDataHandlerPtr;
20961 +       rxDataHandlerType                               linkRxDataHandlerPtr;
20962 +       } linkLayerFunctions;
20963 +
20964 +#ifndef ADSLCORE_ONLY
20965 +
20966 +#define         LinkLayerAssignFunctions( var, name_prefix )   do {                                    \
20967 +       (var).linkCommandHandlerPtr = name_prefix##CommandHandler;                                      \
20968 +       (var).linkTimerHandlerPtr       = name_prefix##TimerHandler;                                    \
20969 +       (var).linkCloseHandlerPtr       = name_prefix##CloseHandler;                                    \
20970 +                                                                                                                                                               \
20971 +       (var).linkSendHandlerPtr        = name_prefix##SendFrameHandler;                                \
20972 +       (var).linkReturnHandlerPtr      = name_prefix##ReturnFrameHandler;                              \
20973 +                                                                                                                                                               \
20974 +       (var).linkVcAllocateHandlerPtr          = name_prefix##VcAllocateHandler;               \
20975 +       (var).linkVcFreeHandlerPtr                      = name_prefix##VcFreeHandler;                   \
20976 +       (var).linkVcActivateHandlerPtr          = name_prefix##VcActivateHandler;               \
20977 +       (var).linkVcDeactivateHandlerPtr        = name_prefix##VcDeactivateHandler;             \
20978 +       (var).linkVcConfigureHandlerPtr         = name_prefix##VcConfigureHandler;              \
20979 +                                                                                                                                                               \
20980 +       (var).linkVc2IdHandlerPtr                       = name_prefix##Vc2IdHandler;                    \
20981 +       (var).linkVcId2VcHandlerPtr                     = name_prefix##VcId2VcHandler;                  \
20982 +       (var).linkGetFramePoolHandlerPtr        = name_prefix##GetFramePoolHandler;             \
20983 +                                                                                                                                                               \
20984 +       (var).linkRxCellHeaderHandlerPtr        = name_prefix##RxCellHeaderHandler;             \
20985 +       (var).linkRxCellDataHandlerPtr          = name_prefix##RxCellDataHandler;               \
20986 +       (var).linkTxCellHandlerPtr                      = name_prefix##TxCellHandler;                   \
20987 +                                                                                                                                                               \
20988 +       (var).linkTxDataHandlerPtr      = name_prefix##TxDataHandler;                                   \
20989 +       (var).linkRxDataHandlerPtr      = name_prefix##RxDataHandler;                                   \
20990 +} while (0)
20991 +
20992 +#else
20993 +
20994 +#define         LinkLayerAssignFunctions( var, name_prefix )   do {                                    \
20995 +       (var).linkCommandHandlerPtr = name_prefix##CommandHandler;                                      \
20996 +       (var).linkTimerHandlerPtr       = name_prefix##TimerHandler;                                    \
20997 +       (var).linkCloseHandlerPtr       = name_prefix##CloseHandler;                                    \
20998 +                                                                                                                                                               \
20999 +       (var).linkSendHandlerPtr        = name_prefix##SendFrameHandler;                                \
21000 +       (var).linkReturnHandlerPtr      = name_prefix##ReturnFrameHandler;                              \
21001 +                                                                                                                                                               \
21002 +       (var).linkVcAllocateHandlerPtr          = name_prefix##VcAllocateHandler;               \
21003 +       (var).linkVcFreeHandlerPtr                      = name_prefix##VcFreeHandler;                   \
21004 +       (var).linkVcActivateHandlerPtr          = name_prefix##VcActivateHandler;               \
21005 +       (var).linkVcDeactivateHandlerPtr        = name_prefix##VcDeactivateHandler;             \
21006 +       (var).linkVcConfigureHandlerPtr         = name_prefix##VcConfigureHandler;              \
21007 +                                                                                                                                                               \
21008 +       (var).linkVc2IdHandlerPtr                       = name_prefix##Vc2IdHandler;                    \
21009 +       (var).linkVcId2VcHandlerPtr                     = name_prefix##VcId2VcHandler;                  \
21010 +       (var).linkGetFramePoolHandlerPtr        = name_prefix##GetFramePoolHandler;             \
21011 +                                                                                                                                                               \
21012 +       (var).linkTxDataHandlerPtr      = name_prefix##TxDataHandler;                                   \
21013 +       (var).linkRxDataHandlerPtr      = name_prefix##RxDataHandler;                                   \
21014 +} while (0)
21015 +
21016 +#endif
21017 +
21018 +typedef struct
21019 +       {
21020 +       dslFrameHandlerType                             rxIndicateHandlerPtr;
21021 +       dslFrameHandlerType                             txCompleteHandlerPtr;
21022 +       dslStatusHandlerType                    statusHandlerPtr;
21023 +       } upperLayerFunctions;
21024 +
21025 +
21026 +/*
21027 + * Debug data
21028 + */
21029 +#define        kDslFirstDebugData                                      1000
21030 +#define        kDslXmtPerSymTimeCompData                       (kDslFirstDebugData + 0)
21031 +#define        kDslRcvPerSymTimeCompData                       (kDslFirstDebugData + 1)
21032 +#define        kDslXmtAccTimeCompData                          (kDslFirstDebugData + 2)
21033 +#define        kDslRcvAccTimeCompData                          (kDslFirstDebugData + 3)
21034 +#define        kDslRcvPilotToneData                            (kDslFirstDebugData + 4)
21035 +#define        kDslTEQCoefData                                         (kDslFirstDebugData + 5)
21036 +#define        kDslTEQInputData                                        (kDslFirstDebugData + 6)
21037 +#define        kDslTEQOutputData                                       (kDslFirstDebugData + 7)
21038 +#define        kDslRcvFFTInputData                                     (kDslFirstDebugData + 8)
21039 +#define        kDslRcvFFTOutputData                            (kDslFirstDebugData + 9)
21040 +#define        kDslRcvCarrierSNRData                           (kDslFirstDebugData + 10)
21041 +#define        kDslXmtToneOrderingData                         (kDslFirstDebugData + 11)
21042 +#define        kDslRcvToneOrderingData                         (kDslFirstDebugData + 12)
21043 +#define        kDslXmtGainData                                         (kDslFirstDebugData + 13)
21044 +#define        kDslRcvGainData                                         (kDslFirstDebugData + 14)
21045 +#define        kDslMseData                                                     (kDslFirstDebugData + 15)
21046 +#define        kDslFEQOutErrData                                       (kDslFirstDebugData + 16)
21047 +#define kDslFEQCoefData                                        (kDslFirstDebugData + 17)
21048 +#define kDslShowtimeMseData                                    (kDslFirstDebugData + 18)
21049 +#define kDslTimeEstimationHWPhaseTweak         (kDslFirstDebugData + 24)
21050 +#define        kDslSlicerInput                                         (kDslFirstDebugData + 40)
21051 +#define        kDslXmtConstellations                           (kDslFirstDebugData + 41)
21052 +#define kDslSnr1ShiftData                                      (kDslFirstDebugData + 50)
21053 +#define kDslSnr1InputData                                      (kDslFirstDebugData + 51)
21054 +#define kDslSnr1ReverbAvgData                          (kDslFirstDebugData + 52)
21055 +#define kDslAnnexCFextSnrData                          (kDslFirstDebugData + 53)
21056 +#define kDslAnnexCNextSnrData                          (kDslFirstDebugData + 54)
21057 +#define        kG994p1OutputXmtSample                          (kDslFirstDebugData + 100)
21058 +#define        kG994p1OutputMicroBit                           (kDslFirstDebugData + 101)
21059 +#define        kG994p1OutputBit                                        (kDslFirstDebugData + 102)
21060 +#define        kG994p1OutputTimer                                      (kDslFirstDebugData + 103)
21061 +
21062 +/****************************************************************************/
21063 +/*     2.      Constant definitions.                                                                                           */
21064 +/*                                                                                                                                                     */
21065 +/*     2.1     Defininitive constants                                                                                          */
21066 +/****************************************************************************/
21067 +
21068 +/* dslDirectionType */
21069 +
21070 +#define        kATU_C          0
21071 +#define        kATU_R          1
21072 +
21073 +/* ATM setup maps      */
21074 +
21075 +#define        kAtmCallMgrEnabled                      0x00000001              /* Bit 0  */
21076 +#define        kAtmAAL1FecEnabledMask          0x00000006              /* Bit 1  */
21077 +#define        kAtmAAL1HiDelayFecEnabled       0x00000002              /* Bit 2  */
21078 +#define        kAtmAAL1LoDelayFecEnabled       0x00000004              /* Bit 3  */
21079 +
21080 +/* dslLinkLayerType */
21081 +
21082 +#define kNoDataLink                    0
21083 +#define kAtmLink                       0x00000001
21084 +#define kAtmPhyLink                    0x00000002
21085 +#define kDslPacketLink         0x00000003
21086 +#define kDslPacketPhyLink      0x00000004
21087 +
21088 +/* dslModulationType */
21089 +#define        kNoCommonModulation     0x00000000                              
21090 +#define        kG994p1                         0x00000020                              /* G.994.1 or G.hs */
21091 +#define        kT1p413                         0x00000040                              /* T1.413 handshaking */
21092 +#define        kG992p1AnnexA           0x00000001                              /* G.992.1 or G.dmt Annex A */
21093 +#define        kG992p1AnnexB           0x00000002                              /* G.992.1 or G.dmt Annex B */
21094 +#define        kG992p1AnnexC           0x00000004                              /* G.992.1 or G.dmt Annex C */
21095 +#define        kG992p2AnnexAB          0x00000008                              /* G.992.2 or G.lite Annex A/B */
21096 +#define        kG992p2AnnexC           0x00000010                              /* G.992.2 or G.lite Annex C */
21097 +#define        kG992p3AnnexA           0x00000100                              /* G.992.3 or G.DMTbis Annex A */
21098 +#define        kG992p3AnnexB           0x00000200                              /* G.992.3 or G.DMTbis Annex A */
21099 +#define        kG992p1AnnexI           0x00000400                              /* G.992.1 Annex I */
21100 +#define kG992p5AnnexA       0x00010000              /* G.992.5 Annex A */
21101 +#define kG992p5AnnexB       0x00020000              /* G.992.5 Annex B */
21102 +#define kG992p5AnnexI       0x00040000              /* G.992.5 Annex I */
21103 +#define kG992p3AnnexM       0x00080000              /* G.992.3 Annex M */
21104 +#define kG992p5AnnexM       0x01000000              /* G.992.5 Annex M */
21105 +
21106 +/* demodCapabilities bitmap */
21107 +#define        kEchoCancellorEnabled                                   0x00000001
21108 +#define        kSoftwareTimeErrorDetectionEnabled              0x00000002
21109 +#define        kSoftwareTimeTrackingEnabled                    0x00000004
21110 +#define kDslTrellisEnabled                                 0x00000008
21111 +#define        kHardwareTimeTrackingEnabled                    0x00000010
21112 +#define kHardwareAGCEnabled                                            0x00000020
21113 +#define kDigitalEchoCancellorEnabled                   0x00000040
21114 +#define kReedSolomonCodingEnabled                              0x00000080
21115 +#define kAnalogEchoCancellorEnabled                            0x00000100
21116 +#define        kT1p413Issue1SingleByteSymMode                  0x00000200
21117 +#define        kDslAturXmtPowerCutbackEnabled                  0x00000400
21118 +#ifdef G992_ANNEXC_LONG_REACH
21119 +#define kDslAnnexCPilot48                       0x00000800
21120 +#define kDslAnnexCReverb33_63                   0x00001000
21121 +#endif
21122 +#ifdef G992_ANNEXC
21123 +#define kDslCentilliumCRCWorkAroundEnabled             0x00002000
21124 +#else
21125 +#define kDslEnableRoundUpDSLoopAttn                    0x00002000
21126 +#endif
21127 +#define        kDslBitSwapEnabled                                              0x00004000
21128 +#define        kDslADILowRateOptionFixDisabled                 0x00008000
21129 +#define        kDslAnymediaGSPNCrcFixEnabled                   0x00010000
21130 +#define        kDslMultiModesPreferT1p413                              0x00020000
21131 +#define        kDslT1p413UseRAck1Only                                  0x00040000
21132 +#define        kDslUE9000ADI918FECFixEnabled                   0x00080000
21133 +#define        kDslG994AnnexAMultimodeEnabled                  0x00100000
21134 +#define        kDslATUCXmtPowerMinimizeEnabled                 0x00200000
21135 +#define        kDropOnDataErrorsDisabled                           0x00400000
21136 +#define        kDslSRAEnabled                                              0x00800000
21137 +
21138 +#define        kDslT1p413HigherToneLevelNeeded                 0x01000000
21139 +#define        kDslT1p413SubsampleAlignmentEnabled             0x02000000
21140 +#define        kDslT1p413DisableUpstream2xIfftMode             0x04000000
21141 +
21142 +/* test mode related demodCapabilities, for internal use only */
21143 +#define        kDslTestDemodCapMask                                    0xF8000000
21144 +#define        kDslSendReverbModeEnabled                               0x10000000
21145 +#define        kDslSendMedleyModeEnabled                               0x20000000
21146 +#define        kDslAutoRetrainDisabled                                 0x40000000
21147 +#define kDslPllWorkaroundEnabled                0x80000000
21148 +#define kDslAfeLoopbackModeEnabled              0x08000000
21149 +
21150 +/* demodCapabilities bitmap2 */
21151 +
21152 +#define kDslAnnexCProfile1                                 0x00000001
21153 +#define kDslAnnexCProfile2                                 0x00000002
21154 +#define kDslAnnexCProfile3                                 0x00000004
21155 +#define kDslAnnexCProfile4                                 0x00000008
21156 +#define kDslAnnexCProfile5                                 0x00000010
21157 +#define kDslAnnexCProfile6                                 0x00000020
21158 +#define kDslAnnexCPilot64                                      0x00000040
21159 +#define kDslAnnexCPilot48                       0x00000080
21160 +#define kDslAnnexCPilot32                                      0x00000100
21161 +#define kDslAnnexCPilot16                                      0x00000200
21162 +#define kDslAnnexCA48B48                                           0x00000400
21163 +#define kDslAnnexCA24B24                                   0x00000800
21164 +#define kDslAnnexCReverb33_63                   0x00001000
21165 +#define kDslAnnexCCReverb6_31                          0x00002000
21166 +
21167 +#define kDslAnnexIShapedSSVI                    0x00004000
21168 +#define kDslAnnexIFlatSSVI                      0x00008000
21169 +
21170 +#define kDslAnnexIPilot64                                      0x00010000
21171 +#define kDslAnnexIA48B48                                           0x00020000
21172 +#define kDslAnnexIPilot128                                     0x00040000
21173 +#define kDslAnnexIPilot96                                      0x00080000
21174 +
21175 +/* Features bitmap */
21176 +#define        kG992p2RACK1                                                0x00000001
21177 +#define        kG992p2RACK2                                                    0x00000002
21178 +#define        kG992p2DBM                                                              0x00000004
21179 +#define        kG992p2FastRetrain                                              0x00000008
21180 +#define        kG992p2RS16                                                             0x00000010
21181 +#define        kG992p2ClearEOCOAM                                              0x00000020
21182 +#define        kG992NTREnabled                                                 0x00000040
21183 +#define        kG992p2EraseAllStoredProfiles                   0x00000080
21184 +#define kG992p2FeaturesNPar2Mask                0x0000003B
21185 +#define kG992p2FeaturesNPar2Shift                        0
21186 +
21187 +#define kG992p1RACK1                            0x00000100
21188 +#define kG992p1RACK2                            0x00000200
21189 +#define kG992p1STM                              0x00000800
21190 +#define kG992p1ATM                              0x00001000
21191 +#define        kG992p1ClearEOCOAM                                              0x00002000
21192 +#define kG992p1FeaturesNPar2Mask                0x00003B00
21193 +#define kG992p1FeaturesNPar2Shift                        8     
21194 +#define kG992p1DualLatencyUpstream                             0x00004000
21195 +#define kG992p1DualLatencyDownstream                   0x00008000
21196 +#define kG992p1HigherBitRates                                  0x40000000
21197 +
21198 +#if defined(G992P1_ANNEX_I)
21199 +#define kG992p1HigherBitRates1over3                            0x80000000
21200 +#define kG992p1AnnexIShapedSSVI                 0x00000001
21201 +#define kG992p1AnnexIFlatSSVI                   0x00000002
21202 +#define kG992p1AnnexIPilotFlag                                 0x00000008
21203 +#define kG992p1AnnexIPilot64                                   0x00000001
21204 +#define kG992p1AnnexIPilot128                                  0x00000004
21205 +#define kG992p1AnnexIPilot96                                   0x00000008
21206 +#define kG992p1AnnexIPilotA48B48                0x00000010
21207 +#endif
21208 +
21209 +#define kG992p1AnnexBRACK1                      0x00010000
21210 +#define kG992p1AnnexBRACK2                      0x00020000
21211 +#define kG992p1AnnexBUpstreamTones1to32                        0x00040000
21212 +#define kG992p1AnnexBSTM                        0x00080000
21213 +#define kG992p1AnnexBATM                        0x00100000
21214 +#define        kG992p1AnnexBClearEOCOAM                                0x00200000
21215 +#define kG992p1AnnexBFeaturesNPar2Mask          0x003F0000
21216 +#define kG992p1AnnexBFeaturesNPar2Shift                 16     
21217 +
21218 +#define kG992p1AnnexCRACK1                      0x01000000
21219 +#define kG992p1AnnexCRACK2                      0x02000000
21220 +#define kG992p1AnnexCDBM                                               0x04000000
21221 +#define kG992p1AnnexCSTM                        0x08000000
21222 +#define kG992p1AnnexCATM                        0x10000000
21223 +#define        kG992p1AnnexCClearEOCOAM                                0x20000000
21224 +#define kG992p1AnnexCFeaturesNPar2Mask          0x3F000000
21225 +#define kG992p1AnnexCFeaturesNPar2Shift                 24     
21226 +
21227 +#define kG992p1HigherBitRates1over3                            0x80000000
21228 +
21229 +/* auxFeatures bitmap */
21230 +#define        kG994p1PreferToExchangeCaps                             0x00000001
21231 +#define        kG994p1PreferToDecideMode                               0x00000002
21232 +#define        kG994p1PreferToMPMode                               0x00000004
21233 +#define        kAfePwmSyncClockShift                                   3
21234 +#define        kAfePwmSyncClockMask                                    (0xF << kAfePwmSyncClockShift)
21235 +#define        AfePwmSyncClockEnabled(val)                             (((val) & kAfePwmSyncClockMask) != 0)
21236 +#define        AfePwmGetSyncClockFreq(val)                             ((((val) & kAfePwmSyncClockMask) >> kAfePwmSyncClockShift) - 1)
21237 +#define        AfePwmSetSyncClockFreq(val,freq)                ((val) |= ((((freq)+1) << kAfePwmSyncClockShift) & kAfePwmSyncClockMask))
21238 +
21239 +/* SubChannel Info bitMap for G992p1 */
21240 +#define kSubChannelASODownstream                0x00000001
21241 +#define kSubChannelAS1Downstream                0x00000002
21242 +#define kSubChannelAS2Downstream                0x00000004
21243 +#define kSubChannelAS3Downstream                0x00000008
21244 +#define kSubChannelLSODownstream                0x00000010
21245 +#define kSubChannelLS1Downstream                0x00000020
21246 +#define kSubChannelLS2Downstream                0x00000040
21247 +#define kSubChannelLS0Upstream                  0x00000080
21248 +#define kSubChannelLS1Upstream                  0x00000100
21249 +#define kSubChannelLS2Upstream                  0x00000200
21250 +#define kSubChannelInfoOctet1Mask               0x0000001F
21251 +#define kSubChannelInfoOctet2Mask               0x000003E0
21252 +#define kSubChannelInfoOctet1Shift                              0      
21253 +#define kSubChannelInfoOctet2Shift                              5      
21254 +
21255 +/****************************************************************************/
21256 +/*     3.      Interface functions.                                                                                            */
21257 +/*                                                                                                                                                     */
21258 +/****************************************************************************/
21259 +
21260 +#ifdef G992P1
21261 +#if defined(G992P1_ANNEX_I2X) || defined(G992P5) 
21262 +/* lke */
21263 +#define        kDslSamplingFreq                        4416000
21264 +#define        kDslMaxFFTSize                          1024    
21265 +#define        kDslMaxFFTSizeShift                     10
21266 +#elif defined(G992P1_ANNEX_I4X)
21267 +#define        kDslSamplingFreq                        8832000
21268 +#define        kDslMaxFFTSize                          2048    
21269 +#define        kDslMaxFFTSizeShift                     11
21270 +#elif defined(G992P1_ANNEX_I8X)
21271 +#define        kDslSamplingFreq                        17664000
21272 +#define        kDslMaxFFTSize                          4096    
21273 +#define        kDslMaxFFTSizeShift                     12
21274 +#else
21275 +#define        kDslSamplingFreq                        2208000
21276 +#define        kDslMaxFFTSize                          512
21277 +#define        kDslMaxFFTSizeShift                     9
21278 +#endif
21279 +#else
21280 +#define        kDslSamplingFreq                        1104000
21281 +#define        kDslMaxFFTSize                          256
21282 +#define        kDslMaxFFTSizeShift                     8
21283 +#endif
21284 +
21285 +#if defined(G992_ATUR_UPSTREAM_SAMPLING_FREQ_276KHZ)
21286 +#define kDslATURUpstreamSamplingFreq    276000
21287 +#define        kDslATURFFTSizeShiftUpstream    6
21288 +#elif defined(G992_ATUR_UPSTREAM_SAMPLING_FREQ_552KHZ)
21289 +#define kDslATURUpstreamSamplingFreq    552000
21290 +#define        kDslATURFFTSizeShiftUpstream    7
21291 +#else
21292 +#define kDslATURUpstreamSamplingFreq    kDslSamplingFreq
21293 +#define        kDslATURFFTSizeShiftUpstream    kDslMaxFFTSizeShift
21294 +#endif 
21295 +
21296 +#if defined(G992_ATUC_UPSTREAM_SAMPLING_FREQ_276KHZ)
21297 +#define kDslATUCUpstreamSamplingFreq    276000
21298 +#define        kDslATUCFFTSizeShiftUpstream    6
21299 +#elif defined(G992_ATUC_UPSTREAM_SAMPLING_FREQ_552KHZ)
21300 +#define kDslATUCUpstreamSamplingFreq    552000
21301 +#define        kDslATUCFFTSizeShiftUpstream    7
21302 +#else
21303 +#define kDslATUCUpstreamSamplingFreq    kDslSamplingFreq
21304 +#define        kDslATUCFFTSizeShiftUpstream    kDslMaxFFTSizeShift
21305 +#endif 
21306 +
21307 +#define        kDslMaxSamplesPerSymbol         (kDslMaxFFTSize+kDslMaxFFTSize/16)
21308 +
21309 +#if defined(G992P1_ANNEX_I) || defined(G992P5)
21310 +#define kDslMaxTEQLength               32
21311 +#else
21312 +#define kDslMaxTEQLength               16
21313 +#endif
21314 +
21315 +#define        kDslMaxSymbolBlockSize          1
21316 +#define        kDslMaxSampleBlockSize          (kDslMaxSymbolBlockSize*kDslMaxSamplesPerSymbol)
21317 +
21318 +#ifdef G992_ANNEXC
21319 +#define        kG992AnnexCXmtToRcvPathDelay    512   /* In samples at kDslSamplingFreq */
21320 +#endif
21321 +
21322 +/*** For compatibility with existing test codes ***/
21323 +#if !defined(TARG_OS_RTEMS)
21324 +typedef dslStatusCode                          modemStatusCode;
21325 +typedef        dslStatusStruct                         modemStatusStruct;
21326 +typedef        dslStatusHandlerType            statusHandlerType;
21327 +typedef dslCommandCode                         modemCommandCode;
21328 +typedef        dslCommandStruct                        modemCommandStruct;
21329 +typedef        dslCommandHandlerType           commandHandlerType;
21330 +#endif
21331 +
21332 +extern void            SM_DECL SoftDslSetRefData       (void *gDslVars, ulong refData);
21333 +extern ulong   SM_DECL SoftDslGetRefData       (void *gDslVars);
21334 +extern int             SM_DECL SoftDslGetMemorySize(void);
21335 +extern void            SM_DECL SoftDslInit                     (void *gDslVars);
21336 +extern void            SM_DECL SoftDslReset            (void *gDslVars);
21337 +extern void            SM_DECL SoftDslLineHandler      (void *gDslVars, int rxNSamps, int txNSamps, short *rcvPtr, short *xmtPtr) FAST_TEXT;
21338 +extern Boolean SM_DECL SoftDslCommandHandler (void *gDslVars, dslCommandStruct *cmdPtr);
21339 +
21340 +/* swap Lmem functions */
21341 +#if defined(bcm47xx) && defined(SWAP_LMEM)
21342 +extern int SoftDslSwapLmem(void *gDslVars, int sectionN, int imageN);
21343 +extern void init_SoftDslSwapLmem(void);
21344 +#endif
21345 +
21346 +/* SoftDsl time functions      */
21347 +
21348 +extern ulong   SM_DECL SoftDslGetTime(void *gDslVars);
21349 +#define                        __SoftDslGetTime(gv)            gDslGlobalVarPtr->execTime
21350 +
21351 +extern void            SM_DECL SoftDslTimer(void *gDslVars, ulong timeMs);
21352 +
21353 +/* SoftDsl IO functions        */
21354 +
21355 +extern void            SM_DECL SoftDslClose (void *gDslVars);
21356 +extern int             SM_DECL SoftDslSendFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
21357 +extern int             SM_DECL SoftDslReturnFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
21358 +
21359 +/* SoftDsl connection functions        */
21360 +
21361 +extern void*   SM_DECL SoftDslVcAllocate(void *gDslVars, dslVcParams *pVcParams);
21362 +extern void    SM_DECL SoftDslVcFree(void *gDslVars, void *pVc);
21363 +extern Boolean SM_DECL SoftDslVcActivate(void *gDslVars, void *pVc);
21364 +extern  void   SM_DECL SoftDslVcDeactivate(void *gDslVars, void *pVc);
21365 +extern  Boolean SM_DECL SoftDslVcConfigure(void *gDslVars, void *pVc, ulong mid, dslVcParams *pVcParams);
21366 +
21367 +/* Special functions for LOG support */
21368 +
21369 +extern  ulong  SM_DECL SoftDslVc2Id(void *gDslVars, void *pVc);
21370 +extern  void*  SM_DECL SoftDslVcId2Vc(void *gDslVars, ulong vcId);
21371 +extern void*   SM_DECL SoftDslGetFramePool(void *gDslVars);
21372 +
21373 +/* Functions for host mode execution */
21374 +
21375 +extern  void*   SM_DECL SoftDslRxCellHeaderHandler (void *gDslVars, ulong hdr, uchar hdrHec);
21376 +extern void*   SM_DECL SoftDslRxCellDataHandler (void *gDslVars, int,  void*);
21377 +extern  void*  SM_DECL SoftDslTxCellHandler    (void *gDslVars, int*,  void*);
21378 +extern  Boolean        SM_DECL SoftDslPhyCommandHandler (void *gDslVars, dslCommandStruct *cmdPtr);
21379 +
21380 +/* Functions getting OEM parameters including G994 non standard info management */
21381 +
21382 +extern char*   SM_DECL SoftDslGetTrainingVendorIDString(void *gDslVars);
21383 +extern char*   SM_DECL SoftDslGetVendorIDString(void *gDslVars);
21384 +extern char*   SM_DECL SoftDslGetSerialNumberString(void *gDslVars);
21385 +extern char*   SM_DECL SoftDslGetRevString(void *gDslVars);
21386 +extern int             SM_DECL SoftDslRevStringSize(void *gDslVars);
21387 +extern int             SM_DECL SoftDslSerNumStringSize(void *gDslVars);
21388 +                                                          
21389 +extern  void*  SM_DECL SoftDslGetG994p1RcvNonStdInfo(void *gDslVars, ulong *pLen);
21390 +extern  void*  SM_DECL SoftDslGetG994p1XmtNonStdInfo(void *gDslVars, ulong *pLen);
21391 +
21392 +#ifdef G997_1_FRAMER
21393 +
21394 +/* G997 functions */
21395 +
21396 +extern int             SM_DECL SoftDslG997SendFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
21397 +extern int             SM_DECL SoftDslG997ReturnFrame (void *gDslVars, void *pVc, ulong mid, dslFrame * pFrame);
21398 +
21399 +#endif
21400 +
21401 +#ifdef ADSL_MIB
21402 +extern void     *      SM_DECL SoftDslMibGetData (void *gDslVars, int dataId, void *pAdslMibData);
21403 +#endif
21404 +
21405 +#define        SoftDsl                                 SoftDslLineHandler
21406 +#define        kSoftDslMaxMemorySize   (32768*16384)
21407 +
21408 +/*
21409 + * Internal functions
21410 + */
21411 +
21412 +extern  void   SoftDslStatusHandler    (void *gDslVars, dslStatusStruct *status) FAST_TEXT;
21413 +extern  void   SoftDslInternalStatusHandler (void *gDslVars, dslStatusStruct *status);
21414 +
21415 +/*
21416 + *             DSL OS functions
21417 + */
21418 +
21419 +#ifdef DSL_OS
21420 +
21421 +#define        SoftDslIsBgAvailable(gDslVars)          (DSLOS_THREAD_INACTIVE == DslOsGetThreadState(&(gDslGlobalVarPtr->tcbDslBg)))
21422 +#define        SoftDslGetBgThread(gDslVars)            \
21423 +       ((DSLOS_THREAD_INACTIVE != DslOsGetThreadState(&(gDslGlobalVarPtr->tcbDslBg))) ? &gDslGlobalVarPtr->tcbDslBg : NULL)
21424 +#define        SoftDslBgStart(gDslVars, pFunc)         \
21425 +       DslOsCreateThread(&gDslGlobalVarPtr->tcbDslBg, DSLOS_PRIO_HIGHEST - 10, pFunc, gDslVars,        \
21426 +       WB_ADDR(gDslGlobalVarPtr->bgStack), sizeof(gDslGlobalVarPtr->bgStack))
21427 +#define        SoftDslBgStop(gDslVars)                         DslOsDeleteThread(&gDslGlobalVarPtr->tcbDslBg)
21428 +
21429 +#define        SoftDslEnterCritical()                          DslOsEnterCritical()
21430 +#define        SoftDslLeaveCritical(id)                        DslOsLeaveCritical(id)
21431 +
21432 +#else
21433 +
21434 +#define        SoftDslIsBgAvailable(gDslVars)          1
21435 +#define        SoftDslGetBgThread(gDslVars)            1
21436 +#define        SoftDslBgStart(gDslVars, pFunc)         (*pFunc)(gDslVars)
21437 +#define        SoftDslBgStop(gDslVars)
21438 +
21439 +#define        SoftDslEnterCritical()                          0
21440 +#define        SoftDslLeaveCritical(id)
21441 +
21442 +#endif
21443 +
21444 +/*
21445 + *             DSL frames and native frame functions
21446 + */
21447 +
21448 +DslFrameDeclareFunctions (DslFrameNative)
21449 +
21450 +/*
21451 + * These functions are for testing purpose, they are defined outside.
21452 + */
21453 +#ifdef STACK_SIZE_REQUIREMENT_TEST
21454 +extern void            StackSizeTestInitializeStackBeforeEntry(void);
21455 +extern void            StackSizeTestCheckStackAfterExit(void);
21456 +extern void            StackSizeTestBackupStack(void);
21457 +extern void            StackSizeTestRestoreStack(void);
21458 +#endif /* STACK_SIZE_REQUIREMENT_TEST */
21459 +
21460 +#ifdef NEC_NSIF_WORKAROUND
21461 +#define        SoftDslGetG994NsStatus(gDslVars)                        (gDslGlobalVarPtr->G994NsStatus)
21462 +#define        SoftDslGetG994NsFailCounter(gDslVars)               (gDslGlobalVarPtr->G994NsFailCounter)
21463 +#endif
21464 +
21465 +#endif /* SoftDslHeader */
21466 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModem.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModem.h
21467 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModem.h       1970-01-01 01:00:00.000000000 +0100
21468 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModem.h      2006-06-26 09:07:10.000000000 +0200
21469 @@ -0,0 +1,3128 @@
21470 +/*
21471 +<:copyright-broadcom 
21472
21473 + Copyright (c) 2002 Broadcom Corporation 
21474 + All Rights Reserved 
21475 + No portions of this material may be reproduced in any form without the 
21476 + written permission of: 
21477 +          Broadcom Corporation 
21478 +          16215 Alton Parkway 
21479 +          Irvine, California 92619 
21480 + All information contained in this document is Broadcom Corporation 
21481 + company private, proprietary, and trade secret. 
21482
21483 +:>
21484 +*/
21485 +/****************************************************************************
21486 + *
21487 + * SoftModem.h 
21488 + *
21489 + *
21490 + * Description:
21491 + *     This file contains the exported interface for SoftModem.c
21492 + *
21493 + *
21494 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
21495 + * Authors: Mark Gonikberg, Haixiang Liang.
21496 + *
21497 + * $Revision: 1.16 $
21498 + *
21499 + * $Id: SoftModem.h,v 1.16 2004/04/14 21:16:51 ilyas Exp $
21500 + *
21501 + * $Log: SoftModem.h,v $
21502 + * Revision 1.16  2004/04/14 21:16:51  ilyas
21503 + * Merged with the latest changes in ADSL driver
21504 + *
21505 + * Revision 1.15  2004/04/13 00:56:10  ilyas
21506 + * Merged the latest ADSL driver changes for RTEMS
21507 + *
21508 + * Revision 1.14  2004/04/13 00:16:59  ilyas
21509 + * Merged the latest ADSL driver changes
21510 + *
21511 + * Revision 1.13  2003/02/22 05:07:11  ilyas
21512 + * Added VendorID for T1.413 mode
21513 + *
21514 + * Revision 1.12  2002/10/03 19:34:24  ilyas
21515 + * Added size for EOC serial number register
21516 + *
21517 + * Revision 1.11  2002/09/07 01:37:22  ilyas
21518 + * Added support for OEM parameters
21519 + *
21520 + * Revision 1.10  2001/12/13 02:25:34  ilyas
21521 + * Added definitions for G997
21522 + *
21523 + * Revision 1.9  2001/11/30 05:56:34  liang
21524 + * Merged top of the branch AnnexBDevelopment onto top of the tree.
21525 + *
21526 + * Revision 1.7.2.2  2001/11/27 02:32:05  liang
21527 + * Combine vendor ID, serial #, and version number into SoftModemVersionNumber.c.
21528 + *
21529 + * Revision 1.7.2.1  2001/10/03 01:44:10  liang
21530 + * Merged with codes from main tree (tag SoftDsl_2_18).
21531 + *
21532 + * Revision 1.8  2001/09/21 19:19:01  ilyas
21533 + * Minor fixes for VxWorks build
21534 + *
21535 + * Revision 1.7  2000/07/17 21:08:16  lkaplan
21536 + * removed global pointer
21537 + *
21538 + * Revision 1.6  2000/05/03 04:09:11  ilyas
21539 + * Added ID for ATM log data
21540 + *
21541 + * Revision 1.5  2000/04/01 01:07:44  liang
21542 + * Changed file names and some module names.
21543 + *
21544 + * Revision 1.4  2000/03/02 20:18:12  ilyas
21545 + * Added test status code for ATM VC finished
21546 + *
21547 + * Revision 1.3  1999/08/05 20:02:11  liang
21548 + * Merged with the softmodem top of the tree on 08/04/99.
21549 + *
21550 + * Revision 1.2  1999/01/27 22:19:08  liang
21551 + * Merge with SoftModem_3_1_02.
21552 + * Include SoftDsl.h conditionlly so that the test utilities from SoftModem
21553 + * can be used without major change. It can be merged easily to SoftModem.
21554 + *
21555 + * Revision 1.170  1998/12/22 00:52:52  liang
21556 + * Added auxFeatures bit kV8HoldANSamUntilDetCI. When it is set, ANSam won't be
21557 + * sent until CI is detected (normally ANSam will be sent after 200ms). This is
21558 + * useful in V34 half duplex fax mode.
21559 + *
21560 + * Revision 1.169  1998/12/19 04:46:52  mwg
21561 + * Added bits for fax/data calling tones
21562 + *
21563 + * Revision 1.168  1998/12/17 02:46:10  scott
21564 + * Removed overlay-related commands/statuses and added
21565 + * kSetTrainingDelayReductionCmd
21566 + *
21567 + * Revision 1.167  1998/12/12 03:17:42  scott
21568 + * Added overlay commands and statuses
21569 + *
21570 + * Revision 1.166  1998/12/02 05:34:23  mwg
21571 + * Fixed a problem with bong tone detection
21572 + *
21573 + * Revision 1.165  1998/11/26 00:22:44  yura
21574 + * Added two more log data types: modulatorInputData & modulatorOutputData
21575 + *
21576 + * Revision 1.164  1998/11/19 03:08:04  mwg
21577 + * Added kSetCallProgressParamsCmd
21578 + *
21579 + * Revision 1.163  1998/11/18 23:00:03  liang
21580 + * Added a separate command kLoopbackTestAutoRespEnableCmd to enable or disable
21581 + * the loopback test auto respond feature when the modem is already on-line.
21582 + *
21583 + * Revision 1.162  1998/11/13 20:50:21  scott
21584 + * SoftModemInternalStatusHandler is now SM_DECL as well
21585 + *
21586 + * Revision 1.161  1998/11/13 20:42:25  scott
21587 + * Added SM_DECL type to entrypoint functions
21588 + *
21589 + * Revision 1.160  1998/11/13 03:02:54  scott
21590 + * Added SoftModemTimer prototype.
21591 + * Also include V.8bis types if AT_COMMANDS_V8BIS is defined.
21592 + *
21593 + * Revision 1.159  1998/11/12 01:22:46  scott
21594 + * Increased number of AT registers to 46
21595 + *
21596 + * Revision 1.158  1998/11/05 22:35:18  yura
21597 + * Added two more S-registers
21598 + *
21599 + * Revision 1.157  1998/11/05 03:09:54  mwg
21600 + * Added kLapmRetryFailed to the list of LAPM errors
21601 + *
21602 + * Revision 1.156  1998/11/05 00:13:20  liang
21603 + * Add new connectionInfo status kLoopbackSelfTestNewErrs to report
21604 + * new bit errors whenever it happens.
21605 + *
21606 + * Revision 1.155  1998/11/04 07:11:33  mwg
21607 + * Moved declaration for SoftModemATPrintf() to SoftModem.h
21608 + *
21609 + * Revision 1.154  1998/10/29 07:24:49  mwg
21610 + * *** empty log message ***
21611 + *
21612 + * Revision 1.153  1998/10/15 02:09:37  luisgm
21613 + * added separate data rate mask for Flex to dataPumpCapabilities structure
21614 + *
21615 + * Revision 1.152  1998/10/14 00:12:15  scott
21616 + * Added kMnpOOBFrameCmd and command.frameSpec
21617 + *
21618 + * Revision 1.151  1998/10/09 02:19:22  luisgm
21619 + * added FlexV8bisStruct member to dataPumpCapabilities struc to store flex v8bis info, added define for kFlexSkipV8bis
21620 + *
21621 + * Revision 1.150  1998/10/06 19:36:33  mwg
21622 + * Limited 56K rates to 53K
21623 + *
21624 + * Revision 1.149  1998/10/03 03:43:38  ilyas
21625 + * Added status codes for Audio
21626 + *
21627 + * Revision 1.148  1998/10/01 02:03:17  mwg
21628 + * Added external pulse dialer option
21629 + *
21630 + * Revision 1.147  1998/09/30 01:44:26  mwg
21631 + * Added new functions SoftModemGetWriteBufferSize() & SoftModemGetReadBufferSize()
21632 + *
21633 + * Revision 1.146  1998/09/22 03:44:38  scott
21634 + * Added ALWAYS_LONG_ALIGN() macro
21635 + *
21636 + * Revision 1.145  1998/09/21 21:49:22  scott
21637 + * Added logDataCodes for mnpDecoder(Input/Output)Data
21638 + *
21639 + * Revision 1.144  1998/08/31 22:57:21  luisgm
21640 + * added constants for Flex data rates + kFlexEventTRN2AFinished
21641 + *
21642 + * Revision 1.143  1998/08/18 05:09:53  mwg
21643 + * Increased AT command buffer size to 128
21644 + *
21645 + * Revision 1.142  1998/08/18 03:45:54  ilyas
21646 + * Integrated Audio into V70 test
21647 + *
21648 + * Revision 1.141  1998/08/14 17:46:04  ilyas
21649 + * Integrated Audio and G729a
21650 + *
21651 + * Revision 1.140  1998/08/10 21:42:19  mwg
21652 + * Added space and mark parity
21653 + *
21654 + * Revision 1.139  1998/08/08 03:39:33  scott
21655 + * Moved the C6xDefs and PentiumDefs includes before the internal function
21656 + * prototypes (to permit their redefinitions)
21657 + *
21658 + * Revision 1.138  1998/08/07 20:37:27  yura
21659 + * Added new S-register for &T commands
21660 + *
21661 + * Revision 1.137  1998/08/01 05:22:09  mwg
21662 + * Implemented split memory model
21663 + *
21664 + * Revision 1.136  1998/07/22 02:12:22  liang
21665 + * Added self test mode for loopback test.
21666 + *
21667 + * Revision 1.135  1998/07/21 01:19:03  liang
21668 + * Changed loopback test command parameter interface to use regular modeSpec.
21669 + *
21670 + * Revision 1.134  1998/07/18 03:52:10  liang
21671 + * Added V54 loop 2 test for V22.
21672 + *
21673 + * Revision 1.133  1998/07/15 02:45:03  mwg
21674 + * Added new connection info code: kPCMSpectralShapingBits
21675 + *
21676 + * Revision 1.132  1998/07/15 00:18:48  liang
21677 + * Add special turn off command for V34 fax to handle different turn off procedures.
21678 + *
21679 + * Revision 1.131  1998/07/13 22:19:49  liang
21680 + * Add V8 CI detection status and ANSam disable aux feature.
21681 + *
21682 + * Revision 1.130  1998/07/08 17:09:13  scott
21683 + * Added USE_LONG_ALIGN; support for 6 and PentiumDefs.h files
21684 + *
21685 + * Revision 1.129  1998/07/03 23:28:13  mwg
21686 + * Added Fax Class 2 defines
21687 + *
21688 + * Revision 1.128  1998/07/03 23:17:33  mwg
21689 + * Insuread command/status structures are long aligned
21690 + *
21691 + * Revision 1.127  1998/06/23 16:48:01  mwg
21692 + * Fixed a longstanding problem typical for Win95 VxD: whenever new
21693 + * VxD is intalled the confuguration profile may not match the old one but
21694 + * since the crc is correct it is still being downloaded. To avoid the problem
21695 + * a crc for the version number was added to avoid confusion between profiles
21696 + * of different versions.
21697 + *
21698 + * Revision 1.126  1998/06/19 21:04:06  liang
21699 + * Add auxiliary feature bit kV90ServerNotDetSbarAfterJdbarFix.
21700 + *
21701 + * Revision 1.125  1998/06/11 22:48:14  liang
21702 + * Add kPCM28000bpsShift constant.
21703 + *
21704 + * Revision 1.124  1998/06/05 22:11:51  liang
21705 + * New V90 DIL works through data mode.
21706 + *
21707 + * Revision 1.123  1998/06/01 23:03:41  liang
21708 + * Add v90RcvdDilDiffData logging.
21709 + *
21710 + * Revision 1.122  1998/06/01 21:24:38  mwg
21711 + * Changed some of the names.
21712 + *
21713 + * Revision 1.121  1998/05/13 04:55:22  mwg
21714 + * Now passing the number of spectral shaping bits in aux features
21715 + *
21716 + * Revision 1.120  1998/05/13 02:53:13  liang
21717 + * Add field "value" to command param structure.
21718 + *
21719 + * Revision 1.119  1998/05/12 04:42:23  mwg
21720 + * Replaced some of the status messages
21721 + *
21722 + * Revision 1.118  1998/05/11 23:36:10  mwg
21723 + * Added 8000Hz symbol rate to the map
21724 + *
21725 + * Revision 1.117  1998/05/05 04:28:39  liang
21726 + * V90 works up to data mode first version.
21727 + *
21728 + * Revision 1.116  1998/04/21 09:36:45  mwg
21729 + * Fixed a few problems for 16Khz and added 32Khz.
21730 + *
21731 + * Revision 1.115  1998/04/17  22:33:54  liang
21732 + * Added V90 DIL for mu-law PCM.
21733 + *
21734 + * Revision 1.114  1998/04/15  22:36:39  mwg
21735 + * Added new parameters to kDialCmd to allow individual control of each
21736 + * DTMF group attenuation.
21737 + *
21738 + * Revision 1.113  1998/04/15 18:16:22  ilyas
21739 + * Integrated V.8bis and changed coding of LinkLayerType to bitMap
21740 + *
21741 + * Revision 1.112  1998/04/15 07:59:06  mwg
21742 + * Added new status codes for V.90
21743 + *
21744 + * Revision 1.111  1998/04/11 00:29:16  mwg
21745 + * Fixed the warnings which appeared when Irix builds were upgraded to
21746 + * gcc 2.8.1
21747 + *
21748 + * Revision 1.110  1998/04/11  00:25:01  ilyas
21749 + * More V.70 statuses
21750 + *
21751 + * Revision 1.109  1998/04/10 23:29:31  mwg
21752 + * Added new field to capabilities: dataRates56K
21753 + *
21754 + * Revision 1.108  1998/04/09 02:02:56  mwg
21755 + * Added status for Ja detection.
21756 + *
21757 + * Revision 1.107  1998/04/03 02:05:30  ilyas
21758 + * More V.70 commands added
21759 + *
21760 + * Revision 1.106  1998/04/02 06:15:39  mwg
21761 + * Added coding type (Mu-law/A-law) status reporting.
21762 + *
21763 + * Revision 1.105  1998/03/30 09:53:57  mwg
21764 + * Added definition for k56Flex modulation for future use.
21765 + *
21766 + * Revision 1.104  1998/03/27  17:56:09  ilyas
21767 + * Added definitions for V.70
21768 + *
21769 + * Revision 1.103  1998/03/26 23:29:04  liang
21770 + * Added first version of IMD estimation.
21771 + *
21772 + * Revision 1.102  1998/03/20  04:37:26  mwg
21773 + * Increased the size of the nominal variance to 32 bit.
21774 + *
21775 + * Revision 1.101  1998/03/06 01:22:04  yura
21776 + * Improved Win95 VxD segmentation handling
21777 + *
21778 + * Revision 1.100  1998/03/06  01:06:18  liang
21779 + * Add initial version of V90 phase 1 and 2.
21780 + *
21781 + * Revision 1.99  1998/03/05  23:42:22  mwg
21782 + * (hxl) Implemented enable/disable call waiting command.
21783 + *
21784 + * Revision 1.98  1998/02/26  06:13:06  mwg
21785 + * Increased the number of AT S-registers to account for newly introduced
21786 + * S9 and S10.
21787 + *
21788 + * Revision 1.97  1998/02/25  18:18:25  scott
21789 + * Added v42bisCycleCount for V42BIS_THROUGHPUT_CONTROL
21790 + *
21791 + * Revision 1.96  1998/02/24 05:31:20  mwg
21792 + * Added stuff required by international version of AT command processor.
21793 + *
21794 + * Revision 1.95  1998/02/17  01:14:10  scott
21795 + * Reenabled sys/types.h for Linux builds
21796 + *
21797 + * Revision 1.94  1998/02/16 22:32:23  scott
21798 + * Changed copyright notice
21799 + *
21800 + * Revision 1.93  1998/02/16 22:17:44  scott
21801 + * Turned off include of sys/types.h for normal builds
21802 + *
21803 + * Revision 1.92  1998/02/16 21:53:28  scott
21804 + * Exclude sys/types.h for another compiler
21805 + *
21806 + * Revision 1.91  1998/02/09 18:24:10  scott
21807 + * Fixed ComplexShort type to work around bugs in MS and GreenHill compilers
21808 + *
21809 + * Revision 1.90  1998/01/27 01:37:36  mwg
21810 + * Added new log identifier for pcm infidelity data.
21811 + *
21812 + * Revision 1.89  1998/01/22  19:49:32  liang
21813 + * Add auxFeature bit kFaxV34HDXAllowAsymCtrlChan.
21814 + *
21815 + * Revision 1.88  1998/01/21  02:32:01  liang
21816 + * Add more V34 half duplex training progress codes.
21817 + *
21818 + * Revision 1.87  1997/12/23  03:28:25  liang
21819 + * Add more half duplex V34 related constants.
21820 + *
21821 + * Revision 1.86  1997/12/18  19:38:50  scott
21822 + * Added agcData log type.
21823 + * Added kDisableFaxFastClearDown demod capability
21824 + *
21825 + * Revision 1.85  1997/12/18 06:02:45  mwg
21826 + * Added a function to reenable DC offset tracking.
21827 + *
21828 + * Revision 1.84  1997/12/17  22:46:30  mwg
21829 + * Minor modifications to X2 escape status reporting.
21830 + *
21831 + * Revision 1.83  1997/12/16  06:49:45  mwg
21832 + * Implemented proper data rate reporting for PCM modem.
21833 + *
21834 + * Revision 1.82  1997/12/13  06:11:08  mwg
21835 + * Added X2 interface hooks
21836 + *
21837 + * Revision 1.81  1997/12/02 06:21:33  mwg
21838 + * Implemented kSetATRegister command.
21839 + *
21840 + * Revision 1.80  1997/11/27  02:11:41  liang
21841 + * Add code for half duplex V34 control channel.
21842 + *
21843 + * Revision 1.79  1997/11/19  19:52:48  guy
21844 + * Added constant to define V.34 half duplex operation
21845 + *
21846 + * Revision 1.78  1997/10/24 05:15:53  scott
21847 + * Added AGC and phase hit recovery to demodCapabilities
21848 + *
21849 + * Revision 1.77  1997/10/01 02:47:50  liang
21850 + * Add PCM interface.
21851 + *
21852 + * Revision 1.76  1997/09/29  15:48:04  yura
21853 + * Added #pragma statement for W95 Vxd
21854 + *
21855 + * Revision 1.75  1997/09/18 20:32:39  scott
21856 + * Do not include VxD support files if GENERATE_DEPENDENCIES is defined.
21857 + *
21858 + * Revision 1.74  1997/09/18 12:40:55  yura
21859 + * Removed #ifdef statments to be more robust
21860 + *
21861 + * Revision 1.73  1997/09/17 17:32:41  scott
21862 + * Do not include sys/types.h for 6
21863 + *
21864 + * Revision 1.72  1997/08/08 00:53:48  mwg
21865 + * Added fields for LAP-M frames printout.
21866 + * Added fields in auxFeatures to pass preemphasis filter parameters
21867 + * to V.34 phase 3 when doing PTT testing.
21868 + *
21869 + * Revision 1.71  1997/08/06  03:41:45  yura
21870 + * Added a few includes and defines needed by Win 95 driver.
21871 + *
21872 + * Revision 1.70  1997/08/05  03:22:10  liang
21873 + * Add equalizer center tap adjustment calculation related constants.
21874 + *
21875 + * Revision 1.69  1997/07/29  02:44:19  mwg
21876 + * Added new field to dataPumpCapabilities structure. This field is not
21877 + * yet exposed to external interface and currently is only used to
21878 + * enable PTT testing.
21879 + * Added new commands: kStartDataModemPTTTestCmd & kStartDataModemLoopbackTestCmd
21880 + *
21881 + * Revision 1.68  1997/07/22  22:05:10  liang
21882 + * Change sample rate setup as a normal command.
21883 + *
21884 + * Revision 1.67  1997/07/21  23:23:30  liang
21885 + * Define SoftModemSetSampleRate as null when SAMPLE_RATE_CONVERSION is not defined.
21886 + *
21887 + * Revision 1.66  1997/07/21  22:38:36  liang
21888 + * Change sample rate converter structure so that sample rate can be changed
21889 + * on the fly (at very begining) to either 8KHz or 9600Hz.
21890 + *
21891 + * Revision 1.65  1997/07/21  20:22:01  mwg
21892 + * Added statusInfoData to the log identifiers.
21893 + *
21894 + * Revision 1.64  1997/07/16  20:40:07  scott
21895 + * Added multitone monitor fields
21896 + *
21897 + * Revision 1.63  1997/07/10 02:31:08  mwg
21898 + * 1. Added kRxFrameHDLCFlags detected status for the
21899 + *    framingInfo.
21900 + * 2. Added kLapmMNPFrameDetected status to lapmStatusCode.
21901 + * 3. Increased the number of AT registers to 35
21902 + * 4. Modified LinkLayerSpec structure in modemCommandStruc
21903 + *    to provide the initial values of rxDataRate &
21904 + *    txDataRate and RT delay for the cases when
21905 + *    link layer is started *after* the data connection
21906 + *    is established and the status snooper is unable
21907 + *    to determine the rates and RT delay.
21908 + * 5. Added a few extra *empty* constant definitions for
21909 + *    disabled features.
21910 + *
21911 + * Revision 1.62  1997/07/02  19:15:05  scott
21912 + * Added bits for Bel103 & Bel212 modulations.
21913 + *
21914 + * Revision 1.61  1997/07/02 05:15:16  mwg
21915 + * Added MNP code.
21916 + *
21917 + * Revision 1.60  1997/07/01  23:52:48  mwg
21918 + * Modified the record test setup to log and use all the commands.
21919 + *
21920 + * Revision 1.59  1997/06/25  19:11:26  mwg
21921 + * 1. Added new framingInfoCode values for Async framing error reporting;
21922 + * 2. Added a substructure to pass serial data format for kSetDTERate cmd;
21923 + *
21924 + * Revision 1.58  1997/05/28  02:05:08  liang
21925 + * Add PCM modem phase 2 codes.
21926 + *
21927 + * Revision 1.57  1997/05/12  21:55:08  liang
21928 + * Add call waiting tone detector module.
21929 + *
21930 + * Revision 1.56  1997/03/21  23:50:08  liang
21931 + * Added initial version of V8bis module to CVS tree.
21932 + *
21933 + * Revision 1.55  1997/03/19  18:35:05  mwg
21934 + * Changed copyright notice.
21935 + *
21936 + * Revision 1.54  1997/03/11  11:11:45  mwg
21937 + * Added code to report V42bis statistics.
21938 + *
21939 + * Revision 1.53  1997/03/04  06:21:08  mwg
21940 + * Added logging of most commands.
21941 + *
21942 + * Revision 1.52  1997/02/28  23:45:13  liang
21943 + * Added training progress status report kPhaseJitterDeactivated.
21944 + *
21945 + * Revision 1.51  1997/02/28  22:23:22  mwg
21946 + * Implemented the following features:
21947 + * - Cleardown for fax modulations V.27, V.29 V.17
21948 + * - Rockwell compatible bitmap report (needed by a customer)
21949 + *
21950 + * Revision 1.50  1997/02/28  03:05:31  mwg
21951 + * Added more logging data types.
21952 + *
21953 + * Revision 1.49  1997/02/27  05:28:58  mwg
21954 + * Added RxFrameOK report.
21955 + *
21956 + * Revision 1.48  1997/02/27  01:48:53  liang
21957 + * Add kV8MenuDataWord1 and kV8MenuDataWord2 connectionInfo status.
21958 + *
21959 + * Revision 1.47  1997/02/24  02:30:27  mwg
21960 + * Added new log  data: predictorErrData
21961 + *
21962 + * Revision 1.46  1997/02/22  03:00:22  liang
21963 + * Add echoCancelledSignalData.
21964 + *
21965 + * Revision 1.45  1997/02/21  01:26:42  liang
21966 + * Add six more bits for the Demodulator capabilities to deal with 2nd order
21967 + * time tracking & PLLs, as well as shorter NEEC & PFEEC, and front end HBF.
21968 + *
21969 + * Revision 1.44  1997/02/17  03:09:00  mwg
21970 + * Added LAPM statistics printout.
21971 + *
21972 + * Revision 1.43  1997/02/04  08:38:47  mwg
21973 + * Added dc cancelled samples printout.
21974 + *
21975 + * Revision 1.42  1997/01/29  21:40:28  mwg
21976 + * Changed the way timers work: now time is passed as Q4 ms instead of ticks.
21977 + * Completed the 8KHz front end implementation.
21978 + * Got rid of kSamplesPerSecond constant.
21979 + *
21980 + * Revision 1.41  1997/01/24  07:13:50  mwg
21981 + * Added new statuses for automoder.
21982 + *
21983 + * Revision 1.40  1997/01/23  02:03:08  mwg
21984 + * Replaced old sample rate conversion with the newer one.
21985 + * Still has to resolve the automoding issue.
21986 + *
21987 + * Revision 1.39  1997/01/21  00:55:04  mwg
21988 + * Added 8KHz front end functionality.
21989 + *
21990 + * Revision 1.38  1996/11/13  00:30:55  liang
21991 + * Add kAutoLoadReductionEnabled to demodCapabilities so that PFEEC, FEEC, IEEC
21992 + * can be disabled automatically, but for worst processor loading test they
21993 + * won't be disabled when this bit is not set.
21994 + *
21995 + * Revision 1.37  1996/11/07  23:07:18  mwg
21996 + * Rearranged global variables to allow V.17 short training.
21997 + *
21998 + * Revision 1.36  1996/09/17  23:55:05  liang
21999 + * Change kMaxDataBlockSize from 16 to 24 to handle high data rates.
22000 + *
22001 + * Revision 1.35  1996/09/05  19:43:39  liang
22002 + * Removed caller ID error status code kCallerIDUnknownMessageType, and
22003 + * added caller ID status codes kCallerIDUnknownMessage & kCallerIDWholeMessage.
22004 + * Changed the callerIDStatus report structure.
22005 + *
22006 + * Revision 1.34  1996/08/29  00:36:57  liang
22007 + * Added kLapmTxFrameStatus and kLapmRxFrameStatus.
22008 + *
22009 + * Revision 1.33  1996/08/27  22:56:01  liang
22010 + * Added kResetHardware status code.
22011 + *
22012 + * Revision 1.32  1996/08/23  23:35:35  liang
22013 + * Add kATDebugStatus and function SoftModemGetHybridDelay.
22014 + *
22015 + * Revision 1.31  1996/08/22  01:13:19  yg
22016 + * Added AT command processor.
22017 + *
22018 + * Revision 1.30  1996/08/12  21:46:47  mwg
22019 + * Added code to report capabilities.
22020 + *
22021 + * Revision 1.29  1996/08/10  01:59:59  mwg
22022 + * Added report of the sent rate sequence;
22023 + *
22024 + * Revision 1.28  1996/08/07  22:15:02  mwg
22025 + * Added new status reports:
22026 + * kRemoteFreqOffset
22027 + * kIEECDeactivated
22028 + * kPFEECDeactivated
22029 + *
22030 + * Revision 1.27  1996/06/27  05:15:48  mwg
22031 + * Added V.24 circuit status.
22032 + *
22033 + * Revision 1.26  1996/06/27  02:12:43  mwg
22034 + * Cleaned the code.
22035 + *
22036 + * Revision 1.25  1996/06/20  23:57:30  mwg
22037 + * Added new training progress status.
22038 + *
22039 + * Revision 1.24  1996/06/18  21:13:50  mwg
22040 + * Added trellis MSE data logging.
22041 + *
22042 + * Revision 1.23  1996/06/12  02:31:10  mwg
22043 + * Added new type: VeryLong
22044 + *
22045 + * Revision 1.22  1996/06/08  22:15:39  mwg
22046 + * Added new status report: kCleardownStarted
22047 + * Added new field for the features: kV34bisEnabled
22048 + *
22049 + * Revision 1.21  1996/05/31  00:29:11  liang
22050 + * Add feature bit kV34ExtraINFOPreamble.
22051 + *
22052 + * Revision 1.20  1996/05/30  23:28:31  mwg
22053 + * Replaced enums with #defines
22054 + *
22055 + * Revision 1.19  1996/05/25  00:38:27  mwg
22056 + * Added kProjectedDataRate training progress report.
22057 + *
22058 + * Revision 1.18  1996/05/24  23:27:15  mwg
22059 + * Added mode status codes.
22060 + *
22061 + * Revision 1.17  1996/05/10  05:39:59  liang
22062 + * Move the includes for DEBUG inside "ifndef SoftModemTypes" so that
22063 + * cap build won't break.
22064 + *
22065 + * Revision 1.16  1996/05/08  01:49:34  mwg
22066 + * Added capability to setup auxiliary data channel handlers.
22067 + *
22068 + * Revision 1.15  1996/05/07  22:51:08  liang
22069 + * Added group delay estimation and improved symbol rate selection process.
22070 + *
22071 + * Revision 1.14  1996/05/06  06:49:09  mwg
22072 + * Fixed linux problems.
22073 + *
22074 + * Revision 1.13  1996/05/02  08:40:16  mwg
22075 + * Merged in Chromatic bug fixes.
22076 + *
22077 + * Revision 1.12  1996/05/02  02:26:21  mwg
22078 + * Added code to implement dozing functionality for v.34.
22079 + *
22080 + * Revision 1.11  1996/05/01  22:43:13  mwg
22081 + * Added new command: kDozeCmd;
22082 + *
22083 + * Revision 1.10  1996/05/01  19:20:16  liang
22084 + * Add command codes kInitiateRetrainCmd and kInitiateRateRenegotiationCmd.
22085 + *
22086 + * Revision 1.9  1996/04/25  01:12:37  mwg
22087 + * Added new flag: rapid preliminary EC training.
22088 + *
22089 + * Revision 1.8  1996/04/20  02:26:22  mwg
22090 + * Added preliminary far-end echo support
22091 + *
22092 + * Revision 1.7  1996/04/15  23:26:16  mwg
22093 + * Changed flag definitions for v34 modem.
22094 + *
22095 + * Revision 1.6  1996/04/04  02:35:50  liang
22096 + * Change kCid from 0x0080 to 0x0004 (0x0080 is defined as kV32).
22097 + *
22098 + * Revision 1.5  1996/03/08  23:07:01  mwg
22099 + * Added name for the struct.
22100 + *
22101 + * Revision 1.4  1996/03/02  00:59:27  liang
22102 + * Added typedef for V34CodingParameters structure.
22103 + *
22104 + * Revision 1.3  1996/02/27  02:28:31  mwg
22105 + * Fixed a bug in kLapmLongADPEnabled definition.
22106 + *
22107 + * Revision 1.2  1996/02/19  23:50:59  liang
22108 + * Removed compressionSetup parameter from the link layer command structure.
22109 + *
22110 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
22111 + * Redesigned the project directory structure. Merged V.34 into the project.
22112 + *
22113 + * Revision 1.5  1996/01/15  23:26:04  liang
22114 + * Change the softmodem command structure name from SoftwareModemCommand
22115 + * to SoftwareModemCommandParameters.
22116 + *
22117 + *****************************************************************************/
22118 +#ifndef        SoftModemPh
22119 +#define        SoftModemPh
22120 +
22121 +/****************************************************************************/
22122 +/*     1.      Type definitions.                                                                                                       */
22123 +/*                                                                                                                                                     */
22124 +/*     1.1     General types                                                                                                           */
22125 +/****************************************************************************/
22126 +
22127 +#ifndef SM_DECL
22128 +#define SM_DECL
22129 +#endif
22130 +
22131 +#ifdef __VxWORKS__
22132 +#include <types/vxTypesOld.h>
22133 +#endif
22134 +
22135 +#ifdef DEBUG
22136 +/* We have to define __wchar_t for Linux       */
22137 +#if defined __linux__ && !defined _NO_WHCAR_DEF_
22138 +typedef        long int __wchar_t;
22139 +#endif
22140 +#if !defined(__KERNEL__) && !defined(_CFE_)
22141 +#include <stdio.h>
22142 +#include <stdlib.h>
22143 +#endif
22144 +
22145 +#if defined(__linux__) || defined (__unix__) || defined (__unix) || (defined (__mips__) && !defined(_CFE_) && !defined(VXWORKS) && !defined(TARG_OS_RTEMS))/* enable if necessary, but not for dos-based builds */
22146 +#include <linux/types.h>
22147 +#endif
22148 +
22149 +
22150 +#endif /* DEBUG */
22151 +
22152 +#if defined(W95_DRIVER) 
22153 +#pragma code_seg("_LTEXT", "LCODE")
22154 +#pragma data_seg("_LDATA", "LCODE")
22155 +#pragma const_seg("_LDATA", "LCODE")
22156 +#pragma bss_seg("_LDATA", "LCODE")
22157 +#pragma pack(1)
22158 +#endif /* W95_DRIVER */
22159 +
22160 +#ifndef SoftModemTypes
22161 +#include "SoftModemTypes.h"
22162 +#endif /* SoftModemTypes */
22163 +
22164 +
22165 +typedef struct
22166 +       {
22167 +       schar x, y;
22168 +       } ComplexByte;
22169 +
22170 +typedef struct
22171 +       {
22172 +       uchar numerator;
22173 +       uchar denominator;
22174 +       } Ratio;
22175 +
22176 +#ifdef PEGASUS
22177 +typedef union
22178 +       {
22179 +       struct
22180 +               {
22181 +               short x, y;
22182 +               };
22183 +       
22184 +       long foo;
22185 +       } ComplexShort;
22186 +#else
22187 +typedef struct
22188 +       {
22189 +       short x, y;
22190 +#ifdef GREENHILL
22191 +    long a[0];
22192 +#endif
22193 +       } ComplexShort;
22194 +#endif
22195 +
22196 +typedef struct
22197 +       {
22198 +       long x, y;
22199 +       } ComplexLong;
22200 +
22201 +typedef struct
22202 +       {
22203 +       ushort  x0, x1, x2;
22204 +       short   x3;
22205 +       } VeryLong;
22206 +
22207 +typedef union
22208 +       {
22209 +       struct
22210 +               {
22211 +               uchar number;
22212 +               uchar defaultValue;                     /* default value */                     
22213 +               uchar maxValue;                 /* max allowed value */
22214 +               uchar minValue;                 /* should be greater then maxValue to make reg readonly */
22215 +               } param;
22216 +       long alignment;
22217 +       } SRegisterDefinition;
22218 +
22219 +#define MacroPaste2(a,b) a##b
22220 +#define MacroPaste(a,b) MacroPaste2(a,b)
22221 +#define ALWAYS_LONG_ALIGN() long MacroPaste(ALIGNMENT,__LINE__);
22222 +
22223 +#ifdef USE_LONG_ALIGN
22224 +#define LONG_ALIGN() ALWAYS_LONG_ALIGN()
22225 +#else
22226 +#define LONG_ALIGN()
22227 +#endif
22228 +
22229 +typedef        ulong   bitMap;
22230 +
22231 +typedef        int     pace;
22232 +#define kStop          0
22233 +#define kVerySlow      1
22234 +#define kSlow          2
22235 +#define kMedium                3
22236 +#define kFast          4
22237 +
22238 +
22239 +/****************************************************************************/
22240 +/*     1.      Type definitions.                                                                                                       */
22241 +/*                                                                                                                                                     */
22242 +/*     1.2     Modem specific types                                                                                            */
22243 +/****************************************************************************/
22244 +
22245 +typedef        long directionType;
22246 +#define kXmt   0
22247 +#define kRcv   1
22248 +#define kXmtRcv        2
22249 +
22250 +
22251 +#define        originating             kXmt
22252 +#define        answering               kRcv
22253 +#define        kOrg                    kXmt
22254 +#define        kAns                    kRcv
22255 +#define        kOrgAns                 kXmtRcv
22256 +
22257 +#define        ORIGINATING             originating
22258 +#define        ANSWERING               answering
22259 +
22260 +typedef        int     pcmCodingType;
22261 +#define        kMuLawPCM       0
22262 +#define        kALawPCM        1
22263 +
22264 +#define        kMuLawPCMScaleShift             2
22265 +#define        kALawPCMScaleShift              3
22266 +
22267 +/* link layer and framer share defines */
22268 +typedef        bitMap  framerType;
22269 +typedef        bitMap  linkLayerType;
22270 +#define kNoFramer      0
22271 +#define kSync          0x00000001
22272 +#define kAsync         0x00000002
22273 +#define kHDLC          0x00000004
22274 +#define kLapm          0x00000008
22275 +#define kMnp           0x00000010
22276 +#define kV70           0x00000020
22277 +#define kSAM           0x00000040
22278 +
22279 +       
22280 +typedef        bitMap  modulationMap;
22281 +typedef        bitMap  symbolRateMap;
22282 +typedef        bitMap  dataRateMap;
22283 +typedef        bitMap  featureMap;
22284 +typedef        bitMap  breakType;
22285 +
22286 +typedef        bitMap  audioType;
22287 +#define        kRawAudio               0
22288 +#define        kAudioG729A             1
22289 +#define        kAudioG729              2
22290 +#define        kAudioG723              3
22291 +
22292 +
22293 +#ifndef ADSL_MODEM
22294 +typedef long   modemStatusCode;
22295 +#endif
22296 +       /* Information status Codes: 1-31               */
22297 +#define kSetSampleRate                         1
22298 +#define kModulationKnown                       2
22299 +#define kRxSymbolRate                          3
22300 +#define kTxSymbolRate                          4
22301 +#define kRxCarrierFreq                         5
22302 +#define kTxCarrierFreq                         6
22303 +#define kTxPreemphasisFilter           7
22304 +#define kTxPowerAdjustment                     8
22305 +#define kRemoteTxPreemphasisFilter     9
22306 +#define kRemoteTxPowerAdjustment       10
22307 +#define kRxRateKnown                           11
22308 +#define kTxRateKnown                           12
22309 +#define kRxDataModeActive                      13
22310 +#define kTxDataModeActive                      14
22311 +#define kTxSignalCompleted                     15
22312 +#define kDTMFSignalDetected                    16
22313 +#define kModemSignalDetected           17
22314 +#define kCallProgressSignalDetected    18
22315 +#define kCustomSignalDetected          19
22316 +#define kFaxPreambleDetected           20
22317 +#define kV24CircuitStatusChange                21
22318 +#define kHookStateChange                       22
22319 +#define kCallWaitingToneDetected       23
22320 +#define kMultiToneSignalDetected       24
22321 +#define kPulseShuntStateChange         25
22322 +#define kRingFrequency              26
22323 +
22324 +
22325 +       /* Warning status Codes:                32-64   */
22326 +#define kError                                         32
22327 +#define kV34Exception                          33
22328 +#define kClearDownLocal                                34
22329 +#define kClearDownRemote                       35
22330 +#define kCarrierPresent                                36
22331 +#define kCarrierLost                           37
22332 +#define kRetrainingLocal                       38
22333 +#define kRetrainingRemote                      39
22334 +#define kRateRenegotiationLocal                40
22335 +#define kRateRenegotiationRemote       41
22336 +#define kFallbackStarted                       42
22337 +#define kFallForwardStarted                    43
22338 +#define kCleardownStarted                      44
22339 +#define kIllegalCommand                                45
22340 +       
22341 +       /* Auxiliary status Codes:      64-..   */      
22342 +#define kTrainingProgress                      64
22343 +#define kConnectionInfo                                65
22344 +#define kDialerStatus                          66
22345 +#define kFramingInfo                           67
22346 +#define kBreakReceived                         68
22347 +#define kLapmStatus                                    69
22348 +#define kLapmParameter                         70
22349 +#define kV42bisStatus                          71
22350 +#define kCallerIDStatus                                72
22351 +#define kIOStatus                                      73
22352 +#define kCapabilitiesStatus                    74
22353 +#define kSpeakerStatus                         75
22354 +#define kATProfileChanged                      76
22355 +#define kATDebugStatus                         77
22356 +#define        kResetHardware                          78
22357 +#define        kV8bisStatus                            79
22358 +#define kMnpStatus                                     80
22359 +#define kMnpParameter                          81
22360 +#define kV70Status                                     82
22361 +#define kV70Parameter                          83
22362 +#define kFaxClass2Status                       84
22363 +#define kAudioStatus                           85
22364 +#define kAudioParameter                                86
22365 +#define kOverlayStatus                         87
22366 +#define kCallerIDCircuitStatus         88
22367 +#define kV80Status                                     89
22368 +#define kV80Parameter                          90
22369 +#define kLocalCountryChanged           91
22370 +#define kDTERateChanged                                92
22371 +#define kATResponse                                    93
22372 +#define kFramerConfigured                      94
22373 +#define kA8RStatus                                     95
22374 +#define kA8TStatus                                     96
22375 +#define        kVersionStatus                          97
22376 +
22377 +       /* Testing status codes:        128-... */
22378 +       /* These statuses are generated by modem test suit      */
22379 +#define kTestFinished                          128
22380 +#define kConnectivityTestFinished      129
22381 +#define kTestCheckSum                          130
22382 +#define kLogFileControl                                131
22383 +#define kTestAtmVcFinished                     132
22384 +#define kTestClearEocFinished          133
22385 +#define kTestG997Finished                      134
22386 +
22387 +typedef long   modemErrorCode;
22388 +#define kNoError                               0
22389 +#define kErrorTimerExpired             1
22390 +#define kErrorNoSReceived              2
22391 +#define kErrorNoSbarReceived   3
22392 +
22393 +
22394 +typedef long   dialerStatusCode;
22395 +#define kDialCompleted                         0
22396 +#define kNoDialToneDetected                    1
22397 +#define kBongToneDetected                      2
22398 +#define kNoBongToneDetected                    3
22399 +#define kErrorIllegalDialModifier      5
22400 +#define kDialStarted                           6
22401 +#define kExternalPulseDialDigit                7
22402 +
22403 +
22404 +typedef long   framingInfoCode;
22405 +#define kRxFrameOK                                     0
22406 +#define kRxFrameTooLong                                1
22407 +#define kRxFrameCRCError                       2
22408 +#define kTxFrameUnderrun                       3
22409 +#define kRxFrameOverrun                                4
22410 +#define kRxFrameAborted                                5
22411 +#define kRxFrameParityError                    6
22412 +#define kRxFrameFormatError                    7
22413 +#define        kRxFrameHDLCFlagsDetected       8
22414 +
22415 +
22416 +typedef long   IOStatusCode;
22417 +#define kRxDataReady           0
22418 +#define kRxBufferOverflow      1
22419 +#define kTxSpaceAvailable      2
22420 +#define kTxBufferEmpty         3
22421 +
22422 +typedef long   capabilitiesStatusCode;
22423 +#define kSymbolRates                           0
22424 +#define kDataRates                                     1
22425 +#define kFeatures                                      2
22426 +#define kDemodCapabilities                     3
22427 +#define kRateThresholdAdjustment       4
22428 +#define kXmtLevel                                      5
22429 +#define kHybridDelay                           6
22430 +#define kAuxFeatures                           7
22431 +
22432 +
22433 +typedef long   A8TStatusCode;
22434 +#define kA8TFinished                           0
22435 +
22436 +typedef long   callerIDStatusCode;
22437 +#define kCallerIDError                                 0
22438 +#define kCallerIDChannelSeizureReceived        1
22439 +#define kCallerIDMarkSignalReceived            2
22440 +#define kCallerIDTime                                  3
22441 +#define kCallerIDTelnum                                        4
22442 +#define kCallerIDName                                  5
22443 +#define kCallerIDEnd                                   6
22444 +#define kCallerIDUnknownMessage                        7
22445 +#define kCallerIDWholeMessage                  8
22446 +
22447 +
22448 +typedef long   callerIDErrorCode;
22449 +#define kCallerIDNoError                       0
22450 +#define kCallerIDMarkSignalError       1
22451 +#define kCallerIDTooManyMarkBits       2
22452 +#define kCallerIDMessageTooLong                3
22453 +#define kCallerIDChecksumError         4
22454 +
22455 +
22456 +typedef long   connectionInfoCode;
22457 +#define kRTDelay                       1
22458 +#define kRxSignalLevel         2
22459 +#define kTimingOffset          3
22460 +#define kFreqOffset                    4
22461 +#define kPhaseJitter           5
22462 +#define kSNR                           6
22463 +#define kNearEchoLevel         7
22464 +#define kSER                           8
22465 +#define kNearEndDelay          9
22466 +#define kFarEchoLevel          10
22467 +#define kL1L2SNRDifference     11
22468 +#define        kDCOffset                       12
22469 +#define        kTotalRxPower           13
22470 +#define        kRemoteFreqOffset       14
22471 +/* obsolete    #define kV8MenuDataWord1        15 */
22472 +/* obsolete    #define kV8MenuDataWord2        16 */
22473 +#define        kPCMP2AnalogDetSNR      17
22474 +#define        kPCMP2DigitalDetSNR     18
22475 +#define        kPCMP2RBSDetSNR         19
22476 +#define        kEqCenterTapOffset      20
22477 +#define        kPCMPadValue            21
22478 +#define        kPCMRBSMap                      22
22479 +#define        kPCMCodingType          23
22480 +#define        kPCMSpectralShapingBits                 24
22481 +#define        kLoopbackSelfTestResult                 25
22482 +#define        kEyeQuality                                             26
22483 +#define        kLoopbackSelfTestNewErrs                27
22484 +#define kV34EqlLengthStatus 28
22485 +#define kV34EqlOffsetStatus 29
22486 +#define        kV8CallMenuData         30
22487 +#define        kV8JointMenuData        31
22488 +#define kPCMClientIeecLengthStatus 32
22489 +#define kPCMClientIeecOffsetStatus 33
22490 +#define        kSeamlessRateChange     34
22491 +
22492 +typedef long   trainingProgressCode;
22493 +#define kPeriodicalSignalDetected              0
22494 +#define kPhaseReversalDetected                 1
22495 +#define kSignalStartDetected                   2
22496 +#define kSignalEndDetected                             3
22497 +#define kSSignalDetected                               4
22498 +#define kSbarSignalDetected                            5
22499 +#define kJ4SignalDetected                              6
22500 +#define kJ16SignalDetected                             7
22501 +#define kJprimeSignalDetected                  8
22502 +#define kMPSignalDetected                              9
22503 +#define kMPprimeSignalDetected                 10
22504 +#define kMPSignalSent                                  11
22505 +#define kMPprimeSignalSent                             12
22506 +#define kRateSignalDetected                            13
22507 +#define kESignalDetected                               14
22508 +#define kRateSignalSent                                        15
22509 +
22510 +#define        kAutomodingTryModulation                16
22511 +#define        kAutomodingCompleted                    17
22512 +#define        kRCFaxBitMapStatus                              18
22513 +       
22514 +#define kV8CIDetected                                  19
22515 +#define kV8ANSToneDetected                             20
22516 +#define kV8ANSamDetected                               21
22517 +#define kV8CMDetected                                  22
22518 +#define kV8JMDetected                                  23
22519 +#define kV8CJDetected                                  24
22520 +#define kV8Finished                                            25
22521 +       
22522 +#define kV34Phase2Started                              26
22523 +#define kV34Phase2INFOSequenceDetected 27
22524 +#define kV34Phase2NearEndEchoDetected  28
22525 +#define kV34Phase2L1Receiving                  29
22526 +#define kV34Phase2L2Receiving                  30
22527 +#define kV34Phase2Finished                             31
22528 +#define kV34Phase3Started                              32
22529 +#define kV34Phase3Finished                             33
22530 +#define kV34Phase4Started                              34
22531 +#define kV34Phase4Finished                             35
22532 +#define kV34DecoderParameters                  36
22533 +#define kV34EncoderParameters                  37
22534 +
22535 +#define kMaxLocalRxDataRate                            38
22536 +#define kMaxLocalTxDataRate                            39
22537 +#define kMaxRemoteRxDataRate                   40
22538 +#define kMaxRemoteTxDataRate                   41
22539 +#define kProjectedDataRate                             42
22540 +#define kFEECDeactivated                               43
22541 +#define kIEECDeactivated                               44
22542 +#define kPFEECDeactivated                              45
22543 +#define kPhaseJitterDeactivated                        46
22544 +
22545 +#define        kPCMP2DetectedDigitalConnection 47
22546 +#define        kPCMP2DetectedRBS                               48
22547 +#define        kX2DetectedPhase1Escape                 49
22548 +
22549 +#define kStarted1200BpsTraining                        50
22550 +#define kStarted2400BpsTraining                        51
22551 +#define kUnscrambledOneDetected                        52
22552 +#define kScrambled1200BpsOneDetected   53
22553 +#define kScrambled2400BpsOneDetected   54
22554 +#define kV22BisS1Detected                              55
22555 +#define        kV22InitiateLoop2Test                   56
22556 +#define        kV22RespondLoop2Test                    57
22557 +#define        kV22Loop2TestAlt01Detected              58
22558 +
22559 +#define        kDataModemLoop1TestStarted              59
22560 +#define        kDataModemLoop1TestFinished             60
22561 +#define        kDataModemLoop2TestStarted              61
22562 +#define        kDataModemLoop2TestFinished             62
22563 +#define        kDataModemLoop3TestStarted              63
22564 +#define        kDataModemLoop3TestFinished             64
22565 +#define        kDataModemSelfLoopTestEnabled   65
22566 +
22567 +#define kPCMPhase3Started                              70
22568 +#define kPCMPhase3Finished                             71
22569 +#define kPCMPhase4Started                              72
22570 +#define kPCMPhase4Finished                             73
22571 +
22572 +#define        kV90JaSignalDetected                    74              
22573 +#define        kV90JdSignalDetected                    75              
22574 +#define        kV90JdPrimeSignalDetected               76              
22575 +#define        kV90RSignalDetected                             77              
22576 +#define        kV90RBarSignalDetected                  78      
22577 +#define        kV90CPSignalDetected                    79      
22578 +
22579 +#define        kV90CPtSignalSent                               80
22580 +#define        kV90CPSignalSent                                81
22581 +#define        kV90CPprimeSignalSent                   82
22582 +
22583 +
22584 +#define        kV34SeamlessRateChangeRequestSent               83
22585 +#define        kV34SeamlessRateChangeUpdateSent                84
22586 +#define        kV34SeamlessRateChangeRequestReceived   85
22587 +#define        kV34SeamlessRateChangeUpdateReceived    86
22588 +#define        kV34SeamlessRateChangeUpdateTimeout             87
22589 +
22590 +#define kV90JaSignalAcknowledged                               88
22591 +
22592 +#define        kV34HCtrlChanPPhDetected                100
22593 +#define        kV34HCtrlChanMPhDetected                101
22594 +#define        kV34HCtrlChanRatesKnown                 102
22595 +#define        kV34HDXCtrlChanBinary1Detected  103
22596 +#define        kV34HDXPhase3Started                    104
22597 +#define        kV34HDXPhase3Finished                   105
22598 +#define        kV34HDXPrimChanBinary1Detected  106
22599 +#define kFlexEventTRN2AFinished         107
22600 +
22601 +#define kV32RanginigStarted                            108
22602 +#define kV32RangingStarted                             108
22603 +#define kV32RanginigFinished                   109
22604 +#define kV32RangingFinished                            109
22605 +
22606 +
22607 +typedef long   lapmStatusCode;
22608 +#define kLapmDisconnected                      0       /* LAPM disconnected */
22609 +#define kLapmConnected                         1       /* LAPM is connected */
22610 +#define kLapmV42ODPDetected                    2       /* LAPM ODP is detected */
22611 +#define kLapmV42ADPDetected                    3       /* LAPM V.42 ADP is detected    */
22612 +#define kLapmUnknownADPDetected                4       /* LAPM Unsupported ADP is detected     */
22613 +#define kLapmTimeout                           5       /* LAPM Timeout         */
22614 +#define        kLapmMNPFrameDetected           6       /* LAPM detected MNP frame      */
22615 +#define kLapmDPDetectionTimedOut       7       /* LAPM Unsupported ADP is detected     */
22616 +#define kLapmError                                     8       /* LAPM Error   */
22617 +#define kLapmTestResult                                9       /* LAPM loopback test result */
22618 +#define        kLapmTxFrameStatus                      10
22619 +#define        kLapmRxFrameStatus                      11
22620 +#define        kLapmTxStatistics                       12
22621 +#define        kLapmRxStatistics                       13
22622 +
22623 +typedef long   lapmTakedownReason;
22624 +#define kLapmRemoteDisconnect  0
22625 +#define kLapmLocalDisconnect   1
22626 +#define kLapmCannotConnect             2
22627 +#define kLapmProtocolError             3
22628 +#define kLapmCompressionError  4
22629 +#define kLapmInactivityTimer   5
22630 +#define kLapmRetryFailed               6
22631 +
22632 +
22633 +typedef long   lapmParameterCode;
22634 +#define kLapmXmtK                      0
22635 +#define kLapmRcvK                      1
22636 +#define kLapmXmtN401           2
22637 +#define kLapmRcvN401           3
22638 +#define kLapmTESTSupport       4
22639 +#define kLapmSREJSupport       5
22640 +#define kLapmCompDir           6
22641 +#define kLapmCompDictSize      7
22642 +#define kLapmCompStringSize    8
22643 +
22644 +
22645 +typedef long   lapmErrorCode;
22646 +#define kLapmNoError           0
22647 +#define kLapmBufferOverflow    1
22648 +#define kLapmFrameTooLong      2
22649 +#define kLapmBadFrame          3
22650 +#define kLapmUnknownEvent      4
22651 +/* 6 is reserved for kLapmRetryFailed defined above */
22652 +
22653 +
22654 +typedef long   lapmTestResultCode;
22655 +#define kLapmTestPassed                                0
22656 +#define kLapmTestRequestIgnored                1
22657 +#define kLapmTestAlreadyInProgress     2
22658 +#define kLapmTestNotSupported          3
22659 +#define kLapmTestFailed                                4
22660 +
22661 +
22662 +typedef long   v42bisStatusCode;
22663 +#define kV42bisEncoderTransparentMode  0       /* V.42bis encoder transparent mode active */
22664 +#define kV42bisEncoderCompressedMode   1       /* V.42bis encoder compressed mode active */
22665 +#define kV42bisDecoderTransparentMode  2       /* V.42bis decoder transparent mode active */
22666 +#define kV42bisDecoderCompressedMode   3       /* V.42bis decoder compressed mode active */
22667 +#define kV42bisError                                   4       /* V.42bis error */
22668 +#define        kV42bisEncoderStatistics                5
22669 +#define        kV42bisDecoderStatistics                6
22670 +
22671 +
22672 +typedef long   v42bisErrorCode;
22673 +#define kV42bisUndefinedEscSequence    0       /* V.42bis undefined escape sequence            */
22674 +#define kV42bisCodewordSizeOverflow    1       /* V.42bis codeword size overflow                       */
22675 +#define kV42bisUndefinedCodeword       2       /* V.42bis undefined codeword                           */
22676 +
22677 +typedef long   mnpStatusCode;
22678 +#define kMnpDisconnected                       0       /* Mnp disconnected */
22679 +#define kMnpConnected                          1       /* Mnp is connected */
22680 +#define kMnpFallback                           2       /* Mnp is falling back to buffer mode */
22681 +#define kMnpError                                      3       /* Mnp Error    */
22682 +#define        kMnpTimeout                                     4       /* Mnp Timeout */
22683 +#define        kMnpInvalidLT                           5       /* Invalid LT received */
22684 +#define        kMnpRetransmitFrame                     6
22685 +#define        kMnpNack                                        7
22686 +#define        kMnpTxFrameStatus                       8
22687 +#define        kMnpRxFrameStatus                       9
22688 +#define        kMnpTxStatistics                        10
22689 +#define        kMnpRxStatistics                        11
22690 +
22691 +typedef long   mnpTakedownReason;
22692 +#define kMnpRemoteDisconnect           0
22693 +#define kMnpLocalDisconnect                    1
22694 +#define kMnpCannotConnect                      2
22695 +#define kMnpProtocolError                      3
22696 +#define kMnpCompressionError           4
22697 +#define kMnpInactivityTimer                    5
22698 +#define kMnpRetryFailed                                6
22699 +
22700 +
22701 +typedef long   mnpParameterCode;
22702 +#define kMnpProtocolLevel                      0
22703 +#define kMnpServiceClass                       1
22704 +#define kMnpOptimizationSupport                2
22705 +#define kMnpCompressionSupport         3
22706 +#define kMnpN401                                       4
22707 +#define kMnpK                                          5
22708 +
22709 +
22710 +typedef long   mnpErrorCode;
22711 +#define kMnpNoError                                    0                       
22712 +#define kMnpBufferOverflow                     1
22713 +#define kMnpFrameTooLong                       2
22714 +#define kMnpBadFrame                           3
22715 +#define kMnpUnknownEvent                       4
22716 +
22717 +
22718 +typedef long   v70StatusCode;
22719 +#define kV70Disconnected                       0       /* V70 disconnected */
22720 +#define kV70Connected                          1       /* V70 is connected */
22721 +#define kV70Error                                      2       /* V70 Error    */
22722 +#define        kV70Timeout                                     3       /* V70 Timeout */
22723 +#define kV70ChannelDown             4  /* V70 channel released */
22724 +#define kV70ChannelUp               5  /* V70 channel established */
22725 +#define kV70AudioChannelDown        6  /* V70 audio channel released */
22726 +#define kV70AudioChannelUp          7  /* V70 audio channel established */
22727 +#define kV70DataChannelDown         8  /* V70 data channel released */
22728 +#define kV70DataChannelUp           9  /* V70 data channel established */
22729 +#define kV70OOBChannelDown          10 /* V70 out-of-band channel released */
22730 +#define kV70OOBChannelUp            11  /* V70 out-of-band channel established */
22731 +#define        kV70TxFrameStatus                       12
22732 +#define        kV70RxFrameStatus                       13
22733 +#define        kV70TxStatistics                        14
22734 +#define        kV70RxStatistics                        15
22735 +#define        kV70StateTransition                     16
22736 +
22737 +typedef long   v70TakedownReason;
22738 +#define kV70RemoteDisconnect           0
22739 +#define kV70LocalDisconnect                    1
22740 +#define kV70CannotConnect                      2
22741 +#define kV70ProtocolError                      3
22742 +#define kV70CompressionError           4
22743 +#define kV70InactivityTimer                    5
22744 +#define kV70RetryFailed                                6
22745 +
22746 +
22747 +typedef long   v70ParameterCode;
22748 +#define kV70SuspendResume              0
22749 +#define kV70CrcLength              1
22750 +#define kV70NumberOfDLCs               2
22751 +#define kV70uIH                            3
22752 +
22753 +#define kV70LapmXmtK                           10
22754 +#define kV70LapmRcvK                           11
22755 +#define kV70LapmXmtN401                                12
22756 +#define kV70LapmRcvN401                                13
22757 +#define kV70LapmTESTSupport                    14
22758 +#define kV70LapmSREJSupport                    15
22759 +#define kV70LapmCompDir                                16
22760 +#define kV70LapmCompDictSize           17
22761 +#define kV70LapmCompStringSize         18
22762 +
22763 +#define kV70AudioHeader                    20   /* if audio header is present in audio frames */
22764 +#define kV70BlockingFactor             21   /* audio blocking factor (default 1)  */
22765 +#define kV70SilenceSuppression      22   /* audio silence suppression */
22766 +
22767 +
22768 +
22769 +typedef long   v70ErrorCode;
22770 +#define kV70NoError                                    0                       
22771 +#define kV70BadFrame                           1                       
22772 +
22773 +typedef long   audioStatusCode;
22774 +#define kAudioFramesLost                       0        /* One or more audio frames were lost */
22775 +#define kAudioTxBufferOverflow         1
22776 +#define kAudioRxBufferOverflow         2
22777 +#define kAudioRxBufferUnderflow                3
22778 +
22779 +
22780 +typedef long   v80StatusCode;
22781 +#define kV80Disconnected                       0       /* V80 disconnected */
22782 +#define kV80Connected                          1       /* V80 is connected */
22783 +#define kV80Error                                      2       /* V80 Error    */
22784 +#define kV80InBandStatus                       3       /* V80 in-band SAM status */
22785 +#define        kV80TxFrameStatus                       12
22786 +#define        kV80RxFrameStatus                       13
22787 +#define        kV80TxStatistics                        14
22788 +#define        kV80RxStatistics                        15
22789 +
22790 +typedef long   v80TakedownReason;
22791 +#define kV80RemoteDisconnect           0
22792 +#define kV80LocalDisconnect                    1
22793 +
22794 +typedef long   v80ErrorCode;
22795 +#define kV80NoError                                    0                       
22796 +#define kV80BadFrame                           1                       
22797 +
22798 +typedef long   overlayStatusCode;
22799 +#define kOverlayBegin                          0       /* DSP has halted */
22800 +#define kOverlayEnd                                    1       /* DSP has received entire overlay */
22801 +#define kOverlayElapsedTime                    2       /* time elapsed(as viewed by datapump) during overlay */
22802 +#define kOverlayRecordingData          3       /* ms of data that we are recording */
22803 +#define kOverlayReplayingData          4       /* ms of data that we have replayed so far */
22804 +#define kOverlayReplayDone                     5       /* playback is done */
22805 +
22806 +/* types for kOverlayRecording/ReplayingData */
22807 +#define kOverlayTxData                         0
22808 +#define kOverlayRxData                         1
22809 +
22810 +/*
22811 + * Rockwell faxmodem compatible bitmap (kRCFaxBitMapStatus)
22812 + */
22813 +#define        kRCFaxFCD       0x01
22814 +#define        kRCFaxP2        0x02
22815 +#define        kRCFaxPN        0x04
22816 +#define        kRCFaxDCD       0x08
22817 +#define        kRCFaxTX        0x10
22818 +#define        kRCFaxCTS       0x20
22819 +
22820 +
22821 +#ifndef ADSL_MODEM
22822 +typedef long   modemCommandCode;
22823 +#endif
22824 +       /* Basic Action commands                00-63           */
22825 +#define kIdleCmd                                               0
22826 +#define kStartFaxModemCmd                              1
22827 +#define kStartDataModemCmd                             2
22828 +#define kStartCallProgressMonitorCmd   3
22829 +#define kSendTonesCmd                                  4
22830 +#define kStartCallerIDRcvCmd                   5
22831 +#define kSetLinkLayerCmd                               6
22832 +#define kSetFramerCmd                                  7
22833 +#define kTestLinkLayerCmd                              8
22834 +#define kIdleRcvCmd                                            9
22835 +#define kIdleXmtCmd                                            10
22836 +#define kSetStatusHandlerCmd                   11
22837 +#define kSetEyeHandlerCmd                              12
22838 +#define kSetLogHandlerCmd                              13
22839 +#define kSendBreakCmd                                  14
22840 +#define kSendTestCmd                                   15
22841 +#define kDisconnectLinkCmd                             16
22842 +#define kSetXmtGainCmd                                 17
22843 +#define kStartADSICmd                                  18
22844 +#define kSetHybridDelayCmd                             19
22845 +#define kCleardownCmd                                  20
22846 +#define kInitiateRetrainCmd                            21
22847 +#define kInitiateRateRenegotiationCmd  22
22848 +#define        kDialToneIndicator                              23
22849 +#define kSetRxDataHandler                              24      /* not used yet */
22850 +#define kSetTxDataHandler                              25      /* not used yet */
22851 +#define kSetAuxRxDataHandler                   26
22852 +#define kSetAuxTxDataHandler                   27
22853 +#define kRingIndicatorCmd                              28
22854 +#define kDTERateIndicatorCmd                   29
22855 +#define        kStartV8bisCmd                                  30
22856 +#define kSendMultiTonesCmd                             31
22857 +#define kSetMultiToneParamsCmd                 32
22858 +#define kSetModemSampleRateCmd                 33
22859 +#define kStartDataModemPTTTestCmd              34
22860 +#define kStartDataModemLoopbackTestCmd 35
22861 +#define kRingFrequencyCmd                              36
22862 +#define kSetCallWaitingDetectorStateCmd        37
22863 +#define kV34HDXTurnOffCurrentModeCmd   38
22864 +#define        kSetAudioCmd                                    39
22865 +#define        kLoopbackTestAutoRespEnableCmd  40
22866 +#define kSetCallProgressParamsCmd              41
22867 +#define kSetTrainingDelayReductionCmd  42
22868 +#define        kSetFaxECMPageBufferPtrCmd              43
22869 +#define kSetLineCurrentStateCmd                        44
22870 +#define        kSetFramerParameterCmd                  45
22871 +#define kStartDozeCmd                   46
22872 +#define kEndDozeCmd                     47
22873 +#define kStartRingFrequencyDetectorCmd  48
22874 +#define        kSetBufferingDelayAdjustmentCmd 49
22875 +
22876 +       /* Composite action commands    64-127          */
22877 +#define kDialCmd                                               64
22878 +#define kSendCallingToneCmd                            65
22879 +#define kV24CircuitChangeCmd                   66
22880 +#define        kStartATModeCmd                                 67
22881 +#define        kStopATModeCmd                                  68
22882 +#define        kSetATRegister                                  69
22883 +#define        kSetATRegisterLimits                    70
22884 +#define        kSetATIResponse                                 71
22885 +#define        kEnableATDebugMode                              72
22886 +#define        kSetWhiteListEntry                              73
22887 +#define        kSetBlackListEntry                              74
22888 +
22889 +#define kV70Setup                                          75      /* additional V70 configuration */
22890 +#define kEstablishChannel                          76      /* Establish new link layer channel (V70) */
22891 +#define kReleaseChannel                                        77      /* Release link layer channel (V70) */
22892 +#define kWaitChannelEstablished                        78      /* Wait for establishment of the new link layer channel (V70) */
22893 +
22894 +/* unused      79 */
22895 +#define kMnpOOBFrameCmd                                        80
22896 +#define kV80InBandCmd                                  81              /* V80 In-band commands */
22897 +#define kSetV250IdString                               82
22898 +#define        kSetInternationalTablesCmd              83
22899 +#define        kConfigureCountryCmd                    84
22900 +#define        kConigureCountryCmd                             84
22901 +#define        kV8ControlCmd                                   85
22902 +#define kV8bisSendMessage                              86
22903 +#define        kSetHWIdCmd                                             87
22904 +#define        kSetCodecIdCmd                                  88
22905 +#define        kOverCurrentDetected                    89
22906 +
22907 +
22908 +
22909 +typedef long v8ControlType;
22910 +#define kEnableDTEControl                              1
22911 +#define kSetV8ControlTimeout                   2
22912 +#define kSetCIValue                                            3
22913 +#define kSetCMValue                                            4
22914 +#define kSetJMValue                                            5
22915 +#define kSendCJ                                                        6
22916 +#define kSetCallFunctionCategory               7
22917 +
22918 +typedef long v250IdStringCode;
22919 +#define kGMIString                                             1
22920 +#define kGMMString                                             2
22921 +#define kGMRString                                             3
22922 +#define kGSNString                                             4
22923 +#define kGOIString                                             5
22924 +
22925 +typedef long   kCallProgressParameterCode;
22926 +#define        kModemSignalPowerThreshold              1
22927 +#define        kDialtonePowerThreshold                 2
22928 +#define        kRingBackPowerThreshold                 3
22929 +#define        kBusyPowerThreshold                             4
22930 +#define        kReorderPowerThreshold                  5
22931 +#define        k2ndDTnPowerThreshold                   6
22932 +#define        kMinDialtoneTime                                7
22933 +#define        kDialtoneFreqRange                              8
22934 +#define        kRingBackFreqRange                              9
22935 +#define        kBusyFreqRange                                  10
22936 +#define        kReorderFreqRange                               11
22937 +#define        k2ndDTnFreqRange                                12
22938 +
22939 +
22940 +typedef        long    framerParameterCode;
22941 +#define        kSetHDLCLeadingFlags            0
22942 +#define        kHDLCResetFlagDetection         1
22943 +#define        kSyncFramerSetup                        2
22944 +#define        kHDLCSendCRC                            3
22945 +#define kHDLCSendFlags                         4
22946 +#define        kHDLCSendAborts                         5
22947 +
22948 +
22949 +typedef        long logDataCode;
22950 +#define eyeData                                0
22951 +#define mseData                                1
22952 +#define rxData                         2
22953 +#define txData                         3
22954 +#define neecData                       4
22955 +#define eqlData                                5
22956 +#define ieecData                       6
22957 +#define feecData                       7
22958 +#define eqlPllData                     8
22959 +#define feecPllData                    9
22960 +#define timingData                     10
22961 +#define pjPhaseErrData         11
22962 +#define pjEstimateData         12
22963 +#define pjEstDiffData          13
22964 +#define pjCoefData                     14
22965 +#define inputSignalData                15
22966 +#define outputSignalData       16
22967 +#define agcGainData                    17
22968 +#define automoderData          18
22969 +#define v8CMData                       19
22970 +#define v8JMData                       20
22971 +#define inputAfterNeecData     21
22972 +#define eqlErrData                     22
22973 +#define dpskMicrobitsData      23
22974 +#define v34P2LSamplesData      24
22975 +#define phaseSplittedLData     25
22976 +#define fftedLData                     26
22977 +#define channelSNRData         27
22978 +#define noiseEstimateData      28
22979 +#define signalEstimateData     29
22980 +#define v34INFOData                    30
22981 +#define v34ChanProbData                31
22982 +#define v34P2OutputData                32
22983 +#define v8ANSamDetectData      33
22984 +#define pFeecData                      34
22985 +#define channelDelayData       35
22986 +#define timingOffsetData       36
22987 +#define trellisMSEData         37
22988 +#define interpolatedSignalData         38
22989 +#define dcCancelledSignalData          39
22990 +#define echoCancelledSignalData                40
22991 +#define predictorErrData                       41
22992 +#define commandInfoData                                42
22993 +#define unusedInfoData                         43
22994 +#define atCommandInfoData                      44
22995 +#define atResponseInfoData                     45
22996 +#define hwTerminalTxData                       46
22997 +#define hwTerminalRxData                       47
22998 +#define statusInfoData                         48
22999 +#define        channelResponseData                     49
23000 +#define        channelImpulseRespData          50
23001 +#define        x2PcmP1DetectorInData           51
23002 +#define        x2PcmP1DetectorOutData          52
23003 +#define eqlRealData                                    53
23004 +#define ieecRealData                           54
23005 +#define neecOutputData                         55
23006 +#define precodedEqlOutputData          56
23007 +#define eqlRealErrData                         57
23008 +#define idealEqlOutputData                     58
23009 +#define agcData                                                59
23010 +#define pcmInfidelityData                      60
23011 +#define v42bisCycleCount                       61
23012 +#define pcmImdOffsetCoefData           62
23013 +#define pcmImdOffsetData                       63
23014 +#define        v90RcvdDilLongData                      64
23015 +#define        v90RcvdDilShortData                     65
23016 +#define        v90DilProducedData                      66
23017 +#define        pcmEncoderKbitsData                     67
23018 +#define        pcmEncoderMbitsData                     68
23019 +#define        pcmEncoderSbitsData                     69
23020 +#define        pcmDecoderKbitsData                     70
23021 +#define        pcmDecoderMbitsData                     71
23022 +#define        pcmDecoderSbitsData                     72
23023 +#define        v90CPorCPtData                          73
23024 +#define        mnpDecoderInputData                     74
23025 +#define        mnpDecoderOutputData            75
23026 +#define        v42bisEncoderInputData          76
23027 +#define        v42bisDecoderInputData          77
23028 +#define        modulatorInputData                      78
23029 +#define        modulatorOutputData                     79
23030 +#define encodedStatusData                      80
23031 +#define blockFramerTxData                      81
23032 +#define blockFramerRxData                      82
23033 +#define framerTxData                           83
23034 +#define framerRxData                           84
23035 +#define        dpskBasebandData                        85
23036 +#define        dpskBasebandLPFedData           86
23037 +#define        dpskRealData                            87
23038 +#define bandEdgeCorrectedSignalData    88
23039 +#define atmLogData                                     89
23040 +#define clearEocLogData                                90
23041 +#define g997LogData                                    91
23042 +
23043 +
23044 +#define        kLogDataDelimiter       0xFEFEFEFE
23045 +
23046 +/****************************************************************************/
23047 +/*     1.      Type definitions.                                                                                                       */
23048 +/*                                                                                                                                                     */
23049 +/*     1.3     Handlers                                                                                                                        */
23050 +/****************************************************************************/
23051 +
23052 +typedef        void    (SM_DECL *rcvHandlerType)                       (void *gDslVars, int, short*);
23053 +typedef        void    (SM_DECL *xmtHandlerType)                       (void *gDslVars, int, short*);
23054 +typedef        int             (SM_DECL *xmtHandlerWithRtnValType)     (void *gDslVars, int, short*);
23055 +typedef        void    (SM_DECL *timerHandlerType)                     (void *gDslVars, long);
23056 +typedef        int             (SM_DECL *interpolatorHandlerType)      (void *gDslVars, int, short*, short*);
23057 +typedef        void    (SM_DECL *controlHandlerType)           (void *gDslVars, int);
23058 +
23059 +typedef        int             (SM_DECL *txDataHandlerType)    (void *gDslVars, int,   uchar*);
23060 +typedef        int             (SM_DECL *rxDataHandlerType)    (void *gDslVars, int,   uchar*);
23061 +
23062 +typedef        bitMap  (SM_DECL *signalDetectorType)   (void *gDslVars, int, long, long*);
23063 +
23064 +
23065 +typedef        void    (SM_DECL *hookHandlerType)              (void *gDslVars, Boolean);
23066 +
23067 +typedef        short*  (SM_DECL *sampBuffPtrType)              (void *gDslVars, int);
23068 +
23069 +typedef        void    (SM_DECL *eyeHandlerType)               (void *gDslVars, int, ComplexShort*);
23070 +typedef        void    (SM_DECL *logHandlerType)               (void *gDslVars, logDataCode, ...);
23071 +
23072 +typedef        void    (SM_DECL *voidFuncType)                 (void *gDslVars);
23073 +
23074 +typedef        int             (SM_DECL *txAudioHandlerType)   (void *gDslVars, int,   short*);
23075 +typedef        int             (SM_DECL *rxAudioHandlerType)   (void *gDslVars, int,   short*);
23076 +
23077 +
23078 +/****************************************************************************/
23079 +/*     1.      Type definitions.                                                                                                       */
23080 +/*                                                                                                                                                     */
23081 +/*     1.4     Structures                                                                                                                      */
23082 +/****************************************************************************/
23083 +
23084 +/*
23085 + * AT command processor definitions
23086 + */
23087 +#define kATRegistersNumber                             56
23088 +#define        kFirstConfigurationRegister             500
23089 +#define        kLastConfigurationRegister              515
23090 +#define        kFirstInternationalRegister             516
23091 +#define        kLastInternationalRegister              595
23092 +
23093 +
23094 +
23095 +#define kATMaxDialStringSize   128
23096 +typedef struct
23097 +       {
23098 +       struct 
23099 +               {
23100 +               uchar loadNumber;                                                               /* Which profile to load upon powerup/reset */
23101 +               uchar countryCode;                                                              /* T.35 Country Code */
23102 +               uchar profile[2][kATRegistersNumber];
23103 +               uchar dialString[4][kATMaxDialStringSize + 1];
23104 +               } config;
23105 +       ulong versionCode;
23106 +       ulong crcCheckSum;
23107 +       } NVRAMConfiguration;
23108 +
23109 +/* Structure to hold international settings */
23110 +typedef        struct
23111 +       {
23112 +       char                                            *name;
23113 +       int                                                     countryCode;
23114 +       const SRegisterDefinition       *userRegisters;
23115 +       const ulong                                     *configRegisters;
23116 +       } CountryDescriptor;
23117 +
23118 +/*
23119 + * V.34 coding parameters structure
23120 + */
23121 +
23122 +typedef struct
23123 +       {
23124 +       /* DO NOT CHANGE THE ORDER OF FIELDS IN THIS STRUCTURE!
23125 +        * (Some assembly code depends on it!)  If you
23126 +        * must add fields, please do so at the bottom.
23127 +        */
23128 +
23129 +       int                                     symbolRateIndex,
23130 +                                               dataRateIndex,
23131 +                                               userSNRAdjustment;
23132 +       Boolean                         auxChannel, 
23133 +                                               expConstellation, 
23134 +                                               precoding,
23135 +                                               nonlinearCoding; 
23136 +       schar   J,                      /* number of data frames in superframe                          */
23137 +                       P,                      /* number of mapping frames in a data frame                     */
23138 +                       r,                      /* number of high mapping frames in a data frame        */
23139 +                       b,                      /* number of data bits in a mapping frame                       */
23140 +                       W,                      /* number of aux bits in a data frame                           */
23141 +                       K,                      /* number of S bits in a mapping frame                          */
23142 +                       q,                      /* number of Q bits in a 2D symbol                                      */
23143 +                       M;                      /* number of rings in shell mapping                                     */
23144 +       long    nominalVariance;        /* the signal variance which gives 1e-2 BLER Q10 */
23145 +       int             bitsPerDataFrame;
23146 +       short   quantRoundOff,
23147 +                       quantMask;
23148 +       uchar   nTrellisStates, 
23149 +                       log2NTrellisStates; 
23150 +       short   gain1xmt,
23151 +                       gain2xmt,
23152 +                       gain1rcv,
23153 +                       gain2rcv;
23154 +       ushort  bitInversionPattern;
23155 +       } V34CodingParams;
23156 +
23157 +typedef        long                            v8bisStatusCode;
23158 +typedef        bitMap                          v8bisConnectionSetup;
23159 +#if defined(V8BIS) || defined(AT_COMMANDS_V8BIS)
23160 +#include "V8bisMainTypes.h"
23161 +#endif
23162 +
23163 +#define kMaxMultiTones                         4       /* MultiTone: search for up to this many tones at once */
23164 +
23165 +#ifndef ADSL_MODEM
23166 +typedef        struct
23167 +       {
23168 +       modemStatusCode         code;
23169 +       union
23170 +               {
23171 +               long                                            value;
23172 +               long                                            freq;
23173 +               modemErrorCode                          error;
23174 +               modulationMap                           modulation;
23175 +               modulationMap                           modemSignal;
23176 +               dataRateMap                                     dataRate;
23177 +               long                                            dtmfSignal;
23178 +               bitMap                                          callProgressSignal;
23179 +               bitMap                                          customSignal;
23180 +               void                                            *ptr;
23181 +               struct
23182 +                       {
23183 +                       long                            detected;
23184 +                       long                            numTones;
23185 +                       long                            tones[kMaxMultiTones];
23186 +                       } multiToneInfo;
23187 +               struct
23188 +                       {
23189 +                       v8bisStatusCode         code;
23190 +                       long                            value;
23191 +                       } v8bisStatus;
23192 +               struct
23193 +                       {
23194 +                       trainingProgressCode    code;   
23195 +                       long                                    value;                  
23196 +                       } trainingInfo;
23197 +               struct
23198 +                       {
23199 +                       long                                    code;   
23200 +                       long                                    value;                  
23201 +                       } v24Circuit;
23202 +               struct
23203 +                       {
23204 +                       trainingProgressCode    code;   
23205 +                       void*                                   ptr;                    
23206 +                       } advancedTrainingInfo;
23207 +               struct
23208 +                       {
23209 +                       capabilitiesStatusCode  code;   
23210 +                       long                                    value;                  
23211 +                       } capabilitiesStatusInfo;
23212 +               struct
23213 +                       {
23214 +                       connectionInfoCode              code;
23215 +                       long                                    value;                  
23216 +                       } connectionInfo;
23217 +               struct
23218 +                       {
23219 +                       connectionInfoCode              code;
23220 +                       int                                             length;
23221 +                       uchar                                   *ptr;
23222 +                       } advancedConnectionInfo;
23223 +               struct
23224 +                       {
23225 +                       dialerStatusCode                code;
23226 +                       long                                    value;
23227 +                       long                                    makeTime;                       
23228 +                       long                                    breakTime;                      
23229 +                       } dialerStatus;
23230 +               struct
23231 +                       {
23232 +                       long                                    enabled;
23233 +                       long                                    volume;                 
23234 +                       } speakerStatus;
23235 +               framingInfoCode                         framingInfo;
23236 +               IOStatusCode                            ioStatus;
23237 +               struct
23238 +                       {
23239 +                       lapmStatusCode                  code;
23240 +                       union
23241 +                               {
23242 +                               long                            value;
23243 +                               lapmTakedownReason      reason;
23244 +                               lapmErrorCode           error;
23245 +                               lapmTestResultCode      testResult;
23246 +                               struct
23247 +                                       {
23248 +                                       long    length;
23249 +                                       uchar   *framePtr;
23250 +                                       } frame;
23251 +                               struct
23252 +                                       {
23253 +                                       long    nFrames;
23254 +                                       long    nFrameErrors;
23255 +                                       } statistic;
23256 +                               } param;                        
23257 +                       } lapmStatus;
23258 +               struct
23259 +                       {
23260 +                       lapmParameterCode               code;
23261 +                       long                                    value;
23262 +                       } lapmParameter;
23263 +               struct
23264 +                       {
23265 +                       v42bisStatusCode                code;
23266 +                       union
23267 +                               {
23268 +                               long                            value;
23269 +                               v42bisErrorCode         error;
23270 +                               struct
23271 +                                       {
23272 +                                       long    nBytesIn;
23273 +                                       long    nBytesOut;
23274 +                                       } statistic;
23275 +                               } param;                        
23276 +                       } v42bisStatus;
23277 +               struct
23278 +                       {
23279 +                       mnpStatusCode                   code;
23280 +                       union
23281 +                               {
23282 +                               long                            value;
23283 +                               mnpTakedownReason       reason;
23284 +                               mnpErrorCode            error;
23285 +                               struct
23286 +                                       {
23287 +                                       long    nFrames;
23288 +                                       long    nFrameErrors;
23289 +                                       } statistic;
23290 +                               struct
23291 +                                       {
23292 +                                       ulong   nSize;
23293 +                                       uchar  *Buffer;
23294 +                                       } fallback;
23295 +                               struct
23296 +                                       {
23297 +                                       char    *header;
23298 +                                       void    *frame;
23299 +                                       } frame;
23300 +                               struct
23301 +                                       {
23302 +                                       long    nack;
23303 +                                       long    rFrameNo;
23304 +                                       } timeout;
23305 +                               struct
23306 +                                       {
23307 +                                       long    frameNo;
23308 +                                       long    framesPending;
23309 +                                       } retrFrame;
23310 +                               } param;                        
23311 +                       } mnpStatus;
23312 +               struct
23313 +                       {
23314 +                       mnpParameterCode                code;
23315 +                       long                                    value;
23316 +                       } mnpParameter;
23317 +               struct
23318 +                       {
23319 +                       v70StatusCode                   code;
23320 +                       union
23321 +                               {
23322 +                               long                            value;
23323 +                               v70TakedownReason       reason;
23324 +                               v70ErrorCode            error;
23325 +                               struct
23326 +                                       {
23327 +                                       long    nFrames;
23328 +                                       long    nFrameErrors;
23329 +                                       } statistic;
23330 +                               struct
23331 +                                       {
23332 +                                       long    length;
23333 +                                       uchar   *framePtr;
23334 +                                       } frame;
23335 +                               struct
23336 +                                       {
23337 +                                       long    nack;
23338 +                                       long    rFrameNo;
23339 +                                       } timeout;
23340 +                               struct
23341 +                                       {
23342 +                                       long    frameNo;
23343 +                                       long    framesPending;
23344 +                                       } retrFrame;
23345 +                               struct  
23346 +                                       {
23347 +                                       long    ChannelId;
23348 +                                       long    DLCI;
23349 +                                       ulong   LcNum;
23350 +                                       v70TakedownReason       reason;
23351 +                                       } channelInfo;                  
23352 +                               struct  
23353 +                                       {
23354 +                                       long    ChannelId;
23355 +                                       long    stateOld;
23356 +                                       long    stateNew;
23357 +                                       } stateInfo;                    
23358 +                               } param;
23359 +                       ulong   v70Time;
23360 +                       } v70Status;
23361 +               struct
23362 +                       {
23363 +                       audioStatusCode                 code;
23364 +                       union
23365 +                               {
23366 +                               long            value;
23367 +                               struct
23368 +                                       {
23369 +                                       long    nReq;
23370 +                                       long    nAvail;
23371 +                                       } buffer;
23372 +                               struct
23373 +                                       {
23374 +                                       long    nFrames;
23375 +                                       long    nFrameErrors;
23376 +                                       } statistic;
23377 +                               struct
23378 +                                       {
23379 +                                       long    length;
23380 +                                       uchar   *framePtr;
23381 +                                       } frame;
23382 +                               } param;
23383 +                       } audioStatus;
23384 +               struct
23385 +                       {
23386 +                       v80StatusCode                   code;
23387 +                       union
23388 +                               {
23389 +                               long                            value;
23390 +                               v80TakedownReason       reason;
23391 +                               v80ErrorCode            error;
23392 +                               struct
23393 +                                       {
23394 +                                       long    nFrames;
23395 +                                       long    nFrameErrors;
23396 +                                       } statistic;
23397 +                               struct
23398 +                                       {
23399 +                                       long    length;
23400 +                                       uchar   *framePtr;
23401 +                                       } frame;
23402 +                               struct
23403 +                                       {
23404 +                                       long    code;
23405 +                                       long    value;
23406 +                                       } inBand;
23407 +                               } param;
23408 +                       ulong   v80Time;
23409 +                       } v80Status;
23410 +               struct
23411 +                       {
23412 +                       v70ParameterCode                code;
23413 +                       long                                    value;
23414 +                       } v70Parameter;
23415 +               struct
23416 +                       {
23417 +                       breakType                       type;
23418 +                       long                            length;
23419 +                       } breakStatus;
23420 +               struct
23421 +                       {
23422 +                       callerIDStatusCode                      code;
23423 +                       union
23424 +                               {
23425 +                               long                            value;
23426 +                               struct
23427 +                                       {
23428 +                                       callerIDErrorCode       code;
23429 +                                       long                            value;  
23430 +                                       } callerIDError;
23431 +                               struct
23432 +                                       {
23433 +                                       long                    length;
23434 +                                       char*                   ptr;    
23435 +                                       } message;
23436 +                               } param;                        
23437 +                       } callerIDStatus;
23438 +               struct
23439 +                       {
23440 +                       ulong           signal;
23441 +                       uchar           *msg1;
23442 +                       long            msg1Length;     
23443 +                       uchar           *msg2;
23444 +                       long            msg2Length;     
23445 +                       } A8RStatus;
23446 +               struct
23447 +                       {
23448 +                       overlayStatusCode               code;
23449 +                       long                                    value;
23450 +                       long                                    value2;
23451 +                       } overlayStatus;
23452 +               struct
23453 +                       {
23454 +                       ulong   nBits;
23455 +                       ulong   nBlocks;
23456 +                       ulong   nBitErrors;
23457 +                       ulong   nBlockErrors;
23458 +
23459 +                       ulong   nAudioBits;
23460 +                       ulong   nAudioBlocks;
23461 +                       ulong   nAudioSyncErrors;
23462 +                       ulong   nAudioBlockErrors;
23463 +                       } testResults;
23464 +               ulong                                   checksum;
23465 +               struct
23466 +                       {
23467 +                       ulong   sizeM;
23468 +                       uchar   *filename;
23469 +                       } logFileControlStatus;
23470 +               struct
23471 +                       {
23472 +                       long    direction;
23473 +                       long    module;
23474 +                       long    message;
23475 +                       long    data;
23476 +                       }
23477 +               faxClass2Status;
23478 +               
23479 +               } param;
23480 +       } modemStatusStruct;
23481 +       
23482 +typedef        void    (SM_DECL *statusHandlerType)    (void *gDslVars, modemStatusStruct*);
23483 +#endif /* ADSL_MODEM */
23484 +
23485 +/****************************************************************************/
23486 +/*     1.      Type definitions.                                                                                                       */
23487 +/*                                                                                                                                                     */
23488 +/*     1.5     Command structure                                                                                                       */
23489 +/****************************************************************************/
23490 +
23491 +typedef struct
23492 +       {
23493 +    Boolean remoteModemIsFlex;
23494 +    uchar   countryCode;
23495 +    ushort  manufacturerId;
23496 +    uchar   licenseeId;
23497 +    uchar   productCapabilities;
23498 +    Boolean digitalModeFlag;
23499 +    Boolean prototypeFlag;
23500 +    uchar   version;
23501 +       }
23502 +FlexV8bisStruct;
23503 +
23504 +typedef struct
23505 +       {
23506 +       symbolRateMap   symbolRates;
23507 +       dataRateMap             dataRates;
23508 +       dataRateMap             dataRates56k;
23509 +       dataRateMap     dataRatesFlex;
23510 +       featureMap              features;
23511 +       bitMap                  auxFeatures;
23512 +       bitMap                  demodCapabilities;
23513 +       long                    rateThresholdAdjustment;        /* dB Q4        */
23514 +    FlexV8bisStruct flexRemoteV8bisInfo;
23515 +       }       dataPumpCapabilities;
23516 +
23517 +#ifndef ADSL_MODEM
23518 +typedef        struct  SoftwareModemCommandParameters
23519 +       {
23520 +       modemCommandCode                command;
23521 +       union
23522 +               {
23523 +               long                            xmtGain;
23524 +               ulong                           hybridDelayQ4ms;
23525 +               long                            modemSampleRate;
23526 +               long                            timeInMs;
23527 +               long                            state;
23528 +               long                            freq;
23529 +               NVRAMConfiguration      *nvramConfigurationPtr;
23530 +               long                            enabled;
23531 +               long                            value;
23532 +               uchar                           *phoneNumber;
23533 +               uchar                           *faxECMPageBufferPtr;
23534 +               CountryDescriptor       *countryDescriptorTable;
23535 +               struct
23536 +                       {
23537 +                       dataRateMap                     dteRate;
23538 +                       bitMap                          format;
23539 +                       } dteRateSpec;
23540 +               struct
23541 +                       {
23542 +                       v8ControlType           code;
23543 +                       long                            value;
23544 +                       uchar                           *buffer;
23545 +                       } v8ControlSpec;
23546 +               struct
23547 +                       {
23548 +                       directionType                   direction;
23549 +                       v8bisConnectionSetup    setup;
23550 +                       void                                    *capPtr;
23551 +                       voidFuncType                    confirmMsFunc;
23552 +                       voidFuncType                    genMsFunc;
23553 +                       xmtHandlerWithRtnValType        ogmFunc;
23554 +                       } v8bisSpec;
23555 +               struct
23556 +                       {
23557 +                       directionType   direction;
23558 +                       } ADSISpec;
23559 +               struct
23560 +                       {
23561 +                       directionType                   direction;
23562 +                       modulationMap                   modulations;
23563 +                       dataPumpCapabilities    capabilities;
23564 +                       } modeSpec;
23565 +               struct
23566 +                       {
23567 +                       long                    time, 
23568 +                                                       freq1, 
23569 +                                                       freq2, 
23570 +                                                       freq3, 
23571 +                                                       freq4,
23572 +                                                       mag1, 
23573 +                                                       mag2,
23574 +                                                       mag3,
23575 +                                                       mag4;
23576 +                       } toneSpec;
23577 +               struct
23578 +                       {
23579 +                       long            signal;
23580 +                       uchar           *msg1;
23581 +                       long            msg1Length;     
23582 +                       uchar           *msg2;
23583 +                       long            msg2Length;     
23584 +                       long            sig_en;
23585 +                       long            msg_en;
23586 +                       long            supp_delay;
23587 +                       }
23588 +                       v8bisMessageSpec;
23589 +               struct
23590 +                       {
23591 +                       linkLayerType           type;
23592 +                       bitMap                          setup;
23593 +                       dataRateMap                     rxDataRate;
23594 +                       dataRateMap                     txDataRate;
23595 +                       long                            rtDelayQ4ms;                            
23596 +                       rxDataHandlerType       rxDataHandlerPtr;
23597 +                       txDataHandlerType       txDataHandlerPtr;
23598 +                       } linkLayerSpec;
23599 +               struct
23600 +                       {
23601 +                       framerType                      type;
23602 +                       bitMap                          setup;
23603 +                       directionType           direction;
23604 +                       long                            fill[2]; /* need to match linkLayerSpec */
23605 +                       rxDataHandlerType       rxDataHandlerPtr;
23606 +                       txDataHandlerType       txDataHandlerPtr;
23607 +                       } framerSpec;
23608 +               struct
23609 +                       {
23610 +                       framerParameterCode     code;
23611 +                       long                            value;
23612 +                       } framerParameterSpec;
23613 +               struct
23614 +                       {
23615 +                       bitMap                          callProgressDetectorSetup;
23616 +                       signalDetectorType      callProgressDetectorPtr;        /* if nil, use defaults                 */
23617 +                       signalDetectorType      customDetectorPtr;                      /* if nil, no custom detector   */
23618 +                       } callProgressMonitorSpec;
23619 +               struct
23620 +                       {
23621 +                       ulong                   maxTones;                                       /* maximum number of simultaneous tones to detect */
23622 +                       ulong                   allowableVariance;                      /* maximum cumulative variance in the eight interpolated frequencies */
23623 +                       ulong                   totalPowerThreshold;            /* ignore complete block if power less than this */
23624 +                       ulong                   powerShiftThreshold;            /* ignore a bin if its power is less than (totalPowerValue >> powerShiftThreshold) */
23625 +                       ulong                   toneMatchThresholdHz;           /* tones within +/- this many Hz of original tone are considered the same tone */
23626 +                       ulong                   binSeparation;                          /* ignore tones with a spacing of less than this */
23627 +                       ulong                   outsideFreqDeviation;           /* an individual value in the interpolated array can be up to this many Hz outside of the expected angle range */
23628 +                       } multiToneSpec;
23629 +               struct
23630 +                       {
23631 +                       uchar                           *dialString;    /* nil limited string for DTMF dialing sequence */
23632 +                       long                            pulseBreakTime, 
23633 +                                                               pulseMakeTime, 
23634 +                                                               pulseInterDigitTime,
23635 +                                                               toneDigitTime, 
23636 +                                                               toneInterDigitTime, 
23637 +                                                               toneLoGroupMag,
23638 +                                                               toneHiGroupMag,
23639 +                                                               flashTime, 
23640 +                                                               pauseTime,
23641 +                                                               signalWaitTimeout,      
23642 +                                                               blindDialingTimeout;    
23643 +                       bitMap                          dialerSetup;
23644 +                       bitMap                          callProgressDetectorSetup;
23645 +                       signalDetectorType      callProgressDetectorPtr;        /* if nil, use defaults                 */      
23646 +                       signalDetectorType      customDetectorPtr;                      /* if nil, no custom detector   */
23647 +                       hookHandlerType         hookHandlerPtr;                         /* nil if DTMF dialing specified*/
23648 +                       } dialSpec;
23649 +               struct
23650 +                       {
23651 +                       long                    timeOn, 
23652 +                                                       timeOff, 
23653 +                                                       freq;
23654 +                       } callingToneSpec;
23655 +               union
23656 +                       {
23657 +                       statusHandlerType       statusHandlerPtr;
23658 +                       eyeHandlerType          eyeHandlerPtr;
23659 +                       logHandlerType          logHandlerPtr;
23660 +                       rxDataHandlerType       rxDataHandlerPtr;
23661 +                       txDataHandlerType       txDataHandlerPtr;
23662 +                       } handlerSpec;
23663 +               struct
23664 +                       {
23665 +                       breakType                       type;
23666 +                       long                            length;
23667 +                       } breakSpec;
23668 +               struct
23669 +                       {
23670 +                       long                            length;
23671 +                       uchar                           *dataPtr;
23672 +                       } lapmTestSpec;
23673 +               struct
23674 +                       {
23675 +                       bitMap                          setupLapm;
23676 +                       rxDataHandlerType       rxAudioHandlerPtr;
23677 +                       txDataHandlerType       txAudioHandlerPtr;
23678 +            } v70SetupSpec;
23679 +               struct
23680 +                       {
23681 +                       ulong                           ChannelId;
23682 +                       ulong                           LogChannelNum;
23683 +                       ulong                           PortNum;
23684 +            } EstChannelSpec;
23685 +               struct
23686 +                       {
23687 +                       ulong                           ChannelId;
23688 +            } WaitChannelSpec;
23689 +               struct
23690 +                       {
23691 +                       ulong                           ChannelId;
23692 +                       ulong                           LogChannelNum;
23693 +                       ulong                           PortNum;
23694 +                       ulong                           DLCI;
23695 +            } RelChannelSpec;
23696 +               struct
23697 +                       {
23698 +                       audioType                       type;
23699 +                       bitMap                          setup;
23700 +                       dataRateMap                     rxAudioRate;
23701 +                       dataRateMap                     txAudioRate;
23702 +                       rxAudioHandlerType      rxAudioHandlerPtr;
23703 +                       txAudioHandlerType      txAudioHandlerPtr;
23704 +                       } audioSpec;
23705 +               struct
23706 +                       {
23707 +                       long                                    code;   
23708 +                       long                                    value;                  
23709 +                       } v24Circuit;
23710 +               struct
23711 +                       {
23712 +                       ulong                                   code;   
23713 +                       ulong                                   value;                  
23714 +                       ulong                                   minValue;
23715 +                       ulong                                   maxValue;
23716 +                       } atRegister;
23717 +               struct
23718 +                       {
23719 +                       long                                    code;   
23720 +                       uchar                                   *response;
23721 +                       } atiSpec;
23722 +               struct
23723 +                       {
23724 +                       long                                    length;
23725 +                       uchar                                   *framePtr;
23726 +                       } frameSpec;
23727 +               struct
23728 +                       {
23729 +                       long                                    code;
23730 +                       union
23731 +                               {
23732 +                               long                            value;
23733 +                               struct
23734 +                                       {
23735 +                                       long                    loFreq1;
23736 +                                       long                    hiFreq1;
23737 +                                       long                    loFreq2;
23738 +                                       long                    hiFreq2;
23739 +                                       } freqRange;
23740 +                               } params;
23741 +                       } callProgressParamSpec;
23742 +               struct
23743 +                       {
23744 +                       v250IdStringCode        v250IdCode;
23745 +                       uchar                           *v250IdString;
23746 +                       } v250IdSpec;
23747 +
23748 +               } param;
23749 +       } modemCommandStruct;
23750 +       
23751 +typedef        Boolean (*commandHandlerType)   (modemCommandStruct*);
23752 +#endif /* ADSL_MODEM */
23753 +
23754 +
23755 +
23756 +/****************************************************************************/
23757 +/*     2.      Constant definitions.                                                                                           */
23758 +/*                                                                                                                                                     */
23759 +/*     2.1     Definitive constants                                                                                            */
23760 +/****************************************************************************/
23761 +
23762 +#define kMaxSampleBlockSize                    48
23763 +#define kMaxDataBlockSize                      48
23764 +
23765 +#define        kMaxDialStringLength            127
23766 +#define        kCallProgressSampleRate         7200
23767 +
23768 +#define        kMaxCallerIDMessageLength       80
23769 +
23770 +/****************************************************************************/
23771 +/*     2.      Constant definitions.                                                                                           */
23772 +/*                                                                                                                                                     */
23773 +/*     2.2     Bit maps                                                                                                                */
23774 +/****************************************************************************/
23775 +
23776 +/* modulationMap */
23777 +
23778 +#define        kIdle                                   0x00000000
23779 +#define        kV25                                    0x00000001
23780 +#define        kV8                                             0x00000002
23781 +#define        kCid                                    0x00000004
23782 +#define        kV8bis                                  0x00000008
23783 +#define        kV21                                    0x00000010
23784 +#define        kV22                                    0x00000020
23785 +#define        kV23                                    0x00000040
23786 +#define        kV32                                    0x00000080
23787 +#define        kV34                                    0x00000100
23788 +#define        kX2                                             0x00000200
23789 +#define        kV90                                    0x00000400
23790 +#define        k56Flex                                 0x00000800
23791 +#define        kV27                                    0x00001000
23792 +#define        kV29                                    0x00002000
23793 +#define        kV17                                    0x00004000
23794 +#define        kV34HDX                                 0x00008000
23795 +#define        kV34HDXC                                0x00010000
23796 +#define        kBell103                                0x00100000
23797 +#define        kBell212                                0x00200000
23798 +#define        kDataCallingTone                0x01000000
23799 +#define        kFaxCallingTone                 0x02000000
23800 +
23801 +#define        kV22FastNZConnect           0x04000000
23802 +#define kV22FastNNZConnect      0x08000000
23803 +#define kV22FastConnect         (kV22FastNZConnect|kV22FastNNZConnect)
23804 +#define kV22bisFastConnect      0x10000000
23805 +
23806 +
23807 +#define        kDataModulations        (kV25 | kV8 | kV21 | kV22FastConnect | kV22bisFastConnect | kV22 | kV23 | kV32 | kV34 | kBell103 | kBell212)
23808 +#define        kDataOnlyModulations (kV21 | kV22 | kV23 | kV32 | kBell103 | kBell212)
23809 +#define        kPCMModulations         (kV90 | kX2 | k56Flex)
23810 +
23811 +#define        kFaxModulations         (kV25 | kV21 | kV27 | kV29 | kV17)
23812 +#define        kFaxOnlyModulations     (kV27 | kV29 | kV17)
23813 +#define        kFaxModulationShift             12
23814 +
23815 +/* symbolRateMap       */
23816 +
23817 +#define        k1200Hz                 0x00000001
23818 +#define        k1600Hz                 0x00000002
23819 +#define        k2400Hz                 0x00000004
23820 +#define        k2743Hz                 0x00000008
23821 +#define        k2800Hz                 0x00000010
23822 +#define        k3000Hz                 0x00000020
23823 +#define        k3200Hz                 0x00000040
23824 +#define        k3429Hz                 0x00000080
23825 +#define        k8000Hz                 0x00000100
23826 +
23827 +#define        kAllSymbolRates (       k1200Hz | k1600Hz | k2400Hz | k2743Hz | \
23828 +                                                       k2800Hz | k3000Hz | k3429Hz | k8000Hz )
23829 +
23830 +/* dataRateMap */
23831 +
23832 +#define        k75bps                  0x00000002
23833 +#define        k300bps                 0x00000004
23834 +#define        k600bps                 0x00000008
23835 +#define        k1200bps                0x00000010
23836 +#define        k2400bps                0x00000020
23837 +#define        k4800bps                0x00000040
23838 +#define        k7200bps                0x00000080
23839 +#define        k9600bps                0x00000100
23840 +#define        k12000bps               0x00000200
23841 +#define        k14400bps               0x00000400
23842 +#define        k16800bps               0x00000800
23843 +#define        k19200bps               0x00001000
23844 +#define        k21600bps               0x00002000
23845 +#define        k24000bps               0x00004000
23846 +#define        k26400bps               0x00008000
23847 +#define        k28800bps               0x00010000
23848 +#define        k31200bps               0x00020000
23849 +#define        k33600bps               0x00040000
23850 +#define        k36000bps               0x00080000
23851 +#define        k38400bps               0x00100000
23852 +#define        k57600bps               0x00200000
23853 +#define        k115200bps              0x00400000
23854 +#define        k230400bps              0x00800000
23855 +#define        k460800bps              0x01000000
23856 +#define        k921600bps              0x02000000
23857 +/*
23858 + * kPCMRate is used to identify that the reported rate is
23859 + * PCM modulation rate, and is only used for PCM modulation while
23860 + * reporting rate !!!!
23861 + */
23862 +#define        kPCMRate                0x40000000
23863 +#define kPCMFlexRate    0x80000000
23864 +#define        kAllDataRates   0x0FFFFFFF
23865 +
23866 +/* rates specific for X2  and V.90 */
23867 +#define        kPCM25333bps    0x00000001
23868 +#define        kPCM26666bps    0x00000002
23869 +#define        kPCM28000bps    0x00000004
23870 +#define        kPCM29333bps    0x00000008
23871 +#define        kPCM30666bps    0x00000010
23872 +#define        kPCM32000bps    0x00000020
23873 +#define        kPCM33333bps    0x00000040
23874 +#define        kPCM34666bps    0x00000080
23875 +#define        kPCM36000bps    0x00000100
23876 +#define        kPCM37333bps    0x00000200
23877 +#define        kPCM38666bps    0x00000400
23878 +#define        kPCM40000bps    0x00000800
23879 +#define        kPCM41333bps    0x00001000
23880 +#define        kPCM42666bps    0x00002000
23881 +#define        kPCM44000bps    0x00004000
23882 +#define        kPCM45333bps    0x00008000
23883 +#define        kPCM46666bps    0x00010000
23884 +#define        kPCM48000bps    0x00020000
23885 +#define        kPCM49333bps    0x00040000
23886 +#define        kPCM50666bps    0x00080000
23887 +#define        kPCM52000bps    0x00100000
23888 +#define        kPCM53333bps    0x00200000
23889 +#define        kPCM54666bps    0x00400000
23890 +#define        kPCM56000bps    0x00800000
23891 +#define        kPCM57333bps    0x01000000
23892 +
23893 +#define        kV90ServerToClientDataRates     \
23894 +                                               (       kPCM28000bps | kPCM29333bps | kPCM30666bps | \
23895 +                                                       kPCM32000bps | kPCM33333bps | kPCM34666bps | \
23896 +                                                       kPCM36000bps | kPCM37333bps | kPCM38666bps | \
23897 +                                                       kPCM40000bps | kPCM41333bps | kPCM42666bps | \
23898 +                                                       kPCM44000bps | kPCM45333bps | kPCM46666bps | \
23899 +                                                       kPCM48000bps | kPCM49333bps | kPCM50666bps | \
23900 +                                                       kPCM52000bps | kPCM53333bps | kPCM54666bps | \
23901 +                                                       kPCM56000bps | kPCM57333bps )
23902 +
23903 +#define        kV90ClientToServerDataRates     \
23904 +                                               (       k4800bps  | k7200bps  | k9600bps  | k12000bps | \
23905 +                                                       k14400bps | k16800bps | k19200bps | k21600bps | \
23906 +                                                       k24000bps | k26400bps | k28800bps | k31200bps | \
23907 +                                                       k33600bps )     
23908 +
23909 +
23910 +
23911 +#define        kX2ServerToClientDataRates      \
23912 +                                               (       kPCM25333bps | kPCM26666bps | kPCM28000bps | \
23913 +                                                       kPCM29333bps | kPCM30666bps | kPCM32000bps | \
23914 +                                                       kPCM33333bps | \
23915 +                                                       kPCM34666bps | kPCM36000bps | kPCM37333bps | \
23916 +                                                       kPCM38666bps | kPCM40000bps | kPCM41333bps | \
23917 +                                                       kPCM42666bps | kPCM44000bps | kPCM45333bps | \
23918 +                                                       kPCM46666bps | kPCM48000bps | kPCM49333bps | \
23919 +                                                       kPCM50666bps | kPCM52000bps | kPCM53333bps | \
23920 +                                                       kPCM54666bps | kPCM56000bps | kPCM57333bps )
23921 +#define        kX2ClientToServerDataRates      \
23922 +                                               (       k4800bps | k7200bps | k9600bps | k12000bps | k14400bps | \
23923 +                                                               k16800bps | k19200bps | k21600bps | k24000bps | k26400bps | k28800bps | \
23924 +                                                               k31200bps )
23925 +
23926 +  /*
23927 +  Rates specific for Flex
23928 +  */
23929 +#define kPCMFlex32000bps  0x00000001
23930 +#define kPCMFlex34000bps  0x00000002
23931 +#define kPCMFlex36000bps  0x00000004
23932 +#define kPCMFlex38000bps  0x00000008
23933 +#define kPCMFlex40000bps  0x00000010
23934 +#define kPCMFlex42000bps  0x00000020
23935 +#define kPCMFlex44000bps  0x00000040
23936 +#define kPCMFlex46000bps  0x00000080
23937 +#define kPCMFlex48000bps  0x00000100
23938 +#define kPCMFlex50000bps  0x00000200
23939 +#define kPCMFlex52000bps  0x00000400
23940 +#define kPCMFlex54000bps  0x00000800
23941 +#define kPCMFlex56000bps  0x00001000
23942 +#define kPCMFlex58000bps  0x00002000
23943 +#define kPCMFlex60000bps  0x00004000
23944 +
23945 +#define        kFlexServerToClientDataRates \
23946 +                        (   kPCMFlex32000bps | kPCMFlex34000bps | kPCMFlex36000bps | kPCMFlex38000bps | \
23947 +                                                       kPCMFlex40000bps | kPCMFlex42000bps | kPCMFlex44000bps | kPCMFlex46000bps | \
23948 +                                                       kPCMFlex48000bps | kPCMFlex50000bps | kPCMFlex52000bps | kPCMFlex52000bps | \
23949 +                                                       kPCMFlex54000bps | kPCMFlex56000bps | kPCMFlex58000bps | kPCMFlex60000bps )
23950 +
23951 +#define        kFlexClientToServerDataRates    \
23952 +                                               (       k4800bps  | k7200bps  | k9600bps  | k12000bps | \
23953 +                                                       k14400bps | k16800bps | k19200bps | k21600bps | \
23954 +                                                       k24000bps | k26400bps | k28800bps | k31200bps )
23955 +
23956 +
23957 +#define        k2400BitShift   5
23958 +#define        k4800BitShift   6
23959 +
23960 +#define        kPCM28000bpsShift       2
23961 +
23962 +#define        kV21Rates                       k300bps
23963 +#define        kV22Rates                       k1200bps
23964 +#define        kV22bisRates            (k1200bps | k2400bps)
23965 +#define        kV23Rates                       (k75bps | k1200bps)
23966 +#define        kCidRates                       (k1200bps)
23967 +#define        kV32Rates                       (k4800bps | k9600bps)
23968 +#define        kV32bisRates            (kV32Rates | k7200bps | k12000bps | k14400bps)
23969 +#define        kV32terboRates          (kV32bisRates | k16800bps | k19200bps)  
23970 +#define        kV34Rates                       (       k2400bps | k4800bps | k7200bps | k9600bps | k12000bps | k14400bps | \
23971 +                                                               k16800bps | k19200bps | k21600bps | k24000bps | k26400bps | k28800bps | \
23972 +                                                               k31200bps | k33600bps ) 
23973 +
23974 +#define        kV27Rates                       (k2400bps | k4800bps)
23975 +#define        kV29Rates                       (k4800bps | k7200bps | k9600bps)
23976 +#define        kBell103Rates       k300bps
23977 +#define        kBell212Rates       k1200bps
23978 +
23979 +
23980 +/* Demodulator capabilities    */
23981 +#define        kNeecEnabled                                    0x00000001
23982 +#define        kPFeecEnabled                                   0x00000002
23983 +#define        kIeecEnabled                                    0x00000004
23984 +#define        kFeecEnabled                                    0x00000008
23985 +
23986 +#define        kRapidEqualizerTraining                 0x00000010
23987 +#define        kRapidPECTraining                               0x00000020
23988 +#define        kRapidECTraining                                0x00000040
23989 +#define        kAutoLoadReductionEnabled               0x00000080
23990 +
23991 +#define        kTimingTrackingEnabled                  0x00000100
23992 +#define        kPhaseLockedLoopEnabled                 0x00000200
23993 +#define        kFeecPhaseLockedLoopEnabled             0x00000400
23994 +#define        kPhaseJitterTrackingEnabled             0x00000800
23995 +
23996 +#define        kClockErrorTrackingEnabled              0x00001000
23997 +#define        kFreqOffsetTrackingEnabled              0x00002000
23998 +#define        kFeecFreqOffsetTrackingEnabled  0x00004000
23999 +
24000 +#define        kShorterNeecEnabled                             0x00008000
24001 +#define        kShorterPFeecEnabled                    0x00010000
24002 +#define        kFrondEndHPFilterEnabled                0x00020000
24003 +#define kGainControlEnabled                            0x00040000
24004 +#define kPhaseHitControlEnabled                        0x00080000
24005 +#define        kBandEdgeCorrectorEnabled               0x00100000
24006 +#define kDisableFaxFastClearDown               0x00200000
24007 +
24008 +#define kImdOffsetCompensationEnabled  0x00400000
24009 +
24010 +#define kV34ShortEqlLengthExtShift  23
24011 +#define kV34ShortEqlLengthExtMask      (0x3<<kV34ShortEqlLengthExtShift)
24012 +#define kV34EqlLengthReductionEnabled  (1<<(kV34ShortEqlLengthExtShift+2))
24013 +#define kPCMIeecLengthReductionEnabled (1<<(kV34ShortEqlLengthExtShift+3))
24014 +
24015 +/* featureMap  */
24016 +
24017 +#define        kAllFeatures                            0xFFFFFFFF
24018 +
24019 +#define        kAutomodingEnabled                      0x00000001      /* bit 1        */
24020 +#define        kAutomodingDisabled                     0x00000000      /* bit 1        */
24021 +
24022 +#define        kV8SendCIEnabled                        0x00000002      /* bit 2        */
24023 +#define        kV8SendCIDisabled                       0x00000000      /* bit 2        */
24024 +
24025 +#define        kV34CMEModem                            0x00000004      /* bit 3        */
24026 +#define        kV34NotCMEModem                         0x00000000      /* bit 3        */
24027 +
24028 +#define        kV34ExtraINFOPreamble           0x00000008      /* bit 4        */
24029 +
24030 +#define        kRetrainingEnabled                      0x00000010
24031 +#define        kRateRenegotiationEnabled       0x00000020
24032 +#define        kTrellisCodingEnabled           0x00000040
24033 +
24034 +/* Fax specific features       */
24035 +#define        kFaxShortTraining                       0x00000080
24036 +#define        kFaxEchoSuppressionEnabled      0x00000100
24037 +
24038 +/* V.22/V.22bis specific features      */
24039 +#define        kV22GuardTone1800HzEnabled      0x00000200
24040 +#define        kV22GuardTone550HzEnabled       0x00000400
24041 +
24042 +
24043 +/* V.34 specific features      */
24044 +
24045 +#define        kV34bisEnabled                          0x00000800
24046 +
24047 +#define        kV34PowerReductionAllowed       0x00001000
24048 +#define        kAuxChannelEnabled                      0x00002000
24049 +#define        kAuxChannelDisabled                     0x00000000
24050 +#define        kV34TrellisEncoderTypeMask      0x0000C000
24051 +#define        kV34TrellisEncoderTypeShift     14
24052 +
24053 +#define        kTRN16                                          0x00010000
24054 +#define        kAssymDataRatesEnabled          0x00020000
24055 +#define        kNonLinearCodingEnabled         0x00040000
24056 +#define        kConstShapingEnabled            0x00080000
24057 +#define        kPrecodingEnabled                       0x00100000
24058 +
24059 +#define        kV34LoFcAt2400HzEnabled         0x00200000
24060 +#define        kV34HiFcAt2400HzEnabled         0x00400000
24061 +#define        kV34LoFcAt2743HzEnabled         0x00800000
24062 +#define        kV34HiFcAt2743HzEnabled         0x01000000
24063 +#define        kV34LoFcAt2800HzEnabled         0x02000000
24064 +#define        kV34HiFcAt2800HzEnabled         0x04000000
24065 +#define        kV34LoFcAt3000HzEnabled         0x08000000
24066 +#define        kV34HiFcAt3000HzEnabled         0x10000000
24067 +#define        kV34LoFcAt3200HzEnabled         0x20000000
24068 +#define        kV34HiFcAt3200HzEnabled         0x40000000
24069 +#define        kV34LoFcAt3429HzEnabled         0x80000000
24070 +#define        kV34HiFcAt3429HzEnabled         0x80000000
24071 +
24072 +/* auxiliary features definintions map */
24073 +
24074 +#define        kLoopbackTestFinish                             0x00000000
24075 +#define        kLoopbackTestV54Loop1                   0x00000001
24076 +#define        kLoopbackTestV54Loop2                   0x00000002
24077 +#define        kLoopbackTestV54Loop3                   0x00000003
24078 +#define        kLoopbackTestTypeMask                   0x00000003
24079 +#define        kLoopbackTestAutoRespondEnabled 0x00000004
24080 +#define        kLoopbackSelfTest                               0x00000008
24081 +
24082 +#define        kPreempFilterMask                       0x000000F0
24083 +#define        kPreempFilterShift                      4
24084 +
24085 +#define        kPcmCodingTypeMuLaw                     0x00000100
24086 +#define        kPcmServerToServerEnabled       0x00000200
24087 +#define        kPcmIsServerModem                       0x00000400
24088 +#define        kPcmAnalogModemAvailable        0x00000800
24089 +#define        kPcmDigitalModemAvailable       0x00001000
24090 +#define        kPcmDceOnDigitalNetwork         0x00002000
24091 +#define        kPcmDModemPwrCalAtCodecOut      0x00004000
24092 +#define        kPcm3429UpstreamAvailable       0x00008000
24093 +
24094 +#define        kPcmSpectralShapingBitsMask             0x00070000
24095 +#define        kPcmSpectralShapingBitsShift    16
24096 +#define        kV90ServerNotDetSbarAfterJdbarFix       0x00080000
24097 +
24098 +#define kAutomoderPassive                      0x00400000
24099 +
24100 +#define        kV8HoldANSamUntilDetCI          0x00800000
24101 +#define        kFaxSendFromOrgSide                     0x01000000
24102 +#define        kFaxV34HDX2400bpsCtrlChan       0x02000000
24103 +#define        kFaxV34HDXAllowAsymCtrlChan     0x04000000
24104 +#define        kV8ANSamStageDisabled           0x08000000
24105 +
24106 +#define kFlexSkipV8bis              0x10000000
24107 +#define kV34ControlChannelEnabled   0x20000000
24108 +#define kV34SeamlessRateChangeEnabled 0x40000000
24109 +
24110 +#define        kPTTTest                                        0x80000000
24111 +
24112 +/* call progress detection Map */
24113 +
24114 +#define        kDialTone                               0x00000001
24115 +#define        kRingBack                               0x00000002
24116 +#define        kBusy                                   0x00000004
24117 +#define        kReorder                                0x00000008
24118 +#define        k2ndDTn                                 0x00000010
24119 +#define        kBongTone                               0x00000020
24120 +
24121 +/* Break type bit settings     */
24122 +#define        kExpedited              0x0001
24123 +#define        kDestructive    0x0002
24124 +
24125 +/* async Framer setup map              */
24126 +
24127 +#define        kNDataBitsMask  0x03
24128 +#define        k5DataBits              0x00
24129 +#define        k6DataBits              0x01
24130 +#define        k7DataBits              0x02
24131 +#define        k8DataBits              0x03
24132 +
24133 +#define        kNDataBitsShift         0
24134 +#define        kNDataBitsOffset        5
24135 +
24136 +#define        kParityTypeMask 0x1C
24137 +#define        kNoParity               0x00
24138 +#define        kOddParity              0x04
24139 +#define        kEvenParity             0x08
24140 +#define        kMarkParity             0x0C
24141 +#define        kSpaceParity    0x10
24142 +
24143 +#define        kNStopBitsMask  0x60
24144 +#define        k1StopBits              0x00
24145 +#define        k2StopBits              0x20
24146 +
24147 +#define        kNStopBitsShift         5
24148 +#define        kNStopBitsOffset        1
24149 +
24150 +/* Sync Framer setup map               */
24151 +
24152 +#define kUnderrunCharMask                      0xff
24153 +#define kRepeatLastCharOnUnderrun      0x100
24154 +
24155 +/* HDLC sync framer setup maps */
24156 +#define        kNFlagsBeforeFramesMask         0x3F
24157 +#define        kNFlagsBeforeFramesShift        0
24158 +
24159 +#define        kNFlagsBetweenFramesMask        0x3F
24160 +#define        kNFlagsBetweenFramesShift       6
24161 +
24162 +#define        k32BitCRC                                       0x1000
24163 +#define        kFlagSharingEnabled                     0x2000
24164 +
24165 +#define kNFlagsBeforeReportMask                0x03    /* no. of *extra* flags reqd before frame */
24166 +#define kNFlagsBeforeReportShift       14
24167 +
24168 +#define        kTxDeferredCRC                          0x10000
24169 +#define        kRxDeferredCRC                          0x20000
24170 +#define        kTxIdleMarks                            0x40000
24171 +#define kNoCRC                                         0x80000
24172 +
24173 +/* SAM framer setup maps       */
24174 +
24175 +#define        kSAMTransparentIdleTypeMask             0x00000003
24176 +#define        kSAMTransparentIdleTypeShift    0
24177 +#define        kSAMFramedIdleTypeMask                  0x00000004
24178 +#define        kSAMFramedIdleTypeShift                 2
24179 +#define        kSAMFramedOverrunActionMask             0x00000010
24180 +#define        kSAMFramedOverrunActionShift    4
24181 +#define        kSAMHalfDuplexModeMask                  0x00000020
24182 +#define        kSAMHalfDuplexModeShift                 5
24183 +#define        kSAMCRCTypeMask                                 0x000000C0
24184 +#define        kSAMCRCTypeShift                                6
24185 +#define        kSAMNRZIEnabledMask                             0x00000100
24186 +#define        kSAMNRZIEnabledShift                    8
24187 +#define        kSAMSyn1Mask                                    0x00FF0000
24188 +#define        kSAMSyn1Shift                                   16
24189 +#define        kSAMSyn2Mask                                    0xFF000000
24190 +#define        kSAMSyn2Shift                                   24
24191 +
24192 +/* <trans_idle> */
24193 +#define        kSAM8bitSYNHuntDisabled         0
24194 +#define        kSAM8bitSYNHuntEnabled          ((ulong)1 << kSAMTransparentIdleTypeShift)
24195 +#define        kSAM16bitSYNHuntEnabled         ((ulong)2 << kSAMTransparentIdleTypeShift)
24196 +
24197 +/* <framed_idle> */
24198 +#define        kSAMSendFlagsOnIdle                     0
24199 +#define        kSAMSendMarksOnIdle                     ((ulong)1 << kSAMFramedIdleTypeShift)
24200 +
24201 +/* <framed_un_ov> */
24202 +#define        kSAMAbortOnUnderrun                     0
24203 +#define        kSAMFlagsOnUnderrun                     ((ulong)1 << kSAMFramedOverrunActionShift)
24204 +
24205 +/* <hd_auto> */
24206 +#define        kSAMHalfDuplexNoAuto            0
24207 +#define        kSAMHalfDuplexAuto                      ((ulong)1 << kSAMHalfDuplexModeShift)
24208 +
24209 +
24210 +/* <crc_type> */
24211 +#define        kSAMNoCRC                                       0
24212 +#define        kSAM16bitCRC                            ((ulong)1 << kSAMCRCTypeShift) 
24213 +#define        kSAM32bitCRC                            ((ulong)2 << kSAMCRCTypeShift) 
24214 +                               
24215 +/* <nrzi_en> */
24216 +#define        kSAMNRZIDisabled                        0
24217 +#define        kSAMNRZIEnabled                         ((ulong)1 << kSAMNRZIEnabledShift)
24218 +
24219 +
24220 +/* LAPM setup maps     */
24221 +#define        kLapmDirection                          0x00000001              /* Bit 0  */
24222 +#define        kLapmSREJEnabled                        0x00000002              /* Bit 1  */
24223 +#define        kLapmDetectionEnabled           0x00000004              /* Bit 2  */
24224 +#define        kLapmLongADPEnabled                     0x00000008              /* Bit 3  */
24225 +
24226 +#define        kLapmCompressionEnabledMask     0x00000030
24227 +#define        kLapmTxCompressionEnabled       0x00000010              /* Bit 4  */
24228 +#define        kLapmRxCompressionEnabled       0x00000020              /* Bit 5  */
24229 +#define        kLapmCompressionEnabledShift            4
24230 +
24231 +#define        kLapmRetryLimitMask                     0x000000C0              /* Bits 6,7  */
24232 +
24233 +#define        kLapmNoRetryLimit                       0x00000000
24234 +#define        kLapm4Retries                           0x00000040
24235 +#define        kLapm8Retries                           0x00000080
24236 +#define        kLapm20Retries                          0x000000C0
24237 +
24238 +#define        kLapmWindowSizeMask                     0x00001F00              /* Bits 8-12  */
24239 +#define        kLapmWindowSizeShift            8
24240 +
24241 +#define        kLapmWindowSize8                        0x00000800
24242 +#define        kLapmWindowSize15                       0x00000F00
24243 +
24244 +
24245 +#define        kLapmInfoFieldSizeMask          0x0000E000              /* Bits 13-15  */
24246 +#define        kLapmInfoField8Bytes            0x00000000
24247 +#define        kLapmInfoField16Bytes           0x00002000
24248 +#define        kLapmInfoField32Bytes           0x00004000
24249 +#define        kLapmInfoField64Bytes           0x00006000
24250 +#define        kLapmInfoField128Bytes          0x00008000
24251 +#define        kLapmInfoField192Bytes          0x0000A000
24252 +#define        kLapmInfoField256Bytes          0x0000C000
24253 +#define        kLapmInfoField512Bytes          0x0000E000
24254 +#define        kLapmInfoFieldSizeShift         13
24255 +
24256 +#define        kLapmT400Mask                           0x00030000              /* Bits 16-17   */
24257 +#define        kLapmAutoT400                           0x00000000
24258 +#define        kLapm750msT400                          0x00010000
24259 +#define        kLapm3secT400                           0x00020000
24260 +#define        kLapm30secT400                          0x00030000
24261 +
24262 +#define        kLapmT401Mask                           0x000C0000              /* Bits 18-19   */
24263 +#define        kLapmAutoT401                           0x00000000
24264 +#define        kLapm750msT401                          0x00040000
24265 +#define        kLapm3secT401                           0x00080000
24266 +#define        kLapm6secT401                           0x000C0000
24267 +
24268 +#define        kLapmT403Mask                           0x00300000              /* Bits 20-21   */
24269 +#define        kLapmAutoT403                           0x00000000
24270 +#define        kLapm750msT403                          0x00100000
24271 +#define        kLapm2secT403                           0x00200000
24272 +#define        kLapm4secT403                           0x00300000
24273 +
24274 +
24275 +
24276 +#define        kLapmDictSizeMask                       0x00C00000              /* Bits 22-23  */
24277 +#define        kLapmDictSize512                        0x00000000
24278 +#define        kLapmDictSize1024                       0x00400000
24279 +#define        kLapmDictSize2048                       0x00800000
24280 +#define        kLapmDictSize4096                       0x00C00000
24281 +
24282 +#define        kLapmStringSizeMask                     0xFF000000              /* Bits 24-31  */
24283 +#define        kLapmStringSizeShift            24
24284 +
24285 +/* MNP setup maps      */
24286 +
24287 +#define        kMnpMinPLevel                           0x00000001              /* Bit 0: 1 - Minimal, 0 - Standard */
24288 +#define        kMnpStdPLevel                           0x00000000              /* Bit 0: 1 - Minimal, 0 - Standard */
24289 +
24290 +#define        kMnpOptimizationEnabled         0x00000002              /* Bit 1  */
24291 +#define        kMnpOptimizationDisabled        0x00000000              /* Bit 1  */
24292 +
24293 +#define        kMnpCompressionEnabled          0x00000004              /* Bit 2  */
24294 +#define        kMnpCompressionDisabled         0x00000000              /* Bit 2  */
24295 +
24296 +#define        kMnpClassMask                           0x00000018
24297 +#define        kMnpClassShift                                           3
24298 +#define        kMnpClass1                                      0x00000008
24299 +#define        kMnpClass2                                      0x00000010
24300 +#define        kMnpClass3                                      0x00000018              /* Bits 3,4 */
24301 +
24302 +#define kMnpMaxRetryMask                   0x00000060          /* Bits 5,6 */
24303 +#define kMnpMaxRetryShift                                       5
24304 +#define        kMnpNoRetryLimit                        0x00000000
24305 +#define        kMnp4Retries                            0x00000020
24306 +#define        kMnp8Retries                            0x00000040
24307 +#define        kMnp20Retries                           0x00000060
24308 +
24309 +#define        kMnpInfoFieldSizeMask           0x00000380              /* Bits 7-9  */
24310 +#define        kMnpInfoFieldSizeShift                           7
24311 +#define        kMnpInfoField8Bytes                     0x00000000
24312 +#define        kMnpInfoField16Bytes            0x00000080
24313 +#define        kMnpInfoField32Bytes            0x00000100
24314 +#define        kMnpInfoField64Bytes            0x00000180
24315 +#define        kMnpInfoField128Bytes           0x00000200
24316 +#define        kMnpInfoField192Bytes           0x00000280
24317 +#define        kMnpInfoField256Bytes           0x00000300
24318 +#define        kMnpInfoField260Bytes           0x00000380
24319 +
24320 +#define        kMnpT400Mask                            0x00003000              /* Bits 12,13 */
24321 +#define        kMnpT400Shift                                           12
24322 +#define        kMnpAutoT400                            0x00000000
24323 +#define        kMnp750msT400                           0x00001000
24324 +#define        kMnp3secT400                            0x00002000
24325 +#define        kMnp6secT400                            0x00003000
24326 +
24327 +#define        kMnpT401Mask                            0x0000C000              /* Bits 14,15 */
24328 +#define        kMnpT401Shift                                           14
24329 +#define        kMnpAutoT401                            0x00000000
24330 +#define        kMnp750msT401                           0x00004000
24331 +#define        kMnp3secT401                            0x00008000
24332 +#define        kMnp6secT401                            0x0000C000
24333 +
24334 +#define        kMnpT403Mask                            0x00030000              /* Bits 16,17 */
24335 +#define        kMnpT403Shift                                           16
24336 +#define        kMnpAutoT403                            0x00000000
24337 +#define        kMnp60secT403                           0x00010000
24338 +#define        kMnp600secT403                          0x00020000
24339 +#define        kMnp3600secT403                         0x00030000
24340 +
24341 +#define kMnpFallbackTypeMask           0x000C0000              /* Bits 18,19 */
24342 +#define kMnpFallbackTypeShift                          18
24343 +#define kMnpNoFallback                         0x00000000
24344 +#define kMnpFallbackTime                       0x00040000
24345 +#define kMnpFallback200                                0x00080000
24346 +#define kMnpFallbackChar                       0x000C0000
24347 +
24348 +#define        kMnpWindowSizeMask                      0x00300000              /* Bits 20,21  */
24349 +#define        kMnpWindowSizeShift                                     20
24350 +#define        kMnp1Frame                                      0x00000000
24351 +#define        kMnp4Frames                             0x00100000
24352 +#define        kMnp8Frames                             0x00200000
24353 +#define        kMnp16Frames                            0x00300000
24354 +
24355 +#define        kMnpDirection                           0x00800000              /* Bit 22  */
24356 +
24357 +#define kMnpFallbackCharMask           0xFF000000              /* Bit 24-31  */
24358 +#define kMnpFallbackCharShift                          24
24359 +
24360 +/* kV34HDXTurnOffCurrentModeCmd state parameter values */
24361 +
24362 +#define        kV34HDXTurnOffAsClearDown                               0
24363 +#define        kV34HDXTurnOffFromControlSource                 1
24364 +#define        kV34HDXTurnOffFromControlDestination    2
24365 +#define        kV34HDXTurnOffFromPrimarySource                 3
24366 +#define        kV34HDXTurnOffFromPrimaryDestination    4
24367 +
24368 +/* V70 setup maps */
24369 +
24370 +#define        kV70Direction                           0x00000001              /* Bit 0  */
24371 +#define        kV70uIHEnabled                      0x00000002          /* Bit 1  */
24372 +#define        kV70AudioHeaderEnabled      0x00000004          /* Bit 2  */
24373 +#define kV70SilenceSupprEnabled     0x00000008         /* Bit 3  */
24374 +
24375 +#define        kV70SuspendResumeShift      4 
24376 +#define        kV70SuspendResumeMask       (3 << kV70SuspendResumeShift)
24377 +#define        kV70SuspendResumeDisabled   0x00000000          /* Bit 4,5  */
24378 +#define        kV70SuspendResumeWAddr      0x00000010          /* Bit 4  */
24379 +#define        kV70SuspendResumeWoAddr     0x00000020          /* Bit 5  */
24380 +
24381 +#define        kV70CrcLengthShift          6 
24382 +#define        kV70CrcLengthMask               (3 << kV70CrcLengthShift)
24383 +#define        kV70CrcLength16             0x00000000          /* Bit 6,7  */
24384 +#define        kV70CrcLength8              0x00000040          /* Bit 6  */
24385 +#define        kV70CrcLength32             0x00000080          /* Bit 7  */
24386 +
24387 +#define        kV70BlockingFactorShift     8 
24388 +#define        kV70BlockingFactorMask      (3 << kV70BlockingFactorShift)
24389 +#define        kV70BlockingFactor1         0x00000000          /* Bit 8,9  */
24390 +#define        kV70BlockingFactor2         0x00000100          /* Bit 8  */
24391 +#define        kV70BlockingFactor3                     0x00000200              /* Bit 9  */
24392 +#define        kV70BlockingFactor4                     0x00000300              /* Bit 8,9  */
24393 +
24394 +#define kV70InitChannelsShift          10
24395 +#define kV70InitChannelsMask           (1 << kV70InitChannelsShift)
24396 +#define        kV70InitNoChannels                      0x00000000              /* Bit 10,11  */
24397 +#define        kV70InitDataChannel                     0x00000400              /* Bit 10,11  */
24398 +#define        kV70InitAudioChannel            0x00000800              /* Bit 10,11  */
24399 +#define        kV70InitBothChannels            0x00000C00              /* Bit 10,11  */
24400 +
24401 +#define kV70OOBEnabled                         0x00001000              /* Bit 12 */
24402 +
24403 +/* V80 setup maps */
24404 +
24405 +#define        kV80Direction                           0x00000001              /* Bit 0  */
24406 +
24407 +#define        kV80ModeShift                           1 
24408 +#define        kV80ModeMask                            (3 << kV80ModeShift)
24409 +#define        kV80SyncMode                            (0 << kV80ModeShift)
24410 +#define        kV80TunnellingMode                      (1 << kV80ModeShift)
24411 +#define        kV80SamMode                                     (2 << kV80ModeShift)
24412 +#define        kV80SamTransparentMode          (2 << kV80ModeShift)
24413 +#define        kV80SamFramedMode                       (3 << kV80ModeShift)
24414 +
24415 +#define        kV80TransIdleShift                      3 
24416 +#define        kV80TransIdleMask                       (3 << kV80TransIdleShift)
24417 +#define        kV80TransIdleNoHunt                     (0 << kV80TransIdleShift)
24418 +#define        kV80TransIdleHunt8                      (1 << kV80TransIdleShift)
24419 +#define        kV80TransIdleHunt16                     (2 << kV80TransIdleShift)
24420 +
24421 +#define        kV80FrameIdleShift                      5 
24422 +#define        kV80FrameIdleMask                       (1 << kV80FrameIdleShift)
24423 +#define        kV80FrameIdleFlags                      (0 << kV80FrameIdleShift)
24424 +#define        kV80FrameIdleMarks                      (1 << kV80FrameIdleShift)
24425 +
24426 +#define        kV80FrameUnOvShift                      6 
24427 +#define        kV80FrameUnOvMask                       (1 << kV80FrameUnOvShift)
24428 +#define        kV80FrameUnOvAbort                      (0 << kV80FrameUnOvShift)
24429 +#define        kV80FrameUnOvFlag                       (1 << kV80FrameUnOvShift)
24430
24431 +#define        kV80HdAutoShift                         7 
24432 +#define        kV80HdAutoMask                          (1 << kV80HdAutoShift)
24433 +#define        kV80HdAutoNormal                        (0 << kV80HdAutoShift)
24434 +#define        kV80HdAutoExtended                      (1 << kV80HdAutoShift)
24435 +
24436 +#define        kV80CrcTypeShift                        8 
24437 +#define        kV80CrcTypeMask                         (3 << kV80CrcTypeShift)
24438 +#define        kV80NoCrc                                       (0 << kV80CrcTypeShift)
24439 +#define        kV80Crc16                                       (1 << kV80CrcTypeShift)
24440 +#define        kV80Crc32                                       (2 << kV80CrcTypeShift)
24441 +
24442 +#define        kV80NrziShift                           10
24443 +#define        kV80NrziMask                            (1 << kV80NrziShift)
24444 +#define        kV80NrziDisabled                        (0 << kV80NrziShift)
24445 +#define        kV80NrziEnabled                         (1 << kV80NrziShift)
24446 +
24447 +#define kV80Syn1Mask                           0x00FF0000              /* Bit 16-23  */
24448 +#define kV80Syn1Shift                          16
24449 +#define kV80Syn2Mask                           0xFF000000              /* Bit 24-31  */
24450 +#define kV80Syn2Shift                          24
24451 +
24452 +/* kStartCallProgressMonitorCmd setup masks */
24453 +
24454 +#define        kDTMFDetectorDebouncerEnabled                   0x0001
24455 +#define        kModemSignalDetectorDebouncerEnabled    0x0002
24456 +#define        kCallProgressDetectorDebouncerEnabled   0x0004
24457 +#define        kCustomSignalDebouncerEnabled                   0x0008
24458 +#define        kFaxCallingToneSuppressionEnabled               0x0010
24459 +#define        kDataCallingToneSuppressionEnabled              0x0020
24460 +#define        kCISuppressionEnabled                                   0x0040
24461 +#define        kAnsSuppressionEnabled                                  0x0080
24462 +
24463 +/* kDialCmd setup masks (dialerSetup bit fields) */
24464 +
24465 +#define        kDTMFDialingEnabled                                             0x0001
24466 +#define        kPulseDialingEnabled                                    0x0002
24467 +#define        kModeSwitchEnabled                                              0x0004
24468 +#define        kBlindDialingEnabled                                    0x0008
24469 +#define        kPulseDialingMethodMask                                 0x0030
24470 +#define        kDialModifierTranslationMask                    0x00C0
24471 +#define        kFlashWhilePulseDialingEnabled                  0x0100
24472 +
24473 +/* Pulse dialing method */
24474 +#define        kPulseDialingNPulsesPerDigit                    0x0000
24475 +#define        kPulseDialingNplusOnePulsesPerDigit             0x0010
24476 +#define        kPulseDialingTenMinusNPulsesPerDigit    0x0020
24477 +
24478 +/* Dial modifier translation */
24479 +#define        kTreatWasPause                                                  0x0040  /* Tread 'W' modifier as pause */
24480 +#define        kTreatCommaAsWaitForDialtone                    0x0080
24481 +
24482 +#ifdef TI_C6X
24483 +#include "C6xDefs.h"
24484 +#endif
24485 +#ifdef PENTIUM_MMX
24486 +#include "PentiumDefs.h"
24487 +#endif
24488 +
24489 +
24490 +#if defined(DSP16K) && !defined(SoftModemGlobals)
24491 +/* ensure that code generator does not use r5 */
24492 +register int *softmodem_h_should_not_be_included_after_softmodem_gh asm("r5");
24493 +#endif
24494 +
24495 +/****************************************************************************/
24496 +/*     3.      Interface functions.                                                                                            */
24497 +/*                                                                                                                                                     */
24498 +/****************************************************************************/
24499 +
24500 +#ifdef ADSL_MODEM
24501 +
24502 +#ifndef SoftDslHeader
24503 +#include "SoftDsl.h"
24504 +#endif
24505 +extern char*   SM_DECL SoftModemGetRevString(void);
24506 +extern char*   SM_DECL SoftModemGetProductName(void);
24507 +extern char*   SM_DECL SoftModemGetBuildDate(void);
24508 +extern char*   SM_DECL SoftModemGetFullManufacturerName(void);
24509 +extern char*   SM_DECL SoftModemGetShortManufacturerName(void);
24510 +extern int             SM_DECL SoftModemRevStringSize(void);
24511 +extern char*   SM_DECL SoftModemGetVendorIDString(void);
24512 +extern char*   SM_DECL SoftModemGetT1413VendorIDString(void);
24513 +extern char*   SM_DECL SoftModemGetSerialNumberString(void);
24514 +extern int             SM_DECL SoftModemSerNumStringSize(void);
24515 +#define        SoftDslGetProductName                   SoftModemGetProductName
24516 +#define        SoftDslGetBuildDate                             SoftModemGetBuildDate
24517 +#define        SoftDslGetFullManufacturerName  SoftModemGetFullManufacturerName
24518 +#define        SoftDslGetShortManufacturerName SoftModemGetShortManufacturerName
24519 +
24520 +#else /* !ADSL_MODEM */
24521 +
24522 +extern void            SM_DECL SoftModemSetMemoryPtr   (void   *varsPtr);
24523 +extern void*   SM_DECL SoftModemGetMemoryPtr   (void);
24524 +extern void            SM_DECL SoftModemSetRefData             (void   *varsPtr);
24525 +extern void*   SM_DECL SoftModemGetRefData             (void);
24526 +extern int             SM_DECL SoftModemGetMemorySize  (void);
24527 +extern void            SM_DECL SoftModemInit                   (void);
24528 +extern void            SM_DECL SoftModemReset                  (void);
24529 +extern void            SM_DECL SoftModemLineHandler    (int sampleCount, short *srcPtr, short *dstPtr);
24530 +extern void            SM_DECL SoftModemTimer                  (long timeQ24ms);
24531 +extern Boolean SM_DECL SoftModemCommandHandler (modemCommandStruct *cmdPtr);
24532 +extern int             SM_DECL SoftModemGetExternalMemorySize(void);
24533 +extern void            SM_DECL SoftModemSetExternalMemoryPtr(void      *varsPtr);
24534 +
24535 +extern void            SM_DECL SoftModemSetPcmCoding   (pcmCodingType pcmCoding);
24536 +extern void            SM_DECL SoftModemPcmLineHandler (int sampleCount, uchar *srcPtr, uchar *dstPtr);
24537 +
24538 +/* SoftModem IO functions      */
24539 +extern int             SM_DECL SoftModemWrite(int nBytes, uchar* srcPtr);
24540 +extern int             SM_DECL SoftModemRead(int nBytes, uchar* dstPtr);
24541 +extern int             SM_DECL SoftModemWriteFrame(int nBytes, uchar* srcPtr);
24542 +extern int             SM_DECL SoftModemReadFrame(int maxFrameSize, uchar* dstPtr);
24543 +extern int             SM_DECL SoftModemCountWritePending(void);
24544 +extern int             SM_DECL SoftModemCountReadPending(void);
24545 +extern int             SM_DECL SoftModemWriteSpaceAvailable(void);
24546 +extern void            SM_DECL SoftModemWriteFlush(void);
24547 +extern void            SM_DECL SoftModemReadFlush(void);
24548 +extern int             SM_DECL SoftModemGetWriteBufferSize(void);
24549 +extern int             SM_DECL SoftModemGetReadBufferSize(void);
24550 +
24551 +#ifdef AUDIO
24552 +extern int             SM_DECL SoftModemAudioHandler(int sampleCount, short *srcPtr, short *dstPtr);
24553 +extern int             SM_DECL SoftModemAudioRxDataHandler(int nBytes, uchar* srcPtr);
24554 +extern int             SM_DECL SoftModemAudioTxDataHandler(int nBytes, uchar* dstPtr);
24555 +#endif
24556 +
24557 +
24558 +#define        SoftModemSetGlobalPtr   SoftModemSetMemoryPtr
24559 +#define        SoftModem                               SoftModemLineHandler
24560 +#ifndef LINKLAYER_V42BIS_LARGE_DICTIONARY
24561 +#define        kSoftModemMaxMemorySize (65536)
24562 +#else
24563 +#define        kSoftModemMaxMemorySize (65536 + 8192)
24564 +#endif
24565 +
24566 +/*
24567 + * Internal functions
24568 + */
24569 +extern long    SM_DECL SoftModemGetDCOffset(void);
24570 +extern void    SM_DECL SoftModemDisableDCOffsetTracking(void);
24571 +extern void    SM_DECL SoftModemEnableDCOffsetTracking(void);
24572 +extern long    SM_DECL SoftModemGetRcvPower(void);
24573 +extern ulong   SM_DECL SoftModemGetHybridDelay(void);
24574 +extern  void   SM_DECL SoftModemStatusHandler  (modemStatusStruct *status);
24575 +extern Boolean SM_DECL SoftModemInternalCommandHandler (modemCommandStruct *cmdPtr);
24576 +extern  void   SM_DECL SoftModemInternalStatusHandler  (modemStatusStruct *status);
24577 +extern void    SM_DECL SoftModemSetControllerOnlyMode(commandHandlerType externalDataPumpCommandHandlerPtr);
24578 +extern char*   SM_DECL SoftModemGetRevString(void);
24579 +extern char*   SM_DECL SoftModemGetProductName(void);
24580 +extern char*   SM_DECL SoftModemGetBuildDate(void);
24581 +extern char*   SM_DECL SoftModemGetFullManufacturerName(void);
24582 +extern char*   SM_DECL SoftModemGetShortManufacturerName(void);
24583 +extern int             SM_DECL SoftModemRevStringSize(void);
24584 +extern char*   SM_DECL SoftModemGetVendorIDString(void);
24585 +extern char*   SM_DECL SoftModemGetSerialNumberString(void);
24586 +extern  void   SM_DECL SoftModemAuxTxDataHandler(int nBytes, uchar *dataPtr);
24587 +extern void    SM_DECL SoftModemAuxRxDataHandler(int nBytes, uchar *dataPtr);
24588 +extern  void   SM_DECL SoftModemTxDataHandler(int nBytes, uchar *dataPtr);
24589 +extern void    SM_DECL SoftModemRxDataHandler(int nBytes, uchar *dataPtr);
24590 +extern void    SM_DECL SoftModemATPrintf(uchar *format, void *arg1, void *arg2, void *arg3);
24591 +
24592 +#define        SoftModemSetInputSaturationLimit(limit)         (gSystemVars.inputSignalLimit = limit)  
24593 +#define        SoftModemResetInputSaturationLimit()            (gSystemVars.inputSignalLimit = 0)
24594 +
24595 +#endif /* !ADSL_MODEM */
24596 +
24597 +#endif /* SoftModemPh */
24598 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModemTypes.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModemTypes.h
24599 --- linux-2.6.8.1/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModemTypes.h  1970-01-01 01:00:00.000000000 +0100
24600 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/char/adsl/impl1/softdsl/SoftModemTypes.h 2006-06-26 09:07:10.000000000 +0200
24601 @@ -0,0 +1,292 @@
24602 +/*
24603 +<:copyright-broadcom 
24604
24605 + Copyright (c) 2002 Broadcom Corporation 
24606 + All Rights Reserved 
24607 + No portions of this material may be reproduced in any form without the 
24608 + written permission of: 
24609 +          Broadcom Corporation 
24610 +          16215 Alton Parkway 
24611 +          Irvine, California 92619 
24612 + All information contained in this document is Broadcom Corporation 
24613 + company private, proprietary, and trade secret. 
24614
24615 +:>
24616 +*/
24617 +/****************************************************************************
24618 + *
24619 + * SoftModemTypes.h 
24620 + *
24621 + *
24622 + * Description:
24623 + *     This file contains some of the type declarations for SoftModem
24624 + *
24625 + * Copyright (c) 1993-1997 AltoCom, Inc. All rights reserved.
24626 + * Authors: Mark Gonikberg, Haixiang Liang.
24627 + *
24628 + * $Revision: 1.9 $
24629 + *
24630 + * $Id: SoftModemTypes.h,v 1.9 2004/04/13 00:16:59 ilyas Exp $
24631 + *
24632 + * $Log: SoftModemTypes.h,v $
24633 + * Revision 1.9  2004/04/13 00:16:59  ilyas
24634 + * Merged the latest ADSL driver changes
24635 + *
24636 + * Revision 1.8  2004/01/24 01:35:33  ytan
24637 + * add multi-section lmem swap
24638 + *
24639 + * Revision 1.7  2001/09/21 19:19:01  ilyas
24640 + * Minor fixes for VxWorks build
24641 + *
24642 + * Revision 1.6  2001/08/16 02:16:39  khp
24643 + * - added definitions for SLOW_DATA and FAST_TEXT, defined to nothing
24644 + *   except when bcm47xx && USE_SLOW_DATA or USE_FAST_TEXT.  Any function
24645 + *   that needs to run fast should be marked with FAST_TEXT.  Any data that
24646 + *   is not referenced often should be marked with SLOW_DATA.
24647 + *
24648 + * Revision 1.5  2001/03/30 00:49:59  liang
24649 + * Changed warning output message.
24650 + *
24651 + * Revision 1.4  2000/06/21 22:24:40  yongbing
24652 + * Modify WARN micro to limit the number of same warnings printed
24653 + *
24654 + * Revision 1.3  1999/08/05 20:02:13  liang
24655 + * Merged with the softmodem top of the tree on 08/04/99.
24656 + *
24657 + * Revision 1.2  1999/01/27 22:14:29  liang
24658 + * Merge with SoftModem_3_1_02.
24659 + *
24660 + * Revision 1.19  1998/11/17 04:02:39  yura
24661 + * Fixed WARN and ASSERT redefinition warning for WinNT targets
24662 + *
24663 + * Revision 1.18  1998/08/26 19:20:43  scott
24664 + * Commented out EXCLUDE_CYGWIN32_TYPES define
24665 + *
24666 + * Revision 1.17  1998/08/13 19:03:06  scott
24667 + * Added BitField definition and INT_IS_LONG
24668 + *
24669 + * Revision 1.16  1998/08/08 03:39:55  scott
24670 + * The DEBUG_PTR_ENABLED macro can be used to enable only the DEBUG_PTR macros
24671 + *
24672 + * Revision 1.15  1998/07/28 22:21:31  mwg
24673 + * Fixed problems with NULL & nil being defined incorrectly
24674 + *
24675 + * Revision 1.14  1998/07/08 17:09:17  scott
24676 + * Define ASSERT and WARN only if not already defined
24677 + *
24678 + * Revision 1.13  1998/07/02 20:46:34  scott
24679 + * Added workaround for building certain builds with older SunOS
24680 + *
24681 + * Revision 1.12  1998/02/09 18:24:49  scott
24682 + * Defined "Private" as nothing for GreenHill (to prevent erroneous section
24683 + * allocations for data)
24684 + *
24685 + * Revision 1.11  1997/08/29 21:39:24  scott
24686 + * Added check for LONG_IS_INT define (for TI C6X support)
24687 + *
24688 + * Revision 1.10  1997/05/29 19:50:23  mwg
24689 + * Added code to avoid type redefintions under SunOS.
24690 + *
24691 + * Revision 1.9  1997/03/19 18:35:08  mwg
24692 + * Changed copyright notice.
24693 + *
24694 + * Revision 1.8  1997/02/11  00:05:53  mwg
24695 + * Minor adjustments for Pentium optimization.
24696 + *
24697 + * Revision 1.7  1997/01/11  01:30:47  mwg
24698 + * Added new macro WARN -- the same as ASSERT but without exit.
24699 + *
24700 + * Revision 1.6  1996/08/22  20:07:39  liang
24701 + * When ASSERT fires, only print out information, don't exit.
24702 + *
24703 + * Revision 1.5  1996/05/06  06:49:10  mwg
24704 + * Fixed linux problems.
24705 + *
24706 + * Revision 1.4  1996/05/02  08:40:16  mwg
24707 + * Merged in Chromatic bug fixes.
24708 + *
24709 + * Revision 1.3  1996/04/01  20:59:53  mwg
24710 + * Added macros to setup and use debug pointer.
24711 + *
24712 + * Revision 1.2  1996/02/27  01:50:04  mwg
24713 + * Added ASSERT() macro.
24714 + *
24715 + * Revision 1.1.1.1  1996/02/14  02:35:13  mwg
24716 + * Redesigned the project directory structure. Merged V.34 into the project.
24717 + *
24718 + * Revision 1.2  1995/12/03  06:59:31  mwg
24719 + * Fixed all gcc varnings. We are now running under Linux on a PC!
24720 + *
24721 + *****************************************************************************/
24722 +#ifndef        SoftModemTypesh
24723 +#define        SoftModemTypesh
24724 +
24725 +#ifdef LONG_SHORTS
24726 +#define        short   long
24727 +#define        ushort  unsigned long
24728 +#endif
24729 +
24730 +typedef signed char                    schar;
24731 +typedef unsigned char          uchar;
24732 +
24733 +#if 0 /* This is not currently required */
24734 +#if defined(_CYGWIN32) && defined(DEBUG)
24735 +#define EXCLUDE_CYGWIN32_TYPES
24736 +#endif
24737 +#endif
24738 +
24739 +#if !defined(_SYS_TYPES_H) || !defined(TARG_OS_RTEMS)
24740 +#if defined(_CFE_)
24741 + typedef unsigned int          uint;
24742 + typedef unsigned long         ulong;
24743 + typedef unsigned short                ushort;
24744 +#elif defined(TARG_OS_RTEMS)
24745 +#if defined(HOST_ARCH_LINUX)
24746 + typedef unsigned int          uint;
24747 +#endif
24748 + typedef unsigned long         ulong;
24749 +#if defined(HOST_ARCH_LINUX)
24750 + typedef unsigned short                ushort;
24751 +#endif
24752 +#elif defined(EXCLUDE_CYGWIN32_TYPES) || (!defined _NO_TYPE_DEFS_ && !defined _SYS_TYPES_H && !defined __SYS_TYPES_H__ && !defined _SYS_BSD_TYPES_H && !defined _LINUX_TYPES_H) || defined(__sparc__)
24753 +#ifndef EXCLUDE_CYGWIN32_TYPES
24754 + typedef unsigned int          uint;
24755 +#endif
24756 +#ifndef _LINUX_TYPES_H
24757 + typedef unsigned long         ulong;
24758 +#endif
24759 +#if !defined(ushort) && !defined(EXCLUDE_CYGWIN32_TYPES) && !defined(__INCvxTypesOldh)
24760 + typedef unsigned short                ushort;
24761 +#endif
24762 +#endif
24763 +#else
24764 +typedef unsigned long          ulong;
24765 +#endif
24766 +
24767 +#if defined(GREENHILL) || defined(GNUTX39) /* GH allocates private data to incorrect section */
24768 +#define Private
24769 +#else
24770 +#define Private             static
24771 +#endif
24772 +
24773 +#define Public
24774 +
24775 +#ifdef NULL
24776 +#undef NULL
24777 +#endif
24778 +#ifdef nil
24779 +#undef nil
24780 +#endif
24781 +
24782 +#define NULL 0
24783 +#define nil 0
24784 +
24785 +#define false 0
24786 +#define true 1
24787 +typedef unsigned char Boolean;
24788 +typedef unsigned int BitField; /* this must occur BEFORE long_is_int/int_is_long defs */
24789 +
24790 +#ifdef LONG_IS_INT
24791 +#define long int
24792 +#define ulong uint
24793 +#endif
24794 +
24795 +#ifdef INT_IS_LONG
24796 +#define int long
24797 +#define uint ulong
24798 +#endif
24799 +
24800 +#define POSTULATE(postulate)                                                                                   \
24801 +   do                                                                                                                                  \
24802 +          {                                                                                                                            \
24803 +          typedef struct                                                                                                       \
24804 +                  {                                                                                                                    \
24805 +                  char NegativeSizeIfPostulateFalse[((int)(postulate))*2 - 1]; \
24806 +                  } PostulateCheckStruct;                                                                              \
24807 +          }                                                                                                                            \
24808 +   while (0)
24809 +
24810 +#if defined(DEBUG) && !defined(__KERNEL__)
24811 +#ifndef WARN
24812 +#define        kDSLNumberWarnTimes     10
24813 +#define WARN(assertion) \
24814 +       { static int    warnSeveralTimes=0;     \
24815 +         if ((!(assertion))&(warnSeveralTimes<kDSLNumberWarnTimes)) \
24816 +               { \
24817 +               fprintf(stderr, "Warning, failed: %s\n", #assertion); \
24818 +               fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); \
24819 +               warnSeveralTimes++;     \
24820 +               } \
24821 +       }
24822 +#endif
24823 +#ifndef ASSERT
24824 +#define ASSERT(assertion) \
24825 +       { if (!(assertion)) \
24826 +               { \
24827 +               fprintf(stderr, "Assertion failed: %s\n", #assertion); \
24828 +               fprintf(stderr, "%s:%d\n", __FILE__, __LINE__); \
24829 +               exit(1); \
24830 +               } \
24831 +       }
24832 +#endif
24833 +#else
24834 +
24835 +#undef WARN
24836 +#define        WARN(a)
24837 +
24838 +#undef ASSERT
24839 +#define        ASSERT(a)
24840 +
24841 +#endif
24842 +
24843 +/*
24844 + * memory allocation macros
24845 + */
24846 +
24847 +#if defined(bcm47xx) && defined(USE_SLOW_DATA)
24848 +#define SLOW_DATA __attribute__ ((section(".slow_data")))
24849 +#else
24850 +#define SLOW_DATA
24851 +#endif
24852 +
24853 +#if defined(bcm47xx) && defined(USE_FAST_TEXT)
24854 +#define FAST_TEXT __attribute__ ((section(".fast_text")))
24855 +#else
24856 +#define FAST_TEXT
24857 +#endif
24858 +
24859 +#if defined(bcm47xx) && defined(SWAP_LMEM)
24860 +#define SWAP_TEXT1_1 __attribute__ ((section(".swap_text1_1")))
24861 +#define SWAP_TEXT1_2 __attribute__ ((section(".swap_text1_2")))
24862 +#define SWAP_TEXT2_1 __attribute__ ((section(".swap_text2_1")))
24863 +#define SWAP_TEXT2_2 __attribute__ ((section(".swap_text2_2")))
24864 +#define SWAP_TEXT3_1 __attribute__ ((section(".swap_text3_1")))
24865 +#define SWAP_TEXT3_2 __attribute__ ((section(".swap_text3_2")))
24866 +#else
24867 +#define SWAP_TEXT1_1 FAST_TEXT
24868 +#define SWAP_TEXT1_2 FAST_TEXT
24869 +#define SWAP_TEXT2_1 FAST_TEXT
24870 +#define SWAP_TEXT2_2 FAST_TEXT
24871 +#define SWAP_TEXT3_1 FAST_TEXT
24872 +#define SWAP_TEXT3_2 FAST_TEXT
24873 +#endif
24874 +
24875 +/*
24876 + * Debug stuff
24877 + */
24878 +#if defined(DEBUG) || defined(DEBUG_PTR_ENABLED)
24879 +#define        DECLARE_DEBUG_PTR(type)         static  type    *gv;
24880 +#define        SETUP_DEBUG_PTR()                       gv = &globalVar
24881 +#else
24882 +#define        DECLARE_DEBUG_PTR(type)
24883 +#define        SETUP_DEBUG_PTR()
24884 +#endif
24885 +/*
24886 + * Obsolete stuff
24887 + */
24888 +#ifdef DEBUG
24889 +#define        HereIsTheGlobalVarPointerMacro          SETUP_DEBUG_PTR();
24890 +#else
24891 +#define        HereIsTheGlobalVarPointerMacro
24892 +#endif
24893 +#endif
24894 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6338_common.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6338_common.h
24895 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6338_common.h    1970-01-01 01:00:00.000000000 +0100
24896 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6338_common.h   2006-06-26 09:07:10.000000000 +0200
24897 @@ -0,0 +1,207 @@
24898 +/*
24899 +<:copyright-broadcom 
24900
24901 + Copyright (c) 2002 Broadcom Corporation 
24902 + All Rights Reserved 
24903 + No portions of this material may be reproduced in any form without the 
24904 + written permission of: 
24905 +          Broadcom Corporation 
24906 +          16215 Alton Parkway 
24907 +          Irvine, California 92619 
24908 + All information contained in this document is Broadcom Corporation 
24909 + company private, proprietary, and trade secret. 
24910
24911 +:>
24912 +*/
24913 +/***********************************************************************/
24914 +/*                                                                     */
24915 +/*   MODULE: 6338_common.h                                             */
24916 +/*   DATE:    05/10/04                                                 */
24917 +/*   PURPOSE: Define addresses of major hardware components of         */
24918 +/*            BCM6338                                                  */
24919 +/*                                                                     */
24920 +/***********************************************************************/
24921 +#ifndef __BCM6338_MAP_COMMON_H
24922 +#define __BCM6338_MAP_COMMON_H
24923 +
24924 +#if __cplusplus
24925 +extern "C" {
24926 +#endif
24927 +
24928 +#define PERF_BASE     0xfffe0000    /* chip control registers */
24929 +#define BB_BASE       0xfffe0100    /* bus bridge registers */
24930 +#define TIMR_BASE     0xfffe0200    /* timer registers */
24931 +#define UART_BASE     0xfffe0300    /* uart registers */
24932 +#define GPIO_BASE     0xfffe0400    /* gpio registers */
24933 +#define SPI_BASE      0xfffe0c00    /* SPI master controller registers */
24934 +
24935 +#define ADSL_BASE     0xfffe1000       /* ADSL core control registers */
24936 +#define ATM_BASE      0xfffe2000       /* ATM SAR control registers */
24937 +#define EMAC_DMA_BASE 0xfffe2400    /* EMAC DMA control registers */
24938 +#define USB_DMA_BASE  0xfffe2400    /* USB DMA control registers */
24939 +#define EMAC1_BASE    0xfffe2800    /* EMAC1 control registers */
24940 +#define USB_CTL_BASE  0xfffe3000    /* USB control registers */
24941 +#define SDRAM_BASE    0xfffe3100    /* SDRAM control registers */
24942 +
24943 +
24944 +/*
24945 +#####################################################################
24946 +# System PLL Control Register
24947 +#####################################################################
24948 +*/
24949 +
24950 +#define SOFT_RESET     0x00000001
24951 +
24952 +/*
24953 +#####################################################################
24954 +# SDRAM Control Registers
24955 +#####################################################################
24956 +*/
24957 +#define SDR_INIT_CTL        0x00
24958 +    /* Control Bits */
24959 +#define SDR_PFEN1           (1<<16)
24960 +#define SDR_PFEN0           (1<<15)
24961 +#define SDR_EMPRS           (1<<14)
24962 +#define SDR_2_BANKS         (1<<13)
24963 +#define SDR_1_BANK          (0<<13)
24964 +#define SDR_CS1_EN          (1<<12)
24965 +#define SDR_PEND            (1<<11)
24966 +#define SDR_32_BIT          (1<<10)
24967 +#define SDR_POWER_DOWN      (1<<9)
24968 +#define SDR_SELF_REFRESH    (1<<8)
24969 +#define SDR_11_COLS         (3<<6)
24970 +#define SDR_10_COLS         (2<<6)
24971 +#define SDR_9_COLS          (1<<6)
24972 +#define SDR_8_COLS          (0<<6)
24973 +#define SDR_13_ROWS         (2<<4)
24974 +#define SDR_12_ROWS         (1<<4)
24975 +#define SDR_11_ROWS         (0<<4)
24976 +#define SDR_MASTER_EN       (1<<3)
24977 +#define SDR_MRS_CMD         (1<<2)
24978 +#define SDR_PRE_CMD         (1<<1)
24979 +#define SDR_CBR_CMD         (1<<0)
24980 +
24981 +#define SDR_CFG_REG         0x04
24982 +    /* Control Bits */
24983 +#define SDR_FULL_PG         0
24984 +#define SDR_BURST8          1
24985 +#define SDR_BURST4          2
24986 +#define SDR_BURST2          3
24987 +#define SDR_FAST_MEM        (1<<2)
24988 +#define SDR_SLOW_MEM        (0<<2)
24989 +
24990 +#define SDR_REF_CTL         0x0C
24991 +    /* Control Bits */
24992 +#define SDR_REF_EN          (1<<15)
24993 +
24994 +#define SDR_PRIOR
24995 +    /* Control Bits */
24996 +#define SDR_EN_PRIOR        (1<<31)
24997 +
24998 +
24999 +/*
25000 +#####################################################################
25001 +# MPI Control Registers
25002 +#####################################################################
25003 +*/
25004 +#define CS0BASE         0x00
25005 +#define CS0CNTL         0x04
25006 +
25007 +/*
25008 +# CSxBASE settings
25009 +#   Size in low 4 bits
25010 +#   Base Address for match in upper 24 bits
25011 +*/
25012 +#define EBI_SIZE_8K         0
25013 +#define EBI_SIZE_16K        1
25014 +#define EBI_SIZE_32K        2
25015 +#define EBI_SIZE_64K        3
25016 +#define EBI_SIZE_128K       4
25017 +#define EBI_SIZE_256K       5
25018 +#define EBI_SIZE_512K       6
25019 +#define EBI_SIZE_1M         7
25020 +#define EBI_SIZE_2M         8
25021 +#define EBI_SIZE_4M         9
25022 +#define EBI_SIZE_8M         10
25023 +#define EBI_SIZE_16M        11
25024 +#define EBI_SIZE_32M        12
25025 +#define EBI_SIZE_64M        13
25026 +#define EBI_SIZE_128M       14
25027 +#define EBI_SIZE_256M       15
25028 +
25029 +/* CSxCNTL settings */
25030 +#define EBI_ENABLE          0x00000001  /* .. enable this range */
25031 +#define EBI_WAIT_STATES     0x0000000e  /* .. mask for wait states */
25032 +#define ZEROWT              0x00000000  /* ..  0 WS */
25033 +#define ONEWT               0x00000002  /* ..  1 WS */
25034 +#define TWOWT               0x00000004  /* ..  2 WS */
25035 +#define THREEWT             0x00000006  /* ..  3 WS */
25036 +#define FOURWT              0x00000008  /* ..  4 WS */
25037 +#define FIVEWT              0x0000000a  /* ..  5 WS */
25038 +#define SIXWT               0x0000000c  /* ..  6 WS */
25039 +#define SEVENWT             0x0000000e  /* ..  7 WS */
25040 +#define EBI_WORD_WIDE       0x00000010  /* .. 16-bit peripheral, else 8 */
25041 +#define EBI_POLARITY        0x00000040  /* .. set to invert chip select polarity */
25042 +#define EBI_TS_TA_MODE      0x00000080  /* .. use TS/TA mode */
25043 +#define EBI_TS_SEL          0x00000100  /* .. drive tsize, not bs_b */
25044 +#define EBI_FIFO            0x00000200  /* .. enable fifo */
25045 +#define EBI_RE              0x00000400  /* .. Reverse Endian */
25046 +
25047 +/*
25048 +#####################################################################
25049 +# UART Control Registers
25050 +#####################################################################
25051 +*/
25052 +#define UART0CONTROL     0x01
25053 +#define UART0CONFIG      0x02
25054 +#define UART0RXTIMEOUT   0x03
25055 +#define UART0BAUD        0x04
25056 +#define UART0FIFOCFG     0x0a
25057 +#define UART0INTMASK     0x10
25058 +#define UART0INTSTAT     0x12
25059 +#define UART0DATA        0x17
25060 +
25061 +#define BRGEN            0x80   /* Control register bit defs */
25062 +#define TXEN             0x40
25063 +#define RXEN             0x20
25064 +#define LOOPBK           0x10
25065 +#define TXPARITYEN       0x08
25066 +#define TXPARITYEVEN     0x04
25067 +#define RXPARITYEN       0x02
25068 +#define RXPARITYEVEN     0x01
25069 +
25070 +#define XMITBREAK        0x40   /* Config register */
25071 +#define BITS5SYM         0x00
25072 +#define BITS6SYM         0x10
25073 +#define BITS7SYM         0x20
25074 +#define BITS8SYM         0x30
25075 +#define ONESTOP          0x07
25076 +#define TWOSTOP          0x0f
25077 +
25078 +#define RSTTXFIFOS       0x80   /* Rx Timeout register */
25079 +#define RSTRXFIFOS       0x40
25080 +
25081 +#define TX4              0x40   /* FIFO config register */
25082 +#define RX4              0x04
25083 +
25084 +#define DELTAIP          0x0001 /* Interrupt Status and Mask registers */
25085 +#define TXUNDERR         0x0002
25086 +#define TXOVFERR         0x0004
25087 +#define TXFIFOTHOLD      0x0008
25088 +#define TXREADLATCH      0x0010
25089 +#define TXFIFOEMT        0x0020
25090 +#define RXUNDERR         0x0040
25091 +#define RXOVFERR         0x0080
25092 +#define RXTIMEOUT        0x0100
25093 +#define RXFIFOFULL       0x0200
25094 +#define RXFIFOTHOLD      0x0400
25095 +#define RXFIFONE         0x0800
25096 +#define RXFRAMERR        0x1000
25097 +#define RXPARERR         0x2000
25098 +#define RXBRK            0x4000
25099 +          
25100 +#if __cplusplus
25101 +}
25102 +#endif
25103 +
25104 +#endif
25105 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6338_map.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6338_map.h
25106 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6338_map.h       1970-01-01 01:00:00.000000000 +0100
25107 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6338_map.h      2006-06-26 09:07:10.000000000 +0200
25108 @@ -0,0 +1,885 @@
25109 +/*
25110 +<:copyright-broadcom 
25111
25112 + Copyright (c) 2002 Broadcom Corporation 
25113 + All Rights Reserved 
25114 + No portions of this material may be reproduced in any form without the 
25115 + written permission of: 
25116 +          Broadcom Corporation 
25117 +          16215 Alton Parkway 
25118 +          Irvine, California 92619 
25119 + All information contained in this document is Broadcom Corporation 
25120 + company private, proprietary, and trade secret. 
25121
25122 +:>
25123 +*/
25124 +/***********************************************************************/
25125 +/*                                                                     */
25126 +/*   MODULE:  6338_map.h                                               */
25127 +/*   DATE:    05/10/04                                                 */
25128 +/*   PURPOSE: Define addresses of major hardware components of         */
25129 +/*            BCM6338                                                  */
25130 +/*                                                                     */
25131 +/***********************************************************************/
25132 +#ifndef __BCM6338_MAP_H
25133 +#define __BCM6338_MAP_H
25134 +
25135 +#if __cplusplus
25136 +extern "C" {
25137 +#endif
25138 +
25139 +#include "bcmtypes.h"
25140 +#include "6338_common.h"
25141 +#include "6338_intr.h"
25142 +
25143 +/* macro to convert logical data addresses to physical */
25144 +/* DMA hardware must see physical address */
25145 +#define LtoP( x )       ( (uint32)x & 0x1fffffff )
25146 +#define PtoL( x )       ( LtoP(x) | 0xa0000000 )
25147 +
25148 +/*
25149 +** Interrupt Controller
25150 +*/
25151 +typedef struct PerfControl {
25152 +  uint32        RevID;          /* (00) */
25153 +  uint16        testControl;    /* (04) */
25154 +  uint16        blkEnables;     /* (06) */
25155 +
25156 +#define ADSL_CLK_EN     0x0001
25157 +#define MPI_CLK_EN      0x0002
25158 +#define DRAM_CLK_EN     0x0004
25159 +#define EMAC_CLK_EN     0x0010
25160 +#define USBS_CLK_EN     0x0010
25161 +#define SAR_CLK_EN      0x0020
25162 +#define SPI_CLK_EN      0x0200
25163 +
25164 +  uint32        pll_control;    /* (08) */
25165 +#define CHIP_SOFT_RESET 0x00000001
25166 +
25167 +  uint32        IrqMask;        /* (0c) */
25168 +  uint32        IrqStatus;      /* (10) */
25169 +
25170 +  uint32        ExtIrqCfg;
25171 +#define EI_SENSE_SHFT   0
25172 +#define EI_STATUS_SHFT  5
25173 +#define EI_CLEAR_SHFT   10
25174 +#define EI_MASK_SHFT    15
25175 +#define EI_INSENS_SHFT  20
25176 +#define EI_LEVEL_SHFT   25
25177 +
25178 +  uint32        unused[4];      /* (18) */
25179 +  uint32        BlockSoftReset; /* (28) */
25180 +#define BSR_SPI             0x00000001
25181 +#define BSR_EMAC            0x00000004
25182 +#define BSR_USBH            0x00000008
25183 +#define BSR_USBS            0x00000010
25184 +#define BSR_ADSL            0x00000020
25185 +#define BSR_DMAMEM          0x00000040
25186 +#define BSR_SAR             0x00000080
25187 +#define BSR_ACLC            0x00000100
25188 +#define BSR_ADSL_MIPS_PLL   0x00000400
25189 +#define BSR_ALL_BLOCKS      \
25190 +    (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
25191 +     BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
25192 +} PerfControl;
25193 +
25194 +#define PERF ((volatile PerfControl * const) PERF_BASE)
25195 +
25196 +/*
25197 +** Bus Bridge Registers
25198 +*/
25199 +typedef struct BusBridge {
25200 +  uint16    status;
25201 +#define BB_BUSY     0x8000      /* posted operation in progress */
25202 +#define BB_RD_PND   0x4000      /* read pending */
25203 +#define BB_RD_CMPLT 0x2000      /* read complete */
25204 +#define BB_ERROR    0x1000      /* posted write error */
25205 +#define BB_TEA      0x0800      /* transfer aborted */
25206 +  uint16    abortTimeoutCnt;    /* abort timeout value */
25207 +
25208 +  byte      writePostEnable;
25209 +#define BB_POST_TIMR_EN 0x08        /* post writes to timer regs */
25210 +#define BB_POST_GPIO_EN 0x04        /* post writes to gpio regs */
25211 +#define BB_POST_INTC_EN 0x02        /* post writes to interrupt controller regs */
25212 +#define BB_POST_UART_EN 0x01        /* post writes to uart regs */
25213 +  byte      unused1[5];
25214 +  uint16    postAddr;       /* posted read address (lower half) */
25215 +  byte      unused2[3];
25216 +  byte      postData;       /* posted read data */
25217 +} BusBridge;
25218 +
25219 +/* register offsets (needed for EBI master access) */
25220 +#define BB_STATUS       0
25221 +#define BB_ABORT_TO_CNT     2
25222 +#define BB_WR_POST_EN       4
25223 +#define BB_RD_POST_ADDR     10
25224 +#define BB_RD_POST_DATA     12
25225 +
25226 +#define BRIDGE *bridge ((volatile BusBridge * const) BB_BASE)
25227 +
25228 +/*
25229 +** Timer
25230 +*/
25231 +typedef struct Timer {
25232 +  uint16        unused0;
25233 +  byte          TimerMask;
25234 +#define TIMER0EN        0x01
25235 +#define TIMER1EN        0x02
25236 +#define TIMER2EN        0x04
25237 +  byte          TimerInts;
25238 +#define TIMER0          0x01
25239 +#define TIMER1          0x02
25240 +#define TIMER2          0x04
25241 +#define WATCHDOG        0x08
25242 +  uint32        TimerCtl0;
25243 +  uint32        TimerCtl1;
25244 +  uint32        TimerCtl2;
25245 +#define TIMERENABLE     0x80000000
25246 +#define RSTCNTCLR       0x40000000      
25247 +  uint32        TimerCnt0;
25248 +  uint32        TimerCnt1;
25249 +  uint32        TimerCnt2;
25250 +  uint32        WatchDogDefCount;
25251 +
25252 +  /* Write 0xff00 0x00ff to Start timer
25253 +   * Write 0xee00 0x00ee to Stop and re-load default count
25254 +   * Read from this register returns current watch dog count
25255 +   */
25256 +  uint32        WatchDogCtl;
25257 +
25258 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
25259 +  uint32        WDResetCount;
25260 +} Timer;
25261 +
25262 +#define TIMER ((volatile Timer * const) TIMR_BASE)
25263 +
25264 +/*
25265 +** UART
25266 +*/
25267 +typedef struct UartChannel {
25268 +  byte          unused0;
25269 +  byte          control;
25270 +#define BRGEN           0x80    /* Control register bit defs */
25271 +#define TXEN            0x40
25272 +#define RXEN            0x20
25273 +#define LOOPBK          0x10
25274 +#define TXPARITYEN      0x08
25275 +#define TXPARITYEVEN    0x04
25276 +#define RXPARITYEN      0x02
25277 +#define RXPARITYEVEN    0x01
25278 +
25279 +  byte          config;
25280 +#define XMITBREAK       0x40
25281 +#define BITS5SYM        0x00
25282 +#define BITS6SYM        0x10
25283 +#define BITS7SYM        0x20
25284 +#define BITS8SYM        0x30
25285 +#define ONESTOP         0x07
25286 +#define TWOSTOP         0x0f
25287 +  /* 4-LSBS represent STOP bits/char
25288 +   * in 1/8 bit-time intervals.  Zero
25289 +   * represents 1/8 stop bit interval.
25290 +   * Fifteen represents 2 stop bits.
25291 +   */
25292 +  byte          fifoctl;
25293 +#define RSTTXFIFOS      0x80
25294 +#define RSTRXFIFOS      0x40
25295 +  /* 5-bit TimeoutCnt is in low bits of this register.
25296 +   *  This count represents the number of characters 
25297 +   *  idle times before setting receive Irq when below threshold
25298 +   */
25299 +  uint32        baudword;
25300 +  /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
25301 +   */
25302 +
25303 +  byte          txf_levl;       /* Read-only fifo depth */
25304 +  byte          rxf_levl;       /* Read-only fifo depth */
25305 +  byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
25306 +                                 *      RxThreshold.  Irq can be asserted
25307 +                                 *      when rx fifo> thresh, txfifo<thresh
25308 +                                 */
25309 +  byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
25310 +                                 *  if these bits are also enabled to GPIO_o
25311 +                                 */
25312 +#define        DTREN   0x01
25313 +#define        RTSEN   0x02
25314 +
25315 +  byte          unused1;
25316 +  byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
25317 +                                         * detect irq on rising AND falling 
25318 +                                         * edges for corresponding GPIO_i
25319 +                                         * if enabled (edge insensitive)
25320 +                                         */
25321 +  byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
25322 +                                         *      0 for negedge sense if
25323 +                                         *      not configured for edge
25324 +                                         *      insensitive (see above)
25325 +                                         * Lower 4 bits: Mask to enable change
25326 +                                         *  detection IRQ for corresponding
25327 +                                         *  GPIO_i
25328 +                                         */
25329 +  byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
25330 +                                         *  have changed (may set IRQ).
25331 +                                         *  read automatically clears bit
25332 +                                         * Lower 4 bits are actual status
25333 +                                         */
25334 +
25335 +  uint16        intMask;                               /* Same Bit defs for Mask and status */
25336 +  uint16        intStatus;
25337 +#define DELTAIP         0x0001
25338 +#define TXUNDERR        0x0002
25339 +#define TXOVFERR        0x0004
25340 +#define TXFIFOTHOLD     0x0008
25341 +#define TXREADLATCH     0x0010
25342 +#define TXFIFOEMT       0x0020
25343 +#define RXUNDERR        0x0040
25344 +#define RXOVFERR        0x0080
25345 +#define RXTIMEOUT       0x0100
25346 +#define RXFIFOFULL      0x0200
25347 +#define RXFIFOTHOLD     0x0400
25348 +#define RXFIFONE        0x0800
25349 +#define RXFRAMERR       0x1000
25350 +#define RXPARERR        0x2000
25351 +#define RXBRK           0x4000
25352 +
25353 +  uint16        unused2;
25354 +  uint16        Data;                   /* Write to TX, Read from RX */
25355 +                                        /* bits 11:8 are BRK,PAR,FRM errors */
25356 +
25357 +  uint32               unused3;
25358 +  uint32               unused4;
25359 +} Uart;
25360 +
25361 +#define UART ((volatile Uart * const) UART_BASE)
25362 +
25363 +/*
25364 +** Gpio Controller
25365 +*/
25366 +
25367 +typedef struct GpioControl {
25368 +  uint32        unused0;
25369 +  uint32        GPIODir;      /* bits 7:0 */
25370 +  uint32        unused1;      /* bits 36:32 */
25371 +  uint32        GPIOio;
25372 +  uint32        LEDCtrl;
25373 +#define         LED3_STROBE             0x08000000
25374 +#define         LED2_STROBE             0x04000000
25375 +#define         LED1_STROBE             0x02000000
25376 +#define         LED0_STROBE             0x01000000
25377 +#define         LED_TEST                0x00010000
25378 +#define         LED3_DISABLE_LINK_ACT   0x00008000
25379 +#define         LED2_DISABLE_LINK_ACT   0x00004000
25380 +#define         LED1_DISABLE_LINK_ACT   0x00002000
25381 +#define         LED0_DISABLE_LINK_ACT   0x00001000
25382 +#define         LED_INTERVAL_SET_MASK   0x00000f00
25383 +#define         LED_INTERVAL_SET_320MS  0x00000500
25384 +#define         LED_INTERVAL_SET_160MS  0x00000400
25385 +#define         LED_INTERVAL_SET_80MS   0x00000300
25386 +#define         LED_INTERVAL_SET_40MS   0x00000200
25387 +#define         LED_INTERVAL_SET_20MS   0x00000100
25388 +#define         LED3_ON                 0x00000080
25389 +#define         LED2_ON                 0x00000040
25390 +#define         LED1_ON                 0x00000020
25391 +#define         LED0_ON                 0x00000010
25392 +#define         LED3_ENABLE             0x00000008
25393 +#define         LED2_ENABLE             0x00000004
25394 +#define         LED1_ENABLE             0x00000002
25395 +#define         LED0_ENABLE             0x00000001
25396 +  uint32        SpiSlaveCfg;
25397 +#define         SPI_SLAVE_RESET         0x00010000
25398 +#define         SPI_RESTRICT            0x00000400
25399 +#define         SPI_DELAY_DISABLE       0x00000200
25400 +#define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
25401 +#define         SPI_SER_ADDR_CFG_MASK   0x0000000c
25402 +#define         SPI_MODE                0x00000001
25403 +  uint32        vRegConfig;
25404 +} GpioControl;
25405 +
25406 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
25407 +
25408 +/* Number to mask conversion macro used for GPIODir and GPIOio */
25409 +#define GPIO_NUM_MAX_BITS_MASK          0x0f
25410 +#define GPIO_NUM_TO_MASK(X)             (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
25411 +
25412 +/*
25413 +** Spi Controller
25414 +*/
25415 +
25416 +typedef struct SpiControl {
25417 +  uint16        spiCmd;                 /* (0x0): SPI command */
25418 +#define SPI_CMD_NOOP                    0
25419 +#define SPI_CMD_SOFT_RESET              1
25420 +#define SPI_CMD_HARD_RESET              2
25421 +#define SPI_CMD_START_IMMEDIATE         3
25422 +
25423 +#define SPI_CMD_COMMAND_SHIFT           0
25424 +#define SPI_CMD_DEVICE_ID_SHIFT         4
25425 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
25426 +#define SPI_CMD_ONE_BYTE_SHIFT          11
25427 +#define SPI_CMD_ONE_WIRE_SHIFT          12
25428 +#define SPI_DEV_ID_0                    0
25429 +#define SPI_DEV_ID_1                    1
25430 +#define SPI_DEV_ID_2                    2
25431 +#define SPI_DEV_ID_3                    3
25432 +
25433 +  byte          spiIntStatus;           /* (0x2): SPI interrupt status */
25434 +  byte          spiMaskIntStatus;       /* (0x3): SPI masked interrupt status */
25435 +
25436 +  byte          spiIntMask;             /* (0x4): SPI interrupt mask */
25437 +#define SPI_INTR_CMD_DONE               0x01
25438 +#define SPI_INTR_RX_OVERFLOW            0x02
25439 +#define SPI_INTR_INTR_TX_UNDERFLOW      0x04
25440 +#define SPI_INTR_TX_OVERFLOW            0x08
25441 +#define SPI_INTR_RX_UNDERFLOW           0x10
25442 +#define SPI_INTR_CLEAR_ALL              0x1f
25443 +
25444 +  byte          spiStatus;              /* (0x5): SPI status */
25445 +#define SPI_RX_EMPTY                    0x02
25446 +#define SPI_CMD_BUSY                    0x04
25447 +#define SPI_SERIAL_BUSY                 0x08
25448 +
25449 +  byte          spiClkCfg;              /* (0x6): SPI clock configuration */
25450 +#define SPI_CLK_0_391MHZ                1
25451 +#define SPI_CLK_0_781MHZ                2 /* default */
25452 +#define SPI_CLK_1_563MHZ                3
25453 +#define SPI_CLK_3_125MHZ                4
25454 +#define SPI_CLK_6_250MHZ                5
25455 +#define SPI_CLK_12_50MHZ                6
25456 +#define SPI_CLK_MASK                    0x07
25457 +#define SPI_SSOFFTIME_MASK              0x38
25458 +#define SPI_SSOFFTIME_SHIFT             3
25459 +#define SPI_BYTE_SWAP                   0x80
25460 +
25461 +  byte          spiFillByte;            /* (0x7): SPI fill byte */
25462 +
25463 +  byte          unused0; 
25464 +  byte          spiMsgTail;             /* (0x9): msgtail */
25465 +  byte          unused1; 
25466 +  byte          spiRxTail;              /* (0xB): rxtail */
25467 +
25468 +  uint32        unused2[13];            /* (0x0c - 0x3c) reserved */
25469 +
25470 +  byte          spiMsgCtl;              /* (0x40) control byte */
25471 +#define FULL_DUPLEX_RW                  0
25472 +#define HALF_DUPLEX_W                   1
25473 +#define HALF_DUPLEX_R                   2
25474 +#define SPI_MSG_TYPE_SHIFT              6
25475 +#define SPI_BYTE_CNT_SHIFT              0
25476 +  byte          spiMsgData[63];         /* (0x41 - 0x7f) msg data */
25477 +  byte          spiRxDataFifo[64];      /* (0x80 - 0xbf) rx data */
25478 +  byte          unused3[64];            /* (0xc0 - 0xff) reserved */
25479 +} SpiControl;
25480 +
25481 +#define SPI ((volatile SpiControl * const) SPI_BASE)
25482 +
25483 +#define IUDMA_MAX_CHANNELS      16
25484 +
25485 +/*
25486 +** DMA Channel Configuration (1 .. 16)
25487 +*/
25488 +typedef struct DmaChannelCfg {
25489 +  uint32        cfg;                    /* (00) assorted configuration */
25490 +#define         DMA_BURST_HALT  0x00000004  /* idle after finish current memory burst */
25491 +#define         DMA_PKT_HALT    0x00000002  /* idle after an EOP flag is detected */
25492 +#define         DMA_ENABLE  0x00000001      /* set to enable channel */
25493 +  uint32        intStat;                /* (04) interrupts control and status */
25494 +  uint32        intMask;                /* (08) interrupts mask */
25495 +#define         DMA_BUFF_DONE   0x00000001  /* buffer done */
25496 +#define         DMA_DONE        0x00000002  /* packet xfer complete */
25497 +#define         DMA_NO_DESC     0x00000004  /* no valid descriptors */
25498 +  uint32        maxBurst;               /* (0C) max burst length permitted */
25499 +} DmaChannelCfg;
25500 +
25501 +/*
25502 +** DMA State RAM (1 .. 16)
25503 +*/
25504 +typedef struct DmaStateRam {
25505 +  uint32        baseDescPtr;            /* (00) descriptor ring start address */
25506 +  uint32        state_data;             /* (04) state/bytes done/ring offset */
25507 +  uint32        desc_len_status;        /* (08) buffer descriptor status and len */
25508 +  uint32        desc_base_bufptr;       /* (0C) buffer descrpitor current processing */
25509 +} DmaStateRam;
25510 +
25511 +/*
25512 +** DMA Registers
25513 +*/
25514 +typedef struct DmaRegs {
25515 +#define DMA_MASTER_EN           0x00000001
25516 +#define DMA_FLOWC_CH1_EN        0x00000002
25517 +#define DMA_FLOWC_CH3_EN        0x00000004
25518 +#define DMA_NUM_CHS_MASK        0x0f000000
25519 +#define DMA_NUM_CHS_SHIFT       24
25520 +#define DMA_FLOWCTL_MASK        0x30000000
25521 +#define DMA_FLOWCTL_CH1         0x10000000
25522 +#define DMA_FLOWCTL_CH3         0x20000000
25523 +#define DMA_FLOWCTL_SHIFT       28
25524 +    uint32 controller_cfg;              /* (00) controller configuration */
25525 +
25526 +    // Flow control Ch1
25527 +    uint32 flowctl_ch1_thresh_lo;       /* (04) EMAC1 RX DMA channel */
25528 +    uint32 flowctl_ch1_thresh_hi;       /* (08) EMAC1 RX DMA channel */
25529 +    uint32 flowctl_ch1_alloc;           /* (0C) EMAC1 RX DMA channel */
25530 +#define DMA_BUF_ALLOC_FORCE     0x80000000
25531 +
25532 +    // Flow control Ch3
25533 +    uint32 flowctl_ch3_thresh_lo;       /* (10) EMAC2 RX DMA channel */
25534 +    uint32 flowctl_ch3_thresh_hi;       /* (14) EMAC2 RX DMA channel */
25535 +    uint32 flowctl_ch3_alloc;           /* (18) EMAC2 RX DMA channel */
25536 +
25537 +    // Unused words
25538 +    uint32 resv[57];
25539 +
25540 +    // Per channel registers/state ram
25541 +    DmaChannelCfg chcfg[IUDMA_MAX_CHANNELS]; /* (100) Channel configuration */
25542 +    union {
25543 +        DmaStateRam     s[IUDMA_MAX_CHANNELS];
25544 +        uint32          u32[4 * IUDMA_MAX_CHANNELS];
25545 +    } stram;                                /* (200) state ram */
25546 +} DmaRegs;
25547 +
25548 +/*
25549 +** DMA Buffer 
25550 +*/
25551 +typedef struct DmaDesc {
25552 +  uint16        length;                 /* in bytes of data in buffer */
25553 +#define          DMA_DESC_USEFPM    0x8000
25554 +#define          DMA_DESC_MULTICAST 0x4000
25555 +#define          DMA_DESC_BUFLENGTH 0x0fff
25556 +  uint16        status;                 /* buffer status */
25557 +#define          DMA_OWN        0x8000  /* cleared by DMA, set by SW */
25558 +#define          DMA_EOP        0x4000  /* last buffer in packet */
25559 +#define          DMA_SOP        0x2000  /* first buffer in packet */
25560 +#define          DMA_WRAP       0x1000  /* */
25561 +#define          DMA_APPEND_CRC 0x0100
25562 +
25563 +/* EMAC Descriptor Status definitions */
25564 +#define          EMAC_MISS      0x0080  /* framed address recognition failed (promiscuous) */
25565 +#define          EMAC_BRDCAST   0x0040  /* DA is Broadcast */
25566 +#define          EMAC_MULT      0x0020  /* DA is multicast */
25567 +#define          EMAC_LG        0x0010  /* frame length > RX_LENGTH register value */
25568 +#define          EMAC_NO        0x0008  /* Non-Octet aligned */
25569 +#define          EMAC_RXER      0x0004  /* RX_ERR on MII while RX_DV assereted */
25570 +#define          EMAC_CRC_ERROR 0x0002  /* CRC error */
25571 +#define          EMAC_OV        0x0001  /* Overflow */
25572 +
25573 +/* HDLC Descriptor Status definitions */
25574 +#define          DMA_HDLC_TX_ABORT      0x0100
25575 +#define          DMA_HDLC_RX_OVERRUN    0x4000
25576 +#define          DMA_HDLC_RX_TOO_LONG   0x2000
25577 +#define          DMA_HDLC_RX_CRC_OK     0x1000
25578 +#define          DMA_HDLC_RX_ABORT      0x0100
25579 +
25580 +  uint32        address;                /* address of data */
25581 +} DmaDesc;
25582 +
25583 +/*
25584 +** Sdram Controller
25585 +*/
25586 +typedef struct SdramControllerRegs {
25587 +  uint16        unused1;
25588 +  uint16        initControl;    /* 02 */
25589 +#define SD_POWER_DOWN           0x200   /* put sdram into power down */
25590 +#define SD_SELF_REFRESH         0x100   /* enable self refresh mode */
25591 +#define SD_SOFT_RESET           0x080   /* soft reset all sdram controller regs */
25592 +#define SD_EDO_SELECT           0x040   /* select EDO mode */
25593 +#define SD_EDO_WAIT_STATE       0x020   /* add an EDO wait state */
25594 +#define SD_8MEG                 0x010   /* map sdram to 8 megs */
25595 +#define SD_MASTER_ENABLE        0x008   /* enable accesses to external sdram */
25596 +#define SD_MRS                  0x004   /* generate a mode register select cycle */
25597 +#define SD_PRECHARGE            0x002   /* generate a precharge cycle */
25598 +#define SD_CBR                  0x001   /* generate a refresh cycle */
25599 +  uint8         unused2[3];
25600 +  uint8         config;         /* 07 */
25601 +#define SD_FAST_MEM             0x04    /* 1=CAS latency of 2, 0 = CAS latency of 3 */
25602 +#define SD_BURST_LEN            0x03    /* set burst length */
25603 +#define SD_BURST_FULL_PAGE      0x00    /* .. full page */
25604 +#define SD_BURST_8              0x01    /* .. 8 words */
25605 +#define SD_BURST_4              0x02    /* .. 4 words */
25606 +#define SD_BURST_2              0x03    /* .. 2 words */
25607 +  uint16        unused3;
25608 +  uint16        refreshControl; /* 0a */
25609 +#define SD_REFRESH_ENABLE       0x8000  /* refresh enable */
25610 +#define SD_REFRESH_PERIOD       0x00ff  /* refresh period (16 x n x clock_period) */
25611 +
25612 +  uint32        memoryBase;     /* 0c */
25613 +#define SD_MEMBASE_MASK         0xffffe000      /* base address mask */
25614 +#define SD_MEMSIZE_8MEG         0x00000001      /* memory is 8 meg */
25615 +#define SD_MEMSIZE_2MEG         0x00000001      /* memory is 2 meg */
25616 +
25617 +} SdramControllerRegs;
25618 +
25619 +/*
25620 +** External Bus Interface
25621 +*/
25622 +typedef struct EbiChipSelect {
25623 +  uint32        base;                   /* base address in upper 24 bits */
25624 +#define EBI_SIZE_8K         0
25625 +#define EBI_SIZE_16K        1
25626 +#define EBI_SIZE_32K        2
25627 +#define EBI_SIZE_64K        3
25628 +#define EBI_SIZE_128K       4
25629 +#define EBI_SIZE_256K       5
25630 +#define EBI_SIZE_512K       6
25631 +#define EBI_SIZE_1M         7
25632 +#define EBI_SIZE_2M         8
25633 +#define EBI_SIZE_4M         9
25634 +#define EBI_SIZE_8M         10
25635 +#define EBI_SIZE_16M        11
25636 +#define EBI_SIZE_32M        12
25637 +#define EBI_SIZE_64M        13
25638 +#define EBI_SIZE_128M       14
25639 +#define EBI_SIZE_256M       15
25640 +  uint32        config;
25641 +#define EBI_ENABLE          0x00000001      /* .. enable this range */
25642 +#define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
25643 +#define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
25644 +#define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
25645 +#define EBI_WREN            0x00000020      /* enable posted writes */
25646 +#define EBI_POLARITY        0x00000040      /* .. set to invert something, 
25647 +                                        **    don't know what yet */
25648 +#define EBI_FIFO            0x00000200      /* .. use fifo */
25649 +#define EBI_RE              0x00000400      /* .. Reverse Endian */
25650 +} EbiChipSelect;
25651 +
25652 +typedef struct MpiRegisters {
25653 +  EbiChipSelect cs[1];                  /* size chip select configuration */
25654 +} MpiRegisters;
25655 +
25656 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
25657 +
25658 +/*
25659 +** EMAC transmit MIB counters
25660 +*/
25661 +typedef struct EmacTxMib {
25662 +  uint32        tx_good_octets;         /* (200) good byte count */
25663 +  uint32        tx_good_pkts;           /* (204) good pkt count */
25664 +  uint32        tx_octets;              /* (208) good and bad byte count */
25665 +  uint32        tx_pkts;                /* (20c) good and bad pkt count */
25666 +  uint32        tx_broadcasts_pkts;     /* (210) good broadcast packets */
25667 +  uint32        tx_multicasts_pkts;     /* (214) good mulitcast packets */
25668 +  uint32        tx_len_64;              /* (218) RMON tx pkt size buckets */
25669 +  uint32        tx_len_65_to_127;       /* (21c) */
25670 +  uint32        tx_len_128_to_255;      /* (220) */
25671 +  uint32        tx_len_256_to_511;      /* (224) */
25672 +  uint32        tx_len_512_to_1023;     /* (228) */
25673 +  uint32        tx_len_1024_to_max;     /* (22c) */
25674 +  uint32        tx_jabber_pkts;         /* (230) > 1518 with bad crc */
25675 +  uint32        tx_oversize_pkts;       /* (234) > 1518 with good crc */
25676 +  uint32        tx_fragment_pkts;       /* (238) < 63   with bad crc */
25677 +  uint32        tx_underruns;           /* (23c) fifo underrun */
25678 +  uint32        tx_total_cols;          /* (240) total collisions in all tx pkts */
25679 +  uint32        tx_single_cols;         /* (244) tx pkts with single collisions */
25680 +  uint32        tx_multiple_cols;       /* (248) tx pkts with multiple collisions */
25681 +  uint32        tx_excessive_cols;      /* (24c) tx pkts with excessive cols */
25682 +  uint32        tx_late_cols;           /* (250) tx pkts with late cols */
25683 +  uint32        tx_defered;             /* (254) tx pkts deferred */
25684 +  uint32        tx_carrier_lost;        /* (258) tx pkts with CRS lost */
25685 +  uint32        tx_pause_pkts;          /* (25c) tx pause pkts sent */
25686 +#define NumEmacTxMibVars        24
25687 +} EmacTxMib;
25688 +
25689 +/*
25690 +** EMAC receive MIB counters
25691 +*/
25692 +typedef struct EmacRxMib {
25693 +  uint32        rx_good_octets;         /* (280) good byte count */
25694 +  uint32        rx_good_pkts;           /* (284) good pkt count */
25695 +  uint32        rx_octets;              /* (288) good and bad byte count */
25696 +  uint32        rx_pkts;                /* (28c) good and bad pkt count */
25697 +  uint32        rx_broadcasts_pkts;     /* (290) good broadcast packets */
25698 +  uint32        rx_multicasts_pkts;     /* (294) good mulitcast packets */
25699 +  uint32        rx_len_64;              /* (298) RMON rx pkt size buckets */
25700 +  uint32        rx_len_65_to_127;       /* (29c) */
25701 +  uint32        rx_len_128_to_255;      /* (2a0) */
25702 +  uint32        rx_len_256_to_511;      /* (2a4) */
25703 +  uint32        rx_len_512_to_1023;     /* (2a8) */
25704 +  uint32        rx_len_1024_to_max;     /* (2ac) */
25705 +  uint32        rx_jabber_pkts;         /* (2b0) > 1518 with bad crc */
25706 +  uint32        rx_oversize_pkts;       /* (2b4) > 1518 with good crc */
25707 +  uint32        rx_fragment_pkts;       /* (2b8) < 63   with bad crc */
25708 +  uint32        rx_missed_pkts;         /* (2bc) missed packets */
25709 +  uint32        rx_crc_align_errs;      /* (2c0) both or either */
25710 +  uint32        rx_undersize;           /* (2c4) < 63   with good crc */
25711 +  uint32        rx_crc_errs;            /* (2c8) crc errors (only) */
25712 +  uint32        rx_align_errs;          /* (2cc) alignment errors (only) */
25713 +  uint32        rx_symbol_errs;         /* (2d0) pkts with RXERR assertions (symbol errs) */
25714 +  uint32        rx_pause_pkts;          /* (2d4) MAC control, PAUSE */
25715 +  uint32        rx_nonpause_pkts;       /* (2d8) MAC control, not PAUSE */
25716 +#define NumEmacRxMibVars        23
25717 +} EmacRxMib;
25718 +
25719 +typedef struct EmacRegisters {
25720 +  uint32        rxControl;              /* (00) receive control */
25721 +#define          EMAC_PM_REJ    0x80    /*      - reject DA match in PMx regs */
25722 +#define          EMAC_UNIFLOW   0x40    /*      - accept cam match fc */
25723 +#define          EMAC_FC_EN     0x20    /*      - enable flow control */
25724 +#define          EMAC_LOOPBACK  0x10    /*      - loopback */
25725 +#define          EMAC_PROM      0x08    /*      - promiscuous */
25726 +#define          EMAC_RDT       0x04    /*      - ignore transmissions */
25727 +#define          EMAC_ALL_MCAST 0x02    /*      - ignore transmissions */
25728 +#define          EMAC_NO_BCAST  0x01    /*      - ignore transmissions */
25729 +
25730 +
25731 +  uint32        rxMaxLength;            /* (04) receive max length */
25732 +  uint32        txMaxLength;            /* (08) transmit max length */
25733 +  uint32        unused1[1];
25734 +  uint32        mdioFreq;               /* (10) mdio frequency */
25735 +#define          EMAC_MII_PRE_EN 0x00000080 /* prepend preamble sequence */
25736 +#define          EMAC_MDIO_PRE   0x00000080 /*      - enable MDIO preamble */
25737 +#define          EMAC_MDC_FREQ   0x0000007f /*      - mdio frequency */
25738 +
25739 +  uint32        mdioData;               /* (14) mdio data */
25740 +#define          MDIO_WR        0x50020000 /*   - write framing */
25741 +#define          MDIO_RD        0x60020000 /*   - read framing */
25742 +#define          MDIO_PMD_SHIFT  23
25743 +#define          MDIO_REG_SHIFT  18
25744 +
25745 +  uint32        intMask;                /* (18) int mask */
25746 +  uint32        intStatus;              /* (1c) int status */
25747 +#define          EMAC_FLOW_INT  0x04    /*      - flow control event */
25748 +#define          EMAC_MIB_INT   0x02    /*      - mib event */
25749 +#define          EMAC_MDIO_INT  0x01    /*      - mdio event */
25750 +
25751 +  uint32        unused2[3];
25752 +  uint32        config;                 /* (2c) config */
25753 +#define          EMAC_ENABLE    0x001   /*      - enable emac */
25754 +#define          EMAC_DISABLE   0x002   /*      - disable emac */
25755 +#define          EMAC_SOFT_RST  0x004   /*      - soft reset */
25756 +#define          EMAC_SOFT_RESET 0x004  /*      - emac soft reset */
25757 +#define          EMAC_EXT_PHY   0x008   /*      - external PHY select */
25758 +
25759 +  uint32        txControl;              /* (30) transmit control */
25760 +#define          EMAC_FD        0x001   /*      - full duplex */
25761 +#define          EMAC_FLOWMODE  0x002   /*      - flow mode */
25762 +#define          EMAC_NOBKOFF   0x004   /*      - no backoff in  */
25763 +#define          EMAC_SMALLSLT  0x008   /*      - small slot time */
25764 +
25765 +  uint32        txThreshold;            /* (34) transmit threshold */
25766 +  uint32        mibControl;             /* (38) mib control */
25767 +#define          EMAC_NO_CLEAR  0x001   /* don't clear on read */
25768 +
25769 +  uint32        unused3[7];
25770 +
25771 +  uint32        pm0DataLo;              /* (58) perfect match 0 data lo */
25772 +  uint32        pm0DataHi;              /* (5C) perfect match 0 data hi (15:0) */
25773 +  uint32        pm1DataLo;              /* (60) perfect match 1 data lo */
25774 +  uint32        pm1DataHi;              /* (64) perfect match 1 data hi (15:0) */
25775 +  uint32        pm2DataLo;              /* (68) perfect match 2 data lo */
25776 +  uint32        pm2DataHi;              /* (6C) perfect match 2 data hi (15:0) */
25777 +  uint32        pm3DataLo;              /* (70) perfect match 3 data lo */
25778 +  uint32        pm3DataHi;              /* (74) perfect match 3 data hi (15:0) */
25779 +#define          EMAC_CAM_V   0x10000  /*      - cam index */
25780 +#define          EMAC_CAM_VALID 0x00010000
25781 +
25782 +  uint32        unused4[98];            /* (78-1fc) */
25783 +
25784 +  EmacTxMib     tx_mib;                 /* (200) emac tx mib */
25785 +  uint32        unused5[8];             /* (260-27c) */
25786 +
25787 +  EmacRxMib     rx_mib;                 /* (280) rx mib */
25788 +
25789 +} EmacRegisters;
25790 +
25791 +/* register offsets for subrouting access */
25792 +#define EMAC_RX_CONTROL         0x00
25793 +#define EMAC_RX_MAX_LENGTH      0x04
25794 +#define EMAC_TX_MAC_LENGTH      0x08
25795 +#define EMAC_MDIO_FREQ          0x10
25796 +#define EMAC_MDIO_DATA          0x14
25797 +#define EMAC_INT_MASK           0x18
25798 +#define EMAC_INT_STATUS         0x1C
25799 +#define EMAC_CAM_DATA_LO        0x20
25800 +#define EMAC_CAM_DATA_HI        0x24
25801 +#define EMAC_CAM_CONTROL        0x28
25802 +#define EMAC_CONTROL            0x2C
25803 +#define EMAC_TX_CONTROL         0x30
25804 +#define EMAC_TX_THRESHOLD       0x34
25805 +#define EMAC_MIB_CONTROL        0x38
25806 +
25807 +
25808 +#define EMAC1 ((volatile EmacRegisters * const) EMAC1_BASE)
25809 +
25810 +/*
25811 +** USB Registers
25812 +*/
25813 +typedef struct UsbRegisters {
25814 +    byte inttf_setting;
25815 +    byte current_config;
25816 +    uint16 status_frameNum;
25817 +#define USB_LINK        0x2000 
25818 +#define USB_BUS_RESET   0x1000 
25819 +#define USB_SUSPENDED   0x0800 
25820 +    byte unused1;
25821 +    byte endpt_prnt;
25822 +    byte endpt_dirn;
25823 +    byte endpt_status;
25824 +#define USB_ENDPOINT_0  0x01
25825 +#define USB_ENDPOINT_1  0x02
25826 +#define USB_ENDPOINT_2  0x04
25827 +#define USB_ENDPOINT_3  0x08
25828 +#define USB_ENDPOINT_4  0x10
25829 +#define USB_ENDPOINT_5  0x20
25830 +#define USB_ENDPOINT_6  0x40
25831 +#define USB_ENDPOINT_7  0x80
25832 +    uint32 unused2;
25833 +    byte conf_mem_ctl;
25834 +#define USB_CONF_MEM_RD     0x80
25835 +#define USB_CONF_MEM_RDY    0x40
25836 +    byte unused2a;
25837 +    byte conf_mem_read_address;
25838 +    byte conf_mem_write_address;
25839 +
25840 +    byte unused3;
25841 +    byte dev_req_bytesel;
25842 +    uint16 ext_dev_data;
25843 +
25844 +    byte unused4;
25845 +    byte clr_fifo;
25846 +    byte endpt_stall_reset;  // use same endpoint #'s from above
25847 +    byte usb_cntl;
25848 +#define USB_FORCE_ERR       0x20
25849 +#define USB_SOFT_RESET      0x10
25850 +#define USB_RESUME          0x08
25851 +#define USB_COMMAND_ERR     0x04
25852 +#define USB_COMMAND_OVER    0x02
25853 +    byte irq_addr;
25854 +    byte iso_out_in_addr;
25855 +    byte blk_out_in_addr;
25856 +    byte cntl_addr;
25857 +    uint32 unusedx[2];
25858 +    uint32 tx_ram_write_port;
25859 +    uint32 fifo_status;  // (see bcm6338 data sheet for definition)
25860 +
25861 +    uint32 irq_status;
25862 +    uint32 irq_mask;
25863 +#define USB_NEW_CONFIG              0x00000001   
25864 +#define USB_SETUP_COMMAND_RECV      0x00000002 // non-standard setup cmd rcvd
25865 +#define USB_OUT_FIFO_OV             0x00000004   
25866 +#define USB_RESET_RECV              0x00000008   
25867 +#define USB_SUSPEND_RECV            0x00000010   
25868 +#define USB_FIFO_REWIND             0x00000020   
25869 +#define USB_RX_BULK_FIFO_DATA_AVAIL 0x00000040   
25870 +#define USB_RX_ISO_FIFO_DATA_AVAIL  0x00000080   
25871 +#define USB_LINK_CHANGE             0x00010000   
25872 +    uint32 endpt_cntl;
25873 +#define USB_R_WK_EN                 0x0100   
25874 +#define USB_TX_EOP                  0x0200   
25875 +#define USB_TX_CNTL_DMA_EN          0x0400
25876 +#define USB_TX_BULK_DMA_EN          0x0800
25877 +#define USB_TX_ISO_DMA_EN           0x1000
25878 +#define USB_RX_CNTL_DMA_EN          0x2000
25879 +#define USB_RX_BULK_DMA_EN          0x4800
25880 +#define USB_RX_ISO_DMA_EN           0x8000
25881 +    uint32 rx_status_read_port;
25882 +    uint32 confmem_read_port;
25883 +    uint32 confmem_write_port;
25884 +    uint32 fifo_ovf_count;
25885 +    uint32 fifo_rewind_cnt;
25886 +    uint32 terminal_count;
25887 +} UsbRegisters;
25888 +
25889 +#define USB ((volatile UsbRegisters * const) USB_CTL_BASE)
25890 +
25891 +/*
25892 +** ADSL core Registers
25893 +*/
25894 +
25895 +#define        _PADLINE(line)  pad ## line
25896 +#define        _XSTR(line)     _PADLINE(line)
25897 +#define        PAD             _XSTR(__LINE__)
25898 +
25899 +typedef struct AdslRegisters {
25900 +    uint32 core_control;
25901 +#define ADSL_RESET             0x01
25902 +   
25903 +    uint32 core_status;
25904 +#define ADSL_HOST_MSG  0x01
25905 +
25906 +    uint32 PAD;
25907 +    uint32 bist_status;
25908 +    uint32 PAD[4];
25909 +    uint32 int_status_i; /* 0x20 */
25910 +    uint32 int_mask_i;
25911 +    uint32 int_status_f;
25912 +    uint32 int_mask_f;
25913 +#define ADSL_INT_HOST_MSG              0x00000020
25914 +#define ADSL_INT_DESC_ERR              0x00000400
25915 +#define ADSL_INT_DATA_ERR              0x00000800
25916 +#define ADSL_INT_DESC_PROTO_ERR        0x00001000
25917 +#define ADSL_INT_RCV_DESC_UF   0x00002000
25918 +#define ADSL_INT_RCV_FIFO_OF   0x00004000
25919 +#define ADSL_INT_XMT_FIFO_UF   0x00008000
25920 +#define ADSL_INT_RCV                   0x00010000
25921 +#define ADSL_INT_XMT                   0x01000000
25922 +
25923 +    uint32 PAD[116];
25924 +
25925 +       uint32  xmtcontrol_intr; /* 0x200 */
25926 +#define ADSL_DMA_XMT_EN                        0x00000001
25927 +#define ADSL_DMA_XMT_LE                        0x00000004
25928 +       uint32  xmtaddr_intr;
25929 +#define ADSL_DMA_ADDR_MASK             0xFFFFF000
25930 +       uint32  xmtptr_intr;
25931 +#define ADSL_DMA_LAST_DESC_MASK        0x00000FFF
25932 +       uint32  xmtstatus_intr;
25933 +#define ADSL_DMA_CURR_DESC_MASK        0x00000FFF
25934 +#define ADSL_DMA_XMT_STATE_MASK        0x0000F000
25935 +#define ADSL_DMA_XMT_STATE_DIS 0x00000000
25936 +#define ADSL_DMA_XMT_STATE_ACT 0x00001000
25937 +#define ADSL_DMA_XMT_STATE_IDLE        0x00002000
25938 +#define ADSL_DMA_XMT_STATE_STOP        0x00003000
25939 +
25940 +#define ADSL_DMA_XMT_ERR_MASK  0x000F0000
25941 +#define ADSL_DMA_XMT_ERR_NONE  0x00000000
25942 +#define ADSL_DMA_XMT_ERR_DPE   0x00010000
25943 +#define ADSL_DMA_XMT_ERR_FIFO  0x00020000
25944 +#define ADSL_DMA_XMT_ERR_DTE   0x00030000
25945 +#define ADSL_DMA_XMT_ERR_DRE   0x00040000
25946 +
25947 +       uint32  rcvcontrol_intr;
25948 +#define ADSL_DMA_RCV_EN                        0x00000001
25949 +#define ADSL_DMA_RCV_FO                        0x000000FE
25950 +       uint32  rcvaddr_intr;
25951 +       uint32  rcvptr_intr;
25952 +       uint32  rcvstatus_intr;
25953 +#define ADSL_DMA_RCV_STATE_MASK        0x0000F000
25954 +#define ADSL_DMA_RCV_STATE_DIS 0x00000000
25955 +#define ADSL_DMA_RCV_STATE_ACT 0x00001000
25956 +#define ADSL_DMA_RCV_STATE_IDLE        0x00002000
25957 +#define ADSL_DMA_RCV_STATE_STOP        0x00003000
25958 +
25959 +#define ADSL_DMA_RCV_ERR_MASK  0x000F0000
25960 +#define ADSL_DMA_RCV_ERR_NONE  0x00000000
25961 +#define ADSL_DMA_RCV_ERR_DPE   0x00010000
25962 +#define ADSL_DMA_RCV_ERR_FIFO  0x00020000
25963 +#define ADSL_DMA_RCV_ERR_DTE   0x00030000
25964 +#define ADSL_DMA_RCV_ERR_DRE   0x00040000
25965 +
25966 +       uint32  xmtcontrol_fast;
25967 +       uint32  xmtaddr_fast;
25968 +       uint32  xmtptr_fast;
25969 +       uint32  xmtstatus_fast;
25970 +       uint32  rcvcontrol_fast;
25971 +       uint32  rcvaddr_fast;
25972 +       uint32  rcvptr_fast;
25973 +       uint32  rcvstatus_fast;
25974 +       uint32  PAD[48];
25975 +
25976 +       uint32  host_message; /* 0x300 */
25977 +       uint32  PAD[805];
25978 +    uint32 core_reset;
25979 +    uint32 core_error;
25980 +    uint32 core_revision;
25981 +
25982 +#define        ADSL_CORE_REV                   0x0000000F
25983 +#define        ADSL_CORE_TYPE                  0x0000FFF0
25984 +} AdslRegisters;
25985 +
25986 +#define ADSL ((volatile AdslRegisters * const) ADSL_BASE)
25987 +
25988 +#if __cplusplus
25989 +}
25990 +#endif
25991 +
25992 +#endif
25993 +
25994 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6345_common.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6345_common.h
25995 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6345_common.h    1970-01-01 01:00:00.000000000 +0100
25996 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6345_common.h   2006-06-26 09:07:10.000000000 +0200
25997 @@ -0,0 +1,275 @@
25998 +/*
25999 +<:copyright-broadcom 
26000
26001 + Copyright (c) 2002 Broadcom Corporation 
26002 + All Rights Reserved 
26003 + No portions of this material may be reproduced in any form without the 
26004 + written permission of: 
26005 +          Broadcom Corporation 
26006 +          16215 Alton Parkway 
26007 +          Irvine, California 92619 
26008 + All information contained in this document is Broadcom Corporation 
26009 + company private, proprietary, and trade secret. 
26010
26011 +:>
26012 +*/
26013 +/***********************************************************************/
26014 +/*                                                                     */
26015 +/*   MODULE: 6345_common.h                                             */
26016 +/*   DATE:    96/12/19                                                 */
26017 +/*   PURPOSE: Define addresses of major hardware components of         */
26018 +/*            BCM6345                                                  */
26019 +/*                                                                     */
26020 +/***********************************************************************/
26021 +#ifndef __BCM6345_MAP_COMMON_H
26022 +#define __BCM6345_MAP_COMMON_H
26023 +
26024 +#if __cplusplus
26025 +extern "C" {
26026 +#endif
26027 +
26028 +/* matches isb_decoder.v */
26029 +#define INTC_BASE     0xfffe0000    /* interrupts controller registers */
26030 +#define BB_BASE       0xfffe0100    /* bus bridge registers */
26031 +#define TIMR_BASE     0xfffe0200    /* timer registers */
26032 +#define UART_BASE     0xfffe0300    /* uart registers */
26033 +#define GPIO_BASE     0xfffe0400    /* gpio registers */
26034 +#define EMAC_BASE     0xfffe1800    /* EMAC control registers */
26035 +#define EBIC_BASE     0xfffe2000    /* EBI control registers */
26036 +#define PCMCIA_BASE   0xfffe2028    /* PCMCIA control registers */
26037 +#define USB_BASE      0xfffe2100    /* USB controll registers */
26038 +#define SDRAM_BASE    0xfffe2300    /* SDRAM control registers */
26039 +#define DMA_BASE      0xfffe2800    /* DMA control registers */
26040 +
26041 +/* DMA channel assignments */
26042 +#define EMAC_RX_CHAN            1
26043 +#define EMAC_TX_CHAN            2
26044 +#define EBI_RX_CHAN             5
26045 +#define EBI_TX_CHAN             6
26046 +#define RESERVED_RX_CHAN        9
26047 +#define RESERVED_TX_CHAN        10
26048 +#define USB_BULK_RX_CHAN        13
26049 +#define USB_BULK_TX_CHAN        14
26050 +#define USB_ISO_RX_CHAN         15
26051 +#define USB_ISO_TX_CHAN         16
26052 +#define USB_CNTL_RX_CHAN        17
26053 +#define USB_CNTL_TX_CHAN        18
26054 +
26055 +/*
26056 +#-----------------------------------------------------------------------*
26057 +#                                                                       *
26058 +#************************************************************************
26059 +*/
26060 +#define SDR_INIT_CTL        0x00
26061 +    /* Control Bits */
26062 +#define SDR_9BIT_COL        (1<<11)
26063 +#define SDR_32BIT           (1<<10)
26064 +#define SDR_PWR_DN          (1<<9)
26065 +#define SDR_SELF_REF        (1<<8)
26066 +#define SDR_SOFT_RST        (1<<7)
26067 +#define SDR_64x32           (3<<4)
26068 +#define SDR_128MEG          (2<<4)
26069 +#define SDR_64MEG           (1<<4)
26070 +#define SDR_16MEG           (0<<4)
26071 +#define SDR_ENABLE          (1<<3)
26072 +#define SDR_MRS_CMD         (1<<2)
26073 +#define SDR_PRE_CMD         (1<<1)
26074 +#define SDR_CBR_CMD         (1<<0)
26075 +
26076 +#define SDR_CFG_REG         0x04
26077 +    /* Control Bits */
26078 +#define SDR_FULL_PG         0x00
26079 +#define SDR_BURST8          0x01
26080 +#define SDR_BURST4          0x02
26081 +#define SDR_BURST2          0x03
26082 +#define SDR_FAST_MEM        (1<<2)
26083 +#define SDR_SLOW_MEM        0x00
26084 +
26085 +#define SDR_REF_CTL         0x08
26086 +    /* Control Bits */
26087 +#define SDR_REF_EN          (1<<15)
26088 +
26089 +#define SDR_MEM_BASE        0x0c
26090 +    /*  Control Bits */
26091 +#define DRAM2MBSPC          0x00000000
26092 +#define DRAM8MBSPC          0x00000001
26093 +#define DRAM16MBSPC         0x00000002
26094 +#define DRAM32MBSPC         0x00000003
26095 +#define DRAM64MBSPC         0x00000004
26096 +
26097 +#define DRAM2MEG            0x00000000  /*  See SDRAM config */
26098 +#define DRAM8MEG            0x00000001  /*  See SDRAM config */
26099 +#define DRAM16MEG           0x00000002  /*  See SDRAM config */
26100 +#define DRAM32MEG           0x00000003  /*  See SDRAM config */
26101 +#define DRAM64MEG           0x00000004  /*  See SDRAM config */
26102 +
26103 +/*
26104 +#-----------------------------------------------------------------------*
26105 +#                                                                       *
26106 +#************************************************************************
26107 +*/
26108 +#define CS0BASE         0x00
26109 +#define CS0CNTL         0x04
26110 +#define CS1BASE         0x08
26111 +#define CS1CNTL         0x0c
26112 +#define CS2BASE         0x10
26113 +#define CS2CNTL         0x14
26114 +#define CS3BASE         0x18
26115 +#define CS3CNTL         0x1c
26116 +#define CS4BASE         0x20
26117 +#define CS4CNTL         0x24
26118 +#define CS5BASE         0x28
26119 +#define CS5CNTL         0x2c
26120 +#define CS6BASE         0x30
26121 +#define CS6CNTL         0x34
26122 +#define CS7BASE         0x38
26123 +#define CS7CNTL         0x3c
26124 +#define EBICONFIG       0x40
26125 +
26126 +/*
26127 +# CSxBASE settings
26128 +#   Size in low 4 bits
26129 +#   Base Address for match in upper 24 bits
26130 +*/
26131 +#define EBI_SIZE_8K         0
26132 +#define EBI_SIZE_16K        1
26133 +#define EBI_SIZE_32K        2
26134 +#define EBI_SIZE_64K        3
26135 +#define EBI_SIZE_128K       4
26136 +#define EBI_SIZE_256K       5
26137 +#define EBI_SIZE_512K       6
26138 +#define EBI_SIZE_1M         7
26139 +#define EBI_SIZE_2M         8
26140 +#define EBI_SIZE_4M         9
26141 +#define EBI_SIZE_8M         10
26142 +#define EBI_SIZE_16M        11
26143 +#define EBI_SIZE_32M        12
26144 +#define EBI_SIZE_64M        13
26145 +#define EBI_SIZE_128M       14
26146 +#define EBI_SIZE_256M       15
26147 +
26148 +/* CSxCNTL settings */
26149 +#define EBI_ENABLE          0x00000001  /* .. enable this range */
26150 +#define EBI_WAIT_STATES     0x0000000e  /* .. mask for wait states */
26151 +#define ZEROWT              0x00000000  /* ..  0 WS */
26152 +#define ONEWT               0x00000002  /* ..  1 WS */
26153 +#define TWOWT               0x00000004  /* ..  2 WS */
26154 +#define THREEWT             0x00000006  /* ..  3 WS */
26155 +#define FOURWT              0x00000008  /* ..  4 WS */
26156 +#define FIVEWT              0x0000000a  /* ..  5 WS */
26157 +#define SIXWT               0x0000000c  /* ..  6 WS */
26158 +#define SEVENWT             0x0000000e  /* ..  7 WS */
26159 +#define EBI_WORD_WIDE       0x00000010  /* .. 16-bit peripheral, else 8 */
26160 +#define EBI_POLARITY        0x00000040  /* .. set to invert chip select polarity */
26161 +#define EBI_TS_TA_MODE      0x00000080  /* .. use TS/TA mode */
26162 +#define EBI_TS_SEL          0x00000100  /* .. drive tsize, not bs_b */
26163 +#define EBI_FIFO            0x00000200  /* .. enable fifo */
26164 +#define EBI_RE              0x00000400  /* .. Reverse Endian */
26165 +
26166 +/* EBICONFIG settings */
26167 +#define EBI_MASTER_ENABLE   0x80000000  /* allow external masters */
26168 +#define EBI_EXT_MAST_PRIO   0x40000000  /* maximize ext master priority */
26169 +#define EBI_CTRL_ENABLE     0x20000000
26170 +#define EBI_TA_ENABLE       0x10000000
26171 +
26172 +#define BRGEN            0x80   /* Control register bit defs */
26173 +#define TXEN             0x40
26174 +#define RXEN             0x20
26175 +#define LOOPBK           0x10
26176 +#define TXPARITYEN       0x08
26177 +#define TXPARITYEVEN     0x04
26178 +#define RXPARITYEN       0x02
26179 +#define RXPARITYEVEN     0x01
26180 +#define XMITBREAK        0x40
26181 +#define BITS5SYM         0x00
26182 +#define BITS6SYM         0x10
26183 +#define BITS7SYM         0x20
26184 +#define BITS8SYM         0x30
26185 +#define BAUD115200       0x0a
26186 +#define ONESTOP          0x07
26187 +#define TWOSTOP          0x0f
26188 +#define TX4              0x40
26189 +#define RX4              0x04
26190 +#define RSTTXFIFOS       0x80
26191 +#define RSTRXFIFOS       0x40
26192 +#define DELTAIP          0x0001
26193 +#define TXUNDERR         0x0002
26194 +#define TXOVFERR         0x0004
26195 +#define TXFIFOTHOLD      0x0008
26196 +#define TXREADLATCH      0x0010
26197 +#define TXFIFOEMT        0x0020
26198 +#define RXUNDERR         0x0040
26199 +#define RXOVFERR         0x0080
26200 +#define RXTIMEOUT        0x0100
26201 +#define RXFIFOFULL       0x0200
26202 +#define RXFIFOTHOLD      0x0400
26203 +#define RXFIFONE         0x0800
26204 +#define RXFRAMERR        0x1000
26205 +#define RXPARERR         0x2000
26206 +#define RXBRK            0x4000
26207 +          
26208 +#define RXIRQS           0x7fc0
26209 +#define TXIRQS           0x003e
26210 +
26211 +#define CPU_CLK_EN       0x0001
26212 +#define UART_CLK_EN      0x0008
26213 +
26214 +#define BLKEN            06
26215 +
26216 +#define FMSEL_MASK      0xf0000000      // 31:28
26217 +#define FMSEL_SHFT      28
26218 +#define FM_HI_GEAR      0x08000000      // 27
26219 +#define FMCLKSEL        0x04000000      // 26
26220 +#define FMDIV_MASK      0x03000000      // 25:24
26221 +#define FMDIV_SHFT      24
26222 +#define FBDIV_MASK      0x00f00000      // 23:20
26223 +#define FBDIV_SHFT      20
26224 +#define FB_SEL          0x00010000      // 16
26225 +#define FU2SEL_MASK     0x0000f000      // 15:12
26226 +#define FU2SEL_SHFT     12
26227 +#define FU1SEL_MASK     0x00000f00      // 11:8
26228 +#define FU1SEL_SHFT     8
26229 +#define FU1PRS_MASK     0x000000e0      // 7:5
26230 +#define FU1PRS_SHFT     5
26231 +#define FU1POS_MASK     0x00000018      // 4:3
26232 +#define FU1POS_SHFT     3
26233 +#define SOFT_RESET     0x00000001
26234 +
26235 +#define FMSEL            0x08
26236 +
26237 +#define UART0CONTROL     0x01
26238 +#define UART0CONFIG      0x02
26239 +#define UART0RXTIMEOUT   0x03
26240 +#define UART0BAUD        0x04
26241 +#define UART0FIFOCFG     0x0a
26242 +#define UART0INTMASK     0x10
26243 +#define UART0INTSTAT     0x12
26244 +#define UART0DATA        0x17
26245 +
26246 +#define GPIOTBUSSEL      0x03
26247 +#define GPIODIR          0x06
26248 +#define GPIOLED          0x09
26249 +#define GPIOIO           0x0a
26250 +#define GPIOUARTCTL      0x0c
26251 +
26252 +/*Defines below show which bit enables which UART signals */
26253 +#define RI1_EN          0x0001
26254 +#define CTS1_EN         0x0002
26255 +#define DCD1_EN         0x0004
26256 +#define DSR1_EN         0x0008
26257 +#define DTR1_EN         0x0010
26258 +#define RTS1_EN         0x0020
26259 +#define DO1_EN          0x0040
26260 +#define DI1_EN          0x0080
26261 +#define RI0_EN          0x0100
26262 +#define CTS0_EN         0x0200
26263 +#define DCD0_EN         0x0400
26264 +#define DSR0_EN         0x0800
26265 +#define DTR0_EN         0x1000
26266 +#define RTS0_EN         0x2000
26267 +
26268 +#if __cplusplus
26269 +}
26270 +#endif
26271 +
26272 +#endif
26273 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6345_map.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6345_map.h
26274 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6345_map.h       1970-01-01 01:00:00.000000000 +0100
26275 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6345_map.h      2006-06-26 09:07:10.000000000 +0200
26276 @@ -0,0 +1,939 @@
26277 +/*
26278 +<:copyright-broadcom 
26279
26280 + Copyright (c) 2002 Broadcom Corporation 
26281 + All Rights Reserved 
26282 + No portions of this material may be reproduced in any form without the 
26283 + written permission of: 
26284 +          Broadcom Corporation 
26285 +          16215 Alton Parkway 
26286 +          Irvine, California 92619 
26287 + All information contained in this document is Broadcom Corporation 
26288 + company private, proprietary, and trade secret. 
26289
26290 +:>
26291 +*/
26292 +/***********************************************************************/
26293 +/*                                                                     */
26294 +/*   MODULE:  6345_map.h                                               */
26295 +/*   DATE:    96/12/19                                                 */
26296 +/*   PURPOSE: Define addresses of major hardware components of         */
26297 +/*            BCM6345                                                  */
26298 +/*                                                                     */
26299 +/***********************************************************************/
26300 +#ifndef __BCM6345_MAP_H
26301 +#define __BCM6345_MAP_H
26302 +
26303 +#if __cplusplus
26304 +extern "C" {
26305 +#endif
26306 +
26307 +#include "bcmtypes.h"
26308 +#include "6345_common.h"
26309 +#include "6345_intr.h"
26310 +
26311 +/* macro to convert logical data addresses to physical */
26312 +/* DMA hardware must see physical address */
26313 +#define LtoP( x )       ( (uint32)x & 0x1fffffff )
26314 +#define PtoL( x )       ( LtoP(x) | 0xa0000000 )
26315 +
26316 +/*
26317 +** Interrupt Controller
26318 +*/
26319 +typedef struct IntControl {
26320 +  uint32        RevID;          /* (00) */
26321 +  uint16        testControl;    /* (04) */
26322 +  uint16        blkEnables;     /* (06) */
26323 +
26324 +#define USB_CLK_EN      0x0100
26325 +#define EMAC_CLK_EN     0x0080
26326 +#define ADSL_CLK_EN     0x0010
26327 +#define UART_CLK_EN     0x0008
26328 +#define EBI_CLK_EN      0x0004
26329 +#define BUS_CLK_EN      0x0002
26330 +#define CPU_CLK_EN      0x0001
26331 +
26332 +  uint32        pll_control;    /* (08) */
26333 +#define FMSEL_MASK      0xf0000000      // 31:28
26334 +#define FMSEL_SHFT      28
26335 +#define FM_HI_GEAR      0x08000000      // 27
26336 +#define FMCLKSEL        0x04000000      // 26
26337 +#define FMDIV_MASK      0x03000000      // 25:24
26338 +#define FMDIV_SHFT      24
26339 +#define FBDIV_MASK      0x00f00000      // 23:20
26340 +#define FBDIV_SHFT      20
26341 +#define FB_SEL          0x00010000      // 16
26342 +#define FU2SEL_MASK     0x0000f000      // 15:12
26343 +#define FU2SEL_SHFT     12
26344 +#define FU1SEL_MASK     0x00000f00      // 11:8
26345 +#define FU1SEL_SHFT     8
26346 +#define FU1PRS_MASK     0x000000e0      // 7:5
26347 +#define FU1PRS_SHFT     5
26348 +#define FU1POS_MASK     0x00000018      // 4:3
26349 +#define FU1POS_SHFT     3
26350 +#define SOFT_RESET     0x00000001
26351 +
26352 +  uint32        IrqMask;        /* (0c) */
26353 +  uint32        IrqStatus;              /* (10) */
26354 +
26355 +  uint32        ExtIrqCfg;
26356 +#define EI_SENSE_SHFT   0
26357 +#define EI_STATUS_SHFT  4
26358 +#define EI_CLEAR_SHFT   8
26359 +#define EI_MASK_SHFT    12
26360 +#define EI_INSENS_SHFT  16
26361 +#define EI_LEVEL_SHFT   20
26362 +} IntControl;
26363 +
26364 +#define PERF ((volatile IntControl * const) INTC_BASE)
26365 +
26366 +/*
26367 +** Bus Bridge Registers
26368 +*/
26369 +typedef struct BusBridge {
26370 +  uint16    status;
26371 +#define BB_BUSY     0x8000      /* posted operation in progress */
26372 +#define BB_RD_PND   0x4000      /* read pending */
26373 +#define BB_RD_CMPLT 0x2000      /* read complete */
26374 +#define BB_ERROR    0x1000      /* posted write error */
26375 +#define BB_TEA      0x0800      /* transfer aborted */
26376 +  uint16    abortTimeoutCnt;    /* abort timeout value */
26377 +
26378 +  byte      writePostEnable;
26379 +#define BB_POST_TIMR_EN 0x08        /* post writes to timer regs */
26380 +#define BB_POST_GPIO_EN 0x04        /* post writes to gpio regs */
26381 +#define BB_POST_INTC_EN 0x02        /* post writes to interrupt controller regs */
26382 +#define BB_POST_UART_EN 0x01        /* post writes to uart regs */
26383 +  byte      unused1[5];
26384 +  uint16    postAddr;       /* posted read address (lower half) */
26385 +  byte      unused2[3];
26386 +  byte      postData;       /* posted read data */
26387 +} BusBridge;
26388 +
26389 +/* register offsets (needed for EBI master access) */
26390 +#define BB_STATUS       0
26391 +#define BB_ABORT_TO_CNT     2
26392 +#define BB_WR_POST_EN       4
26393 +#define BB_RD_POST_ADDR     10
26394 +#define BB_RD_POST_DATA     12
26395 +
26396 +#define BRIDGE *bridge ((volatile BusBridge * const) BB_BASE)
26397 +
26398 +/*
26399 +** Timer
26400 +*/
26401 +typedef struct Timer {
26402 +  uint16        unused0;
26403 +  byte          TimerMask;
26404 +#define TIMER0EN        0x01
26405 +#define TIMER1EN        0x02
26406 +#define TIMER2EN        0x04
26407 +  byte          TimerInts;
26408 +#define TIMER0          0x01
26409 +#define TIMER1          0x02
26410 +#define TIMER2          0x04
26411 +#define WATCHDOG        0x08
26412 +  uint32        TimerCtl0;
26413 +  uint32        TimerCtl1;
26414 +  uint32        TimerCtl2;
26415 +#define TIMERENABLE     0x80000000
26416 +#define RSTCNTCLR       0x40000000      
26417 +  uint32        TimerCnt0;
26418 +  uint32        TimerCnt1;
26419 +  uint32        TimerCnt2;
26420 +  uint32        WatchDogDefCount;
26421 +
26422 +  /* Write 0xff00 0x00ff to Start timer
26423 +   * Write 0xee00 0x00ee to Stop and re-load default count
26424 +   * Read from this register returns current watch dog count
26425 +   */
26426 +  uint32        WatchDogCtl;
26427 +
26428 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
26429 +  uint32        WDResetCount;
26430 +} Timer;
26431 +
26432 +#define TIMER ((volatile Timer * const) TIMR_BASE)
26433 +
26434 +/*
26435 +** UART
26436 +*/
26437 +typedef struct UartChannel {
26438 +  byte          unused0;
26439 +  byte          control;
26440 +#define BRGEN           0x80    /* Control register bit defs */
26441 +#define TXEN            0x40
26442 +#define RXEN            0x20
26443 +#define LOOPBK          0x10
26444 +#define TXPARITYEN      0x08
26445 +#define TXPARITYEVEN    0x04
26446 +#define RXPARITYEN      0x02
26447 +#define RXPARITYEVEN    0x01
26448 +
26449 +  byte          config;
26450 +#define XMITBREAK       0x40
26451 +#define BITS5SYM        0x00
26452 +#define BITS6SYM        0x10
26453 +#define BITS7SYM        0x20
26454 +#define BITS8SYM        0x30
26455 +#define ONESTOP         0x07
26456 +#define TWOSTOP         0x0f
26457 +  /* 4-LSBS represent STOP bits/char
26458 +   * in 1/8 bit-time intervals.  Zero
26459 +   * represents 1/8 stop bit interval.
26460 +   * Fifteen represents 2 stop bits.
26461 +   */
26462 +  byte          fifoctl;
26463 +#define RSTTXFIFOS      0x80
26464 +#define RSTRXFIFOS      0x40
26465 +  /* 5-bit TimeoutCnt is in low bits of this register.
26466 +   *  This count represents the number of characters 
26467 +   *  idle times before setting receive Irq when below threshold
26468 +   */
26469 +  uint32        baudword;
26470 +  /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
26471 +   */
26472 +
26473 +  byte          txf_levl;       /* Read-only fifo depth */
26474 +  byte          rxf_levl;       /* Read-only fifo depth */
26475 +  byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
26476 +                                 *      RxThreshold.  Irq can be asserted
26477 +                                 *      when rx fifo> thresh, txfifo<thresh
26478 +                                 */
26479 +  byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
26480 +                                 *  if these bits are also enabled to GPIO_o
26481 +                                 */
26482 +#define        DTREN   0x01
26483 +#define        RTSEN   0x02
26484 +
26485 +  byte          unused1;
26486 +  byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
26487 +                                         * detect irq on rising AND falling 
26488 +                                         * edges for corresponding GPIO_i
26489 +                                         * if enabled (edge insensitive)
26490 +                                         */
26491 +  byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
26492 +                                         *      0 for negedge sense if
26493 +                                         *      not configured for edge
26494 +                                         *      insensitive (see above)
26495 +                                         * Lower 4 bits: Mask to enable change
26496 +                                         *  detection IRQ for corresponding
26497 +                                         *  GPIO_i
26498 +                                         */
26499 +  byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
26500 +                                         *  have changed (may set IRQ).
26501 +                                         *  read automatically clears bit
26502 +                                         * Lower 4 bits are actual status
26503 +                                         */
26504 +
26505 +  uint16        intMask;                               /* Same Bit defs for Mask and status */
26506 +  uint16        intStatus;
26507 +#define DELTAIP         0x0001
26508 +#define TXUNDERR        0x0002
26509 +#define TXOVFERR        0x0004
26510 +#define TXFIFOTHOLD     0x0008
26511 +#define TXREADLATCH     0x0010
26512 +#define TXFIFOEMT       0x0020
26513 +#define RXUNDERR        0x0040
26514 +#define RXOVFERR        0x0080
26515 +#define RXTIMEOUT       0x0100
26516 +#define RXFIFOFULL      0x0200
26517 +#define RXFIFOTHOLD     0x0400
26518 +#define RXFIFONE        0x0800
26519 +#define RXFRAMERR       0x1000
26520 +#define RXPARERR        0x2000
26521 +#define RXBRK           0x4000
26522 +
26523 +  uint16        unused2;
26524 +  uint16        Data;                   /* Write to TX, Read from RX */
26525 +                                        /* bits 11:8 are BRK,PAR,FRM errors */
26526 +
26527 +  uint32               unused3;
26528 +  uint32               unused4;
26529 +} Uart;
26530 +
26531 +#define UART ((volatile Uart * const) UART_BASE)
26532 +
26533 +/*
26534 +** Gpio Controller
26535 +*/
26536 +typedef struct GpioControl {
26537 +  uint16        unused0;
26538 +  byte          unused1;
26539 +  byte          TBusSel;
26540 +
26541 +  /* High in bit location enables output */
26542 +  uint16        unused2;
26543 +  uint16        GPIODir;
26544 +  byte          unused3;
26545 +  byte          Leds;           //Only bits [3:0]
26546 +  uint16        GPIOio;
26547 +
26548 +  /* Defines below show which bit enables which UART signals */
26549 +  uint32        UartCtl;
26550 +#define RI1_EN          0x0001
26551 +#define CTS1_EN         0x0002
26552 +#define DCD1_EN         0x0004
26553 +#define DSR1_EN         0x0008
26554 +#define DTR1_EN         0x0010
26555 +#define RTS1_EN         0x0020
26556 +#define DO1_EN          0x0040
26557 +#define DI1_EN          0x0080
26558 +#define RI0_EN          0x0100
26559 +#define CTS0_EN         0x0200
26560 +#define DCD0_EN         0x0400
26561 +#define DSR0_EN         0x0800
26562 +#define DTR0_EN         0x1000
26563 +#define RTS0_EN         0x2000
26564 +
26565 +  /*********************************************************************
26566 +   * Multiple Use Muxed GPIO
26567 +   * -----------------------
26568 +   *
26569 +   * ------
26570 +   * GPIO_A
26571 +   * ------
26572 +   *
26573 +   * GPIO[0] -> RI1             I       Controlled by UartCtl[0] ELSE 0
26574 +   * GPIO[0] -> DMATC_i         I       Always
26575 +   * GPIO[0] -> DMATC_o         O       Controlled by dma_enable_n|dma_drive_n
26576 +   * GPIO[0] -> ebi_bsize[0]    I       Always
26577 +   *
26578 +   * GPIO[1] -> CTS1            I       Controlled by UartCtl[1] ELSE 0
26579 +   * GPIO[1] -> DMAACK1 (18)    O       Controlled by dma_enable_n
26580 +   * GPIO[1] -> ebi_bg_b        O       Controlled by ebi_master_n
26581 +   *
26582 +   * GPIO[2] -> DCD1            I       Controlled by UartCtl[2] ELSE 0
26583 +   * GPIO[2] -> ebi_bsize[1]    I       Always
26584 +   *
26585 +   * GPIO[3] -> DSR1            I       Controlled by UartCtl[3] ELSE 0
26586 +   * GPIO[3] -> INT2            I       Always
26587 +   * GPIO[3] -> ebi_bsize[2]    I       Always
26588 +   *
26589 +   * GPIO[4] -> DTR1            O       Controlled by UartCtl[4]&GpioDir[4]
26590 +   * GPIO[4] -> INT3            I       Always
26591 +   * GPIO[4] -> ebi_burst       I       Always
26592 +   *
26593 +   * GPIO[5] -> RTS1            O       Controlled by UartCtl[5]&GpioDir[5]
26594 +   * GPIO[5] -> DMAACK0 (17)    O       Controlled by dma_enable_n
26595 +   * GPIO[5] -> ebi_tsize       I       Always
26596 +   *
26597 +   * GPIO[6] -> sDout1          O       Controlled by UartCtl[6]&GpioDir[6]
26598 +   * GPIO[6] -> DMARQ1 (18)     I       Always
26599 +   * GPIO[6] -> ebi_bb_i        I       Always
26600 +   * GPIO[6] -> ebi_bb_o        O       Controlled by ebi_master_n|ebi_bb_oen
26601 +   *
26602 +   * GPIO[7] -> sDin1           I       Controlled by UartCtl[7] ELSE 0
26603 +   * GPIO[7] -> ebi_br_b        I       Always
26604 +   * GPIO[7] -> DMARQ0 (17)     I       Always
26605 +   *
26606 +   * ------
26607 +   * GPIO_B
26608 +   * ------
26609 +   *
26610 +   * GPIO[8] -> RI0             I       Controlled by UartCtl[8] ELSE 0
26611 +   * GPIO[8] -> ebi_cs_b[6]     O       Controlled by ebi_cs_en[6]
26612 +   *
26613 +   * GPIO[9] -> CTS0            I       Controlled by UartCtl[9] ELSE 0
26614 +   *
26615 +   * GPIO[a] -> DCD0            I       Controlled by UartCtl[a] ELSE 0
26616 +   * GPIO[a] -> ebi_cs_b[7]     O       Controlled by ebi_cs_en[7]
26617 +   *
26618 +   * GPIO[b] -> DSR0            I       Controlled by UartCtl[b] ELSE 0
26619 +   * GPIO[b] -> ebi_int_cs_b    I       Always
26620 +   *
26621 +   * GPIO[c] -> DTR0            O       Controlled by UartCtl[c]&GpioDir[c]
26622 +   *
26623 +   * GPIO[d] -> RTS0            O       Controlled by UartCtl[d]&&GpioDir[d]
26624 +   *
26625 +   * GPIO[e] -> INT0            I       Always
26626 +   *
26627 +   * GPIO[f] -> INT1            I       Always
26628 +   *
26629 +   * sDout0 -> (bist_en[15]) ? pll_clk48:sDout0_int
26630 +   *
26631 +   *********************************************************************/
26632 +
26633 +} GpioControl;
26634 +
26635 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
26636 +
26637 +#define GPIO_NUM_MAX_BITS_MASK          0x0f
26638 +#define GPIO_NUM_TO_MASK(X)             (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
26639 +
26640 +/*
26641 +** DMA Channel (1 .. 20)
26642 +*/
26643 +typedef struct DmaChannel {
26644 +  uint32        cfg;                    /* (00) assorted configuration */
26645 +#define          DMA_FLOWC_EN   0x00000010      /* flow control enable */
26646 +#define          DMA_WRAP_EN    0x00000008      /* use DMA_WRAP bit */
26647 +#define          DMA_CHAINING   0x00000004      /* chaining mode */
26648 +#define          DMA_STALL      0x00000002      
26649 +#define          DMA_ENABLE     0x00000001      /* set to enable channel */
26650 +  uint32        maxBurst;               /* (04) max burst length permitted */
26651 +                                        /*      non-chaining / chaining */
26652 +  uint32        startAddr;              /* (08) source addr  / ring start address */
26653 +  uint32        length;                 /* (0c) xfer len     / ring len */
26654 +#define          DMA_KICKOFF    0x80000000      /* start non-chaining xfer */
26655 +
26656 +  uint32        bufStat;                /* (10) buffer status for non-chaining */
26657 +  uint32        intStat;                /* (14) interrupts control and status */
26658 +  uint32        intMask;                /* (18) interrupts mask */
26659 +#define         DMA_BUFF_DONE   0x00000001      /* buffer done */
26660 +#define         DMA_DONE        0x00000002      /* packet xfer complete */
26661 +#define         DMA_NO_DESC     0x00000004      /* no valid descriptors */
26662 +
26663 +// DMA HW bits are clugy in this version of chip (mask/status shifted)
26664 +#define         DMA_BUFF_DONE_MASK  0x00000004      /* buffer done */
26665 +#define         DMA_DONE_MASK       0x00000001      /* packet xfer complete */
26666 +#define         DMA_NO_DESC_MASK    0x00000002      /* no valid descriptors */
26667 +
26668 +  uint32        fcThreshold;            /* (1c) flow control threshold */
26669 +  uint32        numAlloc;               /* */
26670 +  uint32        unused[7];              /* (20-3c) pad to next descriptor */
26671 +} DmaChannel;
26672 +/* register offsets, useful for ebi master access */
26673 +#define DMA_CFG                 0
26674 +#define DMA_MAX_BURST           4
26675 +#define DMA_START_ADDR          8
26676 +#define DMA_LENGTH              12
26677 +#define DMA_BUF_STAT            16
26678 +#define DMA_INT_STAT            20
26679 +#define DMA_FC_THRESHOLD        24
26680 +#define DMA_NUM_ALLOC           28
26681 +
26682 +
26683 +/* paste in your program ...
26684 +DmaChannel *dmaChannels  = (DmaChannel *)DMA_BASE;
26685 +DmaChannel *dma1 = dmaChannels[1];
26686 +*/
26687 +
26688 +
26689 +/*
26690 +** DMA Buffer 
26691 +*/
26692 +typedef struct DmaDesc {
26693 +  uint16        length;                 /* in bytes of data in buffer */
26694 +  uint16        status;                 /* buffer status */
26695 +#define          DMA_OWN        0x8000  /* cleared by DMA, set by SW */
26696 +#define          DMA_EOP        0x0800  /* last buffer in packet */
26697 +#define          DMA_SOP        0x0400  /* first buffer in packet */
26698 +#define          DMA_WRAP       0x0200  /* */
26699 +#define          DMA_APPEND_CRC 0x0100  /* .. for emac tx */
26700 +#define          DATA_FLAG      0x0100  /* .. for secmod rx */
26701 +#define          AUTH_FAIL_FLAG 0x0100  /* .. for secmod tx */
26702 +
26703 +/* EMAC Descriptor Status definitions */
26704 +#define          EMAC_UNDERRUN  0x4000   /* Tx underrun, dg-mod ???) */
26705 +#define          EMAC_MISS      0x0080  /* framed address recognition failed (promiscuous) */
26706 +#define          EMAC_BRDCAST   0x0040  /* DA is Broadcast */
26707 +#define          EMAC_MULT      0x0020  /* DA is multicast */
26708 +#define          EMAC_LG        0x0010  /* frame length > RX_LENGTH register value */
26709 +#define          EMAC_NO        0x0008  /* Non-Octet aligned */
26710 +#define          EMAC_RXER      0x0004  /* RX_ERR on MII while RX_DV assereted */
26711 +#define          EMAC_CRC_ERROR 0x0002  /* CRC error */
26712 +#define          EMAC_OV        0x0001  /* Overflow */
26713 +
26714 +/* HDLC Descriptor Status definitions */
26715 +#define          DMA_HDLC_TX_ABORT      0x0100
26716 +#define          DMA_HDLC_RX_OVERRUN    0x4000
26717 +#define          DMA_HDLC_RX_TOO_LONG   0x2000
26718 +#define          DMA_HDLC_RX_CRC_OK     0x1000
26719 +#define          DMA_HDLC_RX_ABORT      0x0100
26720 +
26721 +  uint32        address;                        /* address of data */
26722 +} DmaDesc;
26723 +
26724 +/*
26725 +** Sdram Controller
26726 +*/
26727 +typedef struct SdramControllerRegs {
26728 +  uint16        unused1;
26729 +  uint16        initControl;    /* 02 */
26730 +#define SD_POWER_DOWN           0x200   /* put sdram into power down */
26731 +#define SD_SELF_REFRESH         0x100   /* enable self refresh mode */
26732 +#define SD_SOFT_RESET           0x080   /* soft reset all sdram controller regs */
26733 +#define SD_EDO_SELECT           0x040   /* select EDO mode */
26734 +#define SD_EDO_WAIT_STATE       0x020   /* add an EDO wait state */
26735 +#define SD_8MEG                 0x010   /* map sdram to 8 megs */
26736 +#define SD_MASTER_ENABLE        0x008   /* enable accesses to external sdram */
26737 +#define SD_MRS                  0x004   /* generate a mode register select cycle */
26738 +#define SD_PRECHARGE            0x002   /* generate a precharge cycle */
26739 +#define SD_CBR                  0x001   /* generate a refresh cycle */
26740 +  uint8         unused2[3];
26741 +  uint8         config;         /* 07 */
26742 +#define SD_FAST_MEM             0x04    /* 1=CAS latency of 2, 0 = CAS latency of 3 */
26743 +#define SD_BURST_LEN            0x03    /* set burst length */
26744 +#define SD_BURST_FULL_PAGE      0x00    /* .. full page */
26745 +#define SD_BURST_8              0x01    /* .. 8 words */
26746 +#define SD_BURST_4              0x02    /* .. 4 words */
26747 +#define SD_BURST_2              0x03    /* .. 2 words */
26748 +  uint16        unused3;
26749 +  uint16        refreshControl; /* 0a */
26750 +#define SD_REFRESH_ENABLE       0x8000  /* refresh enable */
26751 +#define SD_REFRESH_PERIOD       0x00ff  /* refresh period (16 x n x clock_period) */
26752 +
26753 +  uint32        memoryBase;     /* 0c */
26754 +#define SD_MEMBASE_MASK         0xffffe000      /* base address mask */
26755 +#define SD_MEMSIZE_8MEG         0x00000001      /* memory is 8 meg */
26756 +#define SD_MEMSIZE_2MEG         0x00000001      /* memory is 2 meg */
26757 +
26758 +} SdramControllerRegs;
26759 +
26760 +/*
26761 +** External Bus Interface
26762 +*/
26763 +typedef struct EbiChipSelect {
26764 +  uint32        base;                   /* base address in upper 24 bits */
26765 +#define EBI_SIZE_8K         0
26766 +#define EBI_SIZE_16K        1
26767 +#define EBI_SIZE_32K        2
26768 +#define EBI_SIZE_64K        3
26769 +#define EBI_SIZE_128K       4
26770 +#define EBI_SIZE_256K       5
26771 +#define EBI_SIZE_512K       6
26772 +#define EBI_SIZE_1M         7
26773 +#define EBI_SIZE_2M         8
26774 +#define EBI_SIZE_4M         9
26775 +#define EBI_SIZE_8M         10
26776 +#define EBI_SIZE_16M        11
26777 +#define EBI_SIZE_32M        12
26778 +#define EBI_SIZE_64M        13
26779 +#define EBI_SIZE_128M       14
26780 +#define EBI_SIZE_256M       15
26781 +  uint32        config;
26782 +#define EBI_ENABLE          0x00000001      /* .. enable this range */
26783 +#define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
26784 +#define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
26785 +#define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
26786 +#define EBI_WREN            0x00000020      /* enable posted writes */
26787 +#define EBI_POLARITY        0x00000040      /* .. set to invert something, 
26788 +                                        **    don't know what yet */
26789 +#define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
26790 +#define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
26791 +#define EBI_FIFO            0x00000200      /* .. use fifo */
26792 +#define EBI_RE              0x00000400      /* .. Reverse Endian */
26793 +} EbiChipSelect;
26794 +
26795 +typedef struct EbiRegisters {
26796 +  EbiChipSelect cs[5];                  /* size chip select configuration */
26797 +  uint32        reserved[6];
26798 +  uint32        ebi_config;             /* configuration */
26799 +#define EBI_MASTER_ENABLE       0x80000000  /* allow external masters */
26800 +#define EBI_EXT_MAST_PRIO       0x40000000  /* maximize ext master priority */
26801 +#define EBI_CTRL_ENABLE         0x20000000
26802 +#define EBI_TA_ENABLE           0x10000000
26803 +  uint32        dma_control;
26804 +#define EBI_TX_INV_IRQ_EN       0x00080000
26805 +#define EBI_RX_INV_IRQ_EN       0x00040000
26806 +#define EBI_TX_PKT_DN_IRQ_EN    0x00020000
26807 +#define EBI_RX_PKT_DN_IRQ_EN    0x00010000
26808 +#define EBI_TX_INV_CLR          0x00001000
26809 +#define EBI_RX_INV_CLR          0x00000800
26810 +#define EBI_CHAINING            0x00000400
26811 +#define EBI_EXT_MODE            0x00000200
26812 +#define EBI_HALF_WORD           0x00000100
26813 +#define EBI_TX_PKT_DN_CLR       0x00000080
26814 +#define EBI_RX_PKT_DN_CLR       0x00000040
26815 +#define EBI_TX_BUF_DN_CLR       0x00000020
26816 +#define EBI_RX_BUF_DN_CLR       0x00000010
26817 +#define EBI_TX_BUF_DN_IRQ_EN    0x00000008
26818 +#define EBI_RX_BUF_DN_IRQ_EN    0x00000004
26819 +#define EBI_TX_EN               0x00000002
26820 +#define EBI_RX_EN               0x00000001
26821 +  uint32        dma_rx_start_addr;
26822 +  uint32        dma_rx_buf_size;
26823 +  uint32        dma_tx_start_addr;
26824 +  uint32        dma_tx_buf_size;
26825 +  uint32        dma_status;
26826 +#define EBI_TX_INV_DESC         0x00000020
26827 +#define EBI_RX_INV_DESC         0x00000010
26828 +#define EBI_TX_PKT_DN           0x00000008
26829 +#define EBI_RX_PKT_DN           0x00000004
26830 +#define EBI_TX_BUF_DN           0x00000002
26831 +#define EBI_RX_BUF_DN           0x00000001
26832 +} EbiRegisters;
26833 +
26834 +#define EBIC ((volatile EbiRegisters * const) EBIC_BASE)
26835 +
26836 +typedef struct PcmciaRegisters {
26837 +  /*Each of base has 24 bits of base address followed by size select field*/
26838 +  uint32 mem_base;
26839 +  uint32 mem_cntrl; 
26840 +  uint32 attr_base;
26841 +  uint32 attr_cntrl;
26842 +  uint32 io_base;
26843 +  uint32 io_cntrl;
26844 +#define PCMCIA_CS_ENABLE 0x00000001
26845 +#define PCMCIA_CS_FIFO_ENABLE 0x00000200
26846 +#define PCMCIA_DSTSIZE_16 0x00000010 // 0 -8bit, 1- 16bit
26847 +#define PCMCIA_RENDIAN  0x00000400 
26848 +  /* Skip ECR and EBI-DMA registers */
26849 +  uint32 other1[7];
26850 +
26851 +  byte mem_waitcnt4; // Only bits [5:0]
26852 +  byte mem_waitcnt3; // Only bits [4:0]
26853 +  byte mem_waitcnt2; // Only bits [4:0]
26854 +  byte mem_waitcnt1; // Only bits [4:0]
26855 +
26856 +  byte attr_waitcnt4; // Only bits [5:0]
26857 +  byte attr_waitcnt3; // Only bits [4:0]
26858 +  byte attr_waitcnt2; // Only bits [4:0]
26859 +  byte attr_waitcnt1; // Only bits [4:0]
26860 +
26861 +  byte io_waitcnt4; // Only bits [5:0]
26862 +  byte io_waitcnt3; // Only bits [4:0]
26863 +  byte io_waitcnt2; // Only bits [4:0]
26864 +  byte io_waitcnt1; // Only bits [4:0]
26865 +
26866 +} PcmciaRegisters;
26867 +
26868 +#define PCMCIA ((volatile PcmciaRegisters * const) PCMCIA_BASE)
26869 +
26870 +/*
26871 +** EMAC transmit MIB counters
26872 +*/
26873 +typedef struct EmacTxMib {
26874 +  uint32        tx_good_octets;         /* (200) good byte count */
26875 +  uint32        tx_good_pkts;           /* (204) good pkt count */
26876 +  uint32        tx_octets;              /* (208) good and bad byte count */
26877 +  uint32        tx_pkts;                /* (20c) good and bad pkt count */
26878 +  uint32        tx_broadcasts_pkts;     /* (210) good broadcast packets */
26879 +  uint32        tx_multicasts_pkts;     /* (214) good mulitcast packets */
26880 +  uint32        tx_len_64;              /* (218) RMON tx pkt size buckets */
26881 +  uint32        tx_len_65_to_127;       /* (21c) */
26882 +  uint32        tx_len_128_to_255;      /* (220) */
26883 +  uint32        tx_len_256_to_511;      /* (224) */
26884 +  uint32        tx_len_512_to_1023;     /* (228) */
26885 +  uint32        tx_len_1024_to_max;     /* (22c) */
26886 +  uint32        tx_jabber_pkts;         /* (230) > 1518 with bad crc */
26887 +  uint32        tx_oversize_pkts;       /* (234) > 1518 with good crc */
26888 +  uint32        tx_fragment_pkts;       /* (238) < 63   with bad crc */
26889 +  uint32        tx_underruns;           /* (23c) fifo underrun */
26890 +  uint32        tx_total_cols;          /* (240) total collisions in all tx pkts */
26891 +  uint32        tx_single_cols;         /* (244) tx pkts with single collisions */
26892 +  uint32        tx_multiple_cols;       /* (248) tx pkts with multiple collisions */
26893 +  uint32        tx_excessive_cols;      /* (24c) tx pkts with excessive cols */
26894 +  uint32        tx_late_cols;           /* (250) tx pkts with late cols */
26895 +  uint32        tx_defered;             /* (254) tx pkts deferred */
26896 +  uint32        tx_carrier_lost;        /* (258) tx pkts with CRS lost */
26897 +  uint32        tx_pause_pkts;          /* (25c) tx pause pkts sent */
26898 +#define NumEmacTxMibVars        24
26899 +} EmacTxMib;
26900 +
26901 +/*
26902 +** EMAC receive MIB counters
26903 +*/
26904 +typedef struct EmacRxMib {
26905 +  uint32        rx_good_octets;         /* (280) good byte count */
26906 +  uint32        rx_good_pkts;           /* (284) good pkt count */
26907 +  uint32        rx_octets;              /* (288) good and bad byte count */
26908 +  uint32        rx_pkts;                /* (28c) good and bad pkt count */
26909 +  uint32        rx_broadcasts_pkts;     /* (290) good broadcast packets */
26910 +  uint32        rx_multicasts_pkts;     /* (294) good mulitcast packets */
26911 +  uint32        rx_len_64;              /* (298) RMON rx pkt size buckets */
26912 +  uint32        rx_len_65_to_127;       /* (29c) */
26913 +  uint32        rx_len_128_to_255;      /* (2a0) */
26914 +  uint32        rx_len_256_to_511;      /* (2a4) */
26915 +  uint32        rx_len_512_to_1023;     /* (2a8) */
26916 +  uint32        rx_len_1024_to_max;     /* (2ac) */
26917 +  uint32        rx_jabber_pkts;         /* (2b0) > 1518 with bad crc */
26918 +  uint32        rx_oversize_pkts;       /* (2b4) > 1518 with good crc */
26919 +  uint32        rx_fragment_pkts;       /* (2b8) < 63   with bad crc */
26920 +  uint32        rx_missed_pkts;         /* (2bc) missed packets */
26921 +  uint32        rx_crc_align_errs;      /* (2c0) both or either */
26922 +  uint32        rx_undersize;           /* (2c4) < 63   with good crc */
26923 +  uint32        rx_crc_errs;            /* (2c8) crc errors (only) */
26924 +  uint32        rx_align_errs;          /* (2cc) alignment errors (only) */
26925 +  uint32        rx_symbol_errs;         /* (2d0) pkts with RXERR assertions (symbol errs) */
26926 +  uint32        rx_pause_pkts;          /* (2d4) MAC control, PAUSE */
26927 +  uint32        rx_nonpause_pkts;       /* (2d8) MAC control, not PAUSE */
26928 +#define NumEmacRxMibVars        23
26929 +} EmacRxMib;
26930 +
26931 +typedef struct EmacRegisters {
26932 +  uint32        rxControl;              /* (00) receive control */
26933 +#define          EMAC_PM_REJ    0x80    /*      - reject DA match in PMx regs */
26934 +#define          EMAC_UNIFLOW   0x40    /*      - accept cam match fc */
26935 +#define          EMAC_FC_EN     0x20    /*      - enable flow control */
26936 +#define          EMAC_LOOPBACK  0x10    /*      - loopback */
26937 +#define          EMAC_PROM      0x08    /*      - promiscuous */
26938 +#define          EMAC_RDT       0x04    /*      - ignore transmissions */
26939 +#define          EMAC_ALL_MCAST 0x02    /*      - ignore transmissions */
26940 +#define          EMAC_NO_BCAST  0x01    /*      - ignore transmissions */
26941 +
26942 +
26943 +  uint32        rxMaxLength;            /* (04) receive max length */
26944 +  uint32        txMaxLength;            /* (08) transmit max length */
26945 +  uint32        unused1[1];
26946 +  uint32        mdioFreq;               /* (10) mdio frequency */
26947 +#define          EMAC_MII_PRE_EN 0x0100 /* prepend preamble sequence */
26948 +#define          EMAC_MDIO_PRE   0x100  /*      - enable MDIO preamble */
26949 +#define          EMAC_MDC_FREQ   0x0ff  /*      - mdio frequency */
26950 +
26951 +  uint32        mdioData;               /* (14) mdio data */
26952 +#define          MDIO_WR        0x50020000 /*   - write framing */
26953 +#define          MDIO_RD        0x60020000 /*   - read framing */
26954 +#define          MDIO_PMD_SHIFT  23
26955 +#define          MDIO_REG_SHIFT  18
26956 +
26957 +  uint32        intMask;                /* (18) int mask */
26958 +  uint32        intStatus;              /* (1c) int status */
26959 +#define          EMAC_FLOW_INT  0x04    /*      - flow control event */
26960 +#define          EMAC_MIB_INT   0x02    /*      - mib event */
26961 +#define          EMAC_MDIO_INT  0x01    /*      - mdio event */
26962 +
26963 +  uint32        unused2[3];
26964 +  uint32        config;                 /* (2c) config */
26965 +#define          EMAC_ENABLE    0x001   /*      - enable emac */
26966 +#define          EMAC_DISABLE   0x002   /*      - disable emac */
26967 +#define          EMAC_SOFT_RST  0x004   /*      - soft reset */
26968 +#define          EMAC_SOFT_RESET 0x004  /*      - emac soft reset */
26969 +#define          EMAC_EXT_PHY   0x008   /*      - external PHY select */
26970 +
26971 +  uint32        txControl;              /* (30) transmit control */
26972 +#define          EMAC_FD        0x001   /*      - full duplex */
26973 +#define          EMAC_FLOWMODE  0x002   /*      - flow mode */
26974 +#define          EMAC_NOBKOFF   0x004   /*      - no backoff in  */
26975 +#define          EMAC_SMALLSLT  0x008   /*      - small slot time */
26976 +
26977 +  uint32        txThreshold;            /* (34) transmit threshold */
26978 +  uint32        mibControl;             /* (38) mib control */
26979 +#define          EMAC_NO_CLEAR  0x001   /* don't clear on read */
26980 +
26981 +  uint32        unused3[7];
26982 +
26983 +  uint32        pm0DataLo;              /* (58) perfect match 0 data lo */
26984 +  uint32        pm0DataHi;              /* (5C) perfect match 0 data hi (15:0) */
26985 +  uint32        pm1DataLo;              /* (60) perfect match 1 data lo */
26986 +  uint32        pm1DataHi;              /* (64) perfect match 1 data hi (15:0) */
26987 +  uint32        pm2DataLo;              /* (68) perfect match 2 data lo */
26988 +  uint32        pm2DataHi;              /* (6C) perfect match 2 data hi (15:0) */
26989 +  uint32        pm3DataLo;              /* (70) perfect match 3 data lo */
26990 +  uint32        pm3DataHi;              /* (74) perfect match 3 data hi (15:0) */
26991 +#define          EMAC_CAM_V   0x10000  /*      - cam index */
26992 +#define          EMAC_CAM_VALID 0x00010000
26993 +
26994 +  uint32        unused4[98];            /* (78-1fc) */
26995 +
26996 +  EmacTxMib     tx_mib;                 /* (200) emac tx mib */
26997 +  uint32        unused5[8];             /* (260-27c) */
26998 +
26999 +  EmacRxMib     rx_mib;                 /* (280) rx mib */
27000 +
27001 +} EmacRegisters;
27002 +
27003 +/* register offsets for subrouting access */
27004 +#define EMAC_RX_CONTROL         0x00
27005 +#define EMAC_RX_MAX_LENGTH      0x04
27006 +#define EMAC_TX_MAC_LENGTH      0x08
27007 +#define EMAC_MDIO_FREQ          0x10
27008 +#define EMAC_MDIO_DATA          0x14
27009 +#define EMAC_INT_MASK           0x18
27010 +#define EMAC_INT_STATUS         0x1C
27011 +#define EMAC_CAM_DATA_LO        0x20
27012 +#define EMAC_CAM_DATA_HI        0x24
27013 +#define EMAC_CAM_CONTROL        0x28
27014 +#define EMAC_CONTROL            0x2C
27015 +#define EMAC_TX_CONTROL         0x30
27016 +#define EMAC_TX_THRESHOLD       0x34
27017 +#define EMAC_MIB_CONTROL        0x38
27018 +
27019 +
27020 +#define EMAC ((volatile EmacRegisters * const) EMAC_BASE)
27021 +
27022 +/*
27023 +** USB Registers
27024 +*/
27025 +typedef struct UsbRegisters {
27026 +    byte inttf_setting;
27027 +    byte current_config;
27028 +    uint16 status_frameNum;
27029 +#define USB_BUS_RESET   0x1000 
27030 +#define USB_SUSPENDED   0x0800 
27031 +    byte unused1;
27032 +    byte endpt_prnt;
27033 +    byte endpt_dirn;
27034 +    byte endpt_status;
27035 +#define USB_ENDPOINT_0  0x01
27036 +#define USB_ENDPOINT_1  0x02
27037 +#define USB_ENDPOINT_2  0x04
27038 +#define USB_ENDPOINT_3  0x08
27039 +#define USB_ENDPOINT_4  0x10
27040 +#define USB_ENDPOINT_5  0x20
27041 +#define USB_ENDPOINT_6  0x40
27042 +#define USB_ENDPOINT_7  0x80
27043 +    uint32 unused2;
27044 +    byte conf_mem_ctl;
27045 +#define USB_CONF_MEM_RD     0x80
27046 +#define USB_CONF_MEM_RDY    0x40
27047 +    byte unused2a;
27048 +    byte conf_mem_read_address;
27049 +    byte conf_mem_write_address;
27050 +
27051 +    byte unused3;
27052 +    byte dev_req_bytesel;
27053 +    uint16 ext_dev_data;
27054 +
27055 +    byte unused4;
27056 +    byte clr_fifo;
27057 +    byte endpt_stall_reset;  // use same endpoint #'s from above
27058 +    byte usb_cntl;
27059 +#define USB_FORCE_ERR       0x20
27060 +#define USB_SOFT_RESET      0x10
27061 +#define USB_RESUME          0x08
27062 +#define USB_COMMAND_ERR     0x04
27063 +#define USB_COMMAND_OVER    0x02
27064 +    byte irq_addr;
27065 +    byte iso_out_in_addr;
27066 +    byte blk_out_in_addr;
27067 +    byte cntl_addr;
27068 +    uint32 mux_cntl;
27069 +#define USB_TX_DMA_OPER          0x00000000   
27070 +#define USB_TX_CNTL_FIFO_OPER    0x00000004   
27071 +#define USB_TX_BULK_FIFO_OPER    0x00000008   
27072 +#define USB_TX_ISO_FIFO_OPER     0x0000000c   
27073 +#define USB_TX_IRQ_OPER          0x00000010   
27074 +#define USB_RX_DMA_OPER          0x00000000   
27075 +#define USB_RX_CNTL_FIFO_OPER    0x00000001   
27076 +#define USB_RX_BULK_FIFO_OPER    0x00000002   
27077 +#define USB_RX_ISO_FIFO_OPER     0x00000003   
27078 +    uint32 rx_ram_read_port;
27079 +    uint32 tx_ram_write_port;
27080 +    uint32 fifo_status;
27081 +#define USB_CTRLI_FIFO_FULL         0x00000001
27082 +#define USB_CTRLI_FIFO_EMPTY        0x00000002
27083 +#define USB_CTRLO_FIFO_FULL         0x00000100
27084 +#define USB_CTRLO_FIFO_EMPTY        0x00000200
27085 +    uint32 irq_status;
27086 +    uint32 irq_mask;
27087 +#define USB_NEW_CONFIG              0x01   
27088 +#define USB_SETUP_COMMAND_RECV      0x02    // non-standard setup command received
27089 +#define USB_OUT_FIFO_OV             0x04   
27090 +#define USB_RESET_RECV              0x08   
27091 +#define USB_SUSPEND_RECV            0x10   
27092 +#define USB_FIFO_REWIND             0x20   
27093 +#define USB_RX_BULK_FIFO_DATA_AVAIL 0x40   
27094 +#define USB_RX_ISO_FIFO_DATA_AVAIL  0x80   
27095 +    uint32 endpt_cntl;
27096 +#define USB_R_WK_EN                 0x0100   
27097 +#define USB_TX_EOP                  0x0200   
27098 +#define USB_TX_CNTL_DMA_EN          0x0400
27099 +#define USB_TX_BULK_DMA_EN          0x0800
27100 +#define USB_TX_ISO_DMA_EN           0x1000
27101 +#define USB_RX_CNTL_DMA_EN          0x2000
27102 +#define USB_RX_BULK_DMA_EN          0x4800
27103 +#define USB_RX_ISO_DMA_EN           0x8000
27104 +    uint32 rx_status_read_port;
27105 +    uint32 confmem_read_port;
27106 +    uint32 confmem_write_port;
27107 +    uint32 fifo_ovf_count;
27108 +    uint32 fifo_rewind_cnt;
27109 +} UsbRegisters;
27110 +
27111 +#define USB ((volatile UsbRegisters * const) USB_BASE)
27112 +
27113 +/*
27114 +** ADSL core Registers
27115 +*/
27116 +
27117 +#define        _PADLINE(line)  pad ## line
27118 +#define        _XSTR(line)     _PADLINE(line)
27119 +#define        PAD             _XSTR(__LINE__)
27120 +
27121 +typedef struct AdslRegisters {
27122 +    uint32 core_control;
27123 +#define ADSL_RESET             0x01
27124 +   
27125 +    uint32 core_status;
27126 +#define ADSL_HOST_MSG  0x01
27127 +
27128 +    uint32 PAD;
27129 +    uint32 bist_status;
27130 +    uint32 PAD[4];
27131 +    uint32 int_status_i; /* 0x20 */
27132 +    uint32 int_mask_i;
27133 +    uint32 int_status_f;
27134 +    uint32 int_mask_f;
27135 +#define ADSL_INT_HOST_MSG              0x00000020
27136 +#define ADSL_INT_DESC_ERR              0x00000400
27137 +#define ADSL_INT_DATA_ERR              0x00000800
27138 +#define ADSL_INT_DESC_PROTO_ERR        0x00001000
27139 +#define ADSL_INT_RCV_DESC_UF   0x00002000
27140 +#define ADSL_INT_RCV_FIFO_OF   0x00004000
27141 +#define ADSL_INT_XMT_FIFO_UF   0x00008000
27142 +#define ADSL_INT_RCV                   0x00010000
27143 +#define ADSL_INT_XMT                   0x01000000
27144 +
27145 +    uint32 PAD[116];
27146 +
27147 +       uint32  xmtcontrol_intr; /* 0x200 */
27148 +#define ADSL_DMA_XMT_EN                        0x00000001
27149 +#define ADSL_DMA_XMT_LE                        0x00000004
27150 +       uint32  xmtaddr_intr;
27151 +#define ADSL_DMA_ADDR_MASK             0xFFFFF000
27152 +       uint32  xmtptr_intr;
27153 +#define ADSL_DMA_LAST_DESC_MASK        0x00000FFF
27154 +       uint32  xmtstatus_intr;
27155 +#define ADSL_DMA_CURR_DESC_MASK        0x00000FFF
27156 +#define ADSL_DMA_XMT_STATE_MASK        0x0000F000
27157 +#define ADSL_DMA_XMT_STATE_DIS 0x00000000
27158 +#define ADSL_DMA_XMT_STATE_ACT 0x00001000
27159 +#define ADSL_DMA_XMT_STATE_IDLE        0x00002000
27160 +#define ADSL_DMA_XMT_STATE_STOP        0x00003000
27161 +
27162 +#define ADSL_DMA_XMT_ERR_MASK  0x000F0000
27163 +#define ADSL_DMA_XMT_ERR_NONE  0x00000000
27164 +#define ADSL_DMA_XMT_ERR_DPE   0x00010000
27165 +#define ADSL_DMA_XMT_ERR_FIFO  0x00020000
27166 +#define ADSL_DMA_XMT_ERR_DTE   0x00030000
27167 +#define ADSL_DMA_XMT_ERR_DRE   0x00040000
27168 +
27169 +       uint32  rcvcontrol_intr;
27170 +#define ADSL_DMA_RCV_EN                        0x00000001
27171 +#define ADSL_DMA_RCV_FO                        0x000000FE
27172 +       uint32  rcvaddr_intr;
27173 +       uint32  rcvptr_intr;
27174 +       uint32  rcvstatus_intr;
27175 +#define ADSL_DMA_RCV_STATE_MASK        0x0000F000
27176 +#define ADSL_DMA_RCV_STATE_DIS 0x00000000
27177 +#define ADSL_DMA_RCV_STATE_ACT 0x00001000
27178 +#define ADSL_DMA_RCV_STATE_IDLE        0x00002000
27179 +#define ADSL_DMA_RCV_STATE_STOP        0x00003000
27180 +
27181 +#define ADSL_DMA_RCV_ERR_MASK  0x000F0000
27182 +#define ADSL_DMA_RCV_ERR_NONE  0x00000000
27183 +#define ADSL_DMA_RCV_ERR_DPE   0x00010000
27184 +#define ADSL_DMA_RCV_ERR_FIFO  0x00020000
27185 +#define ADSL_DMA_RCV_ERR_DTE   0x00030000
27186 +#define ADSL_DMA_RCV_ERR_DRE   0x00040000
27187 +
27188 +       uint32  xmtcontrol_fast;
27189 +       uint32  xmtaddr_fast;
27190 +       uint32  xmtptr_fast;
27191 +       uint32  xmtstatus_fast;
27192 +       uint32  rcvcontrol_fast;
27193 +       uint32  rcvaddr_fast;
27194 +       uint32  rcvptr_fast;
27195 +       uint32  rcvstatus_fast;
27196 +       uint32  PAD[48];
27197 +
27198 +       uint32  host_message; /* 0x300 */
27199 +       uint32  PAD[805];
27200 +    uint32 core_reset;
27201 +    uint32 core_error;
27202 +    uint32 core_revision;
27203 +
27204 +#define        ADSL_CORE_REV                   0x0000000F
27205 +#define        ADSL_CORE_TYPE                  0x0000FFF0
27206 +} AdslRegisters;
27207 +
27208 +#define ADSL ((volatile AdslRegisters * const) ADSL_BASE)
27209 +
27210 +#if __cplusplus
27211 +}
27212 +#endif
27213 +
27214 +#endif
27215 +
27216 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6348_common.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6348_common.h
27217 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6348_common.h    1970-01-01 01:00:00.000000000 +0100
27218 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6348_common.h   2006-06-26 09:07:10.000000000 +0200
27219 @@ -0,0 +1,225 @@
27220 +/*
27221 +<:copyright-broadcom 
27222
27223 + Copyright (c) 2002 Broadcom Corporation 
27224 + All Rights Reserved 
27225 + No portions of this material may be reproduced in any form without the 
27226 + written permission of: 
27227 +          Broadcom Corporation 
27228 +          16215 Alton Parkway 
27229 +          Irvine, California 92619 
27230 + All information contained in this document is Broadcom Corporation 
27231 + company private, proprietary, and trade secret. 
27232
27233 +:>
27234 +*/
27235 +/***********************************************************************/
27236 +/*                                                                     */
27237 +/*   MODULE: 6348_common.h                                             */
27238 +/*   DATE:    04/12/19                                                 */
27239 +/*   PURPOSE: Define addresses of major hardware components of         */
27240 +/*            BCM6348                                                  */
27241 +/*                                                                     */
27242 +/***********************************************************************/
27243 +#ifndef __BCM6348_MAP_COMMON_H
27244 +#define __BCM6348_MAP_COMMON_H
27245 +
27246 +#if __cplusplus
27247 +extern "C" {
27248 +#endif
27249 +
27250 +#define PERF_BASE     0xfffe0000    /* chip control registers */
27251 +#define BB_BASE       0xfffe0100    /* bus bridge registers */
27252 +#define TIMR_BASE     0xfffe0200    /* timer registers */
27253 +#define UART_BASE     0xfffe0300    /* uart registers */
27254 +#define GPIO_BASE     0xfffe0400    /* gpio registers */
27255 +#define SPI_BASE      0xfffe0c00    /* SPI master controller registers */
27256 +
27257 +#define USB_CTL_BASE  0xfffe1000    /* USB control registers */
27258 +#define USB_DMA_BASE  0xfffe1400    /* USB DMA control registers */
27259 +#define USB_HOST_BASE 0xfffe1b00    /* USB host registers */
27260 +
27261 +#define MPI_BASE      0xfffe2000    /* MPI control registers */
27262 +#define SDRAM_BASE    0xfffe2300    /* SDRAM control registers */
27263 +
27264 +#define ADSL_BASE     0xfffe3000       /* ADSL core control registers */
27265 +#define ATM_BASE      0xfffe4000       /* ATM SAR control registers */
27266 +#define UBUS_BASE     0xfffe5000       /* UBUS status registers */
27267 +#define EMAC1_BASE    0xfffe6000    /* EMAC1 control registers */
27268 +#define EMAC2_BASE    0xfffe6800    /* EMAC2 control registers */
27269 +#define EMAC_DMA_BASE 0xfffe7000    /* EMAC DMA control registers */
27270 +
27271 +/*
27272 +#####################################################################
27273 +# System PLL Control Register
27274 +#####################################################################
27275 +*/
27276 +#define SYSPLLCFG       0x08
27277 +
27278 +#define M_MPI_MASK      0x00000018      // 4:3
27279 +#define M_MPI_SHFT      3
27280 +#define M_MPI_50MHZ     0
27281 +#define M_MPI_40MHZ     1
27282 +#define M_MPI_33MHZ     2
27283 +#define M_MPI_25MHZ     3
27284 +
27285 +#define M_UTO_MASK      0x00000002      // 1:1
27286 +#define M_UTO_SHFT      1
27287 +
27288 +#define SOFT_RESET     0x00000001
27289 +
27290 +#define PLL_STRAP_VALUE  0x34
27291 +
27292 +/*
27293 +#####################################################################
27294 +# SDRAM Control Registers
27295 +#####################################################################
27296 +*/
27297 +#define SDR_INIT_CTL        0x00
27298 +    /* Control Bits */
27299 +#define SDR_PFEN1           (1<<16)
27300 +#define SDR_PFEN0           (1<<15)
27301 +#define SDR_EMPRS           (1<<14)
27302 +#define SDR_2_BANKS         (1<<13)
27303 +#define SDR_1_BANK          (0<<13)
27304 +#define SDR_CS1_EN          (1<<12)
27305 +#define SDR_PEND            (1<<11)
27306 +#define SDR_32_BIT          (1<<10)
27307 +#define SDR_POWER_DOWN      (1<<9)
27308 +#define SDR_SELF_REFRESH    (1<<8)
27309 +#define SDR_11_COLS         (3<<6)
27310 +#define SDR_10_COLS         (2<<6)
27311 +#define SDR_9_COLS          (1<<6)
27312 +#define SDR_8_COLS          (0<<6)
27313 +#define SDR_13_ROWS         (2<<4)
27314 +#define SDR_12_ROWS         (1<<4)
27315 +#define SDR_11_ROWS         (0<<4)
27316 +#define SDR_MASTER_EN       (1<<3)
27317 +#define SDR_MRS_CMD         (1<<2)
27318 +#define SDR_PRE_CMD         (1<<1)
27319 +#define SDR_CBR_CMD         (1<<0)
27320 +
27321 +#define SDR_CFG_REG         0x04
27322 +    /* Control Bits */
27323 +#define SDR_FULL_PG         0
27324 +#define SDR_BURST8          1
27325 +#define SDR_BURST4          2
27326 +#define SDR_BURST2          3
27327 +#define SDR_FAST_MEM        (1<<2)
27328 +#define SDR_SLOW_MEM        (0<<2)
27329 +
27330 +#define SDR_REF_CTL         0x0C
27331 +    /* Control Bits */
27332 +#define SDR_REF_EN          (1<<15)
27333 +
27334 +#define SDR_PRIOR
27335 +    /* Control Bits */
27336 +#define SDR_EN_PRIOR        (1<<31)
27337 +
27338 +
27339 +/*
27340 +#####################################################################
27341 +# MPI Control Registers
27342 +#####################################################################
27343 +*/
27344 +#define CS0BASE         0x00
27345 +#define CS0CNTL         0x04
27346 +
27347 +/*
27348 +# CSxBASE settings
27349 +#   Size in low 4 bits
27350 +#   Base Address for match in upper 24 bits
27351 +*/
27352 +#define EBI_SIZE_8K         0
27353 +#define EBI_SIZE_16K        1
27354 +#define EBI_SIZE_32K        2
27355 +#define EBI_SIZE_64K        3
27356 +#define EBI_SIZE_128K       4
27357 +#define EBI_SIZE_256K       5
27358 +#define EBI_SIZE_512K       6
27359 +#define EBI_SIZE_1M         7
27360 +#define EBI_SIZE_2M         8
27361 +#define EBI_SIZE_4M         9
27362 +#define EBI_SIZE_8M         10
27363 +#define EBI_SIZE_16M        11
27364 +#define EBI_SIZE_32M        12
27365 +#define EBI_SIZE_64M        13
27366 +#define EBI_SIZE_128M       14
27367 +#define EBI_SIZE_256M       15
27368 +
27369 +/* CSxCNTL settings */
27370 +#define EBI_ENABLE          0x00000001  /* .. enable this range */
27371 +#define EBI_WAIT_STATES     0x0000000e  /* .. mask for wait states */
27372 +#define ZEROWT              0x00000000  /* ..  0 WS */
27373 +#define ONEWT               0x00000002  /* ..  1 WS */
27374 +#define TWOWT               0x00000004  /* ..  2 WS */
27375 +#define THREEWT             0x00000006  /* ..  3 WS */
27376 +#define FOURWT              0x00000008  /* ..  4 WS */
27377 +#define FIVEWT              0x0000000a  /* ..  5 WS */
27378 +#define SIXWT               0x0000000c  /* ..  6 WS */
27379 +#define SEVENWT             0x0000000e  /* ..  7 WS */
27380 +#define EBI_WORD_WIDE       0x00000010  /* .. 16-bit peripheral, else 8 */
27381 +#define EBI_POLARITY        0x00000040  /* .. set to invert chip select polarity */
27382 +#define EBI_TS_TA_MODE      0x00000080  /* .. use TS/TA mode */
27383 +#define EBI_TS_SEL          0x00000100  /* .. drive tsize, not bs_b */
27384 +#define EBI_FIFO            0x00000200  /* .. enable fifo */
27385 +#define EBI_RE              0x00000400  /* .. Reverse Endian */
27386 +
27387 +/*
27388 +#####################################################################
27389 +# UART Control Registers
27390 +#####################################################################
27391 +*/
27392 +#define UART0CONTROL     0x01
27393 +#define UART0CONFIG      0x02
27394 +#define UART0RXTIMEOUT   0x03
27395 +#define UART0BAUD        0x04
27396 +#define UART0FIFOCFG     0x0a
27397 +#define UART0INTMASK     0x10
27398 +#define UART0INTSTAT     0x12
27399 +#define UART0DATA        0x17
27400 +
27401 +#define BRGEN            0x80   /* Control register bit defs */
27402 +#define TXEN             0x40
27403 +#define RXEN             0x20
27404 +#define LOOPBK           0x10
27405 +#define TXPARITYEN       0x08
27406 +#define TXPARITYEVEN     0x04
27407 +#define RXPARITYEN       0x02
27408 +#define RXPARITYEVEN     0x01
27409 +
27410 +#define XMITBREAK        0x40   /* Config register */
27411 +#define BITS5SYM         0x00
27412 +#define BITS6SYM         0x10
27413 +#define BITS7SYM         0x20
27414 +#define BITS8SYM         0x30
27415 +#define ONESTOP          0x07
27416 +#define TWOSTOP          0x0f
27417 +
27418 +#define RSTTXFIFOS       0x80   /* Rx Timeout register */
27419 +#define RSTRXFIFOS       0x40
27420 +
27421 +#define TX4              0x40   /* FIFO config register */
27422 +#define RX4              0x04
27423 +
27424 +#define DELTAIP          0x0001 /* Interrupt Status and Mask registers */
27425 +#define TXUNDERR         0x0002
27426 +#define TXOVFERR         0x0004
27427 +#define TXFIFOTHOLD      0x0008
27428 +#define TXREADLATCH      0x0010
27429 +#define TXFIFOEMT        0x0020
27430 +#define RXUNDERR         0x0040
27431 +#define RXOVFERR         0x0080
27432 +#define RXTIMEOUT        0x0100
27433 +#define RXFIFOFULL       0x0200
27434 +#define RXFIFOTHOLD      0x0400
27435 +#define RXFIFONE         0x0800
27436 +#define RXFRAMERR        0x1000
27437 +#define RXPARERR         0x2000
27438 +#define RXBRK            0x4000
27439 +          
27440 +#if __cplusplus
27441 +}
27442 +#endif
27443 +
27444 +#endif
27445 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6348_map.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6348_map.h
27446 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/6348_map.h       1970-01-01 01:00:00.000000000 +0100
27447 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/6348_map.h      2006-06-26 09:07:10.000000000 +0200
27448 @@ -0,0 +1,1095 @@
27449 +/*
27450 +<:copyright-broadcom 
27451
27452 + Copyright (c) 2002 Broadcom Corporation 
27453 + All Rights Reserved 
27454 + No portions of this material may be reproduced in any form without the 
27455 + written permission of: 
27456 +          Broadcom Corporation 
27457 +          16215 Alton Parkway 
27458 +          Irvine, California 92619 
27459 + All information contained in this document is Broadcom Corporation 
27460 + company private, proprietary, and trade secret. 
27461
27462 +:>
27463 +*/
27464 +/***********************************************************************/
27465 +/*                                                                     */
27466 +/*   MODULE:  6348_map.h                                               */
27467 +/*   DATE:    11/06/03                                                 */
27468 +/*   PURPOSE: Define addresses of major hardware components of         */
27469 +/*            BCM6348                                                  */
27470 +/*                                                                     */
27471 +/***********************************************************************/
27472 +#ifndef __BCM6348_MAP_H
27473 +#define __BCM6348_MAP_H
27474 +
27475 +#if __cplusplus
27476 +extern "C" {
27477 +#endif
27478 +
27479 +#include "bcmtypes.h"
27480 +#include "6348_common.h"
27481 +#include "6348_intr.h"
27482 +
27483 +/* macro to convert logical data addresses to physical */
27484 +/* DMA hardware must see physical address */
27485 +#define LtoP( x )       ( (uint32)x & 0x1fffffff )
27486 +#define PtoL( x )       ( LtoP(x) | 0xa0000000 )
27487 +
27488 +/*
27489 +** Interrupt Controller
27490 +*/
27491 +typedef struct PerfControl {
27492 +  uint32        RevID;          /* (00) */
27493 +  uint16        testControl;    /* (04) */
27494 +  uint16        blkEnables;     /* (06) */
27495 +
27496 +#define ADSL_CLK_EN     0x0001
27497 +#define MPI_CLK_EN      0x0002
27498 +#define DRAM_CLK_EN     0x0004
27499 +#define M2M_CLK_EN      0x0008
27500 +#define EMAC_CLK_EN     0x0010
27501 +#define SAR_CLK_EN      0x0020
27502 +#define USBS_CLK_EN     0x0040
27503 +#define USBH_CLK_EN     0x0100
27504 +#define SPI_CLK_EN      0x0200
27505 +
27506 +  uint32        pll_control;    /* (08) */
27507 +#define CHIP_SOFT_RESET 0x00000001
27508 +#define MPI_CLK_50MHZ   0x00000000
27509 +#define MPI_CLK_40MHZ   0x00000008
27510 +#define MPI_CLK_33MHZ   0x00000010
27511 +#define MPI_CLK_25MHZ   0x00000018
27512 +#define MPI_CLK_MASK    0x00000018
27513 +
27514 +  uint32        IrqMask;        /* (0c) */
27515 +  uint32        IrqStatus;      /* (10) */
27516 +
27517 +  uint32        ExtIrqCfg;
27518 +#define EI_SENSE_SHFT   0
27519 +#define EI_STATUS_SHFT  5
27520 +#define EI_CLEAR_SHFT   10
27521 +#define EI_MASK_SHFT    15
27522 +#define EI_INSENS_SHFT  20
27523 +#define EI_LEVEL_SHFT   25
27524 +
27525 +  uint32        unused[4];      /* (18) */
27526 +  uint32        BlockSoftReset; /* (28) */
27527 +#define BSR_SPI             0x00000001
27528 +#define BSR_EMAC            0x00000004
27529 +#define BSR_USBH            0x00000008
27530 +#define BSR_USBS            0x00000010
27531 +#define BSR_ADSL            0x00000020
27532 +#define BSR_DMAMEM          0x00000040
27533 +#define BSR_SAR             0x00000080
27534 +#define BSR_ACLC            0x00000100
27535 +#define BSR_ADSL_MIPS_PLL   0x00000400
27536 +#define BSR_ALL_BLOCKS      \
27537 +    (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
27538 +     BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
27539 +  uint32        unused2[2];     /* (2c) */
27540 +  uint32        PllStrap;       /* (34) */
27541 +#define PLL_N1_SHFT         20
27542 +#define PLL_N1_MASK         (7<<PLL_N1_SHFT)
27543 +#define PLL_N2_SHFT         15
27544 +#define PLL_N2_MASK         (0x1f<<PLL_N2_SHFT)
27545 +#define PLL_M1_REF_SHFT     12
27546 +#define PLL_M1_REF_MASK     (7<<PLL_M1_REF_SHFT)
27547 +#define PLL_M2_REF_SHFT     9
27548 +#define PLL_M2_REF_MASK     (7<<PLL_M2_REF_SHFT)
27549 +#define PLL_M1_CPU_SHFT     6
27550 +#define PLL_M1_CPU_MASK     (7<<PLL_M1_CPU_SHFT)
27551 +#define PLL_M1_BUS_SHFT     3
27552 +#define PLL_M1_BUS_MASK     (7<<PLL_M1_BUS_SHFT)
27553 +#define PLL_M2_BUS_SHFT     0
27554 +#define PLL_M2_BUS_MASK     (7<<PLL_M2_BUS_SHFT)
27555 +} PerfControl;
27556 +
27557 +#define PERF ((volatile PerfControl * const) PERF_BASE)
27558 +
27559 +/*
27560 +** Bus Bridge Registers
27561 +*/
27562 +typedef struct BusBridge {
27563 +  uint16    status;
27564 +#define BB_BUSY     0x8000      /* posted operation in progress */
27565 +#define BB_RD_PND   0x4000      /* read pending */
27566 +#define BB_RD_CMPLT 0x2000      /* read complete */
27567 +#define BB_ERROR    0x1000      /* posted write error */
27568 +#define BB_TEA      0x0800      /* transfer aborted */
27569 +  uint16    abortTimeoutCnt;    /* abort timeout value */
27570 +
27571 +  byte      writePostEnable;
27572 +#define BB_POST_TIMR_EN 0x08        /* post writes to timer regs */
27573 +#define BB_POST_GPIO_EN 0x04        /* post writes to gpio regs */
27574 +#define BB_POST_INTC_EN 0x02        /* post writes to interrupt controller regs */
27575 +#define BB_POST_UART_EN 0x01        /* post writes to uart regs */
27576 +  byte      unused1[5];
27577 +  uint16    postAddr;       /* posted read address (lower half) */
27578 +  byte      unused2[3];
27579 +  byte      postData;       /* posted read data */
27580 +} BusBridge;
27581 +
27582 +/* register offsets (needed for EBI master access) */
27583 +#define BB_STATUS       0
27584 +#define BB_ABORT_TO_CNT     2
27585 +#define BB_WR_POST_EN       4
27586 +#define BB_RD_POST_ADDR     10
27587 +#define BB_RD_POST_DATA     12
27588 +
27589 +#define BRIDGE *bridge ((volatile BusBridge * const) BB_BASE)
27590 +
27591 +/*
27592 +** Timer
27593 +*/
27594 +typedef struct Timer {
27595 +  uint16        unused0;
27596 +  byte          TimerMask;
27597 +#define TIMER0EN        0x01
27598 +#define TIMER1EN        0x02
27599 +#define TIMER2EN        0x04
27600 +  byte          TimerInts;
27601 +#define TIMER0          0x01
27602 +#define TIMER1          0x02
27603 +#define TIMER2          0x04
27604 +#define WATCHDOG        0x08
27605 +  uint32        TimerCtl0;
27606 +  uint32        TimerCtl1;
27607 +  uint32        TimerCtl2;
27608 +#define TIMERENABLE     0x80000000
27609 +#define RSTCNTCLR       0x40000000      
27610 +  uint32        TimerCnt0;
27611 +  uint32        TimerCnt1;
27612 +  uint32        TimerCnt2;
27613 +  uint32        WatchDogDefCount;
27614 +
27615 +  /* Write 0xff00 0x00ff to Start timer
27616 +   * Write 0xee00 0x00ee to Stop and re-load default count
27617 +   * Read from this register returns current watch dog count
27618 +   */
27619 +  uint32        WatchDogCtl;
27620 +
27621 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
27622 +  uint32        WDResetCount;
27623 +} Timer;
27624 +
27625 +#define TIMER ((volatile Timer * const) TIMR_BASE)
27626 +
27627 +/*
27628 +** UART
27629 +*/
27630 +typedef struct UartChannel {
27631 +  byte          unused0;
27632 +  byte          control;
27633 +#define BRGEN           0x80    /* Control register bit defs */
27634 +#define TXEN            0x40
27635 +#define RXEN            0x20
27636 +#define LOOPBK          0x10
27637 +#define TXPARITYEN      0x08
27638 +#define TXPARITYEVEN    0x04
27639 +#define RXPARITYEN      0x02
27640 +#define RXPARITYEVEN    0x01
27641 +
27642 +  byte          config;
27643 +#define XMITBREAK       0x40
27644 +#define BITS5SYM        0x00
27645 +#define BITS6SYM        0x10
27646 +#define BITS7SYM        0x20
27647 +#define BITS8SYM        0x30
27648 +#define ONESTOP         0x07
27649 +#define TWOSTOP         0x0f
27650 +  /* 4-LSBS represent STOP bits/char
27651 +   * in 1/8 bit-time intervals.  Zero
27652 +   * represents 1/8 stop bit interval.
27653 +   * Fifteen represents 2 stop bits.
27654 +   */
27655 +  byte          fifoctl;
27656 +#define RSTTXFIFOS      0x80
27657 +#define RSTRXFIFOS      0x40
27658 +  /* 5-bit TimeoutCnt is in low bits of this register.
27659 +   *  This count represents the number of characters 
27660 +   *  idle times before setting receive Irq when below threshold
27661 +   */
27662 +  uint32        baudword;
27663 +  /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
27664 +   */
27665 +
27666 +  byte          txf_levl;       /* Read-only fifo depth */
27667 +  byte          rxf_levl;       /* Read-only fifo depth */
27668 +  byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
27669 +                                 *      RxThreshold.  Irq can be asserted
27670 +                                 *      when rx fifo> thresh, txfifo<thresh
27671 +                                 */
27672 +  byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
27673 +                                 *  if these bits are also enabled to GPIO_o
27674 +                                 */
27675 +#define        DTREN   0x01
27676 +#define        RTSEN   0x02
27677 +
27678 +  byte          unused1;
27679 +  byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
27680 +                                         * detect irq on rising AND falling 
27681 +                                         * edges for corresponding GPIO_i
27682 +                                         * if enabled (edge insensitive)
27683 +                                         */
27684 +  byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
27685 +                                         *      0 for negedge sense if
27686 +                                         *      not configured for edge
27687 +                                         *      insensitive (see above)
27688 +                                         * Lower 4 bits: Mask to enable change
27689 +                                         *  detection IRQ for corresponding
27690 +                                         *  GPIO_i
27691 +                                         */
27692 +  byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
27693 +                                         *  have changed (may set IRQ).
27694 +                                         *  read automatically clears bit
27695 +                                         * Lower 4 bits are actual status
27696 +                                         */
27697 +
27698 +  uint16        intMask;                               /* Same Bit defs for Mask and status */
27699 +  uint16        intStatus;
27700 +#define DELTAIP         0x0001
27701 +#define TXUNDERR        0x0002
27702 +#define TXOVFERR        0x0004
27703 +#define TXFIFOTHOLD     0x0008
27704 +#define TXREADLATCH     0x0010
27705 +#define TXFIFOEMT       0x0020
27706 +#define RXUNDERR        0x0040
27707 +#define RXOVFERR        0x0080
27708 +#define RXTIMEOUT       0x0100
27709 +#define RXFIFOFULL      0x0200
27710 +#define RXFIFOTHOLD     0x0400
27711 +#define RXFIFONE        0x0800
27712 +#define RXFRAMERR       0x1000
27713 +#define RXPARERR        0x2000
27714 +#define RXBRK           0x4000
27715 +
27716 +  uint16        unused2;
27717 +  uint16        Data;                   /* Write to TX, Read from RX */
27718 +                                        /* bits 11:8 are BRK,PAR,FRM errors */
27719 +
27720 +  uint32               unused3;
27721 +  uint32               unused4;
27722 +} Uart;
27723 +
27724 +#define UART ((volatile Uart * const) UART_BASE)
27725 +
27726 +/*
27727 +** Gpio Controller
27728 +*/
27729 +
27730 +typedef struct GpioControl {
27731 +  uint32        GPIODir_high; /* bits 36:32 */
27732 +  uint32        GPIODir;      /* bits 31:00 */
27733 +  uint32        GPIOio_high;  /* bits 36:32 */
27734 +  uint32        GPIOio;       /* bits 31:00 */
27735 +  uint32        LEDCtrl;
27736 +#define         LED3_STROBE             0x08000000
27737 +#define         LED2_STROBE             0x04000000
27738 +#define         LED1_STROBE             0x02000000
27739 +#define         LED0_STROBE             0x01000000
27740 +#define         LED_TEST                0x00010000
27741 +#define         LED3_DISABLE_LINK_ACT   0x00008000
27742 +#define         LED2_DISABLE_LINK_ACT   0x00004000
27743 +#define         LED1_DISABLE_LINK_ACT   0x00002000
27744 +#define         LED0_DISABLE_LINK_ACT   0x00001000
27745 +#define         LED_INTERVAL_SET_MASK   0x00000f00
27746 +#define         LED_INTERVAL_SET_320MS  0x00000500
27747 +#define         LED_INTERVAL_SET_160MS  0x00000400
27748 +#define         LED_INTERVAL_SET_80MS   0x00000300
27749 +#define         LED_INTERVAL_SET_40MS   0x00000200
27750 +#define         LED_INTERVAL_SET_20MS   0x00000100
27751 +#define         LED3_ON                 0x00000080
27752 +#define         LED2_ON                 0x00000040
27753 +#define         LED1_ON                 0x00000020
27754 +#define         LED0_ON                 0x00000010
27755 +#define         LED3_ENABLE             0x00000008
27756 +#define         LED2_ENABLE             0x00000004
27757 +#define         LED1_ENABLE             0x00000002
27758 +#define         LED0_ENABLE             0x00000001
27759 +  uint32        SpiSlaveCfg;
27760 +#define         SPI_SLAVE_RESET         0x00010000
27761 +#define         SPI_RESTRICT            0x00000400
27762 +#define         SPI_DELAY_DISABLE       0x00000200
27763 +#define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
27764 +#define         SPI_SER_ADDR_CFG_MASK   0x0000000c
27765 +#define         SPI_MODE                0x00000001
27766 +  uint32        GPIOMode;
27767 +#define         GROUP4_DIAG             0x00090000
27768 +#define         GROUP4_UTOPIA           0x00080000
27769 +#define         GROUP4_LEGACY_LED       0x00030000
27770 +#define         GROUP4_MII_SNOOP        0x00020000
27771 +#define         GROUP4_EXT_EPHY         0x00010000
27772 +#define         GROUP3_DIAG             0x00009000
27773 +#define         GROUP3_UTOPIA           0x00008000
27774 +#define         GROUP3_EXT_MII          0x00007000
27775 +#define         GROUP2_DIAG             0x00000900
27776 +#define         GROUP2_PCI              0x00000500
27777 +#define         GROUP1_DIAG             0x00000090
27778 +#define         GROUP1_UTOPIA           0x00000080
27779 +#define         GROUP1_SPI_UART         0x00000060
27780 +#define         GROUP1_SPI_MASTER       0x00000060
27781 +#define         GROUP1_MII_PCCARD       0x00000040
27782 +#define         GROUP1_MII_SNOOP        0x00000020
27783 +#define         GROUP1_EXT_EPHY         0x00000010
27784 +#define         GROUP0_DIAG             0x00000009
27785 +#define         GROUP0_EXT_MII          0x00000007
27786 +
27787 +} GpioControl;
27788 +
27789 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
27790 +
27791 +/* Number to mask conversion macro used for GPIODir and GPIOio */
27792 +#define GPIO_NUM_TOTAL_BITS_MASK        0x3f
27793 +#define GPIO_NUM_MAX_BITS_MASK          0x1f
27794 +#define GPIO_NUM_TO_MASK(X)             ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
27795 +
27796 +/* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
27797 +#define GPIO_NUM_MAX_BITS_MASK_HIGH     0x07
27798 +#define GPIO_NUM_TO_MASK_HIGH(X)        ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
27799 +
27800 +
27801 +/*
27802 +** Spi Controller
27803 +*/
27804 +
27805 +typedef struct SpiControl {
27806 +  uint16        spiCmd;                 /* (0x0): SPI command */
27807 +#define SPI_CMD_NOOP                    0
27808 +#define SPI_CMD_SOFT_RESET              1
27809 +#define SPI_CMD_HARD_RESET              2
27810 +#define SPI_CMD_START_IMMEDIATE         3
27811 +
27812 +#define SPI_CMD_COMMAND_SHIFT           0
27813 +#define SPI_CMD_DEVICE_ID_SHIFT         4
27814 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
27815 +#define SPI_CMD_ONE_BYTE_SHIFT          11
27816 +#define SPI_CMD_ONE_WIRE_SHIFT          12
27817 +#define SPI_DEV_ID_0                    0
27818 +#define SPI_DEV_ID_1                    1
27819 +#define SPI_DEV_ID_2                    2
27820 +#define SPI_DEV_ID_3                    3
27821 +
27822 +  byte          spiIntStatus;           /* (0x2): SPI interrupt status */
27823 +  byte          spiMaskIntStatus;       /* (0x3): SPI masked interrupt status */
27824 +
27825 +  byte          spiIntMask;             /* (0x4): SPI interrupt mask */
27826 +#define SPI_INTR_CMD_DONE               0x01
27827 +#define SPI_INTR_RX_OVERFLOW            0x02
27828 +#define SPI_INTR_INTR_TX_UNDERFLOW      0x04
27829 +#define SPI_INTR_TX_OVERFLOW            0x08
27830 +#define SPI_INTR_RX_UNDERFLOW           0x10
27831 +#define SPI_INTR_CLEAR_ALL              0x1f
27832 +
27833 +  byte          spiStatus;              /* (0x5): SPI status */
27834 +#define SPI_RX_EMPTY                    0x02
27835 +#define SPI_CMD_BUSY                    0x04
27836 +#define SPI_SERIAL_BUSY                 0x08
27837 +
27838 +  byte          spiClkCfg;              /* (0x6): SPI clock configuration */
27839 +#define SPI_CLK_0_391MHZ                1
27840 +#define SPI_CLK_0_781MHZ                2 /* default */
27841 +#define SPI_CLK_1_563MHZ                3
27842 +#define SPI_CLK_3_125MHZ                4
27843 +#define SPI_CLK_6_250MHZ                5
27844 +#define SPI_CLK_12_50MHZ                6
27845 +#define SPI_CLK_MASK                    0x07
27846 +#define SPI_SSOFFTIME_MASK              0x38
27847 +#define SPI_SSOFFTIME_SHIFT             3
27848 +#define SPI_BYTE_SWAP                   0x80
27849 +
27850 +  byte          spiFillByte;            /* (0x7): SPI fill byte */
27851 +
27852 +  byte          unused0; 
27853 +  byte          spiMsgTail;             /* (0x9): msgtail */
27854 +  byte          unused1; 
27855 +  byte          spiRxTail;              /* (0xB): rxtail */
27856 +
27857 +  uint32        unused2[13];            /* (0x0c - 0x3c) reserved */
27858 +
27859 +  byte          spiMsgCtl;              /* (0x40) control byte */
27860 +#define FULL_DUPLEX_RW                  0
27861 +#define HALF_DUPLEX_W                   1
27862 +#define HALF_DUPLEX_R                   2
27863 +#define SPI_MSG_TYPE_SHIFT              6
27864 +#define SPI_BYTE_CNT_SHIFT              0
27865 +  byte          spiMsgData[63];         /* (0x41 - 0x7f) msg data */
27866 +  byte          spiRxDataFifo[64];      /* (0x80 - 0xbf) rx data */
27867 +  byte          unused3[64];            /* (0xc0 - 0xff) reserved */
27868 +} SpiControl;
27869 +
27870 +#define SPI ((volatile SpiControl * const) SPI_BASE)
27871 +
27872 +#define IUDMA_MAX_CHANNELS      16
27873 +
27874 +/*
27875 +** DMA Channel Configuration (1 .. 16)
27876 +*/
27877 +typedef struct DmaChannelCfg {
27878 +  uint32        cfg;                    /* (00) assorted configuration */
27879 +#define         DMA_BURST_HALT  0x00000004  /* idle after finish current memory burst */
27880 +#define         DMA_PKT_HALT    0x00000002  /* idle after an EOP flag is detected */
27881 +#define         DMA_ENABLE  0x00000001      /* set to enable channel */
27882 +  uint32        intStat;                /* (04) interrupts control and status */
27883 +  uint32        intMask;                /* (08) interrupts mask */
27884 +#define         DMA_BUFF_DONE   0x00000001  /* buffer done */
27885 +#define         DMA_DONE        0x00000002  /* packet xfer complete */
27886 +#define         DMA_NO_DESC     0x00000004  /* no valid descriptors */
27887 +  uint32        maxBurst;               /* (0C) max burst length permitted */
27888 +} DmaChannelCfg;
27889 +
27890 +/*
27891 +** DMA State RAM (1 .. 16)
27892 +*/
27893 +typedef struct DmaStateRam {
27894 +  uint32        baseDescPtr;            /* (00) descriptor ring start address */
27895 +  uint32        state_data;             /* (04) state/bytes done/ring offset */
27896 +  uint32        desc_len_status;        /* (08) buffer descriptor status and len */
27897 +  uint32        desc_base_bufptr;       /* (0C) buffer descrpitor current processing */
27898 +} DmaStateRam;
27899 +
27900 +/*
27901 +** DMA Registers
27902 +*/
27903 +typedef struct DmaRegs {
27904 +#define DMA_MASTER_EN           0x00000001
27905 +#define DMA_FLOWC_CH1_EN        0x00000002
27906 +#define DMA_FLOWC_CH3_EN        0x00000004
27907 +#define DMA_NUM_CHS_MASK        0x0f000000
27908 +#define DMA_NUM_CHS_SHIFT       24
27909 +#define DMA_FLOWCTL_MASK        0x30000000
27910 +#define DMA_FLOWCTL_CH1         0x10000000
27911 +#define DMA_FLOWCTL_CH3         0x20000000
27912 +#define DMA_FLOWCTL_SHIFT       28
27913 +    uint32 controller_cfg;              /* (00) controller configuration */
27914 +
27915 +    // Flow control Ch1
27916 +    uint32 flowctl_ch1_thresh_lo;       /* (04) EMAC1 RX DMA channel */
27917 +    uint32 flowctl_ch1_thresh_hi;       /* (08) EMAC1 RX DMA channel */
27918 +    uint32 flowctl_ch1_alloc;           /* (0C) EMAC1 RX DMA channel */
27919 +#define DMA_BUF_ALLOC_FORCE     0x80000000
27920 +
27921 +    // Flow control Ch3
27922 +    uint32 flowctl_ch3_thresh_lo;       /* (10) EMAC2 RX DMA channel */
27923 +    uint32 flowctl_ch3_thresh_hi;       /* (14) EMAC2 RX DMA channel */
27924 +    uint32 flowctl_ch3_alloc;           /* (18) EMAC2 RX DMA channel */
27925 +
27926 +    // Unused words
27927 +    uint32 resv[57];
27928 +
27929 +    // Per channel registers/state ram
27930 +    DmaChannelCfg chcfg[IUDMA_MAX_CHANNELS]; /* (100) Channel configuration */
27931 +    union {
27932 +        DmaStateRam     s[IUDMA_MAX_CHANNELS];
27933 +        uint32          u32[4 * IUDMA_MAX_CHANNELS];
27934 +    } stram;                                /* (200) state ram */
27935 +} DmaRegs;
27936 +
27937 +/*
27938 +** DMA Buffer 
27939 +*/
27940 +typedef struct DmaDesc {
27941 +  uint16        length;                 /* in bytes of data in buffer */
27942 +#define          DMA_DESC_USEFPM    0x8000
27943 +#define          DMA_DESC_MULTICAST 0x4000
27944 +#define          DMA_DESC_BUFLENGTH 0x0fff
27945 +  uint16        status;                 /* buffer status */
27946 +#define          DMA_OWN        0x8000  /* cleared by DMA, set by SW */
27947 +#define          DMA_EOP        0x4000  /* last buffer in packet */
27948 +#define          DMA_SOP        0x2000  /* first buffer in packet */
27949 +#define          DMA_WRAP       0x1000  /* */
27950 +#define          DMA_APPEND_CRC 0x0100
27951 +
27952 +/* EMAC Descriptor Status definitions */
27953 +#define          EMAC_MISS      0x0080  /* framed address recognition failed (promiscuous) */
27954 +#define          EMAC_BRDCAST   0x0040  /* DA is Broadcast */
27955 +#define          EMAC_MULT      0x0020  /* DA is multicast */
27956 +#define          EMAC_LG        0x0010  /* frame length > RX_LENGTH register value */
27957 +#define          EMAC_NO        0x0008  /* Non-Octet aligned */
27958 +#define          EMAC_RXER      0x0004  /* RX_ERR on MII while RX_DV assereted */
27959 +#define          EMAC_CRC_ERROR 0x0002  /* CRC error */
27960 +#define          EMAC_OV        0x0001  /* Overflow */
27961 +
27962 +/* HDLC Descriptor Status definitions */
27963 +#define          DMA_HDLC_TX_ABORT      0x0100
27964 +#define          DMA_HDLC_RX_OVERRUN    0x4000
27965 +#define          DMA_HDLC_RX_TOO_LONG   0x2000
27966 +#define          DMA_HDLC_RX_CRC_OK     0x1000
27967 +#define          DMA_HDLC_RX_ABORT      0x0100
27968 +
27969 +  uint32        address;                /* address of data */
27970 +} DmaDesc;
27971 +
27972 +/*
27973 +** Sdram Controller
27974 +*/
27975 +typedef struct SdramControllerRegs {
27976 +  uint16        unused1;
27977 +  uint16        initControl;    /* 02 */
27978 +#define SD_POWER_DOWN           0x200   /* put sdram into power down */
27979 +#define SD_SELF_REFRESH         0x100   /* enable self refresh mode */
27980 +#define SD_SOFT_RESET           0x080   /* soft reset all sdram controller regs */
27981 +#define SD_EDO_SELECT           0x040   /* select EDO mode */
27982 +#define SD_EDO_WAIT_STATE       0x020   /* add an EDO wait state */
27983 +#define SD_8MEG                 0x010   /* map sdram to 8 megs */
27984 +#define SD_MASTER_ENABLE        0x008   /* enable accesses to external sdram */
27985 +#define SD_MRS                  0x004   /* generate a mode register select cycle */
27986 +#define SD_PRECHARGE            0x002   /* generate a precharge cycle */
27987 +#define SD_CBR                  0x001   /* generate a refresh cycle */
27988 +  uint8         unused2[3];
27989 +  uint8         config;         /* 07 */
27990 +#define SD_FAST_MEM             0x04    /* 1=CAS latency of 2, 0 = CAS latency of 3 */
27991 +#define SD_BURST_LEN            0x03    /* set burst length */
27992 +#define SD_BURST_FULL_PAGE      0x00    /* .. full page */
27993 +#define SD_BURST_8              0x01    /* .. 8 words */
27994 +#define SD_BURST_4              0x02    /* .. 4 words */
27995 +#define SD_BURST_2              0x03    /* .. 2 words */
27996 +  uint16        unused3;
27997 +  uint16        refreshControl; /* 0a */
27998 +#define SD_REFRESH_ENABLE       0x8000  /* refresh enable */
27999 +#define SD_REFRESH_PERIOD       0x00ff  /* refresh period (16 x n x clock_period) */
28000 +
28001 +  uint32        memoryBase;     /* 0c */
28002 +#define SD_MEMBASE_MASK         0xffffe000      /* base address mask */
28003 +#define SD_MEMSIZE_8MEG         0x00000001      /* memory is 8 meg */
28004 +#define SD_MEMSIZE_2MEG         0x00000001      /* memory is 2 meg */
28005 +
28006 +} SdramControllerRegs;
28007 +
28008 +/*
28009 +** External Bus Interface
28010 +*/
28011 +typedef struct EbiChipSelect {
28012 +  uint32        base;                   /* base address in upper 24 bits */
28013 +#define EBI_SIZE_8K         0
28014 +#define EBI_SIZE_16K        1
28015 +#define EBI_SIZE_32K        2
28016 +#define EBI_SIZE_64K        3
28017 +#define EBI_SIZE_128K       4
28018 +#define EBI_SIZE_256K       5
28019 +#define EBI_SIZE_512K       6
28020 +#define EBI_SIZE_1M         7
28021 +#define EBI_SIZE_2M         8
28022 +#define EBI_SIZE_4M         9
28023 +#define EBI_SIZE_8M         10
28024 +#define EBI_SIZE_16M        11
28025 +#define EBI_SIZE_32M        12
28026 +#define EBI_SIZE_64M        13
28027 +#define EBI_SIZE_128M       14
28028 +#define EBI_SIZE_256M       15
28029 +  uint32        config;
28030 +#define EBI_ENABLE          0x00000001      /* .. enable this range */
28031 +#define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
28032 +#define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
28033 +#define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
28034 +#define EBI_WREN            0x00000020      /* enable posted writes */
28035 +#define EBI_POLARITY        0x00000040      /* .. set to invert something, 
28036 +                                        **    don't know what yet */
28037 +#define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
28038 +#define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
28039 +#define EBI_FIFO            0x00000200      /* .. use fifo */
28040 +#define EBI_RE              0x00000400      /* .. Reverse Endian */
28041 +} EbiChipSelect;
28042 +
28043 +typedef struct MpiRegisters {
28044 +  EbiChipSelect cs[7];                  /* size chip select configuration */
28045 +#define EBI_CS0_BASE            0
28046 +#define EBI_CS1_BASE            1
28047 +#define EBI_CS2_BASE            2
28048 +#define EBI_CS3_BASE            3
28049 +#define PCMCIA_COMMON_BASE      4
28050 +#define PCMCIA_ATTRIBUTE_BASE   5
28051 +#define PCMCIA_IO_BASE          6
28052 +  uint32        unused0[2];             /* reserved */
28053 +  uint32        ebi_control;            /* ebi control */
28054 +  uint32        unused1[4];             /* reserved */
28055 +#define EBI_ACCESS_TIMEOUT      0x000007FF
28056 +  uint32        pcmcia_cntl1;           /* pcmcia control 1 */
28057 +#define PCCARD_CARD_RESET       0x00040000
28058 +#define CARDBUS_ENABLE          0x00008000
28059 +#define PCMCIA_ENABLE           0x00004000
28060 +#define PCMCIA_GPIO_ENABLE      0x00002000
28061 +#define CARDBUS_IDSEL           0x00001F00
28062 +#define VS2_OEN                 0x00000080
28063 +#define VS1_OEN                 0x00000040
28064 +#define VS2_OUT                 0x00000020
28065 +#define VS1_OUT                 0x00000010
28066 +#define VS2_IN                  0x00000008
28067 +#define VS1_IN                  0x00000004
28068 +#define CD2_IN                  0x00000002
28069 +#define CD1_IN                  0x00000001
28070 +#define VS_MASK                 0x0000000C
28071 +#define CD_MASK                 0x00000003
28072 +  uint32        unused2;                /* reserved */
28073 +  uint32        pcmcia_cntl2;           /* pcmcia control 2 */
28074 +#define PCMCIA_BYTESWAP_DIS     0x00000002
28075 +#define PCMCIA_HALFWORD_EN      0x00000001
28076 +  uint32        unused3[40];            /* reserved */
28077 +
28078 +  uint32        sp0range;               /* PCI to internal system bus address space */
28079 +#define ADDR_SPACE_MASK         0xFFFF0000
28080 +  uint32        sp0remap;
28081 +  uint32        sp0cfg;
28082 +  uint32        sp1range;
28083 +  uint32        sp1remap;
28084 +  uint32        sp1cfg;
28085 +
28086 +  uint32        EndianCfg;
28087 +
28088 +  uint32        l2pcfgctl;              /* internal system bus to PCI IO/Cfg control */
28089 +#define DIR_CFG_SEL             0x80000000 /* change from PCI I/O access to PCI config access */
28090 +#define DIR_CFG_USEREG          0x40000000 /* use this register info for PCI configuration access */
28091 +#define DEVICE_NUMBER           0x00007C00 /* device number for the PCI configuration access */
28092 +#define FUNC_NUMBER             0x00000300 /* function number for the PCI configuration access */
28093 +#define REG_NUMBER              0x000000FC /* register number for the PCI configuration access */
28094 +#define CONFIG_TYPE             0x00000003 /* configuration type for the PCI configuration access */
28095 +
28096 +  uint32        l2pmrange1;             /* internal system bus to PCI memory space */
28097 +#define PCI_SIZE_64K            0xFFFF0000
28098 +#define PCI_SIZE_128K           0xFFFE0000
28099 +#define PCI_SIZE_256K           0xFFFC0000
28100 +#define PCI_SIZE_512K           0xFFF80000
28101 +#define PCI_SIZE_1M             0xFFF00000
28102 +#define PCI_SIZE_2M             0xFFE00000
28103 +#define PCI_SIZE_4M             0xFFC00000
28104 +#define PCI_SIZE_8M             0xFF800000
28105 +#define PCI_SIZE_16M            0xFF000000
28106 +  uint32        l2pmbase1;              /* kseg0 or kseg1 address & 0x1FFFFFFF */
28107 +  uint32        l2pmremap1;
28108 +#define CARDBUS_MEM             0x00000004
28109 +#define MEM_WINDOW_EN           0x00000001
28110 +  uint32        l2pmrange2;
28111 +  uint32        l2pmbase2;
28112 +  uint32        l2pmremap2;
28113 +  uint32        l2piorange;             /* internal system bus to PCI I/O space */
28114 +  uint32        l2piobase;
28115 +  uint32        l2pioremap;
28116 +
28117 +  uint32        pcimodesel;
28118 +#define PCI2_INT_BUS_RD_PREFECH 0x000000F0
28119 +#define PCI_BAR2_NOSWAP         0x00000002 /* BAR at offset 0x20 */
28120 +#define PCI_BAR1_NOSWAP         0x00000001 /* BAR at affset 0x1c */
28121 +
28122 +  uint32        pciintstat;             /* PCI interrupt mask/status */
28123 +#define MAILBOX1_SENT           0x08
28124 +#define MAILBOX0_SENT           0x04
28125 +#define MAILBOX1_MSG_RCV        0x02
28126 +#define MAILBOX0_MSG_RCV        0x01
28127 +  uint32        locbuscntrl;            /* internal system bus control */
28128 +#define DIR_U2P_NOSWAP          0x00000002
28129 +#define EN_PCI_GPIO             0x00000001
28130 +  uint32        locintstat;             /* internal system bus interrupt mask/status */
28131 +#define CSERR                   0x0200
28132 +#define SERR                    0x0100
28133 +#define EXT_PCI_INT             0x0080
28134 +#define DIR_FAILED              0x0040
28135 +#define DIR_COMPLETE            0x0020
28136 +#define PCI_CFG                 0x0010
28137 +  uint32        unused4[7];
28138 +
28139 +  uint32        mailbox0;
28140 +  uint32        mailbox1;
28141 +
28142 +  uint32        pcicfgcntrl;            /* internal system bus PCI configuration control */
28143 +#define PCI_CFG_REG_WRITE_EN    0x00000080
28144 +#define PCI_CFG_ADDR            0x0000003C
28145 +  uint32        pcicfgdata;             /* internal system bus PCI configuration data */
28146 +
28147 +  uint32        locch2ctl;              /* PCI to interrnal system bus DMA (downstream) local control */
28148 +#define MPI_DMA_HALT            0x00000008  /* idle after finish current memory burst */
28149 +#define MPI_DMA_PKT_HALT        0x00000004  /* idle after an EOP flag is detected */
28150 +#define MPI_DMA_STALL           0x00000002  /* idle after an EOP flag is detected */
28151 +#define MPI_DMA_ENABLE          0x00000001  /* set to enable channel */
28152 +  uint32        locch2intStat;
28153 +#define MPI_DMA_NO_DESC         0x00000004  /* no valid descriptors */
28154 +#define MPI_DMA_DONE            0x00000002  /* packet xfer complete */
28155 +#define MPI_DMA_BUFF_DONE       0x00000001  /* buffer done */
28156 +  uint32        locch2intMask;
28157 +  uint32        unused5;
28158 +  uint32        locch2descaddr;
28159 +  uint32        locch2status1;
28160 +#define LOCAL_DESC_STATE        0xE0000000
28161 +#define PCI_DESC_STATE          0x1C000000
28162 +#define BYTE_DONE               0x03FFC000
28163 +#define RING_ADDR               0x00003FFF
28164 +  uint32        locch2status2;
28165 +#define BUFPTR_OFFSET           0x1FFF0000
28166 +#define PCI_MASTER_STATE        0x000000C0
28167 +#define LOC_MASTER_STATE        0x00000038
28168 +#define CONTROL_STATE           0x00000007
28169 +  uint32        unused6;
28170 +
28171 +  uint32        locch1Ctl;              /*internal system bus to PCI DMA (upstream) local control */
28172 +#define DMA_U2P_LE              0x00000200  /* local bus is little endian */
28173 +#define DMA_U2P_NOSWAP          0x00000100  /* lccal bus is little endian but no data swapped */
28174 +  uint32        locch1intstat;
28175 +  uint32        locch1intmask;
28176 +  uint32        unused7;
28177 +  uint32        locch1descaddr;
28178 +  uint32        locch1status1;
28179 +  uint32        locch1status2;
28180 +  uint32        unused8;
28181 +
28182 +  uint32        pcich1ctl;              /* internal system bus to PCI DMA PCI control */
28183 +  uint32        pcich1intstat;
28184 +  uint32        pcich1intmask;
28185 +  uint32        pcich1descaddr;
28186 +  uint32        pcich1status1;
28187 +  uint32        pcich1status2;
28188 +
28189 +  uint32        pcich2Ctl;              /* PCI to internal system bus DMA PCI control */
28190 +  uint32        pcich2intstat;
28191 +  uint32        pcich2intmask;
28192 +  uint32        pcich2descaddr;
28193 +  uint32        pcich2status1;
28194 +  uint32        pcich2status2;
28195 +
28196 +  uint32        perm_id;                /* permanent device and vendor id */
28197 +  uint32        perm_rev;               /* permanent revision id */
28198 +} MpiRegisters;
28199 +
28200 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
28201 +
28202 +/* PCI configuration address space start offset 0x40 */
28203 +#define BRCM_PCI_CONFIG_TIMER               0x40
28204 +#define BRCM_PCI_CONFIG_TIMER_RETRY_MASK    0x0000FF00
28205 +#define BRCM_PCI_CONFIG_TIMER_TRDY_MASK     0x000000FF
28206 +
28207 +/*
28208 +** EMAC transmit MIB counters
28209 +*/
28210 +typedef struct EmacTxMib {
28211 +  uint32        tx_good_octets;         /* (200) good byte count */
28212 +  uint32        tx_good_pkts;           /* (204) good pkt count */
28213 +  uint32        tx_octets;              /* (208) good and bad byte count */
28214 +  uint32        tx_pkts;                /* (20c) good and bad pkt count */
28215 +  uint32        tx_broadcasts_pkts;     /* (210) good broadcast packets */
28216 +  uint32        tx_multicasts_pkts;     /* (214) good mulitcast packets */
28217 +  uint32        tx_len_64;              /* (218) RMON tx pkt size buckets */
28218 +  uint32        tx_len_65_to_127;       /* (21c) */
28219 +  uint32        tx_len_128_to_255;      /* (220) */
28220 +  uint32        tx_len_256_to_511;      /* (224) */
28221 +  uint32        tx_len_512_to_1023;     /* (228) */
28222 +  uint32        tx_len_1024_to_max;     /* (22c) */
28223 +  uint32        tx_jabber_pkts;         /* (230) > 1518 with bad crc */
28224 +  uint32        tx_oversize_pkts;       /* (234) > 1518 with good crc */
28225 +  uint32        tx_fragment_pkts;       /* (238) < 63   with bad crc */
28226 +  uint32        tx_underruns;           /* (23c) fifo underrun */
28227 +  uint32        tx_total_cols;          /* (240) total collisions in all tx pkts */
28228 +  uint32        tx_single_cols;         /* (244) tx pkts with single collisions */
28229 +  uint32        tx_multiple_cols;       /* (248) tx pkts with multiple collisions */
28230 +  uint32        tx_excessive_cols;      /* (24c) tx pkts with excessive cols */
28231 +  uint32        tx_late_cols;           /* (250) tx pkts with late cols */
28232 +  uint32        tx_defered;             /* (254) tx pkts deferred */
28233 +  uint32        tx_carrier_lost;        /* (258) tx pkts with CRS lost */
28234 +  uint32        tx_pause_pkts;          /* (25c) tx pause pkts sent */
28235 +#define NumEmacTxMibVars        24
28236 +} EmacTxMib;
28237 +
28238 +/*
28239 +** EMAC receive MIB counters
28240 +*/
28241 +typedef struct EmacRxMib {
28242 +  uint32        rx_good_octets;         /* (280) good byte count */
28243 +  uint32        rx_good_pkts;           /* (284) good pkt count */
28244 +  uint32        rx_octets;              /* (288) good and bad byte count */
28245 +  uint32        rx_pkts;                /* (28c) good and bad pkt count */
28246 +  uint32        rx_broadcasts_pkts;     /* (290) good broadcast packets */
28247 +  uint32        rx_multicasts_pkts;     /* (294) good mulitcast packets */
28248 +  uint32        rx_len_64;              /* (298) RMON rx pkt size buckets */
28249 +  uint32        rx_len_65_to_127;       /* (29c) */
28250 +  uint32        rx_len_128_to_255;      /* (2a0) */
28251 +  uint32        rx_len_256_to_511;      /* (2a4) */
28252 +  uint32        rx_len_512_to_1023;     /* (2a8) */
28253 +  uint32        rx_len_1024_to_max;     /* (2ac) */
28254 +  uint32        rx_jabber_pkts;         /* (2b0) > 1518 with bad crc */
28255 +  uint32        rx_oversize_pkts;       /* (2b4) > 1518 with good crc */
28256 +  uint32        rx_fragment_pkts;       /* (2b8) < 63   with bad crc */
28257 +  uint32        rx_missed_pkts;         /* (2bc) missed packets */
28258 +  uint32        rx_crc_align_errs;      /* (2c0) both or either */
28259 +  uint32        rx_undersize;           /* (2c4) < 63   with good crc */
28260 +  uint32        rx_crc_errs;            /* (2c8) crc errors (only) */
28261 +  uint32        rx_align_errs;          /* (2cc) alignment errors (only) */
28262 +  uint32        rx_symbol_errs;         /* (2d0) pkts with RXERR assertions (symbol errs) */
28263 +  uint32        rx_pause_pkts;          /* (2d4) MAC control, PAUSE */
28264 +  uint32        rx_nonpause_pkts;       /* (2d8) MAC control, not PAUSE */
28265 +#define NumEmacRxMibVars        23
28266 +} EmacRxMib;
28267 +
28268 +typedef struct EmacRegisters {
28269 +  uint32        rxControl;              /* (00) receive control */
28270 +#define          EMAC_PM_REJ    0x80    /*      - reject DA match in PMx regs */
28271 +#define          EMAC_UNIFLOW   0x40    /*      - accept cam match fc */
28272 +#define          EMAC_FC_EN     0x20    /*      - enable flow control */
28273 +#define          EMAC_LOOPBACK  0x10    /*      - loopback */
28274 +#define          EMAC_PROM      0x08    /*      - promiscuous */
28275 +#define          EMAC_RDT       0x04    /*      - ignore transmissions */
28276 +#define          EMAC_ALL_MCAST 0x02    /*      - ignore transmissions */
28277 +#define          EMAC_NO_BCAST  0x01    /*      - ignore transmissions */
28278 +
28279 +
28280 +  uint32        rxMaxLength;            /* (04) receive max length */
28281 +  uint32        txMaxLength;            /* (08) transmit max length */
28282 +  uint32        unused1[1];
28283 +  uint32        mdioFreq;               /* (10) mdio frequency */
28284 +#define          EMAC_MII_PRE_EN 0x00000080 /* prepend preamble sequence */
28285 +#define          EMAC_MDIO_PRE   0x00000080 /*      - enable MDIO preamble */
28286 +#define          EMAC_MDC_FREQ   0x0000007f /*      - mdio frequency */
28287 +
28288 +  uint32        mdioData;               /* (14) mdio data */
28289 +#define          MDIO_WR        0x50020000 /*   - write framing */
28290 +#define          MDIO_RD        0x60020000 /*   - read framing */
28291 +#define          MDIO_PMD_SHIFT  23
28292 +#define          MDIO_REG_SHIFT  18
28293 +
28294 +  uint32        intMask;                /* (18) int mask */
28295 +  uint32        intStatus;              /* (1c) int status */
28296 +#define          EMAC_FLOW_INT  0x04    /*      - flow control event */
28297 +#define          EMAC_MIB_INT   0x02    /*      - mib event */
28298 +#define          EMAC_MDIO_INT  0x01    /*      - mdio event */
28299 +
28300 +  uint32        unused2[3];
28301 +  uint32        config;                 /* (2c) config */
28302 +#define          EMAC_ENABLE    0x001   /*      - enable emac */
28303 +#define          EMAC_DISABLE   0x002   /*      - disable emac */
28304 +#define          EMAC_SOFT_RST  0x004   /*      - soft reset */
28305 +#define          EMAC_SOFT_RESET 0x004  /*      - emac soft reset */
28306 +#define          EMAC_EXT_PHY   0x008   /*      - external PHY select */
28307 +
28308 +  uint32        txControl;              /* (30) transmit control */
28309 +#define          EMAC_FD        0x001   /*      - full duplex */
28310 +#define          EMAC_FLOWMODE  0x002   /*      - flow mode */
28311 +#define          EMAC_NOBKOFF   0x004   /*      - no backoff in  */
28312 +#define          EMAC_SMALLSLT  0x008   /*      - small slot time */
28313 +
28314 +  uint32        txThreshold;            /* (34) transmit threshold */
28315 +  uint32        mibControl;             /* (38) mib control */
28316 +#define          EMAC_NO_CLEAR  0x001   /* don't clear on read */
28317 +
28318 +  uint32        unused3[7];
28319 +
28320 +  uint32        pm0DataLo;              /* (58) perfect match 0 data lo */
28321 +  uint32        pm0DataHi;              /* (5C) perfect match 0 data hi (15:0) */
28322 +  uint32        pm1DataLo;              /* (60) perfect match 1 data lo */
28323 +  uint32        pm1DataHi;              /* (64) perfect match 1 data hi (15:0) */
28324 +  uint32        pm2DataLo;              /* (68) perfect match 2 data lo */
28325 +  uint32        pm2DataHi;              /* (6C) perfect match 2 data hi (15:0) */
28326 +  uint32        pm3DataLo;              /* (70) perfect match 3 data lo */
28327 +  uint32        pm3DataHi;              /* (74) perfect match 3 data hi (15:0) */
28328 +#define          EMAC_CAM_V   0x10000  /*      - cam index */
28329 +#define          EMAC_CAM_VALID 0x00010000
28330 +
28331 +  uint32        unused4[98];            /* (78-1fc) */
28332 +
28333 +  EmacTxMib     tx_mib;                 /* (200) emac tx mib */
28334 +  uint32        unused5[8];             /* (260-27c) */
28335 +
28336 +  EmacRxMib     rx_mib;                 /* (280) rx mib */
28337 +
28338 +} EmacRegisters;
28339 +
28340 +/* register offsets for subrouting access */
28341 +#define EMAC_RX_CONTROL         0x00
28342 +#define EMAC_RX_MAX_LENGTH      0x04
28343 +#define EMAC_TX_MAC_LENGTH      0x08
28344 +#define EMAC_MDIO_FREQ          0x10
28345 +#define EMAC_MDIO_DATA          0x14
28346 +#define EMAC_INT_MASK           0x18
28347 +#define EMAC_INT_STATUS         0x1C
28348 +#define EMAC_CAM_DATA_LO        0x20
28349 +#define EMAC_CAM_DATA_HI        0x24
28350 +#define EMAC_CAM_CONTROL        0x28
28351 +#define EMAC_CONTROL            0x2C
28352 +#define EMAC_TX_CONTROL         0x30
28353 +#define EMAC_TX_THRESHOLD       0x34
28354 +#define EMAC_MIB_CONTROL        0x38
28355 +
28356 +
28357 +#define EMAC1 ((volatile EmacRegisters * const) EMAC1_BASE)
28358 +#define EMAC2 ((volatile EmacRegisters * const) EMAC2_BASE)
28359 +
28360 +/*
28361 +** USB Registers
28362 +*/
28363 +typedef struct UsbRegisters {
28364 +    byte inttf_setting;
28365 +    byte current_config;
28366 +    uint16 status_frameNum;
28367 +#define USB_LINK        0x2000 
28368 +#define USB_BUS_RESET   0x1000 
28369 +#define USB_SUSPENDED   0x0800 
28370 +    byte unused1;
28371 +    byte endpt_prnt;
28372 +    byte endpt_dirn;
28373 +    byte endpt_status;
28374 +#define USB_ENDPOINT_0  0x01
28375 +#define USB_ENDPOINT_1  0x02
28376 +#define USB_ENDPOINT_2  0x04
28377 +#define USB_ENDPOINT_3  0x08
28378 +#define USB_ENDPOINT_4  0x10
28379 +#define USB_ENDPOINT_5  0x20
28380 +#define USB_ENDPOINT_6  0x40
28381 +#define USB_ENDPOINT_7  0x80
28382 +    uint32 unused2;
28383 +    byte conf_mem_ctl;
28384 +#define USB_CONF_MEM_RD     0x80
28385 +#define USB_CONF_MEM_RDY    0x40
28386 +    byte unused2a;
28387 +    byte conf_mem_read_address;
28388 +    byte conf_mem_write_address;
28389 +
28390 +    byte unused3;
28391 +    byte dev_req_bytesel;
28392 +    uint16 ext_dev_data;
28393 +
28394 +    byte unused4;
28395 +    byte clr_fifo;
28396 +    byte endpt_stall_reset;  // use same endpoint #'s from above
28397 +    byte usb_cntl;
28398 +#define USB_FORCE_ERR       0x20
28399 +#define USB_SOFT_RESET      0x10
28400 +#define USB_RESUME          0x08
28401 +#define USB_COMMAND_ERR     0x04
28402 +#define USB_COMMAND_OVER    0x02
28403 +    byte irq_addr;
28404 +    byte iso_out_in_addr;
28405 +    byte blk_out_in_addr;
28406 +    byte cntl_addr;
28407 +    uint32 unusedx[2];
28408 +    uint32 tx_ram_write_port;
28409 +    uint32 fifo_status;  // (see bcm6348 data sheet for definition)
28410 +
28411 +    uint32 irq_status;
28412 +    uint32 irq_mask;
28413 +#define USB_NEW_CONFIG              0x00000001   
28414 +#define USB_SETUP_COMMAND_RECV      0x00000002 // non-standard setup cmd rcvd
28415 +#define USB_OUT_FIFO_OV             0x00000004   
28416 +#define USB_RESET_RECV              0x00000008   
28417 +#define USB_SUSPEND_RECV            0x00000010   
28418 +#define USB_FIFO_REWIND             0x00000020   
28419 +#define USB_RX_BULK_FIFO_DATA_AVAIL 0x00000040   
28420 +#define USB_RX_ISO_FIFO_DATA_AVAIL  0x00000080   
28421 +#define USB_LINK_CHANGE             0x00010000   
28422 +    uint32 endpt_cntl;
28423 +#define USB_R_WK_EN                 0x0100   
28424 +#define USB_TX_EOP                  0x0200   
28425 +#define USB_TX_CNTL_DMA_EN          0x0400
28426 +#define USB_TX_BULK_DMA_EN          0x0800
28427 +#define USB_TX_ISO_DMA_EN           0x1000
28428 +#define USB_RX_CNTL_DMA_EN          0x2000
28429 +#define USB_RX_BULK_DMA_EN          0x4800
28430 +#define USB_RX_ISO_DMA_EN           0x8000
28431 +    uint32 rx_status_read_port;
28432 +    uint32 confmem_read_port;
28433 +    uint32 confmem_write_port;
28434 +    uint32 fifo_ovf_count;
28435 +    uint32 fifo_rewind_cnt;
28436 +    uint32 terminal_count;
28437 +} UsbRegisters;
28438 +
28439 +#define USB ((volatile UsbRegisters * const) USB_CTL_BASE)
28440 +
28441 +/*
28442 +** ADSL core Registers
28443 +*/
28444 +
28445 +#define        _PADLINE(line)  pad ## line
28446 +#define        _XSTR(line)     _PADLINE(line)
28447 +#define        PAD             _XSTR(__LINE__)
28448 +
28449 +typedef struct AdslRegisters {
28450 +    uint32 core_control;
28451 +#define ADSL_RESET             0x01
28452 +   
28453 +    uint32 core_status;
28454 +#define ADSL_HOST_MSG  0x01
28455 +
28456 +    uint32 PAD;
28457 +    uint32 bist_status;
28458 +    uint32 PAD[4];
28459 +    uint32 int_status_i; /* 0x20 */
28460 +    uint32 int_mask_i;
28461 +    uint32 int_status_f;
28462 +    uint32 int_mask_f;
28463 +#define ADSL_INT_HOST_MSG              0x00000020
28464 +#define ADSL_INT_DESC_ERR              0x00000400
28465 +#define ADSL_INT_DATA_ERR              0x00000800
28466 +#define ADSL_INT_DESC_PROTO_ERR        0x00001000
28467 +#define ADSL_INT_RCV_DESC_UF   0x00002000
28468 +#define ADSL_INT_RCV_FIFO_OF   0x00004000
28469 +#define ADSL_INT_XMT_FIFO_UF   0x00008000
28470 +#define ADSL_INT_RCV                   0x00010000
28471 +#define ADSL_INT_XMT                   0x01000000
28472 +
28473 +    uint32 PAD[116];
28474 +
28475 +       uint32  xmtcontrol_intr; /* 0x200 */
28476 +#define ADSL_DMA_XMT_EN                        0x00000001
28477 +#define ADSL_DMA_XMT_LE                        0x00000004
28478 +       uint32  xmtaddr_intr;
28479 +#define ADSL_DMA_ADDR_MASK             0xFFFFF000
28480 +       uint32  xmtptr_intr;
28481 +#define ADSL_DMA_LAST_DESC_MASK        0x00000FFF
28482 +       uint32  xmtstatus_intr;
28483 +#define ADSL_DMA_CURR_DESC_MASK        0x00000FFF
28484 +#define ADSL_DMA_XMT_STATE_MASK        0x0000F000
28485 +#define ADSL_DMA_XMT_STATE_DIS 0x00000000
28486 +#define ADSL_DMA_XMT_STATE_ACT 0x00001000
28487 +#define ADSL_DMA_XMT_STATE_IDLE        0x00002000
28488 +#define ADSL_DMA_XMT_STATE_STOP        0x00003000
28489 +
28490 +#define ADSL_DMA_XMT_ERR_MASK  0x000F0000
28491 +#define ADSL_DMA_XMT_ERR_NONE  0x00000000
28492 +#define ADSL_DMA_XMT_ERR_DPE   0x00010000
28493 +#define ADSL_DMA_XMT_ERR_FIFO  0x00020000
28494 +#define ADSL_DMA_XMT_ERR_DTE   0x00030000
28495 +#define ADSL_DMA_XMT_ERR_DRE   0x00040000
28496 +
28497 +       uint32  rcvcontrol_intr;
28498 +#define ADSL_DMA_RCV_EN                        0x00000001
28499 +#define ADSL_DMA_RCV_FO                        0x000000FE
28500 +       uint32  rcvaddr_intr;
28501 +       uint32  rcvptr_intr;
28502 +       uint32  rcvstatus_intr;
28503 +#define ADSL_DMA_RCV_STATE_MASK        0x0000F000
28504 +#define ADSL_DMA_RCV_STATE_DIS 0x00000000
28505 +#define ADSL_DMA_RCV_STATE_ACT 0x00001000
28506 +#define ADSL_DMA_RCV_STATE_IDLE        0x00002000
28507 +#define ADSL_DMA_RCV_STATE_STOP        0x00003000
28508 +
28509 +#define ADSL_DMA_RCV_ERR_MASK  0x000F0000
28510 +#define ADSL_DMA_RCV_ERR_NONE  0x00000000
28511 +#define ADSL_DMA_RCV_ERR_DPE   0x00010000
28512 +#define ADSL_DMA_RCV_ERR_FIFO  0x00020000
28513 +#define ADSL_DMA_RCV_ERR_DTE   0x00030000
28514 +#define ADSL_DMA_RCV_ERR_DRE   0x00040000
28515 +
28516 +       uint32  xmtcontrol_fast;
28517 +       uint32  xmtaddr_fast;
28518 +       uint32  xmtptr_fast;
28519 +       uint32  xmtstatus_fast;
28520 +       uint32  rcvcontrol_fast;
28521 +       uint32  rcvaddr_fast;
28522 +       uint32  rcvptr_fast;
28523 +       uint32  rcvstatus_fast;
28524 +       uint32  PAD[48];
28525 +
28526 +       uint32  host_message; /* 0x300 */
28527 +       uint32  PAD[805];
28528 +    uint32 core_reset;
28529 +    uint32 core_error;
28530 +    uint32 core_revision;
28531 +
28532 +#define        ADSL_CORE_REV                   0x0000000F
28533 +#define        ADSL_CORE_TYPE                  0x0000FFF0
28534 +} AdslRegisters;
28535 +
28536 +#define ADSL ((volatile AdslRegisters * const) ADSL_BASE)
28537 +
28538 +#if __cplusplus
28539 +}
28540 +#endif
28541 +
28542 +#endif
28543 +
28544 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/AdslMibDef.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/AdslMibDef.h
28545 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/AdslMibDef.h     1970-01-01 01:00:00.000000000 +0100
28546 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/AdslMibDef.h    2006-06-26 09:07:10.000000000 +0200
28547 @@ -0,0 +1,712 @@
28548 +/*
28549 +<:copyright-broadcom 
28550
28551 + Copyright (c) 2002 Broadcom Corporation 
28552 + All Rights Reserved 
28553 + No portions of this material may be reproduced in any form without the 
28554 + written permission of: 
28555 +          Broadcom Corporation 
28556 +          16215 Alton Parkway 
28557 +          Irvine, California 92619 
28558 + All information contained in this document is Broadcom Corporation 
28559 + company private, proprietary, and trade secret. 
28560
28561 +:>
28562 +*/
28563 +/****************************************************************************
28564 + *
28565 + * AdslMibOid.h 
28566 + *
28567 + * Description:
28568 + *     SNMP object identifiers for ADSL MIB and other related MIBs
28569 + *
28570 + * Copyright (c) 1993-1998 AltoCom, Inc. All rights reserved.
28571 + * Authors: Ilya Stomakhin
28572 + *
28573 + * $Revision: 1.17 $
28574 + *
28575 + * $Id: AdslMibDef.h,v 1.17 2004/07/27 19:24:40 ilyas Exp $
28576 + *
28577 + * $Log: AdslMibDef.h,v $
28578 + * Revision 1.17  2004/07/27 19:24:40  ilyas
28579 + * Added AnnexM configuration option
28580 + *
28581 + * Revision 1.16  2004/06/04 18:56:01  ilyas
28582 + * Added counter for ADSL2 framing and performance
28583 + *
28584 + * Revision 1.15  2004/05/25 16:15:04  ilyas
28585 + * Added ADSL2 framing status
28586 + *
28587 + * Revision 1.14  2004/03/31 19:09:48  ilyas
28588 + * Added ADSL2+ modulation control
28589 + *
28590 + * Revision 1.13  2004/03/03 20:14:05  ilyas
28591 + * Merged changes for ADSL2+ from ADSL driver
28592 + *
28593 + * Revision 1.12  2003/10/17 21:02:12  ilyas
28594 + * Added more data for ADSL2
28595 + *
28596 + * Revision 1.11  2003/10/14 00:55:27  ilyas
28597 + * Added UAS, LOSS, SES error seconds counters.
28598 + * Support for 512 tones (AnnexI)
28599 + *
28600 + * Revision 1.10  2003/09/29 18:39:51  ilyas
28601 + * Added new definitions for AnnexI
28602 + *
28603 + * Revision 1.9  2003/07/18 19:14:34  ilyas
28604 + * Merged with ADSL driver
28605 + *
28606 + * Revision 1.8  2003/07/08 18:34:16  ilyas
28607 + * Added fields to adsl configuration structure
28608 + *
28609 + * Revision 1.7  2003/03/25 00:07:00  ilyas
28610 + * Added "long" BERT supprt
28611 + *
28612 + * Revision 1.6  2003/02/27 07:10:52  ilyas
28613 + * Added more configuration and status parameters (for EFNT)
28614 + *
28615 + * Revision 1.5  2003/01/23 20:29:37  ilyas
28616 + * Added structure for ADSL PHY configuration command
28617 + *
28618 + * Revision 1.4  2002/11/13 21:32:49  ilyas
28619 + * Added adjustK support for Centillium non-standard framing mode
28620 + *
28621 + * Revision 1.3  2002/10/31 01:35:50  ilyas
28622 + * Fixed size of K for S=1/2
28623 + *
28624 + * Revision 1.2  2002/10/05 03:28:31  ilyas
28625 + * Added extra definitions for Linux and VxWorks drivers.
28626 + * Added definitions for SelfTest support
28627 + *
28628 + * Revision 1.1  2002/07/20 00:51:41  ilyas
28629 + * Merged witchanges made for VxWorks/Linux driver.
28630 + *
28631 + * Revision 1.1  2001/12/21 22:39:30  ilyas
28632 + * Added support for ADSL MIB data objects (RFC2662)
28633 + *
28634 + *
28635 + *****************************************************************************/
28636 +
28637 +#ifndef        AdslMibDefHeader
28638 +#define        AdslMibDefHeader
28639 +
28640 +#if defined(__cplusplus)
28641 +extern "C" {
28642 +#endif
28643 +
28644 +/* 
28645 +**
28646 +**             ADSL configuration parameters 
28647 +**
28648 +*/
28649 +
28650 +#define kAdslCfgModMask                                                (0x00000007 | 0x0000F000)
28651 +#define kAdslCfgModAny                                         0x00000000
28652 +
28653 +#define kAdslCfgModGdmtOnly                                    0x00000001
28654 +#define kAdslCfgModGliteOnly                           0x00000002
28655 +#define kAdslCfgModT1413Only                           0x00000004
28656 +#define kAdslCfgModAnnexIOnly                          0x00000004
28657 +#define kAdslCfgModAdsl2Only                           0x00001000
28658 +#define kAdslCfgModAdsl2pOnly                          0x00002000
28659 +
28660 +#define kAdslCfgBitmapMask                                     0x00000018
28661 +#define kAdslCfgDBM                                                    0x00000000
28662 +#define kAdslCfgFBM                                                    0x00000008
28663 +#define kAdslCfgFBMSoL                                         0x00000010
28664 +
28665 +#define kAdslCfgLinePairMask                           0x00000020
28666 +#define kAdslCfgLineInnerPair                          0x00000000
28667 +#define kAdslCfgLineOuterPair                          0x00000020
28668 +
28669 +#define kAdslCfgCentilliumCRCWorkAroundMask                    0x00000040
28670 +#define kAdslCfgCentilliumCRCWorkAroundDisabled                0x00000000
28671 +#define kAdslCfgCentilliumCRCWorkAroundEnabled         0x00000040
28672 +
28673 +#define kAdslCfgExtraData                                      0x00000080
28674 +#define kAdslCfgTrellisMask                                    (0x00000100 | kAdslCfgExtraData)
28675 +#define kAdslCfgTrellisOn                                      (0x00000100 | kAdslCfgExtraData)
28676 +#define kAdslCfgTrellisOff                                     (0 | kAdslCfgExtraData)
28677 +#define kAdslCfgExtraMask                                      0xFFFFFF80
28678 +
28679 +#define kAdslCfgLOSMonitoringMask                      0x00000200
28680 +#define kAdslCfgLOSMonitoringOff                       0x00000200
28681 +#define kAdslCfgLOSMonitoringOn                                0x00000000
28682 +
28683 +#define kAdslCfgMarginMonitoringMask           0x00000400
28684 +#define kAdslCfgMarginMonitoringOn                     0x00000400
28685 +#define kAdslCfgMarginMonitoringOff                    0x00000000
28686 +
28687 +#define kAdslCfgDemodCapMask                           0x00000800
28688 +#define kAdslCfgDemodCapOn                                     0x00000800
28689 +#define kAdslCfgDemodCapOff                                    0x00000000
28690 +
28691 +/* Flags 0x00001000 - 0x00008000 are reserved for modulation (see above) */
28692 +
28693 +/* Upstream mode flags 0x00010000 - 0x00030000 */
28694 +
28695 +#define kAdslCfgUpstreamModeMask                       0x00030000
28696 +#define kAdslCfgUpstreamMax                                    0x00000000
28697 +#define kAdslCfgUpstreamSingle                         0x00010000
28698 +#define kAdslCfgUpstreamDouble                         0x00020000
28699 +#define kAdslCfgUpstreamTriple                         0x00030000
28700 +
28701 +#define kAdslCfgNoSpectrumOverlap                      0x00040000
28702 +
28703 +/* Pwm sync clock configuration */
28704 +
28705 +#define kAdslCfgPwmSyncClockMask                       0x00080000
28706 +#define kAdslCfgPwmSyncClockOn                         0x00080000
28707 +#define kAdslCfgPwmSyncClockOff                                0x00000000
28708 +
28709 +#define kAdslCfgDefaultTrainingMargin          -1
28710 +#define kAdslCfgDefaultShowtimeMargin          -1
28711 +#define kAdslCfgDefaultLOMTimeThld                     -1
28712 +
28713 +/* ADSL2 parameters */
28714 +
28715 +#define kAdsl2CfgReachExOn                                     0x00000001
28716 +#define kAdsl2CfgAnnexMEnabled                         0x00000002
28717 +
28718 +typedef struct _adslCfgProfile {
28719 +       long            adslAnnexCParam;
28720 +       long            adslAnnexAParam;
28721 +       long            adslTrainingMarginQ4;
28722 +       long            adslShowtimeMarginQ4;
28723 +       long            adslLOMTimeThldSec;
28724 +       long            adslDemodCapMask;
28725 +       long            adslDemodCapValue;
28726 +       long            adsl2Param;
28727 +       long            adslPwmSyncClockFreq;
28728 +} adslCfgProfile;
28729 +
28730 +/* 
28731 +**
28732 +**             ADSL PHY configuration
28733 +**
28734 +*/
28735 +
28736 +typedef struct _adslPhyCfg {
28737 +       long            demodCapMask;
28738 +       long            demodCap;
28739 +} adslPhyCfg;
28740 +
28741 +/* 
28742 +**
28743 +**             ADSL version info parameters 
28744 +**
28745 +*/
28746 +
28747 +#define        kAdslVersionStringSize                          32
28748 +
28749 +#define        kAdslTypeUnknown                                        0
28750 +#define        kAdslTypeAnnexA                                         1
28751 +#define        kAdslTypeAnnexB                                         2
28752 +#define        kAdslTypeAnnexC                                         3
28753 +#define        kAdslTypeSADSL                                          4
28754 +
28755 +typedef struct _adslVersionInfo {
28756 +       unsigned short  phyType;
28757 +       unsigned short  phyMjVerNum;
28758 +       unsigned short  phyMnVerNum;
28759 +       char                    phyVerStr[kAdslVersionStringSize];
28760 +       unsigned short  drvMjVerNum;
28761 +       unsigned short  drvMnVerNum;
28762 +       char                    drvVerStr[kAdslVersionStringSize];
28763 +} adslVersionInfo;
28764 +
28765 +/* 
28766 +**
28767 +**             ADSL self-test parameters 
28768 +**
28769 +*/
28770 +
28771 +#define kAdslSelfTestLMEM                                      0x00000001
28772 +#define kAdslSelfTestSDRAM                                     0x00000002
28773 +#define kAdslSelfTestAFE                                       0x00000004
28774 +#define kAdslSelfTestQproc                                     0x00000008
28775 +#define kAdslSelfTestRS                                                0x00000010
28776 +#define kAdslSelfTestHostDma                           0x00000020
28777 +
28778 +#define kAdslSelfTestAll                                       ((kAdslSelfTestHostDma - 1) | kAdslSelfTestHostDma)
28779 +
28780 +#define kAdslSelfTestInProgress                                0x40000000
28781 +#define kAdslSelfTestCompleted                         0x80000000
28782 +
28783 +/* MIB OID's for ADSL objects */
28784 +
28785 +#define kOidMaxObjLen                                          80
28786 +
28787 +#define kOidAdsl                                                       94
28788 +#define kOidAdslInterleave                                     124
28789 +#define kOidAdslFast                                           125
28790 +#define kOidAtm                                                                37
28791 +#define kOidAdslPrivate                                                255
28792 +#define kOidAdslPrivatePartial                         254
28793 +
28794 +#define kAdslMibAnnexAToneNum                          256
28795 +#define kAdslMibToneNum                                                kAdslMibAnnexAToneNum
28796 +#define kAdslMibMaxToneNum                                     kAdslMibAnnexAToneNum*2*2
28797 +
28798 +#define kOidAdslPrivSNR                                                1
28799 +#define kOidAdslPrivBitAlloc                           2
28800 +#define kOidAdslPrivGain                                       3
28801 +#define kOidAdslPrivShowtimeMargin                     4
28802 +#define kOidAdslPrivChanCharLin                                5
28803 +#define kOidAdslPrivChanCharLog                                6
28804 +#define kOidAdslPrivQuietLineNoise                     7
28805 +#define kOidAdslPrivExtraInfo                          255
28806 +
28807 +#define kOidAdslLine                                           1
28808 +#define kOidAdslMibObjects                                     1
28809 +
28810 +#define kOidAdslLineTable                                      1
28811 +#define kOidAdslLineEntry                                      1
28812 +#define kOidAdslLineCoding                                     1
28813 +#define kOidAdslLineType                                       2
28814 +#define kOidAdslLineSpecific                       3
28815 +#define kOidAdslLineConfProfile                                4
28816 +#define kOidAdslLineAlarmConfProfile           5
28817 +
28818 +#define kOidAdslAtucPhysTable                          2
28819 +#define kOidAdslAturPhysTable                          3
28820 +#define kOidAdslPhysEntry                                      1
28821 +#define kOidAdslPhysInvSerialNumber            1
28822 +#define kOidAdslPhysInvVendorID             2
28823 +#define kOidAdslPhysInvVersionNumber           3
28824 +#define kOidAdslPhysCurrSnrMgn                 4
28825 +#define kOidAdslPhysCurrAtn                    5
28826 +#define kOidAdslPhysCurrStatus                 6
28827 +#define kOidAdslPhysCurrOutputPwr              7
28828 +#define kOidAdslPhysCurrAttainableRate         8
28829 +
28830 +#define kOidAdslAtucChanTable                          4
28831 +#define kOidAdslAturChanTable                          5
28832 +#define kOidAdslChanEntry                                      1
28833 +#define kOidAdslChanInterleaveDelay                    1
28834 +#define kOidAdslChanCurrTxRate                         2
28835 +#define kOidAdslChanPrevTxRate                 3
28836 +#define kOidAdslChanCrcBlockLength             4
28837 +
28838 +#define kOidAdslAtucPerfDataTable                      6
28839 +#define kOidAdslAturPerfDataTable                      7
28840 +#define kOidAdslPerfDataEntry                          1
28841 +#define kOidAdslPerfLofs                       1
28842 +#define kOidAdslPerfLoss                       2
28843 +#define kOidAdslPerfLprs                       3
28844 +#define kOidAdslPerfESs                        4
28845 +#define kOidAdslPerfValidIntervals          5
28846 +#define kOidAdslPerfInvalidIntervals           6
28847 +#define kOidAdslPerfCurr15MinTimeElapsed       7
28848 +#define kOidAdslPerfCurr15MinLofs              8
28849 +#define kOidAdslPerfCurr15MinLoss              9
28850 +#define kOidAdslPerfCurr15MinLprs              10
28851 +#define kOidAdslPerfCurr15MinESs               11
28852 +#define kOidAdslPerfCurr1DayTimeElapsed     12
28853 +#define kOidAdslPerfCurr1DayLofs               13
28854 +#define kOidAdslPerfCurr1DayLoss               14
28855 +#define kOidAdslPerfCurr1DayLprs               15
28856 +#define kOidAdslPerfCurr1DayESs                16
28857 +#define kOidAdslPerfPrev1DayMoniSecs           17
28858 +#define kOidAdslPerfPrev1DayLofs               18
28859 +#define kOidAdslPerfPrev1DayLoss            19
28860 +#define kOidAdslPerfPrev1DayLprs               20
28861 +#define kOidAdslPerfPrev1DayESs                21
28862 +
28863 +#define kOidAdslAtucPerfIntervalTable          8
28864 +#define kOidAdslAturPerfIntervalTable          9
28865 +#define kOidAdslPerfIntervalEntry                      1
28866 +#define kOidAdslIntervalNumber                         1
28867 +#define kOidAdslIntervalLofs                           2
28868 +#define kOidAdslIntervalLoss                           3
28869 +#define kOidAdslIntervalLprs                           4
28870 +#define kOidAdslIntervalESs                                    5
28871 +#define kOidAdslIntervalValidData                      6
28872 +
28873 +#define kOidAdslAtucChanPerfTable                                      10
28874 +#define kOidAdslAturChanPerfTable                                      11
28875 +#define kOidAdslChanPerfEntry                                          1
28876 +#define kOidAdslChanReceivedBlks                       1
28877 +#define kOidAdslChanTransmittedBlks                    2
28878 +#define kOidAdslChanCorrectedBlks                      3
28879 +#define kOidAdslChanUncorrectBlks                      4
28880 +#define kOidAdslChanPerfValidIntervals                 5
28881 +#define kOidAdslChanPerfInvalidIntervals               6
28882 +#define kOidAdslChanPerfCurr15MinTimeElapsed           7
28883 +#define kOidAdslChanPerfCurr15MinReceivedBlks          8
28884 +#define kOidAdslChanPerfCurr15MinTransmittedBlks       9
28885 +#define kOidAdslChanPerfCurr15MinCorrectedBlks         10
28886 +#define kOidAdslChanPerfCurr15MinUncorrectBlks         11
28887 +#define kOidAdslChanPerfCurr1DayTimeElapsed            12
28888 +#define kOidAdslChanPerfCurr1DayReceivedBlks           13
28889 +#define kOidAdslChanPerfCurr1DayTransmittedBlks        14
28890 +#define kOidAdslChanPerfCurr1DayCorrectedBlks          15
28891 +#define kOidAdslChanPerfCurr1DayUncorrectBlks          16
28892 +#define kOidAdslChanPerfPrev1DayMoniSecs               17
28893 +#define kOidAdslChanPerfPrev1DayReceivedBlks           18
28894 +#define kOidAdslChanPerfPrev1DayTransmittedBlks        19
28895 +#define kOidAdslChanPerfPrev1DayCorrectedBlks          20
28896 +#define kOidAdslChanPerfPrev1DayUncorrectBlks          21
28897 +
28898 +#define kOidAdslAtucChanIntervalTable                          12
28899 +#define kOidAdslAturChanIntervalTable                          13
28900 +#define kOidAdslChanIntervalEntry                                      1
28901 +#define kOidAdslChanIntervalNumber                                     1
28902 +#define kOidAdslChanIntervalReceivedBlks               2
28903 +#define kOidAdslChanIntervalTransmittedBlks            3
28904 +#define kOidAdslChanIntervalCorrectedBlks              4
28905 +#define kOidAdslChanIntervalUncorrectBlks              5
28906 +#define kOidAdslChanIntervalValidData                  6
28907 +
28908 +#define kOidAtmMibObjects              1
28909 +#define kOidAtmTcTable                 4
28910 +#define kOidAtmTcEntry                 1
28911 +#define kOidAtmOcdEvents               1
28912 +#define kOidAtmAlarmState              2
28913 +
28914 +/* Adsl Channel coding */
28915 +
28916 +#define        kAdslRcvDir                     0
28917 +#define        kAdslXmtDir                     1
28918 +
28919 +#define        kAdslRcvActive          (1 << kAdslRcvDir)
28920 +#define        kAdslXmtActive          (1 << kAdslXmtDir)
28921 +
28922 +#define        kAdslIntlChannel        0
28923 +#define        kAdslFastChannel        1
28924 +
28925 +#define        kAdslTrellisOff         0
28926 +#define        kAdslTrellisOn          1
28927 +
28928 +/* AnnexC modulation and bitmap types for the field (adslConnection.modType) */
28929 +
28930 +#define kAdslModMask           0x7
28931 +
28932 +#define        kAdslModGdmt            0
28933 +#define        kAdslModT1413           1
28934 +#define        kAdslModGlite           2
28935 +#define kAdslModAnnexI         3
28936 +#define kAdslModAdsl2          4
28937 +#define kAdslModAdsl2p         5
28938 +#define kAdslModReAdsl2                6
28939 +
28940 +#define kAdslBitmapShift       3
28941 +#define kAdslBitmapMask                kAdslCfgBitmapMask
28942 +#define kAdslDBM                   (0 << kAdslBitmapShift)
28943 +#define kAdslFBM                   (1 << kAdslBitmapShift)
28944 +#define kAdslFBMSoL                    (2 << kAdslBitmapShift)
28945 +
28946 +#define kAdslUpstreamModeShift         5
28947 +#define kAdslUpstreamModeMask          (3 << kAdslUpstreamModeShift)
28948 +#define kAdslUpstreamModeSingle                (0 << kAdslUpstreamModeShift)
28949 +#define kAdslUpstreamModeDouble                (1 << kAdslUpstreamModeShift)
28950 +#define kAdslUpstreamModeTriple                (2 << kAdslUpstreamModeShift)
28951 +
28952 +/* AdslLineCodingType definitions */
28953 +
28954 +#define kAdslLineCodingOther           1
28955 +#define kAdslLineCodingDMT                     2
28956 +#define kAdslLineCodingCAP                     3
28957 +#define kAdslLineCodingQAM                     4
28958 +
28959 +/* AdslLineType definitions */
28960 +
28961 +#define kAdslLineTypeNoChannel         1
28962 +#define kAdslLineTypeFastOnly          2
28963 +#define kAdslLineTypeIntlOnly          3
28964 +#define kAdslLineTypeFastOrIntl                4
28965 +#define kAdslLineTypeFastAndIntl       5
28966 +
28967 +typedef struct _adslLineEntry {
28968 +       unsigned char   adslLineCoding;
28969 +       unsigned char   adslLineType;
28970 +} adslLineEntry;
28971 +
28972 +
28973 +/* AdslPhys status definitions */
28974 +
28975 +#define kAdslPhysStatusNoDefect                (1 << 0)
28976 +#define kAdslPhysStatusLOF                     (1 << 1)        /* lossOfFraming (not receiving valid frame) */
28977 +#define kAdslPhysStatusLOS                     (1 << 2)        /* lossOfSignal (not receiving signal) */
28978 +#define kAdslPhysStatusLPR                     (1 << 3)        /* lossOfPower */
28979 +#define kAdslPhysStatusLOSQ                    (1 << 4)        /* lossOfSignalQuality */
28980 +#define kAdslPhysStatusLOM                     (1 << 5)        /* lossOfMargin */
28981 +
28982 +typedef struct _adslPhysEntry {
28983 +       long            adslCurrSnrMgn;
28984 +       long            adslCurrAtn;
28985 +       long            adslCurrStatus;
28986 +       long            adslCurrOutputPwr;
28987 +       long            adslCurrAttainableRate;
28988 +} adslPhysEntry;
28989 +
28990 +#define kAdslPhysVendorIdLen           8
28991 +#define kAdslPhysSerialNumLen          32
28992 +#define kAdslPhysVersionNumLen         32
28993 +
28994 +typedef struct _adslFullPhysEntry {
28995 +       char            adslSerialNumber[kAdslPhysSerialNumLen];
28996 +       char            adslVendorID[kAdslPhysVendorIdLen];
28997 +       char            adslVersionNumber[kAdslPhysVersionNumLen];
28998 +       long            adslCurrSnrMgn;
28999 +       long            adslCurrAtn;
29000 +       long            adslCurrStatus;
29001 +       long            adslCurrOutputPwr;
29002 +       long            adslCurrAttainableRate;
29003 +} adslFullPhysEntry;
29004 +
29005 +/* Adsl channel entry definitions */
29006 +
29007 +typedef struct _adslChanEntry {
29008 +    unsigned long              adslChanIntlDelay;
29009 +       unsigned long           adslChanCurrTxRate;
29010 +       unsigned long           adslChanPrevTxRate;
29011 +       unsigned long           adslChanCrcBlockLength;
29012 +} adslChanEntry;
29013 +
29014 +/* Adsl performance data definitions */
29015 +
29016 +typedef struct _adslPerfCounters {
29017 +       unsigned long           adslLofs;
29018 +       unsigned long           adslLoss;
29019 +       unsigned long           adslLols;       /* Loss of Link failures (ATUC only) */
29020 +       unsigned long           adslLprs;
29021 +       unsigned long           adslESs;        /* Count of Errored Seconds */
29022 +       unsigned long           adslInits;      /* Count of Line initialization attempts (ATUC only) */
29023 +       unsigned long           adslUAS;        /* Count of Unavailable Seconds */
29024 +       unsigned long           adslSES;        /* Count of Severely Errored Seconds */
29025 +       unsigned long           adslLOSS;       /* Count of LOS seconds */
29026 +       unsigned long           adslFECs;       /* Count of FEC seconds  */
29027 +} adslPerfCounters;
29028 +
29029 +typedef struct _adslPerfDataEntry {
29030 +       adslPerfCounters        perfTotal;
29031 +       unsigned long                           adslPerfValidIntervals;
29032 +       unsigned long                           adslPerfInvalidIntervals;
29033 +       adslPerfCounters        perfCurr15Min;
29034 +       unsigned long                           adslPerfCurr15MinTimeElapsed;
29035 +       adslPerfCounters        perfCurr1Day;
29036 +       unsigned long                           adslPerfCurr1DayTimeElapsed;
29037 +       adslPerfCounters        perfPrev1Day;
29038 +       unsigned long                           adslAturPerfPrev1DayMoniSecs;
29039 +} adslPerfDataEntry;
29040 +
29041 +#define kAdslMibPerfIntervals          4
29042 +
29043 +/* Adsl channel performance data definitions */
29044 +
29045 +typedef struct _adslChanCounters {
29046 +       unsigned long           adslChanReceivedBlks;
29047 +       unsigned long           adslChanTransmittedBlks;
29048 +       unsigned long           adslChanCorrectedBlks;
29049 +       unsigned long           adslChanUncorrectBlks;
29050 +} adslChanCounters;
29051 +
29052 +typedef struct _adslChanPerfDataEntry {
29053 +       adslChanCounters        perfTotal;
29054 +       unsigned long                           adslChanPerfValidIntervals;
29055 +       unsigned long                           adslChanPerfInvalidIntervals;
29056 +       adslChanCounters        perfCurr15Min;
29057 +       unsigned long                           adslPerfCurr15MinTimeElapsed;
29058 +       adslChanCounters        perfCurr1Day;
29059 +       unsigned long                           adslPerfCurr1DayTimeElapsed;
29060 +       adslChanCounters        perfPrev1Day;
29061 +       unsigned long                           adslAturPerfPrev1DayMoniSecs;
29062 +} adslChanPerfDataEntry;
29063 +
29064 +#define kAdslMibChanPerfIntervals      4
29065 +
29066 +/* Adsl trap threshold definitions */
29067 +
29068 +#define        kAdslEventLinkChange            0x001
29069 +#define        kAdslEventRateChange            0x002
29070 +#define        kAdslEventLofThresh                     0x004
29071 +#define        kAdslEventLosThresh                     0x008
29072 +#define        kAdslEventLprThresh                     0x010
29073 +#define        kAdslEventESThresh                      0x020
29074 +#define        kAdslEventFastUpThresh          0x040
29075 +#define        kAdslEventIntlUpThresh          0x080
29076 +#define        kAdslEventFastDownThresh        0x100
29077 +#define        kAdslEventIntlDwonThresh        0x200
29078 +
29079 +typedef struct _adslThreshCounters {
29080 +       unsigned long           adslThreshLofs;
29081 +       unsigned long           adslThreshLoss;
29082 +       unsigned long           adslThreshLols; /* Loss of Link failures (ATUC only) */
29083 +       unsigned long           adslThreshLprs;
29084 +       unsigned long           adslThreshESs;
29085 +       unsigned long           adslThreshFastRateUp;
29086 +       unsigned long           adslThreshIntlRateUp;
29087 +       unsigned long           adslThreshFastRateDown;
29088 +       unsigned long           adslThreshIntlRateDown;
29089 +} adslThreshCounters;
29090 +
29091 +
29092 +/* Atm PHY performance data definitions */
29093 +
29094 +#define        kAtmPhyStateNoAlarm                     1
29095 +#define        kAtmPhyStateLcdFailure          2
29096 +
29097 +typedef struct _atmPhyDataEntrty {
29098 +       unsigned long           atmInterfaceOCDEvents;
29099 +       unsigned long           atmInterfaceTCAlarmState;
29100 +} atmPhyDataEntrty;
29101 +
29102 +typedef struct _adslBertResults {
29103 +       unsigned long           bertTotalBits;
29104 +       unsigned long           bertErrBits;
29105 +} adslBertResults;
29106 +
29107 +typedef struct {
29108 +       unsigned long           cntHi;
29109 +       unsigned long           cntLo;
29110 +} cnt64;
29111 +
29112 +typedef struct _adslBertStatusEx {
29113 +       unsigned long           bertSecTotal;
29114 +       unsigned long           bertSecElapsed;
29115 +       unsigned long           bertSecCur;
29116 +       cnt64                           bertTotalBits;
29117 +       cnt64                           bertErrBits;
29118 +} adslBertStatusEx;
29119 +
29120 +typedef struct _adslDataConnectionInfo {
29121 +       unsigned short          K;
29122 +       unsigned char           S, R, D;
29123 +} adslDataConnectionInfo;
29124 +
29125 +typedef struct _adslConnectionInfo {
29126 +       unsigned char                   chType;                         /* fast or interleaved */
29127 +       unsigned char                   modType;                        /* modulation type: G.DMT or T1.413 */
29128 +       unsigned char                   trellisCoding;          /* off(0) or on(1) */
29129 +       adslDataConnectionInfo  rcvInfo;
29130 +       adslDataConnectionInfo  xmtInfo;
29131 +} adslConnectionInfo;
29132 +
29133 +typedef struct _adsl2DataConnectionInfo {
29134 +       unsigned char           Nlp;
29135 +       unsigned char           Nbc;
29136 +       unsigned char           MSGlp;
29137 +       unsigned short          MSGc;
29138 +
29139 +       unsigned long           L;
29140 +       unsigned short          M;
29141 +       unsigned short          T;
29142 +       unsigned short          D;
29143 +       unsigned short          R;
29144 +       unsigned short          B;
29145 +} adsl2DataConnectionInfo;
29146 +
29147 +typedef struct _adsl2ConnectionInfo {
29148 +       long                                    adsl2Mode;
29149 +       long                                    rcvRate;
29150 +       long                                    xmtRate;
29151 +       unsigned char                   pwrState;                       /* Lx state: x = 0..3 */
29152 +       adsl2DataConnectionInfo rcv2Info;
29153 +       adsl2DataConnectionInfo xmt2Info;
29154 +} adsl2ConnectionInfo;
29155 +
29156 +typedef struct _adslConnectionDataStat {
29157 +       unsigned long                   cntRS;  
29158 +       unsigned long                   cntRSCor;       
29159 +       unsigned long                   cntRSUncor;     
29160 +       unsigned long                   cntSF;  
29161 +       unsigned long                   cntSFErr;       
29162 +} adslConnectionDataStat;
29163 +
29164 +typedef struct _adslConnectionStat {
29165 +       adslConnectionDataStat  rcvStat;
29166 +       adslConnectionDataStat  xmtStat;
29167 +} adslConnectionStat;
29168 +
29169 +typedef struct _atmConnectionDataStat {
29170 +       unsigned long                   cntHEC;
29171 +       unsigned long                   cntOCD;
29172 +       unsigned long                   cntLCD;
29173 +       unsigned long                   cntES;
29174 +       unsigned long                   cntCellTotal;
29175 +       unsigned long                   cntCellData;
29176 +       unsigned long                   cntCellDrop;
29177 +       unsigned long                   cntBitErrs;
29178 +} atmConnectionDataStat;
29179 +
29180 +typedef struct _atmConnectionStat {
29181 +       atmConnectionDataStat   rcvStat;
29182 +       atmConnectionDataStat   xmtStat;
29183 +} atmConnectionStat;
29184 +
29185 +#define        kAdslFramingModeMask                    0x0F
29186 +#define        kAtmFramingModeMask                             0xF0
29187 +#define        kAtmHeaderCompression                   0x80
29188 +
29189 +/* ADSL2 data */
29190 +
29191 +typedef struct _adslDiagModeData {
29192 +       long                                    loopAttn;
29193 +       long                                    signalAttn;
29194 +       long                                    snrMargin;
29195 +       long                                    attnDataRate;
29196 +       long                                    actXmtPower;
29197 +       long                                    hlinScaleFactor;
29198 +} adslDiagModeData;
29199 +
29200 +/* AdslMibGetObjectValue return codes */
29201 +
29202 +#define        kAdslMibStatusSuccess                   0
29203 +#define        kAdslMibStatusFailure                   -1
29204 +#define        kAdslMibStatusNoObject                  -2
29205 +#define        kAdslMibStatusObjectInvalid             -3
29206 +#define        kAdslMibStatusBufferTooSmall    -4
29207 +#define        kAdslMibStatusLastError                 -4
29208 +
29209 +/* Adsl training codes */
29210 +
29211 +#define        kAdslTrainingIdle                               0
29212 +#define        kAdslTrainingG994                               1
29213 +#define        kAdslTrainingG992Started                2
29214 +#define        kAdslTrainingG992ChanAnalysis   3
29215 +#define        kAdslTrainingG992Exchange               4
29216 +#define        kAdslTrainingConnected                  5
29217 +
29218 +/* Global info structure */
29219 +
29220 +typedef struct _adslMibInfo {
29221 +       adslLineEntry                   adslLine;
29222 +       adslPhysEntry                   adslPhys;
29223 +       adslChanEntry                   adslChanIntl;
29224 +       adslChanEntry                   adslChanFast;
29225 +       adslPerfDataEntry               adslPerfData;
29226 +       adslPerfCounters                adslPerfIntervals[kAdslMibPerfIntervals];
29227 +       adslChanPerfDataEntry   adslChanIntlPerfData;
29228 +       adslChanPerfDataEntry   adslChanFastPerfData;
29229 +       adslChanCounters                adslChanIntlPerfIntervals[kAdslMibChanPerfIntervals];
29230 +       adslChanCounters                adslChanFastPerfIntervals[kAdslMibChanPerfIntervals];
29231 +
29232 +       adslThreshCounters              adslAlarm;
29233 +
29234 +       atmPhyDataEntrty                adslChanIntlAtmPhyData;
29235 +       atmPhyDataEntrty                adslChanFastAtmPhyData;
29236 +
29237 +       adslBertResults                 adslBertRes;
29238 +
29239 +       adslConnectionInfo              adslConnection;
29240 +       adslConnectionStat              adslStat;
29241 +       unsigned char                   adslTrainingState;
29242 +       atmConnectionStat               atmStat;
29243 +
29244 +       adslFullPhysEntry               adslAtucPhys;
29245 +       unsigned char                   adslRxNonStdFramingAdjustK;
29246 +       unsigned char                   adslFramingMode;
29247 +       adslBertStatusEx                adslBertStatus;
29248 +       long                                    afeRxPgaGainQ1;
29249 +
29250 +       adslDiagModeData                adslDiag;
29251 +       adsl2ConnectionInfo             adsl2Info;
29252 +       adslPerfCounters                adslTxPerfTotal;
29253 +} adslMibInfo;
29254 +
29255 +#if defined(__cplusplus)
29256 +}
29257 +#endif
29258 +
29259 +#endif /* AdslMibDefHeader */
29260 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/DiagDef.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/DiagDef.h
29261 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/DiagDef.h        1970-01-01 01:00:00.000000000 +0100
29262 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/DiagDef.h       2006-06-26 09:07:10.000000000 +0200
29263 @@ -0,0 +1,209 @@
29264 +/*
29265 +<:copyright-broadcom 
29266
29267 + Copyright (c) 2002 Broadcom Corporation 
29268 + All Rights Reserved 
29269 + No portions of this material may be reproduced in any form without the 
29270 + written permission of: 
29271 +          Broadcom Corporation 
29272 +          16215 Alton Parkway 
29273 +          Irvine, California 92619 
29274 + All information contained in this document is Broadcom Corporation 
29275 + company private, proprietary, and trade secret. 
29276
29277 +:>
29278 +*/
29279 +
29280 +/*******************************************************************
29281 + * DiagDef.h
29282 + *
29283 + *     Description:
29284 + *             Diag definitions
29285 + *
29286 + * $Revision: 1.22 $
29287 + *
29288 + * $Id: DiagDef.h,v 1.22 2004/10/16 23:43:19 ilyas Exp $
29289 + *
29290 + * $Log: DiagDef.h,v $
29291 + * Revision 1.22  2004/10/16 23:43:19  ilyas
29292 + * Added playback resume command
29293 + *
29294 + * Revision 1.21  2004/10/16 23:24:08  ilyas
29295 + * Improved FileRead command support for LOG file playback (RecordTest on the board)
29296 + *
29297 + * Revision 1.20  2004/04/28 16:52:32  ilyas
29298 + * Added GDB frame processing
29299 + *
29300 + * Revision 1.19  2004/03/10 22:26:53  ilyas
29301 + * Added command-line parameter for IP port number.
29302 + * Added proxy remote termination
29303 + *
29304 + * Revision 1.18  2004/01/24 23:41:37  ilyas
29305 + * Added DIAG_DEBUG_CMD_LOG_SAMPLES debug command
29306 + *
29307 + * Revision 1.17  2003/11/19 02:25:45  ilyas
29308 + * Added definitions for LOG frame retransmission, time, ADSL2 plots
29309 + *
29310 + * Revision 1.16  2003/11/14 18:46:05  ilyas
29311 + * Added G992p3 debug commands
29312 + *
29313 + * Revision 1.15  2003/10/02 19:50:41  ilyas
29314 + * Added support for buffering data for AnnexI and statistical counters
29315 + *
29316 + * Revision 1.14  2003/09/03 19:45:11  ilyas
29317 + * To refuse connection with older protocol versions
29318 + *
29319 + * Revision 1.13  2003/08/30 00:12:39  ilyas
29320 + * Added support for running chip test regressions via DslDiags
29321 + *
29322 + * Revision 1.12  2003/08/12 00:19:28  ilyas
29323 + * Improved image downloading protocol.
29324 + * Added DEBUG command support
29325 + *
29326 + * Revision 1.11  2003/04/11 00:37:24  ilyas
29327 + * Added DiagProtoFrame definition
29328 + *
29329 + * Revision 1.10  2003/03/25 00:10:07  ilyas
29330 + * Added command for "long" BERT test
29331 + *
29332 + * Revision 1.9  2003/01/30 03:29:32  ilyas
29333 + * Added PHY_CFG support and fixed printing showtime counters
29334 + *
29335 + * Revision 1.8  2002/12/16 20:56:38  ilyas
29336 + * Added support for binary statuses
29337 + *
29338 + * Revision 1.7  2002/12/06 20:19:13  ilyas
29339 + * Added support for binary statuses and scrambled status strings
29340 + *
29341 + * Revision 1.6  2002/11/05 00:18:27  ilyas
29342 + * Added configuration dialog box for Eye tone selection.
29343 + * Added Centillium CRC workaround to AnnexC config dialog
29344 + * Bit allocation update on bit swap messages
29345 + *
29346 + * Revision 1.5  2002/07/30 23:23:43  ilyas
29347 + * Implemented DIAG configuration command for AnnexA and AnnexC
29348 + *
29349 + * Revision 1.4  2002/07/30 22:47:15  ilyas
29350 + * Added DIAG command for configuration
29351 + *
29352 + * Revision 1.3  2002/07/15 23:52:51  ilyas
29353 + * iAdded switch RJ11 pair command
29354 + *
29355 + * Revision 1.2  2002/04/25 17:55:51  ilyas
29356 + * Added mibGet command
29357 + *
29358 + * Revision 1.1  2002/04/02 22:56:39  ilyas
29359 + * Support DIAG connection at any time; BERT commands
29360 + *
29361 + *
29362 + ******************************************************************/
29363 +
29364 +#define        LOG_PROTO_ID                            "*L"
29365 +
29366 +#define        DIAG_PARTY_ID_MASK                      0x01
29367 +#define        LOG_PARTY_CLIENT                        0x01
29368 +#define        LOG_PARTY_SERVER                        0x00
29369 +
29370 +#define        DIAG_DATA_MASK                          0x0E
29371 +#define        DIAG_DATA_LOG                           0x02
29372 +#define        DIAG_DATA_EYE                           0x04
29373 +#define        DIAG_DATA_LOG_TIME                      0x08
29374 +
29375 +#define        DIAG_DATA_EX                            0x80
29376 +#define        DIAG_PARTY_ID_MASK_EX           (DIAG_DATA_EX | DIAG_PARTY_ID_MASK)
29377 +#define        LOG_PARTY_SERVER_EX                     (DIAG_DATA_EX | LOG_PARTY_SERVER)
29378 +
29379 +#define        DIAG_ACK_FRAME_ACK_MASK         0x000000FF
29380 +#define        DIAG_ACK_FRAME_RCV_SHIFT        8
29381 +#define        DIAG_ACK_FRAME_RCV_MASK         0x0000FF00
29382 +#define        DIAG_ACK_FRAME_RCV_PRESENT      0x00010000
29383 +#define        DIAG_ACK_TIMEOUT                        -1
29384 +#define        DIAG_ACK_LEN_INDICATION         -1
29385 +
29386 +#define        LOG_CMD_GDB                                     236
29387 +#define        LOG_CMD_PROXY                           237
29388 +#define        LOG_CMD_RETR                            238
29389 +#define        LOG_CMD_DEBUG                           239
29390 +#define        LOG_CMD_BERT_EX                         240
29391 +#define        LOG_CMD_CFG_PHY                         241
29392 +#define        LOG_CMD_RESET                           242
29393 +#define        LOG_CMD_SCRAMBLED_STRING        243
29394 +#define        LOG_CMD_EYE_CFG                         244
29395 +#define        LOG_CMD_CONFIG_A                        245
29396 +#define        LOG_CMD_CONFIG_C                        246
29397 +#define        LOG_CMD_SWITCH_RJ11_PAIR        247
29398 +#define        LOG_CMD_MIB_GET                         248
29399 +#define        LOG_CMD_LOG_STOP                        249
29400 +#define        LOG_CMD_PING_REQ                        250
29401 +#define        LOG_CMD_PING_RSP                        251
29402 +#define        LOG_CMD_DISCONNECT                      252
29403 +#define        LOG_CMD_STRING_DATA                     253
29404 +#define        LOG_CMD_TEST_DATA                       254
29405 +#define        LOG_CMD_CONNECT                         255
29406 +
29407 +typedef struct _LogProtoHeader {
29408 +       unsigned char   logProtoId[2];
29409 +       unsigned char   logPartyId;
29410 +       unsigned char   logCommmand;
29411 +} LogProtoHeader;
29412 +
29413 +#define        LOG_FILE_PORT                   5100
29414 +#define        LOG_MAX_BUF_SIZE                1400
29415 +#define        LOG_MAX_DATA_SIZE               (LOG_MAX_BUF_SIZE - sizeof(LogProtoHeader))
29416 +
29417 +typedef struct {
29418 +       LogProtoHeader  diagHdr;
29419 +       unsigned char   diagData[LOG_MAX_DATA_SIZE];
29420 +} DiagProtoFrame;
29421 +
29422 +#define        DIAG_PROXY_TERMINATE                            1
29423 +
29424 +#define        DIAG_DEBUG_CMD_READ_MEM                         1
29425 +#define        DIAG_DEBUG_CMD_SET_MEM                          2
29426 +#define        DIAG_DEBUG_CMD_RESET_CONNECTION         3
29427 +#define        DIAG_DEBUG_CMD_RESET_PHY                        4
29428 +#define        DIAG_DEBUG_CMD_RESET_CHIP                       5
29429 +#define        DIAG_DEBUG_CMD_EXEC_FUNC                        6
29430 +#define        DIAG_DEBUG_CMD_EXEC_ADSL_FUNC           7
29431 +#define        DIAG_DEBUG_CMD_WRITE_FILE                       8
29432 +#define        DIAG_DEBUG_CMD_G992P3_DEBUG                     9
29433 +#define        DIAG_DEBUG_CMD_G992P3_DIAG_MODE         10
29434 +#define        DIAG_DEBUG_CMD_CLEAR_TIME                       11
29435 +#define        DIAG_DEBUG_CMD_PRINT_TIME                       12
29436 +#define        DIAG_DEBUG_CMD_LOG_SAMPLES                      13
29437 +
29438 +#define        DIAG_DEBUG_CMD_PLAYBACK_STOP            14
29439 +#define        DIAG_DEBUG_CMD_PLAYBACK_RESUME          15
29440 +
29441 +#define        DIAG_DEBUG_CMD_PRINT_STAT                       21
29442 +#define        DIAG_DEBUG_CMD_CLEAR_STAT                       22
29443 +
29444 +typedef struct {
29445 +       unsigned short  cmd;
29446 +       unsigned short  cmdId;
29447 +       unsigned long   param1;
29448 +       unsigned long   param2;
29449 +       unsigned char   diagData[1];
29450 +} DiagDebugData;
29451 +
29452 +#define        DIAG_TEST_CMD_LOAD                                      101
29453 +#define        DIAG_TEST_CMD_READ                                      102
29454 +#define        DIAG_TEST_CMD_WRITE                                     103
29455 +#define        DIAG_TEST_CMD_APPEND                            104
29456 +#define        DIAG_TEST_CMD_TEST_COMPLETE                     105
29457 +
29458 +#define        DIAG_TEST_FILENAME_LEN                          64
29459 +
29460 +typedef struct {
29461 +       unsigned short  cmd;
29462 +       unsigned short  cmdId;
29463 +       unsigned long   offset;
29464 +       unsigned long   len;
29465 +       unsigned long   bufPtr;
29466 +       char                    fileName[DIAG_TEST_FILENAME_LEN];
29467 +} DiagTestData;
29468 +
29469 +typedef struct {
29470 +       unsigned long   frStart;
29471 +       unsigned long   frNum;
29472 +} DiagLogRetrData;
29473 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/adsldrv.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/adsldrv.h
29474 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/adsldrv.h        1970-01-01 01:00:00.000000000 +0100
29475 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/adsldrv.h       2006-06-26 09:07:10.000000000 +0200
29476 @@ -0,0 +1,203 @@
29477 +/*
29478 +<:copyright-broadcom 
29479
29480 + Copyright (c) 2002 Broadcom Corporation 
29481 + All Rights Reserved 
29482 + No portions of this material may be reproduced in any form without the 
29483 + written permission of: 
29484 +          Broadcom Corporation 
29485 +          16215 Alton Parkway 
29486 +          Irvine, California 92619 
29487 + All information contained in this document is Broadcom Corporation 
29488 + company private, proprietary, and trade secret. 
29489
29490 +:>
29491 +*/
29492 +/***************************************************************************
29493 + * File Name  : AdslDrv.h
29494 + *
29495 + * Description: This file contains the definitions and structures for the
29496 + *              Linux IOCTL interface that used between the user mode ADSL
29497 + *              API library and the kernel ADSL API driver.
29498 + *
29499 + * Updates    : 11/02/2001  lkaplan.  Created.
29500 + ***************************************************************************/
29501 +
29502 +#if !defined(_ADSLDRV_H_)
29503 +#define _ADSLDRV_H_
29504 +
29505 +#if defined(__cplusplus)
29506 +extern "C" {
29507 +#endif
29508 +
29509 +/* Incldes. */
29510 +#include <bcmadsl.h>
29511 +
29512 +/* Defines. */
29513 +#define DSL_IFNAME               "dsl0"
29514 +#define ADSLDRV_MAJOR            208 /* arbitrary unused value */
29515 +
29516 +#define ADSLIOCTL_CHECK \
29517 +    _IOR(ADSLDRV_MAJOR, 0, ADSLDRV_STATUS_ONLY)
29518 +#define ADSLIOCTL_INITIALIZE \
29519 +    _IOWR(ADSLDRV_MAJOR, 1, ADSLDRV_INITIALIZE)
29520 +#define ADSLIOCTL_UNINITIALIZE \
29521 +    _IOR(ADSLDRV_MAJOR, 2, ADSLDRV_STATUS_ONLY)
29522 +#define ADSLIOCTL_CONNECTION_START \
29523 +    _IOWR(ADSLDRV_MAJOR, 3, ADSLDRV_STATUS_ONLY)
29524 +#define ADSLIOCTL_CONNECTION_STOP \
29525 +    _IOR(ADSLDRV_MAJOR, 4, ADSLDRV_STATUS_ONLY)
29526 +#define ADSLIOCTL_GET_PHY_ADDR \
29527 +    _IOR(ADSLDRV_MAJOR, 5, ADSLDRV_PHY_ADDR)
29528 +#define ADSLIOCTL_SET_PHY_ADDR \
29529 +    _IOWR(ADSLDRV_MAJOR, 6, ADSLDRV_PHY_ADDR)
29530 +#define ADSLIOCTL_MAP_ATM_PORT_IDS \
29531 +    _IOWR(ADSLDRV_MAJOR, 7, ADSLDRV_MAP_ATM_PORT)
29532 +#define ADSLIOCTL_GET_CONNECTION_INFO \
29533 +    _IOR(ADSLDRV_MAJOR, 8, ADSLDRV_CONNECTION_INFO)
29534 +#define ADSLIOCTL_DIAG_COMMAND \
29535 +    _IOR(ADSLDRV_MAJOR, 9, ADSLDRV_DIAG)
29536 +#define ADSLIOCTL_GET_OBJ_VALUE \
29537 +    _IOR(ADSLDRV_MAJOR, 10, ADSLDRV_GET_OBJ)
29538 +#define ADSLIOCTL_START_BERT \
29539 +    _IOR(ADSLDRV_MAJOR, 11, ADSLDRV_BERT)
29540 +#define ADSLIOCTL_STOP_BERT \
29541 +    _IOR(ADSLDRV_MAJOR, 12, ADSLDRV_STATUS_ONLY)
29542 +#define ADSLIOCTL_CONFIGURE \
29543 +    _IOR(ADSLDRV_MAJOR, 13, ADSLDRV_CONFIGURE)
29544 +#define ADSLIOCTL_TEST \
29545 +    _IOR(ADSLDRV_MAJOR, 14, ADSLDRV_TEST)
29546 +#define ADSLIOCTL_GET_CONSTEL_POINTS \
29547 +    _IOR(ADSLDRV_MAJOR, 15, ADSLDRV_GET_CONSTEL_POINTS)
29548 +#define ADSLIOCTL_GET_VERSION \
29549 +    _IOR(ADSLDRV_MAJOR, 16, ADSLDRV_GET_VERSION)
29550 +#define ADSLIOCTL_SET_SDRAM_BASE \
29551 +    _IOR(ADSLDRV_MAJOR, 17, ADSLDRV_SET_SDRAM_BASE)
29552 +#define ADSLIOCTL_RESET_STAT_COUNTERS \
29553 +    _IOR(ADSLDRV_MAJOR, 18, ADSLDRV_STATUS_ONLY)
29554 +#define ADSLIOCTL_SET_OEM_PARAM \
29555 +    _IOR(ADSLDRV_MAJOR, 19, ADSLDRV_SET_OEM_PARAM)
29556 +#define ADSLIOCTL_START_BERT_EX \
29557 +    _IOR(ADSLDRV_MAJOR, 20, ADSLDRV_BERT_EX)
29558 +#define ADSLIOCTL_STOP_BERT_EX \
29559 +    _IOR(ADSLDRV_MAJOR, 21, ADSLDRV_STATUS_ONLY)
29560 +
29561 +#define MAX_ADSLDRV_IOCTL_COMMANDS   22
29562 +
29563 +/* Typedefs. */
29564 +typedef struct
29565 +{
29566 +    BCMADSL_STATUS bvStatus;
29567 +} ADSLDRV_STATUS_ONLY, *PADSLDRV_STATUS_ONLY;
29568 +
29569 +typedef struct
29570 +{
29571 +    ADSL_FN_NOTIFY_CB  pFnNotifyCb;
29572 +    UINT32                             ulParm;
29573 +       adslCfgProfile          *pAdslCfg;
29574 +    BCMADSL_STATUS             bvStatus;
29575 +} ADSLDRV_INITIALIZE, *PADSLDRV_INITIALIZE;
29576 +
29577 +typedef struct
29578 +{
29579 +    ADSL_CHANNEL_ADDR ChannelAddr;
29580 +    BCMADSL_STATUS bvStatus;
29581 +} ADSLDRV_PHY_ADDR, *PADSLDRV_PHY_ADDR;
29582 +
29583 +typedef struct
29584 +{
29585 +       UINT16 usAtmFastPortId;
29586 +       UINT16 usAtmInterleavedPortId;
29587 +    BCMADSL_STATUS bvStatus;
29588 +} ADSLDRV_MAP_ATM_PORT, *PADSLDRV_MAP_ATM_PORT;
29589 +
29590 +typedef struct
29591 +{
29592 +    ADSL_CONNECTION_INFO ConnectionInfo;
29593 +    BCMADSL_STATUS bvStatus;
29594 +} ADSLDRV_CONNECTION_INFO, *PADSLDRV_CONNECTION_INFO;
29595 +
29596 +typedef struct
29597 +{
29598 +    int                                diagCmd;
29599 +    int                                diagMap;
29600 +    int                                logTime;
29601 +       int                             srvIpAddr;
29602 +       int                             gwIpAddr;
29603 +    BCMADSL_STATUS     bvStatus;
29604 +} ADSLDRV_DIAG, *PADSLDRV_DIAG;
29605 +
29606 +typedef struct
29607 +{
29608 +       char                    *objId;
29609 +       int                             objIdLen;
29610 +       char                    *dataBuf;
29611 +       long                    dataBufLen;
29612 +    BCMADSL_STATUS     bvStatus;
29613 +} ADSLDRV_GET_OBJ, *PADSLDRV_GET_OBJ;
29614 +
29615 +typedef struct
29616 +{
29617 +       unsigned long   totalBits;
29618 +    BCMADSL_STATUS     bvStatus;
29619 +} ADSLDRV_BERT, *PADSLDRV_BERT;
29620 +
29621 +typedef struct
29622 +{
29623 +       unsigned long   totalSec;
29624 +    BCMADSL_STATUS     bvStatus;
29625 +} ADSLDRV_BERT_EX, *PADSLDRV_BERT_EX;
29626 +
29627 +typedef struct
29628 +{
29629 +       adslCfgProfile          *pAdslCfg;
29630 +    BCMADSL_STATUS             bvStatus;
29631 +} ADSLDRV_CONFIGURE, *PADSLDRV_CONFIGURE;
29632 +
29633 +typedef struct
29634 +{
29635 +       unsigned long   testCmd;
29636 +       unsigned long   xmtStartTone;
29637 +       unsigned long   xmtNumTones;
29638 +       unsigned long   rcvStartTone;
29639 +       unsigned long   rcvNumTones;
29640 +    char                       *xmtToneMap;
29641 +    char                       *rcvToneMap;
29642 +    BCMADSL_STATUS     bvStatus;
29643 +} ADSLDRV_TEST, *PADSLDRV_TEST;
29644 +
29645 +typedef struct
29646 +{
29647 +       int                             toneId;
29648 +       ADSL_CONSTELLATION_POINT        *pointBuf;
29649 +       int                             numPoints;
29650 +    BCMADSL_STATUS     bvStatus;
29651 +} ADSLDRV_GET_CONSTEL_POINTS, *PADSLDRV_GET_CONSTEL_POINTS;
29652 +
29653 +typedef struct
29654 +{
29655 +       adslVersionInfo         *pAdslVer;
29656 +    BCMADSL_STATUS             bvStatus;
29657 +} ADSLDRV_GET_VERSION, *PADSLDRV_GET_VERSION;
29658 +
29659 +typedef struct
29660 +{
29661 +       unsigned long   sdramBaseAddr;
29662 +    BCMADSL_STATUS     bvStatus;
29663 +} ADSLDRV_SET_SDRAM_BASE, *PADSLDRV_SET_SDRAM_BASE;
29664 +
29665 +
29666 +typedef struct
29667 +{
29668 +       int                             paramId;
29669 +       void                    *buf;
29670 +       int                             len;
29671 +    BCMADSL_STATUS     bvStatus;
29672 +} ADSLDRV_SET_OEM_PARAM, *PADSLDRV_SET_OEM_PARAM;
29673 +
29674 +#if defined(__cplusplus)
29675 +}
29676 +#endif
29677 +
29678 +#endif // _ADSLDRV_H_
29679 +
29680 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmapidrv.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmapidrv.h
29681 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmapidrv.h      1970-01-01 01:00:00.000000000 +0100
29682 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmapidrv.h     2006-06-26 09:07:10.000000000 +0200
29683 @@ -0,0 +1,212 @@
29684 +/*
29685 +<:copyright-broadcom 
29686
29687 + Copyright (c) 2002 Broadcom Corporation 
29688 + All Rights Reserved 
29689 + No portions of this material may be reproduced in any form without the 
29690 + written permission of: 
29691 +          Broadcom Corporation 
29692 +          16215 Alton Parkway 
29693 +          Irvine, California 92619 
29694 + All information contained in this document is Broadcom Corporation 
29695 + company private, proprietary, and trade secret. 
29696
29697 +:>
29698 +*/
29699 +/***************************************************************************
29700 + * File Name  : AtmApiDrv.h
29701 + *
29702 + * Description: This file contains the definitions and structures for the
29703 + *              Linux IOCTL interface that used between the user mode ATM
29704 + *              API library and the kernel ATM API driver.
29705 + *
29706 + * Updates    : 09/15/2000  lat.  Created.
29707 + ***************************************************************************/
29708 +
29709 +#if !defined(_ATMAPIDRV_H_)
29710 +#define _ATMAPIDRV_H_
29711 +
29712 +#if defined(__cplusplus)
29713 +extern "C" {
29714 +#endif
29715 +
29716 +/* Incldes. */
29717 +#include <bcmatmapi.h>
29718 +
29719 +/* Defines. */
29720 +#define ATMDRV_MAJOR            205 /* arbitrary unused value */
29721 +
29722 +#define ATMIOCTL_INITIALIZE \
29723 +    _IOWR(ATMDRV_MAJOR, 0, ATMDRV_INITIALIZE)
29724 +#define ATMIOCTL_UNINITIALIZE \
29725 +    _IOR(ATMDRV_MAJOR, 1, ATMDRV_STATUS_ONLY)
29726 +#define ATMIOCTL_GET_INTERFACE_ID \
29727 +    _IOWR(ATMDRV_MAJOR, 2, ATMDRV_INTERFACE_ID)
29728 +#define ATMIOCTL_GET_TRAFFIC_DESCR_TABLE_SIZE \
29729 +    _IOR(ATMDRV_MAJOR, 3, ATMDRV_TRAFFIC_DESCR_TABLE_SIZE)
29730 +#define ATMIOCTL_GET_TRAFFIC_DESCR_TABLE \
29731 +    _IOWR(ATMDRV_MAJOR, 4, ATMDRV_TRAFFIC_DESCR_TABLE)
29732 +#define ATMIOCTL_SET_TRAFFIC_DESCR_TABLE \
29733 +    _IOWR(ATMDRV_MAJOR, 5, ATMDRV_TRAFFIC_DESCR_TABLE)
29734 +#define ATMIOCTL_GET_INTERFACE_CFG \
29735 +    _IOWR(ATMDRV_MAJOR, 6, ATMDRV_INTERFACE_CFG)
29736 +#define ATMIOCTL_SET_INTERFACE_CFG \
29737 +    _IOWR(ATMDRV_MAJOR, 7, ATMDRV_INTERFACE_CFG)
29738 +#define ATMIOCTL_GET_VCC_CFG \
29739 +    _IOWR(ATMDRV_MAJOR, 8, ATMDRV_VCC_CFG)
29740 +#define ATMIOCTL_SET_VCC_CFG \
29741 +    _IOWR(ATMDRV_MAJOR, 9, ATMDRV_VCC_CFG)
29742 +#define ATMIOCTL_GET_VCC_ADDRS \
29743 +    _IOWR(ATMDRV_MAJOR, 10, ATMDRV_VCC_ADDRS)
29744 +#define ATMIOCTL_GET_INTERFACE_STATISTICS \
29745 +    _IOWR(ATMDRV_MAJOR, 11, ATMDRV_INTERFACE_STATISTICS)
29746 +#define ATMIOCTL_GET_VCC_STATISTICS \
29747 +    _IOWR(ATMDRV_MAJOR, 12, ATMDRV_VCC_STATISTICS)
29748 +#define ATMIOCTL_SET_INTERFACE_LINK_INFO \
29749 +    _IOWR(ATMDRV_MAJOR, 13, ATMDRV_INTERFACE_LINK_INFO)
29750 +#define ATMIOCTL_TEST \
29751 +    _IOWR(ATMDRV_MAJOR, 14, ATMDRV_TEST)
29752 +#define ATMIOCTL_OAM_LOOPBACK_TEST \
29753 +    _IOWR(ATMDRV_MAJOR, 15, ATMDRV_OAM_LOOPBACK)
29754 +
29755 +
29756 +#define MAX_ATMDRV_IOCTL_COMMANDS   16
29757 +
29758 +/* Typedefs. */
29759 +typedef struct
29760 +{
29761 +    BCMATM_STATUS baStatus;
29762 +} ATMDRV_STATUS_ONLY, *PATMDRV_STATUS_ONLY;
29763 +
29764 +typedef struct
29765 +{   PATM_INITIALIZATION_PARMS pInit;
29766 +    BCMATM_STATUS baStatus;
29767 +} ATMDRV_INITIALIZE, *PATMDRV_INITIALIZE;
29768 +
29769 +typedef struct
29770 +{
29771 +    UINT8 ucPhyPort;
29772 +    UINT8 ucReserved[3];
29773 +    UINT32 ulInterfaceId;
29774 +    BCMATM_STATUS baStatus;
29775 +} ATMDRV_INTERFACE_ID, *PATMDRV_INTERFACE_ID;
29776 +
29777 +typedef struct
29778 +{
29779 +    UINT32 ulTrafficDescrTableSize;
29780 +    BCMATM_STATUS baStatus;
29781 +} ATMDRV_TRAFFIC_DESCR_TABLE_SIZE, *PATMDRV_TRAFFIC_DESCR_TABLE_SIZE;
29782 +
29783 +typedef struct
29784 +{
29785 +    PATM_TRAFFIC_DESCR_PARM_ENTRY pTrafficDescrTable;
29786 +    UINT32 ulTrafficDescrTableSize;
29787 +    BCMATM_STATUS baStatus;
29788 +} ATMDRV_TRAFFIC_DESCR_TABLE, *PATMDRV_TRAFFIC_DESCR_TABLE;
29789 +
29790 +typedef struct
29791 +{
29792 +    UINT32 ulInterfaceId;
29793 +    PATM_INTERFACE_CFG pInterfaceCfg;
29794 +    BCMATM_STATUS baStatus;
29795 +} ATMDRV_INTERFACE_CFG, *PATMDRV_INTERFACE_CFG;
29796 +
29797 +typedef struct
29798 +{
29799 +    ATM_VCC_ADDR VccAddr;
29800 +    PATM_VCC_CFG pVccCfg;
29801 +    BCMATM_STATUS baStatus;
29802 +} ATMDRV_VCC_CFG, *PATMDRV_VCC_CFG;
29803 +
29804 +typedef struct
29805 +{
29806 +    UINT32 ulInterfaceId;
29807 +    PATM_VCC_ADDR pVccAddrs;
29808 +    UINT32 ulNumVccs;
29809 +    UINT32 ulNumReturned;
29810 +    BCMATM_STATUS baStatus;
29811 +} ATMDRV_VCC_ADDRS, *PATMDRV_VCC_ADDRS;
29812 +
29813 +typedef struct
29814 +{
29815 +    UINT32 ulInterfaceId;
29816 +    PATM_INTERFACE_STATS pStatistics;
29817 +    UINT32 ulReset;
29818 +    BCMATM_STATUS baStatus;
29819 +} ATMDRV_INTERFACE_STATISTICS, *PATMDRV_INTERFACE_STATISTICS;
29820 +
29821 +typedef struct
29822 +{
29823 +    ATM_VCC_ADDR VccAddr;
29824 +    PATM_VCC_STATS pVccStatistics;
29825 +    UINT32 ulReset;
29826 +    BCMATM_STATUS baStatus;
29827 +} ATMDRV_VCC_STATISTICS, *PATMDRV_VCC_STATISTICS;
29828 +
29829 +typedef struct
29830 +{
29831 +    UINT32 ulInterfaceId;
29832 +    ATM_INTERFACE_LINK_INFO InterfaceCfg;
29833 +    BCMATM_STATUS baStatus;
29834 +} ATMDRV_INTERFACE_LINK_INFO, *PATMDRV_INTERFACE_LINK_INFO;
29835 +
29836 +typedef struct
29837 +{
29838 +    ATM_VCC_ADDR VccAddr;
29839 +    UINT32 ulNumToSend;
29840 +    BCMATM_STATUS baStatus;
29841 +} ATMDRV_TEST, *PATMDRV_TEST;
29842 +
29843 +typedef struct
29844 +{
29845 +    ATM_VCC_ADDR VccAddr;
29846 +    UINT32 type;
29847 +    BCMATM_STATUS baStatus;
29848 +} ATMDRV_OAM_LOOPBACK, *PATMDRV_OAM_LOOPBACK;
29849 +
29850 +#define OAM_TYPE_FUNCTION_BYTE_OFFSET       0
29851 +#define OAM_LB_INDICATION_BYTE_OFFSET       1
29852 +#define OAM_LB_CORRELATION_TAG_BYTE_OFFSET  2
29853 +#define OAM_LB_LOCATION_ID_BYTE_OFFSET      6
29854 +#define OAM_LB_SRC_ID_BYTE_OFFSET           22
29855 +#define OAM_LB_UNUSED_BYTE_OFFSET           38
29856 +#define OAM_RDI_UNUSED_BYTE_OFFSET          1
29857 +#define OAM_LB_CRC_BYTE_OFFSET              46
29858 +#define OAM_RDI_CRC_BYTE_OFFSET             46
29859 +#define OAM_LB_CORRELATION_TAG_LEN          4
29860 +#define OAM_LB_LOCATION_ID_LEN              16
29861 +#define OAM_LB_SRC_ID_LEN                   16
29862 +#define OAM_LB_UNUSED_BYTE_LEN              8
29863 +#define OAM_RDI_UNUSED_BYTE_LEN             45
29864 +#define OAM_LB_CRC_BYTE_LEN                 2
29865 +#define OAM_RDI_CRC_BYTE_LEN                2
29866 +#define OAM_FAULT_MANAGEMENT_LB             0x18
29867 +#define OAM_FAULT_MANAGEMENT_RDI            0x11
29868 +#define OAM_FAULT_MANAGEMENT_LB_REQUEST     1
29869 +#define OAM_FAULT_MANAGEMENT_LB_RESPOND     0
29870 +#define OAM_FAULT_MANAGEMENT_CORRELATION_VAL  0xbcbcbcbc
29871 +#define OAM_FAULT_MANAGEMENT_SRC_ID_3       0xffffffff
29872 +#define OAM_FAULT_MANAGEMENT_SRC_ID_2       0xffffffff
29873 +#define OAM_FAULT_MANAGEMENT_SRC_ID_1       0xffffffff
29874 +#define OAM_FAULT_MANAGEMENT_SRC_ID_0       0xffffffff
29875 +#define OAM_FAULT_MANAGEMENT_LOCATION_ID_3  0xffffffff
29876 +#define OAM_FAULT_MANAGEMENT_LOCATION_ID_2  0xffffffff    
29877 +#define OAM_FAULT_MANAGEMENT_LOCATION_ID_1  0xffffffff
29878 +#define OAM_FAULT_MANAGEMENT_LOCATION_ID_0  0xffffffff
29879 +#define OAM_LB_UNUSED_BYTE_DEFAULT          0x6a
29880 +#define OAM_LB_SEGMENT_TYPE                 0
29881 +#define OAM_LB_END_TO_END_TYPE              1
29882 +#define OAM_F4_LB_SEGMENT_TYPE              2
29883 +#define OAM_F4_LB_END_TO_END_TYPE           3
29884 +#define RM_PROT_ID_OFFSET                   0
29885 +#define RM_MESSAGE_TYPE_OFFSET              1
29886 +#define RM_PROTOCOL_ID                      1
29887 +#define RM_TYPE_DEFAULT                     0x20 /* forward/source_generated/congested */
29888 +#define RM_UNUSED_BYTES_OFFSET              2
29889 +#define RM_UNUSED_BYTES_LEN                 46
29890 +#if defined(__cplusplus)
29891 +}
29892 +#endif
29893 +
29894 +#endif // _ATMAPIDRV_H_
29895 +
29896 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmdiag.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmdiag.h
29897 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmdiag.h        1970-01-01 01:00:00.000000000 +0100
29898 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmdiag.h       2006-06-26 09:07:10.000000000 +0200
29899 @@ -0,0 +1,764 @@
29900 +/*
29901 +<:copyright-broadcom 
29902
29903 + Copyright (c) 2002 Broadcom Corporation 
29904 + All Rights Reserved 
29905 + No portions of this material may be reproduced in any form without the 
29906 + written permission of: 
29907 +          Broadcom Corporation 
29908 +          16215 Alton Parkway 
29909 +          Irvine, California 92619 
29910 + All information contained in this document is Broadcom Corporation 
29911 + company private, proprietary, and trade secret. 
29912
29913 +:>
29914 +*/
29915 +
29916 +#ifndef __ATMDIAG_H__
29917 +#define __ATMDIAG_H__
29918 +
29919 +//#define BRCM_6348
29920 +
29921 +#if defined(__cplusplus)
29922 +extern "C" {
29923 +#endif
29924 +
29925 +#define ATM_DIAG_FAIL                       -1
29926 +#define ATM_DIAG_PASS                       0
29927 +#define ATM_REGADDR                         0xFFFE4000
29928 +#define ATM_REGSIZE                         0x800
29929 +#define ATM_TX_VPI_VCI_CAM_OFFSET           0x500
29930 +#define ATM_RX_VPI_VCI_CAM_OFFSET           0x600
29931 +#define ATM_TRAFFIC_SHAPER_OFFSET           0x700
29932 +#define ATM_TX_STATUS_OFFSET                0x40c
29933 +#define ATM_RX_STATUS_OFFSET                0x41c
29934 +#define ATM_RX_AAL_STATUS_OFFSET            0x428
29935 +#define ATM_MIP_COUNTERS_OFFSET             0x440
29936 +#define ATM_UTOPIA_SETTING_OFFSET           0x42c
29937 +#define ATM_ADSL_PHY_PORT_SETTING           0x15c
29938 +#define UT_MAX_TDT_ENTRIES                  2
29939 +#define UT_MAX_MGMT_ENTRIES                 4
29940 +#define UT_LINE_RATE                (146200000)  /* 344811 cells/sec, CIT = 29ns */
29941 +#define UT_CELL_RATE                (53 * 8)
29942 +#define UT_MIN_PCR_SCR              310          /* ~128Kbps */
29943 +#define UT_MAX_PCR_SCR              344811       /* ~146.2Kpbs */
29944 +#define UT_MIN_MBS                  2
29945 +#define UT_MAX_MBS                  200000
29946 +  //#ifdef BRCM_6348  currently, the driver only support 8 VCCS
29947 +  //#define UT_MAX_VCCS                         16
29948 +  //#else
29949 +#define UT_MAX_VCCS                         8
29950 +  //#endif
29951 +#define UT_MAX_PHY_PORTS                    2
29952 +#define UT_BASE_PORT_NUMBER                 1
29953 +#define UT_MIN_QUEUE                        1
29954 +#define UT_MAX_QUEUE                        UT_MAX_VCCS
29955 +#define UT_MULTI_QUEUE                      1
29956 +#define UT_SINGLE_QUEUE                     0
29957 +#define UT_MIN_PRIORITY                     1
29958 +#define UT_MAX_PRIORITY                     4    /* priority ranging from 1-4 */
29959 +#define UT_BUFFER_SIZE                      20
29960 +#define UT_MGMT_IDX                         6
29961 +#define UT_ENABLED                          1
29962 +#define UT_DISABLED                         0
29963 +#define UT_MAX_TD_INDEX                     UT_MAX_VCCS
29964 +#define UT_SSTED_TRAILER_SIZE               8
29965 +#define UT_DIALED_DIGITS                    2
29966 +#define UT_FREE_CELL_Q_SIZE                 800
29967 +#define UT_FREE_PKT_Q_SIZE                  800
29968 +#define UT_FREE_PKT_Q_BUF_SIZE              1600
29969 +#define UT_RX_PKT_Q_SIZE                    800
29970 +#define UT_RX_CELL_Q_SIZE                   800
29971 +#define UT_AAL5_MAX_SDU_LENGTH              65535
29972 +#define UT_TX_FIFO_PRIORITY                 4
29973 +#define UT_MIN_DATA_LEN                     48
29974 +#define UT_MAX_DATA_LEN                     1500
29975 +#define UT_BASE_VPI_NUMBER                  0
29976 +#define UT_MAX_VPI_NUMBER                   256
29977 +#define UT_BASE_VCI_NUMBER                  32
29978 +#define UT_MAX_VCI_NUMBER                   65536
29979 +#define UT_UTOPIA_MODE                      1
29980 +#define UT_ADSL_MODE                        0
29981 +#define UT_UTOPIA_ADSL_MODE                 0x11   /* utopia port 0, adsl port 1 */
29982 +#define UT_TOGGLE_DISPLAY_MODE              1
29983 +#define UT_TOGGLE_CAPTURE_MODE              0
29984 +#define UT_TOGGLE_VERIFICATION_MODE         2
29985 +#define UT_TOGGLE_MODE_ON                   1
29986 +#define UT_TOGGLE_MODE_OFF                  0
29987 +#define UT_DUMP_TX_VPI_VCI_TABLE            1
29988 +#define UT_DUMP_RX_VPI_VCI_TABLE            2
29989 +#define UT_DISPLAY_STATS                    1
29990 +#define UT_CLEAR_STATS                      2
29991 +#define UT_TRAFFIC_DESCRIPTOR_DISPLAY       1
29992 +#define UT_TRAFFIC_DESCRIPTOR_MODIFY        2
29993 +#define UT_PORT_UTOPIA_SETTING              1
29994 +#define UT_GLOBAL_UTOPIA_SETTING            2
29995 +#define UT_DISPLAY_CAPTURED                 0
29996 +#define UT_ERASE_CAPTURED                   1
29997 +#define UT_CAPTURED_ERROR_STATS             2
29998 +#define UT_PATTERN_INCREMENT                1
29999 +#define UT_PATTERN_FIX                      0
30000 +#define UT_MODIFY_OPERATION                 1
30001 +#define UT_DISPLAY_OPERATION                0
30002 +#define DIAG_ATM_MODULE       "bcmatmtest"
30003 +#define DIAG_ATM_PROC         "/proc/atmtest"
30004 +
30005 +/* command is made up of 2_bytes_command|2_bytes_index */
30006 +/* index is ranging from 0-7 for 8 VCs */
30007 +#define UT_PROC_CMD_ADD_VC                  1
30008 +#define UT_PROC_CMD_DELETE_VC               2
30009 +#define UT_PROC_CMD_START_SEND_VC           3
30010 +#define UT_PROC_CMD_SEND_MULTI_VC           4
30011 +#define UT_PROC_CMD_STOP_SEND_VC            5
30012 +#define UT_PROC_CMD_CAPTURE                 6
30013 +#define UT_PROC_CMD_TOGGLE                  7
30014 +#define UT_PROC_CMD_GET_STATS               8
30015 +#define UT_PROC_CMD_CLEAR_STATS             9
30016 +#define UT_PROC_CMD_SEND_MULTI_PRIORITY     10
30017 +#define UT_PROC_CMD_MODIFY_TRAFFIC_SHAPER   11
30018 +#define UT_PROC_CMD_START_SEND_ALL_VC       12
30019 +#define UT_PROC_CMD_ADSL_LOOPBACK           13
30020 +#define UT_PROC_CMD_SEND_MANAGEMENT         14
30021 +#define UT_PROC_CMD_ADD_MPVC                15
30022 +#define UT_PROC_CMD_DELETE_MPVC             16
30023 +#define UT_PROC_CMD_START_SEND_MPVC         17
30024 +#define UT_PROC_CMD_UTOPIA_SET              18
30025 +
30026 +#define UT_OAM_LB_END_TO_END                10  /* was 1 */
30027 +#define UT_OAM_LB_SEGMENT                   11  /* was 2 */
30028 +#define UT_OAM_RDI_END_TO_END               3
30029 +#define UT_OAM_RDI_SEGMENT                  4
30030 +#define UT_VPC_RM_TYPE                      5
30031 +#define UT_VCC_RM_TYPE                      6
30032 +#define UT_OAM_CRC10_SOFTWARE               0
30033 +#define UT_OAM_CRC10_HARDWARE               1
30034 +#define UT_TOGGLE_DISPLAY                   0
30035 +#define UT_TOGGLE_CAPTURE                   1
30036 +#define UT_TOGGLE_VERIFY                    2
30037 +
30038 +#define AP_REG_OFFSET_END                   0x7ff
30039 +#define AP_INDIRECT_RAM_ADDRESS_REG      ATM_PROCESSOR_BASE + 0x7c0
30040 +#define AP_INDIRECT_RAM_REG              ATM_PROCESSOR_BASE + 0x7c4
30041 +#define AP_IRQ_MASK                      AP_INTR_REGS_BASE+0x4
30042 +#define AP_IRQ_STATUS                    AP_INTR_REGS_BASE
30043 +#define AP_ROUTE_OAM_TO_RCQ              0
30044 +#define AP_ROUTE_OAM_TO_MCF              1
30045 +#define AP_IR_ASSERT                     1
30046 +#define AP_IR_DEASSERT                   0
30047 +#define AP_RX_STATUS_ERR_MASK            0x32ecc /* mask out idleCell, vc & unused */
30048 +#define AP_RX_AAL_STATUS_ERR_MASK        0x3008  /* only look at rx router stats, discard */
30049 +
30050 +typedef struct utVccCfg {
30051 +  UINT8 ulAalType;
30052 +  UINT8 ulAtmVccCpcsAcceptCorruptedPdus;
30053 +}UT_VCC_CFG, *pUT_VCC_CFG;
30054 +
30055 +typedef struct utTrafficDescrParmEntry {
30056 +  UINT32 ulTrafficDescrIndex;
30057 +  UINT32 ulTrafficDescrType;
30058 +  UINT32 ulTrafficDescrParm1;
30059 +  UINT32 ulTrafficDescrParm2;
30060 +  UINT32 ulTrafficDescrParm3;
30061 +  UINT32 ulTrafficDescrParm4;
30062 +  UINT32 ulTrafficDescrParm5;
30063 +  UINT32 ulTrafficDescrRowStatus;
30064 +  UINT32 ulServiceCategory;
30065 +}UT_TRAFFIC_DESCR_PARM_ENTRY,*pUT_TRAFFIC_DESCR_PARM_ENTRY;
30066 +
30067 +typedef struct utMultiSendInfo {
30068 +  UINT32 len;
30069 +  UINT8  pattern;
30070 +  UINT8  dataByte;
30071 +  UINT32 numSent;
30072 +  UINT32 rate;
30073 +  UINT8  circuitType;
30074 +  UINT32 cellsPerPdu; 
30075 +  UINT32 delay;
30076 +  UINT32 txCount;
30077 +}UT_MULTISEND_INFO, *pUT_MULTISEND_INFO;
30078 +
30079 +typedef struct utUserSendInfo {
30080 +  UINT32 len;
30081 +  UINT8  incremental;
30082 +  UINT8  dataByte;
30083 +  UINT32 rate;
30084 +  UINT32 aalType;
30085 +  UINT32 delay;
30086 +  UINT32 txCount;   /* number of cells/pkt user want to send */
30087 +  UINT8  multiQPriority;
30088 +  UINT8  basePriority;
30089 +  UINT8  numOfQueues;
30090 +}UT_USER_SEND_INFO, *pUT_USER_SEND_INFO;
30091 +
30092 +typedef struct utVccAddrInfo {
30093 +  ATM_VCC_ADDR vccAddr;
30094 +  UINT8 priority;  /* priority of the queue of this VCC */
30095 +  UINT8 numOfQueues;
30096 +}UT_VCC_ADDR_INFO, *pUT_VCC_ADDR_INFO;
30097 +
30098 +typedef struct utVccListInfo {
30099 +  UINT32 handle;
30100 +  UINT32 managementHandle;
30101 +}UT_VCC_LIST_INFO, *pUT_VCC_LIST_INFO;
30102 +
30103 +typedef struct atmCaptureHdr {
30104 +  UINT8 valid;
30105 +  UINT8 vpi;
30106 +  UINT16 vci;
30107 +  UINT8 circuitType;
30108 +  UINT8 cid;
30109 +  UINT8 uuData8;
30110 +  UINT8 uuData5;
30111 +  UINT8 ucFlags;
30112 +  UINT32 dataLen;
30113 +  UINT8 *dataPtr;
30114 +  UINT8 interface;
30115 +} ATM_CAPTURE_HDR, *pATM_CAPTURE_HDR;
30116 +
30117 +typedef struct atmTxBufferHdr {
30118 +  ATM_VCC_DATA_PARMS dataParms;
30119 +  struct atmTxBufferHdr *next;
30120 +} ATM_TX_BUFFER_HDR, *pATM_TX_BUFFER_HDR;
30121 +
30122 +typedef struct tx_buffer_list{
30123 +  pATM_TX_BUFFER_HDR headPtr;
30124 +  pATM_TX_BUFFER_HDR tailPtr;
30125 +  UINT32 len;
30126 +  UINT32 seqNumber;
30127 +  UINT32 lastSent;
30128 +  UINT32 sentInterval;
30129 +  UINT32 cellsPerPdu;
30130 +} ATM_TX_BUFFER_LIST, *pATM_TX_BUFFER_LIST;
30131 +
30132 +typedef struct atmTestError {
30133 +  UINT32 total;
30134 +  UINT32 data_err;
30135 +  UINT32 data_length;
30136 +  UINT32 sequence_err;
30137 +  UINT32 aalCrcError;
30138 +  UINT32 aalCpcsLen0;
30139 +  UINT32 aalLenError;
30140 +  UINT32 aalSduLenError;
30141 +  UINT32 gfc;
30142 +  UINT32 crc;
30143 +  UINT32 pti;
30144 +  UINT32 pmi_2sml;
30145 +  UINT32 pmi_2big;
30146 +  UINT32 vcam_mme;
30147 +  UINT32 pne;
30148 +  UINT32 came_1;
30149 +  UINT32 came_0;
30150 +  UINT32 dc_1;
30151 +  UINT32 dc_0;
30152 +  UINT32 ec_1;
30153 +  UINT32 ec_0;
30154 +  UINT32 aal5_drop_cell;
30155 +  UINT32 routerDiscard_1;
30156 +  UINT32 routerDiscard_0;
30157 +  UINT32 camLkup;
30158 +  UINT32 idle;
30159 +  UINT32 hec;
30160 +} ATM_TEST_ERROR, *pATM_TEST_ERROR;
30161 +
30162 +typedef struct atmMibStats {
30163 +  UINT32 tx_aal5_0;
30164 +  UINT32 tx_aal5_1;
30165 +  UINT32 tx_aal0_0;
30166 +  UINT32 tx_aal0_1;
30167 +  UINT32 rx_aal5_0;
30168 +  UINT32 rx_aal5_1;
30169 +  UINT32 rx_aal0_0;
30170 +  UINT32 rx_aal0_1;
30171 +} ATM_MIB_STATS, *pATM_MIB_STATS;
30172 +
30173 +/* These are from TX status register; they are collected every 1 second interval */
30174 +typedef struct atmTxStats {
30175 +  UINT32 fifoFull;              /*  fifoFull_port0 */
30176 +  UINT32 aal2bigErr;      
30177 +  UINT32 aal5LenErr;  
30178 +  UINT32 aal5MaxLenErr;
30179 +  UINT32 droppedCellErr;        /* tx aal or tx atm dropped cell port 0 */
30180 +  UINT32 aal5PortNotEnableErr;  /* pne_err_port0 */
30181 +  UINT32 fifoFullErr;           /* ff_err_port0 */
30182 +  UINT32 aal5CountErr;
30183 +} ATM_TX_STATS, *pATM_TX_STATS;
30184 +
30185 +/* these are from RX ATM and RX AAL status registers */
30186 +typedef struct atmRxStats {
30187 +  UINT32 gfcErr;
30188 +  UINT32 crcErr;
30189 +  UINT32 ptiErr;
30190 +  UINT32 vcamMmErr;          /* vcam_mme VCAM multiple match error */
30191 +  UINT32 camLookupErr;       /* came_port0 */
30192 +  UINT32 portNotEnableErr;   /* pne_err */
30193 +  UINT32 discardErr;         /* dc_port0 */
30194 +  UINT32 errCellErr;         /* ec_port0 */
30195 +  UINT32 routerDrop;         /* rxRouterStat_port0 */
30196 +  UINT32 aalDrop;            /* aal5d */
30197 +#ifdef BRCM_6348
30198 +  UINT32 overflowErr;
30199 +  UINT32 uto2small;
30200 +  UINT32 uto2big;
30201 +#endif
30202 +} ATM_RX_STATS, *pATM_RX_STATS;
30203 +
30204 +typedef struct atmStats
30205 +{
30206 +  ATM_MIB_STATS mibStats;
30207 +  ATM_TX_STATS txStats;
30208 +  ATM_RX_STATS rxStats;
30209 +}ATM_STATS, *pATM_STATS;
30210 +
30211 +typedef struct atm_test_tx_info {
30212 +  UINT32 index;
30213 +  UINT32 len;
30214 +  UINT32 lineTxInterval; 
30215 +  UINT32 count;
30216 +  UINT8  incremental;
30217 +  UINT8  dataByte;
30218 +  UINT8  aalType;
30219 +  UINT8  numOfQueues;
30220 +  UINT8  basePriority;
30221 +  UINT32 handle;
30222 +  UINT32 rate;
30223 +  UINT32 sending;
30224 +  UINT8  managementType; /* f4, f5, rm */
30225 +  UINT8  interleaveManagement;
30226 +  UINT16 managementVpi;
30227 +  UINT16 managementVci;
30228 +  UINT16 managementCrc;
30229 +  UINT32 managementInterface;
30230 +} ATM_TEST_TX_INFO, *pATM_TEST_TX_INFO;
30231 +
30232 +typedef struct atm_test_info {
30233 +  ATM_TEST_TX_INFO atmTestTxInfo[UT_MAX_VCCS+1]; /* one extra for f4 since it doesn't
30234 +                                                    have a vcc created, index is last one */
30235 +  UT_TRAFFIC_DESCR_PARM_ENTRY ms_Tdt[UT_MAX_TD_INDEX];
30236 +  UT_VCC_CFG ms_VccCfgs[UT_MAX_VCCS];
30237 +  UT_VCC_ADDR_INFO ms_VccAddrs[UT_MAX_VCCS];
30238 +  UINT32 commandStatus; /* command-2 bytes, status 2 bytes */
30239 +  ATM_TEST_ERROR m_ucTestError[UT_MAX_VCCS+1];
30240 +  ATM_STATS atmStats;
30241 +  UINT8 displayData;  /* current mode: 0=disable, 1=enable */
30242 +  UINT8 captureData;  /* current mode: 0=disable, 1=enable */
30243 +  UINT8 verifyData;  /* current mode: 0=disable, 1=enable */
30244 +  UINT32 pduSent[UT_MAX_VCCS+1]; /* one extra for f4 */
30245 +  UINT32 pduReceived[UT_MAX_VCCS+1];
30246 +  UINT32 multiPriority;
30247 +} ATM_TEST_INFO, *pATM_TEST_INFO;
30248 +
30249 +typedef struct atm_verfication_info {
30250 +  int seqNumber;
30251 +  UINT8 incremental;
30252 +  UINT8 dataByte;
30253 +  int len;
30254 +} ATM_VERIFICATION_INFO, *pATM_VERIFICATION_INFO;
30255 +
30256 +typedef struct atm_data_struct {
30257 +  PATM_VCC_DATA_PARMS data;
30258 +  ATM_VCC_ADDR vccAddr;
30259 +} ATM_DATA_STRUCT, *PATM_DATA_STRUCT;
30260 +
30261 +typedef struct atmDiagCb {
30262 +  ATM_TRAFFIC_DESCR_PARM_ENTRY ms_Tdt[UT_MAX_TD_INDEX];
30263 +  ATM_VCC_CFG ms_VccCfgs[UT_MAX_VCCS];
30264 +  UT_VCC_ADDR_INFO ms_VccAddrs[UT_MAX_VCCS];
30265 +  UINT32 ms_multiPriority[UT_MAX_VCCS];
30266 +  ATM_TX_BUFFER_LIST mTxHdrQ[UT_MAX_VCCS+1]; /* tx Q; an extra one for f4 cells */
30267 +  UT_VCC_LIST_INFO m_ulVccList[UT_MAX_VCCS+1]; /* tx Q; an extra one for f4 cells */
30268 +  UINT32 managementHandle_port0;
30269 +  UINT32 managementHandle_port1;
30270 +  UINT32 rxTaskId;  
30271 +  UINT32 txTaskId;
30272 +  UINT32 statsTaskId;
30273 +  UINT32 rxTaskSem;  /* protect Rx Q */
30274 +  UINT32 txTaskSem;  /* protect Tx Q */
30275 +  UINT32 rxQMuSem;   /* rx task semphore */
30276 +  UINT32 txQMuSem;   /* tx task semphore */
30277 +  UINT32 txTaskExit; /* clean up purpose */
30278 +  UINT32 rxTaskExit; /* clean up purpose */
30279 +  ATM_DATA_STRUCT m_pDpHead; /* rx Q */
30280 +  ATM_DATA_STRUCT m_pDpTail; /* rx Q */
30281 +  UINT8 displayData;  /* 1 to display rx data on screen; default is 0 */
30282 +  UINT8 captureData;
30283 +  UINT8 verifyData;
30284 +  ATM_CAPTURE_HDR m_ulData[UT_BUFFER_SIZE]; 
30285 +  int m_ulBufferPosition;
30286 +  UINT32 m_ulCurSeqNumber;
30287 +  ATM_TEST_ERROR m_ucTestError[UT_MAX_VCCS+1];
30288 +  ATM_STATS m_atmStats;
30289 +  ATM_VERIFICATION_INFO dataVerficationInfo[UT_MAX_VCCS]; 
30290 +  UINT8 txStop; 
30291 +} ATM_DIAG_CB, *pATM_DIAG_CB;
30292 +
30293 +/* 0xfffe15c */
30294 +typedef union phyLastDescConfig { 
30295 +  struct {
30296 +    UINT32 unused:22;
30297 +    UINT32 rxCfg:2;
30298 +    UINT32 unused1:2;
30299 +    UINT32 txCfg:2;
30300 +    UINT32 numRxDesc:2;
30301 +    UINT32 numTxDesc:2;
30302 +  }bit;
30303 +  UINT32 reg;
30304 +} PHY_LAST_DESC_CONFIG, *pPHY_LAST_DESC_CONFIG;
30305 +
30306 +/* 0xfffe4500-0xfffe45ff */
30307 +typedef union txAtmVpiVciTable { 
30308 +  struct {
30309 +    UINT32 unused:6;
30310 +    UINT32 swFlags:1;
30311 +    UINT32 crcEnable:1;
30312 +    UINT32 vpi: 8;
30313 +    UINT32 vci:16;
30314 +  }bit;
30315 +  UINT32 entry;
30316 +} TX_ATM_VPI_VCI_TABLE, *pTX_ATM_VPI_VCI_TABLE;
30317 +
30318 +/* 0xfffe4600-0xfffe46ff */
30319 +typedef union RxAtmVpiVciTable {
30320 +  struct {
30321 +    UINT32 unused:6;
30322 +    UINT32 valid:1;
30323 +    UINT32 vpi:8;
30324 +    UINT32 vci:16;
30325 +    UINT32 port:1;
30326 +  } camSide;  /* even; */
30327 +  struct {
30328 +    UINT32 unused:21;
30329 +    UINT32 userDataIR:1; /* assert IR for user data immediate response */
30330 +    UINT32 oamIR:1; /* assert IR for OAM immediate response */
30331 +    UINT32 rmIR:1;  /* assert IR for RM immediate response */
30332 +    UINT32 vcId:3;  /* VCID */
30333 +    UINT32 userDataCrcEnable:1;
30334 +    UINT32 oamRouteCode:1;  /* 0=route to rx cell q; 1= route to rx mips cell fifo */
30335 +    UINT32 udrc:1;  /* User Data Routing Code */
30336 +    UINT32 circuitType:2; 
30337 +  } ramSide; /* odd; */
30338 +  UINT32 entry;
30339 +} RX_ATM_VPI_VCI_TABLE, *pRX_ATM_VPI_VCI_TABLE;
30340 +
30341 +/* 6345; 0xfffe4300- 0xfffe43ff */
30342 +typedef union atmIntrRegs {
30343 +  struct {
30344 +    UINT32 unused:20; 
30345 +    UINT32 vcamMm:1;   /* RX VCAM multiple match */
30346 +    UINT32 rxRtDc:1;   /* Rx Router discard cell due to full rx buffer */
30347 +    UINT32 rpqIr:1;    /* Receive Packet Queue got a packet tagged with immediate response */
30348 +    UINT32 rcqIr:1;    /* Receive Cell Queue got a cell tagged with immediate response */
30349 +    UINT32 rpqWd:1;    /* RX Pkt Q watchdog- no pkt rxed for the duration defined in RCQ wd timer */
30350 +    UINT32 rcqWd:1;    /* RX Cell Q watchdog */
30351 +    UINT32 mibHf:1;    /* one or more of the MIB coutners is half full */
30352 +    UINT32 fpqAe:1;    /* Free Packet Queue almost empty- has fewer buffers than FPQ watermark */
30353 +    UINT32 rpqAf:1;    /* Rx Packet Queue has exceeded RPQ watermark */
30354 +    UINT32 fcqAe:1;    /* Free Cell Queue almost Empty */
30355 +    UINT32 rcqAf:1;    /* Rx Cell Q almost full */
30356 +    UINT32 txs:1;      /* Tx SDRAM Interrupt- one of the TX SDRAM sub-channels intr is set */
30357 +  }statusMaskBit;      /* status & interrupt mask */
30358 +#ifdef BRCM_6348
30359 +  struct {
30360 +    UINT32 unused1:8;
30361 +    UINT32 sdqMask:8;  /* TX SDRAM watchdog timer interrupt */
30362 +    UINT32 unused:4;
30363 +    UINT32 irqMask:12; 
30364 +  }irqMaskBit;
30365 +  struct {
30366 +    UINT32 unused:28;   
30367 +    UINT32 sdWd:4;     /* TX SDRAM Watchdog */
30368 +  }txSdramValue;
30369 +#else /* 6345 */
30370 +  struct {
30371 +    UINT32 unused:16;   
30372 +    UINT32 irqMask:16; 
30373 +  }irqMaskBit;
30374 +#endif /* BRCM_6348 */
30375 +  struct {
30376 +    UINT32 fcqAeWm:16;  /* Free Cell Q almost empty watermark */
30377 +    UINT32 rcqAfWm:16;  /* Rx Cell Q almost full watermark */
30378 +  }rxCellQBit;
30379 +  struct {
30380 +    UINT32 fpqAeWm:16;  /* Free Packet Q almost empty watermark */
30381 +    UINT32 rpqAfWm:16;  /* Rx Paket Q almost full watermark */
30382 +  }rxPktQBit;
30383 +  struct {
30384 +    UINT32 pktWdTo:16;  /* Watchdog timeout value in 50 uSec increments */
30385 +    UINT32 cellWdTo:16; /* Watchdog timeout value in 50 uSec increments */
30386 +  }rxWdTimer;
30387 +} ATM_INTR_REGS, *pATM_INTR_REGS;
30388 +
30389 +/* 0xfffe4700-0xfffe47ff */
30390 +typedef union atmShaperCtrlReg {
30391 +#ifdef BRCM_6348
30392 +  struct {
30393 +    UINT32 unused:7;
30394 +    UINT32 rst:1;      /* reset shaper */
30395 +    UINT32 pcr:12;     /* peak cell rate */
30396 +    UINT32 mpEn:1;     /* Multi-priority enabled */
30397 +    UINT32 priority:2; /* source scheduling sub-priority */
30398 +    UINT32 mcrEnable:1;/* Minimum Cell Rate Enabled */
30399 +    UINT32 alg:2;      /* source shaping algorithm */
30400 +    UINT32 pid:1;      /* Source destination Port ID */
30401 +    UINT32 vcid:4;     /* source VC ID */
30402 +    UINT32 enable:1;   /* source shaper enable */
30403 +  }bit;
30404 +#else /* 6345 */
30405 +  struct {
30406 +    UINT32 unused:9;
30407 +    UINT32 rst:1;      /* reset shaper */
30408 +    UINT32 pcr:12;     /* peak cell rate */
30409 +    UINT32 mpEn:1;     /* Multi-priority enabled */
30410 +    UINT32 priority:2; /* source scheduling sub-priority */
30411 +    UINT32 alg:2;      /* source shaping algorithm */
30412 +    UINT32 pid:1;      /* Source destination Port ID */
30413 +    UINT32 vcid:3;     /* source VC ID */
30414 +    UINT32 enable:1;   /* source shaper enable */
30415 +  }bit;
30416 +#endif /* BRCM_6348 */
30417 +  UINT32 entry;
30418 +} ATM_SHAPER_CTRL_REG, *pATM_SHAPER_CTRL_REG;
30419 +
30420 +typedef union atmShaperVbrReg {
30421 +  struct {
30422 +    UINT32 unused:1;
30423 +    UINT32 bt:19;
30424 +    UINT32 scr:12;
30425 +  }bit;
30426 +  UINT32 entry;
30427 +} ATM_SHAPER_VBR_REG, *pATM_SHAPER_VBR_REG;
30428 +
30429 +#ifdef BRCM_6348
30430 +typedef union atmShaperMcrReg {
30431 +  struct {
30432 +    UINT32 unused:20;
30433 +    UINT32 mcr:12;
30434 +  }bit;
30435 +  UINT32 entry;
30436 +} ATM_SHAPER_MCR_REG, *pATM_SHAPER_MCR_REG;
30437 +#endif /* BRCM_6348 */
30438 +
30439 +typedef union atmCellHdr {
30440 +  struct {
30441 +    UINT32 gfc:4;  
30442 +    UINT32 msb_vpi:4;  
30443 +    UINT32 vpi:4;  
30444 +    UINT32 msb_vci:4;  
30445 +    UINT32 vci:8;
30446 +    UINT32 lsb_vci:4;  
30447 +    UINT32 pt:3;  
30448 +    UINT32 clp:1;  
30449 +  }bit;
30450 +  UINT32 word1;
30451 +} ATM_CELL_HDR, *pATM_CELL_HDR;
30452 +#define ATM_RX_AAL_STATUS_ERROR_MASK_PORT0 0x108
30453 +
30454 +/* 0xfffe4428 */
30455 +typedef union atmRxAalStatusReg {
30456 +  struct {
30457 +    UINT32 unused:22;  
30458 +    UINT32 rxRouterStat_port1:1; /* RX cells dropped due to full cell buffer; */
30459 +    UINT32 rxRouterStat_port0:1; /* bit 8=port 0 fifo rx drop cell */
30460 +    UINT32 aal0ccnt_port1:1;     /* aal0 cell count has been incremented; bit 4=port0 */
30461 +    UINT32 aal0ccnt_port0:1;     /* aal0 cell count has been incremented; bit 4=port0 */
30462 +    UINT32 aal5ccnt_port1:1;     /* aal5 cell count has been incremented; bit 4=port0 */
30463 +    UINT32 aal5ccnt_port0:1;     /* aal5 cell count has been incremented; bit 4=port0 */
30464 +    UINT32 aal5d:1;        /* aal5 dropped cells */
30465 +    UINT32 aal5p:1;        /* aal5 pdu received */
30466 +    UINT32 aalxp:1;        /* non aal5 received */
30467 +    UINT32 aal5c:1;        /* aal5 received cells */
30468 +  }bit;
30469 +  UINT32 reg;
30470 +} ATM_RX_AAL_STATUS_REG, *pATM_RX_AAL_STATUS_REG;
30471 +/*  0xfffe441c */
30472 +#define ATM_RX_STATUS_ERROR_MASK_PORT0 0x32354
30473 +typedef union atmRxStatusReg {
30474 +  struct {
30475 +    UINT32 unused:14;  
30476 +    UINT32 gfc_err:1;  /* non zero gfc detected */
30477 +    UINT32 crc_err:1;  /* CRC-10 error detected on OAM/RM cells */
30478 +#ifdef BRCM_6348
30479 +    UINT32 rx_flow_err:1;  /* Receive cell dropped by RXATM layer 'cause RX cell FIFO full */
30480 +#else /* 6345 */
30481 +    UINT32 unused1:1;  
30482 +#endif
30483 +    UINT32 idle_err:1; /* Idle cell detected */
30484 +    UINT32 pti_err:1;  /* PTI Error detected (i.e. PT=binary 111) */
30485 +#ifdef BRCM_6348
30486 +    UINT32 unused2:1;  
30487 +    UINT32 uto2small:1;/* Too small of a cell from RX Utopia */
30488 +    UINT32 uto2big:1;  /* Too big of a cell from RX Utopia */
30489 +#else /* BRCM_6345 */
30490 +    UINT32 unused2:3;  
30491 +#endif
30492 +    UINT32 vcam_mme:1; /* VCAM multiple match error */
30493 +    UINT32 pne_err:1;  /* port not enable error */
30494 +    UINT32 came_port1:1;     /* PER port cam lookup error; bit6=port 0  */
30495 +    UINT32 came_port0:1;     /* PER port cam lookup error; bit6=port 0  */
30496 +    UINT32 dc_port1:1;       /* per port dropped cell; bit 4= port 0 */  
30497 +    UINT32 dc_port0:1;       /* per port dropped cell; bit 4= port 0 */  
30498 +    UINT32 ec_port1:1;       /* per port erred cell; bit 2=port 0 */
30499 +    UINT32 ec_port0:1;       /* per port erred cell; bit 2=port 0 */
30500 +    UINT32 vc_port1:1;       /* per port valid cell; bit 0=port 0 */
30501 +    UINT32 vc_port0:1;       /* per port valid cell; bit 0=port 0 */
30502 +  }bit;
30503 +  UINT32 reg;
30504 +} ATM_RX_STATUS_REG, *pATM_RX_STATUS_REG;
30505 +
30506 +#define ATM_TX_STATUS_ERROR_MASK_PORT0  0x41e80c54
30507 +typedef union atmTxStatusReg {
30508 +  struct {
30509 +    UINT32 fifoFull_port1:1; /* per port FIFO Full Status (1=full) */
30510 +    UINT32 fifoFull_port0:1; /* per port FIFO Full Status (1=full) */
30511 +    UINT32 unused:1;  
30512 +    UINT32 aal0_port1:1; /* aal0_port1 tx */
30513 +    UINT32 aal0_port0:1; /* aal0_port0 tx */
30514 +    UINT32 aal5_port1:1; /* aal5_port1 tx */
30515 +    UINT32 aal5_port0:1; /* aal5_port0 tx */
30516 +    UINT32 aal2big:1;  /* aal too big cell input */
30517 +    UINT32 aal5liErr:1;/* aal5 length indicator error */
30518 +    UINT32 aal5mlErr:1;/* aal5 max length error */
30519 +    UINT32 aal5ctErr:1;/* aal5 count error */
30520 +    UINT32 unused1:1;  
30521 +    UINT32 aal5d:1;    /* aal5 drop cell */
30522 +    UINT32 aal5p:1;    /* aal5 pdu passed */
30523 +    UINT32 aalxc:1;    /* non aal5 cell passed */
30524 +    UINT32 aal5c:1;    /* aal cell passed */
30525 +    UINT32 dropCell_port1:1; /* tx aal or tx atm dropped cell */
30526 +    UINT32 dropReq_port1:1;  /* one of the port dropped request */
30527 +    UINT32 scheCell_port1:1; /* per port scheduled cell */
30528 +    UINT32 sit_port1:1;      /* per port schedule interval timer count event */
30529 +    UINT32 dropCell_port0:1; /* tx aal or tx atm dropped cell */
30530 +    UINT32 dropReq_port0:1;  /* one of the port dropped request */
30531 +    UINT32 scheCell_port0:1; /* per port scheduled cell */
30532 +    UINT32 sit_port0:1;      /* per port schedule interval timer count event */
30533 +    UINT32 pne_err_port1:1;  /* port not enable error */
30534 +    UINT32 pne_err_port0:1;  /* port not enable error */
30535 +    UINT32 ff_err_port1:1;   /* fifo full error */
30536 +    UINT32 ff_err_port0:1;   /* fifo full error */
30537 +    UINT32 dc_port1:1;       /* per port dropped cell */
30538 +    UINT32 dc_port0:1;       /* per port dropped cell */
30539 +    UINT32 pc_port1:1;       /* per port processed cell */
30540 +    UINT32 pc_port0:1;       /* per port processed cell */
30541 +  }bit;
30542 +  UINT32 reg;
30543 +} ATM_TX_STATUS_REG, *pATM_TX_STATUS_REG;
30544 +
30545 +
30546 +typedef union atmTxHdrReg {
30547 +  struct {
30548 +    UINT32 unused1:14;
30549 +    UINT32 aal5SwTrailer:1; /* software trailer enable */
30550 +    UINT32 schedCrst_1:1;  /* scheuler reset */
30551 +    UINT32 schedCrst_0:1;  
30552 +    UINT32 unused:1; 
30553 +    UINT32 haltShpt_1:1;   /* halt shaper, used for dynamic configuration of shaper */
30554 +    UINT32 haltShpt_0:1;
30555 +    UINT32 altGFC:4;       /* alternate GFC value */
30556 +    UINT32 altGFCen_1:1;
30557 +    UINT32 altGFCen_0:1;   /* alternate GFC mode enable */
30558 +    UINT32 fRst_1:1;
30559 +    UINT32 fRst_0:1;
30560 +    UINT32 oamCrcEn_1:1;
30561 +    UINT32 oamCrcEn_0:1;
30562 +    UINT32 txEn_1:1;
30563 +    UINT32 txEn_0:1;
30564 +  }bit;
30565 +  UINT32 reg;
30566 +} ATM_TX_HDR_CFG_REG, *pATM_TX_HDR_CFG_REG;
30567 +
30568 +typedef union rxAalError {
30569 +  struct {
30570 +    UINT8 crc:1;             /* aal5 CRC error */
30571 +    UINT8 cpcsLen0:1;        /* aal5 cpcsLen error */
30572 +    UINT8 length:1;          /* aal5 len error */
30573 +    UINT8 maxSduExceed:1;    /* max sdu exceed error */
30574 +    UINT8 unused:4;
30575 +  }bit;
30576 +  UINT8 entry;
30577 +} RX_AAL_ERROR;
30578 +
30579 +typedef union rxAtmError {
30580 +  struct {
30581 +    UINT8 pne:1;             /* port not enable error */
30582 +    UINT8 hec:1;             /* HEC error */
30583 +    UINT8 pti:1;             /* pti error */
30584 +    UINT8 idle:1;            /* idle rx */
30585 +    UINT8 camLkup:1;         /* cam look up error */
30586 +    UINT8 unused:1;          
30587 +    UINT8 oamCrc:1;          /* oam crc */
30588 +    UINT8 gfc:1;             /* gfc error */
30589 +  }bit;
30590 +  UINT8 entry;
30591 +} RX_ATM_ERROR;
30592 +
30593 +/* 0xfffe442c */
30594 +typedef union atmUtopiaCfg {
30595 +  struct {
30596 +    UINT32 unused:26;
30597 +    UINT32 rxLevel2:1;   /* when set=level 2, when 0=level 1 */
30598 +    UINT32 rxEn:1;       /* enable RX Utopia Operation */
30599 +    UINT32 unused1:2;
30600 +    UINT32 txLevel2:1;   /* when set=level 2, when 0=level 1 */
30601 +    UINT32 txEn:1;       /* enable TX Utopia Operation */
30602 +  }bit;
30603 +  UINT32 entry;
30604 +} ATM_UTOPIA_CFG, *pATM_UTOPIA_CFG;
30605 +
30606 +typedef union portSchedulerCfg {
30607 +  struct {
30608 +    UINT32 cit:16;
30609 +    UINT32 unused:12;
30610 +    UINT32 mode:2;
30611 +    UINT32 arb:1;
30612 +    UINT32 en:1;
30613 +  }bit;
30614 +  UINT32 entry;
30615 +} ATM_PORT_SCHEDULER_CFG, *pATM_PORT_SCHEDULER_CFG;
30616 +
30617 +/* memory map operation definition */
30618 +typedef struct atm_regs {
30619 +    int kmem_fd;
30620 +    char *mmap_addr;
30621 +    unsigned long addr;
30622 +    unsigned int size;
30623 +    unsigned int offset;
30624 +} atm_regs;
30625 +
30626 +int getVccNextIndex(void);
30627 +void removeVccIndex(int index);
30628 +int isVpiVciExisted(UINT32 interface, UINT16 vpi, UINT16 vci);
30629 +void atmDiagInit(void);
30630 +BCMATM_STATUS bcmAtmDiagInit(void);
30631 +BCMATM_STATUS bcmAtmDiagUnInit(void);
30632 +BCMATM_STATUS bcmAtmAddVccCommand(pUT_VCC_ADDR_INFO pVccAddrs, pUT_VCC_CFG pVccCfg,
30633 +                                  pUT_TRAFFIC_DESCR_PARM_ENTRY pTd);
30634 +BCMATM_STATUS bcmAtmSendVccCommand(pATM_TEST_TX_INFO pAtmInfo);
30635 +BCMATM_STATUS bcmAtmCaptureCommand(int mode);
30636 +BCMATM_STATUS bcmAtmSendManagementCommand(pATM_TEST_TX_INFO pAtmInfo);
30637 +BCMATM_STATUS bcmAtmDeleteVccCommand(pUT_VCC_ADDR_INFO pVccAddrs);
30638 +BCMATM_STATUS bcmAtmSendAllVccsCommand(pATM_TEST_TX_INFO pAtmInfo);
30639 +BCMATM_STATUS bcmAtmSendMultiPriorityCommand(pATM_TEST_TX_INFO pAtmInfo);
30640 +BCMATM_STATUS bcmAtmSendLoopbackCommand(UINT8 mode);
30641 +BCMATM_STATUS bcmAtmAddMPVccCommand(pUT_VCC_ADDR_INFO pVccAddrs, pUT_VCC_CFG pVccCfg,
30642 +                                    pUT_TRAFFIC_DESCR_PARM_ENTRY pTd);
30643 +BCMATM_STATUS bcmAtmDeleteMPVccCommand(pUT_VCC_ADDR_INFO pVccAddrs);
30644 +BCMATM_STATUS bcmAtmSendMPVccCommand(pATM_TEST_TX_INFO pAtmInfo);
30645 +BCMATM_STATUS bcmAtmSendMultiPriorityCommand(pATM_TEST_TX_INFO pAtmInfo);
30646 +BCMATM_STATUS bcmAtmModifyTDCommand(pUT_TRAFFIC_DESCR_PARM_ENTRY pTD, UINT32 index);
30647 +int bcmAtmGetStatsCommand(int reset);
30648 +int bcmAtmToggleVerifyCommand(void);
30649 +int bcmAtmToggleCaptureCommand(void);
30650 +int bcmAtmToggleDisplayCommand(void);
30651 +int bcmAtmStopTxCommand(void);
30652 +int isVpiVciExisted(UINT32 interface, UINT16 vpi, UINT16 vci);
30653 +int bcmDiag_unmapregs(atm_regs *mapregs);
30654 +atm_regs *bcmDiag_mapregs(unsigned long addr, int size);
30655 +int bcmDiagGetVerificationStats(int vcc,char *pResult);
30656 +void bcmDiagClearSARstats(void);
30657 +void bcmDiagReadSARstats(int parm);
30658 +int bcmDiagGetSARStats(char *pResult);
30659 +#if defined(__cplusplus)
30660 +}
30661 +#endif
30662 +
30663 +#endif
30664 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmosservices.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmosservices.h
30665 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/atmosservices.h  1970-01-01 01:00:00.000000000 +0100
30666 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/atmosservices.h 2006-06-26 09:07:10.000000000 +0200
30667 @@ -0,0 +1,98 @@
30668 +/*
30669 +<:copyright-broadcom 
30670
30671 + Copyright (c) 2002 Broadcom Corporation 
30672 + All Rights Reserved 
30673 + No portions of this material may be reproduced in any form without the 
30674 + written permission of: 
30675 +          Broadcom Corporation 
30676 +          16215 Alton Parkway 
30677 +          Irvine, California 92619 
30678 + All information contained in this document is Broadcom Corporation 
30679 + company private, proprietary, and trade secret. 
30680
30681 +:>
30682 +*/
30683 +//**************************************************************************
30684 +// File Name  : BcmAtmApi.h
30685 +//
30686 +// Description: This file contains the definitions, structures and function
30687 +//              prototypes for the Broadcom Asynchronous Transfer Mode (ATM)
30688 +//              Application Program Interface (API).
30689 +//
30690 +// Updates    : 09/15/2000  lat.  Created.
30691 +//**************************************************************************
30692 +
30693 +#if !defined(_ATMOSSERVICES_H_)
30694 +#define _ATMOSSERVICES_H_
30695 +
30696 +#if defined(__cplusplus)
30697 +extern "C" {
30698 +#endif
30699 +
30700 +//**************************************************************************
30701 +// Constant Definitions
30702 +//**************************************************************************
30703 +#define RTN_SUCCESS                 0
30704 +#define RTN_ERROR                   1
30705 +#define USE_CURRENT_THREAD_PRIORITY 0
30706 +
30707 +//**************************************************************************
30708 +// Type Definitions
30709 +//**************************************************************************
30710 +typedef void (*FN_GENERIC) (void *);
30711 +typedef struct AtmOsFuncs
30712 +{
30713 +    FN_GENERIC pfnAlloc;
30714 +    FN_GENERIC pfnFree;
30715 +    FN_GENERIC pfnDelay;
30716 +    FN_GENERIC pfnCreateSem;
30717 +    FN_GENERIC pfnRequestSem;
30718 +    FN_GENERIC pfnReleaseSem;
30719 +    FN_GENERIC pfnDeleteSem;
30720 +    FN_GENERIC pfnDisableInts;
30721 +    FN_GENERIC pfnEnableInts;
30722 +    FN_GENERIC pfnInvalidateCache;
30723 +    FN_GENERIC pfnFlushCache;
30724 +    FN_GENERIC pfnGetTopMemAddr;
30725 +    FN_GENERIC pfnBlinkLed;
30726 +    FN_GENERIC pfnGetSystemTick;
30727 +    FN_GENERIC pfnStartTimer;
30728 +    FN_GENERIC pfnPrintf;
30729 +} ATM_OS_FUNCS, *PATM_OS_FUNCS;
30730 +
30731 +//**************************************************************************
30732 +// Function Prototypes
30733 +//**************************************************************************
30734 +
30735 +UINT32 AtmOsInitialize( PATM_OS_FUNCS pFuncs );
30736 +char *AtmOsAlloc( UINT32 ulSize );
30737 +void AtmOsFree( char *pBuf );
30738 +UINT32 AtmOsCreateThread( char *pszName, void *pFnEntry, UINT32 ulFnParm,
30739 +    UINT32 ulPriority, UINT32 ulStackSize, UINT32 *pulThreadId );
30740 +UINT32 AtmOsCreateSem( UINT32 ulInitialState );
30741 +UINT32 AtmOsRequestSem( UINT32 ulSem, UINT32 ulTimeoutMs );
30742 +void AtmOsReleaseSem( UINT32 ulSem );
30743 +void AtmOsDeleteSem( UINT32 ulSem );
30744 +UINT32 AtmOsDisableInts( void );
30745 +void AtmOsEnableInts( UINT32 ulLevel );
30746 +void AtmOsDelay( UINT32 ulTimeoutMs );
30747 +UINT32 AtmOsTickGet( void );
30748 +UINT32 AtmOsTickCheck( UINT32 ulWaitTime, UINT32 ulMsToWait );
30749 +void AtmOsInvalidateCache( void *pBuf, UINT32 ulLength );
30750 +void AtmOsFlushCache( void *pBuf, UINT32 ulLength );
30751 +char *AtmOsTopMemAddr( void );
30752 +void AtmOsBlinkLed( void );
30753 +UINT32 AtmOsInitDeferredHandler( void *pFnEntry, UINT32 ulFnParm,
30754 +    UINT32 ulTimeout );
30755 +void AtmOsScheduleDeferred( UINT32 ulHandle );
30756 +void AtmOsUninitDeferredHandler( UINT32 ulHandle );
30757 +UINT32 AtmOsStartTimer( void *pFnEntry, UINT32 ulFnParm, UINT32 ulTimeout );
30758 +void AtmOsPrintf( char *, ... );
30759 +
30760 +#if defined(__cplusplus)
30761 +}
30762 +#endif
30763 +
30764 +#endif // _ATMOSSERVICES_H_
30765 +
30766 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcm_common.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcm_common.h
30767 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcm_common.h     1970-01-01 01:00:00.000000000 +0100
30768 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcm_common.h    2006-06-26 09:07:10.000000000 +0200
30769 @@ -0,0 +1,48 @@
30770 +/*
30771 +<:copyright-broadcom 
30772
30773 + Copyright (c) 2004 Broadcom Corporation 
30774 + All Rights Reserved 
30775 + No portions of this material may be reproduced in any form without the 
30776 + written permission of: 
30777 +          Broadcom Corporation 
30778 +          16215 Alton Parkway 
30779 +          Irvine, California 92619 
30780 + All information contained in this document is Broadcom Corporation 
30781 + company private, proprietary, and trade secret. 
30782
30783 +:>
30784 +*/
30785 +
30786 +#ifndef __BCM_COMMON_H
30787 +#define __BCM_COMMON_H
30788 +
30789 +#if defined(CONFIG_BCM96338)
30790 +#include <6338_common.h>
30791 +#endif
30792 +#if defined(CONFIG_BCM96345)
30793 +#include <6345_common.h>
30794 +#endif
30795 +#if defined(CONFIG_BCM96348)
30796 +#include <6348_common.h>
30797 +#endif
30798 +
30799 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)      /* starting from 2.4.5 */
30800 +#define skb_dataref(x)   (&skb_shinfo(x)->dataref)
30801 +#else
30802 +#define skb_dataref(x)   skb_datarefp(x)
30803 +#endif
30804 +
30805 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19) /* starting from 2.4.19 */
30806 +#define VIRT_TO_PHY(a)  (((unsigned long)(a)) & 0x1fffffff)
30807 +#else
30808 +#define VIRT_TO_PHY     virt_to_phys
30809 +#endif
30810 +
30811 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
30812 +#define __save_and_cli  save_and_cli
30813 +#define __restore_flags restore_flags
30814 +#endif
30815 +
30816 +#endif
30817 +
30818 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcm_map.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcm_map.h
30819 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcm_map.h        1970-01-01 01:00:00.000000000 +0100
30820 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcm_map.h       2006-06-26 09:07:10.000000000 +0200
30821 @@ -0,0 +1,31 @@
30822 +/*
30823 +<:copyright-broadcom 
30824
30825 + Copyright (c) 2004 Broadcom Corporation 
30826 + All Rights Reserved 
30827 + No portions of this material may be reproduced in any form without the 
30828 + written permission of: 
30829 +          Broadcom Corporation 
30830 +          16215 Alton Parkway 
30831 +          Irvine, California 92619 
30832 + All information contained in this document is Broadcom Corporation 
30833 + company private, proprietary, and trade secret. 
30834
30835 +:>
30836 +*/
30837 +
30838 +#ifndef __BCM_MAP_H
30839 +#define __BCM_MAP_H
30840 +
30841 +#if defined(CONFIG_BCM96338)
30842 +#include <6338_map.h>
30843 +#endif
30844 +#if defined(CONFIG_BCM96345)
30845 +#include <6345_map.h>
30846 +#endif
30847 +#if defined(CONFIG_BCM96348)
30848 +#include <6348_map.h>
30849 +#endif
30850 +
30851 +#endif
30852 +
30853 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmadsl.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmadsl.h
30854 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmadsl.h        1970-01-01 01:00:00.000000000 +0100
30855 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmadsl.h       2006-06-26 09:07:10.000000000 +0200
30856 @@ -0,0 +1,199 @@
30857 +/*
30858 +<:copyright-broadcom 
30859
30860 + Copyright (c) 2002 Broadcom Corporation 
30861 + All Rights Reserved 
30862 + No portions of this material may be reproduced in any form without the 
30863 + written permission of: 
30864 +          Broadcom Corporation 
30865 +          16215 Alton Parkway 
30866 +          Irvine, California 92619 
30867 + All information contained in this document is Broadcom Corporation 
30868 + company private, proprietary, and trade secret. 
30869
30870 +:>
30871 +*/
30872 +//**************************************************************************
30873 +// File Name  : Adsl.h
30874 +//
30875 +// Description: This file contains the definitions, structures and function
30876 +//              prototypes for ADSL PHY interface
30877 +//
30878 +//**************************************************************************
30879 +#if !defined(_BCMADSL_H_)
30880 +#define _BCMADSL_H_
30881 +
30882 +#if defined(__cplusplus)
30883 +extern "C" {
30884 +#endif
30885 +
30886 +/* Incldes. */
30887 +#include "AdslMibDef.h"
30888 +
30889 +//**************************************************************************
30890 +// Type Definitions
30891 +//**************************************************************************
30892 +
30893 +// Return status values
30894 +typedef enum BcmAdslStatus
30895 +{
30896 +    BCMADSL_STATUS_SUCCESS = 0,
30897 +    BCMADSL_STATUS_ERROR
30898 +} BCMADSL_STATUS;
30899 +
30900 +// Return status values
30901 +typedef enum AdslLinkState
30902 +{
30903 +    BCM_ADSL_LINK_UP = 0,
30904 +    BCM_ADSL_LINK_DOWN,
30905 +       BCM_ADSL_TRAINING_G992_EXCHANGE,
30906 +       BCM_ADSL_TRAINING_G992_CHANNEL_ANALYSIS,
30907 +       BCM_ADSL_TRAINING_G992_STARTED,
30908 +       BCM_ADSL_TRAINING_G994,
30909 +       BCM_ADSL_G994_NONSTDINFO_RECEIVED,
30910 +    BCM_ADSL_BERT_COMPLETE,
30911 +       BCM_ADSL_ATM_IDLE,
30912 +    BCM_ADSL_EVENT,
30913 +    BCM_ADSL_G997_FRAME_RECEIVED,
30914 +    BCM_ADSL_G997_FRAME_SENT
30915 +} ADSL_LINK_STATE;
30916 +
30917 +#ifndef DISABLE_ADSL_OLD_DEF
30918 +#define        ADSL_LINK_UP            BCM_ADSL_LINK_UP
30919 +#define        ADSL_LINK_DOWN          BCM_ADSL_LINK_DOWN
30920 +#endif
30921 +
30922 +/* ADSL test modes */
30923 +typedef enum AdslTestMode
30924 +{
30925 +    ADSL_TEST_NORMAL = 0,
30926 +    ADSL_TEST_REVERB,
30927 +    ADSL_TEST_MEDLEY,
30928 +    ADSL_TEST_SELECT_TONES,
30929 +    ADSL_TEST_NO_AUTO_RETRAIN,
30930 +       ADSL_TEST_MARGIN_TWEAK,
30931 +       ADSL_TEST_ESTIMATE_PLL_PHASE,
30932 +       ADSL_TEST_REPORT_PLL_PHASE_STATUS,
30933 +       ADSL_TEST_AFELOOPBACK,
30934 +    ADSL_TEST_L3,
30935 +    ADSL_TEST_DIAGMODE,
30936 +    ADSL_TEST_L0
30937 +} ADSL_TEST_MODE;
30938 +
30939 +// ADSL_CHANNEL_ADDR Contains ADSL Utopia PHY addresses
30940 +typedef struct AdslChannelAddr
30941 +{
30942 +    UINT16 usFastChannelAddr;
30943 +    UINT16 usInterleavedChannelAddr;
30944 +} ADSL_CHANNEL_ADDR, *PADSL_CHANNEL_ADDR;
30945 +
30946 +// ADSL_CONNECTION_INFO Contains ADSL Connection Info
30947 +typedef struct AdslConnectionInfo
30948 +{
30949 +       ADSL_LINK_STATE LinkState; 
30950 +    UINT32 ulFastUpStreamRate;
30951 +    UINT32 ulFastDnStreamRate;
30952 +    UINT32 ulInterleavedUpStreamRate;
30953 +    UINT32 ulInterleavedDnStreamRate;
30954 +} ADSL_CONNECTION_INFO, *PADSL_CONNECTION_INFO;
30955 +
30956 +/* OEM parameter definition */
30957 +#define ADSL_OEM_G994_VENDOR_ID       1    /* Vendor ID used during G.994 handshake */
30958 +#define ADSL_OEM_G994_XMT_NS_INFO     2    /* G.994 non-standard info field to send */
30959 +#define ADSL_OEM_G994_RCV_NS_INFO     3    /* G.994 received non-standard */
30960 +#define ADSL_OEM_EOC_VENDOR_ID        4    /* EOC reg. 0 */
30961 +#define ADSL_OEM_EOC_VERSION          5    /* EOC reg. 1 */
30962 +#define ADSL_OEM_EOC_SERIAL_NUMBER    6    /* EOC reg. 2 */
30963 +#define ADSL_OEM_T1413_VENDOR_ID      7    /* Vendor ID used during T1.413 handshake */
30964 +#define ADSL_OEM_T1413_EOC_VENDOR_ID  8    /* EOC reg. 0 (vendor ID) in T1.413 mode */
30965 +
30966 +/* XMT gain definitions */
30967 +#define ADSL_XMT_GAIN_AUTO                       0x80000000
30968 +
30969 +typedef struct
30970 +{
30971 +    int                                diagCmd;
30972 +    int                                diagMap;
30973 +    int                                logTime;
30974 +       int                             srvIpAddr;
30975 +       int                             gwIpAddr;
30976 +} ADSL_DIAG, *PADSL_DIAG;
30977 +
30978 +typedef struct
30979 +{
30980 +    short                      x;
30981 +    short                      y;
30982 +} ADSL_CONSTELLATION_POINT, *PADSL_CONSTELLATION_POINT;
30983 +
30984 +#define ADSL_CONSTEL_DATA_ID           0
30985 +#define ADSL_CONSTEL_PILOT_ID          1
30986 +
30987 +#define ADSL_MIB_INFO  adslMibInfo
30988 +typedef        ADSL_MIB_INFO   *PADSL_MIB_INFO;
30989 +
30990 +typedef void (*ADSL_FN_NOTIFY_CB) (ADSL_LINK_STATE AdslLinkState, UINT32 ulParm); 
30991 +
30992 +//**************************************************************************
30993 +// Function Prototypes
30994 +//**************************************************************************
30995 +
30996 +BCMADSL_STATUS BcmAdsl_Check(void);
30997 +BCMADSL_STATUS BcmAdsl_Initialize(ADSL_FN_NOTIFY_CB pFnNotifyCb, UINT32 ulParm, adslCfgProfile *pAdslCfg);
30998 +#ifdef LINUX
30999 +BCMADSL_STATUS BcmAdsl_MapAtmPortIDs(UINT16 usAtmFastPortId, UINT16 usAtmInterleavedPortId);
31000 +#endif
31001 +BCMADSL_STATUS BcmAdsl_Uninitialize(void);
31002 +BCMADSL_STATUS BcmAdsl_ConnectionStart(void);
31003 +BCMADSL_STATUS BcmAdsl_ConnectionStop(void);
31004 +BCMADSL_STATUS BcmAdsl_GetPhyAddresses(PADSL_CHANNEL_ADDR pChannelAddr);
31005 +BCMADSL_STATUS BcmAdsl_SetPhyAddresses(PADSL_CHANNEL_ADDR pChannelAddr);
31006 +BCMADSL_STATUS BcmAdsl_GetConnectionInfo(PADSL_CONNECTION_INFO pConnectionInfo);
31007 +BCMADSL_STATUS BcmAdsl_DiagCommand(PADSL_DIAG pAdslDiag);
31008 +int BcmAdsl_GetObjectValue(char *objId, int objIdLen, char *dataBuf, long *dataBufLen);
31009 +BCMADSL_STATUS BcmAdsl_StartBERT(unsigned long totalBits);
31010 +BCMADSL_STATUS BcmAdsl_StopBERT(void);
31011 +BCMADSL_STATUS BcmAdsl_BertStartEx(unsigned long bertSec);
31012 +BCMADSL_STATUS BcmAdsl_BertStopEx(void);
31013 +BCMADSL_STATUS BcmAdsl_CheckPowerLoss(void);
31014 +BCMADSL_STATUS BcmAdsl_SendDyingGasp(int powerCtl);
31015 +BCMADSL_STATUS BcmAdsl_Configure(adslCfgProfile *pAdslCfg);
31016 +BCMADSL_STATUS BcmAdsl_GetVersion(adslVersionInfo *pAdslVer);
31017 +BCMADSL_STATUS BcmAdsl_SetSDRAMBaseAddr(void *pAddr);
31018 +BCMADSL_STATUS BcmAdsl_SetVcEntry (int gfc, int port, int vpi, int vci);
31019 +BCMADSL_STATUS BcmAdsl_SetVcEntryEx (int gfc, int port, int vpi, int vci, int pti_clp);
31020 +
31021 +BCMADSL_STATUS BcmAdsl_ResetStatCounters(void);
31022 +BCMADSL_STATUS BcmAdsl_SetAtmLoopbackMode(void);
31023 +BCMADSL_STATUS BcmAdsl_SetTestMode(ADSL_TEST_MODE testMode);
31024 +BCMADSL_STATUS BcmAdsl_SelectTones(
31025 +       int             xmtStartTone, 
31026 +       int             xmtNumTones, 
31027 +       int             rcvStartTone,
31028 +       int             rcvNumTones, 
31029 +       char    *xmtToneMap,
31030 +       char    *rcvToneMap
31031 +       );
31032 +BCMADSL_STATUS BcmAdsl_SetDiagMode(int diagMode);
31033 +
31034 +int BcmAdsl_GetConstellationPoints (int toneId, ADSL_CONSTELLATION_POINT *pointBuf, int numPoints);
31035 +
31036 +int BcmAdsl_GetOemParameter (int paramId, void *buf, int len);
31037 +int BcmAdsl_SetOemParameter (int paramId, void *buf, int len);
31038 +int BcmAdsl_SetXmtGain(int gain);
31039 +
31040 +UINT32 BcmAdsl_GetSelfTestMode(void);
31041 +void   BcmAdsl_SetSelfTestMode(UINT32 stMode);
31042 +UINT32 BcmAdsl_GetSelfTestResults(void);
31043 +
31044 +BCMADSL_STATUS BcmAdsl_G997SendData(void *buf, int len);
31045 +void *BcmAdsl_G997FrameGet(int *pLen);
31046 +void *BcmAdsl_G997FrameGetNext(int *pLen);
31047 +void  BcmAdsl_G997FrameFinished(void);
31048 +void BcmAdsl_DyingGaspHandler(void *context);
31049 +
31050 +#if defined(__cplusplus)
31051 +}
31052 +#endif
31053 +
31054 +#endif // _BCMADSL_H_
31055 +
31056 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmatmapi.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmatmapi.h
31057 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmatmapi.h      1970-01-01 01:00:00.000000000 +0100
31058 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmatmapi.h     2006-06-26 09:07:10.000000000 +0200
31059 @@ -0,0 +1,699 @@
31060 +/*
31061 +<:copyright-broadcom
31062 +
31063 + Copyright (c) 2002 Broadcom Corporation
31064 + All Rights Reserved
31065 + No portions of this material may be reproduced in any form without the
31066 + written permission of:
31067 +          Broadcom Corporation
31068 +          16215 Alton Parkway
31069 +          Irvine, California 92619
31070 + All information contained in this document is Broadcom Corporation
31071 + company private, proprietary, and trade secret.
31072 +
31073 +:>
31074 +*/
31075 +//**************************************************************************
31076 +// File Name  : BcmAtmApi.h
31077 +//
31078 +// Description: This file contains the definitions, structures and function
31079 +//              prototypes for the Broadcom Asynchronous Transfer Mode (ATM)
31080 +//              Application Program Interface (API).
31081 +//
31082 +// Updates    : 09/15/2000  lat.  Created.
31083 +//**************************************************************************
31084 +
31085 +#if !defined(_BCMATMAPI_H_)
31086 +#define _BCMATMAPI_H_
31087 +
31088 +#if defined(__cplusplus)
31089 +extern "C" {
31090 +#endif
31091 +
31092 +//**************************************************************************
31093 +// Constant Definitions
31094 +//**************************************************************************
31095 +
31096 +// ATM physical port constants.
31097 +#define PHY_NUM_PORTS                       4
31098 +#define PHY_0                               0
31099 +#define PHY_1                               1
31100 +#define PHY_2                               2 // [BCM635x Only]
31101 +#define PHY_3                               3 // [BCM635x Only]
31102 +
31103 +// Used for backwards compatibility.
31104 +#define PHY_UTOPIA0                         0
31105 +#define PHY_UTOPIA1                         1
31106 +#define PHY_UTOPIA2                         2
31107 +#define PHY_UTOPIA3_TC_LOOPBACK             3
31108 +
31109 +// Values for ATM_PORT_CFG ucPortType.
31110 +#define PT_DISABLED                         0
31111 +#define PT_UTOPIA                           1
31112 +#define PT_LOOPBACK                         2
31113 +#define PT_TC                               3 // [BCM635x Only]
31114 +#define PT_ADSL_INTERLEAVED                 4 // [BCM6345 Only]
31115 +#define PT_ADSL_FAST                        5 // [BCM6345 Only]
31116 +
31117 +// Wildcard definitions.
31118 +#define ALL_INTERFACES                      0xffffffff
31119 +#define ANY_PRIORITY                        0xff
31120 +
31121 +// Values for ATM_TRAFFIC_DESCR_PARM_ENTRY ulTrafficDescrType.
31122 +#define TDT_ATM_NO_TRAFFIC_DESCRIPTOR       1
31123 +#define TDT_ATM_NO_CLP_NO_SCR               2
31124 +#define TDT_ATM_CLP_NO_TAGGING_NO_SCR       3
31125 +#define TDT_ATM_CLP_TAGGING_NO_SCR          4
31126 +#define TDT_ATM_NO_CLP_SCR                  5
31127 +#define TDT_ATM_CLP_NO_TAGGING_SCR          6 // [BCM635x Only]
31128 +#define TDT_ATM_CLP_TAGGING_SCR             7 // [BCM635x Only]
31129 +#define TDT_ATM_CLP_NO_TAGGING_MCR          8 // [BCM6348 Only]
31130 +#define TDT_ATM_CLP_TRANSPARENT_NO_SCR      9
31131 +#define TDT_ATM_CLP_TRANSPARENT_SCR         10
31132 +#define TDT_ATM_NO_CLP_TAGGING_NO_SCR       11
31133 +#define TDT_ATM_NO_CLP_NO_SCR_CDVT          12
31134 +#define TDT_ATM_NO_CLP_SCR_CDVT             13
31135 +#define TDT_ATM_CLP_NO_TAGGING_SCR_CDVT     14 // [BCM635x Only]
31136 +#define TDT_ATM_CLP_TAGGING_SCR_CDVT        15 // [BCM635x Only]
31137 +
31138 +// Values for ATM_TRAFFIC_DESCR_PARM_ENTRY ulTrafficDescrRowStatus.
31139 +#define TDRS_ACTIVE                         1
31140 +#define TDRS_NOT_IN_SERVICE                 2
31141 +
31142 +// Values for ATM_TRAFFIC_DESCR_PARM_ENTRY ulServiceCategory.
31143 +#define SC_OTHER                            1
31144 +#define SC_CBR                              2
31145 +#define SC_RT_VBR                           3
31146 +#define SC_NRT_VBR                          4
31147 +#define SC_UBR                              6
31148 +
31149 +// Values for ATM_INTERFACE_CFG ulIfAdminStatus and ATM_VCC_CFG
31150 +// ulAtmVclAdminStatus.
31151 +#define ADMSTS_UP                           1
31152 +#define ADMSTS_DOWN                         2
31153 +#define ADMSTS_TESTING                      3
31154 +
31155 +// Values for ATM_INTERFACE_CFG ulIfOperStatus and ATM_VCC_CFG
31156 +// ulAtmVclOperStatus.
31157 +#define OPRSTS_UP                           1
31158 +#define OPRSTS_DOWN                         2
31159 +#define OPRSTS_UNKNOWN                      3
31160 +
31161 +// Values for ATM_INTERFACE_LINK_INFO ulLinkState.
31162 +#define LINK_UP                             1
31163 +#define LINK_DOWN                           2
31164 +
31165 +// Values for ulAalType.
31166 +#define AAL_2                               0 // [BCM635x Only]
31167 +#define AAL_TRANSPARENT                     1
31168 +#define AAL_0_PACKET                        2
31169 +#define AAL_0_CELL_CRC                      3
31170 +#define AAL_5                               7
31171 +
31172 +// Values for ATM_VCC_CFG ulAtmVccEncapsType.
31173 +#define ET_VC_MULTIPLEX_ROUTED_PROTOCOL     1
31174 +#define ET_VC_MULTIPLEX_BRG_PROTOCOL_8023   2
31175 +#define ET_VC_MULTIPLEX_BRG_PROTOCOL_8025   3
31176 +#define ET_VC_MULTIPLEX_BRG_PROTOCOL_8026   4
31177 +#define ET_VC_MULTIPLEX_LAN_EMULATION_8023  5
31178 +#define ET_VC_MULTIPLEX_LAN_EMULATION_8025  6
31179 +#define ET_LLC_ENCAPSULATION                7
31180 +#define ET_MULTI_PROTOCOL_FRAME_RELAY_SSCS  8
31181 +#define ET_OTHER                            9
31182 +#define ET_UNKNOWN                          10
31183 +
31184 +// [BCM635x Only] Values for ATM_AAL2_VCC_CFG ucAal2CpsOptimisation.
31185 +#define OPT_SNG_PKT_PER_PDU_NO_OVERLAP      1
31186 +#define OPT_MULT_PKTS_PER_PDU_OVERLAP       2
31187 +
31188 +// [BCM635x Only] Values for ATM_INTERFACE_STATS ulTcAlarmState.
31189 +#define TCALM_NO_ALARM                      1
31190 +#define TCALM_LCD_FAILURE                   2
31191 +
31192 +// Values for ATM_NOTIFY_PARMS ulNotificationType.
31193 +#define ATM_NOTIFY_INTERFACE_CHANGE         1
31194 +
31195 +// Values for AN_INTF_CHANGE_PARMS ulInterfaceState.
31196 +#define ATM_INTERFACE_UP                    1
31197 +#define ATM_INTERFACE_DOWN                  2
31198 +
31199 +// Values for AN_VCC_CHANGE_PARMS ulInterfaceState.
31200 +#define ATM_VCC_UP                          1
31201 +#define ATM_VCC_DOWN                        2
31202 +
31203 +// Values for ATM_VCC_ATTACH_PARMS ulFlags.
31204 +#define AVAP_ALLOW_OAM_F5_SEGMENT_CELLS     0x0001
31205 +#define AVAP_ALLOW_OAM_F5_END_TO_END_CELLS  0x0002
31206 +#define AVAP_ALLOW_RM_CELLS                 0x0004
31207 +#define AVAP_ALLOW_OAM_F4_SEGMENT_CELLS     0x0008
31208 +#define AVAP_ALLOW_OAM_F4_END_TO_END_CELLS  0x0010
31209 +#define AVAP_ALLOW_CELLS_WITH_ERRORS        0x0020
31210 +#define AVAP_ADD_AAL0_CRC10                 0x0040
31211 +#define AVAP_DSP                            0x8000 // [BCM635x Only]
31212 +
31213 +// [BCM635x Only] Values for ATM_VCC_AAL2_CHANNEL_ID_PARMS ucVoiceRouting.
31214 +#define VOICE_ROUTE_MIPS                    0
31215 +#define VOICE_ROUTE_DSP                     2
31216 +
31217 +// [BCM635x Only] Values for ATM_VCC_AAL2_CHANNEL_ID_PARMS ucFlags.
31218 +#define CID_USE_FRAME_MODE                  0x01
31219 +
31220 +// Values for ATM_VCC_DATA_PARMS ucCircuitType.
31221 +#define CT_AAL0_PACKET                      0x02
31222 +#define CT_AAL0_CELL_CRC                    0x03
31223 +#define CT_OAM_F5_SEGMENT                   0x04
31224 +#define CT_OAM_F5_END_TO_END                0x05
31225 +#define CT_RM                               0x06
31226 +#define CT_AAL5                             0x07
31227 +#define CT_HDLC_PACKET                      0x08 // [BCM6348 Only]
31228 +#define CT_ANY_AAL2_MASK                    0x08 // [BCM635x Only]
31229 +#define CT_AAL2_ALARM                       0x08 // [BCM635x Only]
31230 +#define CT_AAL2_TYPE_3                      0x09 // [BCM635x Only]
31231 +#define CT_AAL2_TYPE_1                      0x0A // [BCM635x Only]
31232 +#define CT_AAL2_FRAME                       0x0B // [BCM635x Only]
31233 +#define CT_TRANSPARENT                      0x10
31234 +#define CT_OAM_F4_ANY                       0x20
31235 +
31236 +// OAM F4 VCI values.
31237 +#define VCI_OAM_F4_SEGMENT                  3
31238 +#define VCI_OAM_F4_END_TO_END               4
31239 +#define VCI_RM                              6
31240 +
31241 +// Values for ATM_VCC_DATA_PARMS ucFlags.
31242 +#define ATMDATA_CI                          0x04
31243 +#define ATMDATA_CLP                         0x08
31244 +
31245 +// [BCM635x Only] DSP specific values.
31246 +#define DSP_VCID                            31
31247 +
31248 +// ATM cell layer interface name
31249 +#define ATM_CELL_LAYER_IFNAME               "atm0"
31250 +
31251 +// AAL5 CPCS layer interface name
31252 +#define AAL5_CPCS_LAYER_IFNAME              "cpcs0"
31253 +
31254 +//**************************************************************************
31255 +// Type Definitions
31256 +//**************************************************************************
31257 +
31258 +// Return status values
31259 +typedef enum BcmAtmStatus
31260 +{
31261 +    STS_SUCCESS = 0,
31262 +    STS_ERROR,
31263 +    STS_STATE_ERROR,
31264 +    STS_PARAMETER_ERROR,
31265 +    STS_ALLOC_ERROR,
31266 +    STS_RESOURCE_ERROR,
31267 +    STS_IN_USE,
31268 +    STS_VCC_DOWN,
31269 +    STS_INTERFACE_DOWN,
31270 +    STS_LINK_DOWN,
31271 +    STS_NOT_FOUND,
31272 +    STS_NOT_SUPPORTED,
31273 +    STS_VCAM_MULT_MATCH_ERROR,
31274 +    STS_CCAM_MULT_MATCH_ERROR,
31275 +    STS_PKTERR_INVALID_VPI_VCI,
31276 +    STS_PKTERR_PORT_NOT_ENABLED,
31277 +    STS_PKTERR_HEC_ERROR,
31278 +    STS_PKTERR_PTI_ERROR,
31279 +    STS_PKTERR_RECEIVED_IDLE_CELL,
31280 +    STS_PKTERR_CIRCUIT_TYPE_ERROR,
31281 +    STS_PKTERR_OAM_RM_CRC_ERROR,
31282 +    STS_PKTERR_GFC_ERROR,
31283 +    STS_PKTERR_AAL5_AAL0_CRC_ERROR,
31284 +    STS_PKTERR_AAL5_AAL0_SHORT_PKT_ERROR,
31285 +    STS_PKTERR_AAL5_AAL0_LENGTH_ERROR,
31286 +    STS_PKTERR_AAL5_AAL0_BIG_PKT_ERROR,
31287 +    STS_PKTERR_AAL5_AAL0_SAR_TIMEOUT_ERROR,
31288 +    STS_PKTERR_AAL2F_HEC_ERROR,
31289 +    STS_PKTERR_AAL2F_SEQ_NUM_ERROR,
31290 +    STS_PKTERR_AAL2F_PARITY_ERROR,
31291 +    STS_PKTERR_AAL2F_CRC_ERROR,
31292 +    STS_PKTERR_AAL2F_CAM_ERROR,
31293 +    STS_PKTERR_AAL2F_BIG_PKT_ERROR,
31294 +    STS_PKTERR_AAL2F_RAS_TIMEOUT_ERROR,
31295 +    STS_PKTERR_AAL2F_SHORT_PKT_ERROR,
31296 +    STS_PKTERR_AAL2F_LENGTH_MISMATCH_ERROR,
31297 +    STS_PKTERR_AAL2V_HEC_ERROR,
31298 +    STS_PKTERR_AAL2V_SEQ_NUM_ERROR,
31299 +    STS_PKTERR_AAL2V_PARITY_ERROR,
31300 +    STS_PKTERR_AAL2V_CRC_ERROR,
31301 +    STS_PKTERR_AAL2V_CAM_ERROR,
31302 +    STS_PKTERR_AAL2V_OSF_MISMATCH_ERROR,
31303 +    STS_PKTERR_AAL2V_OSF_ERROR,
31304 +    STS_PKTERR_AAL2V_HEC_OVERLAP_ERROR,
31305 +    STS_PKTERR_AAL2V_BIG_PKT_ERROR,
31306 +    STS_PKTERR_AAL2V_RAS_ERROR,
31307 +    STS_PKTERR_AAL2V_UUI_ERROR
31308 +} BCMATM_STATUS;
31309 +
31310 +
31311 +// ATM_VCC_ADDR identifies a Virtual Channel Connection (VCC).
31312 +typedef struct AtmVccAddr
31313 +{
31314 +    UINT32 ulInterfaceId;
31315 +    UINT16 usVpi;
31316 +    UINT16 usVci;
31317 +} ATM_VCC_ADDR, *PATM_VCC_ADDR;
31318 +
31319 +
31320 +// ATM_PORT_CFG contains ATM physical port configuration parameters.
31321 +typedef struct AtmPortCfg
31322 +{
31323 +    UINT32 ulInterfaceId;
31324 +    UINT8 ucPortType;
31325 +    UINT8 ucPortAddr;
31326 +    UINT8 ucReserved[2];
31327 +} ATM_PORT_CFG, *PATM_PORT_CFG;
31328 +
31329 +
31330 +// ATM_INITIALIZATION_PARMS contains ATM API module initialization parameters.
31331 +#define ID_ATM_INITIALIZATION_PARMS         2
31332 +typedef struct AtmInitialization
31333 +{
31334 +    UINT32 ulStructureId;
31335 +    UINT32 ulThreadPriority;
31336 +    UINT16 usFreeCellQSize;
31337 +    UINT16 usFreePktQSize;
31338 +    UINT16 usFreePktQBufferSize;
31339 +    UINT16 usFreePktQBufferOffset; // offset into buffer to start receiving data
31340 +    UINT16 usReceiveCellQSize;
31341 +    UINT16 usReceivePktQSize;
31342 +    UINT8  ucTransmitFifoPriority; // [BCM635x Only]
31343 +    UINT8  ucReserved;
31344 +    UINT16 usAal5CpcsMaxSduLength;
31345 +    UINT16 usAal2SscsMaxSsarSduLength; // [BCM635x Only]
31346 +    ATM_PORT_CFG PortCfg[PHY_NUM_PORTS];
31347 +} ATM_INITIALIZATION_PARMS, *PATM_INITIALIZATION_PARMS;
31348 +
31349 +
31350 +// ATM_TRAFFIC_DESCR_PARM_ENTRY contains the fields needed to create a Traffic
31351 +// Descriptor Table parameter entry.
31352 +#define ID_ATM_TRAFFIC_DESCR_PARM_ENTRY     1
31353 +typedef struct AtmTrafficDescrParmEntry
31354 +{
31355 +    UINT32 ulStructureId;
31356 +    UINT32 ulTrafficDescrIndex;
31357 +    UINT32 ulTrafficDescrType;
31358 +    UINT32 ulTrafficDescrParm1;
31359 +    UINT32 ulTrafficDescrParm2;
31360 +    UINT32 ulTrafficDescrParm3;
31361 +    UINT32 ulTrafficDescrParm4;
31362 +    UINT32 ulTrafficDescrParm5;
31363 +    UINT32 ulTrafficDescrRowStatus;
31364 +    UINT32 ulServiceCategory;
31365 +    UINT32 ulTrafficFrameDiscard;
31366 +} ATM_TRAFFIC_DESCR_PARM_ENTRY, *PATM_TRAFFIC_DESCR_PARM_ENTRY;
31367 +
31368 +
31369 +// ATM_INTERFACE_CFG contains configuration fields for an ATM interface.
31370 +#define ID_ATM_INTERFACE_CFG                3
31371 +typedef struct AtmInterfaceCfg
31372 +{
31373 +    UINT32 ulStructureId;
31374 +    UINT32 ulAtmInterfaceMaxVccs;
31375 +    UINT32 ulAtmInterfaceConfVccs;
31376 +    UINT32 ulAtmInterfaceMaxActiveVpiBits;
31377 +    UINT32 ulAtmInterfaceMaxActiveVciBits;
31378 +    UINT32 ulAtmInterfaceCurrentMaxVpiBits;
31379 +    UINT32 ulAtmInterfaceCurrentMaxVciBits;
31380 +    UINT32 ulIfAdminStatus;
31381 +    UINT32 ulIfOperStatus;                  // read-only
31382 +    UINT32 ulSendNullCells;
31383 +    UINT32 ulTcScramble;
31384 +    UINT32 ulPortType;                      // read-only
31385 +    UINT32 ulIfLastChange;
31386 +} ATM_INTERFACE_CFG, *PATM_INTERFACE_CFG;
31387 +
31388 +
31389 +// ATM_VCC_TRANSMIT_QUEUE_PARMS contains fields for configuring an transmit
31390 +// queue.
31391 +#define ID_ATM_VCC_TRANSMIT_QUEUE_PARMS     1
31392 +typedef struct AtmVccTransmitQueueParms
31393 +{
31394 +    UINT32 ulStructureId;
31395 +    UINT32 ulSize;
31396 +    UINT32 ulPriority;
31397 +    UINT32 ulReserved;
31398 +} ATM_VCC_TRANSMIT_QUEUE_PARMS, *PATM_VCC_TRANSMIT_QUEUE_PARMS;
31399 +
31400 +
31401 +// ATM_AAL5_VCC_CFG contains configuration fields for an ATM AAL5 Virtual
31402 +// Channel Connection (VCC).
31403 +typedef struct AtmAal5VccCfg
31404 +{
31405 +    UINT32 ulAtmVccEncapsType;
31406 +    UINT32 ulAtmVccCpcsAcceptCorruptedPdus;
31407 +} ATM_AAL5_VCC_CFG, *PATM_AAL5_VCC_CFG;
31408 +
31409 +
31410 +// [BCM635x Only] ATM_AAL2_VCC_CFG contains configuration fields for an ATM
31411 +// AAL2 Virtual Channel Connection (VCC).
31412 +typedef struct AtmAal2VccCfg
31413 +{
31414 +    UINT8 ucAal2CpsMaxMultiplexedChannels;
31415 +    UINT8 ucAal2CpsMaxSduLength;
31416 +    UINT8 ucAal2CpsCidLowerLimit;
31417 +    UINT8 ucAal2CpsCidUpperLimit;
31418 +    UINT8 ucAal2CpsOptimisation;
31419 +    UINT8 ucReserved[3];
31420 +} ATM_AAL2_VCC_CFG, *PATM_AAL2_VCC_CFG;
31421 +
31422 +
31423 +// ATM_AAL0_VCC_CFG contains configuration fields for an ATM AAL0 Virtual
31424 +// Channel Connection (VCC).
31425 +typedef struct AtmAal0VccCfg
31426 +{
31427 +    UINT8 ucReserved;
31428 +    // Reserved for future use.
31429 +} ATM_AAL0_VCC_CFG, *PATM_AAL0_VCC_CFG;
31430 +
31431 +
31432 +// ATM_VCC_CFG contains configuration fields for an ATM Virtual Channel
31433 +// Connection (VCC).
31434 +#define ID_ATM_VCC_CFG                      2
31435 +#define TX_Q_PARM_SIZE                      8
31436 +typedef struct AtmVccCfg
31437 +{
31438 +    UINT32 ulStructureId;
31439 +    UINT32 ulAalType;
31440 +    UINT32 ulAtmVclAdminStatus;
31441 +    UINT32 ulAtmVclOperStatus;
31442 +    UINT32 ulAtmVclLastChange;
31443 +    UINT32 ulAtmVclReceiveTrafficDescrIndex;
31444 +    UINT32 ulAtmVclTransmitTrafficDescrIndex;
31445 +    UINT32 ulTransmitQParmsSize;
31446 +    ATM_VCC_TRANSMIT_QUEUE_PARMS TransmitQParms[TX_Q_PARM_SIZE];
31447 +    union
31448 +    {
31449 +        ATM_AAL5_VCC_CFG Aal5Cfg;
31450 +        ATM_AAL2_VCC_CFG Aal2Cfg; // [BCM635x Only]
31451 +        ATM_AAL0_VCC_CFG Aal0Cfg;
31452 +    } u;
31453 +} ATM_VCC_CFG, *PATM_VCC_CFG;
31454 +
31455 +
31456 +// ATM_INTF_ATM_STATS contains statistics for the ATM layer of an interface.
31457 +typedef struct AtmIntfAtmStats
31458 +{
31459 +    UINT32 ulIfInOctets;
31460 +    UINT32 ulIfOutOctets;
31461 +    UINT32 ulIfInErrors;
31462 +    UINT32 ulIfInUnknownProtos;
31463 +    UINT32 ulIfOutErrors;
31464 +
31465 +    // The following fields are added together to calculate ulIfInErrors.
31466 +    UINT32 ulIfInHecErrors;
31467 +
31468 +    // The following fields are added together to calculate ulIfInUnknownProtos.
31469 +    UINT32 ulIfInInvalidVpiVciErrors;
31470 +    UINT32 ulIfInPortNotEnabledErrors;
31471 +    UINT32 ulIfInPtiErrors;
31472 +    UINT32 ulIfInIdleCells;
31473 +    UINT32 ulIfInCircuitTypeErrors;
31474 +    UINT32 ulIfInOamRmCrcErrors;
31475 +    UINT32 ulIfInGfcErrors;
31476 +} ATM_INTF_ATM_STATS, *PATM_INTF_ATM_STATS;
31477 +
31478 +
31479 +// [BCM635x Only] ATM_INTF_ATM_STATS contains statistics for the TC layer.
31480 +typedef struct AtmIntfTcStats
31481 +{
31482 +    UINT32 ulTcInDataCells;
31483 +    UINT32 ulTcInTotalCells;
31484 +    UINT32 ulTcInHecErrors;
31485 +    UINT32 ulTcInOcdEvents;
31486 +    UINT32 ulTcAlarmState;
31487 +} ATM_INTF_TC_STATS, *PATM_INTF_TC_STATS;
31488 +
31489 +
31490 +// ATM_INTF_AAL5_AAL0_STATS contains statistics for all AAL5/AAL0 VCCs on an
31491 +// ATM interface.
31492 +typedef struct AtmIntfAal5Aal0Stats
31493 +{
31494 +    UINT32 ulIfInOctets;
31495 +    UINT32 ulIfOutOctets;
31496 +    UINT32 ulIfInUcastPkts;
31497 +    UINT32 ulIfOutUcastPkts;
31498 +    UINT32 ulIfInErrors;
31499 +    UINT32 ulIfOutErrors;
31500 +    UINT32 ulIfInDiscards;
31501 +    UINT32 ulIfOutDiscards;
31502 +} ATM_INTF_AAL5_AAL0_STATS, *PATM_INTF_AAL5_AAL0_STATS;
31503 +
31504 +
31505 +// [BCM635x Only] ATM_INTF_AAL2_STATS contains statistics for all AAL2 VCCs
31506 +// on an ATM interface.
31507 +typedef struct AtmIntfAal2Stats
31508 +{
31509 +    UINT32 ulIfInOctets;
31510 +    UINT32 ulIfOutOctets;
31511 +    UINT32 ulIfInUcastPkts;
31512 +    UINT32 ulIfOutUcastPkts;
31513 +    UINT32 ulIfInErrors;
31514 +    UINT32 ulIfOutErrors;
31515 +    UINT32 ulIfInDiscards;
31516 +    UINT32 ulIfOutDiscards;
31517 +} ATM_INTF_AAL2_STATS, *PATM_INTF_AAL2_STATS;
31518 +
31519 +
31520 +// ATM_INTERFACE_STATS contains statistics for an ATM interface.
31521 +#define ID_ATM_INTERFACE_STATS              1
31522 +typedef struct AtmInterfaceStats
31523 +{
31524 +    UINT32 ulStructureId;
31525 +    ATM_INTF_ATM_STATS       AtmIntfStats;
31526 +    ATM_INTF_TC_STATS        TcIntfStats;   // [BCM635x Only]
31527 +    ATM_INTF_AAL5_AAL0_STATS Aal5IntfStats;
31528 +    ATM_INTF_AAL2_STATS      Aal2IntfStats; // [BCM635x Only]
31529 +    ATM_INTF_AAL5_AAL0_STATS Aal0IntfStats;
31530 +} ATM_INTERFACE_STATS, *PATM_INTERFACE_STATS;
31531 +
31532 +
31533 +// ATM_VCC_AAL5_STATS contains statistics for an AAL5 VCC.
31534 +typedef struct AtmVccAal5Stats
31535 +{
31536 +    UINT32 ulAal5VccCrcErrors;
31537 +    UINT32 ulAal5VccSarTimeOuts;
31538 +    UINT32 ulAal5VccOverSizedSdus;
31539 +    UINT32 ulAal5VccShortPacketErrors;
31540 +    UINT32 ulAal5VccLengthErrors;
31541 +} ATM_VCC_AAL5_STATS, *PATM_VCC_AAL5_STATS;
31542 +
31543 +
31544 +// [BCM635x Only] ATM_VCC_AAL2_STATS contains statistics for an AAL2 VCC.
31545 +typedef struct AtmVccAal2Stats
31546 +{
31547 +    UINT32 ulAal2CpsInPkts;
31548 +    UINT32 ulAal2CpsOutPkts;
31549 +    UINT32 ulAal2CpsParityErrors;
31550 +    UINT32 ulAal2CpsSeqNumErrors;
31551 +    UINT32 ulAal2CpsOsfMismatchErrors;
31552 +    UINT32 ulAal2CpsOsfErrors;
31553 +    UINT32 ulAal2CpsHecOverlapErrors;
31554 +    UINT32 ulAal2CpsHecErrors;
31555 +    UINT32 ulAal2CpsOversizedSduErrors;
31556 +    UINT32 ulAal2CpsReassemblyErrors;
31557 +    UINT32 ulAal2CpsUuiErrors;
31558 +    UINT32 ulAal2CpsCidErrors;
31559 +    UINT32 ulAal2SscsOversizedSssarSduErrors;
31560 +    UINT32 ulAal2SscsSssarRasTimerExipiryErrors;
31561 +    UINT32 ulAal2SscsUndersizedSstedPduErrors;
31562 +    UINT32 ulAal2SscsSstedPduLengthMismatchErrors;
31563 +    UINT32 ulAal2SscsSstedCrcMismatchErrors;
31564 +} ATM_VCC_AAL2_STATS, *PATM_VCC_AAL2_STATS;
31565 +
31566 +
31567 +// ATM_VCC_AAL0PKT_STATS contains statistics for an AAL0 Packet VCC.
31568 +typedef struct AtmVccAal0PktStats
31569 +{
31570 +    UINT32 ulAal0VccSarTimeOuts;
31571 +    UINT32 ulAal0VccOverSizedSdus;
31572 +} ATM_VCC_AAL0PKT_STATS, *PATM_VCC_AAL0PKT_STATS;
31573 +
31574 +
31575 +// ATM_VCC_AAL0CELL_STATS contains statistics for an AAL0 Cell with CRC VCC.
31576 +typedef struct AtmVccAal0CellStats
31577 +{
31578 +    UINT32 ulAal0VccCrcErrors;
31579 +} ATM_VCC_AAL0CELL_STATS, *PATM_VCC_AAL0CELL_STATS;
31580 +
31581 +
31582 +// ATM_VCC_STATS contains statistics for a VCC.
31583 +#define ID_ATM_VCC_STATS                    1
31584 +typedef struct AtmVccStatistics
31585 +{
31586 +    UINT32 ulStructureId;
31587 +    UINT32 ulAalType;
31588 +    union
31589 +    {
31590 +        ATM_VCC_AAL5_STATS AtmVccAal5Stats;
31591 +        ATM_VCC_AAL2_STATS AtmVccAal2Stats; // [BCM635x Only]
31592 +        ATM_VCC_AAL0PKT_STATS AtmVccAal0PktStats;
31593 +        ATM_VCC_AAL0CELL_STATS AtmVccAal0CellStats;
31594 +    } u;
31595 +} ATM_VCC_STATS, *PATM_VCC_STATS;
31596 +
31597 +
31598 +// ATM_INTERFACE_LINK_INFO contains fields for the physical link that the
31599 +// ATM interface is using.
31600 +#define ID_ATM_INTERFACE_LINK_INFO          1
31601 +typedef struct AtmInterfaceLinkInfo
31602 +{
31603 +    UINT32 ulStructureId;
31604 +    UINT32 ulLinkState;
31605 +    UINT32 ulLineRate;
31606 +    UINT32 ulReserved[2];
31607 +} ATM_INTERFACE_LINK_INFO, *PATM_INTERFACE_LINK_INFO;
31608 +
31609 +
31610 +// AN_INTF_CHANGE_PARMS contains notification fields that passed to an
31611 +// application callback function when the ATM interface goes up or down.
31612 +#define ID_AN_INTF_CHANGE_PARMS             1
31613 +typedef struct AnIntfChangeParms
31614 +{
31615 +    UINT32 ulInterfaceId;
31616 +    UINT32 ulInterfaceState;
31617 +    UINT32 ulInterfaceLineRate;
31618 +} AN_INTF_CHANGE_PARMS, *PAN_INTF_CHANGE_PARMS;
31619 +
31620 +
31621 +// ATM_NOTIFY_PARMS contains notification fields that passed to an application
31622 +// callback function when an ATM notification event occurs.
31623 +typedef struct AtmNotifyParms
31624 +{
31625 +    UINT32 ulNotifyType;
31626 +    union
31627 +    {
31628 +        AN_INTF_CHANGE_PARMS IntfChangeParms;
31629 +
31630 +        // Other fields and structures that are specific
31631 +        // to the type of notification are declared here.
31632 +    } u;
31633 +} ATM_NOTIFY_PARMS, *PATM_NOTIFY_PARMS;
31634 +
31635 +typedef void (*FN_NOTIFY_CB) (PATM_NOTIFY_PARMS pNotifyParms);
31636 +
31637 +
31638 +// ATM_VCC_ATTACH_PARMS contains fields for attaching to a VCC.  It is used
31639 +// by all BcmAtm_Attach... functions.
31640 +struct AtmVccDataParms;
31641 +typedef void (*FN_RECEIVE_CB) (UINT32 ulHandle, PATM_VCC_ADDR pVccAddr,
31642 +    struct AtmVccDataParms *pDataParms, UINT32 ulParmReceiveData);
31643 +
31644 +#define ID_ATM_VCC_ATTACH_PARMS             1
31645 +typedef struct AtmAttachParms
31646 +{
31647 +    UINT32 ulStructureId;
31648 +    UINT32 ulFlags;
31649 +    FN_RECEIVE_CB pFnReceiveDataCb;
31650 +    UINT32 ulParmReceiveData;
31651 +    ATM_VCC_TRANSMIT_QUEUE_PARMS *pTransmitQParms;
31652 +    UINT32 ulTransmitQParmsSize;
31653 +    UINT32 ulHandle;
31654 +    UINT32 ulReserved;
31655 +} ATM_VCC_ATTACH_PARMS, *PATM_VCC_ATTACH_PARMS;
31656 +
31657 +
31658 +// [BCM635x Only] ATM_VCC_AAL2_CHANNEL_ID_PARMS contains fields for
31659 +// configuring an transmit queue.
31660 +#define ID_ATM_VCC_AAL2_CHANNEL_ID_PARMS    1
31661 +typedef struct AtmVccAal2ChannelIdParms
31662 +{
31663 +    UINT32 ulStructureId;
31664 +    UINT8 ucChannelId;
31665 +    UINT8 ucVoiceRouting;
31666 +    UINT8 ucFlags;
31667 +    UINT8 ucReserved[5];
31668 +} ATM_VCC_AAL2_CHANNEL_ID_PARMS, *PATM_VCC_AAL2_CHANNEL_ID_PARMS;
31669 +
31670 +
31671 +// ATM_BUFFER contains fields for passing data to, and receive data from, the
31672 +// ATM API.
31673 +typedef struct AtmBuffer
31674 +{
31675 +    struct AtmBuffer *pNextAtmBuf;
31676 +    UINT8 *pDataBuf;
31677 +    UINT32 ulDataLen;
31678 +    UINT16 usDataOffset;
31679 +    UINT16 usReserved;
31680 +    UINT32 ulReserved;
31681 +} ATM_BUFFER, *PATM_BUFFER;
31682 +
31683 +
31684 +// ATM_VCC_DATA_PARMS contains fields for sending or receiving data on a VCC.
31685 +// It is used by all BcmAtm_Send... and receive functions.
31686 +typedef void (*FN_FREE_DATA_PARMS) (struct AtmVccDataParms *pDataParms);
31687 +
31688 +#define ID_ATM_VCC_DATA_PARMS               2
31689 +typedef struct AtmVccDataParms
31690 +{
31691 +    UINT32 ulStructureId;
31692 +    UINT8 ucCircuitType;
31693 +    UINT8 ucAal2ChannelId; // [BCM635x Only]
31694 +    UINT8 ucUuData8;
31695 +    UINT8 ucUuData5;
31696 +    UINT8 ucFlags;
31697 +    UINT8 ucSendPriority;
31698 +    UINT8 ucReserved[2];
31699 +    BCMATM_STATUS baReceiveStatus;
31700 +    PATM_BUFFER pAtmBuffer;
31701 +    FN_FREE_DATA_PARMS pFnFreeDataParms;
31702 +    UINT32 ulParmFreeDataParms;
31703 +    struct AtmVccDataParms *pApplicationLink;
31704 +    UINT32 ulApplicationDefined[2];
31705 +} ATM_VCC_DATA_PARMS, *PATM_VCC_DATA_PARMS;
31706 +
31707 +
31708 +//**************************************************************************
31709 +// Function Prototypes
31710 +//**************************************************************************
31711 +
31712 +BCMATM_STATUS BcmAtm_Initialize( PATM_INITIALIZATION_PARMS pInitValues );
31713 +BCMATM_STATUS BcmAtm_Uninitialize( void );
31714 +BCMATM_STATUS BcmAtm_GetInterfaceId( UINT8 ucPhyPort, UINT32 *pulInterfaceId );
31715 +BCMATM_STATUS BcmAtm_GetTrafficDescrTableSize(UINT32 *pulTrafficDescrTableSize);
31716 +BCMATM_STATUS BcmAtm_GetTrafficDescrTable( PATM_TRAFFIC_DESCR_PARM_ENTRY
31717 +    pTrafficDescTable, UINT32 ulTrafficDescrTableSize );
31718 +BCMATM_STATUS BcmAtm_SetTrafficDescrTable( PATM_TRAFFIC_DESCR_PARM_ENTRY
31719 +    pTrafficDescTable, UINT32  ulTrafficDescrTableSize );
31720 +BCMATM_STATUS BcmAtm_GetInterfaceCfg( UINT32 ulInterfaceId, PATM_INTERFACE_CFG
31721 +    pInterfaceCfg );
31722 +BCMATM_STATUS BcmAtm_SetInterfaceCfg( UINT32 ulInterfaceId, PATM_INTERFACE_CFG
31723 +    pInterfaceCfg );
31724 +BCMATM_STATUS BcmAtm_GetVccCfg( PATM_VCC_ADDR pVccAddr, PATM_VCC_CFG pVccCfg );
31725 +BCMATM_STATUS BcmAtm_SetVccCfg( PATM_VCC_ADDR pVccAddr, PATM_VCC_CFG pVccCfg );
31726 +BCMATM_STATUS BcmAtm_GetVccAddrs( UINT32 ulInterfaceId, PATM_VCC_ADDR pVccAddrs,
31727 +    UINT32 ulNumVccs, UINT32 *pulNumReturned );
31728 +BCMATM_STATUS BcmAtm_GetInterfaceStatistics( UINT32 ulInterfaceId,
31729 +    PATM_INTERFACE_STATS pStatistics, UINT32 ulReset );
31730 +BCMATM_STATUS BcmAtm_GetVccStatistics( PATM_VCC_ADDR pVccAddr, PATM_VCC_STATS
31731 +    pVccStatistics, UINT32 ulReset );
31732 +BCMATM_STATUS BcmAtm_SetInterfaceLinkInfo( UINT32 ulInterfaceId,
31733 +    PATM_INTERFACE_LINK_INFO pInterfaceCfg );
31734 +BCMATM_STATUS BcmAtm_SetNotifyCallback( FN_NOTIFY_CB pFnNotifyCb );
31735 +BCMATM_STATUS BcmAtm_ResetNotifyCallback( FN_NOTIFY_CB pFnNotifyCb );
31736 +BCMATM_STATUS BcmAtm_AttachVcc( PATM_VCC_ADDR pVccAddr, PATM_VCC_ATTACH_PARMS
31737 +    pAttachParms );
31738 +BCMATM_STATUS BcmAtm_AttachMgmtCells( UINT32 ulInterfaceId,
31739 +    PATM_VCC_ATTACH_PARMS pAttachParms );
31740 +BCMATM_STATUS BcmAtm_AttachTransparent( UINT32 ulInterfaceId,
31741 +    PATM_VCC_ATTACH_PARMS pAttachParms );
31742 +BCMATM_STATUS BcmAtm_Detach( UINT32 ulHandle );
31743 +BCMATM_STATUS BcmAtm_SetAal2ChannelIds( UINT32 ulHandle,
31744 +    PATM_VCC_AAL2_CHANNEL_ID_PARMS pChannelIdParms, UINT32
31745 +    ulNumChannelIdParms ); // [BCM635x Only]
31746 +BCMATM_STATUS BcmAtm_SendVccData( UINT32 ulHandle,
31747 +    PATM_VCC_DATA_PARMS pDataParms );
31748 +BCMATM_STATUS BcmAtm_SendMgmtData( UINT32 ulHandle, PATM_VCC_ADDR pVccAddr,
31749 +    PATM_VCC_DATA_PARMS pDataParms );
31750 +BCMATM_STATUS BcmAtm_SendTransparentData( UINT32 ulHandle, UINT32 ulInterfaceId,
31751 +    PATM_VCC_DATA_PARMS pDataParms );
31752 +
31753 +#if defined(__cplusplus)
31754 +}
31755 +#endif
31756 +
31757 +#endif // _BCMATMAPI_H_
31758 +
31759 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmnet.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmnet.h
31760 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmnet.h 1970-01-01 01:00:00.000000000 +0100
31761 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmnet.h        2006-06-26 09:07:10.000000000 +0200
31762 @@ -0,0 +1,78 @@
31763 +/*
31764 +<:copyright-gpl
31765 + Copyright 2002 Broadcom Corp. All Rights Reserved.
31766 +
31767 + This program is free software; you can distribute it and/or modify it
31768 + under the terms of the GNU General Public License (Version 2) as
31769 + published by the Free Software Foundation.
31770 +
31771 + This program is distributed in the hope it will be useful, but WITHOUT
31772 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31773 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31774 + for more details.
31775 +
31776 + You should have received a copy of the GNU General Public License along
31777 + with this program; if not, write to the Free Software Foundation, Inc.,
31778 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
31779 +:>
31780 +*/
31781 +/***********************************************************************/
31782 +/*                                                                     */
31783 +/*   MODULE:  bcmnet.h                                                 */
31784 +/*   DATE:    05/16/02                                                 */
31785 +/*   PURPOSE: network interface ioctl definition                       */
31786 +/*                                                                     */
31787 +/***********************************************************************/
31788 +#ifndef _IF_NET_H_
31789 +#define _IF_NET_H_
31790 +
31791 +#if __cplusplus
31792 +extern "C" {
31793 +#endif
31794 +
31795 +#define LINKSTATE_DOWN      0
31796 +#define LINKSTATE_UP        1
31797 +
31798 +/*---------------------------------------------------------------------*/
31799 +/* Ethernet Switch Type                                                */
31800 +/*---------------------------------------------------------------------*/
31801 +#define ESW_TYPE_UNDEFINED                  0
31802 +#define ESW_TYPE_BCM5325M                   1
31803 +#define ESW_TYPE_BCM5325E                   2
31804 +#define ESW_TYPE_BCM5325F                   3
31805 +
31806 +/*
31807 + * Ioctl definitions.
31808 + */
31809 +/* reserved SIOCDEVPRIVATE */
31810 +enum {
31811 +    SIOCGLINKSTATE = SIOCDEVPRIVATE + 1,
31812 +    SIOCSCLEARMIBCNTR,
31813 +    SIOCGIFTRANSSTART,
31814 +    SIOCMIBINFO,
31815 +    SIOCSDUPLEX,       /* 0: auto 1: full 2: half */
31816 +    SIOCSSPEED,                /* 0: auto 1: 100mbps 2: 10mbps */
31817 +    SIOCCIFSTATS,
31818 +    SIOCGENABLEVLAN,
31819 +    SIOCGDISABLEVLAN,
31820 +    SIOCGQUERYNUMVLANPORTS,
31821 +    SIOCGSWITCHTYPE,
31822 +    SIOCGQUERYNUMPORTS,
31823 +    SIOCLAST
31824 +};
31825 +
31826 +#define SPEED_10MBIT        10000000
31827 +#define SPEED_100MBIT       100000000
31828 +
31829 +typedef struct IoctlMibInfo
31830 +{
31831 +    unsigned long ulIfLastChange;
31832 +    unsigned long ulIfSpeed;
31833 +} IOCTL_MIB_INFO, *PIOCTL_MIB_INFO;
31834 +
31835 +
31836 +#if __cplusplus
31837 +}
31838 +#endif
31839 +
31840 +#endif /* _IF_NET_H_ */
31841 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmos.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmos.h
31842 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/bcmos.h  1970-01-01 01:00:00.000000000 +0100
31843 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/bcmos.h 2006-06-26 09:07:10.000000000 +0200
31844 @@ -0,0 +1,98 @@
31845 +/***************************************************************************
31846 +*    Copyright 2000  Broadcom Corporation
31847 +*    All Rights Reserved
31848 +*    No portions of this material may be reproduced in any form without the
31849 +*    written permission of:
31850 +*             Broadcom Corporation
31851 +*             16251 Laguna Canyon Road
31852 +*             Irvine, California  92618
31853 +*    All information contained in this document is Broadcom Corporation
31854 +*    company private, proprietary, and trade secret.
31855 +*
31856 +****************************************************************************
31857 +*
31858 +*    Filename: bcmos.h
31859 +*    Creation Date: 8 June 2000 (v0.00)
31860 +*    VSS Info:
31861 +*        $Revision: 16 $
31862 +*        $Date: 5/03/01 5:03p $
31863 +*
31864 +****************************************************************************
31865 +*    Description:
31866 +*
31867 +*      Broadcom Generic Operating System Functions.
31868 +*
31869 +****************************************************************************/
31870 +
31871 +#ifndef _BCMOS_H
31872 +#define _BCMOS_H
31873 +#ifdef __cplusplus
31874 +extern "C" {
31875 +#endif
31876 +
31877 +#ifdef __KERNEL__
31878 +#include <cxcEnv.h>
31879 +#include <bosSleep.h>
31880 +#include <bosTask.h>
31881 +
31882 +#include <linux/kernel.h>
31883 +#include <linux/slab.h>
31884 +#include <linux/interrupt.h>
31885 +#include <bcmtypes.h>
31886 +
31887 +#define malloc(arg) kmalloc(arg, GFP_KERNEL)
31888 +#define free(arg) kfree(arg)
31889 +
31890 +#define BCMOS_ASSERT(expr) \
31891 +if ((expr)? 0:1)                                                     \
31892 +{                                                                    \
31893 +   printk(" ASSERT !!! File %s, line %u \n", __FILE__, __LINE__);    \
31894 +   bosSleep( 10 );                                                 \
31895 +   cli();   /* Disable interrupts */                                 \
31896 +   while(1){ ; }                                                     \
31897 +}
31898 +
31899 +#define CXC_ASSERT BCMOS_ASSERT                // For compatibility with CX's endpoint
31900 +
31901 +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
31902 +/*  Special BOS definitions   */
31903 +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
31904 +#define DSL_NO_RESETSUPPORT
31905 +
31906 +
31907 +#define  bosSocketHtoNL( num )   ((UINT32)( num ))
31908 +#define  bosSocketHtoNS( num )   ((UINT16)( num ))
31909 +#define  bosSocketNtoHL( num )   ((UINT32)( num ))
31910 +#define  bosSocketNtoHS( num )   ((UINT16)( num ))
31911 +#define  bosSocketNtoHS( num )   ((UINT16)( num ))
31912 +#define  bosSocketNtoHU16  bosSocketNtoHS
31913 +
31914 +
31915 +#else /* LINUX */
31916 +
31917 +#include <cxcEnv.h>
31918 +#include <assert.h>
31919 +#include <string.h>
31920 +#include <malloc.h>
31921 +
31922 +#define BCMOS_TASKNAME( nameVar, nameStr ) char nameVar[] = nameStr
31923 +
31924 +#define TEN_MSEC           10
31925 +#define TWENTY_MSEC        20
31926 +#define ONE_HUNDRED_MSEC   100
31927 +#define FIVE_HUNDRED_MSEC  500
31928 +#define ONE_SECOND         1000
31929 +#define TWO_SECONDS        2000
31930 +
31931 +#define BCMOS_ASSERT( expr) assert( expr )
31932 +
31933 +#endif
31934 +
31935 +#ifdef __cplusplus
31936 +    }
31937 +#endif
31938 +
31939 +
31940 +#endif  /* _BCMOS_H  */
31941 +
31942 +
31943 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/cxcEnv.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/cxcEnv.h
31944 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/cxcEnv.h 1970-01-01 01:00:00.000000000 +0100
31945 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/cxcEnv.h        2006-06-26 09:07:10.000000000 +0200
31946 @@ -0,0 +1,79 @@
31947 +/***************************************************************************
31948 +*    Copyright 2000  Broadcom Corporation
31949 +*    All Rights Reserved
31950 +*    No portions of this material may be reproduced in any form without the
31951 +*    written permission of:
31952 +*             Broadcom Corporation
31953 +*             16251 Laguna Canyon Road
31954 +*             Irvine, California  92618
31955 +*    All information contained in this document is Broadcom Corporation
31956 +*    company private, proprietary, and trade secret.
31957 +*
31958 +****************************************************************************
31959 +*
31960 +*    Filename: cxcEnv.h
31961 +*    Creation Date:
31962 +*    VSS Info:
31963 +*        $Revision: 43 $
31964 +*        $Date: 12/03/02 5:50p $
31965 +*
31966 +****************************************************************************
31967 +*    Description:
31968 +*
31969 +*     This file is used in CableX to provide system-wide types and definitions. Howewever.
31970 +*     since iit tries to include various C run-time library dcefintions (eh stdio.h, it is not
31971 +*     appropriate for use "as is" in a Linux kernel environment. So the CableX endpoint source 
31972 +*     does not need to change, we use this file to recursively include bcmtypes.h
31973 +*
31974 +*    NOTE:  This file is based upon LDX's hausenv.h, but has been renamed to
31975 +*           avoid project dependencies, and allow for CablexChange customizations.
31976 +*
31977 +****************************************************************************/
31978 +
31979 +#ifndef CXC_ENV_H
31980 +#define CXC_ENV_H
31981 +
31982 +#ifdef __cplusplus
31983 +extern "C" {
31984 +#endif
31985 +
31986 +/* --------------------------------------------------------------------------
31987 +** Just include definitions from bcmtypes.h
31988 +*/
31989 +#include <bcmtypes.h>
31990 +
31991 +#undef EPT_TEST
31992 +
31993 +#if !defined( HAUS_SINT16_DEFINED )
31994 +#define HAUS_SINT16_DEFINED
31995 +typedef signed short    SINT16;     /* SINT16 is platform independant */
31996 +#endif
31997 +
31998 +
31999 +#if !defined( HAUS_SINT32_DEFINED )
32000 +#define HAUS_SINT32_DEFINED
32001 +typedef signed long   SINT32;
32002 +#endif
32003 +
32004 +#define SUCCESS   0
32005 +#define FAILURE   1
32006 +
32007 +
32008 +// GNU definition imported from cxc_compiler.h
32009 +#define CXC_INLINE __inline__    
32010 +
32011 +// Endian-ness imported from cxc_cpu.h
32012 +#define CXC_CPU_BIG_ENDIAN     1
32013 +#define CXC_CPU_LITTLE_ENDIAN  0
32014 +
32015 +#if defined(__KERNEL__)
32016 +#define CXC_OS_LINUX 1
32017 +#define PSOS 0
32018 +#define VXWORKS 0
32019 +#endif
32020 +
32021 +#ifdef __cplusplus
32022 +}
32023 +#endif
32024 +
32025 +#endif   /* CXC_ENV_H */
32026 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/cxcLog.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/cxcLog.h
32027 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/cxcLog.h 1970-01-01 01:00:00.000000000 +0100
32028 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/cxcLog.h        2006-06-26 09:07:10.000000000 +0200
32029 @@ -0,0 +1,34 @@
32030 +/***************************************************************************
32031 +*    Copyright 2000  Broadcom Corporation
32032 +*    All Rights Reserved
32033 +*    No portions of this material may be reproduced in any form without the
32034 +*    written permission of:
32035 +*             Broadcom Corporation
32036 +*             16251 Laguna Canyon Road
32037 +*             Irvine, California  92618
32038 +*    All information contained in this document is Broadcom Corporation
32039 +*    company private, proprietary, and trade secret.
32040 +*
32041 +****************************************************************************
32042 +*
32043 +*    Filename: log.h
32044 +*    Creation Date: 17 September 2001 (v0.00)
32045 +*    VSS Info:
32046 +*        $Revision: 3 $
32047 +*        $Date: 11/13/02 3:42p $
32048 +*
32049 +****************************************************************************
32050 +*    Description:
32051 +*
32052 +*        This filename is preserved in order to minimize the changes
32053 +*        in the endpoint code, which is shared with the Cablex endpoint.
32054 +*        cxcLog.h simply includes log.h, which contains the log macros.
32055 +*
32056 +****************************************************************************/
32057 +
32058 +#ifndef CXC_LOG_H
32059 +#define CXC_LOG_H
32060 +
32061 +#include <log.h>
32062 +
32063 +#endif  /* CXC_LOG_H  */
32064 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h
32065 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h    1970-01-01 01:00:00.000000000 +0100
32066 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/endpointdrv.h   2006-06-26 09:07:10.000000000 +0200
32067 @@ -0,0 +1,243 @@
32068 +/***************************************************************************
32069 + * Broadcom Corp. Confidential
32070 + * Copyright 2001 Broadcom Corp. All Rights Reserved.
32071 + *
32072 + * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
32073 + * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM.
32074 + * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
32075 + * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
32076 + *
32077 + ***************************************************************************
32078 + * File Name  : EndpointDrv.h
32079 + *
32080 + * Description: This file contains the definitions and structures for the
32081 + *              Linux IOCTL interface that used between the user mode Endpoint
32082 + *              API library and the kernel Endpoint API driver.
32083 + *
32084 + * Updates    : 04/04/2002  YD.  Created.
32085 + ***************************************************************************/
32086 +
32087 +#if !defined(_ENDPOINTDRV_H_)
32088 +#define _ENDPOINTDRV_H_
32089 +
32090 +#if defined(__cplusplus)
32091 +extern "C" {
32092 +#endif
32093 +
32094 +/* Includes. */
32095 +#include <bcmtypes.h>
32096 +#include <vrgEndpt.h>
32097 +#include <endptvoicestats.h>
32098 +
32099 +/* Maximum size for the event data passed with the event callback */
32100 +#define MAX_EVENTDATA_SIZE    256
32101 +
32102 +typedef enum ENDPOINTIOCTL_INDEX
32103 +{
32104 +   ENDPTIO_INIT_INDEX = 0,
32105 +   ENDPTIO_DEINIT_INDEX,
32106 +   ENDPTIO_CREATE_INDEX,
32107 +   ENDPTIO_CAPABILITIES_INDEX,
32108 +   ENDPTIO_SIGNAL_INDEX,
32109 +   ENDPTIO_CREATE_CONNECTION_INDEX,
32110 +   ENDPTIO_MODIFY_CONNECTION_INDEX,
32111 +   ENDPTIO_DELETE_CONNECTION_INDEX,
32112 +   ENDPTIO_PACKET_INDEX,
32113 +   ENDPTIO_GET_PACKET_INDEX,
32114 +   ENDPTIO_GET_EVENT_INDEX,
32115 +   ENDPTIO_GET_CODECMAP_INDEX,
32116 +   ENDPTIO_VOICESTAT_INDEX,
32117 +   ENDPTIO_ISINITIALIZED_INDEX,
32118 +   ENDPTIO_CONSOLE_CMD_INDEX,
32119 +   ENDPTIO_TEST_INDEX,
32120 +   ENDPTIO_ENDPOINTCOUNT_INDEX,
32121 +   ENDPTIO_MAX_INDEX
32122 +} ENDPOINTIOCTL_INDEX;
32123 +
32124 +
32125 +/* Defines. */
32126 +#define ENDPOINTDRV_MAJOR            209 /* arbitrary unused value */
32127 +
32128 +#define ENDPOINTIOCTL_ENDPT_INIT \
32129 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_INIT_INDEX, ENDPOINTDRV_INIT_PARAM)
32130 +
32131 +#define ENDPOINTIOCTL_ENDPT_DEINIT \
32132 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_DEINIT_INDEX, ENDPOINTDRV_INIT_PARAM)
32133 +
32134 +#define ENDPOINTIOCTL_ENDPT_CREATE \
32135 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_CREATE_INDEX, ENDPOINTDRV_CREATE_PARM)
32136 +
32137 +#define ENDPOINTIOCTL_ENDPT_CAPABILITIES \
32138 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_CAPABILITIES_INDEX, ENDPOINTDRV_CAP_PARM)
32139 +
32140 +#define ENDPOINTIOCTL_ENDPT_SIGNAL \
32141 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_SIGNAL_INDEX, ENDPOINTDRV_SIGNAL_PARM)
32142 +
32143 +#define ENDPOINTIOCTL_ENDPT_CREATE_CONNECTION \
32144 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_CREATE_CONNECTION_INDEX, ENDPOINTDRV_CONNECTION_PARM)
32145 +
32146 +#define ENDPOINTIOCTL_ENDPT_MODIFY_CONNECTION \
32147 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_MODIFY_CONNECTION_INDEX, ENDPOINTDRV_CONNECTION_PARM)
32148 +
32149 +#define ENDPOINTIOCTL_ENDPT_DELETE_CONNECTION \
32150 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_DELETE_CONNECTION_INDEX, ENDPOINTDRV_DELCONNECTION_PARM)
32151 +
32152 +#define ENDPOINTIOCTL_ENDPT_PACKET \
32153 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_PACKET_INDEX, ENDPOINTDRV_PACKET_PARM)
32154 +
32155 +#define ENDPOINTIOCTL_ENDPT_GET_PACKET \
32156 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_GET_PACKET_INDEX, ENDPOINTDRV_PACKET_PARM)
32157 +
32158 +#define ENDPOINTIOCTL_ENDPT_GET_EVENT \
32159 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_GET_EVENT_INDEX, ENDPOINTDRV_EVENT_PARM)
32160 +
32161 +#define ENDPOINTIOCTL_ENDPT_GET_CODECMAP \
32162 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_GET_CODECMAP_INDEX, ENDPOINTDRV_CODECMAP_PARM)
32163 +
32164 +#define ENDPOINTIOCTL_ENDPT_VOICESTAT \
32165 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_VOICESTAT_INDEX, ENDPOINTDRV_VOICESTAT_PARM)
32166 +
32167 +#define ENDPOINTIOCTL_ISINITIALIZED \
32168 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_ISINITIALIZED_INDEX, ENDPOINTDRV_ISINITIALIZED_PARM)
32169 +
32170 +#define ENDPOINTIOCTL_ENDPT_CONSOLE_CMD \
32171 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_CONSOLE_CMD_INDEX, ENDPOINTDRV_CONSOLE_CMD_PARM)
32172 +
32173 +#define ENDPOINTIOCTL_TEST \
32174 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_TEST_INDEX, ENDPOINTDRV_TESTPARM)
32175 +
32176 +#define ENDPOINTIOCTL_ENDPOINTCOUNT \
32177 +    _IOWR(ENDPOINTDRV_MAJOR, ENDPTIO_ENDPOINTCOUNT_INDEX, ENDPOINTDRV_ENDPOINTCOUNT_PARM)
32178 +
32179 +#define MAX_ENDPOINTDRV_IOCTL_COMMANDS   ENDPTIO_MAX_INDEX
32180 +
32181 +
32182 +typedef struct
32183 +{
32184 +   UINT32      size;    /* Size of the structure (including the size field) */
32185 +   VRG_COUNTRY country;
32186 +   EPSTATUS    epStatus;
32187 +} ENDPOINTDRV_INIT_PARAM, *PENDPOINTDRV_INIT_PARAM;
32188 +
32189 +typedef struct
32190 +{
32191 +   UINT32   size;       /* Size of the structure (including the size field) */
32192 +   UINT32   physId;
32193 +   UINT32   lineId;
32194 +   VRG_ENDPT_STATE* endptState;
32195 +   EPSTATUS epStatus;
32196 +} ENDPOINTDRV_CREATE_PARM, *PENDPOINTDRV_CREATE_PARM;
32197 +
32198 +typedef struct
32199 +{
32200 +   UINT32   size;       /* Size of the structure (including the size field) */
32201 +   EPZCAP*  capabilities;
32202 +   ENDPT_STATE* state;
32203 +   EPSTATUS epStatus;
32204 +} ENDPOINTDRV_CAP_PARM, *PENDPOINTDRV_CAP_PARM;
32205 +
32206 +typedef struct
32207 +{
32208 +   UINT32      size;    /* Size of the structure (including the size field) */
32209 +   ENDPT_STATE* state;
32210 +   UINT32      cnxId;
32211 +   EPSIG       signal;
32212 +   UINT32      value;      // Reserve an array, can be a pointer
32213 +   EPSTATUS    epStatus;
32214 +   int         duration;
32215 +   int         period;
32216 +   int         repetition;
32217 +} ENDPOINTDRV_SIGNAL_PARM, *PENDPOINTDRV_SIGNAL_PARM;
32218 +
32219 +typedef struct
32220 +{
32221 +   UINT32      size;    /* Size of the structure (including the size field) */
32222 +   ENDPT_STATE* state;
32223 +   int         cnxId;
32224 +   EPZCNXPARAM*   cnxParam;
32225 +   EPSTATUS    epStatus;
32226 +} ENDPOINTDRV_CONNECTION_PARM, *PENDPOINTDRV_CONNECTION_PARM;
32227 +
32228 +typedef struct
32229 +{
32230 +   UINT32         size; /* Size of the structure (including the size field) */
32231 +   ENDPT_STATE*   state;
32232 +   int            cnxId;
32233 +   EPSTATUS       epStatus;
32234 +} ENDPOINTDRV_DELCONNECTION_PARM, *PENDPOINTDRV_DELCONNECTION_PARM;
32235 +
32236 +typedef struct
32237 +{
32238 +   UINT32   size;       /* Size of the structure (including the size field) */
32239 +   ENDPT_STATE*   state;
32240 +   int      cnxId;
32241 +   EPPACKET*      epPacket;
32242 +   int      length;
32243 +   UINT32   bufDesc;
32244 +   EPSTATUS epStatus;
32245 +} ENDPOINTDRV_PACKET_PARM, *PENDPOINTDRV_PACKET_PARM;
32246 +
32247 +typedef struct
32248 +{
32249 +   UINT32   size;       /* Size of the structure (including the size field) */
32250 +   int      lineId;
32251 +   int      cnxId;
32252 +   int      length;
32253 +   EPEVT    event;
32254 +   UINT8    eventData[MAX_EVENTDATA_SIZE];
32255 +} ENDPOINTDRV_EVENT_PARM, *PENDPOINTDRV_EVENT_PARM;
32256 +
32257 +typedef struct
32258 +{
32259 +   UINT32         size; /* Size of the structure (including the size field) */
32260 +   int            isInitialized;
32261 +} ENDPOINTDRV_ISINITIALIZED_PARM, *PENDPOINTDRV_ISINITIALIZED_PARM;
32262 +
32263 +typedef struct
32264 +{
32265 +   UINT32         size; /* Size of the structure (including the size field) */
32266 +   UINT32         testParm1;
32267 +   UINT32         testParm2;
32268 +   EPZCNXPARAM*   testParm3;
32269 +   EPSTATUS       epStatus;
32270 +} ENDPOINTDRV_TESTPARM, *PENDPOINTDRV_TESTPARM;
32271 +
32272 +typedef struct ENDPOINTDRV_PACKET
32273 +{
32274 +   UINT32   size;       /* Size of the structure (including the size field) */
32275 +   int      cnxId;
32276 +   int      length;
32277 +   EPMEDIATYPE mediaType;
32278 +   UINT8    data[1024];
32279 +} ENDPOINTDRV_PACKET;
32280 +
32281 +typedef struct ENDPOINTDRV_VOICESTAT_PARM
32282 +{
32283 +   int lineId;
32284 +   ENDPT_VOICE_STATS* stats;
32285 +   EPSTATUS epStatus;
32286 +} ENDPOINTDRV_VOICESTAT_PARM, *PENDPOINTDRV_VOICESTAT_PARM;
32287 +
32288 +typedef struct ENDPOINTDRV_CONSOLE_CMD_PARM
32289 +{
32290 +   UINT32   size;       /* Size of the structure (including the size field) */
32291 +   int lineId;
32292 +   int cnxId;
32293 +   int cmd;
32294 +   ENDPT_STATE*   state;
32295 +   EPSTATUS epStatus;
32296 +} ENDPOINTDRV_CONSOLE_CMD_PARM, *PENDPOINTDRV_CONSOLE_CMD_PARM;
32297 +
32298 +
32299 +typedef struct
32300 +{
32301 +   UINT32         size; /* Size of the structure (including the size field) */
32302 +   int            endpointNum;
32303 +} ENDPOINTDRV_ENDPOINTCOUNT_PARM, *PENDPOINTDRV_ENDPOINTCOUNT_PARM;
32304 +
32305 +
32306 +#if defined(__cplusplus)
32307 +}
32308 +#endif
32309 +
32310 +#endif // _ENDPOINTDRV_H_
32311 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h
32312 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h        1970-01-01 01:00:00.000000000 +0100
32313 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/endptvoicestats.h       2006-06-26 09:07:10.000000000 +0200
32314 @@ -0,0 +1,106 @@
32315 +/***************************************************************************
32316 + * Broadcom Corp. Confidential
32317 + * Copyright 2001 Broadcom Corp. All Rights Reserved.
32318 + *
32319 + * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
32320 + * SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM.
32321 + * YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
32322 + * SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
32323 + *
32324 + ***************************************************************************
32325 + * File Name  : endptvoicestats.h
32326 + *
32327 + * Description: This file contains the definitions of the voice statistics
32328 + *              structures. This file should be used in user space when
32329 + *              working with the voice statistics structure.
32330 + *
32331 + *              The files hpnet.h and hppve.h
32332 + *              should not be included in user space because of a conflict
32333 + *              in the definitions supplied by hausenv.h (in the endpoint/vocm/
32334 + *              ldxIntf/dspinc directory) and the definitions supplied by bcmtypes.h
32335 + *              (in the /sgibcm_2_4_17/linux/include/asm-mips/bcm96345 directory).
32336 + *
32337 + * Updates    :
32338 + ***************************************************************************/
32339 +
32340 +#if !defined(ENDPTSTATS_H)
32341 +#define ENDPTSTATS_H
32342 +
32343 +#if defined(__cplusplus)
32344 +extern "C" {
32345 +#endif
32346 +
32347 +typedef struct
32348 +{
32349 +#ifdef ENDPT_6345
32350 +   UINT16    peakHoldingTime;    /* Peak Holding Time since last statistic */
32351 +
32352 +   /* Total number of superpackets arriving on the egress path */
32353 +   UINT16    packetCount;        /* # of packets received */
32354 +
32355 +   /* addTail and reorder are successful additions to the JB */
32356 +   /* addTail is typically 1..N times the packetCount if superpackets are enabled */
32357 +   UINT16    addTailCount;       /* # of frames added to tail of JB - normal case */
32358 +   UINT16    reorderCount;       /* # of frames reordered */
32359 +
32360 +   /* overrun, duplicate, outOfRange, tooLate, jitterMax excess are packets that have been discarded */
32361 +   UINT16    overrunCount;       /* Decoder overrun count */
32362 +   UINT16    duplicateCount;     /* # of duplicate frames deleted */
32363 +   UINT16    outOfRangeCount;    /* # of frames with timestamps too far from current TS to be handled */
32364 +   UINT16    tooLateCount;       /* Packet arrived too late (it's redundant mate already played) */
32365 +
32366 +   /* cantDecode are packets that can't be played out due to algorithm not available */
32367 +   UINT16    cantDecodeCount;    /* Can't decode packet - decoder not in load or pkt hdr bad */
32368 +
32369 +   /* The following are internal to the AJC module - they do not represent physical packets */
32370 +   UINT16    ajcUnderrunCount;   /* Adaptive Jitter Control: jitter buffer underruns */
32371 +   UINT16    ajcDeleteCount;     /* Adaptive Jitter Control: # of packet deletes done to reduce holding time */
32372 +   UINT16    ajcRepeatCount;     /* Adaptive Jitter Control: # of packet repeats done to either increase holding time
32373 +                                    or due to late frame or lost frames. */
32374 +   UINT16    ajcResyncCount;     /* Number of times ajb resynced (went through buildout state) */
32375 +   UINT16    ajcPhaseJitterCount;     /* Number of times ajb inserted a phase discontinuity
32376 +                                    (possibly in silence or during CNG or due to a repeat/delete). */
32377 +   /* 14 entries.  Make sure this is even (!) */
32378 +#else
32379 +  UINT16    peakHoldingTime;         /* Peak Holding Time since last statistic */
32380 +  UINT16    minimumHoldingTime;      /* Long-term tracker of min. Hold Time */
32381 +  UINT16    targetHoldingTime;       /* Target holding Time */
32382 +  UINT16    inactiveFrameCount;      /* Inactive Frame Count */
32383 +  UINT16    activeFrameCount;        /* Active Frame Count */
32384 +  UINT16    hsxDecoderOverrunCount;  /* Decoder overrun count */
32385 +  UINT16    hsxDecoderUnderrunCount; /* Decoder underrun count */
32386 +  UINT16    lostFrameCount;          /* Lost frames resulting in frame repeat */
32387 +#endif
32388 +} ENDPT_VOICE_DECODERSTATS;
32389 +
32390 +/* Encoder Statistics */
32391 +typedef struct
32392 +{
32393 +#ifdef ENDPT_6345
32394 +   UINT16   inactiveFrameCount;     /* Inactive Frame Count of Suppressed Frames*/
32395 +   UINT16   activeFrameCount;       /* Active Frame Count - actually sent ingress */
32396 +   UINT16   sidFrameCount;          /* SID Frame Count */
32397 +   UINT16   toneRelayCount;         /* # of tone packets from PTE relayed ingress */
32398 +#else
32399 +  UINT16    hsxEncoderOverrunCount;  /* Encoder overrun count */
32400 +#endif
32401 +} ENDPT_VOICE_ENCODERSTATS;
32402 +
32403 +
32404 +typedef struct
32405 +{
32406 +   ENDPT_VOICE_DECODERSTATS   decoder;
32407 +   ENDPT_VOICE_ENCODERSTATS   encoder;
32408 +} ENDPT_VOICE_PVE_STATS;
32409 +
32410 +typedef struct
32411 +{
32412 +   ENDPT_VOICE_PVE_STATS hsxPVEstats;         /* statistics for PVE encoder and decoder */
32413 +
32414 +} ENDPT_VOICE_STATS;
32415 +
32416 +#if defined(__cplusplus)
32417 +}
32418 +#endif
32419 +
32420 +#endif /* ENDPTSTATS_H */
32421 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/log.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/log.h
32422 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/log.h    1970-01-01 01:00:00.000000000 +0100
32423 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/log.h   2006-06-26 09:07:10.000000000 +0200
32424 @@ -0,0 +1,104 @@
32425 +/***************************************************************************
32426 +*    Copyright 2000  Broadcom Corporation
32427 +*    All Rights Reserved
32428 +*    No portions of this material may be reproduced in any form without the
32429 +*    written permission of:
32430 +*             Broadcom Corporation
32431 +*             16251 Laguna Canyon Road
32432 +*             Irvine, California  92618
32433 +*    All information contained in this document is Broadcom Corporation
32434 +*    company private, proprietary, and trade secret.
32435 +*
32436 +****************************************************************************
32437 +*
32438 +*    Filename: log.h
32439 +*    Creation Date: 4 July 2000 (v0.00)
32440 +*    VSS Info:
32441 +*        $Revision: 23 $
32442 +*        $Date: 9/14/01 4:54p $
32443 +*
32444 +****************************************************************************
32445 +*    Description:
32446 +*
32447 +*     This header file contains the needed macros and function prototypes
32448 +*     for logging on the terminal.
32449 +*
32450 +****************************************************************************/
32451 +
32452 +#ifndef LOG_H
32453 +#define LOG_H
32454 +
32455 +#ifdef __cplusplus
32456 +extern "C" {
32457 +#endif
32458 +
32459 +#define LOG_DBG
32460 +
32461 +#if (! (defined(__KERNEL__) || defined (LINUX)) )
32462 +
32463 +extern void Log( char const *format,...);
32464 +extern void LogMsg( char *string );
32465 +extern void LogDirectSerial( char const *format,...);
32466 +
32467 +#define PANIC(m)  Log(m)
32468 +#define LOG(fmt)       Log fmt
32469 +#define LOGERROR(fmt)  Log fmt
32470 +#define LOG1(fmt)      Log fmt              /* Level 1 logging  */
32471 +#define LOG2(fmt)                           /* Level 2 logging  */
32472 +#define LOGMSG(buf)    LogMsg buf
32473 +
32474 +/***********************************
32475 +** Error logging                   *
32476 +***********************************/
32477 +#elif defined(__KERNEL__)
32478 +
32479 +#define LOG(fmt) printk fmt   ;  printk("\n");
32480 +#define LOG_RAW(fmt)    printk fmt  ;  printk("\n");
32481 +#define PANIC(fmt)      printk("!!! PANIC !!! \n");   printk fmt  ;  printk("\n");
32482 +#define LOGERROR(fmt)  printk("!!! ERROR !!! \n");   printk fmt  ;  printk("\n");
32483 +
32484 +#elif defined(LINUX)
32485 +
32486 +#include <stdio.h>
32487 +
32488 +#ifdef LOG_DBG
32489 +
32490 +#include <time.h>
32491 +
32492 +#define LOG(fmt)                    \
32493 +{                                   \
32494 +   struct tm *tm_ptr;               \
32495 +   time_t curtime;                  \
32496 +   time( &curtime );                \
32497 +   tm_ptr = gmtime( &curtime );     \
32498 +   printf("%02d:%02d:%02d ",        \
32499 +            tm_ptr->tm_hour,        \
32500 +            tm_ptr->tm_min,         \
32501 +            tm_ptr->tm_sec);        \
32502 +   printf fmt;                      \
32503 +   printf("\n");                    \
32504 +}
32505 +#else
32506 +#define LOG(fmt) printf fmt   ;  printf("\n");
32507 +#endif /* LOG_DBG */
32508 +
32509 +#define PANIC(fmt)      printk("!!! PANIC !!! \n");   printk fmt  ;  printk("\n");
32510 +#define LOGERROR(fmt)                     \
32511 +{                                         \
32512 +   printf("ERROR !!! File %s (line %u): ", __FILE__, __LINE__);\
32513 +   printf fmt;                            \
32514 +   printf("\n");                          \
32515 +}
32516 +
32517 +#else
32518 +#error Unknown OS
32519 +#endif
32520 +
32521 +#ifdef __cplusplus
32522 +    }
32523 +#endif
32524 +
32525 +#endif /* LOG_H */
32526 +
32527 +
32528 +
32529 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/mtacfg.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/mtacfg.h
32530 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/mtacfg.h 1970-01-01 01:00:00.000000000 +0100
32531 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/mtacfg.h        2006-06-26 09:07:10.000000000 +0200
32532 @@ -0,0 +1,72 @@
32533 +/***************************************************************************
32534 +*    Copyright 2000  Broadcom Corporation
32535 +*    All Rights Reserved
32536 +*    No portions of this material may be reproduced in any form without the
32537 +*    written permission of:
32538 +*             Broadcom Corporation
32539 +*             16251 Laguna Canyon Road
32540 +*             Irvine, California  92618
32541 +*    All information contained in this document is Broadcom Corporation
32542 +*    company private, proprietary, and trade secret.
32543 +*
32544 +****************************************************************************
32545 +*
32546 +*    Filename: mtacfg.h
32547 +*    Creation Date: 4 July 2000 (v0.00)
32548 +*    VSS Info:
32549 +*        $Revision: 23 $
32550 +*        $Date: 9/14/01 4:54p $
32551 +*
32552 +****************************************************************************
32553 +*    Description:
32554 +*
32555 +*     This header file contains all the different build options that
32556 +*     are required by CablexChange components.
32557 +*
32558 +****************************************************************************/
32559 +
32560 +#ifndef _MTACFG_H
32561 +#define _MTACFG_H
32562 +
32563 +#ifdef __cplusplus
32564 +extern "C" {
32565 +#endif
32566 +
32567 +#include <cfg/endptCfg.h>
32568 +#include <cfg/vocmCfg.h>
32569 +#include <cfg/casCfg.h>
32570 +
32571 +#define MTA_VERSION_INFO   "1.0"
32572 +
32573 +#if ( defined(IP_MGCP) || defined(IP_H323) || defined(IP_SIP) || defined(IP_MEGACO) )
32574 +#define VOIP
32575 +#endif
32576 +
32577 +#ifndef VOIP
32578 +#define ENDPOINT_NULL_SHIM
32579 +#endif
32580 +
32581 +
32582 +/***************************************************************
32583 +** Task Priority options
32584 +****************************************************************/
32585 +
32586 +#define RTP_TASK_PRIORITY        BCMOS_TASK_PRTY_8  /* task priority for rtp */
32587 +#define HGCP_TASK_PRIORITY       BCMOS_TASK_PRTY_8  /* task priority for HGCP */
32588 +#define RTCP_TASK_PRIORITY       BCMOS_TASK_PRTY_13 /* task priority for rtcp */
32589 +
32590 +
32591 +/* Additional DSL specific definitions not provided by Cable Cfg files */
32592 +
32593 +/* For backward compatibility with older code */
32594 +#define MAX_ENDPT   VOCM_CFG_MAX_ENDPT
32595 +#define MAX_CNX   VOCM_CFG_MAX_CNX
32596 +
32597 +#ifdef __cplusplus
32598 +    }
32599 +#endif
32600 +
32601 +#endif /* MTACFG_H */
32602 +
32603 +
32604 +
32605 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/profdrv.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/profdrv.h
32606 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/profdrv.h        1970-01-01 01:00:00.000000000 +0100
32607 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/profdrv.h       2006-06-26 09:07:10.000000000 +0200
32608 @@ -0,0 +1,151 @@
32609 +/***************************************************************************
32610 +*    Copyright 2004  Broadcom Corporation
32611 +*    All Rights Reserved
32612 +*    No portions of this material may be reproduced in any form without the
32613 +*    written permission of:
32614 +*             Broadcom Corporation
32615 +*             16215 Alton Parkway
32616 +*             P.O. Box 57013
32617 +*             Irvine, California 92619-7013
32618 +*    All information contained in this document is Broadcom Corporation
32619 +*    company private, proprietary, and trade secret.
32620 +*
32621 +****************************************************************************
32622 +*
32623 +*    Filename: profdrv.h
32624 +*
32625 +****************************************************************************
32626 +*    Description:
32627 +*
32628 +*      This file contains the profiler device driver
32629 +*
32630 +****************************************************************************/\r
32631 +#ifndef PROFDRV_DEVICE_DRIVER__H__INCLUDED\r
32632 +#define PROFDRV_DEVICE_DRIVER__H__INCLUDED\r
32633 +\r
32634 +#include <linux/ioctl.h>\r
32635 +\r
32636 +#ifdef __cplusplus
32637 +extern "C" {
32638 +#endif
32639 +\r
32640 +#define PROFILER_NAME_MAX_LENGTH                32\r
32641 +#define PROFILER_MAX_RECSEQ                     2048\r
32642 +\r
32643 +#define PROFILER_CPU_UTIL_VALID_START        0x01\r
32644 +#define PROFILER_CPU_UTIL_VALID_STOP         0x02\r
32645 +\r
32646 +#define PROFILER_SOURCE_USER              0x00\r
32647 +#define PROFILER_SOURCE_KERNEL               0x01\r
32648 +\r
32649 +#ifndef __STR\r
32650 +#define __STR(x) #x\r
32651 +#endif\r
32652 +#ifndef STR\r
32653 +#define STR(x) __STR(x)\r
32654 +#endif\r
32655 +\r
32656 +#define profdrv_read_32bit_cp0_register(source)                \
32657 +({ int __res;                                                   \
32658 +        __asm__ __volatile__(                                   \
32659 +    ".set\tpush\n\t"                    \
32660 +    ".set\treorder\n\t"                 \
32661 +        "mfc0\t%0,"STR(source)"\n\t"                            \
32662 +    ".set\tpop"                     \
32663 +        : "=r" (__res));                                        \
32664 +        __res;})
32665 +\r
32666 +/*\r
32667 +    Structure used to pass profiling information data at the user/kernel interface.\r
32668 +*/\r
32669 +typedef struct\r
32670 +{\r
32671 +    char name[PROFILER_NAME_MAX_LENGTH];\r
32672 +\r
32673 +} PROFILER_IOCTL_DATA;\r
32674 +\r
32675 +/*\r
32676 +    This structure is used to keep track of the CPU utilization during the profiling period.\r
32677 +*/\r
32678 +typedef struct\r
32679 +{\r
32680 +    unsigned tick_uptime_start;\r
32681 +    unsigned tick_idle_start;\r
32682 +    unsigned tick_user_start;\r
32683 +    unsigned tick_kernel_start;\r
32684 +    unsigned tick_uptime_stop;\r
32685 +    unsigned tick_idle_stop;\r
32686 +    unsigned tick_user_stop;\r
32687 +    unsigned tick_kernel_stop;\r
32688 +   unsigned char valid_data;\r
32689 +\r
32690 +} PROFILER_CPU_UTILIZATION;\r
32691 +\r
32692 +/*\r
32693 +   A generic structure to pass information about the profiler status.\r
32694 +*/\r
32695 +typedef struct\r
32696 +{\r
32697 +   unsigned status;\r
32698 +   unsigned cpu_jiffies_start;\r
32699 +   unsigned cpu_jiffies_stop;\r
32700 +   unsigned cpu_jiffies_factor;\r
32701 +   unsigned cpu_clock;\r
32702 +\r
32703 +} PROFILER_STATUS;\r
32704 +\r
32705 +/*\r
32706 +    The ioctl action index.\r
32707 +*/\r
32708 +typedef enum\r
32709 +{\r
32710 +   PROFILER_IOCTL_GET_DATA_DUMP_INDEX,\r
32711 +   PROFILER_IOCTL_GET_RECSEQ_DATA_DUMP_INDEX,\r
32712 +   PROFILER_IOCTL_SET_DATA_CLEAN_INDEX,\r
32713 +   PROFILER_IOCTL_SET_PROF_OPS_INDEX,\r
32714 +   PROFILER_IOCTL_REGISTER_CALL_INDEX,\r
32715 +   PROFILER_IOCTL_DEREGISTER_CALL_INDEX,\r
32716 +   PROFILER_IOCTL_START_CALL_INDEX,\r
32717 +   PROFILER_IOCTL_STOP_CALL_INDEX,\r
32718 +   PROFILER_IOCTL_PROFILER_STATUS_INDEX,\r
32719 +   PROFILER_IOCTL_SET_CPU_UTIL_INDEX,\r
32720 +   PROFILER_IOCTL_GET_CPU_UTIL_INDEX,\r
32721 +   PROFILER_IOCTL_GET_RECSEQ_DI_INDEX\r
32722 +\r
32723 +} PROFILER_IOCTL_INDEX;\r
32724 +\r
32725 +/*\r
32726 +    Assigning a device driver major number for the sake of making this application work\r
32727 +*/\r
32728 +#define PROFDRV_DEVICE_DRIVER_MAJOR     224\r
32729 +\r
32730 +#define PROFILER_IOCTL_GET_DATA_DUMP \\r
32731 +    _IOR( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_GET_DATA_DUMP_INDEX, unsigned )\r
32732 +#define PROFILER_IOCTL_GET_RECSEQ_DATA_DUMP \\r
32733 +    _IOR( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_GET_RECSEQ_DATA_DUMP_INDEX, unsigned )\r
32734 +#define PROFILER_IOCTL_SET_DATA_CLEAN \\r
32735 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_SET_DATA_CLEAN_INDEX, unsigned )\r
32736 +#define PROFILER_IOCTL_SET_PROF_OPS \\r
32737 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_SET_PROF_OPS_INDEX, unsigned )\r
32738 +#define PROFILER_IOCTL_REGISTER_CALL \\r
32739 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_REGISTER_CALL_INDEX, PROFILER_IOCTL_DATA )\r
32740 +#define PROFILER_IOCTL_DEREGISTER_CALL \\r
32741 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_DEREGISTER_CALL_INDEX, PROFILER_IOCTL_DATA )\r
32742 +#define PROFILER_IOCTL_START_CALL \\r
32743 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_START_CALL_INDEX, PROFILER_IOCTL_DATA )\r
32744 +#define PROFILER_IOCTL_STOP_CALL \\r
32745 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_STOP_CALL_INDEX, PROFILER_IOCTL_DATA )\r
32746 +#define PROFILER_IOCTL_PROFILER_STATUS_DATA \\r
32747 +    _IOR( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_PROFILER_STATUS_INDEX, PROFILER_STATUS )\r
32748 +#define PROFILER_IOCTL_SET_CPU_UTIL \\r
32749 +    _IOW( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_SET_CPU_UTIL_INDEX, PROFILER_CPU_UTILIZATION )\r
32750 +#define PROFILER_IOCTL_GET_CPU_UTIL \\r
32751 +    _IOR( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_GET_CPU_UTIL_INDEX, PROFILER_CPU_UTILIZATION )\r
32752 +#define PROFILER_IOCTL_GET_RECSEQ_DATA_INDEX \\r
32753 +    _IOR( PROFDRV_DEVICE_DRIVER_MAJOR, PROFILER_IOCTL_GET_RECSEQ_DI_INDEX, unsigned )\r
32754 +\r
32755 +#ifdef __cplusplus
32756 +}\r
32757 +#endif
32758 +\r
32759 +#endif /* PROFDRV_DEVICE_DRIVER__H__INCLUDED */\r
32760 diff -urN linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/profiler.h linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/profiler.h
32761 --- linux-2.6.8.1/bcmdrivers/broadcom/include/bcm963xx/profiler.h       1970-01-01 01:00:00.000000000 +0100
32762 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/broadcom/include/bcm963xx/profiler.h      2006-06-26 09:07:10.000000000 +0200
32763 @@ -0,0 +1,114 @@
32764 +/***************************************************************************
32765 +*    Copyright 2004  Broadcom Corporation
32766 +*    All Rights Reserved
32767 +*    No portions of this material may be reproduced in any form without the
32768 +*    written permission of:
32769 +*             Broadcom Corporation
32770 +*             16215 Alton Parkway
32771 +*             P.O. Box 57013
32772 +*             Irvine, California 92619-7013
32773 +*    All information contained in this document is Broadcom Corporation
32774 +*    company private, proprietary, and trade secret.
32775 +*
32776 +****************************************************************************
32777 +*
32778 +*    Filename: profiler.h
32779 +*
32780 +****************************************************************************
32781 +*    Description:
32782 +*
32783 +*      This file contains the API definition for usage of the profiler tool
32784 +*
32785 +****************************************************************************/\r
32786 +#ifndef PROFILER__H__INCLUDED\r
32787 +#define PROFILER__H__INCLUDED\r
32788 +\r
32789 +#include "profdrv.h"\r
32790 +\r
32791 +#ifdef __cplusplus
32792 +extern "C" {
32793 +#endif
32794 +\r
32795 +#define PROFILER_MAX_MONITORED_PROFILE          32\r
32796 +#define PROFILER_CPU_UTILIZATION_MIN            0.000001\r
32797 +#define PROFILER_MISC_STRING_LENGTH             256\r
32798 +#define PROFILER_CPU_TICK_FACTOR                               2.0\r
32799 +#define PROFILER_S2MS_FACTOR                                   1000.0\r
32800 +\r
32801 +#define PROFILER_FLAG_RESOURCE_FREE             0x00\r
32802 +#define PROFILER_FLAG_RESOURCE_ALLOCATED        0x01\r
32803 +#define PROFILER_FLAG_RESOURCE_ERROR            0x02\r
32804 +#define PROFILER_FLAG_RESOURCE_COLLECT_PENDING  0x04\r
32805 +\r
32806 +/*\r
32807 +    This structure defines the data collected by the profiler.\r
32808 +*/\r
32809 +typedef struct\r
32810 +{\r
32811 +       unsigned char source;                                   /* User or Kernel */\r
32812 +    unsigned char flag;                     /* Generic flag */\r
32813 +    char name[PROFILER_NAME_MAX_LENGTH];    /* Name of the function monitored */\r
32814 +    unsigned int now_cycle;                 /* The current cycle count saved */\r
32815 +    unsigned int min_cycle;                 /* The minimum number of cycles calculated for this function */\r
32816 +    unsigned int max_cycle;                 /* The maximum number of cycles calculated for this function */\r
32817 +    unsigned int avg_cycle;                 /* The average numnber of cycles calculated for this function */\r
32818 +    unsigned int count;                     /* The number of time this function has been profiled */\r
32819 +\r
32820 +} PROFILER_COLLECTED_DATA; \r
32821 +\r
32822 +\r
32823 +/*
32824 +    This structure defines the recorded sequence data collected by the profiler.
32825 +*/
32826 +typedef struct PROFILER_RECSEQ_DATA\r
32827 +{\r
32828 +   unsigned int   id;\r
32829 +   unsigned long  startTime;\r
32830 +   unsigned long  endTime;\r
32831 +} PROFILER_RECSEQ_DATA;\r
32832 +\r
32833 +\r
32834 +void kernel_profiler_register( char *pName, unsigned char src );\r
32835 +void kernel_profiler_deregister( char *pName, unsigned char src );\r
32836 +void kernel_profiler_start( char *pName, unsigned char src );\r
32837 +void kernel_profiler_stop( char *pName, unsigned char src );\r
32838 +void kernel_profiler_recseq_start( unsigned int id );
32839 +void kernel_profiler_recseq_stop( unsigned int id );
32840 +\r
32841 +void kernel_profiler_reinit_collected( void );\r
32842 +void kernel_profiler_dump( void );\r
32843 +void kernel_profiler_recseq_dump( void );
32844 +void kernel_profiler_start_collect( void );\r
32845 +void kernel_profiler_stop_collect( void );\r
32846 +\r
32847 +\r
32848 +void profiler_init( void );\r
32849 +void profiler_get_status( PROFILER_STATUS *pStatus );\r
32850 +PROFILER_COLLECTED_DATA *profiler_get_data_dump( void );\r
32851 +PROFILER_RECSEQ_DATA* profiler_get_recseq_data_dump( void );\r
32852 +void profiler_get_cpu_util( PROFILER_CPU_UTILIZATION *pData );\r
32853 +void profiler_set_cpu_util( PROFILER_CPU_UTILIZATION *pData );\r
32854 +unsigned int profiler_get_recseq_data_index( void );\r
32855 +\r
32856 +/* 
32857 +    This is the generic API that should be used by clients to access the profiler
32858 +*/
32859 +#define PROFILER_REGISTER( name ) ( kernel_profiler_register( (name), PROFILER_SOURCE_KERNEL ) )\r
32860 +#define PROFILER_DEREGISTER( name ) ( kernel_profiler_deregister( (name), PROFILER_SOURCE_KERNEL ) )\r
32861 +#define PROFILER_START( name ) ( kernel_profiler_start( (name), PROFILER_SOURCE_KERNEL ) )\r
32862 +#define PROFILER_STOP( name ) ( kernel_profiler_stop( (name), PROFILER_SOURCE_KERNEL ) )\r
32863 +#define PROFILER_RECSEQ_START( source ) ( kernel_profiler_recseq_start( (source) ) )
32864 +#define PROFILER_RECSEQ_STOP( source ) ( kernel_profiler_recseq_stop( (source)) )
32865 +\r
32866 +#define PROFILER_REINIT_COLLECTED() ( kernel_profiler_reinit_collected() )\r
32867 +#define PROFILER_DUMP() ( kernel_profiler_dump() )\r
32868 +#define PROFILER_RECSEQ_DUMP() ( kernel_profiler_recseq_dump() )
32869 +#define PROFILER_START_COLLECT() ( kernel_profiler_start_collect() )\r
32870 +#define PROFILER_STOP_COLLECT() ( kernel_profiler_stop_collect() )\r
32871 +\r
32872 +\r
32873 +#ifdef __cplusplus
32874 +}\r
32875 +#endif
32876 +\r
32877 +#endif /* PROFILER__H__INCLUDED */\r
32878 diff -urN linux-2.6.8.1/bcmdrivers/opensource/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/Makefile
32879 --- linux-2.6.8.1/bcmdrivers/opensource/Makefile        1970-01-01 01:00:00.000000000 +0100
32880 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/Makefile       2006-06-26 09:07:10.000000000 +0200
32881 @@ -0,0 +1,26 @@
32882 +# File: modules/drivers/Makefile
32883 +#
32884 +# Makefile for the GPLed Linux kernel modules.
32885 +#
32886 +BRCM_BOARD:=bcm963xx
32887 +BRCM_CHIP:=6348
32888 +LN_NAME=bcm9$(BRCM_CHIP)
32889 +LN_DRIVER_DIRS =
32890 +
32891 +-include $(KERNEL_DIR)/.config
32892 +
32893 +ifneq ($(CONFIG_BCM_BOARD),)
32894 +  LN_DRIVER_DIRS +=ln -sn impl$(CONFIG_BCM_BOARD_IMPL) char/board/$(BRCM_BOARD)/$(LN_NAME);
32895 +endif
32896 +
32897 +ifneq ($(CONFIG_BCM_SERIAL),)
32898 +  LN_DRIVER_DIRS +=ln -sn impl$(CONFIG_BCM_SERIAL_IMPL) char/serial/$(LN_NAME);
32899 +endif
32900 +
32901 +obj-$(CONFIG_BCM_BOARD) += char/board/$(BRCM_BOARD)/$(LN_NAME)/
32902 +obj-$(CONFIG_BCM_SERIAL) += char/serial/$(LN_NAME)/
32903 +
32904 +
32905 +symlinks:
32906 +       find . -lname "*" -name "$(LN_NAME)" -print -exec rm -f "{}" ";"        
32907 +       $(CONFIG_SHELL) -c "$(LN_DRIVER_DIRS)"
32908 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/Makefile
32909 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/Makefile   1970-01-01 01:00:00.000000000 +0100
32910 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/Makefile  2006-06-26 09:07:10.000000000 +0200
32911 @@ -0,0 +1,17 @@
32912 +# Makefile for the bcm963xx board drivers
32913 +#
32914 +
32915 +
32916 +obj-y := board.o cfiflash.o bcm63xx_flash.o bcm63xx_led.o
32917 +
32918 +EXTRA_CFLAGS += -I. -I$(INC_BRCMBOARDPARMS_PATH)/$(BRCM_BOARD) -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
32919 +
32920 +ifeq ($(strip $(WIRELESS)),1)
32921 +       EXTRA_CFLAGS += -DWIRELESS
32922 +endif
32923 +
32924 +-include $(TOPDIR)/Rules.make
32925 +
32926 +clean:
32927 +       rm -f core *.o *.a *.s
32928 +
32929 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_flash.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_flash.c
32930 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_flash.c    1970-01-01 01:00:00.000000000 +0100
32931 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_flash.c   2006-06-26 09:07:10.000000000 +0200
32932 @@ -0,0 +1,775 @@
32933 +/*
32934 +<:copyright-gpl
32935 + Copyright 2002 Broadcom Corp. All Rights Reserved.
32936 +
32937 + This program is free software; you can distribute it and/or modify it
32938 + under the terms of the GNU General Public License (Version 2) as
32939 + published by the Free Software Foundation.
32940 +
32941 + This program is distributed in the hope it will be useful, but WITHOUT
32942 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32943 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32944 + for more details.
32945 +
32946 + You should have received a copy of the GNU General Public License along
32947 + with this program; if not, write to the Free Software Foundation, Inc.,
32948 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
32949 +:>
32950 +*/
32951 +/*
32952 + ***************************************************************************
32953 + * File Name  : bcm63xx_flash.c
32954 + *
32955 + * Description: This file contains the flash device driver APIs for bcm63xx board. 
32956 + *
32957 + * Created on :  8/10/2002  seanl:  use cfiflash.c, cfliflash.h (AMD specific)
32958 + *
32959 + ***************************************************************************/
32960 +
32961 +
32962 +/* Includes. */
32963 +#include <linux/fs.h>
32964 +#include <linux/capability.h>
32965 +#include <linux/slab.h>
32966 +#include <linux/errno.h>
32967 +#include <linux/module.h>
32968 +#include <asm/uaccess.h>
32969 +
32970 +#include <bcm_map_part.h>
32971 +#include <board.h>
32972 +#define  BCMTAG_EXE_USE
32973 +#include <bcmTag.h>
32974 +#include "cfiflash.h"
32975 +#include "boardparms.h"
32976 +
32977 +//#define DEBUG_FLASH
32978 +
32979 +static FLASH_ADDR_INFO fInfo;
32980 +static int flashInitialized = 0;
32981 +
32982 +void *retriedKmalloc(size_t size)
32983 +{
32984 +       void *pBuf;
32985 +    int tryCount = 0;
32986 +
32987 +    // try 1000 times before quit
32988 +    while (((pBuf = kmalloc(size, GFP_KERNEL)) == NULL) && (tryCount++ < 1000))
32989 +    {
32990 +               current->state   = TASK_INTERRUPTIBLE;
32991 +               schedule_timeout(HZ/10);
32992 +       }
32993 +    if (tryCount >= 1000)
32994 +        pBuf = NULL;
32995 +    else
32996 +           memset(pBuf, 0, size);
32997 +
32998 +    return pBuf;
32999 +}
33000 +
33001 +void retriedKfree(void *pBuf)
33002 +{
33003 +       kfree(pBuf);
33004 +}
33005 +
33006 +/***************************************************************************
33007 +// Function Name: getCrc32
33008 +// Description  : caculate the CRC 32 of the given data.
33009 +// Parameters   : pdata - array of data.
33010 +//                size - number of input data bytes.
33011 +//                crc - either CRC32_INIT_VALUE or previous return value.
33012 +// Returns      : crc.
33013 +****************************************************************************/
33014 +UINT32 getCrc32(byte *pdata, UINT32 size, UINT32 crc) 
33015 +{
33016 +    while (size-- > 0)
33017 +        crc = (crc >> 8) ^ Crc32_table[(crc ^ *pdata++) & 0xff];
33018 +
33019 +    return crc;
33020 +}
33021 +
33022 +// get the nvram start addr
33023 +//
33024 +unsigned long get_nvram_start_addr(void)
33025 +{
33026 +    return ((unsigned long) 
33027 +        (flash_get_memptr(fInfo.flash_nvram_start_blk) + fInfo.flash_nvram_blk_offset));
33028 +}
33029 +
33030 +// get the scratch_pad start addr
33031 +//
33032 +unsigned long get_scratch_pad_start_addr(void)
33033 +{
33034 +    return ((unsigned long) 
33035 +        (flash_get_memptr(fInfo.flash_scratch_pad_start_blk) + fInfo.flash_scratch_pad_blk_offset));
33036 +}
33037 +
33038 +
33039 +
33040 +/*  *********************************************************************
33041 +    *  kerSysImageTagGet()
33042 +    *   Get the image tag
33043 +    *  Input parameters:
33044 +    *      none
33045 +    *  Return value:
33046 +    *      point to tag -- Found
33047 +    *      NULL -- failed
33048 +    ********************************************************************* */
33049 +PFILE_TAG kerSysImageTagGet(void)
33050 +{
33051 +    int i;
33052 +    int totalBlks = flash_get_numsectors();
33053 +    UINT32 crc;
33054 +    unsigned char *sectAddr;
33055 +    PFILE_TAG pTag;
33056 +
33057 +#if defined(DEBUG_FLASH)
33058 +    printk("totalblks in tagGet=%d\n", totalBlks);
33059 +#endif
33060 +
33061 +    // start from 2nd blk, assume 1st one is always CFE
33062 +    for (i = 1; i < totalBlks; i++)
33063 +    {
33064 +        sectAddr =  flash_get_memptr((byte) i);
33065 +        crc = CRC32_INIT_VALUE;
33066 +        crc = getCrc32(sectAddr, (UINT32)TAG_LEN-TOKEN_LEN, crc);      
33067 +        pTag = (PFILE_TAG) sectAddr;
33068 +
33069 +#if defined(DEBUG_FLASH)
33070 +        printk("Check Tag crc on blk [%d]\n", i);
33071 +#endif
33072 +
33073 +        if (crc == (UINT32)(*(UINT32*)(pTag->tagValidationToken)))
33074 +            return pTag;
33075 +    }
33076 +
33077 +    return (PFILE_TAG) NULL;
33078 +}
33079 +
33080 +// Initialize the flash and fill out the fInfo structure
33081 +void kerSysFlashInit( void )
33082 +{
33083 +    int i = 0;
33084 +    int totalBlks = 0;
33085 +    int totalSize = 0;
33086 +    int startAddr = 0;
33087 +    int usedBlkSize = 0;
33088 +    NVRAM_DATA nvramData;
33089 +    UINT32 crc = CRC32_INIT_VALUE, savedCrc;
33090 +    PFILE_TAG pTag = NULL;
33091 +    unsigned long kernelEndAddr = 0;
33092 +    unsigned long spAddr = 0;
33093 +
33094 +    if (flashInitialized)
33095 +        return;
33096 +
33097 +    flashInitialized = 1;
33098 +    flash_init();
33099 +
33100 +    totalBlks = flash_get_numsectors();
33101 +    totalSize = flash_get_total_size();
33102 +
33103 +    printk("Total Flash size: %dK with %d sectors\n", totalSize/1024, totalBlks);
33104 +
33105 +    /* nvram is always at the end of flash */
33106 +    fInfo.flash_nvram_length = FLASH45_LENGTH_NVRAM;
33107 +    fInfo.flash_nvram_start_blk = 0;  /* always the first block */
33108 +    fInfo.flash_nvram_number_blk = 1; /*always fits in the first block */
33109 +    fInfo.flash_nvram_blk_offset = NVRAM_DATA_OFFSET;
33110
33111 +    // check nvram CRC
33112 +    memcpy((char *)&nvramData, (char *)get_nvram_start_addr(), sizeof(NVRAM_DATA));
33113 +    savedCrc = nvramData.ulCheckSum;
33114 +    nvramData.ulCheckSum = 0;
33115 +    crc = getCrc32((char *)&nvramData, (UINT32) sizeof(NVRAM_DATA), crc);   
33116 +
33117 +    BpSetBoardId( nvramData.szBoardId );
33118 +
33119 +    fInfo.flash_persistent_length = NVRAM_PSI_DEFAULT;
33120 +    if (savedCrc != crc)
33121 +    {
33122 +        printk("***Board is not initialized****: Using the default PSI size: %d\n",
33123 +            fInfo.flash_persistent_length);
33124 +    }
33125 +    else
33126 +    {
33127 +        unsigned long ulPsiSize;
33128 +        if( BpGetPsiSize( &ulPsiSize ) == BP_SUCCESS )
33129 +            fInfo.flash_persistent_length = ulPsiSize;
33130 +        else
33131 +        {
33132 +            printk("***Board id is not set****: Using the default PSI size: %d\n",
33133 +                fInfo.flash_persistent_length);
33134 +        }
33135 +    }
33136 +
33137 +    fInfo.flash_persistent_length *= ONEK;
33138 +    startAddr = totalSize - fInfo.flash_persistent_length;
33139 +    fInfo.flash_persistent_start_blk = flash_get_blk(startAddr+FLASH_BASE_ADDR_REG);
33140 +    fInfo.flash_persistent_number_blk = totalBlks - fInfo.flash_persistent_start_blk;
33141 +    // save abs SP address (Scratch Pad). it is before PSI 
33142 +    spAddr = startAddr - SP_MAX_LEN ;
33143 +    // find out the offset in the start_blk
33144 +    usedBlkSize = 0;
33145 +    for (i = fInfo.flash_persistent_start_blk; 
33146 +        i < (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk); i++)
33147 +    {
33148 +        usedBlkSize += flash_get_sector_size((byte) i);
33149 +    }
33150 +    fInfo.flash_persistent_blk_offset =  usedBlkSize - fInfo.flash_persistent_length;
33151 +
33152 +    // get the info for sp
33153 +    if (!(pTag = kerSysImageTagGet()))
33154 +    {
33155 +        printk("Failed to read image tag from flash\n");
33156 +        return;
33157 +    }
33158 +    kernelEndAddr = (unsigned long) simple_strtoul(pTag->kernelAddress, NULL, 10) + \
33159 +        (unsigned long) simple_strtoul(pTag->kernelLen, NULL, 10);
33160 +
33161 +    // make suer sp does not share kernel block
33162 +    fInfo.flash_scratch_pad_start_blk = flash_get_blk(spAddr+FLASH_BASE_ADDR_REG);
33163 +    if (fInfo.flash_scratch_pad_start_blk != flash_get_blk(kernelEndAddr))
33164 +    {
33165 +        fInfo.flash_scratch_pad_length = SP_MAX_LEN;
33166 +        if (fInfo.flash_persistent_start_blk == fInfo.flash_scratch_pad_start_blk)  // share blk
33167 +        {
33168 +#if 1 /* do not used scratch pad unless it's in its own sector */
33169 +            printk("Scratch pad is not used for this flash part.\n");  
33170 +            fInfo.flash_scratch_pad_length = 0;     // no sp
33171 +#else /* allow scratch pad to share a sector with another section such as PSI */
33172 +            fInfo.flash_scratch_pad_number_blk = 1;
33173 +            fInfo.flash_scratch_pad_blk_offset = fInfo.flash_persistent_blk_offset - fInfo.flash_scratch_pad_length;
33174 +#endif
33175 +        }
33176 +        else // on different blk
33177 +        {
33178 +            fInfo.flash_scratch_pad_number_blk = fInfo.flash_persistent_start_blk\
33179 +                - fInfo.flash_scratch_pad_start_blk;
33180 +            // find out the offset in the start_blk
33181 +            usedBlkSize = 0;
33182 +            for (i = fInfo.flash_scratch_pad_start_blk; 
33183 +                i < (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk); i++)
33184 +                usedBlkSize += flash_get_sector_size((byte) i);
33185 +                fInfo.flash_scratch_pad_blk_offset =  usedBlkSize - fInfo.flash_scratch_pad_length;
33186 +        }
33187 +    }
33188 +    else
33189 +    {
33190 +        printk("No flash for scratch pad!\n");  
33191 +        fInfo.flash_scratch_pad_length = 0;     // no sp
33192 +    }
33193 +
33194 +#if defined(DEBUG_FLASH)
33195 +    printk("fInfo.flash_scratch_pad_start_blk = %d\n", fInfo.flash_scratch_pad_start_blk);
33196 +    printk("fInfo.flash_scratch_pad_number_blk = %d\n", fInfo.flash_scratch_pad_number_blk);
33197 +    printk("fInfo.flash_scratch_pad_length = 0x%x\n", fInfo.flash_scratch_pad_length);
33198 +    printk("fInfo.flash_scratch_pad_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_scratch_pad_blk_offset);
33199 +
33200 +    printk("fInfo.flash_nvram_start_blk = %d\n", fInfo.flash_nvram_start_blk);
33201 +    printk("fInfo.flash_nvram_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_nvram_blk_offset);
33202 +    printk("fInfo.flash_nvram_number_blk = %d\n", fInfo.flash_nvram_number_blk);
33203 +
33204 +    printk("psi startAddr = %x\n", startAddr+FLASH_BASE_ADDR_REG);
33205 +    printk("fInfo.flash_persistent_start_blk = %d\n", fInfo.flash_persistent_start_blk);
33206 +    printk("fInfo.flash_persistent_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_persistent_blk_offset);
33207 +    printk("fInfo.flash_persistent_number_blk = %d\n", fInfo.flash_persistent_number_blk);
33208 +#endif
33209 +
33210 +}
33211 +
33212 +
33213 +
33214 +/***********************************************************************
33215 + * Function Name: kerSysFlashAddrInfoGet
33216 + * Description  : Fills in a structure with information about the NVRAM
33217 + *                and persistent storage sections of flash memory.  
33218 + *                Fro physmap.c to mount the fs vol.
33219 + * Returns      : None.
33220 + ***********************************************************************/
33221 +void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info)
33222 +{
33223 +    pflash_addr_info->flash_nvram_blk_offset = fInfo.flash_nvram_blk_offset;
33224 +    pflash_addr_info->flash_nvram_length = fInfo.flash_nvram_length;
33225 +    pflash_addr_info->flash_nvram_number_blk = fInfo.flash_nvram_number_blk;
33226 +    pflash_addr_info->flash_nvram_start_blk = fInfo.flash_nvram_start_blk;
33227 +    pflash_addr_info->flash_persistent_blk_offset = fInfo.flash_persistent_blk_offset;
33228 +    pflash_addr_info->flash_persistent_length = fInfo.flash_persistent_length;
33229 +    pflash_addr_info->flash_persistent_number_blk = fInfo.flash_persistent_number_blk;
33230 +    pflash_addr_info->flash_persistent_start_blk = fInfo.flash_persistent_start_blk;
33231 +}
33232 +
33233 +
33234 +// get shared blks into *** pTempBuf *** which has to be released bye the caller!
33235 +// return: if pTempBuf != NULL, poits to the data with the dataSize of the buffer
33236 +// !NULL -- ok
33237 +// NULL  -- fail
33238 +static char *getSharedBlks(int start_blk, int end_blk)
33239 +{
33240 +    int i = 0;
33241 +    int usedBlkSize = 0;
33242 +    int sect_size = 0;
33243 +    char *pTempBuf = NULL;
33244 +    char *pBuf = NULL;
33245 +
33246 +    for (i = start_blk; i < end_blk; i++)
33247 +        usedBlkSize += flash_get_sector_size((byte) i);
33248 +
33249 +#if defined(DEBUG_FLASH)
33250 +    printk("usedBlkSize = %d\n", usedBlkSize);
33251 +#endif
33252 +
33253 +    if ((pTempBuf = (char *) retriedKmalloc(usedBlkSize)) == NULL)
33254 +    {
33255 +        printk("failed to allocate memory with size: %d\n", usedBlkSize);
33256 +        return pTempBuf;
33257 +    }
33258 +    
33259 +    pBuf = pTempBuf;
33260 +    for (i = start_blk; i < end_blk; i++)
33261 +    {
33262 +        sect_size = flash_get_sector_size((byte) i);
33263 +
33264 +#if defined(DEBUG_FLASH)
33265 +        printk("i = %d, sect_size = %d, end_blk = %d\n", i, sect_size, end_blk);
33266 +#endif
33267 +        flash_read_buf((byte)i, 0, pBuf, sect_size);
33268 +        pBuf += sect_size;
33269 +    }
33270 +    
33271 +    return pTempBuf;
33272 +}
33273 +
33274 +
33275 +
33276 +// Set the pTempBuf to flash from start_blk to end_blk
33277 +// return:
33278 +// 0 -- ok
33279 +// -1 -- fail
33280 +static int setSharedBlks(int start_blk, int end_blk, char *pTempBuf)
33281 +{
33282 +    int i = 0;
33283 +    int sect_size = 0;
33284 +    int sts = 0;
33285 +    char *pBuf = pTempBuf;
33286 +
33287 +    for (i = start_blk; i < end_blk; i++)
33288 +    {
33289 +        sect_size = flash_get_sector_size((byte) i);
33290 +        flash_sector_erase_int(i);
33291 +        if (flash_write_buf(i, 0, pBuf, sect_size) != sect_size)
33292 +        {
33293 +            printk("Error writing flash sector %d.", i);
33294 +            sts = -1;
33295 +            break;
33296 +        }
33297 +        pBuf += sect_size;
33298 +    }
33299 +
33300 +    return sts;
33301 +}
33302 +
33303 +
33304 +
33305 +/*******************************************************************************
33306 + * NVRAM functions
33307 + *******************************************************************************/
33308 +
33309 +// get nvram data
33310 +// return:
33311 +//  0 - ok
33312 +//  -1 - fail
33313 +int kerSysNvRamGet(char *string, int strLen, int offset)
33314 +{
33315 +    char *pBuf = NULL;
33316 +
33317 +    if (!flashInitialized)
33318 +        kerSysFlashInit();
33319 +
33320 +    if (strLen > FLASH45_LENGTH_NVRAM)
33321 +        return -1;
33322 +
33323 +    if ((pBuf = getSharedBlks(fInfo.flash_nvram_start_blk,
33324 +        (fInfo.flash_nvram_start_blk + fInfo.flash_nvram_number_blk))) == NULL)
33325 +        return -1;
33326 +
33327 +    // get string off the memory buffer
33328 +    memcpy(string, (pBuf + fInfo.flash_nvram_blk_offset + offset), strLen);
33329 +
33330 +    retriedKfree(pBuf);
33331 +
33332 +    return 0;
33333 +}
33334 +
33335 +
33336 +// set nvram 
33337 +// return:
33338 +//  0 - ok
33339 +//  -1 - fail
33340 +int kerSysNvRamSet(char *string, int strLen, int offset)
33341 +{
33342 +    int sts = 0;
33343 +    char *pBuf = NULL;
33344 +
33345 +    if (strLen > FLASH45_LENGTH_NVRAM)
33346 +        return -1;
33347 +
33348 +    if ((pBuf = getSharedBlks(fInfo.flash_nvram_start_blk,
33349 +        (fInfo.flash_nvram_start_blk + fInfo.flash_nvram_number_blk))) == NULL)
33350 +        return -1;
33351 +
33352 +    // set string to the memory buffer
33353 +    memcpy((pBuf + fInfo.flash_nvram_blk_offset + offset), string, strLen);
33354 +
33355 +    if (setSharedBlks(fInfo.flash_nvram_start_blk, 
33356 +        (fInfo.flash_nvram_number_blk + fInfo.flash_nvram_start_blk), pBuf) != 0)
33357 +        sts = -1;
33358 +    
33359 +    retriedKfree(pBuf);
33360 +
33361 +    return sts;
33362 +}
33363 +
33364 +
33365 +/***********************************************************************
33366 + * Function Name: kerSysEraseNvRam
33367 + * Description  : Erase the NVRAM storage section of flash memory.
33368 + * Returns      : 1 -- ok, 0 -- fail
33369 + ***********************************************************************/
33370 +int kerSysEraseNvRam(void)
33371 +{
33372 +    int sts = 1;
33373 +    char *tempStorage = retriedKmalloc(FLASH45_LENGTH_NVRAM);
33374 +    
33375 +    // just write the whole buf with '0xff' to the flash
33376 +    if (!tempStorage)
33377 +        sts = 0;
33378 +    else
33379 +    {
33380 +        memset(tempStorage, 0xff, FLASH45_LENGTH_NVRAM);
33381 +        if (kerSysNvRamSet(tempStorage, FLASH45_LENGTH_NVRAM, 0) != 0)
33382 +            sts = 0;
33383 +        retriedKfree(tempStorage);
33384 +    }
33385 +
33386 +    return sts;
33387 +}
33388 +
33389 +
33390 +/*******************************************************************************
33391 + * PSI functions
33392 + *******************************************************************************/
33393 +// get psi data
33394 +// return:
33395 +//  0 - ok
33396 +//  -1 - fail
33397 +int kerSysPersistentGet(char *string, int strLen, int offset)
33398 +{
33399 +    char *pBuf = NULL;
33400 +
33401 +    if (strLen > fInfo.flash_persistent_length)
33402 +        return -1;
33403 +
33404 +    if ((pBuf = getSharedBlks(fInfo.flash_persistent_start_blk,
33405 +        (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk))) == NULL)
33406 +        return -1;
33407 +
33408 +    // get string off the memory buffer
33409 +    memcpy(string, (pBuf + fInfo.flash_persistent_blk_offset + offset), strLen);
33410 +
33411 +    retriedKfree(pBuf);
33412 +
33413 +    return 0;
33414 +}
33415 +
33416 +
33417 +// set psi 
33418 +// return:
33419 +//  0 - ok
33420 +//  -1 - fail
33421 +int kerSysPersistentSet(char *string, int strLen, int offset)
33422 +{
33423 +    int sts = 0;
33424 +    char *pBuf = NULL;
33425 +
33426 +    if (strLen > fInfo.flash_persistent_length)
33427 +        return -1;
33428 +
33429 +    if ((pBuf = getSharedBlks(fInfo.flash_persistent_start_blk,
33430 +        (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk))) == NULL)
33431 +        return -1;
33432 +
33433 +    // set string to the memory buffer
33434 +    memcpy((pBuf + fInfo.flash_persistent_blk_offset + offset), string, strLen);
33435 +
33436 +    if (setSharedBlks(fInfo.flash_persistent_start_blk, 
33437 +        (fInfo.flash_persistent_number_blk + fInfo.flash_persistent_start_blk), pBuf) != 0)
33438 +        sts = -1;
33439 +    
33440 +    retriedKfree(pBuf);
33441 +
33442 +    return sts;
33443 +}
33444 +
33445 +
33446 +// flash bcm image 
33447 +// return: 
33448 +// 0 - ok
33449 +// !0 - the sector number fail to be flashed (should not be 0)
33450 +int kerSysBcmImageSet( int flash_start_addr, char *string, int size)
33451 +{
33452 +    int sts;
33453 +    int sect_size;
33454 +    int blk_start;
33455 +    int i;
33456 +    char *pTempBuf = NULL;
33457 +    int whole_image = 0;
33458 +
33459 +    blk_start = flash_get_blk(flash_start_addr);
33460 +    if( blk_start < 0 )
33461 +        return( -1 );
33462 +
33463 +    if (flash_start_addr == FLASH_BASE && size > FLASH45_LENGTH_BOOT_ROM)
33464 +        whole_image = 1;
33465 +
33466 +   /* write image to flash memory */
33467 +    do 
33468 +    {
33469 +        sect_size = flash_get_sector_size(blk_start);
33470 +// NOTE: for memory problem in multiple PVC configuration, temporary get rid of kmalloc this 64K for now.
33471 +//        if ((pTempBuf = (char *)retriedKmalloc(sect_size)) == NULL)
33472 +//        {
33473 +//            printk("Failed to allocate memory with size: %d.  Reset the router...\n", sect_size);
33474 +//            kerSysMipsSoftReset();     // reset the board right away.
33475 +//        }
33476 +        // for whole image, no check on psi
33477 +        if (!whole_image && blk_start == fInfo.flash_persistent_start_blk)  // share the blk with psi
33478 +        {
33479 +            if (size > (sect_size - fInfo.flash_persistent_length))
33480 +            {
33481 +                printk("Image is too big\n");
33482 +                break;          // image is too big. Can not overwrite to nvram
33483 +            }
33484 +            if ((pTempBuf = (char *)retriedKmalloc(sect_size)) == NULL)
33485 +            {
33486 +               printk("Failed to allocate memory with size: %d.  Reset the router...\n", sect_size);
33487 +               kerSysMipsSoftReset();     // reset the board right away.
33488 +            }
33489 +            flash_read_buf((byte)blk_start, 0, pTempBuf, sect_size);
33490 +            if (copy_from_user((void *)pTempBuf,(void *)string, size) != 0)
33491 +                break;  // failed ?
33492 +            flash_sector_erase_int(blk_start);     // erase blk before flash
33493 +            if (flash_write_buf(blk_start, 0, pTempBuf, sect_size) == sect_size) 
33494 +                size = 0;   // break out and say all is ok
33495 +            retriedKfree(pTempBuf);
33496 +            break;
33497 +        }
33498 +        
33499 +        flash_sector_erase_int(blk_start);     // erase blk before flash
33500 +
33501 +        if (sect_size > size) 
33502 +        {
33503 +            if (size & 1) 
33504 +                size++;
33505 +            sect_size = size;
33506 +        }
33507 +        
33508 +        if ((i = flash_write_buf(blk_start, 0, string, sect_size)) != sect_size) {
33509 +            break;
33510 +        }
33511 +        blk_start++;
33512 +        string += sect_size;
33513 +        size -= sect_size; 
33514 +    } while (size > 0);
33515 +
33516 +    if (whole_image)  
33517 +    {
33518 +        // If flashing a whole image, erase to end of flash.
33519 +        int total_blks = flash_get_numsectors();
33520 +        while( blk_start < total_blks )
33521 +        {
33522 +            flash_sector_erase_int(blk_start);
33523 +            blk_start++;
33524 +        }
33525 +    }
33526 +    if (pTempBuf)
33527 +        retriedKfree(pTempBuf);
33528 +
33529 +    if( size == 0 ) 
33530 +        sts = 0;  // ok
33531 +    else  
33532 +        sts = blk_start;    // failed to flash this sector
33533 +
33534 +    return sts;
33535 +}
33536 +
33537 +/*******************************************************************************
33538 + * SP functions
33539 + *******************************************************************************/
33540 +// get sp data.  NOTE: memcpy work here -- not using copy_from/to_user
33541 +// return:
33542 +//  0 - ok
33543 +//  -1 - fail
33544 +int kerSysScratchPadGet(char *tokenId, char *tokBuf, int bufLen)
33545 +{
33546 +    PSP_HEADER pHead = NULL;
33547 +    PSP_TOKEN pToken = NULL;
33548 +    char *pBuf = NULL;
33549 +    char *pShareBuf = NULL;
33550 +    char *startPtr = NULL;
33551 +    char *endPtr = NULL;
33552 +    char *spEndPtr = NULL;
33553 +    int sts = -1;
33554 +
33555 +    if (fInfo.flash_scratch_pad_length == 0)
33556 +        return sts;
33557 +
33558 +    if (bufLen >= (fInfo.flash_scratch_pad_length - sizeof(SP_HEADER) - sizeof(SP_TOKEN))) 
33559 +    {
33560 +        printk("Exceed scratch pad space by %d\n", bufLen  - fInfo.flash_scratch_pad_length \
33561 +            - sizeof(SP_HEADER) - sizeof(SP_TOKEN));
33562 +        return sts;
33563 +    }
33564 +
33565 +    if ((pShareBuf = getSharedBlks(fInfo.flash_scratch_pad_start_blk,
33566 +        (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk))) == NULL)
33567 +        return sts;
33568 +
33569 +    // pBuf points to SP buf
33570 +    pBuf = pShareBuf + fInfo.flash_scratch_pad_blk_offset;  
33571 +
33572 +    pHead = (PSP_HEADER) pBuf;
33573 +    if (memcmp(pHead->SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN) != 0) 
33574 +    {
33575 +        printk("Scrap pad is not initialized.\n");
33576 +        return sts;
33577 +    }
33578 +
33579 +    // search up to SPUsedLen for the token
33580 +    startPtr = pBuf + sizeof(SP_HEADER);
33581 +    endPtr = pBuf + pHead->SPUsedLen;
33582 +    spEndPtr = pBuf + SP_MAX_LEN;
33583 +    while (startPtr < endPtr && startPtr < spEndPtr)
33584 +    {
33585 +        pToken = (PSP_TOKEN) startPtr;
33586 +        if (strncmp(pToken->tokenName, tokenId, TOKEN_NAME_LEN) == 0)
33587 +        {
33588 +            memcpy(tokBuf, startPtr + sizeof(SP_TOKEN), bufLen);
33589 +            sts = 0;
33590 +            break;
33591 +        }
33592 +        // get next token
33593 +        startPtr += sizeof(SP_TOKEN) + pToken->tokenLen;
33594 +    }
33595 +
33596 +    retriedKfree(pShareBuf);
33597 +
33598 +    return sts;
33599 +}
33600 +
33601 +
33602 +// set sp.  NOTE: memcpy work here -- not using copy_from/to_user
33603 +// return:
33604 +//  0 - ok
33605 +//  -1 - fail
33606 +int kerSysScratchPadSet(char *tokenId, char *tokBuf, int bufLen)
33607 +{
33608 +    PSP_TOKEN pToken = NULL;
33609 +    PSP_HEADER pHead = NULL;
33610 +    char *pShareBuf = NULL;
33611 +    char *pBuf = NULL;
33612 +    SP_HEADER SPHead;
33613 +    SP_TOKEN SPToken;
33614 +    char *curPtr;
33615 +    int sts = -1;
33616 +
33617 +    if (fInfo.flash_scratch_pad_length == 0)
33618 +        return sts;
33619 +
33620 +    if (bufLen >= (fInfo.flash_scratch_pad_length - sizeof(SP_HEADER) - sizeof(SP_TOKEN))) 
33621 +    {
33622 +        printk("Exceed scratch pad space by %d\n", bufLen  - fInfo.flash_scratch_pad_length \
33623 +            - sizeof(SP_HEADER) - sizeof(SP_TOKEN));
33624 +        return sts;
33625 +    }
33626 +
33627 +    if ((pShareBuf = getSharedBlks(fInfo.flash_scratch_pad_start_blk,
33628 +        (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk))) == NULL)
33629 +        return sts;
33630 +
33631 +    // pBuf points to SP buf
33632 +    pBuf = pShareBuf + fInfo.flash_scratch_pad_blk_offset;  
33633 +    pHead = (PSP_HEADER) pBuf;
33634 +
33635 +    // form header info.  SPUsedLen later on...
33636 +    memset((char *)&SPHead, 0, sizeof(SP_HEADER));
33637 +    memcpy(SPHead.SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN);
33638 +    SPHead.SPVersion = SP_VERSION;
33639 +
33640 +    // form token info.
33641 +    memset((char*)&SPToken, 0, sizeof(SP_TOKEN));
33642 +    strncpy(SPToken.tokenName, tokenId, TOKEN_NAME_LEN - 1);
33643 +    SPToken.tokenLen = bufLen;
33644 +    if (memcmp(pHead->SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN) != 0) 
33645 +    {
33646 +        // new sp, so just flash the token
33647 +        printk("No Scrap pad found.  Initialize scratch pad...\n");
33648 +        SPHead.SPUsedLen = sizeof(SP_HEADER) + sizeof(SP_TOKEN) + bufLen;
33649 +        memcpy(pBuf, (char *)&SPHead, sizeof(SP_HEADER));
33650 +        curPtr = pBuf + sizeof(SP_HEADER);
33651 +        memcpy(curPtr, (char *)&SPToken, sizeof(SP_TOKEN));
33652 +        curPtr += sizeof(SP_TOKEN);
33653 +        memcpy(curPtr, tokBuf, bufLen);
33654 +    }
33655 +    else  
33656 +    {
33657 +        // need search for the token, if exist with same size overwrite it. if sizes differ, 
33658 +        // move over the later token data over and put the new one at the end
33659 +        char *endPtr = pBuf + pHead->SPUsedLen;
33660 +        char *spEndPtr = pBuf + SP_MAX_LEN;
33661 +        curPtr = pBuf + sizeof(SP_HEADER);
33662 +        while (curPtr < endPtr && curPtr < spEndPtr)
33663 +        {
33664 +            pToken = (PSP_TOKEN) curPtr;
33665 +            if (strncmp(pToken->tokenName, tokenId, TOKEN_NAME_LEN) == 0)
33666 +            {
33667 +                if (pToken->tokenLen == bufLen) // overwirte it
33668 +                {
33669 +                    memcpy((curPtr+sizeof(SP_TOKEN)), tokBuf, bufLen);
33670 +                    break;
33671 +                }
33672 +                else // move later data over and put the new token at the end
33673 +                {
33674 +                    memcpy((curPtr+sizeof(SP_TOKEN)), tokBuf, bufLen);  // ~~~
33675 +                    break;
33676 +                }
33677 +            }
33678 +            else // not same token ~~~
33679 +            {
33680 +            }
33681 +            // get next token
33682 +            curPtr += sizeof(SP_TOKEN) + pToken->tokenLen;
33683 +        } // end while
33684 +        SPHead.SPUsedLen = sizeof(SP_HEADER) + sizeof(SP_TOKEN) + bufLen; // ~~~
33685 +        if (SPHead.SPUsedLen > SP_MAX_LEN)
33686 +        {
33687 +            printk("No more Scratch pad space left! Over limit by %d bytes\n", SPHead.SPUsedLen - SP_MAX_LEN);
33688 +            return sts;
33689 +        }
33690 +
33691 +    } // else if not new sp
33692 +
33693 +    sts = setSharedBlks(fInfo.flash_scratch_pad_start_blk, 
33694 +        (fInfo.flash_scratch_pad_number_blk + fInfo.flash_scratch_pad_start_blk), pShareBuf);
33695 +    
33696 +    retriedKfree(pShareBuf);
33697 +
33698 +    return sts;
33699 +
33700 +    
33701 +}
33702 +
33703 +int kerSysFlashSizeGet(void)
33704 +{
33705 +   return flash_get_total_size();
33706 +}
33707 +
33708 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_led.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_led.c
33709 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_led.c      1970-01-01 01:00:00.000000000 +0100
33710 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/bcm63xx_led.c     2006-06-26 09:07:10.000000000 +0200
33711 @@ -0,0 +1,582 @@
33712 +/*
33713 +<:copyright-gpl 
33714 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
33715
33716 + This program is free software; you can distribute it and/or modify it 
33717 + under the terms of the GNU General Public License (Version 2) as 
33718 + published by the Free Software Foundation. 
33719
33720 + This program is distributed in the hope it will be useful, but WITHOUT 
33721 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
33722 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
33723 + for more details. 
33724
33725 + You should have received a copy of the GNU General Public License along 
33726 + with this program; if not, write to the Free Software Foundation, Inc., 
33727 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
33728 +:>
33729 +*/
33730 +/***************************************************************************
33731 + * File Name  : bcm63xx_led.c
33732 + *
33733 + * Description: 
33734 + *
33735 + *    This file contains bcm963xx board led control API functions. 
33736 + *
33737 + *    To use it, do the following
33738 + *
33739 + *    1). define in the board.c the following led mappping (this is for 6345GW board):
33740 + *        const LED_MAP_PAIR cLedMapping45GW[] =
33741 + *        {   // led name     Initial state       physical pin (ledMask)
33742 + *            {kLedUsb,       kLedStateOff,       GPIO_LED_PIN_7}, 
33743 + *            {kLedAdsl,      kLedStateOff,       GPIO_LED_PIN_8},
33744 + *            {kLedPPP,       kLedStateOff,       GPIO_LED_PIN_9},    // PPP and WanData share PIN_9
33745 + *            {kLedWanData,   kLedStateOff,       GPIO_LED_PIN_9},
33746 + *            {kLedWireless,  kLedStateOff,       GPIO_LED_PIN_10},
33747 + *            {kLedEnd,       kLedStateOff,       0              } // NOTE: kLedEnd has to be at the end.
33748 + *
33749 + *    2). };To initialize led API and initial state of the leds, call the following function with the mapping 
33750 + *        pointer from the above struct
33751 + *
33752 + *        boardLedInit((PLED_MAP_PAIR) &cLedMapping45R);
33753 + *
33754 + *    3). Sample call for kernel mode:
33755 + *
33756 + *        kerSysLedCtrl(kLedAdsl, kLedStateBlinkOnce);        // kLedxxx defines in board.h
33757 + *
33758 + *    4). Sample call for user mode
33759 + *
33760 + *        sysLedCtrl(kLedAdsl, kLedStateBlinkOnce);           // kLedxxx defines in board_api.h
33761 + *
33762 + *
33763 + * Created on :  10/28/2002  seanl
33764 + *
33765 + ***************************************************************************/
33766 +
33767 +/* Includes. */
33768 +#include <linux/init.h>
33769 +#include <linux/fs.h>
33770 +#include <linux/capability.h>
33771 +#include <linux/slab.h>
33772 +#include <linux/errno.h>
33773 +#include <linux/module.h>
33774 +#include <linux/netdevice.h>
33775 +#include <asm/uaccess.h>
33776 +
33777 +#include <bcm_map_part.h>
33778 +#include <board.h>
33779 +
33780 +#define k100ms              (HZ / 10)     // ~100 ms
33781 +#define kFastBlinkCount     0             // ~100ms
33782 +#define kSlowBlinkCount     5             // ~600ms
33783 +
33784 +#define MAX_VIRT_LEDS       12
33785 +
33786 +// uncomment // for debug led
33787 +//#define DEBUG_LED
33788 +
33789 +// global variables:
33790 +struct timer_list gLedTimer;
33791 +int gTimerOn = FALSE;
33792 +int gLedCount = 0;
33793 +
33794 +typedef struct ledinfo
33795 +{
33796 +    unsigned short ledMask;         // mask for led: ie. giop 10 = 0x0400
33797 +    unsigned short ledActiveLow;    // GPIO bit reset to turn on LED
33798 +    unsigned short ledMaskFail;     // mask for led: ie. giop 10 = 0x0400
33799 +    unsigned short ledActiveLowFail;// GPIO bit reset to turn on LED
33800 +    BOARD_LED_STATE ledState;       // current led state
33801 +    BOARD_LED_STATE savedLedState;  // used in blink once for restore to the orignal ledState
33802 +    int blinkCountDown;             // if == 0, do blink (toggle).  Is assgined value and dec by 1 at each timer.
33803 +} LED_INFO, *PLED_INFO;
33804 +
33805 +static PLED_INFO gLed = NULL;
33806 +static PLED_INFO gpVirtLeds[MAX_VIRT_LEDS];
33807 +static HANDLE_LED_FUNC gLedHwFunc[MAX_VIRT_LEDS];
33808 +static HANDLE_LED_FUNC gLedHwFailFunc[MAX_VIRT_LEDS];
33809 +
33810 +#if 0 /* BROKEN */
33811 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
33812 +static int gLedOffInBridgeMode = 1;
33813 +#elif defined(CONFIG_BCM96345)
33814 +static int gLedOffInBridgeMode = 0;
33815 +#endif
33816 +#endif
33817 +
33818 +void ledTimerExpire(void);
33819 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed );
33820 +
33821 +//**************************************************************************************
33822 +// LED operations
33823 +//**************************************************************************************
33824 +
33825 +// turn led on and set the ledState
33826 +void ledOn(PLED_INFO pLed)
33827 +{
33828 +    if( pLed->ledMask )
33829 +    {
33830 +        GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
33831 +        if( pLed->ledActiveLow )
33832 +            GPIO->GPIOio  &= ~pLed->ledMask;    // turn on the led
33833 +        else
33834 +            GPIO->GPIOio  |= pLed->ledMask;     // turn on the led
33835 +        pLed->ledState = pLed->savedLedState = kLedStateOn;
33836 +    }
33837 +}
33838 +
33839 +
33840 +// turn led off and set the ledState
33841 +void ledOff(PLED_INFO pLed)
33842 +{
33843 +    if( pLed->ledMask )
33844 +    {
33845 +        GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
33846 +        if( pLed->ledActiveLow )
33847 +            GPIO->GPIOio  |= pLed->ledMask;     // turn off the led
33848 +        else
33849 +            GPIO->GPIOio  &= ~pLed->ledMask;    // turn off the led
33850 +        pLed->ledState = pLed->savedLedState = kLedStateOff;
33851 +    }
33852 +}
33853 +
33854 +// turn led on and set the ledState
33855 +void ledOnFail(PLED_INFO pLed)
33856 +{
33857 +    if( pLed->ledMaskFail )
33858 +    {
33859 +        GPIO->GPIODir |= pLed->ledMaskFail;     // turn on the direction bit in case was turned off by some one
33860 +        if( pLed->ledActiveLowFail )
33861 +            GPIO->GPIOio  &= ~pLed->ledMaskFail;// turn on the led
33862 +        else
33863 +            GPIO->GPIOio  |= pLed->ledMaskFail; // turn on the led
33864 +        pLed->ledState = pLed->savedLedState = kLedStateFail;
33865 +    }
33866 +}
33867 +
33868 +
33869 +// turn led off and set the ledState
33870 +void ledOffFail(PLED_INFO pLed)
33871 +{
33872 +    if( pLed->ledMaskFail )
33873 +    {
33874 +        GPIO->GPIODir |= pLed->ledMaskFail;     // turn on the direction bit in case was turned off by some one
33875 +        if( pLed->ledActiveLowFail )
33876 +            GPIO->GPIOio  |= pLed->ledMaskFail; // turn off the led
33877 +        else
33878 +            GPIO->GPIOio  &= ~pLed->ledMaskFail;// turn off the led
33879 +        pLed->ledState = pLed->savedLedState = kLedStateOff;
33880 +    }
33881 +}
33882 +
33883 +
33884 +// toggle the led and return the current ledState
33885 +BOARD_LED_STATE ledToggle(PLED_INFO pLed)
33886 +{
33887 +    GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
33888 +    if (GPIO->GPIOio & pLed->ledMask)
33889 +    {
33890 +        GPIO->GPIOio &= ~(pLed->ledMask);
33891 +        return( (pLed->ledActiveLow) ? kLedStateOn : kLedStateOff );
33892 +    }
33893 +    else
33894 +    {
33895 +        GPIO->GPIOio |= pLed->ledMask;
33896 +        return( (pLed->ledActiveLow) ? kLedStateOff : kLedStateOn );
33897 +    }
33898 +}   
33899 +
33900 +
33901 +// led timer.  Will return if timer is already on
33902 +void ledTimerStart(void)
33903 +{
33904 +    if (gTimerOn)
33905 +        return;
33906 +
33907 +#if defined(DEBUG_LED)
33908 +    printk("led: add_timer\n");
33909 +#endif
33910 +
33911 +    init_timer(&gLedTimer);
33912 +    gLedTimer.function = (void*)ledTimerExpire;
33913 +    gLedTimer.expires = jiffies + k100ms;        // timer expires in ~100ms
33914 +    add_timer (&gLedTimer);
33915 +    gTimerOn = TRUE;
33916 +} 
33917 +
33918 +
33919 +// led timer expire kicks in about ~100ms and perform the led operation according to the ledState and
33920 +// restart the timer according to ledState
33921 +void ledTimerExpire(void)
33922 +{
33923 +    int i;
33924 +    PLED_INFO pCurLed;
33925 +
33926 +    gTimerOn = FALSE;
33927 +
33928 +    for (i = 0, pCurLed = gLed; i < gLedCount; i++, pCurLed++)
33929 +    {
33930 +#if defined(DEBUG_LED)
33931 +        printk("led[%d]: Mask=0x%04x, State = %d, blcd=%d\n", i, pCurLed->ledMask, pCurLed->ledState, pCurLed->blinkCountDown);
33932 +#endif
33933 +        switch (pCurLed->ledState)
33934 +        {
33935 +            case kLedStateOn:
33936 +            case kLedStateOff:
33937 +            case kLedStateFail:
33938 +                pCurLed->blinkCountDown = 0;            // reset the blink count down
33939 +                break;
33940 +
33941 +            case kLedStateBlinkOnce:
33942 +                ledToggle(pCurLed);
33943 +                pCurLed->blinkCountDown = 0;                      // reset to 0
33944 +                pCurLed->ledState = pCurLed->savedLedState;
33945 +                if (pCurLed->ledState == kLedStateSlowBlinkContinues || 
33946 +                    pCurLed->ledState == kLedStateFastBlinkContinues)
33947 +                    ledTimerStart();                  // start timer if in blinkContinues stats
33948 +                break;
33949 +
33950 +            case kLedStateSlowBlinkContinues:
33951 +                if (pCurLed->blinkCountDown-- == 0)
33952 +                {
33953 +                    pCurLed->blinkCountDown = kSlowBlinkCount;
33954 +                    ledToggle(pCurLed);
33955 +                }
33956 +                ledTimerStart();
33957 +                break;
33958 +
33959 +            case kLedStateFastBlinkContinues:
33960 +                if (pCurLed->blinkCountDown-- == 0)
33961 +                {
33962 +                    pCurLed->blinkCountDown = kFastBlinkCount;
33963 +                    ledToggle(pCurLed);
33964 +                }
33965 +                ledTimerStart();
33966 +                break;
33967 +
33968 +            default:
33969 +                printk("Invalid state = %d\n", pCurLed->ledState);
33970 +        }
33971 +    }
33972 +}
33973 +
33974 +// initialize the gLedCount and allocate and fill gLed struct
33975 +void __init boardLedInit(PLED_MAP_PAIR cLedMapping)
33976 +{
33977 +    PLED_MAP_PAIR p1, p2;
33978 +    PLED_INFO pCurLed;
33979 +    int needTimer = FALSE;
33980 +    int alreadyUsed = 0;
33981 +
33982 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
33983 +    /* Set blink rate for BCM6348/BCM6338 hardware LEDs. */
33984 +    GPIO->LEDCtrl &= ~LED_INTERVAL_SET_MASK;
33985 +    GPIO->LEDCtrl |= LED_INTERVAL_SET_80MS;
33986 +#endif
33987 +
33988 +    memset( gpVirtLeds, 0x00, sizeof(gpVirtLeds) );
33989 +    memset( gLedHwFunc, 0x00, sizeof(gLedHwFunc) );
33990 +    memset( gLedHwFailFunc, 0x00, sizeof(gLedHwFailFunc) );
33991 +
33992 +    gLedCount = 0;
33993 +
33994 +    // Check for multiple LED names and multiple LED GPIO pins that share the
33995 +    // same physical board LED.
33996 +    for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
33997 +    {
33998 +        alreadyUsed = 0;
33999 +        for( p2 = cLedMapping; p2 != p1; p2++ )
34000 +        {
34001 +            if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
34002 +                (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
34003 +            {
34004 +                alreadyUsed = 1;
34005 +                break;
34006 +            }
34007 +        }
34008 +
34009 +        if( alreadyUsed == 0  )
34010 +            gLedCount++;
34011 +    }
34012 +
34013 +    gLed = (PLED_INFO) kmalloc((gLedCount * sizeof(LED_INFO)), GFP_KERNEL);
34014 +    if( gLed == NULL )
34015 +    {
34016 +        printk( "LED memory allocation error.\n" );
34017 +        return;
34018 +    }
34019 +
34020 +    memset( gLed, 0x00, gLedCount * sizeof(LED_INFO) );
34021 +
34022 +    // initial the gLed with unique ledMask and initial state. If more than 1 ledNames share the physical led 
34023 +    // (ledMask) the first defined led's ledInitState will be used.
34024 +    pCurLed = gLed;
34025 +    for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
34026 +    {
34027 +        if( (int) p1->ledName > MAX_VIRT_LEDS )
34028 +            continue;
34029 +
34030 +        alreadyUsed = 0;
34031 +        for( p2 = cLedMapping; p2 != p1; p2++ )
34032 +        {
34033 +            if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
34034 +                (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
34035 +            {
34036 +                alreadyUsed = 1;
34037 +                break;
34038 +            }
34039 +        }
34040 +
34041 +        if( alreadyUsed == 0 )
34042 +        {
34043 +            // Initialize the board LED for the first time.
34044 +            needTimer = initLedInfo( p1, pCurLed );
34045 +            gpVirtLeds[(int) p1->ledName] = pCurLed;
34046 +            pCurLed++;
34047 +        }
34048 +        else
34049 +        {
34050 +            PLED_INFO pLed;
34051 +            for( pLed = gLed; pLed != pCurLed; pLed++ )
34052 +            {
34053 +                // Find the LED_INFO structure that has already been initialized.
34054 +                if((pLed->ledMask && pLed->ledMask == p1->ledMask) ||
34055 +                   (pLed->ledMaskFail && pLed->ledMaskFail==p1->ledMaskFail))
34056 +                {
34057 +                    // The board LED has already been initialized but possibly
34058 +                    // not completely initialized.
34059 +                    if( p1->ledMask )
34060 +                    {
34061 +                        pLed->ledMask = p1->ledMask;
34062 +                        pLed->ledActiveLow = p1->ledActiveLow;
34063 +                    }
34064 +                    if( p1->ledMaskFail )
34065 +                    {
34066 +                        pLed->ledMaskFail = p1->ledMaskFail;
34067 +                        pLed->ledActiveLowFail = p1->ledActiveLowFail;
34068 +                    }
34069 +                    gpVirtLeds[(int) p1->ledName] = pLed;
34070 +                    break;
34071 +                }
34072 +            }
34073 +        }
34074 +    }
34075 +
34076 +    if (needTimer)
34077 +        ledTimerStart();
34078 +
34079 +#if defined(DEBUG_LED)
34080 +    int i;
34081 +    for (i=0; i < gLedCount; i++)
34082 +        printk("initLed: led[%d]: mask=0x%04x, state=%d\n", i,(gLed+i)->ledMask, (gLed+i)->ledState);
34083 +#endif
34084 +
34085 +}
34086 +
34087 +// Initialize a structure that contains information about a physical board LED
34088 +// control.  The board LED may contain more than one GPIO pin to control a
34089 +// normal condition (green) or a failure condition (red).
34090 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed )
34091 +{
34092 +    int needTimer = FALSE;
34093 +    pCurLed->ledState = pCurLed->savedLedState = pCurMap->ledInitState;
34094 +    pCurLed->ledMask = pCurMap->ledMask;
34095 +    pCurLed->ledActiveLow = pCurMap->ledActiveLow;
34096 +    pCurLed->ledMaskFail = pCurMap->ledMaskFail;
34097 +    pCurLed->ledActiveLowFail = pCurMap->ledActiveLowFail;
34098 +
34099 +    switch (pCurLed->ledState)
34100 +    {
34101 +        case kLedStateOn:
34102 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
34103 +            ledOn(pCurLed);
34104 +            break;
34105 +        case kLedStateOff:
34106 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
34107 +            ledOff(pCurLed);
34108 +            break;
34109 +        case kLedStateFail:
34110 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
34111 +            ledOnFail(pCurLed);
34112 +            break;
34113 +        case kLedStateBlinkOnce:
34114 +            pCurLed->blinkCountDown = 1;
34115 +            needTimer = TRUE;
34116 +            break;
34117 +        case kLedStateSlowBlinkContinues:
34118 +            pCurLed->blinkCountDown = kSlowBlinkCount;
34119 +            needTimer = TRUE;
34120 +            break;
34121 +        case kLedStateFastBlinkContinues:
34122 +            pCurLed->blinkCountDown = kFastBlinkCount;
34123 +            needTimer = TRUE;
34124 +            break;
34125 +        default:
34126 +            printk("Invalid state = %d\n", pCurLed->ledState);
34127 +    }
34128 +
34129 +    return( needTimer );
34130 +}
34131 +
34132 +#if 0 /* BROKEN */
34133 +// Determines if there is at least one interface in bridge mode.  Bridge mode
34134 +// is determined by the cfm convention of naming bridge interfaces nas17
34135 +// through nas24.
34136 +static int isBridgedProtocol(void)
34137 +{
34138 +    extern int dev_get(const char *name);
34139 +    const int firstBridgeId = 17;
34140 +    const int lastBridgeId = 24;
34141 +    int i;
34142 +    int ret = FALSE;
34143 +    char name[16];
34144 +
34145 +    for( i = firstBridgeId; i <= lastBridgeId; i++ )
34146 +    {
34147 +        sprintf( name, "nas%d", i );
34148 +
34149 +        if( dev_get(name) )
34150 +        {
34151 +            ret = TRUE;
34152 +            break;
34153 +        }
34154 +    }
34155 +
34156 +    return(ret);
34157 +}
34158 +#endif
34159 +
34160 +// led ctrl.  Maps the ledName to the corresponding ledInfoPtr and perform the led operation
34161 +void boardLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
34162 +{
34163 +    PLED_INFO ledInfoPtr;
34164 +
34165 +    // do the mapping from virtual to physical led
34166 +    if( (int) ledName < MAX_VIRT_LEDS )
34167 +        ledInfoPtr = gpVirtLeds[(int) ledName];
34168 +    else
34169 +        ledInfoPtr = NULL;
34170 +
34171 +    if (ledInfoPtr == NULL)
34172 +        return;
34173 +
34174 +    if( ledState != kLedStateFail && gLedHwFunc[(int) ledName] )
34175 +    {
34176 +        (*gLedHwFunc[(int) ledName]) (ledName, ledState);
34177 +        ledOffFail(ledInfoPtr);
34178 +        return;
34179 +    }
34180 +    else
34181 +        if( ledState == kLedStateFail && gLedHwFailFunc[(int) ledName] )
34182 +        {
34183 +            (*gLedHwFailFunc[(int) ledName]) (ledName, ledState);
34184 +            ledOff(ledInfoPtr);
34185 +            return;
34186 +        }
34187 +
34188 +#if 0 /* BROKEN */
34189 +    // Do not blink the WAN Data LED if at least one interface is in bridge mode.
34190 +    if(gLedOffInBridgeMode == 1 && (ledName == kLedWanData || ledName == kLedPPP))
34191 +    {
34192 +        static int BridgedProtocol = -1;
34193 +
34194 +        if( BridgedProtocol == -1 )
34195 +            BridgedProtocol = isBridgedProtocol();
34196 +
34197 +        if( BridgedProtocol == TRUE )
34198 +            return;
34199 +    }
34200 +#endif
34201 +
34202 +    // If the state is kLedStateFail and there is not a failure LED defined
34203 +    // in the board parameters, change the state to kLedStateFastBlinkContinues.
34204 +    if( ledState == kLedStateFail && ledInfoPtr->ledMaskFail == 0 )
34205 +        ledState = kLedStateFastBlinkContinues;
34206 +
34207 +    switch (ledState)
34208 +    {
34209 +        case kLedStateOn:
34210 +            // First, turn off the complimentary (failure) LED GPIO.
34211 +            if( ledInfoPtr->ledMaskFail )
34212 +                ledOffFail(ledInfoPtr);
34213 +            else
34214 +                if( gLedHwFailFunc[(int) ledName] )
34215 +                    (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
34216 +
34217 +            // Next, turn on the specified LED GPIO.
34218 +            ledOn(ledInfoPtr);
34219 +            break;
34220 +
34221 +        case kLedStateOff: 
34222 +            // First, turn off the complimentary (failure) LED GPIO.
34223 +            if( ledInfoPtr->ledMaskFail )
34224 +                ledOffFail(ledInfoPtr);
34225 +            else
34226 +                if( gLedHwFailFunc[(int) ledName] )
34227 +                    (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
34228 +
34229 +            // Next, turn off the specified LED GPIO.
34230 +            ledOff(ledInfoPtr);
34231 +            break;
34232 +
34233 +        case kLedStateFail:
34234 +            // First, turn off the complimentary (normal) LED GPIO.
34235 +            if( ledInfoPtr->ledMask )
34236 +                ledOff(ledInfoPtr);
34237 +            else
34238 +                if( gLedHwFunc[(int) ledName] )
34239 +                    (*gLedHwFunc[(int) ledName]) (ledName, kLedStateOff);
34240 +
34241 +            // Next, turn on (red) the specified LED GPIO.
34242 +            ledOnFail(ledInfoPtr);
34243 +            break;
34244 +
34245 +        case kLedStateBlinkOnce:
34246 +            // skip blinkOnce if it is already in Slow/Fast blink continues state
34247 +            if (ledInfoPtr->savedLedState == kLedStateSlowBlinkContinues ||
34248 +                ledInfoPtr->savedLedState == kLedStateFastBlinkContinues)
34249 +                ;
34250 +            else
34251 +            {
34252 +                if (ledInfoPtr->blinkCountDown == 0)  // skip the call if it is 1
34253 +                {
34254 +                    ledToggle(ledInfoPtr);
34255 +                    ledInfoPtr->blinkCountDown = 1;  // it will be reset to 0 when timer expires
34256 +                    ledInfoPtr->ledState = kLedStateBlinkOnce;
34257 +                    ledTimerStart();
34258 +                }
34259 +            }
34260 +            break;
34261 +
34262 +        case kLedStateSlowBlinkContinues:
34263 +            ledInfoPtr->blinkCountDown = kSlowBlinkCount;
34264 +            ledInfoPtr->ledState = kLedStateSlowBlinkContinues;
34265 +            ledInfoPtr->savedLedState = kLedStateSlowBlinkContinues;
34266 +            ledTimerStart();
34267 +            break;
34268 +
34269 +        case kLedStateFastBlinkContinues:
34270 +            ledInfoPtr->blinkCountDown = kFastBlinkCount;
34271 +            ledInfoPtr->ledState = kLedStateFastBlinkContinues;
34272 +            ledInfoPtr->savedLedState = kLedStateFastBlinkContinues;
34273 +            ledTimerStart();
34274 +            break;
34275 +
34276 +        default:
34277 +            printk("Invalid led state\n");
34278 +    }
34279 +}
34280 +
34281 +// This function is called for an LED that is controlled by hardware.
34282 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME ledName,
34283 +    HANDLE_LED_FUNC ledHwFunc, int ledFailType )
34284 +{
34285 +    if( (int) ledName < MAX_VIRT_LEDS )
34286 +    {
34287 +        if( ledFailType == 1 )
34288 +            gLedHwFailFunc[(int) ledName] = ledHwFunc;
34289 +        else
34290 +            gLedHwFunc[(int) ledName] = ledHwFunc;
34291 +    }
34292 +}
34293 +
34294 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/board.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/board.c
34295 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/board.c    1970-01-01 01:00:00.000000000 +0100
34296 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/board.c   2006-06-26 09:07:10.000000000 +0200
34297 @@ -0,0 +1,1570 @@
34298 +/*
34299 +<:copyright-gpl 
34300 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
34301
34302 + This program is free software; you can distribute it and/or modify it 
34303 + under the terms of the GNU General Public License (Version 2) as 
34304 + published by the Free Software Foundation. 
34305
34306 + This program is distributed in the hope it will be useful, but WITHOUT 
34307 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
34308 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
34309 + for more details. 
34310
34311 + You should have received a copy of the GNU General Public License along 
34312 + with this program; if not, write to the Free Software Foundation, Inc., 
34313 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
34314 +:>
34315 +*/
34316 +/***************************************************************************
34317 + * File Name  : board.c
34318 + *
34319 + * Description: This file contains Linux character device driver entry 
34320 + *              for the board related ioctl calls: flash, get free kernel
34321 + *              page and dump kernel memory, etc.
34322 + *
34323 + * Created on :  2/20/2002  seanl:  use cfiflash.c, cfliflash.h (AMD specific)
34324 + *
34325 + ***************************************************************************/
34326 +
34327 +
34328 +/* Includes. */
34329 +#include <linux/version.h>
34330 +#include <linux/init.h>
34331 +#include <linux/fs.h>
34332 +#include <linux/interrupt.h>
34333 +#include <linux/capability.h>
34334 +#include <linux/slab.h>
34335 +#include <linux/errno.h>
34336 +#include <linux/module.h>
34337 +#include <linux/pagemap.h>
34338 +#include <asm/uaccess.h>
34339 +#include <linux/wait.h>
34340 +#include <linux/poll.h>
34341 +#include <linux/sched.h>
34342 +#include <linux/list.h>
34343 +#include <linux/if.h>
34344 +
34345 +#include <bcm_map_part.h>
34346 +#include <board.h>
34347 +#include <bcmTag.h>
34348 +#include "boardparms.h"
34349 +#include "cfiflash.h"
34350 +#include "bcm_intr.h"
34351 +#include "board.h"
34352 +#include "bcm_map_part.h"
34353 +
34354 +/* Typedefs. */
34355 +#if defined (NON_CONSECUTIVE_MAC)
34356 +// used to be the last octet. Now changed to the first 5 bits of the the forth octet
34357 +// to reduced the duplicated MAC addresses.
34358 +#define CHANGED_OCTET   3
34359 +#define SHIFT_BITS      3
34360 +#else
34361 +#define CHANGED_OCTET   1
34362 +#define SHIFT_BITS      0
34363 +#endif
34364 +
34365 +#if defined (WIRELESS)
34366 +#define SES_BTN_PRESSED 0x00000001
34367 +#define SES_EVENTS      SES_BTN_PRESSED /*OR all values if any*/
34368 +#define SES_LED_OFF     0
34369 +#define SES_LED_ON      1
34370 +#define SES_LED_BLINK   2
34371 +#endif
34372 +
34373 +typedef struct
34374 +{
34375 +    unsigned long ulId;
34376 +    char chInUse;
34377 +    char chReserved[3];
34378 +} MAC_ADDR_INFO, *PMAC_ADDR_INFO;
34379 +
34380 +typedef struct
34381 +{
34382 +    unsigned long ulSdramSize;
34383 +    unsigned long ulPsiSize;
34384 +    unsigned long ulNumMacAddrs;
34385 +    unsigned long ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
34386 +    MAC_ADDR_INFO MacAddrs[1];
34387 +} NVRAM_INFO, *PNVRAM_INFO;
34388 +
34389 +typedef struct
34390 +{
34391 +    unsigned long eventmask;    
34392 +} BOARD_IOC, *PBOARD_IOC;
34393 +
34394 +
34395 +/*Dyinggasp callback*/
34396 +typedef void (*cb_dgasp_t)(void *arg);
34397 +typedef struct _CB_DGASP__LIST
34398 +{
34399 +    struct list_head list;
34400 +    char name[IFNAMSIZ];
34401 +    cb_dgasp_t cb_dgasp_fn;
34402 +    void *context;
34403 +}CB_DGASP_LIST , *PCB_DGASP_LIST;
34404 +
34405 +
34406 +static LED_MAP_PAIR LedMapping[] =
34407 +{   // led name     Initial state       physical pin (ledMask)
34408 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
34409 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
34410 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
34411 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
34412 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
34413 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0}, 
34414 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0}, 
34415 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},     
34416 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0} // NOTE: kLedEnd has to be at the end.
34417 +};
34418 +
34419 +/* Externs. */
34420 +extern struct file fastcall *fget_light(unsigned int fd, int *fput_needed);
34421 +extern unsigned int nr_free_pages (void);
34422 +extern const char *get_system_type(void);
34423 +extern void kerSysFlashInit(void);
34424 +extern unsigned long get_nvram_start_addr(void);
34425 +extern unsigned long get_scratch_pad_start_addr(void);
34426 +extern unsigned long getMemorySize(void);
34427 +extern void __init boardLedInit(PLED_MAP_PAIR);
34428 +extern void boardLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
34429 +extern void kerSysLedRegisterHandler( BOARD_LED_NAME ledName,
34430 +    HANDLE_LED_FUNC ledHwFunc, int ledFailType );
34431 +
34432 +/* Prototypes. */
34433 +void __init InitNvramInfo( void );
34434 +static int board_open( struct inode *inode, struct file *filp );
34435 +static int board_ioctl( struct inode *inode, struct file *flip, unsigned int command, unsigned long arg );
34436 +static ssize_t board_read(struct file *filp,  char __user *buffer, size_t count, loff_t *ppos); 
34437 +static unsigned int board_poll(struct file *filp, struct poll_table_struct *wait);
34438 +static int board_release(struct inode *inode, struct file *filp);                        
34439 +
34440 +static BOARD_IOC* borad_ioc_alloc(void);
34441 +static void borad_ioc_free(BOARD_IOC* board_ioc);
34442 +
34443 +/* DyingGasp function prototype */
34444 +static void __init kerSysDyingGaspMapIntr(void);
34445 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
34446 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs);
34447 +#else
34448 +static unsigned int kerSysDyingGaspIsr(void);
34449 +#endif
34450 +static void __init kerSysInitDyingGaspHandler( void );
34451 +static void __exit kerSysDeinitDyingGaspHandler( void );
34452 +/* -DyingGasp function prototype - */
34453 +
34454 +
34455 +#if defined (WIRELESS)
34456 +static irqreturn_t sesBtn_isr(int irq, void *dev_id, struct pt_regs *ptregs);
34457 +static void __init sesBtn_mapGpio(void);
34458 +static void __init sesBtn_mapIntr(int context);
34459 +static unsigned int sesBtn_poll(struct file *file, struct poll_table_struct *wait);
34460 +static ssize_t sesBtn_read(struct file *file,  char __user *buffer, size_t count, loff_t *ppos);
34461 +static void __init sesLed_mapGpio(void);
34462 +static void sesLed_ctrl(int action);
34463 +static void __init ses_board_init(void);
34464 +static void __exit ses_board_deinit(void);
34465 +#endif
34466 +
34467 +static PNVRAM_INFO g_pNvramInfo = NULL;
34468 +static int g_ledInitialized = 0;
34469 +static wait_queue_head_t g_board_wait_queue;
34470 +static CB_DGASP_LIST *g_cb_dgasp_list_head = NULL;
34471 +
34472 +static int g_wakeup_monitor = 0;
34473 +static struct file *g_monitor_file = NULL;
34474 +static struct task_struct *g_monitor_task = NULL;
34475 +static unsigned int (*g_orig_fop_poll)
34476 +    (struct file *, struct poll_table_struct *) = NULL;
34477 +
34478 +static struct file_operations board_fops =
34479 +{
34480 +  open:       board_open,
34481 +  ioctl:      board_ioctl,
34482 +  poll:       board_poll,
34483 +  read:       board_read,
34484 +  release:    board_release,
34485 +};
34486 +
34487 +uint32 board_major = 0;
34488 +
34489 +#if defined (WIRELESS)
34490 +static unsigned short sesBtn_irq = BP_NOT_DEFINED;
34491 +static unsigned short sesBtn_gpio = BP_NOT_DEFINED;
34492 +static unsigned short sesLed_gpio = BP_NOT_DEFINED;
34493 +#endif
34494 +
34495 +#if defined(MODULE)
34496 +int init_module(void)
34497 +{
34498 +    return( brcm_board_init() );              
34499 +}
34500 +
34501 +void cleanup_module(void)
34502 +{
34503 +    if (MOD_IN_USE)
34504 +        printk("brcm flash: cleanup_module failed because module is in use\n");
34505 +    else
34506 +        brcm_board_cleanup();
34507 +}
34508 +#endif //MODULE 
34509 +
34510 +
34511 +
34512 +static int __init brcm_board_init( void )
34513 +{
34514 +    typedef int (*BP_LED_FUNC) (unsigned short *);
34515 +    static struct BpLedInformation
34516 +    {
34517 +        BOARD_LED_NAME ledName;
34518 +        BP_LED_FUNC bpFunc;
34519 +        BP_LED_FUNC bpFuncFail;
34520 +    } bpLedInfo[] =
34521 +    {{kLedAdsl, BpGetAdslLedGpio, BpGetAdslFailLedGpio},
34522 +     {kLedWireless, BpGetWirelessLedGpio, NULL},
34523 +     {kLedUsb, BpGetUsbLedGpio, NULL},
34524 +     {kLedHpna, BpGetHpnaLedGpio, NULL},
34525 +     {kLedWanData, BpGetWanDataLedGpio, NULL},
34526 +     {kLedPPP, BpGetPppLedGpio, BpGetPppFailLedGpio},
34527 +     {kLedVoip, BpGetVoipLedGpio, NULL},
34528 +     {kLedSes, BpGetWirelessSesLedGpio, NULL},     
34529 +     {kLedEnd, NULL, NULL}
34530 +    };
34531 +
34532 +    int ret;
34533 +        
34534 +    ret = register_chrdev(BOARD_DRV_MAJOR, "bcrmboard", &board_fops );
34535 +    if (ret < 0)
34536 +        printk( "brcm_board_init(major %d): fail to register device.\n",BOARD_DRV_MAJOR);
34537 +    else 
34538 +    {
34539 +        PLED_MAP_PAIR pLedMap = LedMapping;
34540 +        unsigned short gpio;
34541 +        struct BpLedInformation *pInfo;
34542 +
34543 +        printk("brcmboard: brcm_board_init entry\n");
34544 +        board_major = BOARD_DRV_MAJOR;
34545 +        InitNvramInfo();
34546 +
34547 +        for( pInfo = bpLedInfo; pInfo->ledName != kLedEnd; pInfo++ )
34548 +        {
34549 +            if( pInfo->bpFunc && (*pInfo->bpFunc) (&gpio) == BP_SUCCESS )
34550 +            {
34551 +                pLedMap->ledName = pInfo->ledName;
34552 +                pLedMap->ledMask = GPIO_NUM_TO_MASK(gpio);
34553 +                pLedMap->ledActiveLow = (gpio & BP_ACTIVE_LOW) ? 1 : 0;
34554 +            }
34555 +            if( pInfo->bpFuncFail && (*pInfo->bpFuncFail) (&gpio) == BP_SUCCESS )
34556 +            {
34557 +                pLedMap->ledName = pInfo->ledName;
34558 +                pLedMap->ledMaskFail = GPIO_NUM_TO_MASK(gpio);
34559 +                pLedMap->ledActiveLowFail = (gpio & BP_ACTIVE_LOW) ? 1 : 0;
34560 +            }
34561 +            if( pLedMap->ledName != kLedEnd )
34562 +                pLedMap++;
34563 +        }
34564 +        
34565 +        init_waitqueue_head(&g_board_wait_queue);
34566 +#if defined (WIRELESS)
34567 +        ses_board_init();
34568 +#endif        
34569 +        kerSysInitDyingGaspHandler();
34570 +        kerSysDyingGaspMapIntr();
34571 +
34572 +        boardLedInit(LedMapping);
34573 +        g_ledInitialized = 1;
34574 +    }
34575 +
34576 +    return ret;
34577 +} 
34578 +
34579 +void __init InitNvramInfo( void )
34580 +{
34581 +    PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
34582 +    unsigned long ulNumMacAddrs = pNvramData->ulNumMacAddrs;
34583 +
34584 +    if( ulNumMacAddrs > 0 && ulNumMacAddrs <= NVRAM_MAC_COUNT_MAX )
34585 +    {
34586 +        unsigned long ulNvramInfoSize =
34587 +            sizeof(NVRAM_INFO) + ((sizeof(MAC_ADDR_INFO) - 1) * ulNumMacAddrs);
34588 +
34589 +        g_pNvramInfo = (PNVRAM_INFO) kmalloc( ulNvramInfoSize, GFP_KERNEL );
34590 +
34591 +        if( g_pNvramInfo )
34592 +        {
34593 +            unsigned long ulPsiSize;
34594 +            if( BpGetPsiSize( &ulPsiSize ) != BP_SUCCESS )
34595 +                ulPsiSize = NVRAM_PSI_DEFAULT;
34596 +            memset( g_pNvramInfo, 0x00, ulNvramInfoSize );
34597 +            g_pNvramInfo->ulPsiSize = ulPsiSize * 1024;
34598 +            g_pNvramInfo->ulNumMacAddrs = pNvramData->ulNumMacAddrs;
34599 +            memcpy( g_pNvramInfo->ucaBaseMacAddr, pNvramData->ucaBaseMacAddr,
34600 +                NVRAM_MAC_ADDRESS_LEN );
34601 +            g_pNvramInfo->ulSdramSize = getMemorySize();
34602 +        }
34603 +        else
34604 +            printk("ERROR - Could not allocate memory for NVRAM data\n");
34605 +    }
34606 +    else
34607 +        printk("ERROR - Invalid number of MAC addresses (%ld) is configured.\n",
34608 +            ulNumMacAddrs);
34609 +}
34610 +
34611 +void __exit brcm_board_cleanup( void )
34612 +{
34613 +    printk("brcm_board_cleanup()\n");
34614 +       
34615 +    if (board_major != -1) 
34616 +    {
34617 +#if defined (WIRELESS)         
34618 +       ses_board_deinit();
34619 +#endif         
34620 +        kerSysDeinitDyingGaspHandler();
34621 +        unregister_chrdev(board_major, "board_ioctl");
34622 +    }
34623 +} 
34624 +
34625 +static BOARD_IOC* borad_ioc_alloc(void)
34626 +{
34627 +    BOARD_IOC *board_ioc =NULL;
34628 +    board_ioc = (BOARD_IOC*) kmalloc( sizeof(BOARD_IOC) , GFP_KERNEL );
34629 +    if(board_ioc)
34630 +    {
34631 +        memset(board_ioc, 0, sizeof(BOARD_IOC));
34632 +    }
34633 +    return board_ioc;
34634 +}
34635 +
34636 +static void borad_ioc_free(BOARD_IOC* board_ioc)
34637 +{
34638 +    if(board_ioc)
34639 +    {
34640 +        kfree(board_ioc);
34641 +    }  
34642 +}
34643 +
34644 +
34645 +static int board_open( struct inode *inode, struct file *filp )
34646 +{
34647 +    filp->private_data = borad_ioc_alloc();
34648 +
34649 +    if (filp->private_data == NULL)
34650 +        return -ENOMEM;
34651 +            
34652 +    return( 0 );
34653 +} 
34654 +
34655 +static int board_release(struct inode *inode, struct file *filp)
34656 +{
34657 +    BOARD_IOC *board_ioc = filp->private_data;
34658 +    
34659 +    wait_event_interruptible(g_board_wait_queue, 1);    
34660 +    borad_ioc_free(board_ioc);
34661 +
34662 +    return( 0 );
34663 +} 
34664 +
34665 +
34666 +static unsigned int board_poll(struct file *filp, struct poll_table_struct *wait)
34667 +{
34668 +    unsigned int mask = 0;
34669 +#if defined (WIRELESS)         
34670 +    BOARD_IOC *board_ioc = filp->private_data;         
34671 +#endif
34672 +       
34673 +    poll_wait(filp, &g_board_wait_queue, wait);
34674 +#if defined (WIRELESS)         
34675 +    if(board_ioc->eventmask & SES_EVENTS){
34676 +        mask |= sesBtn_poll(filp, wait);
34677 +    }                  
34678 +#endif    
34679 +
34680 +    return mask;
34681 +}
34682 +
34683 +
34684 +static ssize_t board_read(struct file *filp,  char __user *buffer, size_t count, loff_t *ppos)
34685 +{
34686 +#if defined (WIRELESS)    
34687 +    BOARD_IOC *board_ioc = filp->private_data;
34688 +    if(board_ioc->eventmask & SES_EVENTS){
34689 +       return sesBtn_read(filp, buffer, count, ppos);
34690 +    }
34691 +#endif    
34692 +    return 0;
34693 +}
34694 +
34695 +//**************************************************************************************
34696 +// Utitlities for dump memory, free kernel pages, mips soft reset, etc.
34697 +//**************************************************************************************
34698 +
34699 +/***********************************************************************
34700 + * Function Name: dumpaddr
34701 + * Description  : Display a hex dump of the specified address.
34702 + ***********************************************************************/
34703 +void dumpaddr( unsigned char *pAddr, int nLen )
34704 +{
34705 +    static char szHexChars[] = "0123456789abcdef";
34706 +    char szLine[80];
34707 +    char *p = szLine;
34708 +    unsigned char ch, *q;
34709 +    int i, j;
34710 +    unsigned long ul;
34711 +
34712 +    while( nLen > 0 )
34713 +    {
34714 +        sprintf( szLine, "%8.8lx: ", (unsigned long) pAddr );
34715 +        p = szLine + strlen(szLine);
34716 +
34717 +        for(i = 0; i < 16 && nLen > 0; i += sizeof(long), nLen -= sizeof(long))
34718 +        {
34719 +            ul = *(unsigned long *) &pAddr[i];
34720 +            q = (unsigned char *) &ul;
34721 +            for( j = 0; j < sizeof(long); j++ )
34722 +            {
34723 +                *p++ = szHexChars[q[j] >> 4];
34724 +                *p++ = szHexChars[q[j] & 0x0f];
34725 +                *p++ = ' ';
34726 +            }
34727 +        }
34728 +
34729 +        for( j = 0; j < 16 - i; j++ )
34730 +            *p++ = ' ', *p++ = ' ', *p++ = ' ';
34731 +
34732 +        *p++ = ' ', *p++ = ' ', *p++ = ' ';
34733 +
34734 +        for( j = 0; j < i; j++ )
34735 +        {
34736 +            ch = pAddr[j];
34737 +            *p++ = (ch > ' ' && ch < '~') ? ch : '.';
34738 +        }
34739 +
34740 +        *p++ = '\0';
34741 +        printk( "%s\r\n", szLine );
34742 +
34743 +        pAddr += i;
34744 +    }
34745 +    printk( "\r\n" );
34746 +} /* dumpaddr */
34747 +
34748 +
34749 +void kerSysMipsSoftReset(void)
34750 +{
34751 +#if defined(CONFIG_BCM96348)
34752 +    if (PERF->RevID == 0x634800A1) {
34753 +        typedef void (*FNPTR) (void);
34754 +        FNPTR bootaddr = (FNPTR) FLASH_BASE;
34755 +        int i;
34756 +
34757 +        /* Disable interrupts. */
34758 +        cli();
34759 +
34760 +        /* Reset all blocks. */
34761 +        PERF->BlockSoftReset &= ~BSR_ALL_BLOCKS;
34762 +        for( i = 0; i < 1000000; i++ )
34763 +            ;
34764 +        PERF->BlockSoftReset |= BSR_ALL_BLOCKS;
34765 +        /* Jump to the power on address. */
34766 +        (*bootaddr) ();
34767 +    }
34768 +    else
34769 +        PERF->pll_control |= SOFT_RESET;    // soft reset mips
34770 +#else
34771 +    PERF->pll_control |= SOFT_RESET;    // soft reset mips
34772 +#endif
34773 +}
34774 +
34775 +
34776 +int kerSysGetMacAddress( unsigned char *pucaMacAddr, unsigned long ulId )
34777 +{
34778 +    int nRet = 0;
34779 +    PMAC_ADDR_INFO pMai = NULL;
34780 +    PMAC_ADDR_INFO pMaiFreeNoId = NULL;
34781 +    PMAC_ADDR_INFO pMaiFreeId = NULL;
34782 +    unsigned long i = 0, ulIdxNoId = 0, ulIdxId = 0, shiftedIdx = 0;
34783 +
34784 +    for( i = 0, pMai = g_pNvramInfo->MacAddrs; i < g_pNvramInfo->ulNumMacAddrs;
34785 +        i++, pMai++ )
34786 +    {
34787 +        if( ulId == pMai->ulId || ulId == MAC_ADDRESS_ANY )
34788 +        {
34789 +            /* This MAC address has been used by the caller in the past. */
34790 +            memcpy( pucaMacAddr, g_pNvramInfo->ucaBaseMacAddr,
34791 +                NVRAM_MAC_ADDRESS_LEN );
34792 +            shiftedIdx = i;
34793 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
34794 +            pMai->chInUse = 1;
34795 +            pMaiFreeNoId = pMaiFreeId = NULL;
34796 +            break;
34797 +        }
34798 +        else
34799 +            if( pMai->chInUse == 0 )
34800 +            {
34801 +                if( pMai->ulId == 0 && pMaiFreeNoId == NULL )
34802 +                {
34803 +                    /* This is an available MAC address that has never been
34804 +                     * used.
34805 +                     */
34806 +                    pMaiFreeNoId = pMai;
34807 +                    ulIdxNoId = i;
34808 +                }
34809 +                else
34810 +                    if( pMai->ulId != 0 && pMaiFreeId == NULL )
34811 +                    {
34812 +                        /* This is an available MAC address that has been used
34813 +                         * before.  Use addresses that have never been used
34814 +                         * first, before using this one.
34815 +                         */
34816 +                        pMaiFreeId = pMai;
34817 +                        ulIdxId = i;
34818 +                    }
34819 +            }
34820 +    }
34821 +
34822 +    if( pMaiFreeNoId || pMaiFreeId )
34823 +    {
34824 +        /* An available MAC address was found. */
34825 +        memcpy(pucaMacAddr, g_pNvramInfo->ucaBaseMacAddr,NVRAM_MAC_ADDRESS_LEN);
34826 +        if( pMaiFreeNoId )
34827 +        {
34828 +            shiftedIdx = ulIdxNoId;
34829 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
34830 +            pMaiFreeNoId->ulId = ulId;
34831 +            pMaiFreeNoId->chInUse = 1;
34832 +        }
34833 +        else
34834 +        {
34835 +            shiftedIdx = ulIdxId;
34836 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
34837 +            pMaiFreeId->ulId = ulId;
34838 +            pMaiFreeId->chInUse = 1;
34839 +        }
34840 +    }
34841 +    else
34842 +        if( i == g_pNvramInfo->ulNumMacAddrs )
34843 +            nRet = -EADDRNOTAVAIL;
34844 +
34845 +    return( nRet );
34846 +} /* kerSysGetMacAddr */
34847 +
34848 +int kerSysReleaseMacAddress( unsigned char *pucaMacAddr )
34849 +{
34850 +    int nRet = -EINVAL;
34851 +    unsigned long ulIdx = 0;
34852 +    int idx = (pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] -
34853 +        g_pNvramInfo->ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET]);
34854 +
34855 +    // if overflow 255 (negitive), add 256 to have the correct index
34856 +    if (idx < 0)
34857 +        idx += 256;
34858 +    ulIdx = (unsigned long) (idx >> SHIFT_BITS);
34859 +
34860 +    if( ulIdx < g_pNvramInfo->ulNumMacAddrs )
34861 +    {
34862 +        PMAC_ADDR_INFO pMai = &g_pNvramInfo->MacAddrs[ulIdx];
34863 +        if( pMai->chInUse == 1 )
34864 +        {
34865 +            pMai->chInUse = 0;
34866 +            nRet = 0;
34867 +        }
34868 +    }
34869 +
34870 +    return( nRet );
34871 +} /* kerSysReleaseMacAddr */
34872 +
34873 +int kerSysGetSdramSize( void )
34874 +{
34875 +    return( (int) g_pNvramInfo->ulSdramSize );
34876 +} /* kerSysGetSdramSize */
34877 +
34878 +
34879 +void kerSysLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
34880 +{
34881 +    if (g_ledInitialized)
34882 +      boardLedCtrl(ledName, ledState);
34883 +}
34884 +
34885 +unsigned int kerSysMonitorPollHook( struct file *f, struct poll_table_struct *t)
34886 +{
34887 +    int mask = (*g_orig_fop_poll) (f, t);
34888 +
34889 +    if( g_wakeup_monitor == 1 && g_monitor_file == f )
34890 +    {
34891 +        /* If g_wakeup_monitor is non-0, the user mode application needs to
34892 +         * return from a blocking select function.  Return POLLPRI which will
34893 +         * cause the select to return with the exception descriptor set.
34894 +         */
34895 +        mask |= POLLPRI;
34896 +        g_wakeup_monitor = 0;
34897 +    }
34898 +
34899 +    return( mask );
34900 +}
34901 +
34902 +/* Put the user mode application that monitors link state on a run queue. */
34903 +void kerSysWakeupMonitorTask( void )
34904 +{
34905 +    g_wakeup_monitor = 1;
34906 +    if( g_monitor_task )
34907 +        wake_up_process( g_monitor_task );
34908 +}
34909 +
34910 +//********************************************************************************************
34911 +// misc. ioctl calls come to here. (flash, led, reset, kernel memory access, etc.)
34912 +//********************************************************************************************
34913 +static int board_ioctl( struct inode *inode, struct file *flip,
34914 +                        unsigned int command, unsigned long arg )
34915 +{
34916 +    int ret = 0;
34917 +    BOARD_IOCTL_PARMS ctrlParms;
34918 +    unsigned char ucaMacAddr[NVRAM_MAC_ADDRESS_LEN];
34919 +    int allowedSize;
34920 +
34921 +    switch (command) 
34922 +    {
34923 +        case BOARD_IOCTL_FLASH_INIT:
34924 +            // not used for now.  kerSysBcmImageInit();
34925 +            break;
34926 +
34927 +
34928 +        case BOARD_IOCTL_FLASH_WRITE:
34929 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0)
34930 +            {
34931 +                NVRAM_DATA SaveNvramData;
34932 +                PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
34933 +
34934 +                switch (ctrlParms.action)
34935 +                {
34936 +                    case SCRATCH_PAD:
34937 +                        ret = kerSysScratchPadSet(ctrlParms.string, ctrlParms.buf, ctrlParms.offset);
34938 +                        break;
34939 +
34940 +                    case PERSISTENT:
34941 +                        ret = kerSysPersistentSet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
34942 +                        break;
34943 +                
34944 +                    case NVRAM:
34945 +                        ret = kerSysNvRamSet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
34946 +                        break;
34947 +
34948 +                    case BCM_IMAGE_CFE:
34949 +                        if( ctrlParms.strLen <= 0 || ctrlParms.strLen > FLASH45_LENGTH_BOOT_ROM )
34950 +                        {
34951 +                            printk("Illegal CFE size [%d]. Size allowed: [%d]\n",
34952 +                                ctrlParms.strLen, FLASH45_LENGTH_BOOT_ROM);
34953 +                            ret = -1;
34954 +                            break;
34955 +                        }
34956 +
34957 +                        // save NVRAM data into a local structure
34958 +                        memcpy( &SaveNvramData, pNvramData, sizeof(NVRAM_DATA) );
34959 +
34960 +                        // set memory type field
34961 +                        BpGetSdramSize( (unsigned long *) &ctrlParms.string[SDRAM_TYPE_ADDRESS_OFFSET] );
34962 +
34963 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
34964 +
34965 +                        // if nvram is not valid, restore the current nvram settings
34966 +                        if( BpSetBoardId( pNvramData->szBoardId ) != BP_SUCCESS &&
34967 +                            *(unsigned long *) pNvramData == NVRAM_DATA_ID )
34968 +                        {
34969 +                            kerSysNvRamSet((char *) &SaveNvramData, sizeof(SaveNvramData), 0);
34970 +                        }
34971 +                        break;
34972 +                        
34973 +                    case BCM_IMAGE_FS:
34974 +                        allowedSize = (int) flash_get_total_size() - \
34975 +                            FLASH_RESERVED_AT_END - TAG_LEN - FLASH45_LENGTH_BOOT_ROM;
34976 +                        if( ctrlParms.strLen <= 0 || ctrlParms.strLen > allowedSize)
34977 +                        {
34978 +                            printk("Illegal root file system size [%d]. Size allowed: [%d]\n",
34979 +                                ctrlParms.strLen,  allowedSize);
34980 +                            ret = -1;
34981 +                            break;
34982 +                        }
34983 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
34984 +                        kerSysMipsSoftReset();
34985 +                        break;
34986 +
34987 +                    case BCM_IMAGE_KERNEL:  // not used for now.
34988 +                        break;
34989 +                    case BCM_IMAGE_WHOLE:
34990 +                        if(ctrlParms.strLen <= 0)
34991 +                        {
34992 +                            printk("Illegal flash image size [%d].\n", ctrlParms.strLen);
34993 +                            ret = -1;
34994 +                            break;
34995 +                        }
34996 +
34997 +                        // save NVRAM data into a local structure
34998 +                        memcpy( &SaveNvramData, pNvramData, sizeof(NVRAM_DATA) );
34999 +
35000 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
35001 +
35002 +                        // if nvram is not valid, restore the current nvram settings
35003 +                        if( BpSetBoardId( pNvramData->szBoardId ) != BP_SUCCESS &&
35004 +                            *(unsigned long *) pNvramData == NVRAM_DATA_ID )
35005 +                        {
35006 +                            kerSysNvRamSet((char *) &SaveNvramData, sizeof(SaveNvramData), 0);
35007 +                        }
35008 +
35009 +                        kerSysMipsSoftReset();
35010 +                        break;
35011 +
35012 +                    default:
35013 +                        ret = -EINVAL;
35014 +                        printk("flash_ioctl_command: invalid command %d\n", ctrlParms.action);
35015 +                        break;
35016 +                }
35017 +                ctrlParms.result = ret;
35018 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35019 +            }
35020 +            else
35021 +                ret = -EFAULT;
35022 +            break;
35023 +
35024 +        case BOARD_IOCTL_FLASH_READ:
35025 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35026 +            {
35027 +                switch (ctrlParms.action)
35028 +                {
35029 +                    case SCRATCH_PAD:
35030 +                        ret = kerSysScratchPadGet(ctrlParms.string, ctrlParms.buf, ctrlParms.offset);
35031 +                        break;
35032 +
35033 +                    case PERSISTENT:
35034 +                        ret = kerSysPersistentGet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
35035 +                        break;
35036 +
35037 +                    case NVRAM:
35038 +                        ret = kerSysNvRamGet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
35039 +                        break;
35040 +
35041 +                    case FLASH_SIZE:
35042 +                        ret = kerSysFlashSizeGet();
35043 +                        break;
35044 +
35045 +                    default:
35046 +                        ret = -EINVAL;
35047 +                        printk("Not supported.  invalid command %d\n", ctrlParms.action);
35048 +                        break;
35049 +                }
35050 +                ctrlParms.result = ret;
35051 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35052 +            }
35053 +            else
35054 +                ret = -EFAULT;
35055 +            break;
35056 +
35057 +        case BOARD_IOCTL_GET_NR_PAGES:
35058 +            ctrlParms.result = nr_free_pages() + get_page_cache_size();
35059 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35060 +            ret = 0;
35061 +            break;
35062 +
35063 +        case BOARD_IOCTL_DUMP_ADDR:
35064 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35065 +            {
35066 +                dumpaddr( (unsigned char *) ctrlParms.string, ctrlParms.strLen );
35067 +                ctrlParms.result = 0;
35068 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35069 +                ret = 0;
35070 +            }
35071 +            else
35072 +                ret = -EFAULT;
35073 +            break;
35074 +
35075 +        case BOARD_IOCTL_SET_MEMORY:
35076 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35077 +            {
35078 +                unsigned long  *pul = (unsigned long *)  ctrlParms.string;
35079 +                unsigned short *pus = (unsigned short *) ctrlParms.string;
35080 +                unsigned char  *puc = (unsigned char *)  ctrlParms.string;
35081 +                switch( ctrlParms.strLen )
35082 +                {
35083 +                    case 4:
35084 +                        *pul = (unsigned long) ctrlParms.offset;
35085 +                        break;
35086 +                    case 2:
35087 +                        *pus = (unsigned short) ctrlParms.offset;
35088 +                        break;
35089 +                    case 1:
35090 +                        *puc = (unsigned char) ctrlParms.offset;
35091 +                        break;
35092 +                }
35093 +                dumpaddr( (unsigned char *) ctrlParms.string, sizeof(long) );
35094 +                ctrlParms.result = 0;
35095 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35096 +                ret = 0;
35097 +            }
35098 +            else
35099 +                ret = -EFAULT;
35100 +            break;
35101 +      
35102 +        case BOARD_IOCTL_MIPS_SOFT_RESET:
35103 +            kerSysMipsSoftReset();
35104 +            break;
35105 +
35106 +        case BOARD_IOCTL_LED_CTRL:
35107 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35108 +            {
35109 +                   kerSysLedCtrl((BOARD_LED_NAME)ctrlParms.strLen, (BOARD_LED_STATE)ctrlParms.offset);
35110 +                   ret = 0;
35111 +               }
35112 +            break;
35113 +
35114 +        case BOARD_IOCTL_GET_ID:
35115 +            if (copy_from_user((void*)&ctrlParms, (void*)arg,
35116 +                sizeof(ctrlParms)) == 0) 
35117 +            {
35118 +                if( ctrlParms.string )
35119 +                {
35120 +                    char *p = (char *) get_system_type();
35121 +                    if( strlen(p) + 1 < ctrlParms.strLen )
35122 +                        ctrlParms.strLen = strlen(p) + 1;
35123 +                    __copy_to_user(ctrlParms.string, p, ctrlParms.strLen);
35124 +                }
35125 +
35126 +                ctrlParms.result = 0;
35127 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
35128 +                    sizeof(BOARD_IOCTL_PARMS));
35129 +            }
35130 +            break;
35131 +
35132 +        case BOARD_IOCTL_GET_MAC_ADDRESS:
35133 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35134 +            {
35135 +                ctrlParms.result = kerSysGetMacAddress( ucaMacAddr,
35136 +                    ctrlParms.offset );
35137 +
35138 +                if( ctrlParms.result == 0 )
35139 +                {
35140 +                    __copy_to_user(ctrlParms.string, ucaMacAddr,
35141 +                        sizeof(ucaMacAddr));
35142 +                }
35143 +
35144 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
35145 +                    sizeof(BOARD_IOCTL_PARMS));
35146 +                ret = 0;
35147 +            }
35148 +            else
35149 +                ret = -EFAULT;
35150 +            break;
35151 +
35152 +        case BOARD_IOCTL_RELEASE_MAC_ADDRESS:
35153 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35154 +            {
35155 +                if (copy_from_user((void*)ucaMacAddr, (void*)ctrlParms.string, \
35156 +                     NVRAM_MAC_ADDRESS_LEN) == 0) 
35157 +                {
35158 +                    ctrlParms.result = kerSysReleaseMacAddress( ucaMacAddr );
35159 +                }
35160 +                else
35161 +                {
35162 +                    ctrlParms.result = -EACCES;
35163 +                }
35164 +
35165 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
35166 +                    sizeof(BOARD_IOCTL_PARMS));
35167 +                ret = 0;
35168 +            }
35169 +            else
35170 +                ret = -EFAULT;
35171 +            break;
35172 +
35173 +        case BOARD_IOCTL_GET_PSI_SIZE:
35174 +            ctrlParms.result = (int) g_pNvramInfo->ulPsiSize;
35175 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35176 +            ret = 0;
35177 +            break;
35178 +
35179 +        case BOARD_IOCTL_GET_SDRAM_SIZE:
35180 +            ctrlParms.result = (int) g_pNvramInfo->ulSdramSize;
35181 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35182 +            ret = 0;
35183 +            break;
35184 +
35185 +        case BOARD_IOCTL_GET_BASE_MAC_ADDRESS:
35186 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
35187 +            {
35188 +                __copy_to_user(ctrlParms.string, g_pNvramInfo->ucaBaseMacAddr, NVRAM_MAC_ADDRESS_LEN);
35189 +                ctrlParms.result = 0;
35190 +
35191 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
35192 +                    sizeof(BOARD_IOCTL_PARMS));
35193 +                ret = 0;
35194 +            }
35195 +            else
35196 +                ret = -EFAULT;
35197 +            break;
35198 +
35199 +        case BOARD_IOCTL_GET_CHIP_ID:
35200 +            ctrlParms.result = (int) (PERF->RevID & 0xFFFF0000) >> 16;
35201 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35202 +            ret = 0;
35203 +            break;
35204 +
35205 +        case BOARD_IOCTL_GET_NUM_ENET: {
35206 +            ETHERNET_MAC_INFO EnetInfos[BP_MAX_ENET_MACS];
35207 +            int i, numeth = 0;
35208 +            if (BpGetEthernetMacInfo(EnetInfos, BP_MAX_ENET_MACS) == BP_SUCCESS) {
35209 +            for( i = 0; i < BP_MAX_ENET_MACS; i++) {
35210 +                if (EnetInfos[i].ucPhyType != BP_ENET_NO_PHY) {
35211 +                numeth++;
35212 +                }
35213 +            }
35214 +            ctrlParms.result = numeth;
35215 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,         sizeof(BOARD_IOCTL_PARMS));   
35216 +            ret = 0;
35217 +            }
35218 +               else {
35219 +                   ret = -EFAULT;
35220 +               }
35221 +               break;
35222 +            }
35223 +
35224 +        case BOARD_IOCTL_GET_CFE_VER:
35225 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35226 +                char *vertag =  (char *)(FLASH_BASE + CFE_VERSION_OFFSET);
35227 +                if (ctrlParms.strLen < CFE_VERSION_SIZE) {
35228 +                    ctrlParms.result = 0;
35229 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35230 +                    ret = -EFAULT;
35231 +                }
35232 +                else if (strncmp(vertag, "cfe-v", 5)) { // no tag info in flash
35233 +                    ctrlParms.result = 0;
35234 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35235 +                    ret = 0;
35236 +                }
35237 +                else {
35238 +                    ctrlParms.result = 1;
35239 +                    __copy_to_user(ctrlParms.string, vertag+CFE_VERSION_MARK_SIZE, CFE_VERSION_SIZE);
35240 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
35241 +                    ret = 0;
35242 +                }
35243 +            }
35244 +            else {
35245 +                ret = -EFAULT;
35246 +            }
35247 +            break;
35248 +
35249 +        case BOARD_IOCTL_GET_ENET_CFG:
35250 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35251 +                ETHERNET_MAC_INFO EnetInfos[BP_MAX_ENET_MACS];
35252 +                if (BpGetEthernetMacInfo(EnetInfos, BP_MAX_ENET_MACS) == BP_SUCCESS) {
35253 +                    if (ctrlParms.strLen == sizeof(EnetInfos)) {
35254 +                        __copy_to_user(ctrlParms.string, EnetInfos, sizeof(EnetInfos));
35255 +                        ctrlParms.result = 0;
35256 +                        __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
35257 +                        ret = 0;
35258 +                    } else
35259 +                           ret = -EFAULT;
35260 +                }
35261 +                   else {
35262 +                       ret = -EFAULT;
35263 +                   }
35264 +                   break;
35265 +            }
35266 +            else {
35267 +                ret = -EFAULT;
35268 +            }
35269 +            break;            
35270 +
35271 +#if defined (WIRELESS)
35272 +        case BOARD_IOCTL_GET_WLAN_ANT_INUSE:
35273 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35274 +                unsigned short antInUse = 0;
35275 +                if (BpGetWirelessAntInUse(&antInUse) == BP_SUCCESS) {
35276 +                    if (ctrlParms.strLen == sizeof(antInUse)) {
35277 +                        __copy_to_user(ctrlParms.string, &antInUse, sizeof(antInUse));
35278 +                        ctrlParms.result = 0;
35279 +                        __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
35280 +                        ret = 0;
35281 +                    } else
35282 +                           ret = -EFAULT;
35283 +                }
35284 +               else {
35285 +                  ret = -EFAULT;
35286 +               }
35287 +               break;
35288 +            }
35289 +            else {
35290 +                ret = -EFAULT;
35291 +            }
35292 +            break;            
35293 +#endif            
35294 +        case BOARD_IOCTL_SET_TRIGGER_EVENT:
35295 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {               
35296 +               BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;                 
35297 +                ctrlParms.result = -EFAULT;
35298 +                ret = -EFAULT;
35299 +                if (ctrlParms.strLen == sizeof(unsigned long)) {                                           
35300 +                    board_ioc->eventmask |= *((int*)ctrlParms.string);                    
35301 +#if defined (WIRELESS)                    
35302 +                    if((board_ioc->eventmask & SES_EVENTS)) {
35303 +                        if(sesBtn_irq != BP_NOT_DEFINED) {
35304 +                            BcmHalInterruptEnable(sesBtn_irq);
35305 +                            ctrlParms.result = 0;
35306 +                            ret = 0;
35307 +                        }                                                
35308 +                    } 
35309 +#endif                                                
35310 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));                        
35311 +                }
35312 +               break;
35313 +            }
35314 +            else {
35315 +                ret = -EFAULT;
35316 +            }
35317 +            break;                        
35318 +
35319 +        case BOARD_IOCTL_GET_TRIGGER_EVENT:
35320 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35321 +               BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;
35322 +                if (ctrlParms.strLen == sizeof(unsigned long)) {
35323 +                    __copy_to_user(ctrlParms.string, &board_ioc->eventmask, sizeof(unsigned long));
35324 +                    ctrlParms.result = 0;
35325 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
35326 +                    ret = 0;
35327 +                } else
35328 +                   ret = -EFAULT;
35329 +
35330 +               break;
35331 +            }
35332 +            else {
35333 +                ret = -EFAULT;
35334 +            }
35335 +            break;                
35336 +            
35337 +        case BOARD_IOCTL_UNSET_TRIGGER_EVENT:
35338 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35339 +                if (ctrlParms.strLen == sizeof(unsigned long)) {
35340 +                    BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;                    
35341 +                    board_ioc->eventmask &= (~(*((int*)ctrlParms.string)));                  
35342 +                    ctrlParms.result = 0;
35343 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
35344 +                    ret = 0;
35345 +                } else
35346 +                   ret = -EFAULT;
35347 +
35348 +               break;
35349 +            } 
35350 +            else {
35351 +                ret = -EFAULT;
35352 +            }
35353 +            break;            
35354 +#if defined (WIRELESS)
35355 +        case BOARD_IOCTL_SET_SES_LED:
35356 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35357 +                if (ctrlParms.strLen == sizeof(int)) {
35358 +                    sesLed_ctrl(*(int*)ctrlParms.string);
35359 +                    ctrlParms.result = 0;
35360 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
35361 +                    ret = 0;
35362 +                } else
35363 +                   ret = -EFAULT;
35364 +
35365 +               break;
35366 +            }
35367 +            else {
35368 +                ret = -EFAULT;
35369 +            }
35370 +            break;            
35371 +#endif                                                            
35372 +
35373 +        case BOARD_IOCTL_SET_MONITOR_FD:
35374 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
35375 +                int fput_needed = 0;
35376 +
35377 +                g_monitor_file = fget_light( ctrlParms.offset, &fput_needed );
35378 +                if( g_monitor_file ) {
35379 +                    /* Hook this file descriptor's poll function in order to set
35380 +                     * the exception descriptor when there is a change in link
35381 +                     * state.
35382 +                     */
35383 +                    g_monitor_task = current;
35384 +                    g_orig_fop_poll = g_monitor_file->f_op->poll;
35385 +                    g_monitor_file->f_op->poll = kerSysMonitorPollHook;
35386 +                }
35387 +            }
35388 +            break;
35389 +
35390 +        case BOARD_IOCTL_WAKEUP_MONITOR_TASK:
35391 +            kerSysWakeupMonitorTask();
35392 +            break;
35393 +
35394 +        default:
35395 +            ret = -EINVAL;
35396 +            ctrlParms.result = 0;
35397 +            printk("board_ioctl: invalid command %x, cmd %d .\n",command,_IOC_NR(command));
35398 +            break;
35399 +
35400 +  } /* switch */
35401 +
35402 +  return (ret);
35403 +
35404 +} /* board_ioctl */
35405 +
35406 +/***************************************************************************
35407 + * SES Button ISR/GPIO/LED functions.
35408 + ***************************************************************************/
35409 +#if defined (WIRELESS) 
35410 +static irqreturn_t sesBtn_isr(int irq, void *dev_id, struct pt_regs *ptregs)
35411 +{   
35412 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
35413 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35414 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35415 +#endif
35416 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
35417 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35418 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
35419 +#endif
35420 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
35421 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35422 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35423 +
35424 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
35425 +    {
35426 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
35427 +        gpio_reg = &GPIO->GPIOio_high;
35428 +    }
35429 +#endif 
35430 +               
35431 +    if (!(*gpio_reg & gpio_mask)){
35432 +        wake_up_interruptible(&g_board_wait_queue);
35433 +        return IRQ_RETVAL(1);
35434 +    } else {
35435 +        return IRQ_RETVAL(0);          
35436 +    }
35437 +}
35438 +
35439 +static void __init sesBtn_mapGpio()
35440 +{      
35441 +    if( BpGetWirelessSesBtnGpio(&sesBtn_gpio) == BP_SUCCESS )
35442 +    {
35443 +        printk("SES: Button GPIO 0x%x is enabled\n", sesBtn_gpio);    
35444 +    }
35445 +}
35446 +
35447 +static void __init sesBtn_mapIntr(int context)
35448 +{      
35449 +    if( BpGetWirelessSesExtIntr(&sesBtn_irq) == BP_SUCCESS )
35450 +    {
35451 +       printk("SES: Button Interrupt 0x%x is enabled\n", sesBtn_irq);
35452 +    }
35453 +    else
35454 +       return;
35455 +           
35456 +    sesBtn_irq += INTERRUPT_ID_EXTERNAL_0;     
35457 +               
35458 +    if (BcmHalMapInterrupt((FN_HANDLER)sesBtn_isr, context, sesBtn_irq)) {
35459 +       printk("SES: Interrupt mapping failed\n");
35460 +    }    
35461 +    BcmHalInterruptEnable(sesBtn_irq);
35462 +}
35463 +
35464 +
35465 +static unsigned int sesBtn_poll(struct file *file, struct poll_table_struct *wait)
35466 +{
35467 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
35468 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35469 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35470 +#endif
35471 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
35472 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35473 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
35474 +#endif
35475 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
35476 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35477 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35478 +
35479 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
35480 +    {
35481 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
35482 +        gpio_reg = &GPIO->GPIOio_high;
35483 +    }
35484 +#endif 
35485 +               
35486 +    if (!(*gpio_reg & gpio_mask)){
35487 +       return POLLIN;
35488 +    }  
35489 +    return 0;
35490 +}
35491 +
35492 +static ssize_t sesBtn_read(struct file *file,  char __user *buffer, size_t count, loff_t *ppos)
35493 +{
35494 +    volatile unsigned int event=0;
35495 +    ssize_t ret=0;     
35496 +
35497 +#if defined(_BCM96338_) || defined (CONFIG_BCM96338)
35498 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35499 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35500 +#endif
35501 +#if defined(_BCM96345_) || defined (CONFIG_BCM96345)
35502 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35503 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
35504 +#endif
35505 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
35506 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
35507 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
35508 +    
35509 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
35510 +    {
35511 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
35512 +        gpio_reg = &GPIO->GPIOio_high;
35513 +    }
35514 +#endif 
35515 +
35516 +    if(*gpio_reg & gpio_mask){
35517 +       BcmHalInterruptEnable(sesBtn_irq);              
35518 +       return ret;
35519 +    }  
35520 +    event = SES_EVENTS;
35521 +    __copy_to_user((char*)buffer, (char*)&event, sizeof(event));       
35522 +    BcmHalInterruptEnable(sesBtn_irq); 
35523 +    count -= sizeof(event);
35524 +    buffer += sizeof(event);
35525 +    ret += sizeof(event);      
35526 +    return ret;        
35527 +}
35528 +
35529 +static void __init sesLed_mapGpio()
35530 +{      
35531 +    if( BpGetWirelessSesBtnGpio(&sesLed_gpio) == BP_SUCCESS )
35532 +    {
35533 +        printk("SES: LED GPIO 0x%x is enabled\n", sesBtn_gpio);    
35534 +    }
35535 +}
35536 +
35537 +static void sesLed_ctrl(int action)
35538 +{
35539 +
35540 +    //char status = ((action >> 8) & 0xff); /* extract status */
35541 +    //char event = ((action >> 16) & 0xff); /* extract event */        
35542 +    //char blinktype = ((action >> 24) & 0xff); /* extract blink type for SES_LED_BLINK  */
35543 +    
35544 +    BOARD_LED_STATE led;
35545 +    
35546 +    if(sesLed_gpio == BP_NOT_DEFINED)
35547 +        return;
35548 +       
35549 +    action &= 0xff; /* extract led */
35550 +
35551 +    //printk("blinktype=%d, event=%d, status=%d\n",(int)blinktype, (int)event, (int)status);
35552 +               
35553 +    switch (action) 
35554 +    {
35555 +        case SES_LED_ON:
35556 +            //printk("SES: led on\n");
35557 +            led = kLedStateOn;                                          
35558 +            break;
35559 +        case SES_LED_BLINK:
35560 +            //printk("SES: led blink\n");
35561 +            led = kLedStateSlowBlinkContinues;                         
35562 +            break;
35563 +        case SES_LED_OFF:
35564 +            default:
35565 +            //printk("SES: led off\n");
35566 +            led = kLedStateOff;                                                
35567 +    }  
35568 +    
35569 +    kerSysLedCtrl(kLedSes, led);
35570 +}
35571 +
35572 +static void __init ses_board_init()
35573 +{
35574 +    sesBtn_mapGpio();
35575 +    sesBtn_mapIntr(0);
35576 +    sesLed_mapGpio();
35577 +}
35578 +static void __exit ses_board_deinit()
35579 +{
35580 +    if(sesBtn_irq)
35581 +        BcmHalInterruptDisable(sesBtn_irq);
35582 +}
35583 +#endif
35584 +
35585 +/***************************************************************************
35586 + * Dying gasp ISR and functions.
35587 + ***************************************************************************/
35588 +#define KERSYS_DBG     printk
35589 +
35590 +#if defined(CONFIG_BCM96345)
35591 +#define        CYCLE_PER_US    70
35592 +#elif defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
35593 +/* The BCM6348 cycles per microsecond is really variable since the BCM6348
35594 + * MIPS speed can vary depending on the PLL settings.  However, an appoximate
35595 + * value of 120 will still work OK for the test being done.
35596 + */
35597 +#define        CYCLE_PER_US    120
35598 +#endif
35599 +#define        DG_GLITCH_TO    (100*CYCLE_PER_US)
35600
35601 +static void __init kerSysDyingGaspMapIntr()
35602 +{
35603 +    unsigned long ulIntr;
35604 +       
35605 +#if defined(CONFIG_BCM96348) || defined(_BCM96348_) || defined(CONFIG_BCM96338) || defined(_BCM96338_)
35606 +    if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
35607 +               BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, INTERRUPT_ID_DG);
35608 +               BcmHalInterruptEnable( INTERRUPT_ID_DG );
35609 +    }
35610 +#elif defined(CONFIG_BCM96345) || defined(_BCM96345_)
35611 +    if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
35612 +        ulIntr += INTERRUPT_ID_EXTERNAL_0;
35613 +        BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, ulIntr);
35614 +        BcmHalInterruptEnable( ulIntr );
35615 +    }
35616 +#endif
35617 +
35618 +} 
35619 +
35620 +void kerSysSetWdTimer(ulong timeUs)
35621 +{
35622 +       TIMER->WatchDogDefCount = timeUs * (FPERIPH/1000000);
35623 +       TIMER->WatchDogCtl = 0xFF00;
35624 +       TIMER->WatchDogCtl = 0x00FF;
35625 +}
35626 +
35627 +ulong kerSysGetCycleCount(void)
35628 +{
35629 +    ulong cnt; 
35630 +#ifdef _WIN32_WCE
35631 +    cnt = 0;
35632 +#else
35633 +    __asm volatile("mfc0 %0, $9":"=d"(cnt));
35634 +#endif
35635 +    return(cnt); 
35636 +}
35637 +
35638 +static Bool kerSysDyingGaspCheckPowerLoss(void)
35639 +{
35640 +    ulong clk0;
35641 +    ulong ulIntr;
35642 +
35643 +    ulIntr = 0;
35644 +    clk0 = kerSysGetCycleCount();
35645 +
35646 +    UART->Data = 'D';
35647 +    UART->Data = '%';
35648 +    UART->Data = 'G';
35649 +
35650 +#if defined(CONFIG_BCM96345)
35651 +    BpGetAdslDyingGaspExtIntr( &ulIntr );
35652 +
35653 +    do {
35654 +        ulong clk1;
35655 +        
35656 +        clk1 = kerSysGetCycleCount();          /* time cleared */
35657 +       /* wait a little to get new reading */
35658 +        while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
35659 +            ;
35660 +    } while ((0 == (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT)))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
35661 +
35662 +    if (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT))) {  /* power glitch */
35663 +        BcmHalInterruptEnable( ulIntr + INTERRUPT_ID_EXTERNAL_0);
35664 +        KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
35665 +        return 0;
35666 +    }
35667 +#elif (defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)) && !defined(VXWORKS)
35668 +    do {
35669 +        ulong clk1;
35670 +        
35671 +        clk1 = kerSysGetCycleCount();          /* time cleared */
35672 +       /* wait a little to get new reading */
35673 +        while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
35674 +            ;
35675 +     } while ((PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
35676 +
35677 +    if (!(PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET)))) {
35678 +        BcmHalInterruptEnable( INTERRUPT_ID_DG );
35679 +        KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
35680 +        return 0;
35681 +    }
35682 +#endif
35683 +    return 1;
35684 +}
35685 +
35686 +static void kerSysDyingGaspShutdown( void )
35687 +{
35688 +    kerSysSetWdTimer(1000000);
35689 +#if defined(CONFIG_BCM96345)
35690 +    PERF->blkEnables &= ~(EMAC_CLK_EN | USB_CLK_EN | CPU_CLK_EN);
35691 +#elif defined(CONFIG_BCM96348)
35692 +    PERF->blkEnables &= ~(EMAC_CLK_EN | USBS_CLK_EN | USBH_CLK_EN | SAR_CLK_EN);
35693 +#endif
35694 +}
35695 +
35696 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
35697 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs)
35698 +#else
35699 +static unsigned int kerSysDyingGaspIsr(void)
35700 +#endif
35701 +{      
35702 +    struct list_head *pos;
35703 +    CB_DGASP_LIST *tmp, *dsl = NULL;   
35704 +
35705 +    if (kerSysDyingGaspCheckPowerLoss()) {        
35706 +
35707 +        /* first to turn off everything other than dsl */        
35708 +        list_for_each(pos, &g_cb_dgasp_list_head->list) {      
35709 +            tmp = list_entry(pos, CB_DGASP_LIST, list);
35710 +           if(strncmp(tmp->name, "dsl", 3)) {
35711 +               (tmp->cb_dgasp_fn)(tmp->context); 
35712 +           }else {
35713 +               dsl = tmp;                      
35714 +           }       
35715 +        }  
35716 +        
35717 +        /* now send dgasp */
35718 +        if(dsl)
35719 +            (dsl->cb_dgasp_fn)(dsl->context); 
35720 +
35721 +        /* reset and shutdown system */
35722 +        kerSysDyingGaspShutdown();
35723 +    }
35724 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
35725 +return( IRQ_HANDLED );
35726 +#else
35727 +    return( 1 );
35728 +#endif
35729 +}
35730 +
35731 +static void __init kerSysInitDyingGaspHandler( void )
35732 +{
35733 +    CB_DGASP_LIST *new_node;
35734 +
35735 +    if( g_cb_dgasp_list_head != NULL) {
35736 +        printk("Error: kerSysInitDyingGaspHandler: list head is not null\n");
35737 +        return;        
35738 +    }
35739 +    new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
35740 +    memset(new_node, 0x00, sizeof(CB_DGASP_LIST));
35741 +    INIT_LIST_HEAD(&new_node->list);    
35742 +    g_cb_dgasp_list_head = new_node; 
35743 +               
35744 +} /* kerSysInitDyingGaspHandler */
35745 +
35746 +static void __exit kerSysDeinitDyingGaspHandler( void )
35747 +{
35748 +    struct list_head *pos;
35749 +    CB_DGASP_LIST *tmp; 
35750 +       
35751 +    if(g_cb_dgasp_list_head == NULL)
35752 +        return;
35753 +        
35754 +    list_for_each(pos, &g_cb_dgasp_list_head->list) {          
35755 +       tmp = list_entry(pos, CB_DGASP_LIST, list);
35756 +        list_del(pos);
35757 +       kfree(tmp);
35758 +    }       
35759 +
35760 +    kfree(g_cb_dgasp_list_head);       
35761 +    g_cb_dgasp_list_head = NULL;
35762 +    
35763 +} /* kerSysDeinitDyingGaspHandler */
35764 +
35765 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context)
35766 +{
35767 +    CB_DGASP_LIST *new_node;
35768 +
35769 +    if( g_cb_dgasp_list_head == NULL) {
35770 +        printk("Error: kerSysRegisterDyingGaspHandler: list head is null\n");  
35771 +        return;    
35772 +    }
35773 +    
35774 +    if( devname == NULL || cbfn == NULL ) {
35775 +        printk("Error: kerSysRegisterDyingGaspHandler: register info not enough (%s,%x,%x)\n", devname, (unsigned int)cbfn, (unsigned int)context);            
35776 +        return;
35777 +    }
35778 +       
35779 +    new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
35780 +    memset(new_node, 0x00, sizeof(CB_DGASP_LIST));    
35781 +    INIT_LIST_HEAD(&new_node->list);
35782 +    strncpy(new_node->name, devname, IFNAMSIZ);
35783 +    new_node->cb_dgasp_fn = (cb_dgasp_t)cbfn;
35784 +    new_node->context = context;
35785 +    list_add(&new_node->list, &g_cb_dgasp_list_head->list);
35786 +    
35787 +    printk("dgasp: kerSysRegisterDyingGaspHandler: %s registered \n", devname);
35788 +               
35789 +} /* kerSysRegisterDyingGaspHandler */
35790 +
35791 +void kerSysDeregisterDyingGaspHandler(char *devname)
35792 +{
35793 +    struct list_head *pos;
35794 +    CB_DGASP_LIST *tmp;    
35795 +    
35796 +    if(g_cb_dgasp_list_head == NULL) {
35797 +        printk("Error: kerSysDeregisterDyingGaspHandler: list head is null\n");
35798 +        return;        
35799 +    }
35800 +
35801 +    if(devname == NULL) {
35802 +        printk("Error: kerSysDeregisterDyingGaspHandler: devname is null\n");
35803 +        return;        
35804 +    }
35805 +    
35806 +    printk("kerSysDeregisterDyingGaspHandler: %s is deregistering\n", devname);
35807 +
35808 +    list_for_each(pos, &g_cb_dgasp_list_head->list) {          
35809 +       tmp = list_entry(pos, CB_DGASP_LIST, list);
35810 +       if(!strcmp(tmp->name, devname)) {
35811 +            list_del(pos);
35812 +           kfree(tmp);
35813 +           printk("kerSysDeregisterDyingGaspHandler: %s is deregistered\n", devname);
35814 +           return;
35815 +       }
35816 +    }  
35817 +    printk("kerSysDeregisterDyingGaspHandler: %s not (de)registered\n", devname);
35818 +       
35819 +} /* kerSysDeregisterDyingGaspHandler */
35820 +
35821 +/***************************************************************************
35822 + * MACRO to call driver initialization and cleanup functions.
35823 + ***************************************************************************/
35824 +module_init( brcm_board_init );
35825 +module_exit( brcm_board_cleanup );
35826 +
35827 +EXPORT_SYMBOL(kerSysNvRamGet);
35828 +EXPORT_SYMBOL(dumpaddr);
35829 +EXPORT_SYMBOL(kerSysGetMacAddress);
35830 +EXPORT_SYMBOL(kerSysReleaseMacAddress);
35831 +EXPORT_SYMBOL(kerSysGetSdramSize);
35832 +EXPORT_SYMBOL(kerSysLedCtrl);
35833 +EXPORT_SYMBOL(kerSysLedRegisterHwHandler);
35834 +EXPORT_SYMBOL(BpGetBoardIds);
35835 +EXPORT_SYMBOL(BpGetSdramSize);
35836 +EXPORT_SYMBOL(BpGetPsiSize);
35837 +EXPORT_SYMBOL(BpGetEthernetMacInfo);
35838 +EXPORT_SYMBOL(BpGetRj11InnerOuterPairGpios);
35839 +EXPORT_SYMBOL(BpGetPressAndHoldResetGpio);
35840 +EXPORT_SYMBOL(BpGetVoipResetGpio);
35841 +EXPORT_SYMBOL(BpGetVoipIntrGpio);
35842 +EXPORT_SYMBOL(BpGetPcmciaResetGpio);
35843 +EXPORT_SYMBOL(BpGetRtsCtsUartGpios);
35844 +EXPORT_SYMBOL(BpGetAdslLedGpio);
35845 +EXPORT_SYMBOL(BpGetAdslFailLedGpio);
35846 +EXPORT_SYMBOL(BpGetWirelessLedGpio);
35847 +EXPORT_SYMBOL(BpGetUsbLedGpio);
35848 +EXPORT_SYMBOL(BpGetHpnaLedGpio);
35849 +EXPORT_SYMBOL(BpGetWanDataLedGpio);
35850 +EXPORT_SYMBOL(BpGetPppLedGpio);
35851 +EXPORT_SYMBOL(BpGetPppFailLedGpio);
35852 +EXPORT_SYMBOL(BpGetVoipLedGpio);
35853 +EXPORT_SYMBOL(BpGetWirelessExtIntr);
35854 +EXPORT_SYMBOL(BpGetAdslDyingGaspExtIntr);
35855 +EXPORT_SYMBOL(BpGetVoipExtIntr);
35856 +EXPORT_SYMBOL(BpGetHpnaExtIntr);
35857 +EXPORT_SYMBOL(BpGetHpnaChipSelect);
35858 +EXPORT_SYMBOL(BpGetVoipChipSelect);
35859 +EXPORT_SYMBOL(BpGetWirelessSesBtnGpio);
35860 +EXPORT_SYMBOL(BpGetWirelessSesExtIntr);
35861 +EXPORT_SYMBOL(BpGetWirelessSesLedGpio);
35862 +EXPORT_SYMBOL(kerSysRegisterDyingGaspHandler);
35863 +EXPORT_SYMBOL(kerSysDeregisterDyingGaspHandler);
35864 +EXPORT_SYMBOL(kerSysGetCycleCount);
35865 +EXPORT_SYMBOL(kerSysSetWdTimer);
35866 +EXPORT_SYMBOL(kerSysWakeupMonitorTask);
35867 +
35868 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.c
35869 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.c 1970-01-01 01:00:00.000000000 +0100
35870 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.c        2006-06-26 09:07:10.000000000 +0200
35871 @@ -0,0 +1,692 @@
35872 +/************************************************************************/
35873 +/*                                                                      */
35874 +/*  AMD CFI Enabled Flash Memory Drivers                                */
35875 +/*  File name: CFIFLASH.C                                               */
35876 +/*  Revision:  1.0  5/07/98                                             */
35877 +/*                                                                      */
35878 +/* Copyright (c) 1998 ADVANCED MICRO DEVICES, INC. All Rights Reserved. */
35879 +/* This software is unpublished and contains the trade secrets and      */
35880 +/* confidential proprietary information of AMD. Unless otherwise        */
35881 +/* provided in the Software Agreement associated herewith, it is        */
35882 +/* licensed in confidence "AS IS" and is not to be reproduced in whole  */
35883 +/* or part by any means except for backup. Use, duplication, or         */
35884 +/* disclosure by the Government is subject to the restrictions in       */
35885 +/* paragraph (b) (3) (B) of the Rights in Technical Data and Computer   */
35886 +/* Software clause in DFAR 52.227-7013 (a) (Oct 1988).                  */
35887 +/* Software owned by                                                    */
35888 +/* Advanced Micro Devices, Inc.,                                        */
35889 +/* One AMD Place,                                                       */
35890 +/* P.O. Box 3453                                                        */
35891 +/* Sunnyvale, CA 94088-3453.                                            */
35892 +/************************************************************************/
35893 +/*  This software constitutes a basic shell of source code for          */
35894 +/*  programming all AMD Flash components. AMD                           */
35895 +/*  will not be responsible for misuse or illegal use of this           */
35896 +/*  software for devices not supported herein. AMD is providing         */
35897 +/*  this source code "AS IS" and will not be responsible for            */
35898 +/*  issues arising from incorrect user implementation of the            */
35899 +/*  source code herein. It is the user's responsibility to              */
35900 +/*  properly design-in this source code.                                */
35901 +/*                                                                      */ 
35902 +/************************************************************************/                        
35903 +#ifdef _CFE_                                                
35904 +#include "lib_types.h"
35905 +#include "lib_printf.h"
35906 +#include "lib_string.h"
35907 +#include "cfe_timer.h"
35908 +#define printk  printf
35909 +#else       // linux
35910 +#include <linux/param.h>
35911 +#include <linux/sched.h>
35912 +#include <linux/timer.h>
35913 +#endif
35914 +
35915 +#include "cfiflash.h"
35916 +
35917 +static int flash_wait(WORD sector, int offset, UINT16 data);
35918 +static UINT16 flash_get_device_id(void);
35919 +static int flash_get_cfi(struct cfi_query *query, UINT16 *cfi_struct, int flashFamily);
35920 +static int flash_write(WORD sector, int offset, byte *buf, int nbytes);
35921 +static void flash_command(int command, WORD sector, int offset, UINT16 data);
35922 +
35923 +/*********************************************************************/
35924 +/* 'meminfo' should be a pointer, but most C compilers will not      */
35925 +/* allocate static storage for a pointer without calling             */
35926 +/* non-portable functions such as 'new'.  We also want to avoid      */
35927 +/* the overhead of passing this pointer for every driver call.       */
35928 +/* Systems with limited heap space will need to do this.             */
35929 +/*********************************************************************/
35930 +struct flashinfo meminfo; /* Flash information structure */
35931 +static int flashFamily = FLASH_UNDEFINED;
35932 +static int totalSize = 0;
35933 +static struct cfi_query query;
35934 +
35935 +static UINT16 cfi_data_struct_29W160[] = {
35936 +    0x0020, 0x0049, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35937 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35938 +    0x0051, 0x0052, 0x0059, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000,
35939 +    0x0000, 0x0000, 0x0000, 0x0027, 0x0036, 0x0000, 0x0000, 0x0004,
35940 +    0x0000, 0x000a, 0x0000, 0x0004, 0x0000, 0x0003, 0x0000, 0x0015,
35941 +    0x0002, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0040,
35942 +    0x0000, 0x0001, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0080,
35943 +    0x0000, 0x001e, 0x0000, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff,
35944 +    0x0050, 0x0052, 0x0049, 0x0031, 0x0030, 0x0000, 0x0002, 0x0001,
35945 +    0x0001, 0x0004, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0002,
35946 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35947 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35948 +    0xffff, 0x0888, 0x252b, 0x8c84, 0x7dbc, 0xffff, 0xffff, 0xffff,
35949 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35950 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
35951 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
35952 +};
35953 +
35954 +
35955 +/*********************************************************************/
35956 +/* Init_flash is used to build a sector table from the information   */
35957 +/* provided through the CFI query.  This information is translated   */
35958 +/* from erase_block information to base:offset information for each  */
35959 +/* individual sector. This information is then stored in the meminfo */
35960 +/* structure, and used throughout the driver to access sector        */
35961 +/* information.                                                      */
35962 +/*                                                                   */
35963 +/* This is more efficient than deriving the sector base:offset       */
35964 +/* information every time the memory map switches (since on the      */
35965 +/* development platform can only map 64k at a time).  If the entire  */
35966 +/* flash memory array can be mapped in, then the addition static     */
35967 +/* allocation for the meminfo structure can be eliminated, but the   */
35968 +/* drivers will have to be re-written.                               */
35969 +/*                                                                   */
35970 +/* The meminfo struct occupies 653 bytes of heap space, depending    */
35971 +/* on the value of the define MAXSECTORS.  Adjust to suit            */
35972 +/* application                                                       */ 
35973 +/*********************************************************************/
35974 +byte flash_init(void)
35975 +{
35976 +    int i=0, j=0, count=0;
35977 +    int basecount=0L;
35978 +    UINT16 device_id;
35979 +    int flipCFIGeometry = FALSE;
35980 +
35981 +    /* First, assume
35982 +    * a single 8k sector for sector 0.  This is to allow
35983 +    * the system to perform memory mapping to the device,
35984 +    * even though the actual physical layout is unknown.
35985 +    * Once mapped in, the CFI query will produce all
35986 +    * relevant information.
35987 +    */
35988 +    meminfo.addr = 0L;
35989 +    meminfo.areg = 0;
35990 +    meminfo.nsect = 1;
35991 +    meminfo.bank1start = 0;
35992 +    meminfo.bank2start = 0;
35993 +    
35994 +    meminfo.sec[0].size = 8192;
35995 +    meminfo.sec[0].base = 0x00000;
35996 +    meminfo.sec[0].bank = 1;
35997 +        
35998 +    flash_command(FLASH_RESET, 0, 0, 0);
35999 +
36000 +    device_id = flash_get_device_id();
36001 +
36002 +    switch (device_id) {
36003 +        case ID_I28F160C3B:
36004 +        case ID_I28F320C3B:
36005 +        case ID_I28F160C3T:
36006 +        case ID_I28F320C3T:
36007 +            flashFamily = FLASH_INTEL;
36008 +            break;
36009 +        case ID_AM29DL800B:
36010 +        case ID_AM29LV800B:
36011 +        case ID_AM29LV400B:   
36012 +        case ID_AM29LV160B:
36013 +        case ID_AM29LV320B:
36014 +        case ID_MX29LV320AB:
36015 +        case ID_AM29LV320MB:
36016 +        case ID_AM29DL800T:
36017 +        case ID_AM29LV800T:
36018 +        case ID_AM29LV160T:
36019 +        case ID_AM29LV320T:
36020 +        case ID_MX29LV320AT:
36021 +        case ID_AM29LV320MT:
36022 +            flashFamily = FLASH_AMD;
36023 +            break;
36024 +        case ID_SST39VF1601:
36025 +               case ID_SST39VF3201:
36026 +            flashFamily = FLASH_SST;
36027 +            break;
36028 +        default:
36029 +            printk("Flash memory not supported!  Device id = %x\n", device_id);
36030 +            return -1;           
36031 +    }
36032 +
36033 +    if (flash_get_cfi(&query, 0, flashFamily) == -1) {
36034 +        switch(device_id) {
36035 +        case ID_AM29LV160T:
36036 +        case ID_AM29LV160B:
36037 +            flash_get_cfi(&query, cfi_data_struct_29W160, flashFamily);
36038 +            break;
36039 +        default:
36040 +            printk("CFI data structure not found. Device id = %x\n", device_id);
36041 +            return -1;           
36042 +        }
36043 +    }
36044 +
36045 +    // need to determine if it top or bottom boot here
36046 +    switch (device_id)
36047 +    {
36048 +        case ID_AM29DL800B:
36049 +        case ID_AM29LV800B:
36050 +        case ID_AM29LV400B:   
36051 +        case ID_AM29LV160B:
36052 +        case ID_AM29LV320B:
36053 +        case ID_MX29LV320AB:
36054 +        case ID_AM29LV320MB:
36055 +        case ID_I28F160C3B:
36056 +        case ID_I28F320C3B:
36057 +        case ID_I28F160C3T:
36058 +        case ID_I28F320C3T:
36059 +               case ID_SST39VF1601:
36060 +               case ID_SST39VF3201:
36061 +            flipCFIGeometry = FALSE;
36062 +            break;
36063 +        case ID_AM29DL800T:
36064 +        case ID_AM29LV800T:
36065 +        case ID_AM29LV160T:
36066 +        case ID_AM29LV320T:
36067 +        case ID_MX29LV320AT:
36068 +        case ID_AM29LV320MT:
36069 +            flipCFIGeometry = TRUE;
36070 +            break;
36071 +        default:
36072 +            printk("Flash memory not supported!  Device id = %x\n", device_id);
36073 +            return -1;           
36074 +    }
36075 +
36076 +    count=0;basecount=0L;
36077 +
36078 +    if (!flipCFIGeometry)
36079 +    {
36080 +       for (i=0; i<query.num_erase_blocks; i++) {
36081 +            for(j=0; j<query.erase_block[i].num_sectors; j++) {
36082 +                meminfo.sec[count].size = (int) query.erase_block[i].sector_size;
36083 +                meminfo.sec[count].base = (int) basecount;
36084 +                basecount += (int) query.erase_block[i].sector_size;
36085 +                count++;
36086 +            }
36087 +        }
36088 +    }
36089 +    else
36090 +    {
36091 +        for (i = (query.num_erase_blocks - 1); i >= 0; i--) {
36092 +            for(j=0; j<query.erase_block[i].num_sectors; j++) {
36093 +                meminfo.sec[count].size = (int) query.erase_block[i].sector_size;
36094 +                meminfo.sec[count].base = (int) basecount;
36095 +                basecount += (int) query.erase_block[i].sector_size;
36096 +                               count++;
36097 +            }
36098 +        }
36099 +    }
36100 +
36101 +    meminfo.nsect = count;
36102 +    totalSize = meminfo.sec[count-1].base + meminfo.sec[count-1].size;
36103 +    return (0);
36104 +}
36105 +
36106 +/*********************************************************************/
36107 +/* Flash_sector_erase_int() is identical to flash_sector_erase(),    */
36108 +/* except it will wait until the erase is completed before returning */
36109 +/* control to the calling function.  This can be used in cases which */
36110 +/* require the program to hold until a sector is erased, without     */
36111 +/* adding the wait check external to this function.                  */
36112 +/*********************************************************************/
36113 +byte flash_sector_erase_int(WORD sector)
36114 +{
36115 +    int i;
36116 +
36117 +    for( i = 0; i < 3; i++ ) {
36118 +        flash_command(FLASH_SERASE, sector, 0, 0);
36119 +        if (flash_wait(sector, 0, 0xffff) == STATUS_READY)
36120 +            break;
36121 +    }
36122 +
36123 +    return(1);
36124 +}
36125 +
36126 +/*********************************************************************/
36127 +/* flash_read_buf() reads buffer of data from the specified          */
36128 +/* offset from the sector parameter.                                 */
36129 +/*********************************************************************/
36130 +int flash_read_buf(WORD sector, int offset,
36131 +                        byte *buffer, int numbytes)
36132 +{
36133 +    byte *fwp;
36134 +
36135 +    fwp = (byte *)flash_get_memptr(sector);
36136 +
36137 +       while (numbytes) {
36138 +               *buffer++ = *(fwp + offset);
36139 +               numbytes--;
36140 +               fwp++;
36141 +    }
36142 +
36143 +    return (1);
36144 +}
36145 +
36146 +/*********************************************************************/
36147 +/* flash_write_buf() utilizes                                        */
36148 +/* the unlock bypass mode of the flash device.  This can remove      */
36149 +/* significant overhead from the bulk programming operation, and     */
36150 +/* when programming bulk data a sizeable performance increase can be */
36151 +/* observed.                                                         */
36152 +/*********************************************************************/
36153 +int flash_write_buf(WORD sector, int offset, byte *buffer, int numbytes)
36154 +{
36155 +    int ret = -1;
36156 +    int i;
36157 +    unsigned char *p = flash_get_memptr(sector) + offset;
36158 +
36159 +    /* After writing the flash block, compare the contents to the source
36160 +     * buffer.  Try to write the sector successfully up to three times.
36161 +     */
36162 +    for( i = 0; i < 3; i++ ) {
36163 +        ret = flash_write(sector, offset, buffer, numbytes);
36164 +        if( !memcmp( p, buffer, numbytes ) )
36165 +            break;
36166 +        /* Erase and try again */
36167 +        flash_sector_erase_int(sector);
36168 +        ret = -1;
36169 +    }
36170 +
36171 +    if( ret == -1 )
36172 +        printk( "Flash write error.  Verify failed\n" );
36173 +
36174 +    return( ret );
36175 +}
36176 +
36177 +/*********************************************************************/
36178 +/* Usefull funtion to return the number of sectors in the device.    */
36179 +/* Can be used for functions which need to loop among all the        */
36180 +/* sectors, or wish to know the number of the last sector.           */
36181 +/*********************************************************************/
36182 +int flash_get_numsectors(void)
36183 +{
36184 +    return meminfo.nsect;
36185 +}
36186 +
36187 +/*********************************************************************/
36188 +/* flash_get_sector_size() is provided for cases in which the size   */
36189 +/* of a sector is required by a host application.  The sector size   */
36190 +/* (in bytes) is returned in the data location pointed to by the     */
36191 +/* 'size' parameter.                                                 */
36192 +/*********************************************************************/
36193 +int flash_get_sector_size(WORD sector)
36194 +{
36195 +    return meminfo.sec[sector].size;
36196 +}
36197 +
36198 +/*********************************************************************/
36199 +/* The purpose of flash_get_memptr() is to return a memory pointer   */
36200 +/* which points to the beginning of memory space allocated for the   */
36201 +/* flash.  All function pointers are then referenced from this       */
36202 +/* pointer.                                                         */
36203 +/*                                                                   */
36204 +/* Different systems will implement this in different ways:          */
36205 +/* possibilities include:                                            */
36206 +/*  - A direct memory pointer                                        */
36207 +/*  - A pointer to a memory map                                      */
36208 +/*  - A pointer to a hardware port from which the linear             */
36209 +/*    address is translated                                          */
36210 +/*  - Output of an MMU function / service                            */
36211 +/*                                                                   */
36212 +/* Also note that this function expects the pointer to a specific    */
36213 +/* sector of the device.  This can be provided by dereferencing      */
36214 +/* the pointer from a translated offset of the sector from a         */
36215 +/* global base pointer (e.g. flashptr = base_pointer + sector_offset)*/
36216 +/*                                                                   */
36217 +/* Important: Many AMD flash devices need both bank and or sector    */
36218 +/* address bits to be correctly set (bank address bits are A18-A16,  */
36219 +/* and sector address bits are A18-A12, or A12-A15).  Flash parts    */
36220 +/* which do not need these bits will ignore them, so it is safe to   */
36221 +/* assume that every part will require these bits to be set.         */
36222 +/*********************************************************************/
36223 +unsigned char *flash_get_memptr(WORD sector)
36224 +{
36225 +       unsigned char *memptr = (unsigned char*)(FLASH_BASE_ADDR_REG + meminfo.sec[sector].base);
36226 +
36227 +       return (memptr);
36228 +}
36229 +
36230 +/*********************************************************************/
36231 +/* The purpose of flash_get_blk() is to return a the block number    */
36232 +/* for a given memory address.                                       */
36233 +/*********************************************************************/
36234 +int flash_get_blk(int addr)
36235 +{
36236 +    int blk_start, i;
36237 +    int last_blk = flash_get_numsectors();
36238 +    int relative_addr = addr - (int) FLASH_BASE_ADDR_REG;
36239 +
36240 +    for(blk_start=0, i=0; i < relative_addr && blk_start < last_blk; blk_start++)
36241 +        i += flash_get_sector_size(blk_start);
36242 +
36243 +    if( i > relative_addr )
36244 +    {
36245 +        blk_start--;        // last blk, dec by 1
36246 +    }
36247 +    else
36248 +        if( blk_start == last_blk )
36249 +        {
36250 +            printk("Address is too big.\n");
36251 +            blk_start = -1;
36252 +        }
36253 +
36254 +    return( blk_start );
36255 +}
36256 +
36257 +/************************************************************************/
36258 +/* The purpose of flash_get_total_size() is to return the total size of */
36259 +/* the flash                                                            */
36260 +/************************************************************************/
36261 +int flash_get_total_size()
36262 +{
36263 +    return totalSize;
36264 +}
36265 +
36266 +/*********************************************************************/
36267 +/* Flash_command() is the main driver function.  It performs         */
36268 +/* every possible command available to AMD B revision                */
36269 +/* flash parts. Note that this command is not used directly, but     */
36270 +/* rather called through the API wrapper functions provided below.   */
36271 +/*********************************************************************/
36272 +static void flash_command(int command, WORD sector, int offset, UINT16 data)
36273 +{
36274 +    volatile UINT16 *flashptr;
36275 +    volatile UINT16 *flashbase;
36276 +
36277 +    flashptr = (UINT16 *) flash_get_memptr(sector);
36278 +    flashbase = (UINT16 *) flash_get_memptr(0);
36279 +    
36280 +    switch (flashFamily) {
36281 +    case FLASH_UNDEFINED:
36282 +        /* These commands should work for AMD, Intel and SST flashes */
36283 +        switch (command) {
36284 +        case FLASH_RESET:
36285 +            flashptr[0] = 0xF0;
36286 +            flashptr[0] = 0xFF;
36287 +            break;
36288 +        case FLASH_READ_ID:
36289 +                       flashptr[0x5555] = 0xAA;       /* unlock 1 */
36290 +            flashptr[0x2AAA] = 0x55;       /* unlock 2 */
36291 +            flashptr[0x5555] = 0x90;
36292 +            break;
36293 +        default:
36294 +            break;
36295 +        }
36296 +        break;
36297 +    case FLASH_AMD:
36298 +        switch (command) {
36299 +        case FLASH_RESET:
36300 +            flashptr[0] = 0xF0;
36301 +            break;
36302 +        case FLASH_READ_ID:
36303 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
36304 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
36305 +            flashptr[0x555] = 0x90;
36306 +            break;
36307 +        case FLASH_CFIQUERY:
36308 +            flashptr[0x55] = 0x98;
36309 +            break;
36310 +        case FLASH_UB:
36311 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
36312 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
36313 +            flashptr[0x555] = 0x20;
36314 +            break;
36315 +        case FLASH_PROG:
36316 +            flashptr[0] = 0xA0;
36317 +            flashptr[offset/2] = data;
36318 +            break;
36319 +        case FLASH_UBRESET:
36320 +            flashptr[0] = 0x90;
36321 +            flashptr[0] = 0x00;
36322 +            break;
36323 +        case FLASH_SERASE:
36324 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
36325 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
36326 +            flashptr[0x555] = 0x80;
36327 +            flashptr[0x555] = 0xAA;
36328 +            flashptr[0x2AA] = 0x55;
36329 +            flashptr[0] = 0x30;
36330 +            break;
36331 +        default:
36332 +            break;
36333 +        }
36334 +        break;
36335 +    case FLASH_INTEL:
36336 +        switch (command) {
36337 +        case FLASH_RESET:
36338 +            flashptr[0] = 0xFF;
36339 +            break;
36340 +        case FLASH_READ_ID:
36341 +            flashptr[0] = 0x90;
36342 +            break;
36343 +        case FLASH_CFIQUERY:
36344 +            flashptr[0] = 0x98;
36345 +            break;
36346 +        case FLASH_PROG:
36347 +            flashptr[0] = 0x40;
36348 +            flashptr[offset/2] = data;
36349 +            break;
36350 +        case FLASH_SERASE:
36351 +            flashptr[0] = 0x60;
36352 +            flashptr[0] = 0xD0;
36353 +            flashptr[0] = 0x20;
36354 +            flashptr[0] = 0xD0;
36355 +            break;
36356 +        default:
36357 +            break;
36358 +        }
36359 +        break;
36360 +    case FLASH_SST:
36361 +        switch (command) {
36362 +        case FLASH_RESET:
36363 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
36364 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
36365 +            flashbase[0x5555] = 0xf0;
36366 +            break;
36367 +        case FLASH_READ_ID:
36368 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
36369 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
36370 +            flashbase[0x5555] = 0x90;
36371 +            break;
36372 +        case FLASH_CFIQUERY:
36373 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
36374 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
36375 +            flashbase[0x5555] = 0x98;
36376 +            break;
36377 +        case FLASH_UB:
36378 +            break;
36379 +        case FLASH_PROG:
36380 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
36381 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
36382 +            flashbase[0x5555] = 0xa0;
36383 +            flashptr[offset/2] = data;
36384 +            break;
36385 +        case FLASH_UBRESET:
36386 +            break;
36387 +        case FLASH_SERASE:
36388 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
36389 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
36390 +            flashbase[0x5555] = 0x80;
36391 +            flashbase[0x5555] = 0xAA;
36392 +            flashbase[0x2AAA] = 0x55;
36393 +            flashptr[0] = 0x30;
36394 +            break;
36395 +        default:
36396 +            break;
36397 +        }
36398 +        break;
36399 +    default:
36400 +        break;
36401 +    }
36402 +}
36403 +
36404 +/*********************************************************************/
36405 +/* flash_write extends the functionality of flash_program() by       */
36406 +/* providing an faster way to program multiple data words, without   */
36407 +/* needing the function overhead of looping algorithms which         */
36408 +/* program word by word.  This function utilizes fast pointers       */
36409 +/* to quickly loop through bulk data.                                */
36410 +/*********************************************************************/
36411 +static int flash_write(WORD sector, int offset, byte *buf, int nbytes)
36412 +{
36413 +    UINT16 *src;
36414 +    src = (UINT16 *)buf;
36415 +
36416 +    if ((nbytes | offset) & 1) {
36417 +        return -1;
36418 +    }
36419 +
36420 +    flash_command(FLASH_UB, 0, 0, 0);
36421 +    while (nbytes > 0) {
36422 +        flash_command(FLASH_PROG, sector, offset, *src);
36423 +        if (flash_wait(sector, offset, *src) != STATUS_READY)
36424 +            break;
36425 +        offset +=2;
36426 +        nbytes -=2;
36427 +        src++;
36428 +    }
36429 +    flash_command(FLASH_UBRESET, 0, 0, 0);
36430 +    
36431 +    return (byte*)src - buf;
36432 +}
36433 +
36434 +/*********************************************************************/
36435 +/* flash_wait utilizes the DQ6, DQ5, and DQ2 polling algorithms      */
36436 +/* described in the flash data book.  It can quickly ascertain the   */
36437 +/* operational status of the flash device, and return an             */
36438 +/* appropriate status code (defined in flash.h)                      */
36439 +/*********************************************************************/
36440 +static int flash_wait(WORD sector, int offset, UINT16 data)
36441 +{
36442 +    volatile UINT16 *flashptr; /* flash window */
36443 +    UINT16 d1;
36444 +
36445 +    flashptr = (UINT16 *) flash_get_memptr(sector);
36446 +
36447 +    if (flashFamily == FLASH_AMD || flashFamily == FLASH_SST) {
36448 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
36449 +        do {
36450 +            d1 = flashptr[offset/2];
36451 +            if (d1 == data)
36452 +                return STATUS_READY;
36453 +        } while (!(d1 & 0x20));
36454 +
36455 +        d1 = flashptr[offset/2];
36456 +
36457 +        if (d1 != data) {
36458 +            flash_command(FLASH_RESET, 0, 0, 0);
36459 +            return STATUS_TIMEOUT;
36460 +        }
36461 +#else
36462 +        do {
36463 +            d1 = *flashptr;    /* read data */
36464 +            d1 ^= *flashptr;   /* read it again and see what toggled */
36465 +            if (d1 == 0)       /* no toggles, nothing's happening */
36466 +                return STATUS_READY;
36467 +        } while (!(d1 & 0x20));
36468 +
36469 +        d1 = *flashptr;        /* read data */
36470 +        d1 ^= *flashptr;   /* read it again and see what toggled */
36471 +
36472 +        if (d1 != 0) {
36473 +            flash_command(FLASH_RESET, 0, 0, 0);
36474 +            return STATUS_TIMEOUT;
36475 +        }
36476 +#endif
36477 +    } else if (flashFamily == FLASH_INTEL) {
36478 +        flashptr[0] = 0x70;
36479 +        /* Wait for completion */
36480 +        while(!(*flashptr & 0x80));
36481 +        if (*flashptr & 0x30) {
36482 +            flashptr[0] = 0x50;
36483 +            flash_command(FLASH_RESET, 0, 0, 0);
36484 +            return STATUS_TIMEOUT;
36485 +        }
36486 +        flashptr[0] = 0x50;
36487 +        flash_command(FLASH_RESET, 0, 0, 0);
36488 +    }
36489 +    
36490 +    return STATUS_READY;
36491 +}
36492 +
36493 +/*********************************************************************/
36494 +/* flash_get_device_id() will perform an autoselect sequence on the  */
36495 +/* flash device, and return the device id of the component.          */
36496 +/* This function automatically resets to read mode.                  */
36497 +/*********************************************************************/
36498 +static UINT16 flash_get_device_id()
36499 +{
36500 +    volatile UINT16 *fwp; /* flash window */
36501 +    UINT16 answer;
36502 +    
36503 +    fwp = (UINT16 *)flash_get_memptr(0);
36504 +    
36505 +    flash_command(FLASH_READ_ID, 0, 0, 0);
36506 +    answer = *(fwp + 1);
36507 +    if (answer == ID_AM29LV320M) {
36508 +        answer = *(fwp + 0xe);
36509 +        answer = *(fwp + 0xf);
36510 +    }
36511 +    
36512 +    flash_command(FLASH_RESET, 0, 0, 0);
36513 +    return( (UINT16) answer );
36514 +}
36515 +
36516 +/*********************************************************************/
36517 +/* flash_get_cfi() is the main CFI workhorse function.  Due to it's  */
36518 +/* complexity and size it need only be called once upon              */
36519 +/* initializing the flash system.  Once it is called, all operations */
36520 +/* are performed by looking at the meminfo structure.                */
36521 +/* All possible care was made to make this algorithm as efficient as */
36522 +/* possible.  90% of all operations are memory reads, and all        */
36523 +/* calculations are done using bit-shifts when possible              */
36524 +/*********************************************************************/
36525 +static int flash_get_cfi(struct cfi_query *query, UINT16 *cfi_struct, int flashFamily)
36526 +{
36527 +    volatile UINT16 *fwp; /* flash window */
36528 +    int i=0;
36529 +
36530 +    flash_command(FLASH_CFIQUERY, 0, 0, 0);
36531 +    
36532 +    if (cfi_struct == 0)
36533 +        fwp = (UINT16 *)flash_get_memptr(0);
36534 +    else
36535 +        fwp = cfi_struct;
36536 +    
36537 +    /* Initial house-cleaning */
36538 +    for(i=0; i < 8; i++) {
36539 +        query->erase_block[i].sector_size = 0;
36540 +        query->erase_block[i].num_sectors = 0;
36541 +    }
36542 +    
36543 +    /* If not 'QRY', then we dont have a CFI enabled device in the socket */
36544 +    if( fwp[0x10] != 'Q' &&
36545 +        fwp[0x11] != 'R' &&
36546 +        fwp[0x12] != 'Y') {
36547 +        flash_command(FLASH_RESET, 0, 0, 0);
36548 +        return(-1);
36549 +    }
36550 +    
36551 +       query->num_erase_blocks = fwp[0x2C];
36552 +       if(flashFamily == FLASH_SST)
36553 +               query->num_erase_blocks = 1;
36554 +       
36555 +    for(i=0; i < query->num_erase_blocks; i++) {
36556 +                       query->erase_block[i].num_sectors = fwp[(0x2D+(4*i))] + (fwp[0x2E + (4*i)] << 8);
36557 +                       query->erase_block[i].num_sectors++;
36558 +                       query->erase_block[i].sector_size = 256 * (256 * fwp[(0x30+(4*i))] + fwp[(0x2F+(4*i))]);
36559 +    }
36560 +    
36561 +    flash_command(FLASH_RESET, 0, 0, 0);
36562 +    return(1);
36563 +}
36564 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.h
36565 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.h 1970-01-01 01:00:00.000000000 +0100
36566 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/bcm96348/cfiflash.h        2006-06-26 09:07:10.000000000 +0200
36567 @@ -0,0 +1,150 @@
36568 +/************************************************************************/
36569 +/*                                                                      */
36570 +/*  AMD CFI Enabled Flash Memory Drivers                                */
36571 +/*  File name: CFIFLASH.H                                               */
36572 +/*  Revision:  1.0  5/07/98                                             */
36573 +/*                                                                      */
36574 +/* Copyright (c) 1998 ADVANCED MICRO DEVICES, INC. All Rights Reserved. */
36575 +/* This software is unpublished and contains the trade secrets and      */
36576 +/* confidential proprietary information of AMD. Unless otherwise        */
36577 +/* provided in the Software Agreement associated herewith, it is        */
36578 +/* licensed in confidence "AS IS" and is not to be reproduced in whole  */
36579 +/* or part by any means except for backup. Use, duplication, or         */
36580 +/* disclosure by the Government is subject to the restrictions in       */
36581 +/* paragraph (b) (3) (B) of the Rights in Technical Data and Computer   */
36582 +/* Software clause in DFAR 52.227-7013 (a) (Oct 1988).                  */
36583 +/* Software owned by                                                    */
36584 +/* Advanced Micro Devices, Inc.,                                        */
36585 +/* One AMD Place,                                                       */
36586 +/* P.O. Box 3453                                                        */
36587 +/* Sunnyvale, CA 94088-3453.                                            */
36588 +/************************************************************************/
36589 +/*  This software constitutes a basic shell of source code for          */
36590 +/*  programming all AMD Flash components. AMD                           */
36591 +/*  will not be responsible for misuse or illegal use of this           */
36592 +/*  software for devices not supported herein. AMD is providing         */
36593 +/*  this source code "AS IS" and will not be responsible for            */
36594 +/*  issues arising from incorrect user implementation of the            */
36595 +/*  source code herein. It is the user's responsibility to              */
36596 +/*  properly design-in this source code.                                */
36597 +/*                                                                      */ 
36598 +/************************************************************************/
36599 +#ifndef _CFIFLASH_H
36600 +#define _CFIFLASH_H
36601 +
36602 +#if defined __cplusplus
36603 +extern "C" {
36604 +#endif
36605 +
36606 +/* include board/CPU specific definitions */
36607 +#include "bcmtypes.h"
36608 +#include "board.h"
36609 +
36610 +#define FLASH_BASE_ADDR_REG FLASH_BASE
36611 +
36612 +#ifndef NULL
36613 +#define NULL 0
36614 +#endif
36615 +
36616 +#define MAXSECTORS  1024      /* maximum number of sectors supported */
36617 +
36618 +/* A structure for identifying a flash part.  There is one for each
36619 + * of the flash part definitions.  We need to keep track of the
36620 + * sector organization, the address register used, and the size
36621 + * of the sectors.
36622 + */
36623 +struct flashinfo {
36624 +        char *name;         /* "Am29DL800T", etc. */
36625 +        unsigned long addr; /* physical address, once translated */
36626 +        int areg;           /* Can be set to zero for all parts */
36627 +        int nsect;          /* # of sectors -- 19 in LV, 22 in DL */
36628 +        int bank1start;     /* first sector # in bank 1 */
36629 +        int bank2start;     /* first sector # in bank 2, if DL part */
36630 + struct {
36631 +       long size;           /* # of bytes in this sector */
36632 +       long base;           /* offset from beginning of device */
36633 +       int bank;            /* 1 or 2 for DL; 1 for LV */
36634 +        } sec[MAXSECTORS];  /* per-sector info */
36635 +};
36636 +
36637 +/*
36638 + * This structure holds all CFI query information as defined
36639 + * in the JEDEC standard. All information up to 
36640 + * primary_extended_query is standard among all manufactures
36641 + * with CFI enabled devices.
36642 + */
36643 +
36644 +struct cfi_query {
36645 +       int num_erase_blocks;           /* Number of sector defs. */
36646 +       struct {
36647 +         unsigned long sector_size;    /* byte size of sector */
36648 +         int num_sectors;              /* Num sectors of this size */
36649 +       } erase_block[8];               /* Max of 256, but 8 is good */
36650 +};
36651 +
36652 +/* Standard Boolean declarations */
36653 +#define TRUE                           1
36654 +#define FALSE                          0
36655 +
36656 +/* Define different type of flash */
36657 +#define FLASH_UNDEFINED 0
36658 +#define FLASH_AMD       1
36659 +#define FLASH_INTEL     2
36660 +#define FLASH_SST       3
36661 +
36662 +/* Command codes for the flash_command routine */
36663 +#define FLASH_RESET     0       /* reset to read mode */
36664 +#define FLASH_READ_ID   1       /* read device ID */
36665 +#define FLASH_CFIQUERY  2       /* CFI query */
36666 +#define FLASH_UB        3       /* go into unlock bypass mode */
36667 +#define FLASH_PROG      4       /* program a word */
36668 +#define FLASH_UBRESET   5       /* reset to read mode from unlock bypass mode */
36669 +#define FLASH_SERASE    6       /* sector erase */
36670 +
36671 +/* Return codes from flash_status */
36672 +#define STATUS_READY    0       /* ready for action */
36673 +#define STATUS_TIMEOUT  1       /* operation timed out */
36674 +
36675 +/* A list of AMD compatible device ID's - add others as needed */
36676 +#define ID_AM29DL800T   0x224A
36677 +#define ID_AM29DL800B   0x22CB
36678 +#define ID_AM29LV800T   0x22DA
36679 +#define ID_AM29LV800B   0x225B
36680 +#define ID_AM29LV400B   0x22BA
36681 +
36682 +#define ID_AM29LV160B   0x2249
36683 +#define ID_AM29LV160T   0x22C4
36684 +
36685 +#define ID_AM29LV320T   0x22F6
36686 +#define ID_MX29LV320AT  0x22A7
36687 +#define ID_AM29LV320B   0x22F9
36688 +#define ID_MX29LV320AB  0x22A8
36689 +
36690 +#define ID_AM29LV320M   0x227E
36691 +#define ID_AM29LV320MB  0x2200
36692 +#define ID_AM29LV320MT  0x2201
36693 +
36694 +#define ID_SST39VF1601  0x234B
36695 +#define ID_SST39VF3201  0x235B
36696 +
36697 +/* A list of Intel compatible device ID's - add others as needed */
36698 +#define ID_I28F160C3T   0x88C2
36699 +#define ID_I28F160C3B   0x88C3
36700 +#define ID_I28F320C3T   0x88C4
36701 +#define ID_I28F320C3B   0x88C5
36702 +
36703 +extern byte flash_init(void);
36704 +extern int flash_write_buf(WORD sector, int offset, byte *buffer, int numbytes);
36705 +extern int flash_read_buf(WORD sector, int offset, byte *buffer, int numbytes);
36706 +extern byte flash_sector_erase_int(WORD sector);
36707 +extern int flash_get_numsectors(void);
36708 +extern int flash_get_sector_size(WORD sector);
36709 +extern int flash_get_total_size(void);
36710 +extern unsigned char *flash_get_memptr(WORD sector);
36711 +extern int flash_get_blk(int addr);
36712 +
36713 +#if defined __cplusplus
36714 +}
36715 +#endif
36716 +
36717 +#endif
36718 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/Makefile
36719 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/Makefile      1970-01-01 01:00:00.000000000 +0100
36720 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/Makefile     2006-06-26 09:07:10.000000000 +0200
36721 @@ -0,0 +1,17 @@
36722 +# Makefile for the bcm963xx board drivers
36723 +#
36724 +
36725 +
36726 +obj-y := board.o cfiflash.o bcm63xx_flash.o bcm63xx_led.o
36727 +
36728 +EXTRA_CFLAGS += -I. -I$(INC_BRCMBOARDPARMS_PATH)/$(BRCM_BOARD) -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
36729 +
36730 +ifeq ($(strip $(WIRELESS)),1)
36731 +       EXTRA_CFLAGS += -DWIRELESS
36732 +endif
36733 +
36734 +-include $(TOPDIR)/Rules.make
36735 +
36736 +clean:
36737 +       rm -f core *.o *.a *.s
36738 +
36739 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_flash.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_flash.c
36740 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_flash.c       1970-01-01 01:00:00.000000000 +0100
36741 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_flash.c      2006-06-26 09:07:10.000000000 +0200
36742 @@ -0,0 +1,775 @@
36743 +/*
36744 +<:copyright-gpl
36745 + Copyright 2002 Broadcom Corp. All Rights Reserved.
36746 +
36747 + This program is free software; you can distribute it and/or modify it
36748 + under the terms of the GNU General Public License (Version 2) as
36749 + published by the Free Software Foundation.
36750 +
36751 + This program is distributed in the hope it will be useful, but WITHOUT
36752 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36753 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
36754 + for more details.
36755 +
36756 + You should have received a copy of the GNU General Public License along
36757 + with this program; if not, write to the Free Software Foundation, Inc.,
36758 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
36759 +:>
36760 +*/
36761 +/*
36762 + ***************************************************************************
36763 + * File Name  : bcm63xx_flash.c
36764 + *
36765 + * Description: This file contains the flash device driver APIs for bcm63xx board. 
36766 + *
36767 + * Created on :  8/10/2002  seanl:  use cfiflash.c, cfliflash.h (AMD specific)
36768 + *
36769 + ***************************************************************************/
36770 +
36771 +
36772 +/* Includes. */
36773 +#include <linux/fs.h>
36774 +#include <linux/capability.h>
36775 +#include <linux/slab.h>
36776 +#include <linux/errno.h>
36777 +#include <linux/module.h>
36778 +#include <asm/uaccess.h>
36779 +
36780 +#include <bcm_map_part.h>
36781 +#include <board.h>
36782 +#define  BCMTAG_EXE_USE
36783 +#include <bcmTag.h>
36784 +#include "cfiflash.h"
36785 +#include "boardparms.h"
36786 +
36787 +//#define DEBUG_FLASH
36788 +
36789 +static FLASH_ADDR_INFO fInfo;
36790 +static int flashInitialized = 0;
36791 +
36792 +void *retriedKmalloc(size_t size)
36793 +{
36794 +       void *pBuf;
36795 +    int tryCount = 0;
36796 +
36797 +    // try 1000 times before quit
36798 +    while (((pBuf = kmalloc(size, GFP_KERNEL)) == NULL) && (tryCount++ < 1000))
36799 +    {
36800 +               current->state   = TASK_INTERRUPTIBLE;
36801 +               schedule_timeout(HZ/10);
36802 +       }
36803 +    if (tryCount >= 1000)
36804 +        pBuf = NULL;
36805 +    else
36806 +           memset(pBuf, 0, size);
36807 +
36808 +    return pBuf;
36809 +}
36810 +
36811 +void retriedKfree(void *pBuf)
36812 +{
36813 +       kfree(pBuf);
36814 +}
36815 +
36816 +/***************************************************************************
36817 +// Function Name: getCrc32
36818 +// Description  : caculate the CRC 32 of the given data.
36819 +// Parameters   : pdata - array of data.
36820 +//                size - number of input data bytes.
36821 +//                crc - either CRC32_INIT_VALUE or previous return value.
36822 +// Returns      : crc.
36823 +****************************************************************************/
36824 +UINT32 getCrc32(byte *pdata, UINT32 size, UINT32 crc) 
36825 +{
36826 +    while (size-- > 0)
36827 +        crc = (crc >> 8) ^ Crc32_table[(crc ^ *pdata++) & 0xff];
36828 +
36829 +    return crc;
36830 +}
36831 +
36832 +// get the nvram start addr
36833 +//
36834 +unsigned long get_nvram_start_addr(void)
36835 +{
36836 +    return ((unsigned long) 
36837 +        (flash_get_memptr(fInfo.flash_nvram_start_blk) + fInfo.flash_nvram_blk_offset));
36838 +}
36839 +
36840 +// get the scratch_pad start addr
36841 +//
36842 +unsigned long get_scratch_pad_start_addr(void)
36843 +{
36844 +    return ((unsigned long) 
36845 +        (flash_get_memptr(fInfo.flash_scratch_pad_start_blk) + fInfo.flash_scratch_pad_blk_offset));
36846 +}
36847 +
36848 +
36849 +
36850 +/*  *********************************************************************
36851 +    *  kerSysImageTagGet()
36852 +    *   Get the image tag
36853 +    *  Input parameters:
36854 +    *      none
36855 +    *  Return value:
36856 +    *      point to tag -- Found
36857 +    *      NULL -- failed
36858 +    ********************************************************************* */
36859 +PFILE_TAG kerSysImageTagGet(void)
36860 +{
36861 +    int i;
36862 +    int totalBlks = flash_get_numsectors();
36863 +    UINT32 crc;
36864 +    unsigned char *sectAddr;
36865 +    PFILE_TAG pTag;
36866 +
36867 +#if defined(DEBUG_FLASH)
36868 +    printk("totalblks in tagGet=%d\n", totalBlks);
36869 +#endif
36870 +
36871 +    // start from 2nd blk, assume 1st one is always CFE
36872 +    for (i = 1; i < totalBlks; i++)
36873 +    {
36874 +        sectAddr =  flash_get_memptr((byte) i);
36875 +        crc = CRC32_INIT_VALUE;
36876 +        crc = getCrc32(sectAddr, (UINT32)TAG_LEN-TOKEN_LEN, crc);      
36877 +        pTag = (PFILE_TAG) sectAddr;
36878 +
36879 +#if defined(DEBUG_FLASH)
36880 +        printk("Check Tag crc on blk [%d]\n", i);
36881 +#endif
36882 +
36883 +        if (crc == (UINT32)(*(UINT32*)(pTag->tagValidationToken)))
36884 +            return pTag;
36885 +    }
36886 +
36887 +    return (PFILE_TAG) NULL;
36888 +}
36889 +
36890 +// Initialize the flash and fill out the fInfo structure
36891 +void kerSysFlashInit( void )
36892 +{
36893 +    int i = 0;
36894 +    int totalBlks = 0;
36895 +    int totalSize = 0;
36896 +    int startAddr = 0;
36897 +    int usedBlkSize = 0;
36898 +    NVRAM_DATA nvramData;
36899 +    UINT32 crc = CRC32_INIT_VALUE, savedCrc;
36900 +    PFILE_TAG pTag = NULL;
36901 +    unsigned long kernelEndAddr = 0;
36902 +    unsigned long spAddr = 0;
36903 +
36904 +    if (flashInitialized)
36905 +        return;
36906 +
36907 +    flashInitialized = 1;
36908 +    flash_init();
36909 +
36910 +    totalBlks = flash_get_numsectors();
36911 +    totalSize = flash_get_total_size();
36912 +
36913 +    printk("Total Flash size: %dK with %d sectors\n", totalSize/1024, totalBlks);
36914 +
36915 +    /* nvram is always at the end of flash */
36916 +    fInfo.flash_nvram_length = FLASH45_LENGTH_NVRAM;
36917 +    fInfo.flash_nvram_start_blk = 0;  /* always the first block */
36918 +    fInfo.flash_nvram_number_blk = 1; /*always fits in the first block */
36919 +    fInfo.flash_nvram_blk_offset = NVRAM_DATA_OFFSET;
36920
36921 +    // check nvram CRC
36922 +    memcpy((char *)&nvramData, (char *)get_nvram_start_addr(), sizeof(NVRAM_DATA));
36923 +    savedCrc = nvramData.ulCheckSum;
36924 +    nvramData.ulCheckSum = 0;
36925 +    crc = getCrc32((char *)&nvramData, (UINT32) sizeof(NVRAM_DATA), crc);   
36926 +
36927 +    BpSetBoardId( nvramData.szBoardId );
36928 +
36929 +    fInfo.flash_persistent_length = NVRAM_PSI_DEFAULT;
36930 +    if (savedCrc != crc)
36931 +    {
36932 +        printk("***Board is not initialized****: Using the default PSI size: %d\n",
36933 +            fInfo.flash_persistent_length);
36934 +    }
36935 +    else
36936 +    {
36937 +        unsigned long ulPsiSize;
36938 +        if( BpGetPsiSize( &ulPsiSize ) == BP_SUCCESS )
36939 +            fInfo.flash_persistent_length = ulPsiSize;
36940 +        else
36941 +        {
36942 +            printk("***Board id is not set****: Using the default PSI size: %d\n",
36943 +                fInfo.flash_persistent_length);
36944 +        }
36945 +    }
36946 +
36947 +    fInfo.flash_persistent_length *= ONEK;
36948 +    startAddr = totalSize - fInfo.flash_persistent_length;
36949 +    fInfo.flash_persistent_start_blk = flash_get_blk(startAddr+FLASH_BASE_ADDR_REG);
36950 +    fInfo.flash_persistent_number_blk = totalBlks - fInfo.flash_persistent_start_blk;
36951 +    // save abs SP address (Scratch Pad). it is before PSI 
36952 +    spAddr = startAddr - SP_MAX_LEN ;
36953 +    // find out the offset in the start_blk
36954 +    usedBlkSize = 0;
36955 +    for (i = fInfo.flash_persistent_start_blk; 
36956 +        i < (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk); i++)
36957 +    {
36958 +        usedBlkSize += flash_get_sector_size((byte) i);
36959 +    }
36960 +    fInfo.flash_persistent_blk_offset =  usedBlkSize - fInfo.flash_persistent_length;
36961 +
36962 +    // get the info for sp
36963 +    if (!(pTag = kerSysImageTagGet()))
36964 +    {
36965 +        printk("Failed to read image tag from flash\n");
36966 +        return;
36967 +    }
36968 +    kernelEndAddr = (unsigned long) simple_strtoul(pTag->kernelAddress, NULL, 10) + \
36969 +        (unsigned long) simple_strtoul(pTag->kernelLen, NULL, 10);
36970 +
36971 +    // make suer sp does not share kernel block
36972 +    fInfo.flash_scratch_pad_start_blk = flash_get_blk(spAddr+FLASH_BASE_ADDR_REG);
36973 +    if (fInfo.flash_scratch_pad_start_blk != flash_get_blk(kernelEndAddr))
36974 +    {
36975 +        fInfo.flash_scratch_pad_length = SP_MAX_LEN;
36976 +        if (fInfo.flash_persistent_start_blk == fInfo.flash_scratch_pad_start_blk)  // share blk
36977 +        {
36978 +#if 1 /* do not used scratch pad unless it's in its own sector */
36979 +            printk("Scratch pad is not used for this flash part.\n");  
36980 +            fInfo.flash_scratch_pad_length = 0;     // no sp
36981 +#else /* allow scratch pad to share a sector with another section such as PSI */
36982 +            fInfo.flash_scratch_pad_number_blk = 1;
36983 +            fInfo.flash_scratch_pad_blk_offset = fInfo.flash_persistent_blk_offset - fInfo.flash_scratch_pad_length;
36984 +#endif
36985 +        }
36986 +        else // on different blk
36987 +        {
36988 +            fInfo.flash_scratch_pad_number_blk = fInfo.flash_persistent_start_blk\
36989 +                - fInfo.flash_scratch_pad_start_blk;
36990 +            // find out the offset in the start_blk
36991 +            usedBlkSize = 0;
36992 +            for (i = fInfo.flash_scratch_pad_start_blk; 
36993 +                i < (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk); i++)
36994 +                usedBlkSize += flash_get_sector_size((byte) i);
36995 +                fInfo.flash_scratch_pad_blk_offset =  usedBlkSize - fInfo.flash_scratch_pad_length;
36996 +        }
36997 +    }
36998 +    else
36999 +    {
37000 +        printk("No flash for scratch pad!\n");  
37001 +        fInfo.flash_scratch_pad_length = 0;     // no sp
37002 +    }
37003 +
37004 +#if defined(DEBUG_FLASH)
37005 +    printk("fInfo.flash_scratch_pad_start_blk = %d\n", fInfo.flash_scratch_pad_start_blk);
37006 +    printk("fInfo.flash_scratch_pad_number_blk = %d\n", fInfo.flash_scratch_pad_number_blk);
37007 +    printk("fInfo.flash_scratch_pad_length = 0x%x\n", fInfo.flash_scratch_pad_length);
37008 +    printk("fInfo.flash_scratch_pad_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_scratch_pad_blk_offset);
37009 +
37010 +    printk("fInfo.flash_nvram_start_blk = %d\n", fInfo.flash_nvram_start_blk);
37011 +    printk("fInfo.flash_nvram_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_nvram_blk_offset);
37012 +    printk("fInfo.flash_nvram_number_blk = %d\n", fInfo.flash_nvram_number_blk);
37013 +
37014 +    printk("psi startAddr = %x\n", startAddr+FLASH_BASE_ADDR_REG);
37015 +    printk("fInfo.flash_persistent_start_blk = %d\n", fInfo.flash_persistent_start_blk);
37016 +    printk("fInfo.flash_persistent_blk_offset = 0x%x\n", (unsigned int)fInfo.flash_persistent_blk_offset);
37017 +    printk("fInfo.flash_persistent_number_blk = %d\n", fInfo.flash_persistent_number_blk);
37018 +#endif
37019 +
37020 +}
37021 +
37022 +
37023 +
37024 +/***********************************************************************
37025 + * Function Name: kerSysFlashAddrInfoGet
37026 + * Description  : Fills in a structure with information about the NVRAM
37027 + *                and persistent storage sections of flash memory.  
37028 + *                Fro physmap.c to mount the fs vol.
37029 + * Returns      : None.
37030 + ***********************************************************************/
37031 +void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info)
37032 +{
37033 +    pflash_addr_info->flash_nvram_blk_offset = fInfo.flash_nvram_blk_offset;
37034 +    pflash_addr_info->flash_nvram_length = fInfo.flash_nvram_length;
37035 +    pflash_addr_info->flash_nvram_number_blk = fInfo.flash_nvram_number_blk;
37036 +    pflash_addr_info->flash_nvram_start_blk = fInfo.flash_nvram_start_blk;
37037 +    pflash_addr_info->flash_persistent_blk_offset = fInfo.flash_persistent_blk_offset;
37038 +    pflash_addr_info->flash_persistent_length = fInfo.flash_persistent_length;
37039 +    pflash_addr_info->flash_persistent_number_blk = fInfo.flash_persistent_number_blk;
37040 +    pflash_addr_info->flash_persistent_start_blk = fInfo.flash_persistent_start_blk;
37041 +}
37042 +
37043 +
37044 +// get shared blks into *** pTempBuf *** which has to be released bye the caller!
37045 +// return: if pTempBuf != NULL, poits to the data with the dataSize of the buffer
37046 +// !NULL -- ok
37047 +// NULL  -- fail
37048 +static char *getSharedBlks(int start_blk, int end_blk)
37049 +{
37050 +    int i = 0;
37051 +    int usedBlkSize = 0;
37052 +    int sect_size = 0;
37053 +    char *pTempBuf = NULL;
37054 +    char *pBuf = NULL;
37055 +
37056 +    for (i = start_blk; i < end_blk; i++)
37057 +        usedBlkSize += flash_get_sector_size((byte) i);
37058 +
37059 +#if defined(DEBUG_FLASH)
37060 +    printk("usedBlkSize = %d\n", usedBlkSize);
37061 +#endif
37062 +
37063 +    if ((pTempBuf = (char *) retriedKmalloc(usedBlkSize)) == NULL)
37064 +    {
37065 +        printk("failed to allocate memory with size: %d\n", usedBlkSize);
37066 +        return pTempBuf;
37067 +    }
37068 +    
37069 +    pBuf = pTempBuf;
37070 +    for (i = start_blk; i < end_blk; i++)
37071 +    {
37072 +        sect_size = flash_get_sector_size((byte) i);
37073 +
37074 +#if defined(DEBUG_FLASH)
37075 +        printk("i = %d, sect_size = %d, end_blk = %d\n", i, sect_size, end_blk);
37076 +#endif
37077 +        flash_read_buf((byte)i, 0, pBuf, sect_size);
37078 +        pBuf += sect_size;
37079 +    }
37080 +    
37081 +    return pTempBuf;
37082 +}
37083 +
37084 +
37085 +
37086 +// Set the pTempBuf to flash from start_blk to end_blk
37087 +// return:
37088 +// 0 -- ok
37089 +// -1 -- fail
37090 +static int setSharedBlks(int start_blk, int end_blk, char *pTempBuf)
37091 +{
37092 +    int i = 0;
37093 +    int sect_size = 0;
37094 +    int sts = 0;
37095 +    char *pBuf = pTempBuf;
37096 +
37097 +    for (i = start_blk; i < end_blk; i++)
37098 +    {
37099 +        sect_size = flash_get_sector_size((byte) i);
37100 +        flash_sector_erase_int(i);
37101 +        if (flash_write_buf(i, 0, pBuf, sect_size) != sect_size)
37102 +        {
37103 +            printk("Error writing flash sector %d.", i);
37104 +            sts = -1;
37105 +            break;
37106 +        }
37107 +        pBuf += sect_size;
37108 +    }
37109 +
37110 +    return sts;
37111 +}
37112 +
37113 +
37114 +
37115 +/*******************************************************************************
37116 + * NVRAM functions
37117 + *******************************************************************************/
37118 +
37119 +// get nvram data
37120 +// return:
37121 +//  0 - ok
37122 +//  -1 - fail
37123 +int kerSysNvRamGet(char *string, int strLen, int offset)
37124 +{
37125 +    char *pBuf = NULL;
37126 +
37127 +    if (!flashInitialized)
37128 +        kerSysFlashInit();
37129 +
37130 +    if (strLen > FLASH45_LENGTH_NVRAM)
37131 +        return -1;
37132 +
37133 +    if ((pBuf = getSharedBlks(fInfo.flash_nvram_start_blk,
37134 +        (fInfo.flash_nvram_start_blk + fInfo.flash_nvram_number_blk))) == NULL)
37135 +        return -1;
37136 +
37137 +    // get string off the memory buffer
37138 +    memcpy(string, (pBuf + fInfo.flash_nvram_blk_offset + offset), strLen);
37139 +
37140 +    retriedKfree(pBuf);
37141 +
37142 +    return 0;
37143 +}
37144 +
37145 +
37146 +// set nvram 
37147 +// return:
37148 +//  0 - ok
37149 +//  -1 - fail
37150 +int kerSysNvRamSet(char *string, int strLen, int offset)
37151 +{
37152 +    int sts = 0;
37153 +    char *pBuf = NULL;
37154 +
37155 +    if (strLen > FLASH45_LENGTH_NVRAM)
37156 +        return -1;
37157 +
37158 +    if ((pBuf = getSharedBlks(fInfo.flash_nvram_start_blk,
37159 +        (fInfo.flash_nvram_start_blk + fInfo.flash_nvram_number_blk))) == NULL)
37160 +        return -1;
37161 +
37162 +    // set string to the memory buffer
37163 +    memcpy((pBuf + fInfo.flash_nvram_blk_offset + offset), string, strLen);
37164 +
37165 +    if (setSharedBlks(fInfo.flash_nvram_start_blk, 
37166 +        (fInfo.flash_nvram_number_blk + fInfo.flash_nvram_start_blk), pBuf) != 0)
37167 +        sts = -1;
37168 +    
37169 +    retriedKfree(pBuf);
37170 +
37171 +    return sts;
37172 +}
37173 +
37174 +
37175 +/***********************************************************************
37176 + * Function Name: kerSysEraseNvRam
37177 + * Description  : Erase the NVRAM storage section of flash memory.
37178 + * Returns      : 1 -- ok, 0 -- fail
37179 + ***********************************************************************/
37180 +int kerSysEraseNvRam(void)
37181 +{
37182 +    int sts = 1;
37183 +    char *tempStorage = retriedKmalloc(FLASH45_LENGTH_NVRAM);
37184 +    
37185 +    // just write the whole buf with '0xff' to the flash
37186 +    if (!tempStorage)
37187 +        sts = 0;
37188 +    else
37189 +    {
37190 +        memset(tempStorage, 0xff, FLASH45_LENGTH_NVRAM);
37191 +        if (kerSysNvRamSet(tempStorage, FLASH45_LENGTH_NVRAM, 0) != 0)
37192 +            sts = 0;
37193 +        retriedKfree(tempStorage);
37194 +    }
37195 +
37196 +    return sts;
37197 +}
37198 +
37199 +
37200 +/*******************************************************************************
37201 + * PSI functions
37202 + *******************************************************************************/
37203 +// get psi data
37204 +// return:
37205 +//  0 - ok
37206 +//  -1 - fail
37207 +int kerSysPersistentGet(char *string, int strLen, int offset)
37208 +{
37209 +    char *pBuf = NULL;
37210 +
37211 +    if (strLen > fInfo.flash_persistent_length)
37212 +        return -1;
37213 +
37214 +    if ((pBuf = getSharedBlks(fInfo.flash_persistent_start_blk,
37215 +        (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk))) == NULL)
37216 +        return -1;
37217 +
37218 +    // get string off the memory buffer
37219 +    memcpy(string, (pBuf + fInfo.flash_persistent_blk_offset + offset), strLen);
37220 +
37221 +    retriedKfree(pBuf);
37222 +
37223 +    return 0;
37224 +}
37225 +
37226 +
37227 +// set psi 
37228 +// return:
37229 +//  0 - ok
37230 +//  -1 - fail
37231 +int kerSysPersistentSet(char *string, int strLen, int offset)
37232 +{
37233 +    int sts = 0;
37234 +    char *pBuf = NULL;
37235 +
37236 +    if (strLen > fInfo.flash_persistent_length)
37237 +        return -1;
37238 +
37239 +    if ((pBuf = getSharedBlks(fInfo.flash_persistent_start_blk,
37240 +        (fInfo.flash_persistent_start_blk + fInfo.flash_persistent_number_blk))) == NULL)
37241 +        return -1;
37242 +
37243 +    // set string to the memory buffer
37244 +    memcpy((pBuf + fInfo.flash_persistent_blk_offset + offset), string, strLen);
37245 +
37246 +    if (setSharedBlks(fInfo.flash_persistent_start_blk, 
37247 +        (fInfo.flash_persistent_number_blk + fInfo.flash_persistent_start_blk), pBuf) != 0)
37248 +        sts = -1;
37249 +    
37250 +    retriedKfree(pBuf);
37251 +
37252 +    return sts;
37253 +}
37254 +
37255 +
37256 +// flash bcm image 
37257 +// return: 
37258 +// 0 - ok
37259 +// !0 - the sector number fail to be flashed (should not be 0)
37260 +int kerSysBcmImageSet( int flash_start_addr, char *string, int size)
37261 +{
37262 +    int sts;
37263 +    int sect_size;
37264 +    int blk_start;
37265 +    int i;
37266 +    char *pTempBuf = NULL;
37267 +    int whole_image = 0;
37268 +
37269 +    blk_start = flash_get_blk(flash_start_addr);
37270 +    if( blk_start < 0 )
37271 +        return( -1 );
37272 +
37273 +    if (flash_start_addr == FLASH_BASE && size > FLASH45_LENGTH_BOOT_ROM)
37274 +        whole_image = 1;
37275 +
37276 +   /* write image to flash memory */
37277 +    do 
37278 +    {
37279 +        sect_size = flash_get_sector_size(blk_start);
37280 +// NOTE: for memory problem in multiple PVC configuration, temporary get rid of kmalloc this 64K for now.
37281 +//        if ((pTempBuf = (char *)retriedKmalloc(sect_size)) == NULL)
37282 +//        {
37283 +//            printk("Failed to allocate memory with size: %d.  Reset the router...\n", sect_size);
37284 +//            kerSysMipsSoftReset();     // reset the board right away.
37285 +//        }
37286 +        // for whole image, no check on psi
37287 +        if (!whole_image && blk_start == fInfo.flash_persistent_start_blk)  // share the blk with psi
37288 +        {
37289 +            if (size > (sect_size - fInfo.flash_persistent_length))
37290 +            {
37291 +                printk("Image is too big\n");
37292 +                break;          // image is too big. Can not overwrite to nvram
37293 +            }
37294 +            if ((pTempBuf = (char *)retriedKmalloc(sect_size)) == NULL)
37295 +            {
37296 +               printk("Failed to allocate memory with size: %d.  Reset the router...\n", sect_size);
37297 +               kerSysMipsSoftReset();     // reset the board right away.
37298 +            }
37299 +            flash_read_buf((byte)blk_start, 0, pTempBuf, sect_size);
37300 +            if (copy_from_user((void *)pTempBuf,(void *)string, size) != 0)
37301 +                break;  // failed ?
37302 +            flash_sector_erase_int(blk_start);     // erase blk before flash
37303 +            if (flash_write_buf(blk_start, 0, pTempBuf, sect_size) == sect_size) 
37304 +                size = 0;   // break out and say all is ok
37305 +            retriedKfree(pTempBuf);
37306 +            break;
37307 +        }
37308 +        
37309 +        flash_sector_erase_int(blk_start);     // erase blk before flash
37310 +
37311 +        if (sect_size > size) 
37312 +        {
37313 +            if (size & 1) 
37314 +                size++;
37315 +            sect_size = size;
37316 +        }
37317 +        
37318 +        if ((i = flash_write_buf(blk_start, 0, string, sect_size)) != sect_size) {
37319 +            break;
37320 +        }
37321 +        blk_start++;
37322 +        string += sect_size;
37323 +        size -= sect_size; 
37324 +    } while (size > 0);
37325 +
37326 +    if (whole_image)  
37327 +    {
37328 +        // If flashing a whole image, erase to end of flash.
37329 +        int total_blks = flash_get_numsectors();
37330 +        while( blk_start < total_blks )
37331 +        {
37332 +            flash_sector_erase_int(blk_start);
37333 +            blk_start++;
37334 +        }
37335 +    }
37336 +    if (pTempBuf)
37337 +        retriedKfree(pTempBuf);
37338 +
37339 +    if( size == 0 ) 
37340 +        sts = 0;  // ok
37341 +    else  
37342 +        sts = blk_start;    // failed to flash this sector
37343 +
37344 +    return sts;
37345 +}
37346 +
37347 +/*******************************************************************************
37348 + * SP functions
37349 + *******************************************************************************/
37350 +// get sp data.  NOTE: memcpy work here -- not using copy_from/to_user
37351 +// return:
37352 +//  0 - ok
37353 +//  -1 - fail
37354 +int kerSysScratchPadGet(char *tokenId, char *tokBuf, int bufLen)
37355 +{
37356 +    PSP_HEADER pHead = NULL;
37357 +    PSP_TOKEN pToken = NULL;
37358 +    char *pBuf = NULL;
37359 +    char *pShareBuf = NULL;
37360 +    char *startPtr = NULL;
37361 +    char *endPtr = NULL;
37362 +    char *spEndPtr = NULL;
37363 +    int sts = -1;
37364 +
37365 +    if (fInfo.flash_scratch_pad_length == 0)
37366 +        return sts;
37367 +
37368 +    if (bufLen >= (fInfo.flash_scratch_pad_length - sizeof(SP_HEADER) - sizeof(SP_TOKEN))) 
37369 +    {
37370 +        printk("Exceed scratch pad space by %d\n", bufLen  - fInfo.flash_scratch_pad_length \
37371 +            - sizeof(SP_HEADER) - sizeof(SP_TOKEN));
37372 +        return sts;
37373 +    }
37374 +
37375 +    if ((pShareBuf = getSharedBlks(fInfo.flash_scratch_pad_start_blk,
37376 +        (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk))) == NULL)
37377 +        return sts;
37378 +
37379 +    // pBuf points to SP buf
37380 +    pBuf = pShareBuf + fInfo.flash_scratch_pad_blk_offset;  
37381 +
37382 +    pHead = (PSP_HEADER) pBuf;
37383 +    if (memcmp(pHead->SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN) != 0) 
37384 +    {
37385 +        printk("Scrap pad is not initialized.\n");
37386 +        return sts;
37387 +    }
37388 +
37389 +    // search up to SPUsedLen for the token
37390 +    startPtr = pBuf + sizeof(SP_HEADER);
37391 +    endPtr = pBuf + pHead->SPUsedLen;
37392 +    spEndPtr = pBuf + SP_MAX_LEN;
37393 +    while (startPtr < endPtr && startPtr < spEndPtr)
37394 +    {
37395 +        pToken = (PSP_TOKEN) startPtr;
37396 +        if (strncmp(pToken->tokenName, tokenId, TOKEN_NAME_LEN) == 0)
37397 +        {
37398 +            memcpy(tokBuf, startPtr + sizeof(SP_TOKEN), bufLen);
37399 +            sts = 0;
37400 +            break;
37401 +        }
37402 +        // get next token
37403 +        startPtr += sizeof(SP_TOKEN) + pToken->tokenLen;
37404 +    }
37405 +
37406 +    retriedKfree(pShareBuf);
37407 +
37408 +    return sts;
37409 +}
37410 +
37411 +
37412 +// set sp.  NOTE: memcpy work here -- not using copy_from/to_user
37413 +// return:
37414 +//  0 - ok
37415 +//  -1 - fail
37416 +int kerSysScratchPadSet(char *tokenId, char *tokBuf, int bufLen)
37417 +{
37418 +    PSP_TOKEN pToken = NULL;
37419 +    PSP_HEADER pHead = NULL;
37420 +    char *pShareBuf = NULL;
37421 +    char *pBuf = NULL;
37422 +    SP_HEADER SPHead;
37423 +    SP_TOKEN SPToken;
37424 +    char *curPtr;
37425 +    int sts = -1;
37426 +
37427 +    if (fInfo.flash_scratch_pad_length == 0)
37428 +        return sts;
37429 +
37430 +    if (bufLen >= (fInfo.flash_scratch_pad_length - sizeof(SP_HEADER) - sizeof(SP_TOKEN))) 
37431 +    {
37432 +        printk("Exceed scratch pad space by %d\n", bufLen  - fInfo.flash_scratch_pad_length \
37433 +            - sizeof(SP_HEADER) - sizeof(SP_TOKEN));
37434 +        return sts;
37435 +    }
37436 +
37437 +    if ((pShareBuf = getSharedBlks(fInfo.flash_scratch_pad_start_blk,
37438 +        (fInfo.flash_scratch_pad_start_blk + fInfo.flash_scratch_pad_number_blk))) == NULL)
37439 +        return sts;
37440 +
37441 +    // pBuf points to SP buf
37442 +    pBuf = pShareBuf + fInfo.flash_scratch_pad_blk_offset;  
37443 +    pHead = (PSP_HEADER) pBuf;
37444 +
37445 +    // form header info.  SPUsedLen later on...
37446 +    memset((char *)&SPHead, 0, sizeof(SP_HEADER));
37447 +    memcpy(SPHead.SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN);
37448 +    SPHead.SPVersion = SP_VERSION;
37449 +
37450 +    // form token info.
37451 +    memset((char*)&SPToken, 0, sizeof(SP_TOKEN));
37452 +    strncpy(SPToken.tokenName, tokenId, TOKEN_NAME_LEN - 1);
37453 +    SPToken.tokenLen = bufLen;
37454 +    if (memcmp(pHead->SPMagicNum, MAGIC_NUMBER, MAGIC_NUM_LEN) != 0) 
37455 +    {
37456 +        // new sp, so just flash the token
37457 +        printk("No Scrap pad found.  Initialize scratch pad...\n");
37458 +        SPHead.SPUsedLen = sizeof(SP_HEADER) + sizeof(SP_TOKEN) + bufLen;
37459 +        memcpy(pBuf, (char *)&SPHead, sizeof(SP_HEADER));
37460 +        curPtr = pBuf + sizeof(SP_HEADER);
37461 +        memcpy(curPtr, (char *)&SPToken, sizeof(SP_TOKEN));
37462 +        curPtr += sizeof(SP_TOKEN);
37463 +        memcpy(curPtr, tokBuf, bufLen);
37464 +    }
37465 +    else  
37466 +    {
37467 +        // need search for the token, if exist with same size overwrite it. if sizes differ, 
37468 +        // move over the later token data over and put the new one at the end
37469 +        char *endPtr = pBuf + pHead->SPUsedLen;
37470 +        char *spEndPtr = pBuf + SP_MAX_LEN;
37471 +        curPtr = pBuf + sizeof(SP_HEADER);
37472 +        while (curPtr < endPtr && curPtr < spEndPtr)
37473 +        {
37474 +            pToken = (PSP_TOKEN) curPtr;
37475 +            if (strncmp(pToken->tokenName, tokenId, TOKEN_NAME_LEN) == 0)
37476 +            {
37477 +                if (pToken->tokenLen == bufLen) // overwirte it
37478 +                {
37479 +                    memcpy((curPtr+sizeof(SP_TOKEN)), tokBuf, bufLen);
37480 +                    break;
37481 +                }
37482 +                else // move later data over and put the new token at the end
37483 +                {
37484 +                    memcpy((curPtr+sizeof(SP_TOKEN)), tokBuf, bufLen);  // ~~~
37485 +                    break;
37486 +                }
37487 +            }
37488 +            else // not same token ~~~
37489 +            {
37490 +            }
37491 +            // get next token
37492 +            curPtr += sizeof(SP_TOKEN) + pToken->tokenLen;
37493 +        } // end while
37494 +        SPHead.SPUsedLen = sizeof(SP_HEADER) + sizeof(SP_TOKEN) + bufLen; // ~~~
37495 +        if (SPHead.SPUsedLen > SP_MAX_LEN)
37496 +        {
37497 +            printk("No more Scratch pad space left! Over limit by %d bytes\n", SPHead.SPUsedLen - SP_MAX_LEN);
37498 +            return sts;
37499 +        }
37500 +
37501 +    } // else if not new sp
37502 +
37503 +    sts = setSharedBlks(fInfo.flash_scratch_pad_start_blk, 
37504 +        (fInfo.flash_scratch_pad_number_blk + fInfo.flash_scratch_pad_start_blk), pShareBuf);
37505 +    
37506 +    retriedKfree(pShareBuf);
37507 +
37508 +    return sts;
37509 +
37510 +    
37511 +}
37512 +
37513 +int kerSysFlashSizeGet(void)
37514 +{
37515 +   return flash_get_total_size();
37516 +}
37517 +
37518 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_led.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_led.c
37519 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_led.c 1970-01-01 01:00:00.000000000 +0100
37520 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/bcm63xx_led.c        2006-06-26 09:07:10.000000000 +0200
37521 @@ -0,0 +1,582 @@
37522 +/*
37523 +<:copyright-gpl 
37524 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
37525
37526 + This program is free software; you can distribute it and/or modify it 
37527 + under the terms of the GNU General Public License (Version 2) as 
37528 + published by the Free Software Foundation. 
37529
37530 + This program is distributed in the hope it will be useful, but WITHOUT 
37531 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
37532 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
37533 + for more details. 
37534
37535 + You should have received a copy of the GNU General Public License along 
37536 + with this program; if not, write to the Free Software Foundation, Inc., 
37537 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
37538 +:>
37539 +*/
37540 +/***************************************************************************
37541 + * File Name  : bcm63xx_led.c
37542 + *
37543 + * Description: 
37544 + *
37545 + *    This file contains bcm963xx board led control API functions. 
37546 + *
37547 + *    To use it, do the following
37548 + *
37549 + *    1). define in the board.c the following led mappping (this is for 6345GW board):
37550 + *        const LED_MAP_PAIR cLedMapping45GW[] =
37551 + *        {   // led name     Initial state       physical pin (ledMask)
37552 + *            {kLedUsb,       kLedStateOff,       GPIO_LED_PIN_7}, 
37553 + *            {kLedAdsl,      kLedStateOff,       GPIO_LED_PIN_8},
37554 + *            {kLedPPP,       kLedStateOff,       GPIO_LED_PIN_9},    // PPP and WanData share PIN_9
37555 + *            {kLedWanData,   kLedStateOff,       GPIO_LED_PIN_9},
37556 + *            {kLedWireless,  kLedStateOff,       GPIO_LED_PIN_10},
37557 + *            {kLedEnd,       kLedStateOff,       0              } // NOTE: kLedEnd has to be at the end.
37558 + *
37559 + *    2). };To initialize led API and initial state of the leds, call the following function with the mapping 
37560 + *        pointer from the above struct
37561 + *
37562 + *        boardLedInit((PLED_MAP_PAIR) &cLedMapping45R);
37563 + *
37564 + *    3). Sample call for kernel mode:
37565 + *
37566 + *        kerSysLedCtrl(kLedAdsl, kLedStateBlinkOnce);        // kLedxxx defines in board.h
37567 + *
37568 + *    4). Sample call for user mode
37569 + *
37570 + *        sysLedCtrl(kLedAdsl, kLedStateBlinkOnce);           // kLedxxx defines in board_api.h
37571 + *
37572 + *
37573 + * Created on :  10/28/2002  seanl
37574 + *
37575 + ***************************************************************************/
37576 +
37577 +/* Includes. */
37578 +#include <linux/init.h>
37579 +#include <linux/fs.h>
37580 +#include <linux/capability.h>
37581 +#include <linux/slab.h>
37582 +#include <linux/errno.h>
37583 +#include <linux/module.h>
37584 +#include <linux/netdevice.h>
37585 +#include <asm/uaccess.h>
37586 +
37587 +#include <bcm_map_part.h>
37588 +#include <board.h>
37589 +
37590 +#define k100ms              (HZ / 10)     // ~100 ms
37591 +#define kFastBlinkCount     0             // ~100ms
37592 +#define kSlowBlinkCount     5             // ~600ms
37593 +
37594 +#define MAX_VIRT_LEDS       12
37595 +
37596 +// uncomment // for debug led
37597 +//#define DEBUG_LED
37598 +
37599 +// global variables:
37600 +struct timer_list gLedTimer;
37601 +int gTimerOn = FALSE;
37602 +int gLedCount = 0;
37603 +
37604 +typedef struct ledinfo
37605 +{
37606 +    unsigned short ledMask;         // mask for led: ie. giop 10 = 0x0400
37607 +    unsigned short ledActiveLow;    // GPIO bit reset to turn on LED
37608 +    unsigned short ledMaskFail;     // mask for led: ie. giop 10 = 0x0400
37609 +    unsigned short ledActiveLowFail;// GPIO bit reset to turn on LED
37610 +    BOARD_LED_STATE ledState;       // current led state
37611 +    BOARD_LED_STATE savedLedState;  // used in blink once for restore to the orignal ledState
37612 +    int blinkCountDown;             // if == 0, do blink (toggle).  Is assgined value and dec by 1 at each timer.
37613 +} LED_INFO, *PLED_INFO;
37614 +
37615 +static PLED_INFO gLed = NULL;
37616 +static PLED_INFO gpVirtLeds[MAX_VIRT_LEDS];
37617 +static HANDLE_LED_FUNC gLedHwFunc[MAX_VIRT_LEDS];
37618 +static HANDLE_LED_FUNC gLedHwFailFunc[MAX_VIRT_LEDS];
37619 +
37620 +#if 0 /* BROKEN */
37621 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
37622 +static int gLedOffInBridgeMode = 1;
37623 +#elif defined(CONFIG_BCM96345)
37624 +static int gLedOffInBridgeMode = 0;
37625 +#endif
37626 +#endif
37627 +
37628 +void ledTimerExpire(void);
37629 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed );
37630 +
37631 +//**************************************************************************************
37632 +// LED operations
37633 +//**************************************************************************************
37634 +
37635 +// turn led on and set the ledState
37636 +void ledOn(PLED_INFO pLed)
37637 +{
37638 +    if( pLed->ledMask )
37639 +    {
37640 +        GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
37641 +        if( pLed->ledActiveLow )
37642 +            GPIO->GPIOio  &= ~pLed->ledMask;    // turn on the led
37643 +        else
37644 +            GPIO->GPIOio  |= pLed->ledMask;     // turn on the led
37645 +        pLed->ledState = pLed->savedLedState = kLedStateOn;
37646 +    }
37647 +}
37648 +
37649 +
37650 +// turn led off and set the ledState
37651 +void ledOff(PLED_INFO pLed)
37652 +{
37653 +    if( pLed->ledMask )
37654 +    {
37655 +        GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
37656 +        if( pLed->ledActiveLow )
37657 +            GPIO->GPIOio  |= pLed->ledMask;     // turn off the led
37658 +        else
37659 +            GPIO->GPIOio  &= ~pLed->ledMask;    // turn off the led
37660 +        pLed->ledState = pLed->savedLedState = kLedStateOff;
37661 +    }
37662 +}
37663 +
37664 +// turn led on and set the ledState
37665 +void ledOnFail(PLED_INFO pLed)
37666 +{
37667 +    if( pLed->ledMaskFail )
37668 +    {
37669 +        GPIO->GPIODir |= pLed->ledMaskFail;     // turn on the direction bit in case was turned off by some one
37670 +        if( pLed->ledActiveLowFail )
37671 +            GPIO->GPIOio  &= ~pLed->ledMaskFail;// turn on the led
37672 +        else
37673 +            GPIO->GPIOio  |= pLed->ledMaskFail; // turn on the led
37674 +        pLed->ledState = pLed->savedLedState = kLedStateFail;
37675 +    }
37676 +}
37677 +
37678 +
37679 +// turn led off and set the ledState
37680 +void ledOffFail(PLED_INFO pLed)
37681 +{
37682 +    if( pLed->ledMaskFail )
37683 +    {
37684 +        GPIO->GPIODir |= pLed->ledMaskFail;     // turn on the direction bit in case was turned off by some one
37685 +        if( pLed->ledActiveLowFail )
37686 +            GPIO->GPIOio  |= pLed->ledMaskFail; // turn off the led
37687 +        else
37688 +            GPIO->GPIOio  &= ~pLed->ledMaskFail;// turn off the led
37689 +        pLed->ledState = pLed->savedLedState = kLedStateOff;
37690 +    }
37691 +}
37692 +
37693 +
37694 +// toggle the led and return the current ledState
37695 +BOARD_LED_STATE ledToggle(PLED_INFO pLed)
37696 +{
37697 +    GPIO->GPIODir |= pLed->ledMask;         // turn on the direction bit in case was turned off by some one
37698 +    if (GPIO->GPIOio & pLed->ledMask)
37699 +    {
37700 +        GPIO->GPIOio &= ~(pLed->ledMask);
37701 +        return( (pLed->ledActiveLow) ? kLedStateOn : kLedStateOff );
37702 +    }
37703 +    else
37704 +    {
37705 +        GPIO->GPIOio |= pLed->ledMask;
37706 +        return( (pLed->ledActiveLow) ? kLedStateOff : kLedStateOn );
37707 +    }
37708 +}   
37709 +
37710 +
37711 +// led timer.  Will return if timer is already on
37712 +void ledTimerStart(void)
37713 +{
37714 +    if (gTimerOn)
37715 +        return;
37716 +
37717 +#if defined(DEBUG_LED)
37718 +    printk("led: add_timer\n");
37719 +#endif
37720 +
37721 +    init_timer(&gLedTimer);
37722 +    gLedTimer.function = (void*)ledTimerExpire;
37723 +    gLedTimer.expires = jiffies + k100ms;        // timer expires in ~100ms
37724 +    add_timer (&gLedTimer);
37725 +    gTimerOn = TRUE;
37726 +} 
37727 +
37728 +
37729 +// led timer expire kicks in about ~100ms and perform the led operation according to the ledState and
37730 +// restart the timer according to ledState
37731 +void ledTimerExpire(void)
37732 +{
37733 +    int i;
37734 +    PLED_INFO pCurLed;
37735 +
37736 +    gTimerOn = FALSE;
37737 +
37738 +    for (i = 0, pCurLed = gLed; i < gLedCount; i++, pCurLed++)
37739 +    {
37740 +#if defined(DEBUG_LED)
37741 +        printk("led[%d]: Mask=0x%04x, State = %d, blcd=%d\n", i, pCurLed->ledMask, pCurLed->ledState, pCurLed->blinkCountDown);
37742 +#endif
37743 +        switch (pCurLed->ledState)
37744 +        {
37745 +            case kLedStateOn:
37746 +            case kLedStateOff:
37747 +            case kLedStateFail:
37748 +                pCurLed->blinkCountDown = 0;            // reset the blink count down
37749 +                break;
37750 +
37751 +            case kLedStateBlinkOnce:
37752 +                ledToggle(pCurLed);
37753 +                pCurLed->blinkCountDown = 0;                      // reset to 0
37754 +                pCurLed->ledState = pCurLed->savedLedState;
37755 +                if (pCurLed->ledState == kLedStateSlowBlinkContinues || 
37756 +                    pCurLed->ledState == kLedStateFastBlinkContinues)
37757 +                    ledTimerStart();                  // start timer if in blinkContinues stats
37758 +                break;
37759 +
37760 +            case kLedStateSlowBlinkContinues:
37761 +                if (pCurLed->blinkCountDown-- == 0)
37762 +                {
37763 +                    pCurLed->blinkCountDown = kSlowBlinkCount;
37764 +                    ledToggle(pCurLed);
37765 +                }
37766 +                ledTimerStart();
37767 +                break;
37768 +
37769 +            case kLedStateFastBlinkContinues:
37770 +                if (pCurLed->blinkCountDown-- == 0)
37771 +                {
37772 +                    pCurLed->blinkCountDown = kFastBlinkCount;
37773 +                    ledToggle(pCurLed);
37774 +                }
37775 +                ledTimerStart();
37776 +                break;
37777 +
37778 +            default:
37779 +                printk("Invalid state = %d\n", pCurLed->ledState);
37780 +        }
37781 +    }
37782 +}
37783 +
37784 +// initialize the gLedCount and allocate and fill gLed struct
37785 +void __init boardLedInit(PLED_MAP_PAIR cLedMapping)
37786 +{
37787 +    PLED_MAP_PAIR p1, p2;
37788 +    PLED_INFO pCurLed;
37789 +    int needTimer = FALSE;
37790 +    int alreadyUsed = 0;
37791 +
37792 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
37793 +    /* Set blink rate for BCM6348/BCM6338 hardware LEDs. */
37794 +    GPIO->LEDCtrl &= ~LED_INTERVAL_SET_MASK;
37795 +    GPIO->LEDCtrl |= LED_INTERVAL_SET_80MS;
37796 +#endif
37797 +
37798 +    memset( gpVirtLeds, 0x00, sizeof(gpVirtLeds) );
37799 +    memset( gLedHwFunc, 0x00, sizeof(gLedHwFunc) );
37800 +    memset( gLedHwFailFunc, 0x00, sizeof(gLedHwFailFunc) );
37801 +
37802 +    gLedCount = 0;
37803 +
37804 +    // Check for multiple LED names and multiple LED GPIO pins that share the
37805 +    // same physical board LED.
37806 +    for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
37807 +    {
37808 +        alreadyUsed = 0;
37809 +        for( p2 = cLedMapping; p2 != p1; p2++ )
37810 +        {
37811 +            if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
37812 +                (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
37813 +            {
37814 +                alreadyUsed = 1;
37815 +                break;
37816 +            }
37817 +        }
37818 +
37819 +        if( alreadyUsed == 0  )
37820 +            gLedCount++;
37821 +    }
37822 +
37823 +    gLed = (PLED_INFO) kmalloc((gLedCount * sizeof(LED_INFO)), GFP_KERNEL);
37824 +    if( gLed == NULL )
37825 +    {
37826 +        printk( "LED memory allocation error.\n" );
37827 +        return;
37828 +    }
37829 +
37830 +    memset( gLed, 0x00, gLedCount * sizeof(LED_INFO) );
37831 +
37832 +    // initial the gLed with unique ledMask and initial state. If more than 1 ledNames share the physical led 
37833 +    // (ledMask) the first defined led's ledInitState will be used.
37834 +    pCurLed = gLed;
37835 +    for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
37836 +    {
37837 +        if( (int) p1->ledName > MAX_VIRT_LEDS )
37838 +            continue;
37839 +
37840 +        alreadyUsed = 0;
37841 +        for( p2 = cLedMapping; p2 != p1; p2++ )
37842 +        {
37843 +            if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
37844 +                (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
37845 +            {
37846 +                alreadyUsed = 1;
37847 +                break;
37848 +            }
37849 +        }
37850 +
37851 +        if( alreadyUsed == 0 )
37852 +        {
37853 +            // Initialize the board LED for the first time.
37854 +            needTimer = initLedInfo( p1, pCurLed );
37855 +            gpVirtLeds[(int) p1->ledName] = pCurLed;
37856 +            pCurLed++;
37857 +        }
37858 +        else
37859 +        {
37860 +            PLED_INFO pLed;
37861 +            for( pLed = gLed; pLed != pCurLed; pLed++ )
37862 +            {
37863 +                // Find the LED_INFO structure that has already been initialized.
37864 +                if((pLed->ledMask && pLed->ledMask == p1->ledMask) ||
37865 +                   (pLed->ledMaskFail && pLed->ledMaskFail==p1->ledMaskFail))
37866 +                {
37867 +                    // The board LED has already been initialized but possibly
37868 +                    // not completely initialized.
37869 +                    if( p1->ledMask )
37870 +                    {
37871 +                        pLed->ledMask = p1->ledMask;
37872 +                        pLed->ledActiveLow = p1->ledActiveLow;
37873 +                    }
37874 +                    if( p1->ledMaskFail )
37875 +                    {
37876 +                        pLed->ledMaskFail = p1->ledMaskFail;
37877 +                        pLed->ledActiveLowFail = p1->ledActiveLowFail;
37878 +                    }
37879 +                    gpVirtLeds[(int) p1->ledName] = pLed;
37880 +                    break;
37881 +                }
37882 +            }
37883 +        }
37884 +    }
37885 +
37886 +    if (needTimer)
37887 +        ledTimerStart();
37888 +
37889 +#if defined(DEBUG_LED)
37890 +    int i;
37891 +    for (i=0; i < gLedCount; i++)
37892 +        printk("initLed: led[%d]: mask=0x%04x, state=%d\n", i,(gLed+i)->ledMask, (gLed+i)->ledState);
37893 +#endif
37894 +
37895 +}
37896 +
37897 +// Initialize a structure that contains information about a physical board LED
37898 +// control.  The board LED may contain more than one GPIO pin to control a
37899 +// normal condition (green) or a failure condition (red).
37900 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed )
37901 +{
37902 +    int needTimer = FALSE;
37903 +    pCurLed->ledState = pCurLed->savedLedState = pCurMap->ledInitState;
37904 +    pCurLed->ledMask = pCurMap->ledMask;
37905 +    pCurLed->ledActiveLow = pCurMap->ledActiveLow;
37906 +    pCurLed->ledMaskFail = pCurMap->ledMaskFail;
37907 +    pCurLed->ledActiveLowFail = pCurMap->ledActiveLowFail;
37908 +
37909 +    switch (pCurLed->ledState)
37910 +    {
37911 +        case kLedStateOn:
37912 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
37913 +            ledOn(pCurLed);
37914 +            break;
37915 +        case kLedStateOff:
37916 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
37917 +            ledOff(pCurLed);
37918 +            break;
37919 +        case kLedStateFail:
37920 +            pCurLed->blinkCountDown = 0;            // reset the blink count down
37921 +            ledOnFail(pCurLed);
37922 +            break;
37923 +        case kLedStateBlinkOnce:
37924 +            pCurLed->blinkCountDown = 1;
37925 +            needTimer = TRUE;
37926 +            break;
37927 +        case kLedStateSlowBlinkContinues:
37928 +            pCurLed->blinkCountDown = kSlowBlinkCount;
37929 +            needTimer = TRUE;
37930 +            break;
37931 +        case kLedStateFastBlinkContinues:
37932 +            pCurLed->blinkCountDown = kFastBlinkCount;
37933 +            needTimer = TRUE;
37934 +            break;
37935 +        default:
37936 +            printk("Invalid state = %d\n", pCurLed->ledState);
37937 +    }
37938 +
37939 +    return( needTimer );
37940 +}
37941 +
37942 +#if 0 /* BROKEN */
37943 +// Determines if there is at least one interface in bridge mode.  Bridge mode
37944 +// is determined by the cfm convention of naming bridge interfaces nas17
37945 +// through nas24.
37946 +static int isBridgedProtocol(void)
37947 +{
37948 +    extern int dev_get(const char *name);
37949 +    const int firstBridgeId = 17;
37950 +    const int lastBridgeId = 24;
37951 +    int i;
37952 +    int ret = FALSE;
37953 +    char name[16];
37954 +
37955 +    for( i = firstBridgeId; i <= lastBridgeId; i++ )
37956 +    {
37957 +        sprintf( name, "nas%d", i );
37958 +
37959 +        if( dev_get(name) )
37960 +        {
37961 +            ret = TRUE;
37962 +            break;
37963 +        }
37964 +    }
37965 +
37966 +    return(ret);
37967 +}
37968 +#endif
37969 +
37970 +// led ctrl.  Maps the ledName to the corresponding ledInfoPtr and perform the led operation
37971 +void boardLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
37972 +{
37973 +    PLED_INFO ledInfoPtr;
37974 +
37975 +    // do the mapping from virtual to physical led
37976 +    if( (int) ledName < MAX_VIRT_LEDS )
37977 +        ledInfoPtr = gpVirtLeds[(int) ledName];
37978 +    else
37979 +        ledInfoPtr = NULL;
37980 +
37981 +    if (ledInfoPtr == NULL)
37982 +        return;
37983 +
37984 +    if( ledState != kLedStateFail && gLedHwFunc[(int) ledName] )
37985 +    {
37986 +        (*gLedHwFunc[(int) ledName]) (ledName, ledState);
37987 +        ledOffFail(ledInfoPtr);
37988 +        return;
37989 +    }
37990 +    else
37991 +        if( ledState == kLedStateFail && gLedHwFailFunc[(int) ledName] )
37992 +        {
37993 +            (*gLedHwFailFunc[(int) ledName]) (ledName, ledState);
37994 +            ledOff(ledInfoPtr);
37995 +            return;
37996 +        }
37997 +
37998 +#if 0 /* BROKEN */
37999 +    // Do not blink the WAN Data LED if at least one interface is in bridge mode.
38000 +    if(gLedOffInBridgeMode == 1 && (ledName == kLedWanData || ledName == kLedPPP))
38001 +    {
38002 +        static int BridgedProtocol = -1;
38003 +
38004 +        if( BridgedProtocol == -1 )
38005 +            BridgedProtocol = isBridgedProtocol();
38006 +
38007 +        if( BridgedProtocol == TRUE )
38008 +            return;
38009 +    }
38010 +#endif
38011 +
38012 +    // If the state is kLedStateFail and there is not a failure LED defined
38013 +    // in the board parameters, change the state to kLedStateFastBlinkContinues.
38014 +    if( ledState == kLedStateFail && ledInfoPtr->ledMaskFail == 0 )
38015 +        ledState = kLedStateFastBlinkContinues;
38016 +
38017 +    switch (ledState)
38018 +    {
38019 +        case kLedStateOn:
38020 +            // First, turn off the complimentary (failure) LED GPIO.
38021 +            if( ledInfoPtr->ledMaskFail )
38022 +                ledOffFail(ledInfoPtr);
38023 +            else
38024 +                if( gLedHwFailFunc[(int) ledName] )
38025 +                    (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
38026 +
38027 +            // Next, turn on the specified LED GPIO.
38028 +            ledOn(ledInfoPtr);
38029 +            break;
38030 +
38031 +        case kLedStateOff: 
38032 +            // First, turn off the complimentary (failure) LED GPIO.
38033 +            if( ledInfoPtr->ledMaskFail )
38034 +                ledOffFail(ledInfoPtr);
38035 +            else
38036 +                if( gLedHwFailFunc[(int) ledName] )
38037 +                    (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
38038 +
38039 +            // Next, turn off the specified LED GPIO.
38040 +            ledOff(ledInfoPtr);
38041 +            break;
38042 +
38043 +        case kLedStateFail:
38044 +            // First, turn off the complimentary (normal) LED GPIO.
38045 +            if( ledInfoPtr->ledMask )
38046 +                ledOff(ledInfoPtr);
38047 +            else
38048 +                if( gLedHwFunc[(int) ledName] )
38049 +                    (*gLedHwFunc[(int) ledName]) (ledName, kLedStateOff);
38050 +
38051 +            // Next, turn on (red) the specified LED GPIO.
38052 +            ledOnFail(ledInfoPtr);
38053 +            break;
38054 +
38055 +        case kLedStateBlinkOnce:
38056 +            // skip blinkOnce if it is already in Slow/Fast blink continues state
38057 +            if (ledInfoPtr->savedLedState == kLedStateSlowBlinkContinues ||
38058 +                ledInfoPtr->savedLedState == kLedStateFastBlinkContinues)
38059 +                ;
38060 +            else
38061 +            {
38062 +                if (ledInfoPtr->blinkCountDown == 0)  // skip the call if it is 1
38063 +                {
38064 +                    ledToggle(ledInfoPtr);
38065 +                    ledInfoPtr->blinkCountDown = 1;  // it will be reset to 0 when timer expires
38066 +                    ledInfoPtr->ledState = kLedStateBlinkOnce;
38067 +                    ledTimerStart();
38068 +                }
38069 +            }
38070 +            break;
38071 +
38072 +        case kLedStateSlowBlinkContinues:
38073 +            ledInfoPtr->blinkCountDown = kSlowBlinkCount;
38074 +            ledInfoPtr->ledState = kLedStateSlowBlinkContinues;
38075 +            ledInfoPtr->savedLedState = kLedStateSlowBlinkContinues;
38076 +            ledTimerStart();
38077 +            break;
38078 +
38079 +        case kLedStateFastBlinkContinues:
38080 +            ledInfoPtr->blinkCountDown = kFastBlinkCount;
38081 +            ledInfoPtr->ledState = kLedStateFastBlinkContinues;
38082 +            ledInfoPtr->savedLedState = kLedStateFastBlinkContinues;
38083 +            ledTimerStart();
38084 +            break;
38085 +
38086 +        default:
38087 +            printk("Invalid led state\n");
38088 +    }
38089 +}
38090 +
38091 +// This function is called for an LED that is controlled by hardware.
38092 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME ledName,
38093 +    HANDLE_LED_FUNC ledHwFunc, int ledFailType )
38094 +{
38095 +    if( (int) ledName < MAX_VIRT_LEDS )
38096 +    {
38097 +        if( ledFailType == 1 )
38098 +            gLedHwFailFunc[(int) ledName] = ledHwFunc;
38099 +        else
38100 +            gLedHwFunc[(int) ledName] = ledHwFunc;
38101 +    }
38102 +}
38103 +
38104 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/board.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/board.c
38105 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/board.c       1970-01-01 01:00:00.000000000 +0100
38106 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/board.c      2006-06-26 09:07:10.000000000 +0200
38107 @@ -0,0 +1,1570 @@
38108 +/*
38109 +<:copyright-gpl 
38110 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
38111
38112 + This program is free software; you can distribute it and/or modify it 
38113 + under the terms of the GNU General Public License (Version 2) as 
38114 + published by the Free Software Foundation. 
38115
38116 + This program is distributed in the hope it will be useful, but WITHOUT 
38117 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
38118 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
38119 + for more details. 
38120
38121 + You should have received a copy of the GNU General Public License along 
38122 + with this program; if not, write to the Free Software Foundation, Inc., 
38123 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
38124 +:>
38125 +*/
38126 +/***************************************************************************
38127 + * File Name  : board.c
38128 + *
38129 + * Description: This file contains Linux character device driver entry 
38130 + *              for the board related ioctl calls: flash, get free kernel
38131 + *              page and dump kernel memory, etc.
38132 + *
38133 + * Created on :  2/20/2002  seanl:  use cfiflash.c, cfliflash.h (AMD specific)
38134 + *
38135 + ***************************************************************************/
38136 +
38137 +
38138 +/* Includes. */
38139 +#include <linux/version.h>
38140 +#include <linux/init.h>
38141 +#include <linux/fs.h>
38142 +#include <linux/interrupt.h>
38143 +#include <linux/capability.h>
38144 +#include <linux/slab.h>
38145 +#include <linux/errno.h>
38146 +#include <linux/module.h>
38147 +#include <linux/pagemap.h>
38148 +#include <asm/uaccess.h>
38149 +#include <linux/wait.h>
38150 +#include <linux/poll.h>
38151 +#include <linux/sched.h>
38152 +#include <linux/list.h>
38153 +#include <linux/if.h>
38154 +
38155 +#include <bcm_map_part.h>
38156 +#include <board.h>
38157 +#include <bcmTag.h>
38158 +#include "boardparms.h"
38159 +#include "cfiflash.h"
38160 +#include "bcm_intr.h"
38161 +#include "board.h"
38162 +#include "bcm_map_part.h"
38163 +
38164 +/* Typedefs. */
38165 +#if defined (NON_CONSECUTIVE_MAC)
38166 +// used to be the last octet. Now changed to the first 5 bits of the the forth octet
38167 +// to reduced the duplicated MAC addresses.
38168 +#define CHANGED_OCTET   3
38169 +#define SHIFT_BITS      3
38170 +#else
38171 +#define CHANGED_OCTET   1
38172 +#define SHIFT_BITS      0
38173 +#endif
38174 +
38175 +#if defined (WIRELESS)
38176 +#define SES_BTN_PRESSED 0x00000001
38177 +#define SES_EVENTS      SES_BTN_PRESSED /*OR all values if any*/
38178 +#define SES_LED_OFF     0
38179 +#define SES_LED_ON      1
38180 +#define SES_LED_BLINK   2
38181 +#endif
38182 +
38183 +typedef struct
38184 +{
38185 +    unsigned long ulId;
38186 +    char chInUse;
38187 +    char chReserved[3];
38188 +} MAC_ADDR_INFO, *PMAC_ADDR_INFO;
38189 +
38190 +typedef struct
38191 +{
38192 +    unsigned long ulSdramSize;
38193 +    unsigned long ulPsiSize;
38194 +    unsigned long ulNumMacAddrs;
38195 +    unsigned long ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
38196 +    MAC_ADDR_INFO MacAddrs[1];
38197 +} NVRAM_INFO, *PNVRAM_INFO;
38198 +
38199 +typedef struct
38200 +{
38201 +    unsigned long eventmask;    
38202 +} BOARD_IOC, *PBOARD_IOC;
38203 +
38204 +
38205 +/*Dyinggasp callback*/
38206 +typedef void (*cb_dgasp_t)(void *arg);
38207 +typedef struct _CB_DGASP__LIST
38208 +{
38209 +    struct list_head list;
38210 +    char name[IFNAMSIZ];
38211 +    cb_dgasp_t cb_dgasp_fn;
38212 +    void *context;
38213 +}CB_DGASP_LIST , *PCB_DGASP_LIST;
38214 +
38215 +
38216 +static LED_MAP_PAIR LedMapping[] =
38217 +{   // led name     Initial state       physical pin (ledMask)
38218 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
38219 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
38220 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
38221 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
38222 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},
38223 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0}, 
38224 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0}, 
38225 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0},     
38226 +    {kLedEnd,       kLedStateOff,       0, 0, 0, 0} // NOTE: kLedEnd has to be at the end.
38227 +};
38228 +
38229 +/* Externs. */
38230 +extern struct file fastcall *fget_light(unsigned int fd, int *fput_needed);
38231 +extern unsigned int nr_free_pages (void);
38232 +extern const char *get_system_type(void);
38233 +extern void kerSysFlashInit(void);
38234 +extern unsigned long get_nvram_start_addr(void);
38235 +extern unsigned long get_scratch_pad_start_addr(void);
38236 +extern unsigned long getMemorySize(void);
38237 +extern void __init boardLedInit(PLED_MAP_PAIR);
38238 +extern void boardLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
38239 +extern void kerSysLedRegisterHandler( BOARD_LED_NAME ledName,
38240 +    HANDLE_LED_FUNC ledHwFunc, int ledFailType );
38241 +
38242 +/* Prototypes. */
38243 +void __init InitNvramInfo( void );
38244 +static int board_open( struct inode *inode, struct file *filp );
38245 +static int board_ioctl( struct inode *inode, struct file *flip, unsigned int command, unsigned long arg );
38246 +static ssize_t board_read(struct file *filp,  char __user *buffer, size_t count, loff_t *ppos); 
38247 +static unsigned int board_poll(struct file *filp, struct poll_table_struct *wait);
38248 +static int board_release(struct inode *inode, struct file *filp);                        
38249 +
38250 +static BOARD_IOC* borad_ioc_alloc(void);
38251 +static void borad_ioc_free(BOARD_IOC* board_ioc);
38252 +
38253 +/* DyingGasp function prototype */
38254 +static void __init kerSysDyingGaspMapIntr(void);
38255 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
38256 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs);
38257 +#else
38258 +static unsigned int kerSysDyingGaspIsr(void);
38259 +#endif
38260 +static void __init kerSysInitDyingGaspHandler( void );
38261 +static void __exit kerSysDeinitDyingGaspHandler( void );
38262 +/* -DyingGasp function prototype - */
38263 +
38264 +
38265 +#if defined (WIRELESS)
38266 +static irqreturn_t sesBtn_isr(int irq, void *dev_id, struct pt_regs *ptregs);
38267 +static void __init sesBtn_mapGpio(void);
38268 +static void __init sesBtn_mapIntr(int context);
38269 +static unsigned int sesBtn_poll(struct file *file, struct poll_table_struct *wait);
38270 +static ssize_t sesBtn_read(struct file *file,  char __user *buffer, size_t count, loff_t *ppos);
38271 +static void __init sesLed_mapGpio(void);
38272 +static void sesLed_ctrl(int action);
38273 +static void __init ses_board_init(void);
38274 +static void __exit ses_board_deinit(void);
38275 +#endif
38276 +
38277 +static PNVRAM_INFO g_pNvramInfo = NULL;
38278 +static int g_ledInitialized = 0;
38279 +static wait_queue_head_t g_board_wait_queue;
38280 +static CB_DGASP_LIST *g_cb_dgasp_list_head = NULL;
38281 +
38282 +static int g_wakeup_monitor = 0;
38283 +static struct file *g_monitor_file = NULL;
38284 +static struct task_struct *g_monitor_task = NULL;
38285 +static unsigned int (*g_orig_fop_poll)
38286 +    (struct file *, struct poll_table_struct *) = NULL;
38287 +
38288 +static struct file_operations board_fops =
38289 +{
38290 +  open:       board_open,
38291 +  ioctl:      board_ioctl,
38292 +  poll:       board_poll,
38293 +  read:       board_read,
38294 +  release:    board_release,
38295 +};
38296 +
38297 +uint32 board_major = 0;
38298 +
38299 +#if defined (WIRELESS)
38300 +static unsigned short sesBtn_irq = BP_NOT_DEFINED;
38301 +static unsigned short sesBtn_gpio = BP_NOT_DEFINED;
38302 +static unsigned short sesLed_gpio = BP_NOT_DEFINED;
38303 +#endif
38304 +
38305 +#if defined(MODULE)
38306 +int init_module(void)
38307 +{
38308 +    return( brcm_board_init() );              
38309 +}
38310 +
38311 +void cleanup_module(void)
38312 +{
38313 +    if (MOD_IN_USE)
38314 +        printk("brcm flash: cleanup_module failed because module is in use\n");
38315 +    else
38316 +        brcm_board_cleanup();
38317 +}
38318 +#endif //MODULE 
38319 +
38320 +
38321 +
38322 +static int __init brcm_board_init( void )
38323 +{
38324 +    typedef int (*BP_LED_FUNC) (unsigned short *);
38325 +    static struct BpLedInformation
38326 +    {
38327 +        BOARD_LED_NAME ledName;
38328 +        BP_LED_FUNC bpFunc;
38329 +        BP_LED_FUNC bpFuncFail;
38330 +    } bpLedInfo[] =
38331 +    {{kLedAdsl, BpGetAdslLedGpio, BpGetAdslFailLedGpio},
38332 +     {kLedWireless, BpGetWirelessLedGpio, NULL},
38333 +     {kLedUsb, BpGetUsbLedGpio, NULL},
38334 +     {kLedHpna, BpGetHpnaLedGpio, NULL},
38335 +     {kLedWanData, BpGetWanDataLedGpio, NULL},
38336 +     {kLedPPP, BpGetPppLedGpio, BpGetPppFailLedGpio},
38337 +     {kLedVoip, BpGetVoipLedGpio, NULL},
38338 +     {kLedSes, BpGetWirelessSesLedGpio, NULL},     
38339 +     {kLedEnd, NULL, NULL}
38340 +    };
38341 +
38342 +    int ret;
38343 +        
38344 +    ret = register_chrdev(BOARD_DRV_MAJOR, "bcrmboard", &board_fops );
38345 +    if (ret < 0)
38346 +        printk( "brcm_board_init(major %d): fail to register device.\n",BOARD_DRV_MAJOR);
38347 +    else 
38348 +    {
38349 +        PLED_MAP_PAIR pLedMap = LedMapping;
38350 +        unsigned short gpio;
38351 +        struct BpLedInformation *pInfo;
38352 +
38353 +        printk("brcmboard: brcm_board_init entry\n");
38354 +        board_major = BOARD_DRV_MAJOR;
38355 +        InitNvramInfo();
38356 +
38357 +        for( pInfo = bpLedInfo; pInfo->ledName != kLedEnd; pInfo++ )
38358 +        {
38359 +            if( pInfo->bpFunc && (*pInfo->bpFunc) (&gpio) == BP_SUCCESS )
38360 +            {
38361 +                pLedMap->ledName = pInfo->ledName;
38362 +                pLedMap->ledMask = GPIO_NUM_TO_MASK(gpio);
38363 +                pLedMap->ledActiveLow = (gpio & BP_ACTIVE_LOW) ? 1 : 0;
38364 +            }
38365 +            if( pInfo->bpFuncFail && (*pInfo->bpFuncFail) (&gpio) == BP_SUCCESS )
38366 +            {
38367 +                pLedMap->ledName = pInfo->ledName;
38368 +                pLedMap->ledMaskFail = GPIO_NUM_TO_MASK(gpio);
38369 +                pLedMap->ledActiveLowFail = (gpio & BP_ACTIVE_LOW) ? 1 : 0;
38370 +            }
38371 +            if( pLedMap->ledName != kLedEnd )
38372 +                pLedMap++;
38373 +        }
38374 +        
38375 +        init_waitqueue_head(&g_board_wait_queue);
38376 +#if defined (WIRELESS)
38377 +        ses_board_init();
38378 +#endif        
38379 +        kerSysInitDyingGaspHandler();
38380 +        kerSysDyingGaspMapIntr();
38381 +
38382 +        boardLedInit(LedMapping);
38383 +        g_ledInitialized = 1;
38384 +    }
38385 +
38386 +    return ret;
38387 +} 
38388 +
38389 +void __init InitNvramInfo( void )
38390 +{
38391 +    PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
38392 +    unsigned long ulNumMacAddrs = pNvramData->ulNumMacAddrs;
38393 +
38394 +    if( ulNumMacAddrs > 0 && ulNumMacAddrs <= NVRAM_MAC_COUNT_MAX )
38395 +    {
38396 +        unsigned long ulNvramInfoSize =
38397 +            sizeof(NVRAM_INFO) + ((sizeof(MAC_ADDR_INFO) - 1) * ulNumMacAddrs);
38398 +
38399 +        g_pNvramInfo = (PNVRAM_INFO) kmalloc( ulNvramInfoSize, GFP_KERNEL );
38400 +
38401 +        if( g_pNvramInfo )
38402 +        {
38403 +            unsigned long ulPsiSize;
38404 +            if( BpGetPsiSize( &ulPsiSize ) != BP_SUCCESS )
38405 +                ulPsiSize = NVRAM_PSI_DEFAULT;
38406 +            memset( g_pNvramInfo, 0x00, ulNvramInfoSize );
38407 +            g_pNvramInfo->ulPsiSize = ulPsiSize * 1024;
38408 +            g_pNvramInfo->ulNumMacAddrs = pNvramData->ulNumMacAddrs;
38409 +            memcpy( g_pNvramInfo->ucaBaseMacAddr, pNvramData->ucaBaseMacAddr,
38410 +                NVRAM_MAC_ADDRESS_LEN );
38411 +            g_pNvramInfo->ulSdramSize = getMemorySize();
38412 +        }
38413 +        else
38414 +            printk("ERROR - Could not allocate memory for NVRAM data\n");
38415 +    }
38416 +    else
38417 +        printk("ERROR - Invalid number of MAC addresses (%ld) is configured.\n",
38418 +            ulNumMacAddrs);
38419 +}
38420 +
38421 +void __exit brcm_board_cleanup( void )
38422 +{
38423 +    printk("brcm_board_cleanup()\n");
38424 +       
38425 +    if (board_major != -1) 
38426 +    {
38427 +#if defined (WIRELESS)         
38428 +       ses_board_deinit();
38429 +#endif         
38430 +        kerSysDeinitDyingGaspHandler();
38431 +        unregister_chrdev(board_major, "board_ioctl");
38432 +    }
38433 +} 
38434 +
38435 +static BOARD_IOC* borad_ioc_alloc(void)
38436 +{
38437 +    BOARD_IOC *board_ioc =NULL;
38438 +    board_ioc = (BOARD_IOC*) kmalloc( sizeof(BOARD_IOC) , GFP_KERNEL );
38439 +    if(board_ioc)
38440 +    {
38441 +        memset(board_ioc, 0, sizeof(BOARD_IOC));
38442 +    }
38443 +    return board_ioc;
38444 +}
38445 +
38446 +static void borad_ioc_free(BOARD_IOC* board_ioc)
38447 +{
38448 +    if(board_ioc)
38449 +    {
38450 +        kfree(board_ioc);
38451 +    }  
38452 +}
38453 +
38454 +
38455 +static int board_open( struct inode *inode, struct file *filp )
38456 +{
38457 +    filp->private_data = borad_ioc_alloc();
38458 +
38459 +    if (filp->private_data == NULL)
38460 +        return -ENOMEM;
38461 +            
38462 +    return( 0 );
38463 +} 
38464 +
38465 +static int board_release(struct inode *inode, struct file *filp)
38466 +{
38467 +    BOARD_IOC *board_ioc = filp->private_data;
38468 +    
38469 +    wait_event_interruptible(g_board_wait_queue, 1);    
38470 +    borad_ioc_free(board_ioc);
38471 +
38472 +    return( 0 );
38473 +} 
38474 +
38475 +
38476 +static unsigned int board_poll(struct file *filp, struct poll_table_struct *wait)
38477 +{
38478 +    unsigned int mask = 0;
38479 +#if defined (WIRELESS)         
38480 +    BOARD_IOC *board_ioc = filp->private_data;         
38481 +#endif
38482 +       
38483 +    poll_wait(filp, &g_board_wait_queue, wait);
38484 +#if defined (WIRELESS)         
38485 +    if(board_ioc->eventmask & SES_EVENTS){
38486 +        mask |= sesBtn_poll(filp, wait);
38487 +    }                  
38488 +#endif    
38489 +
38490 +    return mask;
38491 +}
38492 +
38493 +
38494 +static ssize_t board_read(struct file *filp,  char __user *buffer, size_t count, loff_t *ppos)
38495 +{
38496 +#if defined (WIRELESS)    
38497 +    BOARD_IOC *board_ioc = filp->private_data;
38498 +    if(board_ioc->eventmask & SES_EVENTS){
38499 +       return sesBtn_read(filp, buffer, count, ppos);
38500 +    }
38501 +#endif    
38502 +    return 0;
38503 +}
38504 +
38505 +//**************************************************************************************
38506 +// Utitlities for dump memory, free kernel pages, mips soft reset, etc.
38507 +//**************************************************************************************
38508 +
38509 +/***********************************************************************
38510 + * Function Name: dumpaddr
38511 + * Description  : Display a hex dump of the specified address.
38512 + ***********************************************************************/
38513 +void dumpaddr( unsigned char *pAddr, int nLen )
38514 +{
38515 +    static char szHexChars[] = "0123456789abcdef";
38516 +    char szLine[80];
38517 +    char *p = szLine;
38518 +    unsigned char ch, *q;
38519 +    int i, j;
38520 +    unsigned long ul;
38521 +
38522 +    while( nLen > 0 )
38523 +    {
38524 +        sprintf( szLine, "%8.8lx: ", (unsigned long) pAddr );
38525 +        p = szLine + strlen(szLine);
38526 +
38527 +        for(i = 0; i < 16 && nLen > 0; i += sizeof(long), nLen -= sizeof(long))
38528 +        {
38529 +            ul = *(unsigned long *) &pAddr[i];
38530 +            q = (unsigned char *) &ul;
38531 +            for( j = 0; j < sizeof(long); j++ )
38532 +            {
38533 +                *p++ = szHexChars[q[j] >> 4];
38534 +                *p++ = szHexChars[q[j] & 0x0f];
38535 +                *p++ = ' ';
38536 +            }
38537 +        }
38538 +
38539 +        for( j = 0; j < 16 - i; j++ )
38540 +            *p++ = ' ', *p++ = ' ', *p++ = ' ';
38541 +
38542 +        *p++ = ' ', *p++ = ' ', *p++ = ' ';
38543 +
38544 +        for( j = 0; j < i; j++ )
38545 +        {
38546 +            ch = pAddr[j];
38547 +            *p++ = (ch > ' ' && ch < '~') ? ch : '.';
38548 +        }
38549 +
38550 +        *p++ = '\0';
38551 +        printk( "%s\r\n", szLine );
38552 +
38553 +        pAddr += i;
38554 +    }
38555 +    printk( "\r\n" );
38556 +} /* dumpaddr */
38557 +
38558 +
38559 +void kerSysMipsSoftReset(void)
38560 +{
38561 +#if defined(CONFIG_BCM96348)
38562 +    if (PERF->RevID == 0x634800A1) {
38563 +        typedef void (*FNPTR) (void);
38564 +        FNPTR bootaddr = (FNPTR) FLASH_BASE;
38565 +        int i;
38566 +
38567 +        /* Disable interrupts. */
38568 +        cli();
38569 +
38570 +        /* Reset all blocks. */
38571 +        PERF->BlockSoftReset &= ~BSR_ALL_BLOCKS;
38572 +        for( i = 0; i < 1000000; i++ )
38573 +            ;
38574 +        PERF->BlockSoftReset |= BSR_ALL_BLOCKS;
38575 +        /* Jump to the power on address. */
38576 +        (*bootaddr) ();
38577 +    }
38578 +    else
38579 +        PERF->pll_control |= SOFT_RESET;    // soft reset mips
38580 +#else
38581 +    PERF->pll_control |= SOFT_RESET;    // soft reset mips
38582 +#endif
38583 +}
38584 +
38585 +
38586 +int kerSysGetMacAddress( unsigned char *pucaMacAddr, unsigned long ulId )
38587 +{
38588 +    int nRet = 0;
38589 +    PMAC_ADDR_INFO pMai = NULL;
38590 +    PMAC_ADDR_INFO pMaiFreeNoId = NULL;
38591 +    PMAC_ADDR_INFO pMaiFreeId = NULL;
38592 +    unsigned long i = 0, ulIdxNoId = 0, ulIdxId = 0, shiftedIdx = 0;
38593 +
38594 +    for( i = 0, pMai = g_pNvramInfo->MacAddrs; i < g_pNvramInfo->ulNumMacAddrs;
38595 +        i++, pMai++ )
38596 +    {
38597 +        if( ulId == pMai->ulId || ulId == MAC_ADDRESS_ANY )
38598 +        {
38599 +            /* This MAC address has been used by the caller in the past. */
38600 +            memcpy( pucaMacAddr, g_pNvramInfo->ucaBaseMacAddr,
38601 +                NVRAM_MAC_ADDRESS_LEN );
38602 +            shiftedIdx = i;
38603 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
38604 +            pMai->chInUse = 1;
38605 +            pMaiFreeNoId = pMaiFreeId = NULL;
38606 +            break;
38607 +        }
38608 +        else
38609 +            if( pMai->chInUse == 0 )
38610 +            {
38611 +                if( pMai->ulId == 0 && pMaiFreeNoId == NULL )
38612 +                {
38613 +                    /* This is an available MAC address that has never been
38614 +                     * used.
38615 +                     */
38616 +                    pMaiFreeNoId = pMai;
38617 +                    ulIdxNoId = i;
38618 +                }
38619 +                else
38620 +                    if( pMai->ulId != 0 && pMaiFreeId == NULL )
38621 +                    {
38622 +                        /* This is an available MAC address that has been used
38623 +                         * before.  Use addresses that have never been used
38624 +                         * first, before using this one.
38625 +                         */
38626 +                        pMaiFreeId = pMai;
38627 +                        ulIdxId = i;
38628 +                    }
38629 +            }
38630 +    }
38631 +
38632 +    if( pMaiFreeNoId || pMaiFreeId )
38633 +    {
38634 +        /* An available MAC address was found. */
38635 +        memcpy(pucaMacAddr, g_pNvramInfo->ucaBaseMacAddr,NVRAM_MAC_ADDRESS_LEN);
38636 +        if( pMaiFreeNoId )
38637 +        {
38638 +            shiftedIdx = ulIdxNoId;
38639 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
38640 +            pMaiFreeNoId->ulId = ulId;
38641 +            pMaiFreeNoId->chInUse = 1;
38642 +        }
38643 +        else
38644 +        {
38645 +            shiftedIdx = ulIdxId;
38646 +            pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] += (shiftedIdx << SHIFT_BITS);
38647 +            pMaiFreeId->ulId = ulId;
38648 +            pMaiFreeId->chInUse = 1;
38649 +        }
38650 +    }
38651 +    else
38652 +        if( i == g_pNvramInfo->ulNumMacAddrs )
38653 +            nRet = -EADDRNOTAVAIL;
38654 +
38655 +    return( nRet );
38656 +} /* kerSysGetMacAddr */
38657 +
38658 +int kerSysReleaseMacAddress( unsigned char *pucaMacAddr )
38659 +{
38660 +    int nRet = -EINVAL;
38661 +    unsigned long ulIdx = 0;
38662 +    int idx = (pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] -
38663 +        g_pNvramInfo->ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET]);
38664 +
38665 +    // if overflow 255 (negitive), add 256 to have the correct index
38666 +    if (idx < 0)
38667 +        idx += 256;
38668 +    ulIdx = (unsigned long) (idx >> SHIFT_BITS);
38669 +
38670 +    if( ulIdx < g_pNvramInfo->ulNumMacAddrs )
38671 +    {
38672 +        PMAC_ADDR_INFO pMai = &g_pNvramInfo->MacAddrs[ulIdx];
38673 +        if( pMai->chInUse == 1 )
38674 +        {
38675 +            pMai->chInUse = 0;
38676 +            nRet = 0;
38677 +        }
38678 +    }
38679 +
38680 +    return( nRet );
38681 +} /* kerSysReleaseMacAddr */
38682 +
38683 +int kerSysGetSdramSize( void )
38684 +{
38685 +    return( (int) g_pNvramInfo->ulSdramSize );
38686 +} /* kerSysGetSdramSize */
38687 +
38688 +
38689 +void kerSysLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
38690 +{
38691 +    if (g_ledInitialized)
38692 +      boardLedCtrl(ledName, ledState);
38693 +}
38694 +
38695 +unsigned int kerSysMonitorPollHook( struct file *f, struct poll_table_struct *t)
38696 +{
38697 +    int mask = (*g_orig_fop_poll) (f, t);
38698 +
38699 +    if( g_wakeup_monitor == 1 && g_monitor_file == f )
38700 +    {
38701 +        /* If g_wakeup_monitor is non-0, the user mode application needs to
38702 +         * return from a blocking select function.  Return POLLPRI which will
38703 +         * cause the select to return with the exception descriptor set.
38704 +         */
38705 +        mask |= POLLPRI;
38706 +        g_wakeup_monitor = 0;
38707 +    }
38708 +
38709 +    return( mask );
38710 +}
38711 +
38712 +/* Put the user mode application that monitors link state on a run queue. */
38713 +void kerSysWakeupMonitorTask( void )
38714 +{
38715 +    g_wakeup_monitor = 1;
38716 +    if( g_monitor_task )
38717 +        wake_up_process( g_monitor_task );
38718 +}
38719 +
38720 +//********************************************************************************************
38721 +// misc. ioctl calls come to here. (flash, led, reset, kernel memory access, etc.)
38722 +//********************************************************************************************
38723 +static int board_ioctl( struct inode *inode, struct file *flip,
38724 +                        unsigned int command, unsigned long arg )
38725 +{
38726 +    int ret = 0;
38727 +    BOARD_IOCTL_PARMS ctrlParms;
38728 +    unsigned char ucaMacAddr[NVRAM_MAC_ADDRESS_LEN];
38729 +    int allowedSize;
38730 +
38731 +    switch (command) 
38732 +    {
38733 +        case BOARD_IOCTL_FLASH_INIT:
38734 +            // not used for now.  kerSysBcmImageInit();
38735 +            break;
38736 +
38737 +
38738 +        case BOARD_IOCTL_FLASH_WRITE:
38739 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0)
38740 +            {
38741 +                NVRAM_DATA SaveNvramData;
38742 +                PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
38743 +
38744 +                switch (ctrlParms.action)
38745 +                {
38746 +                    case SCRATCH_PAD:
38747 +                        ret = kerSysScratchPadSet(ctrlParms.string, ctrlParms.buf, ctrlParms.offset);
38748 +                        break;
38749 +
38750 +                    case PERSISTENT:
38751 +                        ret = kerSysPersistentSet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
38752 +                        break;
38753 +                
38754 +                    case NVRAM:
38755 +                        ret = kerSysNvRamSet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
38756 +                        break;
38757 +
38758 +                    case BCM_IMAGE_CFE:
38759 +                        if( ctrlParms.strLen <= 0 || ctrlParms.strLen > FLASH45_LENGTH_BOOT_ROM )
38760 +                        {
38761 +                            printk("Illegal CFE size [%d]. Size allowed: [%d]\n",
38762 +                                ctrlParms.strLen, FLASH45_LENGTH_BOOT_ROM);
38763 +                            ret = -1;
38764 +                            break;
38765 +                        }
38766 +
38767 +                        // save NVRAM data into a local structure
38768 +                        memcpy( &SaveNvramData, pNvramData, sizeof(NVRAM_DATA) );
38769 +
38770 +                        // set memory type field
38771 +                        BpGetSdramSize( (unsigned long *) &ctrlParms.string[SDRAM_TYPE_ADDRESS_OFFSET] );
38772 +
38773 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
38774 +
38775 +                        // if nvram is not valid, restore the current nvram settings
38776 +                        if( BpSetBoardId( pNvramData->szBoardId ) != BP_SUCCESS &&
38777 +                            *(unsigned long *) pNvramData == NVRAM_DATA_ID )
38778 +                        {
38779 +                            kerSysNvRamSet((char *) &SaveNvramData, sizeof(SaveNvramData), 0);
38780 +                        }
38781 +                        break;
38782 +                        
38783 +                    case BCM_IMAGE_FS:
38784 +                        allowedSize = (int) flash_get_total_size() - \
38785 +                            FLASH_RESERVED_AT_END - TAG_LEN - FLASH45_LENGTH_BOOT_ROM;
38786 +                        if( ctrlParms.strLen <= 0 || ctrlParms.strLen > allowedSize)
38787 +                        {
38788 +                            printk("Illegal root file system size [%d]. Size allowed: [%d]\n",
38789 +                                ctrlParms.strLen,  allowedSize);
38790 +                            ret = -1;
38791 +                            break;
38792 +                        }
38793 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
38794 +                        kerSysMipsSoftReset();
38795 +                        break;
38796 +
38797 +                    case BCM_IMAGE_KERNEL:  // not used for now.
38798 +                        break;
38799 +                    case BCM_IMAGE_WHOLE:
38800 +                        if(ctrlParms.strLen <= 0)
38801 +                        {
38802 +                            printk("Illegal flash image size [%d].\n", ctrlParms.strLen);
38803 +                            ret = -1;
38804 +                            break;
38805 +                        }
38806 +
38807 +                        // save NVRAM data into a local structure
38808 +                        memcpy( &SaveNvramData, pNvramData, sizeof(NVRAM_DATA) );
38809 +
38810 +                        ret = kerSysBcmImageSet(ctrlParms.offset, ctrlParms.string, ctrlParms.strLen);
38811 +
38812 +                        // if nvram is not valid, restore the current nvram settings
38813 +                        if( BpSetBoardId( pNvramData->szBoardId ) != BP_SUCCESS &&
38814 +                            *(unsigned long *) pNvramData == NVRAM_DATA_ID )
38815 +                        {
38816 +                            kerSysNvRamSet((char *) &SaveNvramData, sizeof(SaveNvramData), 0);
38817 +                        }
38818 +
38819 +                        kerSysMipsSoftReset();
38820 +                        break;
38821 +
38822 +                    default:
38823 +                        ret = -EINVAL;
38824 +                        printk("flash_ioctl_command: invalid command %d\n", ctrlParms.action);
38825 +                        break;
38826 +                }
38827 +                ctrlParms.result = ret;
38828 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38829 +            }
38830 +            else
38831 +                ret = -EFAULT;
38832 +            break;
38833 +
38834 +        case BOARD_IOCTL_FLASH_READ:
38835 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38836 +            {
38837 +                switch (ctrlParms.action)
38838 +                {
38839 +                    case SCRATCH_PAD:
38840 +                        ret = kerSysScratchPadGet(ctrlParms.string, ctrlParms.buf, ctrlParms.offset);
38841 +                        break;
38842 +
38843 +                    case PERSISTENT:
38844 +                        ret = kerSysPersistentGet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
38845 +                        break;
38846 +
38847 +                    case NVRAM:
38848 +                        ret = kerSysNvRamGet(ctrlParms.string, ctrlParms.strLen, ctrlParms.offset);
38849 +                        break;
38850 +
38851 +                    case FLASH_SIZE:
38852 +                        ret = kerSysFlashSizeGet();
38853 +                        break;
38854 +
38855 +                    default:
38856 +                        ret = -EINVAL;
38857 +                        printk("Not supported.  invalid command %d\n", ctrlParms.action);
38858 +                        break;
38859 +                }
38860 +                ctrlParms.result = ret;
38861 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38862 +            }
38863 +            else
38864 +                ret = -EFAULT;
38865 +            break;
38866 +
38867 +        case BOARD_IOCTL_GET_NR_PAGES:
38868 +            ctrlParms.result = nr_free_pages() + get_page_cache_size();
38869 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38870 +            ret = 0;
38871 +            break;
38872 +
38873 +        case BOARD_IOCTL_DUMP_ADDR:
38874 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38875 +            {
38876 +                dumpaddr( (unsigned char *) ctrlParms.string, ctrlParms.strLen );
38877 +                ctrlParms.result = 0;
38878 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38879 +                ret = 0;
38880 +            }
38881 +            else
38882 +                ret = -EFAULT;
38883 +            break;
38884 +
38885 +        case BOARD_IOCTL_SET_MEMORY:
38886 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38887 +            {
38888 +                unsigned long  *pul = (unsigned long *)  ctrlParms.string;
38889 +                unsigned short *pus = (unsigned short *) ctrlParms.string;
38890 +                unsigned char  *puc = (unsigned char *)  ctrlParms.string;
38891 +                switch( ctrlParms.strLen )
38892 +                {
38893 +                    case 4:
38894 +                        *pul = (unsigned long) ctrlParms.offset;
38895 +                        break;
38896 +                    case 2:
38897 +                        *pus = (unsigned short) ctrlParms.offset;
38898 +                        break;
38899 +                    case 1:
38900 +                        *puc = (unsigned char) ctrlParms.offset;
38901 +                        break;
38902 +                }
38903 +                dumpaddr( (unsigned char *) ctrlParms.string, sizeof(long) );
38904 +                ctrlParms.result = 0;
38905 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38906 +                ret = 0;
38907 +            }
38908 +            else
38909 +                ret = -EFAULT;
38910 +            break;
38911 +      
38912 +        case BOARD_IOCTL_MIPS_SOFT_RESET:
38913 +            kerSysMipsSoftReset();
38914 +            break;
38915 +
38916 +        case BOARD_IOCTL_LED_CTRL:
38917 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38918 +            {
38919 +                   kerSysLedCtrl((BOARD_LED_NAME)ctrlParms.strLen, (BOARD_LED_STATE)ctrlParms.offset);
38920 +                   ret = 0;
38921 +               }
38922 +            break;
38923 +
38924 +        case BOARD_IOCTL_GET_ID:
38925 +            if (copy_from_user((void*)&ctrlParms, (void*)arg,
38926 +                sizeof(ctrlParms)) == 0) 
38927 +            {
38928 +                if( ctrlParms.string )
38929 +                {
38930 +                    char *p = (char *) get_system_type();
38931 +                    if( strlen(p) + 1 < ctrlParms.strLen )
38932 +                        ctrlParms.strLen = strlen(p) + 1;
38933 +                    __copy_to_user(ctrlParms.string, p, ctrlParms.strLen);
38934 +                }
38935 +
38936 +                ctrlParms.result = 0;
38937 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
38938 +                    sizeof(BOARD_IOCTL_PARMS));
38939 +            }
38940 +            break;
38941 +
38942 +        case BOARD_IOCTL_GET_MAC_ADDRESS:
38943 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38944 +            {
38945 +                ctrlParms.result = kerSysGetMacAddress( ucaMacAddr,
38946 +                    ctrlParms.offset );
38947 +
38948 +                if( ctrlParms.result == 0 )
38949 +                {
38950 +                    __copy_to_user(ctrlParms.string, ucaMacAddr,
38951 +                        sizeof(ucaMacAddr));
38952 +                }
38953 +
38954 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
38955 +                    sizeof(BOARD_IOCTL_PARMS));
38956 +                ret = 0;
38957 +            }
38958 +            else
38959 +                ret = -EFAULT;
38960 +            break;
38961 +
38962 +        case BOARD_IOCTL_RELEASE_MAC_ADDRESS:
38963 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38964 +            {
38965 +                if (copy_from_user((void*)ucaMacAddr, (void*)ctrlParms.string, \
38966 +                     NVRAM_MAC_ADDRESS_LEN) == 0) 
38967 +                {
38968 +                    ctrlParms.result = kerSysReleaseMacAddress( ucaMacAddr );
38969 +                }
38970 +                else
38971 +                {
38972 +                    ctrlParms.result = -EACCES;
38973 +                }
38974 +
38975 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
38976 +                    sizeof(BOARD_IOCTL_PARMS));
38977 +                ret = 0;
38978 +            }
38979 +            else
38980 +                ret = -EFAULT;
38981 +            break;
38982 +
38983 +        case BOARD_IOCTL_GET_PSI_SIZE:
38984 +            ctrlParms.result = (int) g_pNvramInfo->ulPsiSize;
38985 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38986 +            ret = 0;
38987 +            break;
38988 +
38989 +        case BOARD_IOCTL_GET_SDRAM_SIZE:
38990 +            ctrlParms.result = (int) g_pNvramInfo->ulSdramSize;
38991 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
38992 +            ret = 0;
38993 +            break;
38994 +
38995 +        case BOARD_IOCTL_GET_BASE_MAC_ADDRESS:
38996 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) 
38997 +            {
38998 +                __copy_to_user(ctrlParms.string, g_pNvramInfo->ucaBaseMacAddr, NVRAM_MAC_ADDRESS_LEN);
38999 +                ctrlParms.result = 0;
39000 +
39001 +                __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,
39002 +                    sizeof(BOARD_IOCTL_PARMS));
39003 +                ret = 0;
39004 +            }
39005 +            else
39006 +                ret = -EFAULT;
39007 +            break;
39008 +
39009 +        case BOARD_IOCTL_GET_CHIP_ID:
39010 +            ctrlParms.result = (int) (PERF->RevID & 0xFFFF0000) >> 16;
39011 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
39012 +            ret = 0;
39013 +            break;
39014 +
39015 +        case BOARD_IOCTL_GET_NUM_ENET: {
39016 +            ETHERNET_MAC_INFO EnetInfos[BP_MAX_ENET_MACS];
39017 +            int i, numeth = 0;
39018 +            if (BpGetEthernetMacInfo(EnetInfos, BP_MAX_ENET_MACS) == BP_SUCCESS) {
39019 +            for( i = 0; i < BP_MAX_ENET_MACS; i++) {
39020 +                if (EnetInfos[i].ucPhyType != BP_ENET_NO_PHY) {
39021 +                numeth++;
39022 +                }
39023 +            }
39024 +            ctrlParms.result = numeth;
39025 +            __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms,         sizeof(BOARD_IOCTL_PARMS));   
39026 +            ret = 0;
39027 +            }
39028 +               else {
39029 +                   ret = -EFAULT;
39030 +               }
39031 +               break;
39032 +            }
39033 +
39034 +        case BOARD_IOCTL_GET_CFE_VER:
39035 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39036 +                char *vertag =  (char *)(FLASH_BASE + CFE_VERSION_OFFSET);
39037 +                if (ctrlParms.strLen < CFE_VERSION_SIZE) {
39038 +                    ctrlParms.result = 0;
39039 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
39040 +                    ret = -EFAULT;
39041 +                }
39042 +                else if (strncmp(vertag, "cfe-v", 5)) { // no tag info in flash
39043 +                    ctrlParms.result = 0;
39044 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
39045 +                    ret = 0;
39046 +                }
39047 +                else {
39048 +                    ctrlParms.result = 1;
39049 +                    __copy_to_user(ctrlParms.string, vertag+CFE_VERSION_MARK_SIZE, CFE_VERSION_SIZE);
39050 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));
39051 +                    ret = 0;
39052 +                }
39053 +            }
39054 +            else {
39055 +                ret = -EFAULT;
39056 +            }
39057 +            break;
39058 +
39059 +        case BOARD_IOCTL_GET_ENET_CFG:
39060 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39061 +                ETHERNET_MAC_INFO EnetInfos[BP_MAX_ENET_MACS];
39062 +                if (BpGetEthernetMacInfo(EnetInfos, BP_MAX_ENET_MACS) == BP_SUCCESS) {
39063 +                    if (ctrlParms.strLen == sizeof(EnetInfos)) {
39064 +                        __copy_to_user(ctrlParms.string, EnetInfos, sizeof(EnetInfos));
39065 +                        ctrlParms.result = 0;
39066 +                        __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
39067 +                        ret = 0;
39068 +                    } else
39069 +                           ret = -EFAULT;
39070 +                }
39071 +                   else {
39072 +                       ret = -EFAULT;
39073 +                   }
39074 +                   break;
39075 +            }
39076 +            else {
39077 +                ret = -EFAULT;
39078 +            }
39079 +            break;            
39080 +
39081 +#if defined (WIRELESS)
39082 +        case BOARD_IOCTL_GET_WLAN_ANT_INUSE:
39083 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39084 +                unsigned short antInUse = 0;
39085 +                if (BpGetWirelessAntInUse(&antInUse) == BP_SUCCESS) {
39086 +                    if (ctrlParms.strLen == sizeof(antInUse)) {
39087 +                        __copy_to_user(ctrlParms.string, &antInUse, sizeof(antInUse));
39088 +                        ctrlParms.result = 0;
39089 +                        __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
39090 +                        ret = 0;
39091 +                    } else
39092 +                           ret = -EFAULT;
39093 +                }
39094 +               else {
39095 +                  ret = -EFAULT;
39096 +               }
39097 +               break;
39098 +            }
39099 +            else {
39100 +                ret = -EFAULT;
39101 +            }
39102 +            break;            
39103 +#endif            
39104 +        case BOARD_IOCTL_SET_TRIGGER_EVENT:
39105 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {               
39106 +               BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;                 
39107 +                ctrlParms.result = -EFAULT;
39108 +                ret = -EFAULT;
39109 +                if (ctrlParms.strLen == sizeof(unsigned long)) {                                           
39110 +                    board_ioc->eventmask |= *((int*)ctrlParms.string);                    
39111 +#if defined (WIRELESS)                    
39112 +                    if((board_ioc->eventmask & SES_EVENTS)) {
39113 +                        if(sesBtn_irq != BP_NOT_DEFINED) {
39114 +                            BcmHalInterruptEnable(sesBtn_irq);
39115 +                            ctrlParms.result = 0;
39116 +                            ret = 0;
39117 +                        }                                                
39118 +                    } 
39119 +#endif                                                
39120 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));                        
39121 +                }
39122 +               break;
39123 +            }
39124 +            else {
39125 +                ret = -EFAULT;
39126 +            }
39127 +            break;                        
39128 +
39129 +        case BOARD_IOCTL_GET_TRIGGER_EVENT:
39130 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39131 +               BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;
39132 +                if (ctrlParms.strLen == sizeof(unsigned long)) {
39133 +                    __copy_to_user(ctrlParms.string, &board_ioc->eventmask, sizeof(unsigned long));
39134 +                    ctrlParms.result = 0;
39135 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
39136 +                    ret = 0;
39137 +                } else
39138 +                   ret = -EFAULT;
39139 +
39140 +               break;
39141 +            }
39142 +            else {
39143 +                ret = -EFAULT;
39144 +            }
39145 +            break;                
39146 +            
39147 +        case BOARD_IOCTL_UNSET_TRIGGER_EVENT:
39148 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39149 +                if (ctrlParms.strLen == sizeof(unsigned long)) {
39150 +                    BOARD_IOC *board_ioc = (BOARD_IOC *)flip->private_data;                    
39151 +                    board_ioc->eventmask &= (~(*((int*)ctrlParms.string)));                  
39152 +                    ctrlParms.result = 0;
39153 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
39154 +                    ret = 0;
39155 +                } else
39156 +                   ret = -EFAULT;
39157 +
39158 +               break;
39159 +            } 
39160 +            else {
39161 +                ret = -EFAULT;
39162 +            }
39163 +            break;            
39164 +#if defined (WIRELESS)
39165 +        case BOARD_IOCTL_SET_SES_LED:
39166 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39167 +                if (ctrlParms.strLen == sizeof(int)) {
39168 +                    sesLed_ctrl(*(int*)ctrlParms.string);
39169 +                    ctrlParms.result = 0;
39170 +                    __copy_to_user((BOARD_IOCTL_PARMS*)arg, &ctrlParms, sizeof(BOARD_IOCTL_PARMS));   
39171 +                    ret = 0;
39172 +                } else
39173 +                   ret = -EFAULT;
39174 +
39175 +               break;
39176 +            }
39177 +            else {
39178 +                ret = -EFAULT;
39179 +            }
39180 +            break;            
39181 +#endif                                                            
39182 +
39183 +        case BOARD_IOCTL_SET_MONITOR_FD:
39184 +            if (copy_from_user((void*)&ctrlParms, (void*)arg, sizeof(ctrlParms)) == 0) {
39185 +                int fput_needed = 0;
39186 +
39187 +                g_monitor_file = fget_light( ctrlParms.offset, &fput_needed );
39188 +                if( g_monitor_file ) {
39189 +                    /* Hook this file descriptor's poll function in order to set
39190 +                     * the exception descriptor when there is a change in link
39191 +                     * state.
39192 +                     */
39193 +                    g_monitor_task = current;
39194 +                    g_orig_fop_poll = g_monitor_file->f_op->poll;
39195 +                    g_monitor_file->f_op->poll = kerSysMonitorPollHook;
39196 +                }
39197 +            }
39198 +            break;
39199 +
39200 +        case BOARD_IOCTL_WAKEUP_MONITOR_TASK:
39201 +            kerSysWakeupMonitorTask();
39202 +            break;
39203 +
39204 +        default:
39205 +            ret = -EINVAL;
39206 +            ctrlParms.result = 0;
39207 +            printk("board_ioctl: invalid command %x, cmd %d .\n",command,_IOC_NR(command));
39208 +            break;
39209 +
39210 +  } /* switch */
39211 +
39212 +  return (ret);
39213 +
39214 +} /* board_ioctl */
39215 +
39216 +/***************************************************************************
39217 + * SES Button ISR/GPIO/LED functions.
39218 + ***************************************************************************/
39219 +#if defined (WIRELESS) 
39220 +static irqreturn_t sesBtn_isr(int irq, void *dev_id, struct pt_regs *ptregs)
39221 +{   
39222 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
39223 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39224 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39225 +#endif
39226 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
39227 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39228 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
39229 +#endif
39230 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
39231 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39232 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39233 +
39234 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
39235 +    {
39236 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
39237 +        gpio_reg = &GPIO->GPIOio_high;
39238 +    }
39239 +#endif 
39240 +               
39241 +    if (!(*gpio_reg & gpio_mask)){
39242 +        wake_up_interruptible(&g_board_wait_queue);
39243 +        return IRQ_RETVAL(1);
39244 +    } else {
39245 +        return IRQ_RETVAL(0);          
39246 +    }
39247 +}
39248 +
39249 +static void __init sesBtn_mapGpio()
39250 +{      
39251 +    if( BpGetWirelessSesBtnGpio(&sesBtn_gpio) == BP_SUCCESS )
39252 +    {
39253 +        printk("SES: Button GPIO 0x%x is enabled\n", sesBtn_gpio);    
39254 +    }
39255 +}
39256 +
39257 +static void __init sesBtn_mapIntr(int context)
39258 +{      
39259 +    if( BpGetWirelessSesExtIntr(&sesBtn_irq) == BP_SUCCESS )
39260 +    {
39261 +       printk("SES: Button Interrupt 0x%x is enabled\n", sesBtn_irq);
39262 +    }
39263 +    else
39264 +       return;
39265 +           
39266 +    sesBtn_irq += INTERRUPT_ID_EXTERNAL_0;     
39267 +               
39268 +    if (BcmHalMapInterrupt((FN_HANDLER)sesBtn_isr, context, sesBtn_irq)) {
39269 +       printk("SES: Interrupt mapping failed\n");
39270 +    }    
39271 +    BcmHalInterruptEnable(sesBtn_irq);
39272 +}
39273 +
39274 +
39275 +static unsigned int sesBtn_poll(struct file *file, struct poll_table_struct *wait)
39276 +{
39277 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
39278 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39279 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39280 +#endif
39281 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
39282 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39283 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
39284 +#endif
39285 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
39286 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39287 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39288 +
39289 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
39290 +    {
39291 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
39292 +        gpio_reg = &GPIO->GPIOio_high;
39293 +    }
39294 +#endif 
39295 +               
39296 +    if (!(*gpio_reg & gpio_mask)){
39297 +       return POLLIN;
39298 +    }  
39299 +    return 0;
39300 +}
39301 +
39302 +static ssize_t sesBtn_read(struct file *file,  char __user *buffer, size_t count, loff_t *ppos)
39303 +{
39304 +    volatile unsigned int event=0;
39305 +    ssize_t ret=0;     
39306 +
39307 +#if defined(_BCM96338_) || defined (CONFIG_BCM96338)
39308 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39309 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39310 +#endif
39311 +#if defined(_BCM96345_) || defined (CONFIG_BCM96345)
39312 +    unsigned short gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39313 +    volatile unsigned short *gpio_reg = &GPIO->GPIOio;
39314 +#endif
39315 +#if defined(_BCM96348_) || defined (CONFIG_BCM96348)
39316 +    unsigned long gpio_mask = GPIO_NUM_TO_MASK(sesBtn_gpio);
39317 +    volatile unsigned long *gpio_reg = &GPIO->GPIOio;
39318 +    
39319 +    if( (sesBtn_gpio & ~BP_ACTIVE_MASK) >= 32 )
39320 +    {
39321 +        gpio_mask = GPIO_NUM_TO_MASK_HIGH(sesBtn_gpio);
39322 +        gpio_reg = &GPIO->GPIOio_high;
39323 +    }
39324 +#endif 
39325 +
39326 +    if(*gpio_reg & gpio_mask){
39327 +       BcmHalInterruptEnable(sesBtn_irq);              
39328 +       return ret;
39329 +    }  
39330 +    event = SES_EVENTS;
39331 +    __copy_to_user((char*)buffer, (char*)&event, sizeof(event));       
39332 +    BcmHalInterruptEnable(sesBtn_irq); 
39333 +    count -= sizeof(event);
39334 +    buffer += sizeof(event);
39335 +    ret += sizeof(event);      
39336 +    return ret;        
39337 +}
39338 +
39339 +static void __init sesLed_mapGpio()
39340 +{      
39341 +    if( BpGetWirelessSesBtnGpio(&sesLed_gpio) == BP_SUCCESS )
39342 +    {
39343 +        printk("SES: LED GPIO 0x%x is enabled\n", sesBtn_gpio);    
39344 +    }
39345 +}
39346 +
39347 +static void sesLed_ctrl(int action)
39348 +{
39349 +
39350 +    //char status = ((action >> 8) & 0xff); /* extract status */
39351 +    //char event = ((action >> 16) & 0xff); /* extract event */        
39352 +    //char blinktype = ((action >> 24) & 0xff); /* extract blink type for SES_LED_BLINK  */
39353 +    
39354 +    BOARD_LED_STATE led;
39355 +    
39356 +    if(sesLed_gpio == BP_NOT_DEFINED)
39357 +        return;
39358 +       
39359 +    action &= 0xff; /* extract led */
39360 +
39361 +    //printk("blinktype=%d, event=%d, status=%d\n",(int)blinktype, (int)event, (int)status);
39362 +               
39363 +    switch (action) 
39364 +    {
39365 +        case SES_LED_ON:
39366 +            //printk("SES: led on\n");
39367 +            led = kLedStateOn;                                          
39368 +            break;
39369 +        case SES_LED_BLINK:
39370 +            //printk("SES: led blink\n");
39371 +            led = kLedStateSlowBlinkContinues;                         
39372 +            break;
39373 +        case SES_LED_OFF:
39374 +            default:
39375 +            //printk("SES: led off\n");
39376 +            led = kLedStateOff;                                                
39377 +    }  
39378 +    
39379 +    kerSysLedCtrl(kLedSes, led);
39380 +}
39381 +
39382 +static void __init ses_board_init()
39383 +{
39384 +    sesBtn_mapGpio();
39385 +    sesBtn_mapIntr(0);
39386 +    sesLed_mapGpio();
39387 +}
39388 +static void __exit ses_board_deinit()
39389 +{
39390 +    if(sesBtn_irq)
39391 +        BcmHalInterruptDisable(sesBtn_irq);
39392 +}
39393 +#endif
39394 +
39395 +/***************************************************************************
39396 + * Dying gasp ISR and functions.
39397 + ***************************************************************************/
39398 +#define KERSYS_DBG     printk
39399 +
39400 +#if defined(CONFIG_BCM96345)
39401 +#define        CYCLE_PER_US    70
39402 +#elif defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
39403 +/* The BCM6348 cycles per microsecond is really variable since the BCM6348
39404 + * MIPS speed can vary depending on the PLL settings.  However, an appoximate
39405 + * value of 120 will still work OK for the test being done.
39406 + */
39407 +#define        CYCLE_PER_US    120
39408 +#endif
39409 +#define        DG_GLITCH_TO    (100*CYCLE_PER_US)
39410
39411 +static void __init kerSysDyingGaspMapIntr()
39412 +{
39413 +    unsigned long ulIntr;
39414 +       
39415 +#if defined(CONFIG_BCM96348) || defined(_BCM96348_) || defined(CONFIG_BCM96338) || defined(_BCM96338_)
39416 +    if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
39417 +               BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, INTERRUPT_ID_DG);
39418 +               BcmHalInterruptEnable( INTERRUPT_ID_DG );
39419 +    }
39420 +#elif defined(CONFIG_BCM96345) || defined(_BCM96345_)
39421 +    if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
39422 +        ulIntr += INTERRUPT_ID_EXTERNAL_0;
39423 +        BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, ulIntr);
39424 +        BcmHalInterruptEnable( ulIntr );
39425 +    }
39426 +#endif
39427 +
39428 +} 
39429 +
39430 +void kerSysSetWdTimer(ulong timeUs)
39431 +{
39432 +       TIMER->WatchDogDefCount = timeUs * (FPERIPH/1000000);
39433 +       TIMER->WatchDogCtl = 0xFF00;
39434 +       TIMER->WatchDogCtl = 0x00FF;
39435 +}
39436 +
39437 +ulong kerSysGetCycleCount(void)
39438 +{
39439 +    ulong cnt; 
39440 +#ifdef _WIN32_WCE
39441 +    cnt = 0;
39442 +#else
39443 +    __asm volatile("mfc0 %0, $9":"=d"(cnt));
39444 +#endif
39445 +    return(cnt); 
39446 +}
39447 +
39448 +static Bool kerSysDyingGaspCheckPowerLoss(void)
39449 +{
39450 +    ulong clk0;
39451 +    ulong ulIntr;
39452 +
39453 +    ulIntr = 0;
39454 +    clk0 = kerSysGetCycleCount();
39455 +
39456 +    UART->Data = 'D';
39457 +    UART->Data = '%';
39458 +    UART->Data = 'G';
39459 +
39460 +#if defined(CONFIG_BCM96345)
39461 +    BpGetAdslDyingGaspExtIntr( &ulIntr );
39462 +
39463 +    do {
39464 +        ulong clk1;
39465 +        
39466 +        clk1 = kerSysGetCycleCount();          /* time cleared */
39467 +       /* wait a little to get new reading */
39468 +        while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
39469 +            ;
39470 +    } while ((0 == (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT)))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
39471 +
39472 +    if (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT))) {  /* power glitch */
39473 +        BcmHalInterruptEnable( ulIntr + INTERRUPT_ID_EXTERNAL_0);
39474 +        KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
39475 +        return 0;
39476 +    }
39477 +#elif (defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)) && !defined(VXWORKS)
39478 +    do {
39479 +        ulong clk1;
39480 +        
39481 +        clk1 = kerSysGetCycleCount();          /* time cleared */
39482 +       /* wait a little to get new reading */
39483 +        while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
39484 +            ;
39485 +     } while ((PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
39486 +
39487 +    if (!(PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET)))) {
39488 +        BcmHalInterruptEnable( INTERRUPT_ID_DG );
39489 +        KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
39490 +        return 0;
39491 +    }
39492 +#endif
39493 +    return 1;
39494 +}
39495 +
39496 +static void kerSysDyingGaspShutdown( void )
39497 +{
39498 +    kerSysSetWdTimer(1000000);
39499 +#if defined(CONFIG_BCM96345)
39500 +    PERF->blkEnables &= ~(EMAC_CLK_EN | USB_CLK_EN | CPU_CLK_EN);
39501 +#elif defined(CONFIG_BCM96348)
39502 +    PERF->blkEnables &= ~(EMAC_CLK_EN | USBS_CLK_EN | USBH_CLK_EN | SAR_CLK_EN);
39503 +#endif
39504 +}
39505 +
39506 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
39507 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs)
39508 +#else
39509 +static unsigned int kerSysDyingGaspIsr(void)
39510 +#endif
39511 +{      
39512 +    struct list_head *pos;
39513 +    CB_DGASP_LIST *tmp, *dsl = NULL;   
39514 +
39515 +    if (kerSysDyingGaspCheckPowerLoss()) {        
39516 +
39517 +        /* first to turn off everything other than dsl */        
39518 +        list_for_each(pos, &g_cb_dgasp_list_head->list) {      
39519 +            tmp = list_entry(pos, CB_DGASP_LIST, list);
39520 +           if(strncmp(tmp->name, "dsl", 3)) {
39521 +               (tmp->cb_dgasp_fn)(tmp->context); 
39522 +           }else {
39523 +               dsl = tmp;                      
39524 +           }       
39525 +        }  
39526 +        
39527 +        /* now send dgasp */
39528 +        if(dsl)
39529 +            (dsl->cb_dgasp_fn)(dsl->context); 
39530 +
39531 +        /* reset and shutdown system */
39532 +        kerSysDyingGaspShutdown();
39533 +    }
39534 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
39535 +return( IRQ_HANDLED );
39536 +#else
39537 +    return( 1 );
39538 +#endif
39539 +}
39540 +
39541 +static void __init kerSysInitDyingGaspHandler( void )
39542 +{
39543 +    CB_DGASP_LIST *new_node;
39544 +
39545 +    if( g_cb_dgasp_list_head != NULL) {
39546 +        printk("Error: kerSysInitDyingGaspHandler: list head is not null\n");
39547 +        return;        
39548 +    }
39549 +    new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
39550 +    memset(new_node, 0x00, sizeof(CB_DGASP_LIST));
39551 +    INIT_LIST_HEAD(&new_node->list);    
39552 +    g_cb_dgasp_list_head = new_node; 
39553 +               
39554 +} /* kerSysInitDyingGaspHandler */
39555 +
39556 +static void __exit kerSysDeinitDyingGaspHandler( void )
39557 +{
39558 +    struct list_head *pos;
39559 +    CB_DGASP_LIST *tmp; 
39560 +       
39561 +    if(g_cb_dgasp_list_head == NULL)
39562 +        return;
39563 +        
39564 +    list_for_each(pos, &g_cb_dgasp_list_head->list) {          
39565 +       tmp = list_entry(pos, CB_DGASP_LIST, list);
39566 +        list_del(pos);
39567 +       kfree(tmp);
39568 +    }       
39569 +
39570 +    kfree(g_cb_dgasp_list_head);       
39571 +    g_cb_dgasp_list_head = NULL;
39572 +    
39573 +} /* kerSysDeinitDyingGaspHandler */
39574 +
39575 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context)
39576 +{
39577 +    CB_DGASP_LIST *new_node;
39578 +
39579 +    if( g_cb_dgasp_list_head == NULL) {
39580 +        printk("Error: kerSysRegisterDyingGaspHandler: list head is null\n");  
39581 +        return;    
39582 +    }
39583 +    
39584 +    if( devname == NULL || cbfn == NULL ) {
39585 +        printk("Error: kerSysRegisterDyingGaspHandler: register info not enough (%s,%x,%x)\n", devname, (unsigned int)cbfn, (unsigned int)context);            
39586 +        return;
39587 +    }
39588 +       
39589 +    new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
39590 +    memset(new_node, 0x00, sizeof(CB_DGASP_LIST));    
39591 +    INIT_LIST_HEAD(&new_node->list);
39592 +    strncpy(new_node->name, devname, IFNAMSIZ);
39593 +    new_node->cb_dgasp_fn = (cb_dgasp_t)cbfn;
39594 +    new_node->context = context;
39595 +    list_add(&new_node->list, &g_cb_dgasp_list_head->list);
39596 +    
39597 +    printk("dgasp: kerSysRegisterDyingGaspHandler: %s registered \n", devname);
39598 +               
39599 +} /* kerSysRegisterDyingGaspHandler */
39600 +
39601 +void kerSysDeregisterDyingGaspHandler(char *devname)
39602 +{
39603 +    struct list_head *pos;
39604 +    CB_DGASP_LIST *tmp;    
39605 +    
39606 +    if(g_cb_dgasp_list_head == NULL) {
39607 +        printk("Error: kerSysDeregisterDyingGaspHandler: list head is null\n");
39608 +        return;        
39609 +    }
39610 +
39611 +    if(devname == NULL) {
39612 +        printk("Error: kerSysDeregisterDyingGaspHandler: devname is null\n");
39613 +        return;        
39614 +    }
39615 +    
39616 +    printk("kerSysDeregisterDyingGaspHandler: %s is deregistering\n", devname);
39617 +
39618 +    list_for_each(pos, &g_cb_dgasp_list_head->list) {          
39619 +       tmp = list_entry(pos, CB_DGASP_LIST, list);
39620 +       if(!strcmp(tmp->name, devname)) {
39621 +            list_del(pos);
39622 +           kfree(tmp);
39623 +           printk("kerSysDeregisterDyingGaspHandler: %s is deregistered\n", devname);
39624 +           return;
39625 +       }
39626 +    }  
39627 +    printk("kerSysDeregisterDyingGaspHandler: %s not (de)registered\n", devname);
39628 +       
39629 +} /* kerSysDeregisterDyingGaspHandler */
39630 +
39631 +/***************************************************************************
39632 + * MACRO to call driver initialization and cleanup functions.
39633 + ***************************************************************************/
39634 +module_init( brcm_board_init );
39635 +module_exit( brcm_board_cleanup );
39636 +
39637 +EXPORT_SYMBOL(kerSysNvRamGet);
39638 +EXPORT_SYMBOL(dumpaddr);
39639 +EXPORT_SYMBOL(kerSysGetMacAddress);
39640 +EXPORT_SYMBOL(kerSysReleaseMacAddress);
39641 +EXPORT_SYMBOL(kerSysGetSdramSize);
39642 +EXPORT_SYMBOL(kerSysLedCtrl);
39643 +EXPORT_SYMBOL(kerSysLedRegisterHwHandler);
39644 +EXPORT_SYMBOL(BpGetBoardIds);
39645 +EXPORT_SYMBOL(BpGetSdramSize);
39646 +EXPORT_SYMBOL(BpGetPsiSize);
39647 +EXPORT_SYMBOL(BpGetEthernetMacInfo);
39648 +EXPORT_SYMBOL(BpGetRj11InnerOuterPairGpios);
39649 +EXPORT_SYMBOL(BpGetPressAndHoldResetGpio);
39650 +EXPORT_SYMBOL(BpGetVoipResetGpio);
39651 +EXPORT_SYMBOL(BpGetVoipIntrGpio);
39652 +EXPORT_SYMBOL(BpGetPcmciaResetGpio);
39653 +EXPORT_SYMBOL(BpGetRtsCtsUartGpios);
39654 +EXPORT_SYMBOL(BpGetAdslLedGpio);
39655 +EXPORT_SYMBOL(BpGetAdslFailLedGpio);
39656 +EXPORT_SYMBOL(BpGetWirelessLedGpio);
39657 +EXPORT_SYMBOL(BpGetUsbLedGpio);
39658 +EXPORT_SYMBOL(BpGetHpnaLedGpio);
39659 +EXPORT_SYMBOL(BpGetWanDataLedGpio);
39660 +EXPORT_SYMBOL(BpGetPppLedGpio);
39661 +EXPORT_SYMBOL(BpGetPppFailLedGpio);
39662 +EXPORT_SYMBOL(BpGetVoipLedGpio);
39663 +EXPORT_SYMBOL(BpGetWirelessExtIntr);
39664 +EXPORT_SYMBOL(BpGetAdslDyingGaspExtIntr);
39665 +EXPORT_SYMBOL(BpGetVoipExtIntr);
39666 +EXPORT_SYMBOL(BpGetHpnaExtIntr);
39667 +EXPORT_SYMBOL(BpGetHpnaChipSelect);
39668 +EXPORT_SYMBOL(BpGetVoipChipSelect);
39669 +EXPORT_SYMBOL(BpGetWirelessSesBtnGpio);
39670 +EXPORT_SYMBOL(BpGetWirelessSesExtIntr);
39671 +EXPORT_SYMBOL(BpGetWirelessSesLedGpio);
39672 +EXPORT_SYMBOL(kerSysRegisterDyingGaspHandler);
39673 +EXPORT_SYMBOL(kerSysDeregisterDyingGaspHandler);
39674 +EXPORT_SYMBOL(kerSysGetCycleCount);
39675 +EXPORT_SYMBOL(kerSysSetWdTimer);
39676 +EXPORT_SYMBOL(kerSysWakeupMonitorTask);
39677 +
39678 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.c
39679 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.c    1970-01-01 01:00:00.000000000 +0100
39680 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.c   2006-06-26 09:07:10.000000000 +0200
39681 @@ -0,0 +1,692 @@
39682 +/************************************************************************/
39683 +/*                                                                      */
39684 +/*  AMD CFI Enabled Flash Memory Drivers                                */
39685 +/*  File name: CFIFLASH.C                                               */
39686 +/*  Revision:  1.0  5/07/98                                             */
39687 +/*                                                                      */
39688 +/* Copyright (c) 1998 ADVANCED MICRO DEVICES, INC. All Rights Reserved. */
39689 +/* This software is unpublished and contains the trade secrets and      */
39690 +/* confidential proprietary information of AMD. Unless otherwise        */
39691 +/* provided in the Software Agreement associated herewith, it is        */
39692 +/* licensed in confidence "AS IS" and is not to be reproduced in whole  */
39693 +/* or part by any means except for backup. Use, duplication, or         */
39694 +/* disclosure by the Government is subject to the restrictions in       */
39695 +/* paragraph (b) (3) (B) of the Rights in Technical Data and Computer   */
39696 +/* Software clause in DFAR 52.227-7013 (a) (Oct 1988).                  */
39697 +/* Software owned by                                                    */
39698 +/* Advanced Micro Devices, Inc.,                                        */
39699 +/* One AMD Place,                                                       */
39700 +/* P.O. Box 3453                                                        */
39701 +/* Sunnyvale, CA 94088-3453.                                            */
39702 +/************************************************************************/
39703 +/*  This software constitutes a basic shell of source code for          */
39704 +/*  programming all AMD Flash components. AMD                           */
39705 +/*  will not be responsible for misuse or illegal use of this           */
39706 +/*  software for devices not supported herein. AMD is providing         */
39707 +/*  this source code "AS IS" and will not be responsible for            */
39708 +/*  issues arising from incorrect user implementation of the            */
39709 +/*  source code herein. It is the user's responsibility to              */
39710 +/*  properly design-in this source code.                                */
39711 +/*                                                                      */ 
39712 +/************************************************************************/                        
39713 +#ifdef _CFE_                                                
39714 +#include "lib_types.h"
39715 +#include "lib_printf.h"
39716 +#include "lib_string.h"
39717 +#include "cfe_timer.h"
39718 +#define printk  printf
39719 +#else       // linux
39720 +#include <linux/param.h>
39721 +#include <linux/sched.h>
39722 +#include <linux/timer.h>
39723 +#endif
39724 +
39725 +#include "cfiflash.h"
39726 +
39727 +static int flash_wait(WORD sector, int offset, UINT16 data);
39728 +static UINT16 flash_get_device_id(void);
39729 +static int flash_get_cfi(struct cfi_query *query, UINT16 *cfi_struct, int flashFamily);
39730 +static int flash_write(WORD sector, int offset, byte *buf, int nbytes);
39731 +static void flash_command(int command, WORD sector, int offset, UINT16 data);
39732 +
39733 +/*********************************************************************/
39734 +/* 'meminfo' should be a pointer, but most C compilers will not      */
39735 +/* allocate static storage for a pointer without calling             */
39736 +/* non-portable functions such as 'new'.  We also want to avoid      */
39737 +/* the overhead of passing this pointer for every driver call.       */
39738 +/* Systems with limited heap space will need to do this.             */
39739 +/*********************************************************************/
39740 +struct flashinfo meminfo; /* Flash information structure */
39741 +static int flashFamily = FLASH_UNDEFINED;
39742 +static int totalSize = 0;
39743 +static struct cfi_query query;
39744 +
39745 +static UINT16 cfi_data_struct_29W160[] = {
39746 +    0x0020, 0x0049, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39747 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39748 +    0x0051, 0x0052, 0x0059, 0x0002, 0x0000, 0x0040, 0x0000, 0x0000,
39749 +    0x0000, 0x0000, 0x0000, 0x0027, 0x0036, 0x0000, 0x0000, 0x0004,
39750 +    0x0000, 0x000a, 0x0000, 0x0004, 0x0000, 0x0003, 0x0000, 0x0015,
39751 +    0x0002, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0000, 0x0040,
39752 +    0x0000, 0x0001, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0080,
39753 +    0x0000, 0x001e, 0x0000, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff,
39754 +    0x0050, 0x0052, 0x0049, 0x0031, 0x0030, 0x0000, 0x0002, 0x0001,
39755 +    0x0001, 0x0004, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0x0002,
39756 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39757 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39758 +    0xffff, 0x0888, 0x252b, 0x8c84, 0x7dbc, 0xffff, 0xffff, 0xffff,
39759 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39760 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
39761 +    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
39762 +};
39763 +
39764 +
39765 +/*********************************************************************/
39766 +/* Init_flash is used to build a sector table from the information   */
39767 +/* provided through the CFI query.  This information is translated   */
39768 +/* from erase_block information to base:offset information for each  */
39769 +/* individual sector. This information is then stored in the meminfo */
39770 +/* structure, and used throughout the driver to access sector        */
39771 +/* information.                                                      */
39772 +/*                                                                   */
39773 +/* This is more efficient than deriving the sector base:offset       */
39774 +/* information every time the memory map switches (since on the      */
39775 +/* development platform can only map 64k at a time).  If the entire  */
39776 +/* flash memory array can be mapped in, then the addition static     */
39777 +/* allocation for the meminfo structure can be eliminated, but the   */
39778 +/* drivers will have to be re-written.                               */
39779 +/*                                                                   */
39780 +/* The meminfo struct occupies 653 bytes of heap space, depending    */
39781 +/* on the value of the define MAXSECTORS.  Adjust to suit            */
39782 +/* application                                                       */ 
39783 +/*********************************************************************/
39784 +byte flash_init(void)
39785 +{
39786 +    int i=0, j=0, count=0;
39787 +    int basecount=0L;
39788 +    UINT16 device_id;
39789 +    int flipCFIGeometry = FALSE;
39790 +
39791 +    /* First, assume
39792 +    * a single 8k sector for sector 0.  This is to allow
39793 +    * the system to perform memory mapping to the device,
39794 +    * even though the actual physical layout is unknown.
39795 +    * Once mapped in, the CFI query will produce all
39796 +    * relevant information.
39797 +    */
39798 +    meminfo.addr = 0L;
39799 +    meminfo.areg = 0;
39800 +    meminfo.nsect = 1;
39801 +    meminfo.bank1start = 0;
39802 +    meminfo.bank2start = 0;
39803 +    
39804 +    meminfo.sec[0].size = 8192;
39805 +    meminfo.sec[0].base = 0x00000;
39806 +    meminfo.sec[0].bank = 1;
39807 +        
39808 +    flash_command(FLASH_RESET, 0, 0, 0);
39809 +
39810 +    device_id = flash_get_device_id();
39811 +
39812 +    switch (device_id) {
39813 +        case ID_I28F160C3B:
39814 +        case ID_I28F320C3B:
39815 +        case ID_I28F160C3T:
39816 +        case ID_I28F320C3T:
39817 +            flashFamily = FLASH_INTEL;
39818 +            break;
39819 +        case ID_AM29DL800B:
39820 +        case ID_AM29LV800B:
39821 +        case ID_AM29LV400B:   
39822 +        case ID_AM29LV160B:
39823 +        case ID_AM29LV320B:
39824 +        case ID_MX29LV320AB:
39825 +        case ID_AM29LV320MB:
39826 +        case ID_AM29DL800T:
39827 +        case ID_AM29LV800T:
39828 +        case ID_AM29LV160T:
39829 +        case ID_AM29LV320T:
39830 +        case ID_MX29LV320AT:
39831 +        case ID_AM29LV320MT:
39832 +            flashFamily = FLASH_AMD;
39833 +            break;
39834 +        case ID_SST39VF1601:
39835 +               case ID_SST39VF3201:
39836 +            flashFamily = FLASH_SST;
39837 +            break;
39838 +        default:
39839 +            printk("Flash memory not supported!  Device id = %x\n", device_id);
39840 +            return -1;           
39841 +    }
39842 +
39843 +    if (flash_get_cfi(&query, 0, flashFamily) == -1) {
39844 +        switch(device_id) {
39845 +        case ID_AM29LV160T:
39846 +        case ID_AM29LV160B:
39847 +            flash_get_cfi(&query, cfi_data_struct_29W160, flashFamily);
39848 +            break;
39849 +        default:
39850 +            printk("CFI data structure not found. Device id = %x\n", device_id);
39851 +            return -1;           
39852 +        }
39853 +    }
39854 +
39855 +    // need to determine if it top or bottom boot here
39856 +    switch (device_id)
39857 +    {
39858 +        case ID_AM29DL800B:
39859 +        case ID_AM29LV800B:
39860 +        case ID_AM29LV400B:   
39861 +        case ID_AM29LV160B:
39862 +        case ID_AM29LV320B:
39863 +        case ID_MX29LV320AB:
39864 +        case ID_AM29LV320MB:
39865 +        case ID_I28F160C3B:
39866 +        case ID_I28F320C3B:
39867 +        case ID_I28F160C3T:
39868 +        case ID_I28F320C3T:
39869 +               case ID_SST39VF1601:
39870 +               case ID_SST39VF3201:
39871 +            flipCFIGeometry = FALSE;
39872 +            break;
39873 +        case ID_AM29DL800T:
39874 +        case ID_AM29LV800T:
39875 +        case ID_AM29LV160T:
39876 +        case ID_AM29LV320T:
39877 +        case ID_MX29LV320AT:
39878 +        case ID_AM29LV320MT:
39879 +            flipCFIGeometry = TRUE;
39880 +            break;
39881 +        default:
39882 +            printk("Flash memory not supported!  Device id = %x\n", device_id);
39883 +            return -1;           
39884 +    }
39885 +
39886 +    count=0;basecount=0L;
39887 +
39888 +    if (!flipCFIGeometry)
39889 +    {
39890 +       for (i=0; i<query.num_erase_blocks; i++) {
39891 +            for(j=0; j<query.erase_block[i].num_sectors; j++) {
39892 +                meminfo.sec[count].size = (int) query.erase_block[i].sector_size;
39893 +                meminfo.sec[count].base = (int) basecount;
39894 +                basecount += (int) query.erase_block[i].sector_size;
39895 +                count++;
39896 +            }
39897 +        }
39898 +    }
39899 +    else
39900 +    {
39901 +        for (i = (query.num_erase_blocks - 1); i >= 0; i--) {
39902 +            for(j=0; j<query.erase_block[i].num_sectors; j++) {
39903 +                meminfo.sec[count].size = (int) query.erase_block[i].sector_size;
39904 +                meminfo.sec[count].base = (int) basecount;
39905 +                basecount += (int) query.erase_block[i].sector_size;
39906 +                               count++;
39907 +            }
39908 +        }
39909 +    }
39910 +
39911 +    meminfo.nsect = count;
39912 +    totalSize = meminfo.sec[count-1].base + meminfo.sec[count-1].size;
39913 +    return (0);
39914 +}
39915 +
39916 +/*********************************************************************/
39917 +/* Flash_sector_erase_int() is identical to flash_sector_erase(),    */
39918 +/* except it will wait until the erase is completed before returning */
39919 +/* control to the calling function.  This can be used in cases which */
39920 +/* require the program to hold until a sector is erased, without     */
39921 +/* adding the wait check external to this function.                  */
39922 +/*********************************************************************/
39923 +byte flash_sector_erase_int(WORD sector)
39924 +{
39925 +    int i;
39926 +
39927 +    for( i = 0; i < 3; i++ ) {
39928 +        flash_command(FLASH_SERASE, sector, 0, 0);
39929 +        if (flash_wait(sector, 0, 0xffff) == STATUS_READY)
39930 +            break;
39931 +    }
39932 +
39933 +    return(1);
39934 +}
39935 +
39936 +/*********************************************************************/
39937 +/* flash_read_buf() reads buffer of data from the specified          */
39938 +/* offset from the sector parameter.                                 */
39939 +/*********************************************************************/
39940 +int flash_read_buf(WORD sector, int offset,
39941 +                        byte *buffer, int numbytes)
39942 +{
39943 +    byte *fwp;
39944 +
39945 +    fwp = (byte *)flash_get_memptr(sector);
39946 +
39947 +       while (numbytes) {
39948 +               *buffer++ = *(fwp + offset);
39949 +               numbytes--;
39950 +               fwp++;
39951 +    }
39952 +
39953 +    return (1);
39954 +}
39955 +
39956 +/*********************************************************************/
39957 +/* flash_write_buf() utilizes                                        */
39958 +/* the unlock bypass mode of the flash device.  This can remove      */
39959 +/* significant overhead from the bulk programming operation, and     */
39960 +/* when programming bulk data a sizeable performance increase can be */
39961 +/* observed.                                                         */
39962 +/*********************************************************************/
39963 +int flash_write_buf(WORD sector, int offset, byte *buffer, int numbytes)
39964 +{
39965 +    int ret = -1;
39966 +    int i;
39967 +    unsigned char *p = flash_get_memptr(sector) + offset;
39968 +
39969 +    /* After writing the flash block, compare the contents to the source
39970 +     * buffer.  Try to write the sector successfully up to three times.
39971 +     */
39972 +    for( i = 0; i < 3; i++ ) {
39973 +        ret = flash_write(sector, offset, buffer, numbytes);
39974 +        if( !memcmp( p, buffer, numbytes ) )
39975 +            break;
39976 +        /* Erase and try again */
39977 +        flash_sector_erase_int(sector);
39978 +        ret = -1;
39979 +    }
39980 +
39981 +    if( ret == -1 )
39982 +        printk( "Flash write error.  Verify failed\n" );
39983 +
39984 +    return( ret );
39985 +}
39986 +
39987 +/*********************************************************************/
39988 +/* Usefull funtion to return the number of sectors in the device.    */
39989 +/* Can be used for functions which need to loop among all the        */
39990 +/* sectors, or wish to know the number of the last sector.           */
39991 +/*********************************************************************/
39992 +int flash_get_numsectors(void)
39993 +{
39994 +    return meminfo.nsect;
39995 +}
39996 +
39997 +/*********************************************************************/
39998 +/* flash_get_sector_size() is provided for cases in which the size   */
39999 +/* of a sector is required by a host application.  The sector size   */
40000 +/* (in bytes) is returned in the data location pointed to by the     */
40001 +/* 'size' parameter.                                                 */
40002 +/*********************************************************************/
40003 +int flash_get_sector_size(WORD sector)
40004 +{
40005 +    return meminfo.sec[sector].size;
40006 +}
40007 +
40008 +/*********************************************************************/
40009 +/* The purpose of flash_get_memptr() is to return a memory pointer   */
40010 +/* which points to the beginning of memory space allocated for the   */
40011 +/* flash.  All function pointers are then referenced from this       */
40012 +/* pointer.                                                         */
40013 +/*                                                                   */
40014 +/* Different systems will implement this in different ways:          */
40015 +/* possibilities include:                                            */
40016 +/*  - A direct memory pointer                                        */
40017 +/*  - A pointer to a memory map                                      */
40018 +/*  - A pointer to a hardware port from which the linear             */
40019 +/*    address is translated                                          */
40020 +/*  - Output of an MMU function / service                            */
40021 +/*                                                                   */
40022 +/* Also note that this function expects the pointer to a specific    */
40023 +/* sector of the device.  This can be provided by dereferencing      */
40024 +/* the pointer from a translated offset of the sector from a         */
40025 +/* global base pointer (e.g. flashptr = base_pointer + sector_offset)*/
40026 +/*                                                                   */
40027 +/* Important: Many AMD flash devices need both bank and or sector    */
40028 +/* address bits to be correctly set (bank address bits are A18-A16,  */
40029 +/* and sector address bits are A18-A12, or A12-A15).  Flash parts    */
40030 +/* which do not need these bits will ignore them, so it is safe to   */
40031 +/* assume that every part will require these bits to be set.         */
40032 +/*********************************************************************/
40033 +unsigned char *flash_get_memptr(WORD sector)
40034 +{
40035 +       unsigned char *memptr = (unsigned char*)(FLASH_BASE_ADDR_REG + meminfo.sec[sector].base);
40036 +
40037 +       return (memptr);
40038 +}
40039 +
40040 +/*********************************************************************/
40041 +/* The purpose of flash_get_blk() is to return a the block number    */
40042 +/* for a given memory address.                                       */
40043 +/*********************************************************************/
40044 +int flash_get_blk(int addr)
40045 +{
40046 +    int blk_start, i;
40047 +    int last_blk = flash_get_numsectors();
40048 +    int relative_addr = addr - (int) FLASH_BASE_ADDR_REG;
40049 +
40050 +    for(blk_start=0, i=0; i < relative_addr && blk_start < last_blk; blk_start++)
40051 +        i += flash_get_sector_size(blk_start);
40052 +
40053 +    if( i > relative_addr )
40054 +    {
40055 +        blk_start--;        // last blk, dec by 1
40056 +    }
40057 +    else
40058 +        if( blk_start == last_blk )
40059 +        {
40060 +            printk("Address is too big.\n");
40061 +            blk_start = -1;
40062 +        }
40063 +
40064 +    return( blk_start );
40065 +}
40066 +
40067 +/************************************************************************/
40068 +/* The purpose of flash_get_total_size() is to return the total size of */
40069 +/* the flash                                                            */
40070 +/************************************************************************/
40071 +int flash_get_total_size()
40072 +{
40073 +    return totalSize;
40074 +}
40075 +
40076 +/*********************************************************************/
40077 +/* Flash_command() is the main driver function.  It performs         */
40078 +/* every possible command available to AMD B revision                */
40079 +/* flash parts. Note that this command is not used directly, but     */
40080 +/* rather called through the API wrapper functions provided below.   */
40081 +/*********************************************************************/
40082 +static void flash_command(int command, WORD sector, int offset, UINT16 data)
40083 +{
40084 +    volatile UINT16 *flashptr;
40085 +    volatile UINT16 *flashbase;
40086 +
40087 +    flashptr = (UINT16 *) flash_get_memptr(sector);
40088 +    flashbase = (UINT16 *) flash_get_memptr(0);
40089 +    
40090 +    switch (flashFamily) {
40091 +    case FLASH_UNDEFINED:
40092 +        /* These commands should work for AMD, Intel and SST flashes */
40093 +        switch (command) {
40094 +        case FLASH_RESET:
40095 +            flashptr[0] = 0xF0;
40096 +            flashptr[0] = 0xFF;
40097 +            break;
40098 +        case FLASH_READ_ID:
40099 +                       flashptr[0x5555] = 0xAA;       /* unlock 1 */
40100 +            flashptr[0x2AAA] = 0x55;       /* unlock 2 */
40101 +            flashptr[0x5555] = 0x90;
40102 +            break;
40103 +        default:
40104 +            break;
40105 +        }
40106 +        break;
40107 +    case FLASH_AMD:
40108 +        switch (command) {
40109 +        case FLASH_RESET:
40110 +            flashptr[0] = 0xF0;
40111 +            break;
40112 +        case FLASH_READ_ID:
40113 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
40114 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
40115 +            flashptr[0x555] = 0x90;
40116 +            break;
40117 +        case FLASH_CFIQUERY:
40118 +            flashptr[0x55] = 0x98;
40119 +            break;
40120 +        case FLASH_UB:
40121 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
40122 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
40123 +            flashptr[0x555] = 0x20;
40124 +            break;
40125 +        case FLASH_PROG:
40126 +            flashptr[0] = 0xA0;
40127 +            flashptr[offset/2] = data;
40128 +            break;
40129 +        case FLASH_UBRESET:
40130 +            flashptr[0] = 0x90;
40131 +            flashptr[0] = 0x00;
40132 +            break;
40133 +        case FLASH_SERASE:
40134 +            flashptr[0x555] = 0xAA;       /* unlock 1 */
40135 +            flashptr[0x2AA] = 0x55;       /* unlock 2 */
40136 +            flashptr[0x555] = 0x80;
40137 +            flashptr[0x555] = 0xAA;
40138 +            flashptr[0x2AA] = 0x55;
40139 +            flashptr[0] = 0x30;
40140 +            break;
40141 +        default:
40142 +            break;
40143 +        }
40144 +        break;
40145 +    case FLASH_INTEL:
40146 +        switch (command) {
40147 +        case FLASH_RESET:
40148 +            flashptr[0] = 0xFF;
40149 +            break;
40150 +        case FLASH_READ_ID:
40151 +            flashptr[0] = 0x90;
40152 +            break;
40153 +        case FLASH_CFIQUERY:
40154 +            flashptr[0] = 0x98;
40155 +            break;
40156 +        case FLASH_PROG:
40157 +            flashptr[0] = 0x40;
40158 +            flashptr[offset/2] = data;
40159 +            break;
40160 +        case FLASH_SERASE:
40161 +            flashptr[0] = 0x60;
40162 +            flashptr[0] = 0xD0;
40163 +            flashptr[0] = 0x20;
40164 +            flashptr[0] = 0xD0;
40165 +            break;
40166 +        default:
40167 +            break;
40168 +        }
40169 +        break;
40170 +    case FLASH_SST:
40171 +        switch (command) {
40172 +        case FLASH_RESET:
40173 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
40174 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
40175 +            flashbase[0x5555] = 0xf0;
40176 +            break;
40177 +        case FLASH_READ_ID:
40178 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
40179 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
40180 +            flashbase[0x5555] = 0x90;
40181 +            break;
40182 +        case FLASH_CFIQUERY:
40183 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
40184 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
40185 +            flashbase[0x5555] = 0x98;
40186 +            break;
40187 +        case FLASH_UB:
40188 +            break;
40189 +        case FLASH_PROG:
40190 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
40191 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
40192 +            flashbase[0x5555] = 0xa0;
40193 +            flashptr[offset/2] = data;
40194 +            break;
40195 +        case FLASH_UBRESET:
40196 +            break;
40197 +        case FLASH_SERASE:
40198 +            flashbase[0x5555] = 0xAA;       /* unlock 1 */
40199 +            flashbase[0x2AAA] = 0x55;       /* unlock 2 */
40200 +            flashbase[0x5555] = 0x80;
40201 +            flashbase[0x5555] = 0xAA;
40202 +            flashbase[0x2AAA] = 0x55;
40203 +            flashptr[0] = 0x30;
40204 +            break;
40205 +        default:
40206 +            break;
40207 +        }
40208 +        break;
40209 +    default:
40210 +        break;
40211 +    }
40212 +}
40213 +
40214 +/*********************************************************************/
40215 +/* flash_write extends the functionality of flash_program() by       */
40216 +/* providing an faster way to program multiple data words, without   */
40217 +/* needing the function overhead of looping algorithms which         */
40218 +/* program word by word.  This function utilizes fast pointers       */
40219 +/* to quickly loop through bulk data.                                */
40220 +/*********************************************************************/
40221 +static int flash_write(WORD sector, int offset, byte *buf, int nbytes)
40222 +{
40223 +    UINT16 *src;
40224 +    src = (UINT16 *)buf;
40225 +
40226 +    if ((nbytes | offset) & 1) {
40227 +        return -1;
40228 +    }
40229 +
40230 +    flash_command(FLASH_UB, 0, 0, 0);
40231 +    while (nbytes > 0) {
40232 +        flash_command(FLASH_PROG, sector, offset, *src);
40233 +        if (flash_wait(sector, offset, *src) != STATUS_READY)
40234 +            break;
40235 +        offset +=2;
40236 +        nbytes -=2;
40237 +        src++;
40238 +    }
40239 +    flash_command(FLASH_UBRESET, 0, 0, 0);
40240 +    
40241 +    return (byte*)src - buf;
40242 +}
40243 +
40244 +/*********************************************************************/
40245 +/* flash_wait utilizes the DQ6, DQ5, and DQ2 polling algorithms      */
40246 +/* described in the flash data book.  It can quickly ascertain the   */
40247 +/* operational status of the flash device, and return an             */
40248 +/* appropriate status code (defined in flash.h)                      */
40249 +/*********************************************************************/
40250 +static int flash_wait(WORD sector, int offset, UINT16 data)
40251 +{
40252 +    volatile UINT16 *flashptr; /* flash window */
40253 +    UINT16 d1;
40254 +
40255 +    flashptr = (UINT16 *) flash_get_memptr(sector);
40256 +
40257 +    if (flashFamily == FLASH_AMD || flashFamily == FLASH_SST) {
40258 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
40259 +        do {
40260 +            d1 = flashptr[offset/2];
40261 +            if (d1 == data)
40262 +                return STATUS_READY;
40263 +        } while (!(d1 & 0x20));
40264 +
40265 +        d1 = flashptr[offset/2];
40266 +
40267 +        if (d1 != data) {
40268 +            flash_command(FLASH_RESET, 0, 0, 0);
40269 +            return STATUS_TIMEOUT;
40270 +        }
40271 +#else
40272 +        do {
40273 +            d1 = *flashptr;    /* read data */
40274 +            d1 ^= *flashptr;   /* read it again and see what toggled */
40275 +            if (d1 == 0)       /* no toggles, nothing's happening */
40276 +                return STATUS_READY;
40277 +        } while (!(d1 & 0x20));
40278 +
40279 +        d1 = *flashptr;        /* read data */
40280 +        d1 ^= *flashptr;   /* read it again and see what toggled */
40281 +
40282 +        if (d1 != 0) {
40283 +            flash_command(FLASH_RESET, 0, 0, 0);
40284 +            return STATUS_TIMEOUT;
40285 +        }
40286 +#endif
40287 +    } else if (flashFamily == FLASH_INTEL) {
40288 +        flashptr[0] = 0x70;
40289 +        /* Wait for completion */
40290 +        while(!(*flashptr & 0x80));
40291 +        if (*flashptr & 0x30) {
40292 +            flashptr[0] = 0x50;
40293 +            flash_command(FLASH_RESET, 0, 0, 0);
40294 +            return STATUS_TIMEOUT;
40295 +        }
40296 +        flashptr[0] = 0x50;
40297 +        flash_command(FLASH_RESET, 0, 0, 0);
40298 +    }
40299 +    
40300 +    return STATUS_READY;
40301 +}
40302 +
40303 +/*********************************************************************/
40304 +/* flash_get_device_id() will perform an autoselect sequence on the  */
40305 +/* flash device, and return the device id of the component.          */
40306 +/* This function automatically resets to read mode.                  */
40307 +/*********************************************************************/
40308 +static UINT16 flash_get_device_id()
40309 +{
40310 +    volatile UINT16 *fwp; /* flash window */
40311 +    UINT16 answer;
40312 +    
40313 +    fwp = (UINT16 *)flash_get_memptr(0);
40314 +    
40315 +    flash_command(FLASH_READ_ID, 0, 0, 0);
40316 +    answer = *(fwp + 1);
40317 +    if (answer == ID_AM29LV320M) {
40318 +        answer = *(fwp + 0xe);
40319 +        answer = *(fwp + 0xf);
40320 +    }
40321 +    
40322 +    flash_command(FLASH_RESET, 0, 0, 0);
40323 +    return( (UINT16) answer );
40324 +}
40325 +
40326 +/*********************************************************************/
40327 +/* flash_get_cfi() is the main CFI workhorse function.  Due to it's  */
40328 +/* complexity and size it need only be called once upon              */
40329 +/* initializing the flash system.  Once it is called, all operations */
40330 +/* are performed by looking at the meminfo structure.                */
40331 +/* All possible care was made to make this algorithm as efficient as */
40332 +/* possible.  90% of all operations are memory reads, and all        */
40333 +/* calculations are done using bit-shifts when possible              */
40334 +/*********************************************************************/
40335 +static int flash_get_cfi(struct cfi_query *query, UINT16 *cfi_struct, int flashFamily)
40336 +{
40337 +    volatile UINT16 *fwp; /* flash window */
40338 +    int i=0;
40339 +
40340 +    flash_command(FLASH_CFIQUERY, 0, 0, 0);
40341 +    
40342 +    if (cfi_struct == 0)
40343 +        fwp = (UINT16 *)flash_get_memptr(0);
40344 +    else
40345 +        fwp = cfi_struct;
40346 +    
40347 +    /* Initial house-cleaning */
40348 +    for(i=0; i < 8; i++) {
40349 +        query->erase_block[i].sector_size = 0;
40350 +        query->erase_block[i].num_sectors = 0;
40351 +    }
40352 +    
40353 +    /* If not 'QRY', then we dont have a CFI enabled device in the socket */
40354 +    if( fwp[0x10] != 'Q' &&
40355 +        fwp[0x11] != 'R' &&
40356 +        fwp[0x12] != 'Y') {
40357 +        flash_command(FLASH_RESET, 0, 0, 0);
40358 +        return(-1);
40359 +    }
40360 +    
40361 +       query->num_erase_blocks = fwp[0x2C];
40362 +       if(flashFamily == FLASH_SST)
40363 +               query->num_erase_blocks = 1;
40364 +       
40365 +    for(i=0; i < query->num_erase_blocks; i++) {
40366 +                       query->erase_block[i].num_sectors = fwp[(0x2D+(4*i))] + (fwp[0x2E + (4*i)] << 8);
40367 +                       query->erase_block[i].num_sectors++;
40368 +                       query->erase_block[i].sector_size = 256 * (256 * fwp[(0x30+(4*i))] + fwp[(0x2F+(4*i))]);
40369 +    }
40370 +    
40371 +    flash_command(FLASH_RESET, 0, 0, 0);
40372 +    return(1);
40373 +}
40374 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.h
40375 --- linux-2.6.8.1/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.h    1970-01-01 01:00:00.000000000 +0100
40376 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/board/bcm963xx/impl1/cfiflash.h   2006-06-26 09:07:10.000000000 +0200
40377 @@ -0,0 +1,150 @@
40378 +/************************************************************************/
40379 +/*                                                                      */
40380 +/*  AMD CFI Enabled Flash Memory Drivers                                */
40381 +/*  File name: CFIFLASH.H                                               */
40382 +/*  Revision:  1.0  5/07/98                                             */
40383 +/*                                                                      */
40384 +/* Copyright (c) 1998 ADVANCED MICRO DEVICES, INC. All Rights Reserved. */
40385 +/* This software is unpublished and contains the trade secrets and      */
40386 +/* confidential proprietary information of AMD. Unless otherwise        */
40387 +/* provided in the Software Agreement associated herewith, it is        */
40388 +/* licensed in confidence "AS IS" and is not to be reproduced in whole  */
40389 +/* or part by any means except for backup. Use, duplication, or         */
40390 +/* disclosure by the Government is subject to the restrictions in       */
40391 +/* paragraph (b) (3) (B) of the Rights in Technical Data and Computer   */
40392 +/* Software clause in DFAR 52.227-7013 (a) (Oct 1988).                  */
40393 +/* Software owned by                                                    */
40394 +/* Advanced Micro Devices, Inc.,                                        */
40395 +/* One AMD Place,                                                       */
40396 +/* P.O. Box 3453                                                        */
40397 +/* Sunnyvale, CA 94088-3453.                                            */
40398 +/************************************************************************/
40399 +/*  This software constitutes a basic shell of source code for          */
40400 +/*  programming all AMD Flash components. AMD                           */
40401 +/*  will not be responsible for misuse or illegal use of this           */
40402 +/*  software for devices not supported herein. AMD is providing         */
40403 +/*  this source code "AS IS" and will not be responsible for            */
40404 +/*  issues arising from incorrect user implementation of the            */
40405 +/*  source code herein. It is the user's responsibility to              */
40406 +/*  properly design-in this source code.                                */
40407 +/*                                                                      */ 
40408 +/************************************************************************/
40409 +#ifndef _CFIFLASH_H
40410 +#define _CFIFLASH_H
40411 +
40412 +#if defined __cplusplus
40413 +extern "C" {
40414 +#endif
40415 +
40416 +/* include board/CPU specific definitions */
40417 +#include "bcmtypes.h"
40418 +#include "board.h"
40419 +
40420 +#define FLASH_BASE_ADDR_REG FLASH_BASE
40421 +
40422 +#ifndef NULL
40423 +#define NULL 0
40424 +#endif
40425 +
40426 +#define MAXSECTORS  1024      /* maximum number of sectors supported */
40427 +
40428 +/* A structure for identifying a flash part.  There is one for each
40429 + * of the flash part definitions.  We need to keep track of the
40430 + * sector organization, the address register used, and the size
40431 + * of the sectors.
40432 + */
40433 +struct flashinfo {
40434 +        char *name;         /* "Am29DL800T", etc. */
40435 +        unsigned long addr; /* physical address, once translated */
40436 +        int areg;           /* Can be set to zero for all parts */
40437 +        int nsect;          /* # of sectors -- 19 in LV, 22 in DL */
40438 +        int bank1start;     /* first sector # in bank 1 */
40439 +        int bank2start;     /* first sector # in bank 2, if DL part */
40440 + struct {
40441 +       long size;           /* # of bytes in this sector */
40442 +       long base;           /* offset from beginning of device */
40443 +       int bank;            /* 1 or 2 for DL; 1 for LV */
40444 +        } sec[MAXSECTORS];  /* per-sector info */
40445 +};
40446 +
40447 +/*
40448 + * This structure holds all CFI query information as defined
40449 + * in the JEDEC standard. All information up to 
40450 + * primary_extended_query is standard among all manufactures
40451 + * with CFI enabled devices.
40452 + */
40453 +
40454 +struct cfi_query {
40455 +       int num_erase_blocks;           /* Number of sector defs. */
40456 +       struct {
40457 +         unsigned long sector_size;    /* byte size of sector */
40458 +         int num_sectors;              /* Num sectors of this size */
40459 +       } erase_block[8];               /* Max of 256, but 8 is good */
40460 +};
40461 +
40462 +/* Standard Boolean declarations */
40463 +#define TRUE                           1
40464 +#define FALSE                          0
40465 +
40466 +/* Define different type of flash */
40467 +#define FLASH_UNDEFINED 0
40468 +#define FLASH_AMD       1
40469 +#define FLASH_INTEL     2
40470 +#define FLASH_SST       3
40471 +
40472 +/* Command codes for the flash_command routine */
40473 +#define FLASH_RESET     0       /* reset to read mode */
40474 +#define FLASH_READ_ID   1       /* read device ID */
40475 +#define FLASH_CFIQUERY  2       /* CFI query */
40476 +#define FLASH_UB        3       /* go into unlock bypass mode */
40477 +#define FLASH_PROG      4       /* program a word */
40478 +#define FLASH_UBRESET   5       /* reset to read mode from unlock bypass mode */
40479 +#define FLASH_SERASE    6       /* sector erase */
40480 +
40481 +/* Return codes from flash_status */
40482 +#define STATUS_READY    0       /* ready for action */
40483 +#define STATUS_TIMEOUT  1       /* operation timed out */
40484 +
40485 +/* A list of AMD compatible device ID's - add others as needed */
40486 +#define ID_AM29DL800T   0x224A
40487 +#define ID_AM29DL800B   0x22CB
40488 +#define ID_AM29LV800T   0x22DA
40489 +#define ID_AM29LV800B   0x225B
40490 +#define ID_AM29LV400B   0x22BA
40491 +
40492 +#define ID_AM29LV160B   0x2249
40493 +#define ID_AM29LV160T   0x22C4
40494 +
40495 +#define ID_AM29LV320T   0x22F6
40496 +#define ID_MX29LV320AT  0x22A7
40497 +#define ID_AM29LV320B   0x22F9
40498 +#define ID_MX29LV320AB  0x22A8
40499 +
40500 +#define ID_AM29LV320M   0x227E
40501 +#define ID_AM29LV320MB  0x2200
40502 +#define ID_AM29LV320MT  0x2201
40503 +
40504 +#define ID_SST39VF1601  0x234B
40505 +#define ID_SST39VF3201  0x235B
40506 +
40507 +/* A list of Intel compatible device ID's - add others as needed */
40508 +#define ID_I28F160C3T   0x88C2
40509 +#define ID_I28F160C3B   0x88C3
40510 +#define ID_I28F320C3T   0x88C4
40511 +#define ID_I28F320C3B   0x88C5
40512 +
40513 +extern byte flash_init(void);
40514 +extern int flash_write_buf(WORD sector, int offset, byte *buffer, int numbytes);
40515 +extern int flash_read_buf(WORD sector, int offset, byte *buffer, int numbytes);
40516 +extern byte flash_sector_erase_int(WORD sector);
40517 +extern int flash_get_numsectors(void);
40518 +extern int flash_get_sector_size(WORD sector);
40519 +extern int flash_get_total_size(void);
40520 +extern unsigned char *flash_get_memptr(WORD sector);
40521 +extern int flash_get_blk(int addr);
40522 +
40523 +#if defined __cplusplus
40524 +}
40525 +#endif
40526 +
40527 +#endif
40528 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/serial/bcm96348/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/bcm96348/Makefile
40529 --- linux-2.6.8.1/bcmdrivers/opensource/char/serial/bcm96348/Makefile   1970-01-01 01:00:00.000000000 +0100
40530 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/bcm96348/Makefile  2006-06-26 09:07:10.000000000 +0200
40531 @@ -0,0 +1,13 @@
40532 +# File: bcmdrivers/opensource/char/serial
40533 +#
40534 +# Makefile for the BCM63xx serial/console driver
40535 +
40536 +obj-$(CONFIG_BCM_SERIAL) += bcm63xx_cons.o
40537 +
40538 +EXTRA_CFLAGS += -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
40539 +
40540 +-include $(TOPDIR)/Rules.make
40541 +
40542 +clean:
40543 +       rm -f core *.o *.a *.s
40544 +
40545 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/serial/bcm96348/bcm63xx_cons.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/bcm96348/bcm63xx_cons.c
40546 --- linux-2.6.8.1/bcmdrivers/opensource/char/serial/bcm96348/bcm63xx_cons.c     1970-01-01 01:00:00.000000000 +0100
40547 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/bcm96348/bcm63xx_cons.c    2006-06-26 09:07:10.000000000 +0200
40548 @@ -0,0 +1,1035 @@
40549 +/*
40550 +<:copyright-gpl 
40551 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
40552
40553 + This program is free software; you can distribute it and/or modify it 
40554 + under the terms of the GNU General Public License (Version 2) as 
40555 + published by the Free Software Foundation. 
40556
40557 + This program is distributed in the hope it will be useful, but WITHOUT 
40558 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
40559 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
40560 + for more details. 
40561
40562 + You should have received a copy of the GNU General Public License along 
40563 + with this program; if not, write to the Free Software Foundation, Inc., 
40564 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
40565 +:>
40566 +*/
40567 +
40568 +/* Description: Serial port driver for the BCM963XX. */
40569 +
40570 +#define CARDNAME    "bcm963xx_serial driver"
40571 +#define VERSION     "2.0"
40572 +#define VER_STR     CARDNAME " v" VERSION "\n"
40573 +
40574 +
40575 +#include <linux/kernel.h>
40576 +#include <linux/module.h>
40577 +#include <linux/version.h>
40578 +#include <linux/init.h> 
40579 +#include <linux/slab.h>
40580 +#include <linux/interrupt.h>
40581 +
40582 +/* for definition of struct console */
40583 +#include <linux/console.h>
40584 +#include <linux/tty.h>
40585 +#include <linux/tty_flip.h>
40586 +#include <linux/serial.h>
40587 +#include <asm/uaccess.h>
40588 +
40589 +#include <bcmtypes.h>
40590 +#include <board.h>
40591 +#include <bcm_map_part.h>
40592 +#include <bcm_intr.h>
40593 +
40594 +extern void _putc(char);
40595 +extern void _puts(const char *);
40596 +
40597 +typedef struct bcm_serial {
40598 +    volatile Uart *         port;
40599 +    int                     type;
40600 +    int                     flags; 
40601 +    int                     irq;
40602 +    int                     baud_base;
40603 +    int                     blocked_open;
40604 +    unsigned short          close_delay;
40605 +    unsigned short          closing_wait;
40606 +    unsigned short          line;                /* port/line number */
40607 +    unsigned short          cflags;              /* line configuration flag */
40608 +    unsigned short          x_char;              /* xon/xoff character */
40609 +    unsigned short          read_status_mask;    /* mask for read condition */
40610 +    unsigned short          ignore_status_mask;  /* mask for ignore condition */
40611 +    unsigned long           event;               /* mask used in BH */
40612 +    int                     xmit_head;           /* Position of the head */
40613 +    int                     xmit_tail;           /* Position of the tail */
40614 +    int                     xmit_cnt;            /* Count of the chars in the buffer */
40615 +    int                     count;               /* indicates how many times it has been opened */
40616 +    int                     magic;
40617 +
40618 +    struct async_icount     icount;              /* keep track of things ... */
40619 +    struct tty_struct       *tty;                /* tty associated */    
40620 +    struct termios          normal_termios;
40621 +
40622 +    wait_queue_head_t       open_wait;
40623 +    wait_queue_head_t       close_wait;
40624 +
40625 +    long                    session;             /* Session of opening process */
40626 +    long                    pgrp;                /* pgrp of opening process */
40627 +
40628 +    unsigned char           is_initialized;
40629 +} Context;
40630 +
40631 +
40632 +/*---------------------------------------------------------------------*/
40633 +/* Define bits in the Interrupt Enable register                        */
40634 +/*---------------------------------------------------------------------*/
40635 +/* Enable receive interrupt              */
40636 +#define RXINT   (RXFIFONE|RXOVFERR)
40637 +
40638 +/* Enable transmit interrupt             */
40639 +#define TXINT    (TXFIFOEMT|TXUNDERR|TXOVFERR) 
40640 +
40641 +/* Enable receiver line status interrupt */
40642 +#define LSINT    (RXBRK|RXPARERR|RXFRAMERR)
40643 +
40644 +#define BCM_NUM_UARTS                   1
40645 +
40646 +#define BD_BCM63XX_TIMER_CLOCK_INPUT    (FPERIPH)
40647 +
40648 +
40649 +static struct bcm_serial multi[BCM_NUM_UARTS];
40650 +static struct bcm_serial *lines[BCM_NUM_UARTS];
40651 +static struct tty_driver serial_driver;
40652 +static struct tty_struct *serial_table[BCM_NUM_UARTS];
40653 +static struct termios *serial_termios[BCM_NUM_UARTS];
40654 +static struct termios *serial_termios_locked[BCM_NUM_UARTS];
40655 +static int serial_refcount;
40656 +
40657 +
40658 +static void bcm_stop (struct tty_struct *tty);
40659 +static void bcm_start (struct tty_struct *tty);
40660 +static inline void receive_chars (struct bcm_serial * info);
40661 +static int startup (struct bcm_serial *info);
40662 +static void shutdown (struct bcm_serial * info);
40663 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag );
40664 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty);
40665 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
40666 +    const unsigned char *buf, int count);
40667 +static int bcm63xx_cons_write_room (struct tty_struct *tty);
40668 +static int bcm_chars_in_buffer (struct tty_struct *tty);
40669 +static void bcm_flush_buffer (struct tty_struct *tty);
40670 +static void bcm_throttle (struct tty_struct *tty);
40671 +static void bcm_unthrottle (struct tty_struct *tty);
40672 +static void bcm_send_xchar (struct tty_struct *tty, char ch);
40673 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo);
40674 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info);
40675 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value);
40676 +static void send_break (struct bcm_serial *info, int duration);
40677 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
40678 +    unsigned int cmd, unsigned long arg);
40679 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios);
40680 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp);
40681 +static void bcm_hangup (struct tty_struct *tty);
40682 +static int block_til_ready (struct tty_struct *tty, struct file *filp, struct bcm_serial *info);
40683 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp);
40684 +static int __init bcm63xx_serialinit(void);
40685 +
40686 +
40687 +/*
40688 + * ------------------------------------------------------------
40689 + * rs_stop () and rs_start ()
40690 + *
40691 + * These routines are called before setting or resetting 
40692 + * tty->stopped. They enable or disable transmitter interrupts, 
40693 + * as necessary.
40694 + * ------------------------------------------------------------
40695 + */
40696 +static void bcm_stop (struct tty_struct *tty)
40697 +{
40698 +}  
40699 +
40700 +static void bcm_start (struct tty_struct *tty)
40701 +{
40702 +    _puts(CARDNAME " Start\n");
40703 +}  
40704 +
40705 +/*
40706 + * ------------------------------------------------------------
40707 + * receive_char ()
40708 + *
40709 + * This routine deals with inputs from any lines.
40710 + * ------------------------------------------------------------
40711 + */
40712 +static inline void receive_chars (struct bcm_serial * info)
40713 +{
40714 +    struct tty_struct *tty = 0;
40715 +    struct async_icount * icount;
40716 +    int ignore = 0;
40717 +    unsigned short status, tmp;
40718 +    UCHAR ch = 0;
40719 +    while ((status = info->port->intStatus) & RXINT)
40720 +    {
40721 +        if (status & RXFIFONE)
40722 +            ch = info->port->Data;  // Read the character
40723 +        tty = info->tty;                  /* now tty points to the proper dev */
40724 +        icount = &info->icount;
40725 +        if (! tty)
40726 +            break;
40727 +        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
40728 +            break;
40729 +        *tty->flip.char_buf_ptr = ch;
40730 +        *tty->flip.flag_buf_ptr = 0;
40731 +        icount->rx++;
40732 +        if (status & RXBRK)
40733 +        {
40734 +            *tty->flip.flag_buf_ptr = TTY_BREAK;
40735 +            icount->brk++;
40736 +        }
40737 +        // keep track of the statistics
40738 +        if (status & (RXFRAMERR | RXPARERR | RXOVFERR))
40739 +        {
40740 +            if (status & RXPARERR)                /* parity error */
40741 +                icount->parity++;
40742 +            else
40743 +                if (status & RXFRAMERR)           /* frame error */
40744 +                    icount->frame++;
40745 +            if (status & RXOVFERR)
40746 +            {
40747 +                // Overflow. Reset the RX FIFO
40748 +                info->port->fifoctl |= RSTRXFIFOS;
40749 +                icount->overrun++;
40750 +            }
40751 +            // check to see if we should ignore the character
40752 +            // and mask off conditions that should be ignored
40753 +            if (status & info->ignore_status_mask)
40754 +            {
40755 +                if (++ignore > 100 )
40756 +                    break;
40757 +                goto ignore_char;
40758 +            }
40759 +            // Mask off the error conditions we want to ignore
40760 +            tmp = status & info->read_status_mask;
40761 +            if (tmp & RXPARERR)
40762 +            {
40763 +                *tty->flip.flag_buf_ptr = TTY_PARITY;
40764 +            }
40765 +            else
40766 +                if (tmp & RXFRAMERR)
40767 +                {
40768 +                    *tty->flip.flag_buf_ptr = TTY_FRAME;
40769 +                }
40770 +            if (tmp & RXOVFERR)
40771 +            {
40772 +                if (tty->flip.count < TTY_FLIPBUF_SIZE)
40773 +                {
40774 +                    tty->flip.count++;
40775 +                    tty->flip.flag_buf_ptr++;
40776 +                    tty->flip.char_buf_ptr++;
40777 +                    *tty->flip.flag_buf_ptr = TTY_OVERRUN;
40778 +                }
40779 +            }
40780 +        }
40781 +        tty->flip.flag_buf_ptr++;
40782 +        tty->flip.char_buf_ptr++;
40783 +        tty->flip.count++;
40784 +    }
40785 +ignore_char:
40786 +    if (tty)
40787 +        tty_flip_buffer_push(tty);
40788 +}
40789 +
40790 +
40791 +/*
40792 + * ------------------------------------------------------------
40793 + * bcm_interrupt ()
40794 + *
40795 + * this is the main interrupt routine for the chip.
40796 + * It deals with the multiple ports.
40797 + * ------------------------------------------------------------
40798 + */
40799 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
40800 +static irqreturn_t bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
40801 +#else
40802 +static void bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
40803 +#endif
40804 +{
40805 +    struct bcm_serial * info = lines[0];
40806 +    UINT16  intStat;
40807 +
40808 +    /* get pending interrupt flags from UART  */
40809 +
40810 +    /* Mask with only the serial interrupts that are enabled */
40811 +    intStat = info->port->intStatus & info->port->intMask;
40812 +    while (intStat)
40813 +    {
40814 +        if (intStat & RXINT)
40815 +            receive_chars (info);          
40816 +        else
40817 +            if (intStat & TXINT)
40818 +                info->port->intStatus = TXINT;
40819 +            else /* don't know what it was, so let's mask it */
40820 +                info->port->intMask &= ~intStat;
40821 +
40822 +        intStat = info->port->intStatus & info->port->intMask;
40823 +    }
40824 +
40825 +    // Clear the interrupt
40826 +    BcmHalInterruptEnable (INTERRUPT_ID_UART);
40827 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
40828 +    return IRQ_HANDLED;
40829 +#endif    
40830 +}
40831 +
40832 +/*
40833 + * -------------------------------------------------------------------
40834 + * startup ()
40835 + *
40836 + * various initialization tasks
40837 + * ------------------------------------------------------------------- 
40838 + */
40839 +static int startup (struct bcm_serial *info)
40840 +{
40841 +    // Port is already started...
40842 +    return 0;
40843 +}
40844 +
40845 +/* 
40846 + * -------------------------------------------------------------------
40847 + * shutdown ()
40848 + *
40849 + * This routine will shutdown a serial port; interrupts are disabled, and
40850 + * DTR is dropped if the hangup on close termio flag is on.
40851 + * ------------------------------------------------------------------- 
40852 + */
40853 +static void shutdown (struct bcm_serial * info)
40854 +{
40855 +    unsigned long flags;
40856 +    if (!info->is_initialized)
40857 +        return;
40858 +
40859 +    save_flags (flags);
40860 +    cli ();
40861 +
40862 +    info->port->control &= ~(BRGEN|TXEN|RXEN);
40863 +    if (info->tty)
40864 +        set_bit (TTY_IO_ERROR, &info->tty->flags);
40865 +    info->is_initialized = 0;
40866 +
40867 +    restore_flags (flags);
40868 +}
40869 +/* 
40870 + * -------------------------------------------------------------------
40871 + * change_speed ()
40872 + *
40873 + * Set the baud rate, character size, parity and stop bits.
40874 + * ------------------------------------------------------------------- 
40875 + */
40876 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag )
40877 +{
40878 +    unsigned long ulFlags, ulBaud, ulClockFreqHz, ulTmp;
40879 +    save_flags(ulFlags);
40880 +    cli();
40881 +    switch( cFlag & (CBAUD | CBAUDEX) )
40882 +    {
40883 +    case B115200:
40884 +        ulBaud = 115200;
40885 +        break;
40886 +    case B57600:
40887 +        ulBaud = 57600;
40888 +        break;
40889 +    case B38400:
40890 +        ulBaud = 38400;
40891 +        break;
40892 +    case B19200:
40893 +        ulBaud = 19200;
40894 +        break;
40895 +    case B9600:
40896 +        ulBaud = 9600;
40897 +        break;
40898 +    case B4800:
40899 +        ulBaud = 4800;
40900 +        break;
40901 +    case B2400:
40902 +        ulBaud = 2400;
40903 +        break;
40904 +    case B1800:
40905 +        ulBaud = 1800;
40906 +        break;
40907 +    case B1200:
40908 +        ulBaud = 1200;
40909 +        break;
40910 +    case B600:
40911 +        ulBaud = 600;
40912 +        break;
40913 +    case B300:
40914 +        ulBaud = 300;
40915 +        break;
40916 +    case B200:
40917 +        ulBaud = 200;
40918 +        break;
40919 +    case B150:
40920 +        ulBaud = 150;
40921 +        break;
40922 +    case B134:
40923 +        ulBaud = 134;
40924 +        break;
40925 +    case B110:
40926 +        ulBaud = 110;
40927 +        break;
40928 +    case B75:
40929 +        ulBaud = 75;
40930 +        break;
40931 +    case B50:
40932 +        ulBaud = 50;
40933 +        break;
40934 +    default:
40935 +        ulBaud = 115200;
40936 +        break;
40937 +    }
40938 +
40939 +    /* Calculate buad rate.  */
40940 +    ulClockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
40941 +    ulTmp = (ulClockFreqHz / ulBaud) / 16;
40942 +    if( ulTmp & 0x01 )
40943 +        ulTmp /= 2; /* Rounding up, so sub is already accounted for */
40944 +    else
40945 +        ulTmp = (ulTmp / 2) - 1; /* Rounding down so we must sub 1 */
40946 +    pUart->baudword = ulTmp;
40947 +
40948 +    /* Set character size, stop bits and parity.  */
40949 +    switch( cFlag & CSIZE )
40950 +    {
40951 +    case CS5:
40952 +        ulTmp = BITS5SYM; /* select transmit 5 bit data size */
40953 +        break;
40954 +    case CS6:
40955 +        ulTmp = BITS6SYM; /* select transmit 6 bit data size */
40956 +        break;
40957 +    case CS7:
40958 +        ulTmp = BITS7SYM; /* select transmit 7 bit data size */
40959 +        break;
40960 +    /*case CS8:*/
40961 +    default:
40962 +        ulTmp = BITS8SYM; /* select transmit 8 bit data size */
40963 +        break;
40964 +    }
40965 +    if( cFlag & CSTOPB )
40966 +        ulTmp |= TWOSTOP;         /* select 2 stop bits */
40967 +    else
40968 +        ulTmp |= ONESTOP;         /* select one stop bit */
40969 +
40970 +    /* Write these values into the config reg.  */
40971 +    pUart->config = ulTmp;
40972 +    pUart->control &= ~(RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN);
40973 +    switch( cFlag & (PARENB | PARODD) )
40974 +    {
40975 +    case PARENB|PARODD:
40976 +        pUart->control |= RXPARITYEN | TXPARITYEN;
40977 +        break;
40978 +    case PARENB:
40979 +        pUart->control |= RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN;
40980 +        break;
40981 +    default:
40982 +        pUart->control |= 0;
40983 +        break;
40984 +    }
40985 +
40986 +    /* Reset and flush uart */
40987 +    pUart->fifoctl = RSTTXFIFOS | RSTRXFIFOS;
40988 +    restore_flags( ulFlags );
40989 +}
40990 +
40991 +
40992 +/* 
40993 + * -------------------------------------------------------------------
40994 + * bcm_flush_char ()
40995 + *
40996 + * Nothing to flush.  Polled I/O is used.
40997 + * ------------------------------------------------------------------- 
40998 + */
40999 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty)
41000 +{
41001 +}
41002 +
41003 +
41004 +/* 
41005 + * -------------------------------------------------------------------
41006 + * bcm63xx_cons_write ()
41007 + *
41008 + * Main output routine using polled I/O.
41009 + * ------------------------------------------------------------------- 
41010 + */
41011 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
41012 +    const unsigned char *buf, int count)
41013 +{
41014 +    int c;
41015 +
41016 +    for (c = 0; c < count; c++)
41017 +        _putc(buf[c]);
41018 +    return count;
41019 +}
41020 +
41021 +/* 
41022 + * -------------------------------------------------------------------
41023 + * bcm63xx_cons_write_room ()
41024 + *
41025 + * Compute the amount of space available for writing.
41026 + * ------------------------------------------------------------------- 
41027 + */
41028 +static int bcm63xx_cons_write_room (struct tty_struct *tty)
41029 +{
41030 +    /* Pick a number.  Any number.  Polled I/O is used. */
41031 +    return 1024;
41032 +}
41033 +
41034 +/* 
41035 + * -------------------------------------------------------------------
41036 + * bcm_chars_in_buffer ()
41037 + *
41038 + * compute the amount of char left to be transmitted
41039 + * ------------------------------------------------------------------- 
41040 + */
41041 +static int bcm_chars_in_buffer (struct tty_struct *tty)
41042 +{
41043 +    return 0;
41044 +}
41045 +
41046 +/* 
41047 + * -------------------------------------------------------------------
41048 + * bcm_flush_buffer ()
41049 + *
41050 + * Empty the output buffer
41051 + * ------------------------------------------------------------------- 
41052 + */
41053 +static void bcm_flush_buffer (struct tty_struct *tty)
41054 +{
41055 +}
41056 +
41057 +/*
41058 + * ------------------------------------------------------------
41059 + * bcm_throttle () and bcm_unthrottle ()
41060 + * 
41061 + * This routine is called by the upper-layer tty layer to signal that
41062 + * incoming characters should be throttled (or not).
41063 + * ------------------------------------------------------------
41064 + */
41065 +static void bcm_throttle (struct tty_struct *tty)
41066 +{
41067 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;  
41068 +    if (I_IXOFF(tty))
41069 +        info->x_char = STOP_CHAR(tty);
41070 +}
41071 +
41072 +static void bcm_unthrottle (struct tty_struct *tty)
41073 +{
41074 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;  
41075 +    if (I_IXOFF(tty))
41076 +    {
41077 +        if (info->x_char)
41078 +            info->x_char = 0;
41079 +        else
41080 +            info->x_char = START_CHAR(tty);
41081 +    }
41082 +}
41083 +
41084 +static void bcm_send_xchar (struct tty_struct *tty, char ch)
41085 +{
41086 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
41087 +    info->x_char = ch;
41088 +    if (ch)
41089 +        bcm_start (info->tty);
41090 +}
41091 +
41092 +/*
41093 + * ------------------------------------------------------------
41094 + * rs_ioctl () and friends
41095 + * ------------------------------------------------------------
41096 + */
41097 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo)
41098 +{
41099 +    struct serial_struct tmp;
41100 +
41101 +    if (!retinfo)
41102 +        return -EFAULT;
41103 +
41104 +    memset (&tmp, 0, sizeof(tmp));
41105 +    tmp.type            = info->type;
41106 +    tmp.line            = info->line;
41107 +    tmp.port            = (int) info->port;
41108 +    tmp.irq             = info->irq;
41109 +    tmp.flags           = 0;
41110 +    tmp.baud_base       = info->baud_base;
41111 +    tmp.close_delay     = info->close_delay;
41112 +    tmp.closing_wait    = info->closing_wait;
41113 +
41114 +    return copy_to_user (retinfo, &tmp, sizeof(*retinfo));
41115 +}
41116 +
41117 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info)
41118 +{
41119 +    struct serial_struct new_serial;
41120 +    struct bcm_serial old_info;
41121 +    int retval = 0;
41122 +
41123 +    if (!new_info)
41124 +        return -EFAULT;
41125 +
41126 +    copy_from_user (&new_serial, new_info, sizeof(new_serial));
41127 +    old_info = *info;
41128 +
41129 +    if (!capable(CAP_SYS_ADMIN))
41130 +        return -EPERM;
41131 +
41132 +
41133 +    if (info->count > 1)
41134 +        return -EBUSY;
41135 +
41136 +    /* OK, past this point, all the error checking has been done.
41137 +     * At this point, we start making changes.....
41138 +     */
41139 +    info->baud_base = new_serial.baud_base;
41140 +    info->type = new_serial.type;
41141 +    info->close_delay = new_serial.close_delay;
41142 +    info->closing_wait = new_serial.closing_wait;
41143 +    retval = startup (info);
41144 +    return retval;
41145 +}
41146 +
41147 +/*
41148 + * get_lsr_info - get line status register info
41149 + *
41150 + * Purpose: Let user call ioctl() to get info when the UART physically
41151 + *          is emptied.  On bus types like RS485, the transmitter must
41152 + *          release the bus after transmitting. This must be done when
41153 + *          the transmit shift register is empty, not be done when the
41154 + *          transmit holding register is empty.  This functionality
41155 + *          allows an RS485 driver to be written in user space. 
41156 + */
41157 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value)
41158 +{
41159 +    return( 0 );
41160 +}
41161 +
41162 +/*
41163 + * This routine sends a break character out the serial port.
41164 + */
41165 +static void send_break (struct bcm_serial *info, int duration)
41166 +{
41167 +    unsigned long flags;
41168 +
41169 +    if (!info->port)
41170 +        return;
41171 +
41172 +    current->state = TASK_INTERRUPTIBLE;
41173 +
41174 +    save_flags (flags);
41175 +    cli();
41176 +
41177 +    info->port->control |= XMITBREAK;
41178 +    schedule_timeout(duration);
41179 +    info->port->control &= ~XMITBREAK;
41180 +
41181 +    restore_flags (flags);
41182 +}
41183 +
41184 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
41185 +    unsigned int cmd, unsigned long arg)
41186 +{
41187 +    int error;
41188 +    struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
41189 +    int retval;
41190 +
41191 +    if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
41192 +        (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD)  &&
41193 +        (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT))
41194 +    {
41195 +        if (tty->flags & (1 << TTY_IO_ERROR))
41196 +            return -EIO;
41197 +    }
41198 +    switch (cmd) 
41199 +    {
41200 +
41201 +    case TCSBRK:    /* SVID version: non-zero arg --> no break */
41202 +        retval = tty_check_change (tty);
41203 +        if (retval)
41204 +            return retval;
41205 +        tty_wait_until_sent (tty, 0);
41206 +        if (!arg)
41207 +            send_break (info, HZ/4); /* 1/4 second */
41208 +        return 0;
41209 +
41210 +    case TCSBRKP:   /* support for POSIX tcsendbreak() */
41211 +        retval = tty_check_change (tty);
41212 +        if (retval)
41213 +            return retval;
41214 +        tty_wait_until_sent (tty, 0);
41215 +        send_break (info, arg ? arg*(HZ/10) : HZ/4);
41216 +        return 0;
41217 +
41218 +    case TIOCGSOFTCAR:
41219 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(long));
41220 +        if (error)
41221 +            return error;
41222 +        put_user (C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
41223 +        return 0;
41224 +
41225 +    case TIOCSSOFTCAR:
41226 +        error = get_user (arg, (unsigned long *)arg);
41227 +        if (error)
41228 +            return error;
41229 +        tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
41230 +        return 0;
41231 +
41232 +    case TIOCGSERIAL:
41233 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct serial_struct));
41234 +        if (error)
41235 +            return error;
41236 +        return get_serial_info (info, (struct serial_struct *)arg);
41237 +
41238 +    case TIOCSSERIAL:
41239 +        return set_serial_info (info, (struct serial_struct *) arg);
41240 +
41241 +    case TIOCSERGETLSR: /* Get line status register */
41242 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(unsigned int));
41243 +        if (error)
41244 +            return error;
41245 +        else
41246 +            return get_lsr_info (info, (unsigned int *)arg);
41247 +
41248 +    case TIOCSERGSTRUCT:
41249 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct bcm_serial));
41250 +        if (error)
41251 +            return error;
41252 +        copy_to_user((struct bcm_serial *)arg, info, sizeof(struct bcm_serial));
41253 +        return 0;
41254 +
41255 +    default:
41256 +        return -ENOIOCTLCMD;
41257 +    }
41258 +    return 0;
41259 +}
41260 +
41261 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios)
41262 +{
41263 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
41264 +
41265 +    if( tty->termios->c_cflag != old_termios->c_cflag )
41266 +        change_speed (info->port, tty->termios->c_cflag);
41267 +}
41268 +
41269 +/*
41270 + * ------------------------------------------------------------
41271 + * bcm63xx_cons_close()
41272 + * 
41273 + * This routine is called when the serial port gets closed.  First, we
41274 + * wait for the last remaining data to be sent.  Then, we turn off
41275 + * the transmit enable and receive enable flags.
41276 + * ------------------------------------------------------------
41277 + */
41278 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp)
41279 +{
41280 +    struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
41281 +    unsigned long flags;
41282 +
41283 +    if (!info)
41284 +        return;
41285 +
41286 +    save_flags (flags); 
41287 +    cli();
41288 +
41289 +    if (tty_hung_up_p (filp))
41290 +    {
41291 +        restore_flags (flags);
41292 +        return;
41293 +    }
41294 +
41295 +    if ((tty->count == 1) && (info->count != 1))
41296 +    {
41297 +
41298 +        /* Uh, oh.  tty->count is 1, which means that the tty
41299 +         * structure will be freed.  Info->count should always
41300 +         * be one in these conditions.  If it's greater than
41301 +         * one, we've got real problems, since it means the
41302 +         * serial port won't be shutdown.
41303 +         */
41304 +        printk("bcm63xx_cons_close: bad serial port count; tty->count is 1, "
41305 +            "info->count is %d\n", info->count);
41306 +        info->count = 1;
41307 +    }
41308 +
41309 +    if (--info->count < 0)
41310 +    {
41311 +        printk("ds_close: bad serial port count for ttys%d: %d\n",
41312 +        info->line, info->count);
41313 +        info->count = 0;
41314 +    }
41315 +
41316 +    if (info->count)
41317 +    {
41318 +        restore_flags (flags);
41319 +        return;
41320 +    }
41321 +
41322 +    /* Now we wait for the transmit buffer to clear; and we notify 
41323 +     * the line discipline to only process XON/XOFF characters.
41324 +     */
41325 +    tty->closing = 1;
41326 +
41327 +    /* At this point we stop accepting input.  To do this, we
41328 +     * disable the receive line status interrupts.
41329 +     */
41330 +    shutdown (info);
41331 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
41332 +    if (tty->driver->flush_buffer)
41333 +        tty->driver->flush_buffer (tty);
41334 +#else    
41335 +    if (tty->driver.flush_buffer)
41336 +        tty->driver.flush_buffer (tty);
41337 +#endif
41338 +    if (tty->ldisc.flush_buffer)
41339 +        tty->ldisc.flush_buffer (tty);
41340 +
41341 +    tty->closing = 0;
41342 +    info->event = 0;
41343 +    info->tty = 0;
41344 +    if (tty->ldisc.num != ldiscs[N_TTY].num)
41345 +    {
41346 +        if (tty->ldisc.close)
41347 +            (tty->ldisc.close)(tty);
41348 +        tty->ldisc = ldiscs[N_TTY];
41349 +        tty->termios->c_line = N_TTY;
41350 +        if (tty->ldisc.open)
41351 +            (tty->ldisc.open)(tty);
41352 +    }
41353 +    if (info->blocked_open)
41354 +    {
41355 +        if (info->close_delay)
41356 +        {
41357 +            current->state = TASK_INTERRUPTIBLE;
41358 +            schedule_timeout(info->close_delay);
41359 +        }
41360 +        wake_up_interruptible (&info->open_wait);
41361 +    }
41362 +    wake_up_interruptible (&info->close_wait);
41363 +
41364 +    restore_flags (flags);
41365 +}
41366 +
41367 +/*
41368 + * bcm_hangup () --- called by tty_hangup() when a hangup is signaled.
41369 + */
41370 +static void bcm_hangup (struct tty_struct *tty)
41371 +{
41372 +
41373 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
41374 +
41375 +    shutdown (info);
41376 +    info->event = 0;
41377 +    info->count = 0;
41378 +    info->tty = 0;
41379 +    wake_up_interruptible (&info->open_wait);
41380 +}
41381 +
41382 +/*
41383 + * ------------------------------------------------------------
41384 + * rs_open() and friends
41385 + * ------------------------------------------------------------
41386 + */
41387 +static int block_til_ready (struct tty_struct *tty, struct file *filp,
41388 +    struct bcm_serial *info)
41389 +{
41390 +    return 0;
41391 +}       
41392 +
41393 +/*
41394 + * This routine is called whenever a serial port is opened.  It
41395 + * enables interrupts for a serial port. It also performs the 
41396 + * serial-specific initialization for the tty structure.
41397 + */
41398 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp)
41399 +{
41400 +    struct bcm_serial *info;
41401 +    int retval, line;
41402 +
41403 +    // Make sure we're only opening on of the ports we support
41404 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
41405 +    line = MINOR(tty->driver->cdev.dev) - tty->driver->minor_start;
41406 +#else
41407 +    line = MINOR(tty->device) - tty->driver.minor_start;
41408 +#endif    
41409 +
41410 +    if ((line < 0) || (line >= BCM_NUM_UARTS))
41411 +        return -ENODEV;
41412 +
41413 +    info = lines[line];
41414 +
41415 +    info->port->intMask  = 0;     /* Clear any pending interrupts */
41416 +    info->port->intMask  = RXINT; /* Enable RX */
41417 +
41418 +    info->count++;
41419 +    tty->driver_data = info;
41420 +    info->tty = tty;
41421 +    BcmHalInterruptEnable (INTERRUPT_ID_UART);
41422 +
41423 +    // Start up serial port
41424 +    retval = startup (info);
41425 +    if (retval)
41426 +        return retval;
41427 +
41428 +    retval = block_til_ready (tty, filp, info);
41429 +    if (retval)
41430 +        return retval;
41431 +
41432 +
41433 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
41434 +    info->pgrp = process_group(current);
41435 +    info->session = current->signal->session;
41436 +#else
41437 +    info->session = current->session;    
41438 +    info->pgrp = current->pgrp;
41439 +#endif    
41440 +
41441 +    return 0;
41442 +}
41443 +
41444 +/* --------------------------------------------------------------------------
41445 +    Name: bcm63xx_serialinit
41446 + Purpose: Initialize our BCM63xx serial driver
41447 +-------------------------------------------------------------------------- */
41448 +static int __init bcm63xx_serialinit(void)
41449 +{
41450 +    int i, flags;
41451 +    struct bcm_serial * info;
41452 +
41453 +    // Print the driver version information
41454 +    printk(VER_STR);
41455 +
41456 +    memset(&serial_driver, 0, sizeof(struct tty_driver));
41457 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)     
41458 +    serial_driver.owner            = THIS_MODULE;
41459 +    serial_driver.devfs_name       = "tts/";
41460 +#endif    
41461 +    serial_driver.magic             = TTY_DRIVER_MAGIC;
41462 +    serial_driver.name              = "ttyS";
41463 +    serial_driver.major             = TTY_MAJOR;
41464 +    serial_driver.minor_start       = 64;
41465 +    serial_driver.num               = BCM_NUM_UARTS;
41466 +    serial_driver.type              = TTY_DRIVER_TYPE_SERIAL;
41467 +    serial_driver.subtype           = SERIAL_TYPE_NORMAL;
41468 +    serial_driver.init_termios      = tty_std_termios;
41469 +    serial_driver.init_termios.c_cflag = B115200 | CS8 | CREAD | CLOCAL;
41470 +    serial_driver.flags             = TTY_DRIVER_REAL_RAW;
41471 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)    
41472 +    serial_driver.refcount          = serial_refcount;
41473 +    serial_driver.ttys             = serial_table;    
41474 +#else
41475 +    serial_driver.refcount          = &serial_refcount;
41476 +    serial_driver.table             = serial_table;    
41477 +#endif    
41478 +
41479 +    serial_driver.termios           = serial_termios;
41480 +    serial_driver.termios_locked    = serial_termios_locked;
41481 +    serial_driver.open              = bcm63xx_cons_open;
41482 +    serial_driver.close             = bcm63xx_cons_close;
41483 +    serial_driver.write             = bcm63xx_cons_write;
41484 +    serial_driver.flush_chars       = bcm63xx_cons_flush_chars;
41485 +    serial_driver.write_room        = bcm63xx_cons_write_room;
41486 +    serial_driver.chars_in_buffer   = bcm_chars_in_buffer;
41487 +    serial_driver.flush_buffer      = bcm_flush_buffer;
41488 +    serial_driver.ioctl             = bcm_ioctl;
41489 +    serial_driver.throttle          = bcm_throttle;
41490 +    serial_driver.unthrottle        = bcm_unthrottle;
41491 +    serial_driver.send_xchar        = bcm_send_xchar;
41492 +    serial_driver.set_termios       = bcm_set_termios;
41493 +    serial_driver.stop              = bcm_stop;
41494 +    serial_driver.start             = bcm_start;
41495 +    serial_driver.hangup            = bcm_hangup;
41496 +
41497 +    if (tty_register_driver (&serial_driver))
41498 +        panic("Couldn't register serial driver\n");
41499 +
41500 +    save_flags(flags); cli();
41501 +    for (i = 0; i < BCM_NUM_UARTS; i++)
41502 +    {
41503 +        info = &multi[i]; 
41504 +        lines[i] = info;
41505 +        info->port                  = (Uart *) ((char *)UART_BASE + (i * 0x20));
41506 +        info->irq                   = (2 - i) + 8;
41507 +        info->line                  = i;
41508 +        info->tty                   = 0;
41509 +        info->close_delay           = 50;
41510 +        info->closing_wait          = 3000;
41511 +        info->x_char                = 0;
41512 +        info->event                 = 0;
41513 +        info->count                 = 0;
41514 +        info->blocked_open          = 0;       
41515 +        info->normal_termios        = serial_driver.init_termios;
41516 +        init_waitqueue_head(&info->open_wait); 
41517 +        init_waitqueue_head(&info->close_wait); 
41518 +
41519 +        /* If we are pointing to address zero then punt - not correctly
41520 +         * set up in setup.c to handle this. 
41521 +         */
41522 +        if (! info->port)
41523 +            return 0;
41524 +        BcmHalMapInterrupt(bcm_interrupt, 0, INTERRUPT_ID_UART);
41525 +    }
41526 +
41527 +    /* order matters here... the trick is that flags
41528 +     * is updated... in request_irq - to immediatedly obliterate
41529 +     * it is unwise. 
41530 +     */
41531 +    restore_flags(flags);
41532 +    return 0;
41533 +}
41534 +
41535 +module_init(bcm63xx_serialinit);
41536 +
41537 +/* --------------------------------------------------------------------------
41538 +    Name: bcm_console_print
41539 + Purpose: bcm_console_print is registered for printk.
41540 +          The console_lock must be held when we get here.
41541 +-------------------------------------------------------------------------- */
41542 +static void bcm_console_print (struct console * cons, const char * str,
41543 +    unsigned int count)
41544 +{
41545 +    unsigned int i;
41546 +    //_puts(str);
41547 +    for(i=0; i<count; i++, str++)
41548 +    {
41549 +        _putc(*str);
41550 +        if (*str == 10)
41551 +        {
41552 +            _putc(13);
41553 +        }
41554 +    }
41555 +}
41556 +
41557 +static struct tty_driver * bcm_console_device(struct console * c, int *index)
41558 +{
41559 +    *index = c->index;
41560 +    return &serial_driver;
41561 +}
41562 +
41563 +static int __init bcm_console_setup(struct console * co, char * options)
41564 +{
41565 +    return 0;
41566 +}
41567 +
41568 +static struct console bcm_sercons = {
41569 +    .name      = "ttyS",
41570 +    .write     = bcm_console_print,
41571 +    .device    = bcm_console_device,
41572 +    .setup     = bcm_console_setup,
41573 +    .flags     = CON_PRINTBUFFER, // CON_CONSDEV, CONSOLE_LINE,
41574 +    .index     = -1,
41575 +};
41576 +
41577 +static int __init bcm63xx_console_init(void)
41578 +{
41579 +    register_console(&bcm_sercons);
41580 +    return 0;
41581 +}
41582 +
41583 +console_initcall(bcm63xx_console_init);
41584 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/serial/impl1/Makefile linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/impl1/Makefile
41585 --- linux-2.6.8.1/bcmdrivers/opensource/char/serial/impl1/Makefile      1970-01-01 01:00:00.000000000 +0100
41586 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/impl1/Makefile     2006-06-26 09:07:10.000000000 +0200
41587 @@ -0,0 +1,13 @@
41588 +# File: bcmdrivers/opensource/char/serial
41589 +#
41590 +# Makefile for the BCM63xx serial/console driver
41591 +
41592 +obj-$(CONFIG_BCM_SERIAL) += bcm63xx_cons.o
41593 +
41594 +EXTRA_CFLAGS += -I$(INC_BRCMDRIVER_PUB_PATH)/$(BRCM_BOARD)
41595 +
41596 +-include $(TOPDIR)/Rules.make
41597 +
41598 +clean:
41599 +       rm -f core *.o *.a *.s
41600 +
41601 diff -urN linux-2.6.8.1/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c
41602 --- linux-2.6.8.1/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c        1970-01-01 01:00:00.000000000 +0100
41603 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/char/serial/impl1/bcm63xx_cons.c       2006-06-26 09:07:10.000000000 +0200
41604 @@ -0,0 +1,1035 @@
41605 +/*
41606 +<:copyright-gpl 
41607 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
41608
41609 + This program is free software; you can distribute it and/or modify it 
41610 + under the terms of the GNU General Public License (Version 2) as 
41611 + published by the Free Software Foundation. 
41612
41613 + This program is distributed in the hope it will be useful, but WITHOUT 
41614 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
41615 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
41616 + for more details. 
41617
41618 + You should have received a copy of the GNU General Public License along 
41619 + with this program; if not, write to the Free Software Foundation, Inc., 
41620 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
41621 +:>
41622 +*/
41623 +
41624 +/* Description: Serial port driver for the BCM963XX. */
41625 +
41626 +#define CARDNAME    "bcm963xx_serial driver"
41627 +#define VERSION     "2.0"
41628 +#define VER_STR     CARDNAME " v" VERSION "\n"
41629 +
41630 +
41631 +#include <linux/kernel.h>
41632 +#include <linux/module.h>
41633 +#include <linux/version.h>
41634 +#include <linux/init.h> 
41635 +#include <linux/slab.h>
41636 +#include <linux/interrupt.h>
41637 +
41638 +/* for definition of struct console */
41639 +#include <linux/console.h>
41640 +#include <linux/tty.h>
41641 +#include <linux/tty_flip.h>
41642 +#include <linux/serial.h>
41643 +#include <asm/uaccess.h>
41644 +
41645 +#include <bcmtypes.h>
41646 +#include <board.h>
41647 +#include <bcm_map_part.h>
41648 +#include <bcm_intr.h>
41649 +
41650 +extern void _putc(char);
41651 +extern void _puts(const char *);
41652 +
41653 +typedef struct bcm_serial {
41654 +    volatile Uart *         port;
41655 +    int                     type;
41656 +    int                     flags; 
41657 +    int                     irq;
41658 +    int                     baud_base;
41659 +    int                     blocked_open;
41660 +    unsigned short          close_delay;
41661 +    unsigned short          closing_wait;
41662 +    unsigned short          line;                /* port/line number */
41663 +    unsigned short          cflags;              /* line configuration flag */
41664 +    unsigned short          x_char;              /* xon/xoff character */
41665 +    unsigned short          read_status_mask;    /* mask for read condition */
41666 +    unsigned short          ignore_status_mask;  /* mask for ignore condition */
41667 +    unsigned long           event;               /* mask used in BH */
41668 +    int                     xmit_head;           /* Position of the head */
41669 +    int                     xmit_tail;           /* Position of the tail */
41670 +    int                     xmit_cnt;            /* Count of the chars in the buffer */
41671 +    int                     count;               /* indicates how many times it has been opened */
41672 +    int                     magic;
41673 +
41674 +    struct async_icount     icount;              /* keep track of things ... */
41675 +    struct tty_struct       *tty;                /* tty associated */    
41676 +    struct termios          normal_termios;
41677 +
41678 +    wait_queue_head_t       open_wait;
41679 +    wait_queue_head_t       close_wait;
41680 +
41681 +    long                    session;             /* Session of opening process */
41682 +    long                    pgrp;                /* pgrp of opening process */
41683 +
41684 +    unsigned char           is_initialized;
41685 +} Context;
41686 +
41687 +
41688 +/*---------------------------------------------------------------------*/
41689 +/* Define bits in the Interrupt Enable register                        */
41690 +/*---------------------------------------------------------------------*/
41691 +/* Enable receive interrupt              */
41692 +#define RXINT   (RXFIFONE|RXOVFERR)
41693 +
41694 +/* Enable transmit interrupt             */
41695 +#define TXINT    (TXFIFOEMT|TXUNDERR|TXOVFERR) 
41696 +
41697 +/* Enable receiver line status interrupt */
41698 +#define LSINT    (RXBRK|RXPARERR|RXFRAMERR)
41699 +
41700 +#define BCM_NUM_UARTS                   1
41701 +
41702 +#define BD_BCM63XX_TIMER_CLOCK_INPUT    (FPERIPH)
41703 +
41704 +
41705 +static struct bcm_serial multi[BCM_NUM_UARTS];
41706 +static struct bcm_serial *lines[BCM_NUM_UARTS];
41707 +static struct tty_driver serial_driver;
41708 +static struct tty_struct *serial_table[BCM_NUM_UARTS];
41709 +static struct termios *serial_termios[BCM_NUM_UARTS];
41710 +static struct termios *serial_termios_locked[BCM_NUM_UARTS];
41711 +static int serial_refcount;
41712 +
41713 +
41714 +static void bcm_stop (struct tty_struct *tty);
41715 +static void bcm_start (struct tty_struct *tty);
41716 +static inline void receive_chars (struct bcm_serial * info);
41717 +static int startup (struct bcm_serial *info);
41718 +static void shutdown (struct bcm_serial * info);
41719 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag );
41720 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty);
41721 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
41722 +    const unsigned char *buf, int count);
41723 +static int bcm63xx_cons_write_room (struct tty_struct *tty);
41724 +static int bcm_chars_in_buffer (struct tty_struct *tty);
41725 +static void bcm_flush_buffer (struct tty_struct *tty);
41726 +static void bcm_throttle (struct tty_struct *tty);
41727 +static void bcm_unthrottle (struct tty_struct *tty);
41728 +static void bcm_send_xchar (struct tty_struct *tty, char ch);
41729 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo);
41730 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info);
41731 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value);
41732 +static void send_break (struct bcm_serial *info, int duration);
41733 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
41734 +    unsigned int cmd, unsigned long arg);
41735 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios);
41736 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp);
41737 +static void bcm_hangup (struct tty_struct *tty);
41738 +static int block_til_ready (struct tty_struct *tty, struct file *filp, struct bcm_serial *info);
41739 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp);
41740 +static int __init bcm63xx_serialinit(void);
41741 +
41742 +
41743 +/*
41744 + * ------------------------------------------------------------
41745 + * rs_stop () and rs_start ()
41746 + *
41747 + * These routines are called before setting or resetting 
41748 + * tty->stopped. They enable or disable transmitter interrupts, 
41749 + * as necessary.
41750 + * ------------------------------------------------------------
41751 + */
41752 +static void bcm_stop (struct tty_struct *tty)
41753 +{
41754 +}  
41755 +
41756 +static void bcm_start (struct tty_struct *tty)
41757 +{
41758 +    _puts(CARDNAME " Start\n");
41759 +}  
41760 +
41761 +/*
41762 + * ------------------------------------------------------------
41763 + * receive_char ()
41764 + *
41765 + * This routine deals with inputs from any lines.
41766 + * ------------------------------------------------------------
41767 + */
41768 +static inline void receive_chars (struct bcm_serial * info)
41769 +{
41770 +    struct tty_struct *tty = 0;
41771 +    struct async_icount * icount;
41772 +    int ignore = 0;
41773 +    unsigned short status, tmp;
41774 +    UCHAR ch = 0;
41775 +    while ((status = info->port->intStatus) & RXINT)
41776 +    {
41777 +        if (status & RXFIFONE)
41778 +            ch = info->port->Data;  // Read the character
41779 +        tty = info->tty;                  /* now tty points to the proper dev */
41780 +        icount = &info->icount;
41781 +        if (! tty)
41782 +            break;
41783 +        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
41784 +            break;
41785 +        *tty->flip.char_buf_ptr = ch;
41786 +        *tty->flip.flag_buf_ptr = 0;
41787 +        icount->rx++;
41788 +        if (status & RXBRK)
41789 +        {
41790 +            *tty->flip.flag_buf_ptr = TTY_BREAK;
41791 +            icount->brk++;
41792 +        }
41793 +        // keep track of the statistics
41794 +        if (status & (RXFRAMERR | RXPARERR | RXOVFERR))
41795 +        {
41796 +            if (status & RXPARERR)                /* parity error */
41797 +                icount->parity++;
41798 +            else
41799 +                if (status & RXFRAMERR)           /* frame error */
41800 +                    icount->frame++;
41801 +            if (status & RXOVFERR)
41802 +            {
41803 +                // Overflow. Reset the RX FIFO
41804 +                info->port->fifoctl |= RSTRXFIFOS;
41805 +                icount->overrun++;
41806 +            }
41807 +            // check to see if we should ignore the character
41808 +            // and mask off conditions that should be ignored
41809 +            if (status & info->ignore_status_mask)
41810 +            {
41811 +                if (++ignore > 100 )
41812 +                    break;
41813 +                goto ignore_char;
41814 +            }
41815 +            // Mask off the error conditions we want to ignore
41816 +            tmp = status & info->read_status_mask;
41817 +            if (tmp & RXPARERR)
41818 +            {
41819 +                *tty->flip.flag_buf_ptr = TTY_PARITY;
41820 +            }
41821 +            else
41822 +                if (tmp & RXFRAMERR)
41823 +                {
41824 +                    *tty->flip.flag_buf_ptr = TTY_FRAME;
41825 +                }
41826 +            if (tmp & RXOVFERR)
41827 +            {
41828 +                if (tty->flip.count < TTY_FLIPBUF_SIZE)
41829 +                {
41830 +                    tty->flip.count++;
41831 +                    tty->flip.flag_buf_ptr++;
41832 +                    tty->flip.char_buf_ptr++;
41833 +                    *tty->flip.flag_buf_ptr = TTY_OVERRUN;
41834 +                }
41835 +            }
41836 +        }
41837 +        tty->flip.flag_buf_ptr++;
41838 +        tty->flip.char_buf_ptr++;
41839 +        tty->flip.count++;
41840 +    }
41841 +ignore_char:
41842 +    if (tty)
41843 +        tty_flip_buffer_push(tty);
41844 +}
41845 +
41846 +
41847 +/*
41848 + * ------------------------------------------------------------
41849 + * bcm_interrupt ()
41850 + *
41851 + * this is the main interrupt routine for the chip.
41852 + * It deals with the multiple ports.
41853 + * ------------------------------------------------------------
41854 + */
41855 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
41856 +static irqreturn_t bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
41857 +#else
41858 +static void bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
41859 +#endif
41860 +{
41861 +    struct bcm_serial * info = lines[0];
41862 +    UINT16  intStat;
41863 +
41864 +    /* get pending interrupt flags from UART  */
41865 +
41866 +    /* Mask with only the serial interrupts that are enabled */
41867 +    intStat = info->port->intStatus & info->port->intMask;
41868 +    while (intStat)
41869 +    {
41870 +        if (intStat & RXINT)
41871 +            receive_chars (info);          
41872 +        else
41873 +            if (intStat & TXINT)
41874 +                info->port->intStatus = TXINT;
41875 +            else /* don't know what it was, so let's mask it */
41876 +                info->port->intMask &= ~intStat;
41877 +
41878 +        intStat = info->port->intStatus & info->port->intMask;
41879 +    }
41880 +
41881 +    // Clear the interrupt
41882 +    BcmHalInterruptEnable (INTERRUPT_ID_UART);
41883 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
41884 +    return IRQ_HANDLED;
41885 +#endif    
41886 +}
41887 +
41888 +/*
41889 + * -------------------------------------------------------------------
41890 + * startup ()
41891 + *
41892 + * various initialization tasks
41893 + * ------------------------------------------------------------------- 
41894 + */
41895 +static int startup (struct bcm_serial *info)
41896 +{
41897 +    // Port is already started...
41898 +    return 0;
41899 +}
41900 +
41901 +/* 
41902 + * -------------------------------------------------------------------
41903 + * shutdown ()
41904 + *
41905 + * This routine will shutdown a serial port; interrupts are disabled, and
41906 + * DTR is dropped if the hangup on close termio flag is on.
41907 + * ------------------------------------------------------------------- 
41908 + */
41909 +static void shutdown (struct bcm_serial * info)
41910 +{
41911 +    unsigned long flags;
41912 +    if (!info->is_initialized)
41913 +        return;
41914 +
41915 +    save_flags (flags);
41916 +    cli ();
41917 +
41918 +    info->port->control &= ~(BRGEN|TXEN|RXEN);
41919 +    if (info->tty)
41920 +        set_bit (TTY_IO_ERROR, &info->tty->flags);
41921 +    info->is_initialized = 0;
41922 +
41923 +    restore_flags (flags);
41924 +}
41925 +/* 
41926 + * -------------------------------------------------------------------
41927 + * change_speed ()
41928 + *
41929 + * Set the baud rate, character size, parity and stop bits.
41930 + * ------------------------------------------------------------------- 
41931 + */
41932 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag )
41933 +{
41934 +    unsigned long ulFlags, ulBaud, ulClockFreqHz, ulTmp;
41935 +    save_flags(ulFlags);
41936 +    cli();
41937 +    switch( cFlag & (CBAUD | CBAUDEX) )
41938 +    {
41939 +    case B115200:
41940 +        ulBaud = 115200;
41941 +        break;
41942 +    case B57600:
41943 +        ulBaud = 57600;
41944 +        break;
41945 +    case B38400:
41946 +        ulBaud = 38400;
41947 +        break;
41948 +    case B19200:
41949 +        ulBaud = 19200;
41950 +        break;
41951 +    case B9600:
41952 +        ulBaud = 9600;
41953 +        break;
41954 +    case B4800:
41955 +        ulBaud = 4800;
41956 +        break;
41957 +    case B2400:
41958 +        ulBaud = 2400;
41959 +        break;
41960 +    case B1800:
41961 +        ulBaud = 1800;
41962 +        break;
41963 +    case B1200:
41964 +        ulBaud = 1200;
41965 +        break;
41966 +    case B600:
41967 +        ulBaud = 600;
41968 +        break;
41969 +    case B300:
41970 +        ulBaud = 300;
41971 +        break;
41972 +    case B200:
41973 +        ulBaud = 200;
41974 +        break;
41975 +    case B150:
41976 +        ulBaud = 150;
41977 +        break;
41978 +    case B134:
41979 +        ulBaud = 134;
41980 +        break;
41981 +    case B110:
41982 +        ulBaud = 110;
41983 +        break;
41984 +    case B75:
41985 +        ulBaud = 75;
41986 +        break;
41987 +    case B50:
41988 +        ulBaud = 50;
41989 +        break;
41990 +    default:
41991 +        ulBaud = 115200;
41992 +        break;
41993 +    }
41994 +
41995 +    /* Calculate buad rate.  */
41996 +    ulClockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
41997 +    ulTmp = (ulClockFreqHz / ulBaud) / 16;
41998 +    if( ulTmp & 0x01 )
41999 +        ulTmp /= 2; /* Rounding up, so sub is already accounted for */
42000 +    else
42001 +        ulTmp = (ulTmp / 2) - 1; /* Rounding down so we must sub 1 */
42002 +    pUart->baudword = ulTmp;
42003 +
42004 +    /* Set character size, stop bits and parity.  */
42005 +    switch( cFlag & CSIZE )
42006 +    {
42007 +    case CS5:
42008 +        ulTmp = BITS5SYM; /* select transmit 5 bit data size */
42009 +        break;
42010 +    case CS6:
42011 +        ulTmp = BITS6SYM; /* select transmit 6 bit data size */
42012 +        break;
42013 +    case CS7:
42014 +        ulTmp = BITS7SYM; /* select transmit 7 bit data size */
42015 +        break;
42016 +    /*case CS8:*/
42017 +    default:
42018 +        ulTmp = BITS8SYM; /* select transmit 8 bit data size */
42019 +        break;
42020 +    }
42021 +    if( cFlag & CSTOPB )
42022 +        ulTmp |= TWOSTOP;         /* select 2 stop bits */
42023 +    else
42024 +        ulTmp |= ONESTOP;         /* select one stop bit */
42025 +
42026 +    /* Write these values into the config reg.  */
42027 +    pUart->config = ulTmp;
42028 +    pUart->control &= ~(RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN);
42029 +    switch( cFlag & (PARENB | PARODD) )
42030 +    {
42031 +    case PARENB|PARODD:
42032 +        pUart->control |= RXPARITYEN | TXPARITYEN;
42033 +        break;
42034 +    case PARENB:
42035 +        pUart->control |= RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN;
42036 +        break;
42037 +    default:
42038 +        pUart->control |= 0;
42039 +        break;
42040 +    }
42041 +
42042 +    /* Reset and flush uart */
42043 +    pUart->fifoctl = RSTTXFIFOS | RSTRXFIFOS;
42044 +    restore_flags( ulFlags );
42045 +}
42046 +
42047 +
42048 +/* 
42049 + * -------------------------------------------------------------------
42050 + * bcm_flush_char ()
42051 + *
42052 + * Nothing to flush.  Polled I/O is used.
42053 + * ------------------------------------------------------------------- 
42054 + */
42055 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty)
42056 +{
42057 +}
42058 +
42059 +
42060 +/* 
42061 + * -------------------------------------------------------------------
42062 + * bcm63xx_cons_write ()
42063 + *
42064 + * Main output routine using polled I/O.
42065 + * ------------------------------------------------------------------- 
42066 + */
42067 +static int bcm63xx_cons_write (struct tty_struct *tty, int from_user,
42068 +    const unsigned char *buf, int count)
42069 +{
42070 +    int c;
42071 +
42072 +    for (c = 0; c < count; c++)
42073 +        _putc(buf[c]);
42074 +    return count;
42075 +}
42076 +
42077 +/* 
42078 + * -------------------------------------------------------------------
42079 + * bcm63xx_cons_write_room ()
42080 + *
42081 + * Compute the amount of space available for writing.
42082 + * ------------------------------------------------------------------- 
42083 + */
42084 +static int bcm63xx_cons_write_room (struct tty_struct *tty)
42085 +{
42086 +    /* Pick a number.  Any number.  Polled I/O is used. */
42087 +    return 1024;
42088 +}
42089 +
42090 +/* 
42091 + * -------------------------------------------------------------------
42092 + * bcm_chars_in_buffer ()
42093 + *
42094 + * compute the amount of char left to be transmitted
42095 + * ------------------------------------------------------------------- 
42096 + */
42097 +static int bcm_chars_in_buffer (struct tty_struct *tty)
42098 +{
42099 +    return 0;
42100 +}
42101 +
42102 +/* 
42103 + * -------------------------------------------------------------------
42104 + * bcm_flush_buffer ()
42105 + *
42106 + * Empty the output buffer
42107 + * ------------------------------------------------------------------- 
42108 + */
42109 +static void bcm_flush_buffer (struct tty_struct *tty)
42110 +{
42111 +}
42112 +
42113 +/*
42114 + * ------------------------------------------------------------
42115 + * bcm_throttle () and bcm_unthrottle ()
42116 + * 
42117 + * This routine is called by the upper-layer tty layer to signal that
42118 + * incoming characters should be throttled (or not).
42119 + * ------------------------------------------------------------
42120 + */
42121 +static void bcm_throttle (struct tty_struct *tty)
42122 +{
42123 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;  
42124 +    if (I_IXOFF(tty))
42125 +        info->x_char = STOP_CHAR(tty);
42126 +}
42127 +
42128 +static void bcm_unthrottle (struct tty_struct *tty)
42129 +{
42130 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;  
42131 +    if (I_IXOFF(tty))
42132 +    {
42133 +        if (info->x_char)
42134 +            info->x_char = 0;
42135 +        else
42136 +            info->x_char = START_CHAR(tty);
42137 +    }
42138 +}
42139 +
42140 +static void bcm_send_xchar (struct tty_struct *tty, char ch)
42141 +{
42142 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
42143 +    info->x_char = ch;
42144 +    if (ch)
42145 +        bcm_start (info->tty);
42146 +}
42147 +
42148 +/*
42149 + * ------------------------------------------------------------
42150 + * rs_ioctl () and friends
42151 + * ------------------------------------------------------------
42152 + */
42153 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo)
42154 +{
42155 +    struct serial_struct tmp;
42156 +
42157 +    if (!retinfo)
42158 +        return -EFAULT;
42159 +
42160 +    memset (&tmp, 0, sizeof(tmp));
42161 +    tmp.type            = info->type;
42162 +    tmp.line            = info->line;
42163 +    tmp.port            = (int) info->port;
42164 +    tmp.irq             = info->irq;
42165 +    tmp.flags           = 0;
42166 +    tmp.baud_base       = info->baud_base;
42167 +    tmp.close_delay     = info->close_delay;
42168 +    tmp.closing_wait    = info->closing_wait;
42169 +
42170 +    return copy_to_user (retinfo, &tmp, sizeof(*retinfo));
42171 +}
42172 +
42173 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info)
42174 +{
42175 +    struct serial_struct new_serial;
42176 +    struct bcm_serial old_info;
42177 +    int retval = 0;
42178 +
42179 +    if (!new_info)
42180 +        return -EFAULT;
42181 +
42182 +    copy_from_user (&new_serial, new_info, sizeof(new_serial));
42183 +    old_info = *info;
42184 +
42185 +    if (!capable(CAP_SYS_ADMIN))
42186 +        return -EPERM;
42187 +
42188 +
42189 +    if (info->count > 1)
42190 +        return -EBUSY;
42191 +
42192 +    /* OK, past this point, all the error checking has been done.
42193 +     * At this point, we start making changes.....
42194 +     */
42195 +    info->baud_base = new_serial.baud_base;
42196 +    info->type = new_serial.type;
42197 +    info->close_delay = new_serial.close_delay;
42198 +    info->closing_wait = new_serial.closing_wait;
42199 +    retval = startup (info);
42200 +    return retval;
42201 +}
42202 +
42203 +/*
42204 + * get_lsr_info - get line status register info
42205 + *
42206 + * Purpose: Let user call ioctl() to get info when the UART physically
42207 + *          is emptied.  On bus types like RS485, the transmitter must
42208 + *          release the bus after transmitting. This must be done when
42209 + *          the transmit shift register is empty, not be done when the
42210 + *          transmit holding register is empty.  This functionality
42211 + *          allows an RS485 driver to be written in user space. 
42212 + */
42213 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value)
42214 +{
42215 +    return( 0 );
42216 +}
42217 +
42218 +/*
42219 + * This routine sends a break character out the serial port.
42220 + */
42221 +static void send_break (struct bcm_serial *info, int duration)
42222 +{
42223 +    unsigned long flags;
42224 +
42225 +    if (!info->port)
42226 +        return;
42227 +
42228 +    current->state = TASK_INTERRUPTIBLE;
42229 +
42230 +    save_flags (flags);
42231 +    cli();
42232 +
42233 +    info->port->control |= XMITBREAK;
42234 +    schedule_timeout(duration);
42235 +    info->port->control &= ~XMITBREAK;
42236 +
42237 +    restore_flags (flags);
42238 +}
42239 +
42240 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
42241 +    unsigned int cmd, unsigned long arg)
42242 +{
42243 +    int error;
42244 +    struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
42245 +    int retval;
42246 +
42247 +    if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
42248 +        (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD)  &&
42249 +        (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT))
42250 +    {
42251 +        if (tty->flags & (1 << TTY_IO_ERROR))
42252 +            return -EIO;
42253 +    }
42254 +    switch (cmd) 
42255 +    {
42256 +
42257 +    case TCSBRK:    /* SVID version: non-zero arg --> no break */
42258 +        retval = tty_check_change (tty);
42259 +        if (retval)
42260 +            return retval;
42261 +        tty_wait_until_sent (tty, 0);
42262 +        if (!arg)
42263 +            send_break (info, HZ/4); /* 1/4 second */
42264 +        return 0;
42265 +
42266 +    case TCSBRKP:   /* support for POSIX tcsendbreak() */
42267 +        retval = tty_check_change (tty);
42268 +        if (retval)
42269 +            return retval;
42270 +        tty_wait_until_sent (tty, 0);
42271 +        send_break (info, arg ? arg*(HZ/10) : HZ/4);
42272 +        return 0;
42273 +
42274 +    case TIOCGSOFTCAR:
42275 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(long));
42276 +        if (error)
42277 +            return error;
42278 +        put_user (C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
42279 +        return 0;
42280 +
42281 +    case TIOCSSOFTCAR:
42282 +        error = get_user (arg, (unsigned long *)arg);
42283 +        if (error)
42284 +            return error;
42285 +        tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
42286 +        return 0;
42287 +
42288 +    case TIOCGSERIAL:
42289 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct serial_struct));
42290 +        if (error)
42291 +            return error;
42292 +        return get_serial_info (info, (struct serial_struct *)arg);
42293 +
42294 +    case TIOCSSERIAL:
42295 +        return set_serial_info (info, (struct serial_struct *) arg);
42296 +
42297 +    case TIOCSERGETLSR: /* Get line status register */
42298 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(unsigned int));
42299 +        if (error)
42300 +            return error;
42301 +        else
42302 +            return get_lsr_info (info, (unsigned int *)arg);
42303 +
42304 +    case TIOCSERGSTRUCT:
42305 +        error = verify_area (VERIFY_WRITE, (void *)arg, sizeof(struct bcm_serial));
42306 +        if (error)
42307 +            return error;
42308 +        copy_to_user((struct bcm_serial *)arg, info, sizeof(struct bcm_serial));
42309 +        return 0;
42310 +
42311 +    default:
42312 +        return -ENOIOCTLCMD;
42313 +    }
42314 +    return 0;
42315 +}
42316 +
42317 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios)
42318 +{
42319 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
42320 +
42321 +    if( tty->termios->c_cflag != old_termios->c_cflag )
42322 +        change_speed (info->port, tty->termios->c_cflag);
42323 +}
42324 +
42325 +/*
42326 + * ------------------------------------------------------------
42327 + * bcm63xx_cons_close()
42328 + * 
42329 + * This routine is called when the serial port gets closed.  First, we
42330 + * wait for the last remaining data to be sent.  Then, we turn off
42331 + * the transmit enable and receive enable flags.
42332 + * ------------------------------------------------------------
42333 + */
42334 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp)
42335 +{
42336 +    struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
42337 +    unsigned long flags;
42338 +
42339 +    if (!info)
42340 +        return;
42341 +
42342 +    save_flags (flags); 
42343 +    cli();
42344 +
42345 +    if (tty_hung_up_p (filp))
42346 +    {
42347 +        restore_flags (flags);
42348 +        return;
42349 +    }
42350 +
42351 +    if ((tty->count == 1) && (info->count != 1))
42352 +    {
42353 +
42354 +        /* Uh, oh.  tty->count is 1, which means that the tty
42355 +         * structure will be freed.  Info->count should always
42356 +         * be one in these conditions.  If it's greater than
42357 +         * one, we've got real problems, since it means the
42358 +         * serial port won't be shutdown.
42359 +         */
42360 +        printk("bcm63xx_cons_close: bad serial port count; tty->count is 1, "
42361 +            "info->count is %d\n", info->count);
42362 +        info->count = 1;
42363 +    }
42364 +
42365 +    if (--info->count < 0)
42366 +    {
42367 +        printk("ds_close: bad serial port count for ttys%d: %d\n",
42368 +        info->line, info->count);
42369 +        info->count = 0;
42370 +    }
42371 +
42372 +    if (info->count)
42373 +    {
42374 +        restore_flags (flags);
42375 +        return;
42376 +    }
42377 +
42378 +    /* Now we wait for the transmit buffer to clear; and we notify 
42379 +     * the line discipline to only process XON/XOFF characters.
42380 +     */
42381 +    tty->closing = 1;
42382 +
42383 +    /* At this point we stop accepting input.  To do this, we
42384 +     * disable the receive line status interrupts.
42385 +     */
42386 +    shutdown (info);
42387 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
42388 +    if (tty->driver->flush_buffer)
42389 +        tty->driver->flush_buffer (tty);
42390 +#else    
42391 +    if (tty->driver.flush_buffer)
42392 +        tty->driver.flush_buffer (tty);
42393 +#endif
42394 +    if (tty->ldisc.flush_buffer)
42395 +        tty->ldisc.flush_buffer (tty);
42396 +
42397 +    tty->closing = 0;
42398 +    info->event = 0;
42399 +    info->tty = 0;
42400 +    if (tty->ldisc.num != ldiscs[N_TTY].num)
42401 +    {
42402 +        if (tty->ldisc.close)
42403 +            (tty->ldisc.close)(tty);
42404 +        tty->ldisc = ldiscs[N_TTY];
42405 +        tty->termios->c_line = N_TTY;
42406 +        if (tty->ldisc.open)
42407 +            (tty->ldisc.open)(tty);
42408 +    }
42409 +    if (info->blocked_open)
42410 +    {
42411 +        if (info->close_delay)
42412 +        {
42413 +            current->state = TASK_INTERRUPTIBLE;
42414 +            schedule_timeout(info->close_delay);
42415 +        }
42416 +        wake_up_interruptible (&info->open_wait);
42417 +    }
42418 +    wake_up_interruptible (&info->close_wait);
42419 +
42420 +    restore_flags (flags);
42421 +}
42422 +
42423 +/*
42424 + * bcm_hangup () --- called by tty_hangup() when a hangup is signaled.
42425 + */
42426 +static void bcm_hangup (struct tty_struct *tty)
42427 +{
42428 +
42429 +    struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
42430 +
42431 +    shutdown (info);
42432 +    info->event = 0;
42433 +    info->count = 0;
42434 +    info->tty = 0;
42435 +    wake_up_interruptible (&info->open_wait);
42436 +}
42437 +
42438 +/*
42439 + * ------------------------------------------------------------
42440 + * rs_open() and friends
42441 + * ------------------------------------------------------------
42442 + */
42443 +static int block_til_ready (struct tty_struct *tty, struct file *filp,
42444 +    struct bcm_serial *info)
42445 +{
42446 +    return 0;
42447 +}       
42448 +
42449 +/*
42450 + * This routine is called whenever a serial port is opened.  It
42451 + * enables interrupts for a serial port. It also performs the 
42452 + * serial-specific initialization for the tty structure.
42453 + */
42454 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp)
42455 +{
42456 +    struct bcm_serial *info;
42457 +    int retval, line;
42458 +
42459 +    // Make sure we're only opening on of the ports we support
42460 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
42461 +    line = MINOR(tty->driver->cdev.dev) - tty->driver->minor_start;
42462 +#else
42463 +    line = MINOR(tty->device) - tty->driver.minor_start;
42464 +#endif    
42465 +
42466 +    if ((line < 0) || (line >= BCM_NUM_UARTS))
42467 +        return -ENODEV;
42468 +
42469 +    info = lines[line];
42470 +
42471 +    info->port->intMask  = 0;     /* Clear any pending interrupts */
42472 +    info->port->intMask  = RXINT; /* Enable RX */
42473 +
42474 +    info->count++;
42475 +    tty->driver_data = info;
42476 +    info->tty = tty;
42477 +    BcmHalInterruptEnable (INTERRUPT_ID_UART);
42478 +
42479 +    // Start up serial port
42480 +    retval = startup (info);
42481 +    if (retval)
42482 +        return retval;
42483 +
42484 +    retval = block_til_ready (tty, filp, info);
42485 +    if (retval)
42486 +        return retval;
42487 +
42488 +
42489 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
42490 +    info->pgrp = process_group(current);
42491 +    info->session = current->signal->session;
42492 +#else
42493 +    info->session = current->session;    
42494 +    info->pgrp = current->pgrp;
42495 +#endif    
42496 +
42497 +    return 0;
42498 +}
42499 +
42500 +/* --------------------------------------------------------------------------
42501 +    Name: bcm63xx_serialinit
42502 + Purpose: Initialize our BCM63xx serial driver
42503 +-------------------------------------------------------------------------- */
42504 +static int __init bcm63xx_serialinit(void)
42505 +{
42506 +    int i, flags;
42507 +    struct bcm_serial * info;
42508 +
42509 +    // Print the driver version information
42510 +    printk(VER_STR);
42511 +
42512 +    memset(&serial_driver, 0, sizeof(struct tty_driver));
42513 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)     
42514 +    serial_driver.owner            = THIS_MODULE;
42515 +    serial_driver.devfs_name       = "tts/";
42516 +#endif    
42517 +    serial_driver.magic             = TTY_DRIVER_MAGIC;
42518 +    serial_driver.name              = "ttyS";
42519 +    serial_driver.major             = TTY_MAJOR;
42520 +    serial_driver.minor_start       = 64;
42521 +    serial_driver.num               = BCM_NUM_UARTS;
42522 +    serial_driver.type              = TTY_DRIVER_TYPE_SERIAL;
42523 +    serial_driver.subtype           = SERIAL_TYPE_NORMAL;
42524 +    serial_driver.init_termios      = tty_std_termios;
42525 +    serial_driver.init_termios.c_cflag = B115200 | CS8 | CREAD | CLOCAL;
42526 +    serial_driver.flags             = TTY_DRIVER_REAL_RAW;
42527 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)    
42528 +    serial_driver.refcount          = serial_refcount;
42529 +    serial_driver.ttys             = serial_table;    
42530 +#else
42531 +    serial_driver.refcount          = &serial_refcount;
42532 +    serial_driver.table             = serial_table;    
42533 +#endif    
42534 +
42535 +    serial_driver.termios           = serial_termios;
42536 +    serial_driver.termios_locked    = serial_termios_locked;
42537 +    serial_driver.open              = bcm63xx_cons_open;
42538 +    serial_driver.close             = bcm63xx_cons_close;
42539 +    serial_driver.write             = bcm63xx_cons_write;
42540 +    serial_driver.flush_chars       = bcm63xx_cons_flush_chars;
42541 +    serial_driver.write_room        = bcm63xx_cons_write_room;
42542 +    serial_driver.chars_in_buffer   = bcm_chars_in_buffer;
42543 +    serial_driver.flush_buffer      = bcm_flush_buffer;
42544 +    serial_driver.ioctl             = bcm_ioctl;
42545 +    serial_driver.throttle          = bcm_throttle;
42546 +    serial_driver.unthrottle        = bcm_unthrottle;
42547 +    serial_driver.send_xchar        = bcm_send_xchar;
42548 +    serial_driver.set_termios       = bcm_set_termios;
42549 +    serial_driver.stop              = bcm_stop;
42550 +    serial_driver.start             = bcm_start;
42551 +    serial_driver.hangup            = bcm_hangup;
42552 +
42553 +    if (tty_register_driver (&serial_driver))
42554 +        panic("Couldn't register serial driver\n");
42555 +
42556 +    save_flags(flags); cli();
42557 +    for (i = 0; i < BCM_NUM_UARTS; i++)
42558 +    {
42559 +        info = &multi[i]; 
42560 +        lines[i] = info;
42561 +        info->port                  = (Uart *) ((char *)UART_BASE + (i * 0x20));
42562 +        info->irq                   = (2 - i) + 8;
42563 +        info->line                  = i;
42564 +        info->tty                   = 0;
42565 +        info->close_delay           = 50;
42566 +        info->closing_wait          = 3000;
42567 +        info->x_char                = 0;
42568 +        info->event                 = 0;
42569 +        info->count                 = 0;
42570 +        info->blocked_open          = 0;       
42571 +        info->normal_termios        = serial_driver.init_termios;
42572 +        init_waitqueue_head(&info->open_wait); 
42573 +        init_waitqueue_head(&info->close_wait); 
42574 +
42575 +        /* If we are pointing to address zero then punt - not correctly
42576 +         * set up in setup.c to handle this. 
42577 +         */
42578 +        if (! info->port)
42579 +            return 0;
42580 +        BcmHalMapInterrupt(bcm_interrupt, 0, INTERRUPT_ID_UART);
42581 +    }
42582 +
42583 +    /* order matters here... the trick is that flags
42584 +     * is updated... in request_irq - to immediatedly obliterate
42585 +     * it is unwise. 
42586 +     */
42587 +    restore_flags(flags);
42588 +    return 0;
42589 +}
42590 +
42591 +module_init(bcm63xx_serialinit);
42592 +
42593 +/* --------------------------------------------------------------------------
42594 +    Name: bcm_console_print
42595 + Purpose: bcm_console_print is registered for printk.
42596 +          The console_lock must be held when we get here.
42597 +-------------------------------------------------------------------------- */
42598 +static void bcm_console_print (struct console * cons, const char * str,
42599 +    unsigned int count)
42600 +{
42601 +    unsigned int i;
42602 +    //_puts(str);
42603 +    for(i=0; i<count; i++, str++)
42604 +    {
42605 +        _putc(*str);
42606 +        if (*str == 10)
42607 +        {
42608 +            _putc(13);
42609 +        }
42610 +    }
42611 +}
42612 +
42613 +static struct tty_driver * bcm_console_device(struct console * c, int *index)
42614 +{
42615 +    *index = c->index;
42616 +    return &serial_driver;
42617 +}
42618 +
42619 +static int __init bcm_console_setup(struct console * co, char * options)
42620 +{
42621 +    return 0;
42622 +}
42623 +
42624 +static struct console bcm_sercons = {
42625 +    .name      = "ttyS",
42626 +    .write     = bcm_console_print,
42627 +    .device    = bcm_console_device,
42628 +    .setup     = bcm_console_setup,
42629 +    .flags     = CON_PRINTBUFFER, // CON_CONSDEV, CONSOLE_LINE,
42630 +    .index     = -1,
42631 +};
42632 +
42633 +static int __init bcm63xx_console_init(void)
42634 +{
42635 +    register_console(&bcm_sercons);
42636 +    return 0;
42637 +}
42638 +
42639 +console_initcall(bcm63xx_console_init);
42640 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6338_intr.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_intr.h
42641 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6338_intr.h    1970-01-01 01:00:00.000000000 +0100
42642 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_intr.h   2006-06-26 09:07:10.000000000 +0200
42643 @@ -0,0 +1,72 @@
42644 +/*
42645 +<:copyright-gpl 
42646 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
42647
42648 + This program is free software; you can distribute it and/or modify it 
42649 + under the terms of the GNU General Public License (Version 2) as 
42650 + published by the Free Software Foundation. 
42651
42652 + This program is distributed in the hope it will be useful, but WITHOUT 
42653 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
42654 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
42655 + for more details. 
42656
42657 + You should have received a copy of the GNU General Public License along 
42658 + with this program; if not, write to the Free Software Foundation, Inc., 
42659 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
42660 +:>
42661 +*/
42662 +
42663 +#ifndef __6338_INTR_H
42664 +#define __6338_INTR_H
42665 +
42666 +#ifdef __cplusplus
42667 +    extern "C" {
42668 +#endif
42669 +
42670 +/*=====================================================================*/
42671 +/* BCM6338 External Interrupt Level Assignments                       */
42672 +/*=====================================================================*/
42673 +#define INTERRUPT_ID_EXTERNAL_0         3
42674 +#define INTERRUPT_ID_EXTERNAL_1         4
42675 +#define INTERRUPT_ID_EXTERNAL_2         5
42676 +#define INTERRUPT_ID_EXTERNAL_3         6
42677 +
42678 +/*=====================================================================*/
42679 +/* BCM6338 Timer Interrupt Level Assignments                          */
42680 +/*=====================================================================*/
42681 +#define MIPS_TIMER_INT                  7
42682 +
42683 +/*=====================================================================*/
42684 +/* Peripheral ISR Table Offset                                              */
42685 +/*=====================================================================*/
42686 +#define INTERNAL_ISR_TABLE_OFFSET       8
42687 +
42688 +/*=====================================================================*/
42689 +/* Logical Peripheral Interrupt IDs                                    */
42690 +/*=====================================================================*/
42691 +
42692 +#define INTERRUPT_ID_TIMER               (INTERNAL_ISR_TABLE_OFFSET + 0)
42693 +#define INTERRUPT_ID_SPI                 (INTERNAL_ISR_TABLE_OFFSET + 1)
42694 +#define INTERRUPT_ID_UART                (INTERNAL_ISR_TABLE_OFFSET + 2)
42695 +#define INTERRUPT_ID_DG                  (INTERNAL_ISR_TABLE_OFFSET + 4)
42696 +#define INTERRUPT_ID_ADSL                (INTERNAL_ISR_TABLE_OFFSET + 5)
42697 +#define INTERRUPT_ID_ATM                 (INTERNAL_ISR_TABLE_OFFSET + 6)
42698 +#define INTERRUPT_ID_USBS                (INTERNAL_ISR_TABLE_OFFSET + 7)
42699 +#define INTERRUPT_ID_EMAC1               (INTERNAL_ISR_TABLE_OFFSET + 8)
42700 +#define INTERRUPT_ID_EPHY                (INTERNAL_ISR_TABLE_OFFSET + 9)
42701 +#define INTERRUPT_ID_SDRAM               (INTERNAL_ISR_TABLE_OFFSET + 10)
42702 +#define INTERRUPT_ID_USB_CNTL_RX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 11)
42703 +#define INTERRUPT_ID_USB_CNTL_TX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 12)
42704 +#define INTERRUPT_ID_USB_BULK_RX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 13)
42705 +#define INTERRUPT_ID_USB_BULK_TX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 14)
42706 +#define INTERRUPT_ID_EMAC1_RX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 15)
42707 +#define INTERRUPT_ID_EMAC1_TX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 16)
42708 +#define INTERRUPT_ID_SDIO                (INTERNAL_ISR_TABLE_OFFSET + 17)
42709 +
42710 +#ifdef __cplusplus
42711 +    }
42712 +#endif                    
42713 +
42714 +#endif  /* __BCM6338_H */
42715 +
42716 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h
42717 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h        1970-01-01 01:00:00.000000000 +0100
42718 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6338_map_part.h       2006-06-26 09:07:10.000000000 +0200
42719 @@ -0,0 +1,341 @@
42720 +/*
42721 +<:copyright-gpl 
42722 + Copyright 2004 Broadcom Corp. All Rights Reserved. 
42723
42724 + This program is free software; you can distribute it and/or modify it 
42725 + under the terms of the GNU General Public License (Version 2) as 
42726 + published by the Free Software Foundation. 
42727
42728 + This program is distributed in the hope it will be useful, but WITHOUT 
42729 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
42730 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
42731 + for more details. 
42732
42733 + You should have received a copy of the GNU General Public License along 
42734 + with this program; if not, write to the Free Software Foundation, Inc., 
42735 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
42736 +:>
42737 +*/
42738 +
42739 +#ifndef __BCM6338_MAP_H
42740 +#define __BCM6338_MAP_H
42741 +
42742 +#if __cplusplus
42743 +extern "C" {
42744 +#endif
42745 +
42746 +#include "bcmtypes.h"
42747 +
42748 +#define PERF_BASE           0xfffe0000
42749 +#define TIMR_BASE           0xfffe0200 
42750 +#define UART_BASE           0xfffe0300
42751 +#define GPIO_BASE           0xfffe0400
42752 +#define SPI_BASE            0xfffe0c00
42753 +
42754 +typedef struct PerfControl {
42755 +  uint32        RevID;
42756 +  uint16        testControl;
42757 +  uint16        blkEnables;
42758 +#define EMAC_CLK_EN     0x0010
42759 +#define USBS_CLK_EN     0x0010
42760 +#define SAR_CLK_EN      0x0020
42761 +
42762 +#define SPI_CLK_EN      0x0200
42763 +
42764 +  uint32        pll_control;
42765 +#define SOFT_RESET 0x00000001
42766 +
42767 +  uint32        IrqMask;
42768 +  uint32        IrqStatus;
42769 +
42770 +  uint32        ExtIrqCfg;
42771 +#define EI_SENSE_SHFT   0
42772 +#define EI_STATUS_SHFT  5
42773 +#define EI_CLEAR_SHFT   10
42774 +#define EI_MASK_SHFT    15
42775 +#define EI_INSENS_SHFT  20
42776 +#define EI_LEVEL_SHFT   25
42777 +
42778 +  uint32        unused[4];      /* (18) */
42779 +  uint32        BlockSoftReset; /* (28) */
42780 +#define BSR_SPI             0x00000001
42781 +#define BSR_EMAC            0x00000004
42782 +#define BSR_USBH            0x00000008
42783 +#define BSR_USBS            0x00000010
42784 +#define BSR_ADSL            0x00000020
42785 +#define BSR_DMAMEM          0x00000040
42786 +#define BSR_SAR             0x00000080
42787 +#define BSR_ACLC            0x00000100
42788 +#define BSR_ADSL_MIPS_PLL   0x00000400
42789 +#define BSR_ALL_BLOCKS      \
42790 +    (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
42791 +     BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
42792 +} PerfControl;
42793 +
42794 +#define PERF ((volatile PerfControl * const) PERF_BASE)
42795 +
42796 +
42797 +typedef struct Timer {
42798 +  uint16        unused0;
42799 +  byte          TimerMask;
42800 +#define TIMER0EN        0x01
42801 +#define TIMER1EN        0x02
42802 +#define TIMER2EN        0x04
42803 +  byte          TimerInts;
42804 +#define TIMER0          0x01
42805 +#define TIMER1          0x02
42806 +#define TIMER2          0x04
42807 +#define WATCHDOG        0x08
42808 +  uint32        TimerCtl0;
42809 +  uint32        TimerCtl1;
42810 +  uint32        TimerCtl2;
42811 +#define TIMERENABLE     0x80000000
42812 +#define RSTCNTCLR       0x40000000      
42813 +  uint32        TimerCnt0;
42814 +  uint32        TimerCnt1;
42815 +  uint32        TimerCnt2;
42816 +  uint32        WatchDogDefCount;
42817 +
42818 +  /* Write 0xff00 0x00ff to Start timer
42819 +   * Write 0xee00 0x00ee to Stop and re-load default count
42820 +   * Read from this register returns current watch dog count
42821 +   */
42822 +  uint32        WatchDogCtl;
42823 +
42824 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
42825 +  uint32        WDResetCount;
42826 +} Timer;
42827 +
42828 +#define TIMER ((volatile Timer * const) TIMR_BASE)
42829 +typedef struct UartChannel {
42830 +  byte          unused0;
42831 +  byte          control;
42832 +#define BRGEN           0x80    /* Control register bit defs */
42833 +#define TXEN            0x40
42834 +#define RXEN            0x20
42835 +#define LOOPBK          0x10
42836 +#define TXPARITYEN      0x08
42837 +#define TXPARITYEVEN    0x04
42838 +#define RXPARITYEN      0x02
42839 +#define RXPARITYEVEN    0x01
42840 +
42841 +  byte          config;
42842 +#define XMITBREAK       0x40
42843 +#define BITS5SYM        0x00
42844 +#define BITS6SYM        0x10
42845 +#define BITS7SYM        0x20
42846 +#define BITS8SYM        0x30
42847 +#define ONESTOP         0x07
42848 +#define TWOSTOP         0x0f
42849 +  /* 4-LSBS represent STOP bits/char
42850 +   * in 1/8 bit-time intervals.  Zero
42851 +   * represents 1/8 stop bit interval.
42852 +   * Fifteen represents 2 stop bits.
42853 +   */
42854 +  byte          fifoctl;
42855 +#define RSTTXFIFOS      0x80
42856 +#define RSTRXFIFOS      0x40
42857 +  /* 5-bit TimeoutCnt is in low bits of this register.
42858 +   *  This count represents the number of characters 
42859 +   *  idle times before setting receive Irq when below threshold
42860 +   */
42861 +  uint32        baudword;
42862 +  /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
42863 +   */
42864 +
42865 +  byte          txf_levl;       /* Read-only fifo depth */
42866 +  byte          rxf_levl;       /* Read-only fifo depth */
42867 +  byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
42868 +                                 *      RxThreshold.  Irq can be asserted
42869 +                                 *      when rx fifo> thresh, txfifo<thresh
42870 +                                 */
42871 +  byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
42872 +                                 *  if these bits are also enabled to GPIO_o
42873 +                                 */
42874 +#define        DTREN   0x01
42875 +#define        RTSEN   0x02
42876 +
42877 +  byte          unused1;
42878 +  byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
42879 +                                         * detect irq on rising AND falling 
42880 +                                         * edges for corresponding GPIO_i
42881 +                                         * if enabled (edge insensitive)
42882 +                                         */
42883 +  byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
42884 +                                         *      0 for negedge sense if
42885 +                                         *      not configured for edge
42886 +                                         *      insensitive (see above)
42887 +                                         * Lower 4 bits: Mask to enable change
42888 +                                         *  detection IRQ for corresponding
42889 +                                         *  GPIO_i
42890 +                                         */
42891 +  byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
42892 +                                         *  have changed (may set IRQ).
42893 +                                         *  read automatically clears bit
42894 +                                         * Lower 4 bits are actual status
42895 +                                         */
42896 +
42897 +  uint16        intMask;                               /* Same Bit defs for Mask and status */
42898 +  uint16        intStatus;
42899 +#define DELTAIP         0x0001
42900 +#define TXUNDERR        0x0002
42901 +#define TXOVFERR        0x0004
42902 +#define TXFIFOTHOLD     0x0008
42903 +#define TXREADLATCH     0x0010
42904 +#define TXFIFOEMT       0x0020
42905 +#define RXUNDERR        0x0040
42906 +#define RXOVFERR        0x0080
42907 +#define RXTIMEOUT       0x0100
42908 +#define RXFIFOFULL      0x0200
42909 +#define RXFIFOTHOLD     0x0400
42910 +#define RXFIFONE        0x0800
42911 +#define RXFRAMERR       0x1000
42912 +#define RXPARERR        0x2000
42913 +#define RXBRK           0x4000
42914 +
42915 +  uint16        unused2;
42916 +  uint16        Data;                   /* Write to TX, Read from RX */
42917 +                                        /* bits 11:8 are BRK,PAR,FRM errors */
42918 +
42919 +  uint32               unused3;
42920 +  uint32               unused4;
42921 +} Uart;
42922 +
42923 +#define UART ((volatile Uart * const) UART_BASE)
42924 +
42925 +typedef struct GpioControl {
42926 +  uint32        unused0;
42927 +  uint32        GPIODir;      /* bits 7:0 */
42928 +  uint32        unused1;
42929 +  uint32        GPIOio;       /* bits 7:0 */
42930 +  uint32        LEDCtrl;
42931 +#define         LED3_STROBE             0x08000000
42932 +#define         LED2_STROBE             0x04000000
42933 +#define         LED1_STROBE             0x02000000
42934 +#define         LED0_STROBE             0x01000000
42935 +#define         LED_TEST                0x00010000
42936 +#define         LED3_DISABLE_LINK_ACT   0x00008000
42937 +#define         LED2_DISABLE_LINK_ACT   0x00004000
42938 +#define         LED1_DISABLE_LINK_ACT   0x00002000
42939 +#define         LED0_DISABLE_LINK_ACT   0x00001000
42940 +#define         LED_INTERVAL_SET_MASK   0x00000f00
42941 +#define         LED_INTERVAL_SET_320MS  0x00000500
42942 +#define         LED_INTERVAL_SET_160MS  0x00000400
42943 +#define         LED_INTERVAL_SET_80MS   0x00000300
42944 +#define         LED_INTERVAL_SET_40MS   0x00000200
42945 +#define         LED_INTERVAL_SET_20MS   0x00000100
42946 +#define         LED3_ON                 0x00000080
42947 +#define         LED2_ON                 0x00000040
42948 +#define         LED1_ON                 0x00000020
42949 +#define         LED0_ON                 0x00000010
42950 +#define         LED3_ENABLE             0x00000008
42951 +#define         LED2_ENABLE             0x00000004
42952 +#define         LED1_ENABLE             0x00000002
42953 +#define         LED0_ENABLE             0x00000001
42954 +  uint32        SpiSlaveCfg;
42955 +#define         SPI_SLAVE_RESET         0x00010000
42956 +#define         SPI_RESTRICT            0x00000400
42957 +#define         SPI_DELAY_DISABLE       0x00000200
42958 +#define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
42959 +#define         SPI_SER_ADDR_CFG_MASK   0x0000000c
42960 +#define         SPI_MODE                0x00000001
42961 +  uint32        vRegConfig;
42962 +} GpioControl;
42963 +
42964 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
42965 +
42966 +/* Number to mask conversion macro used for GPIODir and GPIOio */
42967 +#define GPIO_NUM_MAX_BITS_MASK          0x0f
42968 +#define GPIO_NUM_TO_MASK(X)             (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
42969 +
42970 +/*
42971 +** Spi Controller
42972 +*/
42973 +
42974 +typedef struct SpiControl {
42975 +  uint16        spiCmd;                 /* (0x0): SPI command */
42976 +#define SPI_CMD_START_IMMEDIATE         3
42977 +
42978 +#define SPI_CMD_COMMAND_SHIFT           0
42979 +#define SPI_CMD_DEVICE_ID_SHIFT         4
42980 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
42981 +
42982 +  byte          spiIntStatus;           /* (0x2): SPI interrupt status */
42983 +  byte          spiMaskIntStatus;       /* (0x3): SPI masked interrupt status */
42984 +
42985 +  byte          spiIntMask;             /* (0x4): SPI interrupt mask */
42986 +#define SPI_INTR_CMD_DONE               0x01
42987 +#define SPI_INTR_CLEAR_ALL              0x1f
42988 +
42989 +  byte          spiStatus;              /* (0x5): SPI status */
42990 +
42991 +  byte          spiClkCfg;              /* (0x6): SPI clock configuration */
42992 +
42993 +  byte          spiFillByte;            /* (0x7): SPI fill byte */
42994 +
42995 +  byte          unused0; 
42996 +  byte          spiMsgTail;             /* (0x9): msgtail */
42997 +  byte          unused1; 
42998 +  byte          spiRxTail;              /* (0xB): rxtail */
42999 +
43000 +  uint32        unused2[13];            /* (0x0c - 0x3c) reserved */
43001 +
43002 +  byte          spiMsgCtl;              /* (0x40) control byte */
43003 +#define HALF_DUPLEX_W                   1
43004 +#define HALF_DUPLEX_R                   2
43005 +#define SPI_MSG_TYPE_SHIFT              6
43006 +#define SPI_BYTE_CNT_SHIFT              0
43007 +  byte          spiMsgData[63];         /* (0x41 - 0x7f) msg data */
43008 +  byte          spiRxDataFifo[64];      /* (0x80 - 0xbf) rx data */
43009 +  byte          unused3[64];            /* (0xc0 - 0xff) reserved */
43010 +} SpiControl;
43011 +
43012 +#define SPI ((volatile SpiControl * const) SPI_BASE)
43013 +
43014 +/*
43015 +** External Bus Interface
43016 +*/
43017 +typedef struct EbiChipSelect {
43018 +  uint32        base;                   /* base address in upper 24 bits */
43019 +#define EBI_SIZE_8K         0
43020 +#define EBI_SIZE_16K        1
43021 +#define EBI_SIZE_32K        2
43022 +#define EBI_SIZE_64K        3
43023 +#define EBI_SIZE_128K       4
43024 +#define EBI_SIZE_256K       5
43025 +#define EBI_SIZE_512K       6
43026 +#define EBI_SIZE_1M         7
43027 +#define EBI_SIZE_2M         8
43028 +#define EBI_SIZE_4M         9
43029 +#define EBI_SIZE_8M         10
43030 +#define EBI_SIZE_16M        11
43031 +#define EBI_SIZE_32M        12
43032 +#define EBI_SIZE_64M        13
43033 +#define EBI_SIZE_128M       14
43034 +#define EBI_SIZE_256M       15
43035 +  uint32        config;
43036 +#define EBI_ENABLE          0x00000001      /* .. enable this range */
43037 +#define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
43038 +#define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
43039 +#define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
43040 +#define EBI_WREN            0x00000020      /* enable posted writes */
43041 +#define EBI_POLARITY        0x00000040      /* .. set to invert something, 
43042 +                                        **    don't know what yet */
43043 +#define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
43044 +#define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
43045 +#define EBI_FIFO            0x00000200      /* .. use fifo */
43046 +#define EBI_RE              0x00000400      /* .. Reverse Endian */
43047 +} EbiChipSelect;
43048 +
43049 +typedef struct MpiRegisters {
43050 +  EbiChipSelect cs[1];                  /* size chip select configuration */
43051 +} MpiRegisters;
43052 +
43053 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
43054 +
43055 +#if __cplusplus
43056 +}
43057 +#endif
43058 +
43059 +#endif
43060 +
43061 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6345_intr.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_intr.h
43062 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6345_intr.h    1970-01-01 01:00:00.000000000 +0100
43063 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_intr.h   2006-06-26 09:07:10.000000000 +0200
43064 @@ -0,0 +1,78 @@
43065 +/*
43066 +<:copyright-gpl 
43067 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
43068
43069 + This program is free software; you can distribute it and/or modify it 
43070 + under the terms of the GNU General Public License (Version 2) as 
43071 + published by the Free Software Foundation. 
43072
43073 + This program is distributed in the hope it will be useful, but WITHOUT 
43074 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
43075 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
43076 + for more details. 
43077
43078 + You should have received a copy of the GNU General Public License along 
43079 + with this program; if not, write to the Free Software Foundation, Inc., 
43080 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
43081 +:>
43082 +*/
43083 +
43084 +#ifndef __6345_INTR_H
43085 +#define __6345_INTR_H
43086 +
43087 +#ifdef __cplusplus
43088 +    extern "C" {
43089 +#endif
43090 +
43091 +/*=====================================================================*/
43092 +/* BCM6345 External Interrupt Level Assignments                       */
43093 +/*=====================================================================*/
43094 +#define INTERRUPT_ID_EXTERNAL_0         3
43095 +#define INTERRUPT_ID_EXTERNAL_1         4
43096 +#define INTERRUPT_ID_EXTERNAL_2         5
43097 +#define INTERRUPT_ID_EXTERNAL_3         6
43098 +
43099 +/*=====================================================================*/
43100 +/* BCM6345 Timer Interrupt Level Assignments                          */
43101 +/*=====================================================================*/
43102 +#define MIPS_TIMER_INT                  7
43103 +
43104 +/*=====================================================================*/
43105 +/* Peripheral ISR Table Offset                                              */
43106 +/*=====================================================================*/
43107 +#define INTERNAL_ISR_TABLE_OFFSET       8
43108 +#define DMA_ISR_TABLE_OFFSET            (INTERNAL_ISR_TABLE_OFFSET + 13)
43109 +
43110 +/*=====================================================================*/
43111 +/* Logical Peripheral Interrupt IDs                                    */
43112 +/*=====================================================================*/
43113 +
43114 +/* Internal peripheral interrupt IDs */
43115 +#define INTERRUPT_ID_TIMER              (INTERNAL_ISR_TABLE_OFFSET +  0)
43116 +#define INTERRUPT_ID_UART               (INTERNAL_ISR_TABLE_OFFSET +  2)
43117 +#define INTERRUPT_ID_ADSL               (INTERNAL_ISR_TABLE_OFFSET +  3)
43118 +#define INTERRUPT_ID_ATM                (INTERNAL_ISR_TABLE_OFFSET +  4)
43119 +#define INTERRUPT_ID_USB                (INTERNAL_ISR_TABLE_OFFSET +  5)
43120 +#define INTERRUPT_ID_EMAC               (INTERNAL_ISR_TABLE_OFFSET +  8)
43121 +#define INTERRUPT_ID_EPHY               (INTERNAL_ISR_TABLE_OFFSET +  12)
43122 +
43123 +/* DMA channel interrupt IDs */        
43124 +#define INTERRUPT_ID_EMAC_RX_CHAN       (DMA_ISR_TABLE_OFFSET + EMAC_RX_CHAN)
43125 +#define INTERRUPT_ID_EMAC_TX_CHAN       (DMA_ISR_TABLE_OFFSET + EMAC_TX_CHAN)
43126 +#define INTERRUPT_ID_EBI_RX_CHAN        (DMA_ISR_TABLE_OFFSET + EBI_RX_CHAN)
43127 +#define INTERRUPT_ID_EBI_TX_CHAN        (DMA_ISR_TABLE_OFFSET + EBI_TX_CHAN)
43128 +#define INTERRUPT_ID_RESERVED_RX_CHAN   (DMA_ISR_TABLE_OFFSET + RESERVED_RX_CHAN)
43129 +#define INTERRUPT_ID_RESERVED_TX_CHAN   (DMA_ISR_TABLE_OFFSET + RESERVED_TX_CHAN)
43130 +#define INTERRUPT_ID_USB_BULK_RX_CHAN   (DMA_ISR_TABLE_OFFSET + USB_BULK_RX_CHAN)
43131 +#define INTERRUPT_ID_USB_BULK_TX_CHAN   (DMA_ISR_TABLE_OFFSET + USB_BULK_TX_CHAN)
43132 +#define INTERRUPT_ID_USB_CNTL_RX_CHAN   (DMA_ISR_TABLE_OFFSET + USB_CNTL_RX_CHAN)
43133 +#define INTERRUPT_ID_USB_CNTL_TX_CHAN   (DMA_ISR_TABLE_OFFSET + USB_CNTL_TX_CHAN)
43134 +#define INTERRUPT_ID_USB_ISO_RX_CHAN    (DMA_ISR_TABLE_OFFSET + USB_ISO_RX_CHAN)
43135 +#define INTERRUPT_ID_USB_ISO_TX_CHAN    (DMA_ISR_TABLE_OFFSET + USB_ISO_TX_CHAN)
43136 +
43137 +#ifdef __cplusplus
43138 +    }
43139 +#endif                    
43140 +
43141 +#endif  /* __BCM6345_H */
43142 +
43143 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h
43144 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h        1970-01-01 01:00:00.000000000 +0100
43145 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6345_map_part.h       2006-06-26 09:07:10.000000000 +0200
43146 @@ -0,0 +1,169 @@
43147 +/*
43148 +<:copyright-gpl 
43149 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
43150
43151 + This program is free software; you can distribute it and/or modify it 
43152 + under the terms of the GNU General Public License (Version 2) as 
43153 + published by the Free Software Foundation. 
43154
43155 + This program is distributed in the hope it will be useful, but WITHOUT 
43156 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
43157 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
43158 + for more details. 
43159
43160 + You should have received a copy of the GNU General Public License along 
43161 + with this program; if not, write to the Free Software Foundation, Inc., 
43162 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
43163 +:>
43164 +*/
43165 +
43166 +#ifndef __BCM6345_MAP_H
43167 +#define __BCM6345_MAP_H
43168 +
43169 +#if __cplusplus
43170 +extern "C" {
43171 +#endif
43172 +
43173 +#include "bcmtypes.h"
43174 +#include "6345_intr.h"
43175 +
43176 +typedef struct IntControl {
43177 +  uint32        RevID;
43178 +  uint16        testControl;
43179 +  uint16        blkEnables;
43180 +#define USB_CLK_EN      0x0100
43181 +#define EMAC_CLK_EN     0x0080
43182 +#define UART_CLK_EN     0x0008
43183 +#define CPU_CLK_EN      0x0001
43184 +
43185 +  uint32        pll_control;
43186 +#define SOFT_RESET     0x00000001
43187 +
43188 +  uint32        IrqMask;
43189 +  uint32        IrqStatus;
43190 +
43191 +  uint32        ExtIrqCfg;
43192 +#define EI_SENSE_SHFT   0
43193 +#define EI_STATUS_SHFT  4
43194 +#define EI_CLEAR_SHFT   8
43195 +#define EI_MASK_SHFT    12
43196 +#define EI_INSENS_SHFT  16
43197 +#define EI_LEVEL_SHFT   20
43198 +} IntControl;
43199 +
43200 +#define INTC_BASE     0xfffe0000
43201 +#define PERF ((volatile IntControl * const) INTC_BASE)
43202 +
43203 +#define TIMR_BASE     0xfffe0200    
43204 +typedef struct Timer {
43205 +  uint16        unused0;
43206 +  byte          TimerMask;
43207 +#define TIMER0EN        0x01
43208 +#define TIMER1EN        0x02
43209 +#define TIMER2EN        0x04
43210 +  byte          TimerInts;
43211 +#define TIMER0          0x01
43212 +#define TIMER1          0x02
43213 +#define TIMER2          0x04
43214 +#define WATCHDOG        0x08
43215 +  uint32        TimerCtl0;
43216 +  uint32        TimerCtl1;
43217 +  uint32        TimerCtl2;
43218 +#define TIMERENABLE     0x80000000
43219 +#define RSTCNTCLR       0x40000000      
43220 +  uint32        TimerCnt0;
43221 +  uint32        TimerCnt1;
43222 +  uint32        TimerCnt2;
43223 +  uint32        WatchDogDefCount;
43224 +
43225 +  /* Write 0xff00 0x00ff to Start timer
43226 +   * Write 0xee00 0x00ee to Stop and re-load default count
43227 +   * Read from this register returns current watch dog count
43228 +   */
43229 +  uint32        WatchDogCtl;
43230 +
43231 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
43232 +  uint32        WDResetCount;
43233 +} Timer;
43234 +
43235 +#define TIMER ((volatile Timer * const) TIMR_BASE)
43236 +
43237 +typedef struct UartChannel {
43238 +  byte          unused0;
43239 +  byte          control;
43240 +#define BRGEN           0x80    /* Control register bit defs */
43241 +#define TXEN            0x40
43242 +#define RXEN            0x20
43243 +#define TXPARITYEN      0x08
43244 +#define TXPARITYEVEN    0x04
43245 +#define RXPARITYEN      0x02
43246 +#define RXPARITYEVEN    0x01
43247 +  byte          config;
43248 +#define BITS5SYM        0x00
43249 +#define BITS6SYM        0x10
43250 +#define BITS7SYM        0x20
43251 +#define BITS8SYM        0x30
43252 +#define XMITBREAK       0x40
43253 +#define ONESTOP         0x07
43254 +#define TWOSTOP         0x0f
43255 +
43256 +  byte          fifoctl;
43257 +#define RSTTXFIFOS      0x80
43258 +#define RSTRXFIFOS      0x40
43259 +  uint32        baudword;
43260 +
43261 +  byte          txf_levl;
43262 +  byte          rxf_levl;
43263 +  byte          fifocfg;
43264 +  byte          prog_out;
43265 +
43266 +  byte          unused1;
43267 +  byte          DeltaIPEdgeNoSense;
43268 +  byte          DeltaIPConfig_Mask;
43269 +  byte          DeltaIP_SyncIP;
43270 +  uint16        intMask;
43271 +  uint16        intStatus;
43272 +#define TXUNDERR        0x0002
43273 +#define TXOVFERR        0x0004
43274 +#define TXFIFOEMT       0x0020
43275 +#define RXOVFERR        0x0080
43276 +#define RXFIFONE        0x0800
43277 +#define RXFRAMERR       0x1000
43278 +#define RXPARERR        0x2000
43279 +#define RXBRK           0x4000
43280 +
43281 +  uint16        unused2;
43282 +  uint16        Data;
43283 +  uint32               unused3;
43284 +  uint32               unused4;
43285 +} Uart;
43286 +
43287 +#define UART_BASE     0xfffe0300
43288 +#define UART ((volatile Uart * const) UART_BASE)
43289 +
43290 +typedef struct GpioControl {
43291 +  uint16        unused0;
43292 +  byte          unused1;
43293 +  byte          TBusSel;
43294 +
43295 +  uint16        unused2;
43296 +  uint16        GPIODir;
43297 +  byte          unused3;
43298 +  byte          Leds;
43299 +  uint16        GPIOio;
43300 +
43301 +  uint32        UartCtl;
43302 +} GpioControl;
43303 +
43304 +#define GPIO_BASE     0xfffe0400
43305 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
43306 +
43307 +#define GPIO_NUM_MAX_BITS_MASK          0x0f
43308 +#define GPIO_NUM_TO_MASK(X)             (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
43309 +
43310 +#if __cplusplus
43311 +}
43312 +#endif
43313 +
43314 +#endif
43315 +
43316 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6348_intr.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_intr.h
43317 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6348_intr.h    1970-01-01 01:00:00.000000000 +0100
43318 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_intr.h   2006-06-26 09:07:10.000000000 +0200
43319 @@ -0,0 +1,80 @@
43320 +/*
43321 +<:copyright-gpl 
43322 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
43323
43324 + This program is free software; you can distribute it and/or modify it 
43325 + under the terms of the GNU General Public License (Version 2) as 
43326 + published by the Free Software Foundation. 
43327
43328 + This program is distributed in the hope it will be useful, but WITHOUT 
43329 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
43330 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
43331 + for more details. 
43332
43333 + You should have received a copy of the GNU General Public License along 
43334 + with this program; if not, write to the Free Software Foundation, Inc., 
43335 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
43336 +:>
43337 +*/
43338 +
43339 +#ifndef __6348_INTR_H
43340 +#define __6348_INTR_H
43341 +
43342 +#ifdef __cplusplus
43343 +    extern "C" {
43344 +#endif
43345 +
43346 +/*=====================================================================*/
43347 +/* BCM6348 External Interrupt Level Assignments                       */
43348 +/*=====================================================================*/
43349 +#define INTERRUPT_ID_EXTERNAL_0         3
43350 +#define INTERRUPT_ID_EXTERNAL_1         4
43351 +#define INTERRUPT_ID_EXTERNAL_2         5
43352 +#define INTERRUPT_ID_EXTERNAL_3         6
43353 +
43354 +/*=====================================================================*/
43355 +/* BCM6348 Timer Interrupt Level Assignments                          */
43356 +/*=====================================================================*/
43357 +#define MIPS_TIMER_INT                  7
43358 +
43359 +/*=====================================================================*/
43360 +/* Peripheral ISR Table Offset                                              */
43361 +/*=====================================================================*/
43362 +#define INTERNAL_ISR_TABLE_OFFSET       8
43363 +
43364 +/*=====================================================================*/
43365 +/* Logical Peripheral Interrupt IDs                                    */
43366 +/*=====================================================================*/
43367 +
43368 +#define INTERRUPT_ID_TIMER               (INTERNAL_ISR_TABLE_OFFSET + 0)
43369 +#define INTERRUPT_ID_SPI                 (INTERNAL_ISR_TABLE_OFFSET + 1)
43370 +#define INTERRUPT_ID_UART                (INTERNAL_ISR_TABLE_OFFSET + 2)
43371 +#define INTERRUPT_ID_ADSL                (INTERNAL_ISR_TABLE_OFFSET + 4)
43372 +#define INTERRUPT_ID_ATM                 (INTERNAL_ISR_TABLE_OFFSET + 5)
43373 +#define INTERRUPT_ID_USBS                (INTERNAL_ISR_TABLE_OFFSET + 6)
43374 +#define INTERRUPT_ID_EMAC2               (INTERNAL_ISR_TABLE_OFFSET + 7)
43375 +#define INTERRUPT_ID_EMAC1               (INTERNAL_ISR_TABLE_OFFSET + 8)
43376 +#define INTERRUPT_ID_EPHY                (INTERNAL_ISR_TABLE_OFFSET + 9)
43377 +#define INTERRUPT_ID_M2M                 (INTERNAL_ISR_TABLE_OFFSET + 10)
43378 +#define INTERRUPT_ID_ACLC                (INTERNAL_ISR_TABLE_OFFSET + 11)
43379 +#define INTERRUPT_ID_USBH                (INTERNAL_ISR_TABLE_OFFSET + 12)
43380 +#define INTERRUPT_ID_SDRAM               (INTERNAL_ISR_TABLE_OFFSET + 13)
43381 +#define INTERRUPT_ID_USB_CNTL_RX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 14)
43382 +#define INTERRUPT_ID_USB_CNTL_TX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 15)
43383 +#define INTERRUPT_ID_USB_BULK_RX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 16)
43384 +#define INTERRUPT_ID_USB_BULK_TX_DMA     (INTERNAL_ISR_TABLE_OFFSET + 17)
43385 +#define INTERRUPT_ID_USB_ISO_RX_DMA      (INTERNAL_ISR_TABLE_OFFSET + 18)
43386 +#define INTERRUPT_ID_USB_ISO_TX_DMA      (INTERNAL_ISR_TABLE_OFFSET + 19)
43387 +#define INTERRUPT_ID_EMAC1_RX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 20)
43388 +#define INTERRUPT_ID_EMAC1_TX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 21)
43389 +#define INTERRUPT_ID_EMAC2_RX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 22)
43390 +#define INTERRUPT_ID_EMAC2_TX_DMA        (INTERNAL_ISR_TABLE_OFFSET + 23)
43391 +#define INTERRUPT_ID_MPI                 (INTERNAL_ISR_TABLE_OFFSET + 24)
43392 +#define INTERRUPT_ID_DG                  (INTERNAL_ISR_TABLE_OFFSET + 25)
43393 +
43394 +#ifdef __cplusplus
43395 +    }
43396 +#endif                    
43397 +
43398 +#endif  /* __BCM6348_H */
43399 +
43400 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h
43401 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h        1970-01-01 01:00:00.000000000 +0100
43402 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/6348_map_part.h       2006-06-26 09:07:10.000000000 +0200
43403 @@ -0,0 +1,508 @@
43404 +/*
43405 +<:copyright-gpl 
43406 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
43407
43408 + This program is free software; you can distribute it and/or modify it 
43409 + under the terms of the GNU General Public License (Version 2) as 
43410 + published by the Free Software Foundation. 
43411
43412 + This program is distributed in the hope it will be useful, but WITHOUT 
43413 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
43414 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
43415 + for more details. 
43416
43417 + You should have received a copy of the GNU General Public License along 
43418 + with this program; if not, write to the Free Software Foundation, Inc., 
43419 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
43420 +:>
43421 +*/
43422 +
43423 +#ifndef __BCM6348_MAP_H
43424 +#define __BCM6348_MAP_H
43425 +
43426 +#if __cplusplus
43427 +extern "C" {
43428 +#endif
43429 +
43430 +#include "bcmtypes.h"
43431 +
43432 +#define PERF_BASE           0xfffe0000
43433 +#define TIMR_BASE           0xfffe0200    
43434 +#define UART_BASE           0xfffe0300
43435 +#define GPIO_BASE           0xfffe0400
43436 +#define MPI_BASE            0xfffe2000    /* MPI control registers */
43437 +#define USB_HOST_BASE       0xfffe1b00    /* USB host registers */
43438 +#define USB_HOST_NON_OHCI   0xfffe1c00    /* USB host non-OHCI registers */
43439 +
43440 +typedef struct PerfControl {
43441 +  uint32        RevID;
43442 +  uint16        testControl;
43443 +  uint16        blkEnables;
43444 +#define EMAC_CLK_EN     0x0010
43445 +#define SAR_CLK_EN      0x0020
43446 +#define USBS_CLK_EN     0x0040
43447 +#define USBH_CLK_EN     0x0100
43448 +
43449 +  uint32        pll_control;
43450 +#define SOFT_RESET 0x00000001
43451 +
43452 +  uint32        IrqMask;
43453 +  uint32        IrqStatus;
43454 +
43455 +  uint32        ExtIrqCfg;
43456 +#define EI_SENSE_SHFT   0
43457 +#define EI_STATUS_SHFT  5
43458 +#define EI_CLEAR_SHFT   10
43459 +#define EI_MASK_SHFT    15
43460 +#define EI_INSENS_SHFT  20
43461 +#define EI_LEVEL_SHFT   25
43462 +
43463 +  uint32        unused[4];      /* (18) */
43464 +  uint32        BlockSoftReset; /* (28) */
43465 +#define BSR_SPI             0x00000001
43466 +#define BSR_EMAC            0x00000004
43467 +#define BSR_USBH            0x00000008
43468 +#define BSR_USBS            0x00000010
43469 +#define BSR_ADSL            0x00000020
43470 +#define BSR_DMAMEM          0x00000040
43471 +#define BSR_SAR             0x00000080
43472 +#define BSR_ACLC            0x00000100
43473 +#define BSR_ADSL_MIPS_PLL   0x00000400
43474 +#define BSR_ALL_BLOCKS      \
43475 +    (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
43476 +     BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL) 
43477 +  uint32        unused2[2];     /* (2c) */
43478 +  uint32        PllStrap;       /* (34) */
43479 +#define PLL_N1_SHFT         20
43480 +#define PLL_N1_MASK         (7<<PLL_N1_SHFT)
43481 +#define PLL_N2_SHFT         15
43482 +#define PLL_N2_MASK         (0x1f<<PLL_N2_SHFT)
43483 +#define PLL_M1_REF_SHFT     12
43484 +#define PLL_M1_REF_MASK     (7<<PLL_M1_REF_SHFT)
43485 +#define PLL_M2_REF_SHFT     9
43486 +#define PLL_M2_REF_MASK     (7<<PLL_M2_REF_SHFT)
43487 +#define PLL_M1_CPU_SHFT     6
43488 +#define PLL_M1_CPU_MASK     (7<<PLL_M1_CPU_SHFT)
43489 +#define PLL_M1_BUS_SHFT     3
43490 +#define PLL_M1_BUS_MASK     (7<<PLL_M1_BUS_SHFT)
43491 +#define PLL_M2_BUS_SHFT     0
43492 +#define PLL_M2_BUS_MASK     (7<<PLL_M2_BUS_SHFT)
43493 +} PerfControl;
43494 +
43495 +#define PERF ((volatile PerfControl * const) PERF_BASE)
43496 +
43497 +typedef struct Timer {
43498 +  uint16        unused0;
43499 +  byte          TimerMask;
43500 +#define TIMER0EN        0x01
43501 +#define TIMER1EN        0x02
43502 +#define TIMER2EN        0x04
43503 +  byte          TimerInts;
43504 +#define TIMER0          0x01
43505 +#define TIMER1          0x02
43506 +#define TIMER2          0x04
43507 +#define WATCHDOG        0x08
43508 +  uint32        TimerCtl0;
43509 +  uint32        TimerCtl1;
43510 +  uint32        TimerCtl2;
43511 +#define TIMERENABLE     0x80000000
43512 +#define RSTCNTCLR       0x40000000      
43513 +  uint32        TimerCnt0;
43514 +  uint32        TimerCnt1;
43515 +  uint32        TimerCnt2;
43516 +  uint32        WatchDogDefCount;
43517 +
43518 +  /* Write 0xff00 0x00ff to Start timer
43519 +   * Write 0xee00 0x00ee to Stop and re-load default count
43520 +   * Read from this register returns current watch dog count
43521 +   */
43522 +  uint32        WatchDogCtl;
43523 +
43524 +  /* Number of 40-MHz ticks for WD Reset pulse to last */
43525 +  uint32        WDResetCount;
43526 +} Timer;
43527 +
43528 +#define TIMER ((volatile Timer * const) TIMR_BASE)
43529 +
43530 +typedef struct UartChannel {
43531 +  byte          unused0;
43532 +  byte          control;
43533 +#define BRGEN           0x80    /* Control register bit defs */
43534 +#define TXEN            0x40
43535 +#define RXEN            0x20
43536 +#define LOOPBK          0x10
43537 +#define TXPARITYEN      0x08
43538 +#define TXPARITYEVEN    0x04
43539 +#define RXPARITYEN      0x02
43540 +#define RXPARITYEVEN    0x01
43541 +
43542 +  byte          config;
43543 +#define XMITBREAK       0x40
43544 +#define BITS5SYM        0x00
43545 +#define BITS6SYM        0x10
43546 +#define BITS7SYM        0x20
43547 +#define BITS8SYM        0x30
43548 +#define ONESTOP         0x07
43549 +#define TWOSTOP         0x0f
43550 +  /* 4-LSBS represent STOP bits/char
43551 +   * in 1/8 bit-time intervals.  Zero
43552 +   * represents 1/8 stop bit interval.
43553 +   * Fifteen represents 2 stop bits.
43554 +   */
43555 +  byte          fifoctl;
43556 +#define RSTTXFIFOS      0x80
43557 +#define RSTRXFIFOS      0x40
43558 +  /* 5-bit TimeoutCnt is in low bits of this register.
43559 +   *  This count represents the number of characters 
43560 +   *  idle times before setting receive Irq when below threshold
43561 +   */
43562 +  uint32        baudword;
43563 +  /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
43564 +   */
43565 +
43566 +  byte          txf_levl;       /* Read-only fifo depth */
43567 +  byte          rxf_levl;       /* Read-only fifo depth */
43568 +  byte          fifocfg;        /* Upper 4-bits are TxThresh, Lower are
43569 +                                 *      RxThreshold.  Irq can be asserted
43570 +                                 *      when rx fifo> thresh, txfifo<thresh
43571 +                                 */
43572 +  byte          prog_out;       /* Set value of DTR (Bit0), RTS (Bit1)
43573 +                                 *  if these bits are also enabled to GPIO_o
43574 +                                 */
43575 +#define        DTREN   0x01
43576 +#define        RTSEN   0x02
43577 +
43578 +  byte          unused1;
43579 +  byte          DeltaIPEdgeNoSense;     /* Low 4-bits, set corr bit to 1 to 
43580 +                                         * detect irq on rising AND falling 
43581 +                                         * edges for corresponding GPIO_i
43582 +                                         * if enabled (edge insensitive)
43583 +                                         */
43584 +  byte          DeltaIPConfig_Mask;     /* Upper 4 bits: 1 for posedge sense
43585 +                                         *      0 for negedge sense if
43586 +                                         *      not configured for edge
43587 +                                         *      insensitive (see above)
43588 +                                         * Lower 4 bits: Mask to enable change
43589 +                                         *  detection IRQ for corresponding
43590 +                                         *  GPIO_i
43591 +                                         */
43592 +  byte          DeltaIP_SyncIP;         /* Upper 4 bits show which bits
43593 +                                         *  have changed (may set IRQ).
43594 +                                         *  read automatically clears bit
43595 +                                         * Lower 4 bits are actual status
43596 +                                         */
43597 +
43598 +  uint16        intMask;                               /* Same Bit defs for Mask and status */
43599 +  uint16        intStatus;
43600 +#define DELTAIP         0x0001
43601 +#define TXUNDERR        0x0002
43602 +#define TXOVFERR        0x0004
43603 +#define TXFIFOTHOLD     0x0008
43604 +#define TXREADLATCH     0x0010
43605 +#define TXFIFOEMT       0x0020
43606 +#define RXUNDERR        0x0040
43607 +#define RXOVFERR        0x0080
43608 +#define RXTIMEOUT       0x0100
43609 +#define RXFIFOFULL      0x0200
43610 +#define RXFIFOTHOLD     0x0400
43611 +#define RXFIFONE        0x0800
43612 +#define RXFRAMERR       0x1000
43613 +#define RXPARERR        0x2000
43614 +#define RXBRK           0x4000
43615 +
43616 +  uint16        unused2;
43617 +  uint16        Data;                   /* Write to TX, Read from RX */
43618 +                                        /* bits 11:8 are BRK,PAR,FRM errors */
43619 +
43620 +  uint32               unused3;
43621 +  uint32               unused4;
43622 +} Uart;
43623 +
43624 +#define UART ((volatile Uart * const) UART_BASE)
43625 +
43626 +typedef struct GpioControl {
43627 +  uint32        GPIODir_high; /* bits 36:32 */
43628 +  uint32        GPIODir;      /* bits 31:00 */
43629 +  uint32        GPIOio_high;  /* bits 36:32 */
43630 +  uint32        GPIOio;       /* bits 31:00 */
43631 +  uint32        LEDCtrl;
43632 +#define         LED3_STROBE             0x08000000
43633 +#define         LED2_STROBE             0x04000000
43634 +#define         LED1_STROBE             0x02000000
43635 +#define         LED0_STROBE             0x01000000
43636 +#define         LED_TEST                0x00010000
43637 +#define         LED3_DISABLE_LINK_ACT   0x00008000
43638 +#define         LED2_DISABLE_LINK_ACT   0x00004000
43639 +#define         LED1_DISABLE_LINK_ACT   0x00002000
43640 +#define         LED0_DISABLE_LINK_ACT   0x00001000
43641 +#define         LED_INTERVAL_SET_MASK   0x00000f00
43642 +#define         LED_INTERVAL_SET_320MS  0x00000500
43643 +#define         LED_INTERVAL_SET_160MS  0x00000400
43644 +#define         LED_INTERVAL_SET_80MS   0x00000300
43645 +#define         LED_INTERVAL_SET_40MS   0x00000200
43646 +#define         LED_INTERVAL_SET_20MS   0x00000100
43647 +#define         LED3_ON                 0x00000080
43648 +#define         LED2_ON                 0x00000040
43649 +#define         LED1_ON                 0x00000020
43650 +#define         LED0_ON                 0x00000010
43651 +#define         LED3_ENABLE             0x00000008
43652 +#define         LED2_ENABLE             0x00000004
43653 +#define         LED1_ENABLE             0x00000002
43654 +#define         LED0_ENABLE             0x00000001
43655 +  uint32        SpiSlaveCfg;
43656 +#define         SPI_SLAVE_RESET         0x00010000
43657 +#define         SPI_RESTRICT            0x00000400
43658 +#define         SPI_DELAY_DISABLE       0x00000200
43659 +#define         SPI_PROBE_MUX_SEL_MASK  0x000001e0
43660 +#define         SPI_SER_ADDR_CFG_MASK   0x0000000c
43661 +#define         SPI_MODE                0x00000001
43662 +  uint32        GPIOMode;
43663 +#define         GROUP4_DIAG             0x00090000
43664 +#define         GROUP4_UTOPIA           0x00080000
43665 +#define         GROUP4_LEGACY_LED       0x00030000
43666 +#define         GROUP4_MII_SNOOP        0x00020000
43667 +#define         GROUP4_EXT_EPHY         0x00010000
43668 +#define         GROUP3_DIAG             0x00009000
43669 +#define         GROUP3_UTOPIA           0x00008000
43670 +#define         GROUP3_EXT_MII          0x00007000
43671 +#define         GROUP2_DIAG             0x00000900
43672 +#define         GROUP2_PCI              0x00000500
43673 +#define         GROUP1_DIAG             0x00000090
43674 +#define         GROUP1_UTOPIA           0x00000080
43675 +#define         GROUP1_SPI_UART         0x00000060
43676 +#define         GROUP1_SPI_MASTER       0x00000060
43677 +#define         GROUP1_MII_PCCARD       0x00000040
43678 +#define         GROUP1_MII_SNOOP        0x00000020
43679 +#define         GROUP1_EXT_EPHY         0x00000010
43680 +#define         GROUP0_DIAG             0x00000009
43681 +#define         GROUP0_EXT_MII          0x00000007
43682 +
43683 +} GpioControl;
43684 +
43685 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
43686 +
43687 +/* Number to mask conversion macro used for GPIODir and GPIOio */
43688 +#define GPIO_NUM_TOTAL_BITS_MASK        0x3f
43689 +#define GPIO_NUM_MAX_BITS_MASK          0x1f
43690 +#define GPIO_NUM_TO_MASK(X)             ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
43691 +
43692 +/* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
43693 +#define GPIO_NUM_MAX_BITS_MASK_HIGH     0x07
43694 +#define GPIO_NUM_TO_MASK_HIGH(X)        ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
43695 +
43696 +
43697 +/*
43698 +** External Bus Interface
43699 +*/
43700 +typedef struct EbiChipSelect {
43701 +  uint32        base;                   /* base address in upper 24 bits */
43702 +#define EBI_SIZE_8K         0
43703 +#define EBI_SIZE_16K        1
43704 +#define EBI_SIZE_32K        2
43705 +#define EBI_SIZE_64K        3
43706 +#define EBI_SIZE_128K       4
43707 +#define EBI_SIZE_256K       5
43708 +#define EBI_SIZE_512K       6
43709 +#define EBI_SIZE_1M         7
43710 +#define EBI_SIZE_2M         8
43711 +#define EBI_SIZE_4M         9
43712 +#define EBI_SIZE_8M         10
43713 +#define EBI_SIZE_16M        11
43714 +#define EBI_SIZE_32M        12
43715 +#define EBI_SIZE_64M        13
43716 +#define EBI_SIZE_128M       14
43717 +#define EBI_SIZE_256M       15
43718 +  uint32        config;
43719 +#define EBI_ENABLE          0x00000001      /* .. enable this range */
43720 +#define EBI_WAIT_STATES     0x0000000e      /* .. mask for wait states */
43721 +#define EBI_WTST_SHIFT      1               /* .. for shifting wait states */
43722 +#define EBI_WORD_WIDE       0x00000010      /* .. 16-bit peripheral, else 8 */
43723 +#define EBI_WREN            0x00000020      /* enable posted writes */
43724 +#define EBI_POLARITY        0x00000040      /* .. set to invert something, 
43725 +                                        **    don't know what yet */
43726 +#define EBI_TS_TA_MODE      0x00000080      /* .. use TS/TA mode */
43727 +#define EBI_TS_SEL          0x00000100      /* .. drive tsize, not bs_b */
43728 +#define EBI_FIFO            0x00000200      /* .. use fifo */
43729 +#define EBI_RE              0x00000400      /* .. Reverse Endian */
43730 +} EbiChipSelect;
43731 +
43732 +typedef struct MpiRegisters {
43733 +  EbiChipSelect cs[7];                  /* size chip select configuration */
43734 +#define EBI_CS0_BASE            0
43735 +#define EBI_CS1_BASE            1
43736 +#define EBI_CS2_BASE            2
43737 +#define EBI_CS3_BASE            3
43738 +#define PCMCIA_COMMON_BASE      4
43739 +#define PCMCIA_ATTRIBUTE_BASE   5
43740 +#define PCMCIA_IO_BASE          6
43741 +  uint32        unused0[2];             /* reserved */
43742 +  uint32        ebi_control;            /* ebi control */
43743 +  uint32        unused1[4];             /* reserved */
43744 +#define EBI_ACCESS_TIMEOUT      0x000007FF
43745 +  uint32        pcmcia_cntl1;           /* pcmcia control 1 */
43746 +#define PCCARD_CARD_RESET       0x00040000
43747 +#define CARDBUS_ENABLE          0x00008000
43748 +#define PCMCIA_ENABLE           0x00004000
43749 +#define PCMCIA_GPIO_ENABLE      0x00002000
43750 +#define CARDBUS_IDSEL           0x00001F00
43751 +#define VS2_OEN                 0x00000080
43752 +#define VS1_OEN                 0x00000040
43753 +#define VS2_OUT                 0x00000020
43754 +#define VS1_OUT                 0x00000010
43755 +#define VS2_IN                  0x00000008
43756 +#define VS1_IN                  0x00000004
43757 +#define CD2_IN                  0x00000002
43758 +#define CD1_IN                  0x00000001
43759 +#define VS_MASK                 0x0000000C
43760 +#define CD_MASK                 0x00000003
43761 +  uint32        unused2;                /* reserved */
43762 +  uint32        pcmcia_cntl2;           /* pcmcia control 2 */
43763 +#define PCMCIA_BYTESWAP_DIS     0x00000002
43764 +#define PCMCIA_HALFWORD_EN      0x00000001
43765 +#define RW_ACTIVE_CNT_BIT       2
43766 +#define INACTIVE_CNT_BIT        8
43767 +#define CE_SETUP_CNT_BIT        16
43768 +#define CE_HOLD_CNT_BIT         24
43769 +  uint32        unused3[40];            /* reserved */
43770 +
43771 +  uint32        sp0range;               /* PCI to internal system bus address space */
43772 +  uint32        sp0remap;
43773 +  uint32        sp0cfg;
43774 +  uint32        sp1range;
43775 +  uint32        sp1remap;
43776 +  uint32        sp1cfg;
43777 +
43778 +  uint32        EndianCfg;
43779 +
43780 +  uint32        l2pcfgctl;              /* internal system bus to PCI IO/Cfg control */
43781 +#define DIR_CFG_SEL             0x80000000 /* change from PCI I/O access to PCI config access */
43782 +#define DIR_CFG_USEREG          0x40000000 /* use this register info for PCI configuration access */
43783 +#define DEVICE_NUMBER           0x00007C00 /* device number for the PCI configuration access */
43784 +#define FUNC_NUMBER             0x00000300 /* function number for the PCI configuration access */
43785 +#define REG_NUMBER              0x000000FC /* register number for the PCI configuration access */
43786 +#define CONFIG_TYPE             0x00000003 /* configuration type for the PCI configuration access */
43787 +
43788 +  uint32        l2pmrange1;             /* internal system bus to PCI memory space */
43789 +#define PCI_SIZE_64K            0xFFFF0000
43790 +#define PCI_SIZE_128K           0xFFFE0000
43791 +#define PCI_SIZE_256K           0xFFFC0000
43792 +#define PCI_SIZE_512K           0xFFF80000
43793 +#define PCI_SIZE_1M             0xFFF00000
43794 +#define PCI_SIZE_2M             0xFFE00000
43795 +#define PCI_SIZE_4M             0xFFC00000
43796 +#define PCI_SIZE_8M             0xFF800000
43797 +#define PCI_SIZE_16M            0xFF000000
43798 +#define PCI_SIZE_32M            0xFE000000
43799 +  uint32        l2pmbase1;              /* kseg0 or kseg1 address & 0x1FFFFFFF */
43800 +  uint32        l2pmremap1;
43801 +#define CARDBUS_MEM             0x00000004
43802 +#define MEM_WINDOW_EN           0x00000001
43803 +  uint32        l2pmrange2;
43804 +  uint32        l2pmbase2;
43805 +  uint32        l2pmremap2;
43806 +  uint32        l2piorange;             /* internal system bus to PCI I/O space */
43807 +  uint32        l2piobase;
43808 +  uint32        l2pioremap;
43809 +
43810 +  uint32        pcimodesel;
43811 +#define PCI2_INT_BUS_RD_PREFECH 0x000000F0
43812 +#define PCI_BAR2_NOSWAP         0x00000002 /* BAR at offset 0x20 */
43813 +#define PCI_BAR1_NOSWAP         0x00000001 /* BAR at affset 0x1c */
43814 +
43815 +  uint32        pciintstat;             /* PCI interrupt mask/status */
43816 +#define MAILBOX1_SENT           0x08
43817 +#define MAILBOX0_SENT           0x04
43818 +#define MAILBOX1_MSG_RCV        0x02
43819 +#define MAILBOX0_MSG_RCV        0x01
43820 +  uint32        locbuscntrl;            /* internal system bus control */
43821 +#define DIR_U2P_NOSWAP          0x00000002
43822 +#define EN_PCI_GPIO             0x00000001
43823 +  uint32        locintstat;             /* internal system bus interrupt mask/status */
43824 +#define CSERR                   0x0200
43825 +#define SERR                    0x0100
43826 +#define EXT_PCI_INT             0x0080
43827 +#define DIR_FAILED              0x0040
43828 +#define DIR_COMPLETE            0x0020
43829 +#define PCI_CFG                 0x0010
43830 +  uint32        unused5[7];
43831 +
43832 +  uint32        mailbox0;
43833 +  uint32        mailbox1;
43834 +
43835 +  uint32        pcicfgcntrl;            /* internal system bus PCI configuration control */
43836 +#define PCI_CFG_REG_WRITE_EN    0x00000080
43837 +#define PCI_CFG_ADDR            0x0000003C
43838 +  uint32        pcicfgdata;             /* internal system bus PCI configuration data */
43839 +
43840 +  uint32        locch2ctl;              /* PCI to interrnal system bus DMA (downstream) local control */
43841 +#define MPI_DMA_HALT            0x00000008  /* idle after finish current memory burst */
43842 +#define MPI_DMA_PKT_HALT        0x00000004  /* idle after an EOP flag is detected */
43843 +#define MPI_DMA_STALL           0x00000002  /* idle after an EOP flag is detected */
43844 +#define MPI_DMA_ENABLE          0x00000001  /* set to enable channel */
43845 +  uint32        locch2intStat;
43846 +#define MPI_DMA_NO_DESC         0x00000004  /* no valid descriptors */
43847 +#define MPI_DMA_DONE            0x00000002  /* packet xfer complete */
43848 +#define MPI_DMA_BUFF_DONE       0x00000001  /* buffer done */
43849 +  uint32        locch2intMask;
43850 +  uint32        unused6;
43851 +  uint32        locch2descaddr;
43852 +  uint32        locch2status1;
43853 +#define LOCAL_DESC_STATE        0xE0000000
43854 +#define PCI_DESC_STATE          0x1C000000
43855 +#define BYTE_DONE               0x03FFC000
43856 +#define RING_ADDR               0x00003FFF
43857 +  uint32        locch2status2;
43858 +#define BUFPTR_OFFSET           0x1FFF0000
43859 +#define PCI_MASTER_STATE        0x000000C0
43860 +#define LOC_MASTER_STATE        0x00000038
43861 +#define CONTROL_STATE           0x00000007
43862 +  uint32        unused7;
43863 +
43864 +  uint32        locch1Ctl;              /*internal system bus to PCI DMA (upstream) local control */
43865 +#define DMA_U2P_LE              0x00000200  /* local bus is little endian */
43866 +#define DMA_U2P_NOSWAP          0x00000100  /* lccal bus is little endian but no data swapped */
43867 +  uint32        locch1intstat;
43868 +  uint32        locch1intmask;
43869 +  uint32        unused8;
43870 +  uint32        locch1descaddr;
43871 +  uint32        locch1status1;
43872 +  uint32        locch1status2;
43873 +  uint32        unused9;
43874 +
43875 +  uint32        pcich1ctl;              /* internal system bus to PCI DMA PCI control */
43876 +  uint32        pcich1intstat;
43877 +  uint32        pcich1intmask;
43878 +  uint32        pcich1descaddr;
43879 +  uint32        pcich1status1;
43880 +  uint32        pcich1status2;
43881 +
43882 +  uint32        pcich2Ctl;              /* PCI to internal system bus DMA PCI control */
43883 +  uint32        pcich2intstat;
43884 +  uint32        pcich2intmask;
43885 +  uint32        pcich2descaddr;
43886 +  uint32        pcich2status1;
43887 +  uint32        pcich2status2;
43888 +
43889 +  uint32        perm_id;                /* permanent device and vendor id */
43890 +  uint32        perm_rev;               /* permanent revision id */
43891 +} MpiRegisters;
43892 +
43893 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
43894 +
43895 +/* PCI configuration address space start offset 0x40 */
43896 +#define BRCM_PCI_CONFIG_TIMER               0x40
43897 +#define BRCM_PCI_CONFIG_TIMER_RETRY_MASK       0x0000FF00
43898 +#define BRCM_PCI_CONFIG_TIMER_TRDY_MASK                0x000000FF
43899 +
43900 +/* USB host non-Open HCI register, USB_HOST_NON_OHCI, bit definitions. */
43901 +#define NON_OHCI_ENABLE_PORT1   0x00000001 /* Use USB port 1 for host, not dev */
43902 +#define NON_OHCI_BYTE_SWAP      0x00000008 /* Swap USB host registers */
43903 +
43904 +#define USBH_NON_OHCI ((volatile unsigned long * const) USB_HOST_NON_OHCI)
43905 +
43906 +#if __cplusplus
43907 +}
43908 +#endif
43909 +
43910 +#endif
43911 +
43912 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmTag.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmTag.h
43913 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmTag.h       1970-01-01 01:00:00.000000000 +0100
43914 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmTag.h      2006-06-26 09:07:10.000000000 +0200
43915 @@ -0,0 +1,153 @@
43916 +/*
43917 +<:copyright-gpl 
43918 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
43919
43920 + This program is free software; you can distribute it and/or modify it 
43921 + under the terms of the GNU General Public License (Version 2) as 
43922 + published by the Free Software Foundation. 
43923
43924 + This program is distributed in the hope it will be useful, but WITHOUT 
43925 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
43926 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
43927 + for more details. 
43928
43929 + You should have received a copy of the GNU General Public License along 
43930 + with this program; if not, write to the Free Software Foundation, Inc., 
43931 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
43932 +:>
43933 +*/
43934 +//**************************************************************************************
43935 +// File Name  : bcmTag.h
43936 +//
43937 +// Description: add tag with validation system to the firmware image file to be uploaded
43938 +//              via http
43939 +//
43940 +// Created    : 02/28/2002  seanl
43941 +//**************************************************************************************
43942 +
43943 +#ifndef _BCMTAG_H_
43944 +#define _BCMTAG_H_
43945 +
43946 +
43947 +#define BCM_SIG_1   "Broadcom Corporation"
43948 +#define BCM_SIG_2   "ver. 2.0"          // was "firmware version 2.0" now it is split 6 char out for chip id.
43949 +
43950 +#define BCM_TAG_VER         "6"
43951 +#define BCM_TAG_VER_LAST    "26"
43952 +
43953 +// file tag (head) structure all is in clear text except validationTokens (crc, md5, sha1, etc). Total: 128 unsigned chars
43954 +#define TAG_LEN         256
43955 +#define TAG_VER_LEN     4
43956 +#define SIG_LEN         20
43957 +#define SIG_LEN_2       14   // Original second SIG = 20 is now devided into 14 for SIG_LEN_2 and 6 for CHIP_ID
43958 +#define CHIP_ID_LEN            6       
43959 +#define IMAGE_LEN       10
43960 +#define ADDRESS_LEN     12
43961 +#define FLAG_LEN        2
43962 +#define TOKEN_LEN       20
43963 +#define BOARD_ID_LEN    16
43964 +#define RESERVED_LEN    (TAG_LEN - TAG_VER_LEN - SIG_LEN - SIG_LEN_2 - CHIP_ID_LEN - BOARD_ID_LEN - \
43965 +                        (4*IMAGE_LEN) - (3*ADDRESS_LEN) - (3*FLAG_LEN) - (2*TOKEN_LEN))
43966 +
43967 +
43968 +// TAG for downloadable image (kernel plus file system)
43969 +typedef struct _FILE_TAG
43970 +{
43971 +    unsigned char tagVersion[TAG_VER_LEN];       // tag version.  Will be 2 here.
43972 +    unsigned char signiture_1[SIG_LEN];          // text line for company info
43973 +    unsigned char signiture_2[SIG_LEN_2];        // additional info (can be version number)
43974 +    unsigned char chipId[CHIP_ID_LEN];                  // chip id 
43975 +    unsigned char boardId[BOARD_ID_LEN];         // board id
43976 +    unsigned char bigEndian[FLAG_LEN];           // if = 1 - big, = 0 - little endia of the host
43977 +    unsigned char totalImageLen[IMAGE_LEN];      // the sum of all the following length
43978 +    unsigned char cfeAddress[ADDRESS_LEN];       // if non zero, cfe starting address
43979 +    unsigned char cfeLen[IMAGE_LEN];             // if non zero, cfe size in clear ASCII text.
43980 +    unsigned char rootfsAddress[ADDRESS_LEN];    // if non zero, filesystem starting address
43981 +    unsigned char rootfsLen[IMAGE_LEN];          // if non zero, filesystem size in clear ASCII text.
43982 +    unsigned char kernelAddress[ADDRESS_LEN];    // if non zero, kernel starting address
43983 +    unsigned char kernelLen[IMAGE_LEN];          // if non zero, kernel size in clear ASCII text.
43984 +    unsigned char dualImage[FLAG_LEN];           // if 1, dual image
43985 +    unsigned char inactiveLen[FLAG_LEN];         // if 1, the image is INACTIVE; if 0, active 
43986 +    unsigned char reserved[RESERVED_LEN];        // reserved for later use
43987 +    unsigned char imageValidationToken[TOKEN_LEN];// image validation token - can be crc, md5, sha;  for
43988 +                                                 // now will be 4 unsigned char crc
43989 +    unsigned char tagValidationToken[TOKEN_LEN]; // validation token for tag(from signiture_1 to end of // mageValidationToken)
43990 +} FILE_TAG, *PFILE_TAG;
43991 +
43992 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
43993 +#define CRC_LEN 4
43994 +
43995 +// only included if for bcmTag.exe program
43996 +#ifdef BCMTAG_EXE_USE
43997 +
43998 +static unsigned long Crc32_table[256] = {
43999 +    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
44000 +    0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
44001 +    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
44002 +    0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
44003 +    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
44004 +    0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
44005 +    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
44006 +    0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
44007 +    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
44008 +    0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
44009 +    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
44010 +    0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
44011 +    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
44012 +    0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
44013 +    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
44014 +    0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
44015 +    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
44016 +    0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
44017 +    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
44018 +    0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
44019 +    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
44020 +    0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
44021 +    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
44022 +    0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
44023 +    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
44024 +    0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
44025 +    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
44026 +    0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
44027 +    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
44028 +    0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
44029 +    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
44030 +    0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
44031 +    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
44032 +    0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
44033 +    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
44034 +    0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
44035 +    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
44036 +    0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
44037 +    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
44038 +    0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
44039 +    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
44040 +    0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
44041 +    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
44042 +    0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
44043 +    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
44044 +    0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
44045 +    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
44046 +    0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
44047 +    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
44048 +    0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
44049 +    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
44050 +    0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
44051 +    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
44052 +    0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
44053 +    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
44054 +    0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
44055 +    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
44056 +    0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
44057 +    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
44058 +    0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
44059 +    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
44060 +    0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
44061 +    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
44062 +    0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
44063 +};
44064 +#endif // BCMTAG_USE
44065 +
44066 +
44067 +#endif // _BCMTAG_H_
44068 +
44069 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h
44070 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h     1970-01-01 01:00:00.000000000 +0100
44071 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_intr.h    2006-06-26 09:07:10.000000000 +0200
44072 @@ -0,0 +1,59 @@
44073 +/*
44074 +<:copyright-gpl 
44075 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
44076
44077 + This program is free software; you can distribute it and/or modify it 
44078 + under the terms of the GNU General Public License (Version 2) as 
44079 + published by the Free Software Foundation. 
44080
44081 + This program is distributed in the hope it will be useful, but WITHOUT 
44082 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44083 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44084 + for more details. 
44085
44086 + You should have received a copy of the GNU General Public License along 
44087 + with this program; if not, write to the Free Software Foundation, Inc., 
44088 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44089 +:>
44090 +*/
44091 +
44092 +#ifndef __BCM_INTR_H
44093 +#define __BCM_INTR_H
44094 +
44095 +#ifdef __cplusplus
44096 +    extern "C" {
44097 +#endif
44098 +
44099 +#if defined(CONFIG_BCM96338)
44100 +#include <6338_intr.h>
44101 +#endif
44102 +#if defined(CONFIG_BCM96345)
44103 +#include <6345_intr.h>
44104 +#endif
44105 +#if defined(CONFIG_BCM96348)
44106 +#include <6348_intr.h>
44107 +#endif
44108 +
44109 +/* defines */
44110 +struct pt_regs;
44111 +typedef int (*FN_HANDLER) (int, void *, struct pt_regs *);
44112 +
44113 +/* prototypes */
44114 +extern void enable_brcm_irq(unsigned int irq);
44115 +extern void disable_brcm_irq(unsigned int irq);
44116 +extern int request_external_irq(unsigned int irq,
44117 +    FN_HANDLER handler, unsigned long irqflags, 
44118 +    const char * devname, void *dev_id);
44119 +extern unsigned int BcmHalMapInterrupt(FN_HANDLER isr, unsigned int param,
44120 +    unsigned int interruptId);
44121 +extern void dump_intr_regs(void);
44122 +
44123 +/* compatibility definitions */
44124 +#define BcmHalInterruptEnable(irq)      enable_brcm_irq( irq )
44125 +#define BcmHalInterruptDisable(irq)     disable_brcm_irq( irq )
44126 +
44127 +#ifdef __cplusplus
44128 +    }
44129 +#endif
44130 +
44131 +#endif
44132 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h
44133 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h 1970-01-01 01:00:00.000000000 +0100
44134 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcm_map_part.h        2006-06-26 09:07:10.000000000 +0200
44135 @@ -0,0 +1,34 @@
44136 +/*
44137 +<:copyright-gpl 
44138 + Copyright 2004 Broadcom Corp. All Rights Reserved. 
44139
44140 + This program is free software; you can distribute it and/or modify it 
44141 + under the terms of the GNU General Public License (Version 2) as 
44142 + published by the Free Software Foundation. 
44143
44144 + This program is distributed in the hope it will be useful, but WITHOUT 
44145 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44146 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44147 + for more details. 
44148
44149 + You should have received a copy of the GNU General Public License along 
44150 + with this program; if not, write to the Free Software Foundation, Inc., 
44151 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44152 +:>
44153 +*/
44154 +
44155 +#ifndef __BCM_MAP_PART_H
44156 +#define __BCM_MAP_PART_H
44157 +
44158 +#if defined(CONFIG_BCM96338)
44159 +#include <6338_map_part.h>
44160 +#endif
44161 +#if defined(CONFIG_BCM96345)
44162 +#include <6345_map_part.h>
44163 +#endif
44164 +#if defined(CONFIG_BCM96348)
44165 +#include <6348_map_part.h>
44166 +#endif
44167 +
44168 +#endif
44169 +
44170 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmpci.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmpci.h
44171 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmpci.h       1970-01-01 01:00:00.000000000 +0100
44172 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmpci.h      2006-06-26 09:07:10.000000000 +0200
44173 @@ -0,0 +1,87 @@
44174 +/*
44175 +<:copyright-gpl 
44176 + Copyright 2004 Broadcom Corp. All Rights Reserved. 
44177
44178 + This program is free software; you can distribute it and/or modify it 
44179 + under the terms of the GNU General Public License (Version 2) as 
44180 + published by the Free Software Foundation. 
44181
44182 + This program is distributed in the hope it will be useful, but WITHOUT 
44183 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44184 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44185 + for more details. 
44186
44187 + You should have received a copy of the GNU General Public License along 
44188 + with this program; if not, write to the Free Software Foundation, Inc., 
44189 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44190 +:>
44191 +*/
44192 +
44193 +//
44194 +// bcmpci.h - bcm96348 PCI, Cardbus, and PCMCIA definition
44195 +//
44196 +#ifndef BCMPCI_H
44197 +#define BCMPCI_H
44198 +
44199 +/* Memory window in internal system bus address space */ 
44200 +#define BCM_PCI_MEM_BASE        0x08000000
44201 +/* IO window in internal system bus address space */ 
44202 +#define BCM_PCI_IO_BASE         0x0C000000
44203 +
44204 +#define BCM_PCI_ADDR_MASK       0x1fffffff
44205 +
44206 +/* Memory window size (range) */
44207 +#define BCM_PCI_MEM_SIZE_16MB   0x01000000
44208 +/* IO window size (range) */
44209 +#define BCM_PCI_IO_SIZE_64KB    0x00010000
44210 +
44211 +/* PCI Configuration and I/O space acesss */
44212 +#define BCM_PCI_CFG(d, f, o)    ( (d << 11) | (f << 8) | (o/4 << 2) )
44213 +
44214 +/* fake USB PCI slot */
44215 +#define USB_HOST_SLOT           9
44216 +#define USB_BAR0_MEM_SIZE       0x0800
44217 +
44218 +#define BCM_HOST_MEM_SPACE1     0x10000000
44219 +#define BCM_HOST_MEM_SPACE2     0x00000000
44220 +
44221 +/* 
44222 + * EBI bus clock is 33MHz and share with PCI bus
44223 + * each clock cycle is 30ns.
44224 + */
44225 +/* attribute memory access wait cnt for 4306 */
44226 +#define PCMCIA_ATTR_CE_HOLD     3  // data hold time 70ns
44227 +#define PCMCIA_ATTR_CE_SETUP    3  // data setup time 50ns
44228 +#define PCMCIA_ATTR_INACTIVE    6  // time between read/write cycles 180ns. For the total cycle time 600ns (cnt1+cnt2+cnt3+cnt4)
44229 +#define PCMCIA_ATTR_ACTIVE      10 // OE/WE pulse width 300ns
44230 +
44231 +/* common memory access wait cnt for 4306 */
44232 +#define PCMCIA_MEM_CE_HOLD      1  // data hold time 30ns
44233 +#define PCMCIA_MEM_CE_SETUP     1  // data setup time 30ns
44234 +#define PCMCIA_MEM_INACTIVE     2  // time between read/write cycles 40ns. For the total cycle time 250ns (cnt1+cnt2+cnt3+cnt4)
44235 +#define PCMCIA_MEM_ACTIVE       5  // OE/WE pulse width 150ns
44236 +
44237 +#define PCCARD_VCC_MASK     0x00070000  // Mask Reset also
44238 +#define PCCARD_VCC_33V      0x00010000
44239 +#define PCCARD_VCC_50V      0x00020000
44240 +
44241 +typedef enum {
44242 +    MPI_CARDTYPE_NONE,      // No Card in slot
44243 +    MPI_CARDTYPE_PCMCIA,    // 16-bit PCMCIA card in slot    
44244 +    MPI_CARDTYPE_CARDBUS,   // 32-bit CardBus card in slot
44245 +}   CardType;
44246 +
44247 +#define CARDBUS_SLOT        0    // Slot 0 is default for CardBus
44248 +
44249 +#define pcmciaAttrOffset    0x00200000
44250 +#define pcmciaMemOffset     0x00000000
44251 +// Needs to be right above PCI I/O space. Give 0x8000 (32K) to PCMCIA. 
44252 +#define pcmciaIoOffset      (BCM_PCI_IO_BASE + 0x80000)
44253 +// Base Address is that mapped into the MPI ChipSelect registers. 
44254 +// UBUS bridge MemoryWindow 0 outputs a 0x00 for the base.
44255 +#define pcmciaBase          0xbf000000
44256 +#define pcmciaAttr          (pcmciaAttrOffset | pcmciaBase)
44257 +#define pcmciaMem           (pcmciaMemOffset  | pcmciaBase)
44258 +#define pcmciaIo            (pcmciaIoOffset   | pcmciaBase)
44259 +
44260 +#endif
44261 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h
44262 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h     1970-01-01 01:00:00.000000000 +0100
44263 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/bcmtypes.h    2006-06-26 09:07:10.000000000 +0200
44264 @@ -0,0 +1,163 @@
44265 +/*
44266 +<:copyright-gpl 
44267 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
44268
44269 + This program is free software; you can distribute it and/or modify it 
44270 + under the terms of the GNU General Public License (Version 2) as 
44271 + published by the Free Software Foundation. 
44272
44273 + This program is distributed in the hope it will be useful, but WITHOUT 
44274 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44275 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44276 + for more details. 
44277
44278 + You should have received a copy of the GNU General Public License along 
44279 + with this program; if not, write to the Free Software Foundation, Inc., 
44280 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44281 +:>
44282 +*/
44283 +
44284 +//
44285 +// bcmtypes.h - misc useful typedefs
44286 +//
44287 +#ifndef BCMTYPES_H
44288 +#define BCMTYPES_H
44289 +
44290 +// These are also defined in typedefs.h in the application area, so I need to
44291 +// protect against re-definition.
44292 +
44293 +#ifndef _TYPEDEFS_H_
44294 +typedef unsigned char   uint8;
44295 +typedef unsigned short  uint16;
44296 +typedef unsigned long   uint32;
44297 +typedef signed char     int8;
44298 +typedef signed short    int16;
44299 +typedef signed long     int32;
44300 +#if !defined(__cplusplus)
44301 +typedef        int     bool;
44302 +#endif
44303 +#endif
44304 +
44305 +typedef unsigned char   byte;
44306 +// typedef unsigned long   sem_t;
44307 +
44308 +typedef unsigned long   HANDLE,*PULONG,DWORD,*PDWORD;
44309 +typedef signed long     LONG,*PLONG;
44310 +
44311 +typedef unsigned int    *PUINT;
44312 +typedef signed int      INT;
44313 +
44314 +typedef unsigned short  *PUSHORT;
44315 +typedef signed short    SHORT,*PSHORT;
44316 +typedef unsigned short  WORD,*PWORD;
44317 +
44318 +typedef unsigned char   *PUCHAR;
44319 +typedef signed char     *PCHAR;
44320 +
44321 +typedef void            *PVOID;
44322 +
44323 +typedef unsigned char   BOOLEAN, *PBOOL, *PBOOLEAN;
44324 +
44325 +typedef unsigned char   BYTE,*PBYTE;
44326 +
44327 +//#ifndef __GNUC__
44328 +//The following has been defined in Vxworks internally: vxTypesOld.h
44329 +//redefine under vxworks will cause error
44330 +typedef signed int      *PINT;
44331 +
44332 +typedef signed char     INT8;
44333 +typedef signed short    INT16;
44334 +typedef signed long     INT32;
44335 +
44336 +typedef unsigned char   UINT8;
44337 +typedef unsigned short  UINT16;
44338 +typedef unsigned long   UINT32;
44339 +
44340 +typedef unsigned char   UCHAR;
44341 +typedef unsigned short  USHORT;
44342 +typedef unsigned int    UINT;
44343 +typedef unsigned long   ULONG;
44344 +
44345 +typedef void            VOID;
44346 +typedef unsigned char   BOOL;
44347 +
44348 +//#endif  /* __GNUC__ */
44349 +
44350 +
44351 +// These are also defined in typedefs.h in the application area, so I need to
44352 +// protect against re-definition.
44353 +#ifndef TYPEDEFS_H
44354 +
44355 +// Maximum and minimum values for a signed 16 bit integer.
44356 +#define MAX_INT16 32767
44357 +#define MIN_INT16 -32768
44358 +
44359 +// Useful for true/false return values.  This uses the
44360 +// Taligent notation (k for constant).
44361 +typedef enum
44362 +{
44363 +    kFalse = 0,
44364 +    kTrue = 1
44365 +} Bool;
44366 +
44367 +#endif
44368 +
44369 +/* macros to protect against unaligned accesses */
44370 +
44371 +#if 0
44372 +/* first arg is an address, second is a value */
44373 +#define PUT16( a, d ) {                \
44374 +  *((byte *)a) = (byte)((d)>>8);       \
44375 +  *(((byte *)a)+1) = (byte)(d);        \
44376 +}
44377 +
44378 +#define PUT32( a, d ) {                \
44379 +  *((byte *)a) = (byte)((d)>>24);      \
44380 +  *(((byte *)a)+1) = (byte)((d)>>16);  \
44381 +  *(((byte *)a)+2) = (byte)((d)>>8);   \
44382 +  *(((byte *)a)+3) = (byte)(d);        \
44383 +}
44384 +
44385 +/* first arg is an address, returns a value */
44386 +#define GET16( a ) (                   \
44387 +  (*((byte *)a) << 8) |                        \
44388 +  (*(((byte *)a)+1))                   \
44389 +)
44390 +
44391 +#define GET32( a ) (                   \
44392 +  (*((byte *)a) << 24)     |           \
44393 +  (*(((byte *)a)+1) << 16) |           \
44394 +  (*(((byte *)a)+2) << 8)  |           \
44395 +  (*(((byte *)a)+3))                   \
44396 +)
44397 +#endif
44398 +
44399 +#ifndef YES
44400 +#define YES 1
44401 +#endif
44402 +
44403 +#ifndef NO
44404 +#define NO  0
44405 +#endif
44406 +
44407 +#ifndef IN
44408 +#define IN
44409 +#endif
44410 +
44411 +#ifndef OUT
44412 +#define OUT
44413 +#endif
44414 +
44415 +#ifndef TRUE
44416 +#define TRUE 1
44417 +#endif
44418 +
44419 +#ifndef FALSE
44420 +#define FALSE  0
44421 +#endif
44422 +
44423 +#define READ32(addr)        (*(volatile UINT32 *)((ULONG)&addr))
44424 +#define READ16(addr)        (*(volatile UINT16 *)((ULONG)&addr))
44425 +#define READ8(addr)         (*(volatile UINT8  *)((ULONG)&addr))
44426 +
44427 +#endif
44428 diff -urN linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/board.h linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/board.h
44429 --- linux-2.6.8.1/bcmdrivers/opensource/include/bcm963xx/board.h        1970-01-01 01:00:00.000000000 +0100
44430 +++ linux-2.6.8.1-brcm63xx/bcmdrivers/opensource/include/bcm963xx/board.h       2006-06-26 09:07:10.000000000 +0200
44431 @@ -0,0 +1,368 @@
44432 +/*
44433 +<:copyright-gpl 
44434 + Copyright 2002 Broadcom Corp. All Rights Reserved. 
44435
44436 + This program is free software; you can distribute it and/or modify it 
44437 + under the terms of the GNU General Public License (Version 2) as 
44438 + published by the Free Software Foundation. 
44439
44440 + This program is distributed in the hope it will be useful, but WITHOUT 
44441 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44442 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44443 + for more details. 
44444
44445 + You should have received a copy of the GNU General Public License along 
44446 + with this program; if not, write to the Free Software Foundation, Inc., 
44447 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44448 +:>
44449 +*/
44450 +/***********************************************************************/
44451 +/*                                                                     */
44452 +/*   MODULE:  board.h                                                  */
44453 +/*   DATE:    97/02/18                                                 */
44454 +/*   PURPOSE: Board specific information.  This module should include  */
44455 +/*            all base device addresses and board specific macros.     */
44456 +/*                                                                     */
44457 +/***********************************************************************/
44458 +#ifndef _BOARD_H
44459 +#define _BOARD_H
44460 +
44461 +#if __cplusplus
44462 +extern "C" {
44463 +#endif
44464 +/*****************************************************************************/
44465 +/*                    Misc board definitions                                 */
44466 +/*****************************************************************************/
44467 +
44468 +#define        DYING_GASP_API
44469 +
44470 +/*****************************************************************************/
44471 +/*                    Physical Memory Map                                    */
44472 +/*****************************************************************************/
44473 +
44474 +#define PHYS_DRAM_BASE           0x00000000     /* Dynamic RAM Base */
44475 +#define PHYS_FLASH_BASE          0x1FC00000     /* Flash Memory         */
44476 +
44477 +/*****************************************************************************/
44478 +/* Note that the addresses above are physical addresses and that programs    */
44479 +/* have to use converted addresses defined below:                            */
44480 +/*****************************************************************************/
44481 +#define DRAM_BASE           (0x80000000 | PHYS_DRAM_BASE)   /* cached DRAM */
44482 +#define DRAM_BASE_NOCACHE   (0xA0000000 | PHYS_DRAM_BASE)   /* uncached DRAM */
44483 +#define FLASH_BASE          (0xA0000000 | PHYS_FLASH_BASE)  /* uncached Flash  */
44484 +
44485 +/*****************************************************************************/
44486 +/*  Select the PLL value to get the desired CPU clock frequency.             */
44487 +/*                                                                           */
44488 +/*                                                                           */
44489 +/*****************************************************************************/
44490 +#define FPERIPH            50000000
44491 +
44492 +#define ONEK                            1024
44493 +#define BLK64K                          (64*ONEK)
44494 +#define FLASH45_BLKS_BOOT_ROM           1
44495 +#define FLASH45_LENGTH_BOOT_ROM         (FLASH45_BLKS_BOOT_ROM * BLK64K)
44496 +#define FLASH_RESERVED_AT_END           (64*ONEK) /*reserved for PSI, scratch pad*/
44497 +    
44498 +/*****************************************************************************/
44499 +/* Note that the addresses above are physical addresses and that programs    */
44500 +/* have to use converted addresses defined below:                            */
44501 +/*****************************************************************************/
44502 +#define DRAM_BASE           (0x80000000 | PHYS_DRAM_BASE)   /* cached DRAM */
44503 +#define DRAM_BASE_NOCACHE   (0xA0000000 | PHYS_DRAM_BASE)   /* uncached DRAM */
44504 +#define FLASH_BASE          (0xA0000000 | PHYS_FLASH_BASE)  /* uncached Flash  */
44505 +
44506 +/*****************************************************************************/
44507 +/*  Select the PLL value to get the desired CPU clock frequency.             */
44508 +/*                                                                           */
44509 +/*                                                                           */
44510 +/*****************************************************************************/
44511 +#define FPERIPH            50000000
44512 +    
44513 +#define SDRAM_TYPE_ADDRESS_OFFSET   16
44514 +#define NVRAM_DATA_OFFSET           0x0580
44515 +#define NVRAM_DATA_ID               0x0f1e2d3c
44516 +#define BOARD_SDRAM_TYPE            *(unsigned long *) \
44517 +                                    (FLASH_BASE + SDRAM_TYPE_ADDRESS_OFFSET)
44518 +
44519 +#define ONEK                1024
44520 +#define BLK64K              (64*ONEK)
44521 +
44522 +// nvram and psi flash definitions for 45
44523 +#define FLASH45_LENGTH_NVRAM            ONEK            // 1k nvram 
44524 +#define NVRAM_PSI_DEFAULT               24              // default psi in K byes
44525 +
44526 +/*****************************************************************************/
44527 +/*       NVRAM Offset and definition                                         */
44528 +/*****************************************************************************/
44529 +
44530 +#define NVRAM_VERSION_NUMBER            2
44531 +#define NVRAM_VERSION_NUMBER_ADDRESS    0
44532 +
44533 +#define NVRAM_BOOTLINE_LEN              256
44534 +#define NVRAM_BOARD_ID_STRING_LEN       16
44535 +#define NVRAM_MAC_ADDRESS_LEN           6
44536 +#define NVRAM_MAC_COUNT_MAX             32
44537 +
44538 +/*****************************************************************************/
44539 +/*       Misc Offsets                                                        */
44540 +/*****************************************************************************/
44541 +
44542 +#define CFE_VERSION_OFFSET           0x0570
44543 +#define CFE_VERSION_MARK_SIZE        5
44544 +#define CFE_VERSION_SIZE             5
44545 +
44546 +typedef struct
44547 +{
44548 +    unsigned long ulVersion;
44549 +    char szBootline[NVRAM_BOOTLINE_LEN];
44550 +    char szBoardId[NVRAM_BOARD_ID_STRING_LEN];
44551 +    unsigned long ulReserved1[2];
44552 +    unsigned long ulNumMacAddrs;
44553 +    unsigned char ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
44554 +    char chReserved[2];
44555 +    unsigned long ulCheckSum;
44556 +} NVRAM_DATA, *PNVRAM_DATA;
44557 +
44558 +
44559 +/*****************************************************************************/
44560 +/*          board ioctl calls for flash, led and some other utilities        */
44561 +/*****************************************************************************/
44562 +
44563 +
44564 +/* Defines. for board driver */
44565 +#define BOARD_IOCTL_MAGIC       'B'
44566 +#define BOARD_DRV_MAJOR          206
44567 +
44568 +#define MAC_ADDRESS_ANY         (unsigned long) -1
44569 +
44570 +#define BOARD_IOCTL_FLASH_INIT \
44571 +    _IOWR(BOARD_IOCTL_MAGIC, 0, BOARD_IOCTL_PARMS)
44572 +
44573 +#define BOARD_IOCTL_FLASH_WRITE \
44574 +    _IOWR(BOARD_IOCTL_MAGIC, 1, BOARD_IOCTL_PARMS)
44575 +
44576 +#define BOARD_IOCTL_FLASH_READ \
44577 +    _IOWR(BOARD_IOCTL_MAGIC, 2, BOARD_IOCTL_PARMS)
44578 +
44579 +#define BOARD_IOCTL_GET_NR_PAGES \
44580 +    _IOWR(BOARD_IOCTL_MAGIC, 3, BOARD_IOCTL_PARMS)
44581 +
44582 +#define BOARD_IOCTL_DUMP_ADDR \
44583 +    _IOWR(BOARD_IOCTL_MAGIC, 4, BOARD_IOCTL_PARMS)
44584 +
44585 +#define BOARD_IOCTL_SET_MEMORY \
44586 +    _IOWR(BOARD_IOCTL_MAGIC, 5, BOARD_IOCTL_PARMS)
44587 +
44588 +#define BOARD_IOCTL_MIPS_SOFT_RESET \
44589 +    _IOWR(BOARD_IOCTL_MAGIC, 6, BOARD_IOCTL_PARMS)
44590 +
44591 +#define BOARD_IOCTL_LED_CTRL \
44592 +    _IOWR(BOARD_IOCTL_MAGIC, 7, BOARD_IOCTL_PARMS)
44593 +
44594 +#define BOARD_IOCTL_GET_ID \
44595 +    _IOWR(BOARD_IOCTL_MAGIC, 8, BOARD_IOCTL_PARMS)
44596 +
44597 +#define BOARD_IOCTL_GET_MAC_ADDRESS \
44598 +    _IOWR(BOARD_IOCTL_MAGIC, 9, BOARD_IOCTL_PARMS)
44599 +
44600 +#define BOARD_IOCTL_RELEASE_MAC_ADDRESS \
44601 +    _IOWR(BOARD_IOCTL_MAGIC, 10, BOARD_IOCTL_PARMS)
44602 +
44603 +#define BOARD_IOCTL_GET_PSI_SIZE \
44604 +    _IOWR(BOARD_IOCTL_MAGIC, 11, BOARD_IOCTL_PARMS)
44605 +
44606 +#define BOARD_IOCTL_GET_SDRAM_SIZE \
44607 +    _IOWR(BOARD_IOCTL_MAGIC, 12, BOARD_IOCTL_PARMS)
44608 +
44609 +#define BOARD_IOCTL_SET_MONITOR_FD \
44610 +    _IOWR(BOARD_IOCTL_MAGIC, 13, BOARD_IOCTL_PARMS)
44611 +    
44612 +#define BOARD_IOCTL_WAKEUP_MONITOR_TASK \
44613 +    _IOWR(BOARD_IOCTL_MAGIC, 14, BOARD_IOCTL_PARMS)
44614 +
44615 +#define BOARD_IOCTL_GET_BOOTLINE \
44616 +    _IOWR(BOARD_IOCTL_MAGIC, 15, BOARD_IOCTL_PARMS)
44617 +
44618 +#define BOARD_IOCTL_SET_BOOTLINE \
44619 +    _IOWR(BOARD_IOCTL_MAGIC, 16, BOARD_IOCTL_PARMS)
44620 +
44621 +#define BOARD_IOCTL_GET_BASE_MAC_ADDRESS \
44622 +    _IOWR(BOARD_IOCTL_MAGIC, 17, BOARD_IOCTL_PARMS)
44623 +
44624 +#define BOARD_IOCTL_GET_CHIP_ID \
44625 +    _IOWR(BOARD_IOCTL_MAGIC, 18, BOARD_IOCTL_PARMS)
44626 +
44627 +#define BOARD_IOCTL_GET_NUM_ENET \
44628 +    _IOWR(BOARD_IOCTL_MAGIC, 19, BOARD_IOCTL_PARMS)
44629 +
44630 +#define BOARD_IOCTL_GET_CFE_VER \
44631 +    _IOWR(BOARD_IOCTL_MAGIC, 20, BOARD_IOCTL_PARMS)
44632 +
44633 +#define BOARD_IOCTL_GET_ENET_CFG \
44634 +    _IOWR(BOARD_IOCTL_MAGIC, 21, BOARD_IOCTL_PARMS)
44635 +
44636 +#define BOARD_IOCTL_GET_WLAN_ANT_INUSE \
44637 +    _IOWR(BOARD_IOCTL_MAGIC, 22, BOARD_IOCTL_PARMS)
44638 +    
44639 +#define BOARD_IOCTL_SET_TRIGGER_EVENT \
44640 +    _IOWR(BOARD_IOCTL_MAGIC, 23, BOARD_IOCTL_PARMS)        
44641 +
44642 +#define BOARD_IOCTL_GET_TRIGGER_EVENT \
44643 +    _IOWR(BOARD_IOCTL_MAGIC, 24, BOARD_IOCTL_PARMS)        
44644 +
44645 +#define BOARD_IOCTL_UNSET_TRIGGER_EVENT \
44646 +    _IOWR(BOARD_IOCTL_MAGIC, 25, BOARD_IOCTL_PARMS) 
44647 +
44648 +#define BOARD_IOCTL_SET_SES_LED \
44649 +    _IOWR(BOARD_IOCTL_MAGIC, 26, BOARD_IOCTL_PARMS)
44650 +    
44651 +    
44652 +// for the action in BOARD_IOCTL_PARMS for flash operation
44653 +typedef enum 
44654 +{
44655 +    PERSISTENT,
44656 +    NVRAM,
44657 +    BCM_IMAGE_CFE,
44658 +    BCM_IMAGE_FS,
44659 +    BCM_IMAGE_KERNEL,
44660 +    BCM_IMAGE_WHOLE,
44661 +    SCRATCH_PAD,
44662 +    FLASH_SIZE,
44663 +} BOARD_IOCTL_ACTION;
44664 +    
44665 +    
44666 +typedef struct boardIoctParms
44667 +{
44668 +    char *string;
44669 +    char *buf;
44670 +    int strLen;
44671 +    int offset;
44672 +    BOARD_IOCTL_ACTION  action;        /* flash read/write: nvram, persistent, bcm image */
44673 +    int result;
44674 +} BOARD_IOCTL_PARMS;
44675 +
44676 +
44677 +// LED defines 
44678 +typedef enum
44679 +{   
44680 +    kLedAdsl,
44681 +    kLedWireless,
44682 +    kLedUsb,
44683 +    kLedHpna,
44684 +    kLedWanData,
44685 +    kLedPPP,
44686 +    kLedVoip,
44687 +    kLedSes,
44688 +    kLedEnd,                // NOTE: Insert the new led name before this one.  Alway stay at the end.
44689 +} BOARD_LED_NAME;
44690 +
44691 +typedef enum
44692 +{
44693 +    kLedStateOff,                        /* turn led off */
44694 +    kLedStateOn,                         /* turn led on */
44695 +    kLedStateFail,                       /* turn led on red */
44696 +    kLedStateBlinkOnce,                  /* blink once, ~100ms and ignore the same call during the 100ms period */
44697 +    kLedStateSlowBlinkContinues,         /* slow blink continues at ~600ms interval */
44698 +    kLedStateFastBlinkContinues,         /* fast blink continues at ~200ms interval */
44699 +} BOARD_LED_STATE;
44700 +
44701 +
44702 +// virtual and physical map pair defined in board.c
44703 +typedef struct ledmappair
44704 +{
44705 +    BOARD_LED_NAME ledName;         // virtual led name
44706 +    BOARD_LED_STATE ledInitState;   // initial led state when the board boots.
44707 +    unsigned short ledMask;         // physical GPIO pin mask
44708 +    unsigned short ledActiveLow;    // reset bit to turn on LED
44709 +    unsigned short ledMaskFail;     // physical GPIO pin mask for state failure
44710 +    unsigned short ledActiveLowFail;// reset bit to turn on LED
44711 +} LED_MAP_PAIR, *PLED_MAP_PAIR;
44712 +
44713 +typedef void (*HANDLE_LED_FUNC)(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState);
44714 +
44715 +/* Flash storage address information that is determined by the flash driver. */
44716 +typedef struct flashaddrinfo
44717 +{
44718 +    int flash_persistent_start_blk;
44719 +    int flash_persistent_number_blk;
44720 +    int flash_persistent_length;
44721 +    unsigned long flash_persistent_blk_offset;
44722 +    int flash_scratch_pad_start_blk;         // start before psi (SP_BUF_LEN)
44723 +    int flash_scratch_pad_number_blk;
44724 +    int flash_scratch_pad_length;
44725 +    unsigned long flash_scratch_pad_blk_offset;
44726 +    int flash_nvram_start_blk;
44727 +    int flash_nvram_number_blk;
44728 +    int flash_nvram_length;
44729 +    unsigned long flash_nvram_blk_offset;
44730 +} FLASH_ADDR_INFO, *PFLASH_ADDR_INFO;
44731 +
44732 +// scratch pad defines
44733 +/* SP - Persisten Scratch Pad format:
44734 +       sp header        : 32 bytes
44735 +       tokenId-1        : 8 bytes
44736 +       tokenId-1 len    : 4 bytes
44737 +       tokenId-1 data    
44738 +       ....
44739 +       tokenId-n        : 8 bytes
44740 +       tokenId-n len    : 4 bytes
44741 +       tokenId-n data    
44742 +*/
44743 +
44744 +#define MAGIC_NUM_LEN       8
44745 +#define MAGIC_NUMBER        "gOGoBrCm"
44746 +#define TOKEN_NAME_LEN      16
44747 +#define SP_VERSION          1
44748 +#define SP_MAX_LEN          8 * 1024            // 8k buf before psi
44749 +#define SP_RESERVERD        16
44750 +
44751 +typedef struct _SP_HEADER
44752 +{
44753 +    char SPMagicNum[MAGIC_NUM_LEN];             // 8 bytes of magic number
44754 +    int SPVersion;                              // version number
44755 +    int SPUsedLen;                              // used sp len   
44756 +    char SPReserved[SP_RESERVERD];              // reservied, total 32 bytes
44757 +} SP_HEADER, *PSP_HEADER;
44758 +
44759 +typedef struct _TOKEN_DEF
44760 +{
44761 +    char tokenName[TOKEN_NAME_LEN];
44762 +    int tokenLen;
44763 +} SP_TOKEN, *PSP_TOKEN;
44764 +
44765 +
44766 +/*****************************************************************************/
44767 +/*          Function Prototypes                                              */
44768 +/*****************************************************************************/
44769 +#if !defined(__ASM_ASM_H)
44770 +void dumpaddr( unsigned char *pAddr, int nLen );
44771 +
44772 +void kerSysFlashAddrInfoGet(PFLASH_ADDR_INFO pflash_addr_info);
44773 +int kerSysNvRamGet(char *string, int strLen, int offset);
44774 +int kerSysNvRamSet(char *string, int strLen, int offset);
44775 +int kerSysPersistentGet(char *string, int strLen, int offset);
44776 +int kerSysPersistentSet(char *string, int strLen, int offset);
44777 +int kerSysScratchPadGet(char *tokName, char *tokBuf, int tokLen);
44778 +int kerSysScratchPadSet(char *tokName, char *tokBuf, int tokLen);
44779 +int kerSysBcmImageSet( int flash_start_addr, char *string, int size);
44780 +int kerSysGetMacAddress( unsigned char *pucaAddr, unsigned long ulId );
44781 +int kerSysReleaseMacAddress( unsigned char *pucaAddr );
44782 +int kerSysGetSdramSize( void );
44783 +void kerSysGetBootline(char *string, int strLen);
44784 +void kerSysSetBootline(char *string, int strLen);
44785 +void kerSysMipsSoftReset(void);
44786 +void kerSysLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
44787 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME, HANDLE_LED_FUNC, int );
44788 +int kerSysFlashSizeGet(void);
44789 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context);
44790 +void kerSysDeregisterDyingGaspHandler(char *devname);    
44791 +void kerSysWakeupMonitorTask( void );
44792 +#endif
44793 +
44794 +#if __cplusplus
44795 +}
44796 +#endif
44797 +
44798 +#endif /* _BOARD_H */
44799 +
44800 diff -urN linux-2.6.8.1/boardparams/bcm963xx/Makefile linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/Makefile
44801 --- linux-2.6.8.1/boardparams/bcm963xx/Makefile 1970-01-01 01:00:00.000000000 +0100
44802 +++ linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/Makefile 2006-06-26 09:07:10.000000000 +0200
44803 @@ -0,0 +1,16 @@
44804 +
44805 +ifeq ($(CONFIG_MIPS_BRCM),y)
44806 +
44807 +# Linux
44808 +obj-y          += boardparms.o
44809 +EXTRA_CFLAGS += -DCONFIG_BCM9$(BRCM_CHIP)
44810 +-include $(TOPDIR)/Rules.make
44811 +
44812 +else
44813 +
44814 +# CFE
44815 +BSPOBJS += boardparms.o
44816 +
44817 +endif
44818 +
44819 +
44820 diff -urN linux-2.6.8.1/boardparams/bcm963xx/boardparms.c linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/boardparms.c
44821 --- linux-2.6.8.1/boardparams/bcm963xx/boardparms.c     1970-01-01 01:00:00.000000000 +0100
44822 +++ linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/boardparms.c     2006-06-26 09:07:10.000000000 +0200
44823 @@ -0,0 +1,2382 @@
44824 +/*
44825 +<:copyright-gpl 
44826 +
44827 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
44828
44829 + This program is free software; you can distribute it and/or modify it 
44830 + under the terms of the GNU General Public License (Version 2) as 
44831 + published by the Free Software Foundation. 
44832
44833 + This program is distributed in the hope it will be useful, but WITHOUT 
44834 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
44835 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
44836 + for more details. 
44837
44838 + You should have received a copy of the GNU General Public License along 
44839 + with this program; if not, write to the Free Software Foundation, Inc., 
44840 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
44841 +
44842 +:>
44843 +*/
44844 +/**************************************************************************
44845 + * File Name  : boardparms.c
44846 + *
44847 + * Description: This file contains the implementation for the BCM63xx board
44848 + *              parameter access functions.
44849 + * 
44850 + * Updates    : 07/14/2003  Created.
44851 + ***************************************************************************/
44852 +
44853 +/* Includes. */
44854 +#include "boardparms.h"
44855 +
44856 +/* Defines. */
44857 +
44858 +/* Default psi size in K bytes */
44859 +#define BP_PSI_DEFAULT_SIZE                     24   
44860 +
44861 +/* Typedefs */
44862 +typedef struct boardparameters
44863 +{
44864 +    char szBoardId[BP_BOARD_ID_LEN];        /* board id string */
44865 +    ETHERNET_MAC_INFO EnetMacInfos[BP_MAX_ENET_MACS];
44866 +    VOIP_DSP_INFO VoIPDspInfo[BP_MAX_VOIP_DSP];
44867 +    unsigned short usSdramSize;             /* SDRAM size and type */
44868 +    unsigned short usPsiSize;               /* persistent storage in K bytes */
44869 +    unsigned short usGpioRj11InnerPair;     /* GPIO pin or not defined */
44870 +    unsigned short usGpioRj11OuterPair;     /* GPIO pin or not defined */
44871 +    unsigned short usGpioPressAndHoldReset; /* GPIO pin or not defined */
44872 +    unsigned short usGpioPcmciaReset;       /* GPIO pin or not defined */
44873 +    unsigned short usGpioUartRts;           /* GPIO pin or not defined */
44874 +    unsigned short usGpioUartCts;           /* GPIO pin or not defined */
44875 +    unsigned short usGpioLedAdsl;           /* GPIO pin or not defined */
44876 +    unsigned short usGpioLedAdslFail;       /* GPIO pin or not defined */
44877 +    unsigned short usGpioLedWireless;       /* GPIO pin or not defined */
44878 +    unsigned short usGpioLedUsb;            /* GPIO pin or not defined */
44879 +    unsigned short usGpioLedHpna;           /* GPIO pin or not defined */
44880 +    unsigned short usGpioLedWanData;        /* GPIO pin or not defined */
44881 +    unsigned short usGpioLedPpp;            /* GPIO pin or not defined */
44882 +    unsigned short usGpioLedPppFail;        /* GPIO pin or not defined */
44883 +    unsigned short usGpioLedBlPowerOn;      /* GPIO pin or not defined */
44884 +    unsigned short usGpioLedBlAlarm;        /* GPIO pin or not defined */
44885 +    unsigned short usGpioLedBlResetCfg;     /* GPIO pin or not defined */
44886 +    unsigned short usGpioLedBlStop;         /* GPIO pin or not defined */
44887 +    unsigned short usExtIntrWireless;       /* ext intr or not defined */
44888 +    unsigned short usExtIntrAdslDyingGasp;  /* ext intr or not defined */
44889 +    unsigned short usExtIntrHpna;           /* ext intr or not defined */
44890 +    unsigned short usCsHpna;                /* chip select not defined */
44891 +    unsigned short usAntInUseWireless;     /* antenna in use or not defined */
44892 +    unsigned short usGpioSesBtnWireless;    /* GPIO pin or not defined */
44893 +    unsigned short usExtIntrSesBtnWireless; /* ext intr or not defined */        
44894 +    unsigned short usGpioLedSesWireless;    /* GPIO pin or not defined */        
44895 +} BOARD_PARAMETERS, *PBOARD_PARAMETERS;
44896 +
44897 +/* Variables */
44898 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
44899 +static BOARD_PARAMETERS g_bcm96338sv =
44900 +{
44901 +    "96338SV",                               /* szBoardId */
44902 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
44903 +      0x01,                                 /* ucPhyAddress */
44904 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
44905 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
44906 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
44907 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
44908 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
44909 +      0x01,                                 /* numSwitchPorts */
44910 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
44911 +      BP_NOT_DEFINED},                      /* usReverseMii */
44912 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
44913 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
44914 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
44915 +    BP_MEMORY_16MB_1_CHIP,                  /* usSdramSize */
44916 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
44917 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
44918 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
44919 +    BP_NOT_DEFINED,                         /* usGpioPressAndHoldReset */
44920 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
44921 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
44922 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
44923 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
44924 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
44925 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
44926 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
44927 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
44928 +    BP_NOT_DEFINED,                         /* usGpioLedWanData */
44929 +    BP_NOT_DEFINED,                         /* usGpioLedPpp */
44930 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
44931 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
44932 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
44933 +    BP_NOT_DEFINED,                         /* usGpioLedBlResetCfg */
44934 +    BP_NOT_DEFINED,                         /* usGpioLedBlStop */
44935 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
44936 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
44937 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
44938 +    BP_NOT_DEFINED,                         /* usCsHpna */
44939 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
44940 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
44941 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
44942 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */     
44943 +};
44944 +static BOARD_PARAMETERS g_bcm96338l2m8m =
44945 +{
44946 +    "96338L-2M-8M",                         /* szBoardId */
44947 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
44948 +      0x01,                                 /* ucPhyAddress */
44949 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
44950 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
44951 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
44952 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
44953 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
44954 +      0x01,                                 /* numSwitchPorts */
44955 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
44956 +      BP_NOT_DEFINED},                      /* usReverseMii */
44957 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
44958 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
44959 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
44960 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
44961 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
44962 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
44963 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
44964 +    BP_NOT_DEFINED,                         /* usGpioPressAndHoldReset */
44965 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
44966 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
44967 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
44968 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
44969 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
44970 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
44971 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
44972 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
44973 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
44974 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
44975 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
44976 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
44977 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
44978 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
44979 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
44980 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
44981 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
44982 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
44983 +    BP_NOT_DEFINED,                         /* usCsHpna */
44984 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
44985 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */    
44986 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
44987 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */         
44988 +};
44989 +static PBOARD_PARAMETERS g_BoardParms[] =
44990 +    {&g_bcm96338sv, &g_bcm96338l2m8m, 0};
44991 +#endif
44992 +
44993 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
44994 +static BOARD_PARAMETERS g_bcm96345r =
44995 +{
44996 +    "96345R",                               /* szBoardId */
44997 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
44998 +      0x01,                                 /* ucPhyAddress */
44999 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45000 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45001 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45002 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45003 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45004 +      0x01,                                 /* numSwitchPorts */
45005 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45006 +      BP_NOT_DEFINED},                      /* usReverseMii */
45007 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45008 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45009 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45010 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
45011 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45012 +    BP_GPIO_11_AH,                          /* usGpioRj11InnerPair */
45013 +    BP_GPIO_12_AH,                          /* usGpioRj11OuterPair */
45014 +    BP_GPIO_13_AH,                          /* usGpioPressAndHoldReset */
45015 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45016 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45017 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45018 +    BP_GPIO_8_AH,                           /* usGpioLedAdsl */
45019 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45020 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45021 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45022 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45023 +    BP_GPIO_8_AH,                           /* usGpioLedWanData */
45024 +    BP_GPIO_9_AH,                           /* usGpioLedPpp */
45025 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45026 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45027 +    BP_GPIO_10_AH,                          /* usGpioLedBlAlarm */
45028 +    BP_GPIO_9_AH,                           /* usGpioLedBlResetCfg */
45029 +    BP_GPIO_8_AH,                           /* usGpioLedBlStop */
45030 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45031 +    BP_EXT_INTR_0,                          /* usExtIntrAdslDyingGasp */
45032 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45033 +    BP_NOT_DEFINED,                         /* usCsHpna */
45034 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45035 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45036 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45037 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45038 +};
45039 +
45040 +static BOARD_PARAMETERS g_bcm96345gw2 =
45041 +{
45042 +    /* A hardware jumper determines whether GPIO 13 is used for Press and Hold
45043 +     * Reset or RTS.
45044 +     */
45045 +    "96345GW2",                             /* szBoardId */
45046 +    {{BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45047 +      0x00,                                 /* ucPhyAddress */
45048 +      BP_GPIO_0_AH,                         /* usGpioPhySpiSck */
45049 +      BP_GPIO_4_AH,                         /* usGpioPhySpiSs */
45050 +      BP_GPIO_12_AH,                        /* usGpioPhySpiMosi */
45051 +      BP_GPIO_11_AH,                        /* usGpioPhySpiMiso */
45052 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45053 +      0x04,                                 /* numSwitchPorts */
45054 +      BP_ENET_CONFIG_GPIO,                  /* usConfigType */
45055 +      BP_ENET_REVERSE_MII},                 /* usReverseMii */
45056 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45057 +    {{BP_VOIP_DSP,                          /* ucDspType */
45058 +      0x00,                                 /* ucDspAddress */
45059 +      BP_EXT_INTR_1,                        /* usExtIntrVoip */
45060 +      BP_GPIO_6_AH,                         /* usGpioVoipReset */
45061 +      BP_GPIO_15_AH,                        /* usGpioVoipIntr */
45062 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45063 +      BP_CS_2},                             /* usCsVoip */
45064 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45065 +    BP_MEMORY_16MB_1_CHIP,                  /* usSdramSize */
45066 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45067 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45068 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45069 +    BP_GPIO_13_AH,                          /* usGpioPressAndHoldReset */
45070 +    BP_GPIO_2_AH,                           /* usGpioPcmciaReset */
45071 +    BP_GPIO_13_AH,                          /* usGpioUartRts */
45072 +    BP_GPIO_9_AH,                           /* usGpioUartCts */
45073 +    BP_GPIO_8_AH,                           /* usGpioLedAdsl */
45074 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45075 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45076 +    BP_GPIO_7_AH,                           /* usGpioLedUsb */
45077 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45078 +    BP_GPIO_8_AH,                           /* usGpioLedWanData */
45079 +    BP_NOT_DEFINED,                         /* usGpioLedPpp */
45080 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45081 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45082 +    BP_GPIO_10_AH,                          /* usGpioLedBlAlarm */
45083 +    BP_GPIO_7_AH,                           /* usGpioLedBlResetCfg */
45084 +    BP_GPIO_8_AH,                           /* usGpioLedBlStop */
45085 +    BP_EXT_INTR_2,                          /* usExtIntrWireless */
45086 +    BP_EXT_INTR_0,                          /* usExtIntrAdslDyingGasp */
45087 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45088 +    BP_NOT_DEFINED,                         /* usCsHpna */
45089 +    BP_WLAN_ANT_MAIN,                       /* usAntInUseWireless */
45090 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45091 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45092 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */    
45093 +};
45094 +
45095 +static BOARD_PARAMETERS g_bcm96345gw =
45096 +{
45097 +    "96345GW",                              /* szBoardId */
45098 +    {{BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45099 +      0x00,                                 /* ucPhyAddress */
45100 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45101 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45102 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45103 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45104 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45105 +      0x04,                                 /* numSwitchPorts */
45106 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45107 +      BP_ENET_NO_REVERSE_MII},              /* usReverseMii */
45108 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45109 +    {{BP_VOIP_DSP,                          /* ucDspType */
45110 +      0x00,                                 /* ucDspAddress */
45111 +      BP_EXT_INTR_1,                        /* usExtIntrVoip */
45112 +      BP_GPIO_6_AH,                         /* usGpioVoipReset */
45113 +      BP_GPIO_15_AH,                        /* usGpioVoipIntr */
45114 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45115 +      BP_CS_2},                             /* usCsVoip */
45116 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45117 +    BP_MEMORY_16MB_1_CHIP,                  /* usSdramSize */
45118 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45119 +    BP_GPIO_11_AH,                          /* usGpioRj11InnerPair */
45120 +    BP_GPIO_1_AH,                           /* usGpioRj11OuterPair */
45121 +    BP_GPIO_13_AH,                          /* usGpioPressAndHoldReset */
45122 +    BP_GPIO_2_AH,                           /* usGpioPcmciaReset */
45123 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45124 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45125 +    BP_GPIO_8_AH,                           /* usGpioLedAdsl */
45126 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45127 +    BP_GPIO_10_AH,                          /* usGpioLedWireless */
45128 +    BP_GPIO_7_AH,                           /* usGpioLedUsb */
45129 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45130 +    BP_GPIO_8_AH,                           /* usGpioLedWanData */
45131 +    BP_NOT_DEFINED,                         /* usGpioLedPpp */
45132 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45133 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45134 +    BP_GPIO_9_AH,                           /* usGpioLedBlAlarm */
45135 +    BP_GPIO_10_AH,                          /* usGpioLedBlResetCfg */
45136 +    BP_GPIO_8_AH,                           /* usGpioLedBlStop */
45137 +    BP_EXT_INTR_2,                          /* usExtIntrWireless */
45138 +    BP_EXT_INTR_0,                          /* usExtIntrAdslDyingGasp */
45139 +    BP_EXT_INTR_3,                          /* usExtIntrHpna */
45140 +    BP_CS_1,                                /* usCsHpna */
45141 +    BP_WLAN_ANT_MAIN,                       /* usAntInUseWireless */
45142 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45143 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45144 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45145 +};
45146 +
45147 +static BOARD_PARAMETERS g_bcm96335r =
45148 +{
45149 +    "96335R",                               /* szBoardId */
45150 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45151 +      0x01,                                 /* ucPhyAddress */
45152 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45153 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45154 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45155 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45156 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45157 +      0x01,                                 /* numSwitchPorts */
45158 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45159 +      BP_NOT_DEFINED},                      /* usReverseMii */
45160 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45161 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45162 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45163 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
45164 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45165 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45166 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45167 +    BP_GPIO_14_AH,                          /* usGpioPressAndHoldReset */
45168 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45169 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45170 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45171 +    BP_GPIO_9_AH,                           /* usGpioLedAdsl */
45172 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45173 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45174 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45175 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45176 +    BP_GPIO_9_AH,                           /* usGpioLedWanData */
45177 +    BP_GPIO_8_AH,                           /* usGpioLedPpp */
45178 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45179 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45180 +    BP_GPIO_10_AH,                          /* usGpioLedBlAlarm */
45181 +    BP_GPIO_8_AH,                           /* usGpioLedBlResetCfg */
45182 +    BP_GPIO_9_AH,                           /* usGpioLedBlStop */
45183 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45184 +    BP_NOT_DEFINED,                         /* usExtIntrAdslDyingGasp */
45185 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45186 +    BP_NOT_DEFINED,                         /* usCsHpna */
45187 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45188 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45189 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45190 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45191 +};
45192 +
45193 +static BOARD_PARAMETERS g_bcm96345r0 =
45194 +{
45195 +    "96345R0",                              /* szBoardId */
45196 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45197 +      0x01,                                 /* ucPhyAddress */
45198 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45199 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45200 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45201 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45202 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45203 +      0x01,                                 /* numSwitchPorts */
45204 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45205 +      BP_NOT_DEFINED},                      /* usReverseMii */
45206 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45207 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45208 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45209 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
45210 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45211 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45212 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45213 +    BP_NOT_DEFINED,                         /* usGpioPressAndHoldReset */
45214 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45215 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45216 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45217 +    BP_GPIO_8_AH,                           /* usGpioLedAdsl */
45218 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45219 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45220 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45221 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45222 +    BP_GPIO_9_AH,                           /* usGpioLedWanData */
45223 +    BP_GPIO_9_AH,                           /* usGpioLedPpp */
45224 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45225 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45226 +    BP_GPIO_9_AH,                           /* usGpioLedBlAlarm */
45227 +    BP_GPIO_8_AH,                           /* usGpioLedBlResetCfg */
45228 +    BP_GPIO_8_AH,                           /* usGpioLedBlStop */
45229 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45230 +    BP_NOT_DEFINED,                         /* usExtIntrAdslDyingGasp */
45231 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45232 +    BP_NOT_DEFINED,                         /* usCsHpna */
45233 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45234 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */     
45235 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45236 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */    
45237 +};
45238 +
45239 +static BOARD_PARAMETERS g_bcm96345rs =
45240 +{
45241 +    "96345RS",                              /* szBoardId */
45242 +    {{BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45243 +      0x00,                                 /* ucPhyAddress */
45244 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45245 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45246 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45247 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45248 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45249 +      0x01,                                 /* numSwitchPorts */
45250 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45251 +      BP_ENET_NO_REVERSE_MII},              /* usReverseMii */
45252 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45253 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45254 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45255 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
45256 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45257 +    BP_GPIO_11_AH,                          /* usGpioRj11InnerPair */
45258 +    BP_GPIO_12_AH,                          /* usGpioRj11OuterPair */
45259 +    BP_GPIO_13_AH,                          /* usGpioPressAndHoldReset */
45260 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45261 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45262 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45263 +    BP_GPIO_8_AH,                           /* usGpioLedAdsl */
45264 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45265 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45266 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45267 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45268 +    BP_GPIO_8_AH,                           /* usGpioLedWanData */
45269 +    BP_GPIO_9_AH,                           /* usGpioLedPpp */
45270 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45271 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45272 +    BP_GPIO_10_AH,                          /* usGpioLedBlAlarm */
45273 +    BP_GPIO_9_AH,                           /* usGpioLedBlResetCfg */
45274 +    BP_GPIO_8_AH,                           /* usGpioLedBlStop */
45275 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45276 +    BP_EXT_INTR_0,                          /* usExtIntrAdslDyingGasp */
45277 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45278 +    BP_NOT_DEFINED,                         /* usCsHpna */
45279 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45280 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45281 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45282 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45283 +};
45284 +
45285 +static PBOARD_PARAMETERS g_BoardParms[] =
45286 +    {&g_bcm96345r, &g_bcm96345gw2, &g_bcm96345gw, &g_bcm96335r, &g_bcm96345r0,
45287 +     &g_bcm96345rs, 0};
45288 +#endif
45289 +
45290 +#if defined(_BCM96348_) || defined(CONFIG_BCM96348)
45291 +
45292 +static BOARD_PARAMETERS g_bcm96348r =
45293 +{
45294 +    "96348R",                               /* szBoardId */
45295 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45296 +      0x01,                                 /* ucPhyAddress */
45297 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45298 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45299 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45300 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45301 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45302 +      0x01,                                 /* numSwitchPorts */
45303 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45304 +      BP_NOT_DEFINED},                      /* usReverseMii */
45305 +     {BP_ENET_NO_PHY}},                     /* ucPhyType */
45306 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45307 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45308 +    BP_MEMORY_8MB_1_CHIP,                   /* usSdramSize */
45309 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45310 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45311 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45312 +    BP_GPIO_7_AH,                           /* usGpioPressAndHoldReset */
45313 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45314 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45315 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45316 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45317 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45318 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45319 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45320 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45321 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45322 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45323 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45324 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45325 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45326 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45327 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45328 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45329 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45330 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45331 +    BP_NOT_DEFINED,                         /* usCsHpna */
45332 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45333 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45334 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45335 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */    
45336 +};
45337 +
45338 +static BOARD_PARAMETERS g_bcm96348lv =
45339 +{
45340 +    "96348LV",                               /* szBoardId */
45341 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45342 +      0x01,                                 /* ucPhyAddress */
45343 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45344 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45345 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45346 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45347 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45348 +      0x01,                                 /* numSwitchPorts */
45349 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45350 +      BP_NOT_DEFINED},                      /* usReverseMii */
45351 +     {BP_ENET_EXTERNAL_PHY,                 /* ucPhyType */
45352 +      0x02,                                 /* ucPhyAddress */
45353 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45354 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45355 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45356 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45357 +      BP_GPIO_5_AL,                         /* usGpioPhyReset */
45358 +      0x01,                                 /* numSwitchPorts */
45359 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45360 +      BP_NOT_DEFINED}},                     /* usReverseMii */
45361 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45362 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45363 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45364 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45365 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45366 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45367 +    BP_GPIO_7_AH,                           /* usGpioPressAndHoldReset */
45368 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45369 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45370 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45371 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45372 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45373 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45374 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45375 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45376 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45377 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45378 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45379 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45380 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45381 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45382 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45383 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45384 +    BP_NOT_DEFINED,                         /* usExtIntrAdslDyingGasp */
45385 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45386 +    BP_NOT_DEFINED,                         /* usCsHpna */
45387 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45388 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45389 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45390 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45391 +};
45392 +
45393 +static BOARD_PARAMETERS g_bcm96348gw =
45394 +{
45395 +    "96348GW",                              /* szBoardId */
45396 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45397 +      0x01,                                 /* ucPhyAddress */
45398 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45399 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45400 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45401 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45402 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45403 +      0x01,                                 /* numSwitchPorts */
45404 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45405 +      BP_NOT_DEFINED},                      /* usReverseMii */
45406 +     {BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45407 +      0x00,                                 /* ucPhyAddress */
45408 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45409 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45410 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45411 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45412 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45413 +      0x03,                                 /* numSwitchPorts */
45414 +      BP_ENET_CONFIG_SPI_SSB_0,             /* usConfigType */
45415 +      BP_ENET_REVERSE_MII}},                /* usReverseMii */
45416 +    {{BP_VOIP_DSP,                          /* ucDspType */
45417 +      0x00,                                 /* ucDspAddress */
45418 +      BP_EXT_INTR_2,                        /* usExtIntrVoip */
45419 +      BP_GPIO_6_AH,                         /* usGpioVoipReset */
45420 +      BP_GPIO_34_AH,                        /* usGpioVoipIntr */
45421 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45422 +      BP_CS_2},                             /* usCsVoip */
45423 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45424 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45425 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45426 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45427 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45428 +    BP_GPIO_33_AL,                          /* usGpioPressAndHoldReset */
45429 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45430 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45431 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45432 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45433 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45434 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45435 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45436 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45437 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45438 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45439 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45440 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45441 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45442 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45443 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45444 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45445 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45446 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45447 +    BP_NOT_DEFINED,                         /* usCsHpna */
45448 +    BP_WLAN_ANT_MAIN,                       /* usAntInUseWireless */
45449 +    BP_NOT_DEFINED, /* BP_GPIO_35_AH, */    /* usGpioSesBtnWireless */
45450 +    BP_NOT_DEFINED, /* BP_EXT_INTR_3, */    /* usExtIntrSesBtnWireless */
45451 +    BP_NOT_DEFINED  /* BP_GPIO_0_AL   */    /* usGpioLedSesWireless */
45452 +};
45453 +
45454 +
45455 +static BOARD_PARAMETERS g_bcm96348gw_10 =
45456 +{
45457 +    "96348GW-10",                           /* szBoardId */
45458 +    {{BP_ENET_NO_PHY},                 /* ucPhyType */
45459 +     {BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45460 +      0x00,                                 /* ucPhyAddress */
45461 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45462 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45463 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45464 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45465 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45466 +      0x04,                                 /* numSwitchPorts */
45467 +      BP_ENET_CONFIG_SPI_SSB_1,             /* usConfigType */
45468 +      BP_ENET_REVERSE_MII}},                /* usReverseMii */
45469 +    {{BP_VOIP_DSP,                          /* ucDspType */
45470 +      0x00,                                 /* ucDspAddress */
45471 +      BP_EXT_INTR_2,                        /* usExtIntrVoip */
45472 +      BP_GPIO_6_AH,                         /* usGpioVoipReset */
45473 +      BP_GPIO_34_AH,                        /* usGpioVoipIntr */
45474 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45475 +      BP_CS_2},                             /* usCsVoip */
45476 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45477 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45478 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45479 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45480 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45481 +    BP_GPIO_33_AL,                          /* usGpioPressAndHoldReset */
45482 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45483 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45484 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45485 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45486 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45487 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45488 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45489 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45490 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45491 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45492 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45493 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45494 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45495 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45496 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45497 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45498 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45499 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45500 +    BP_NOT_DEFINED,                         /* usCsHpna */
45501 +    BP_WLAN_ANT_MAIN,                       /* usAntInUseWireless */
45502 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45503 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45504 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45505 +};
45506 +
45507 +static BOARD_PARAMETERS g_bcm96348gw_11 =
45508 +{
45509 +    "96348GW-11",                           /* szBoardId */
45510 +    {{BP_ENET_NO_PHY},                      /* ucPhyType */
45511 +     {BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45512 +      0x00,                                 /* ucPhyAddress */
45513 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45514 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45515 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45516 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45517 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45518 +      0x04,                                 /* numSwitchPorts */
45519 +      BP_ENET_CONFIG_SPI_SSB_1,             /* usConfigType */
45520 +      BP_ENET_REVERSE_MII}},                /* usReverseMii */
45521 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45522 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45523 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45524 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45525 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45526 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45527 +    BP_GPIO_33_AL,                          /* usGpioPressAndHoldReset */
45528 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45529 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45530 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45531 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45532 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45533 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45534 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45535 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45536 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45537 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45538 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45539 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45540 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45541 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45542 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45543 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45544 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45545 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45546 +    BP_NOT_DEFINED,                         /* usCsHpna */
45547 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45548 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45549 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45550 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */    
45551 +};
45552 +
45553 +static BOARD_PARAMETERS g_bcm96348sv =
45554 +{
45555 +    "96348SV",                              /* szBoardId */
45556 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45557 +      0x01,                                 /* ucPhyAddress */
45558 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45559 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45560 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45561 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45562 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45563 +      0x01,                                 /* numSwitchPorts */
45564 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45565 +      BP_NOT_DEFINED},                      /* usReverseMii */
45566 +     {BP_ENET_EXTERNAL_PHY,                 /* ucPhyType */
45567 +      0x1f,                                 /* ucPhyAddress */
45568 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45569 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45570 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45571 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45572 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45573 +      0x01,                                 /* numSwitchPorts */
45574 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45575 +      BP_NOT_DEFINED}},                     /* usReverseMii */
45576 +    {{BP_VOIP_NO_DSP},                      /* ucDspType */
45577 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45578 +    BP_MEMORY_32MB_2_CHIP,                  /* usSdramSize */
45579 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45580 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45581 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45582 +    BP_NOT_DEFINED,                         /* usGpioPressAndHoldReset */
45583 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45584 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45585 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45586 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45587 +    BP_NOT_DEFINED,                         /* usGpioLedAdslFail */
45588 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45589 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45590 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45591 +    BP_NOT_DEFINED,                         /* usGpioLedWanData */
45592 +    BP_NOT_DEFINED,                         /* usGpioLedPpp */
45593 +    BP_NOT_DEFINED,                         /* usGpioLedPppFail */
45594 +    BP_NOT_DEFINED,                         /* usGpioLedBlPowerOn */
45595 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45596 +    BP_NOT_DEFINED,                         /* usGpioLedBlResetCfg */
45597 +    BP_NOT_DEFINED,                         /* usGpioLedBlStop */
45598 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45599 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45600 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45601 +    BP_NOT_DEFINED,                         /* usCsHpna */
45602 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45603 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45604 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45605 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45606 +};
45607 +
45608 +
45609 +static BOARD_PARAMETERS g_bcm96348gw_dualDsp =
45610 +{
45611 +    "96348GW-DualDSP",                      /* szBoardId */
45612 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45613 +      0x01,                                 /* ucPhyAddress */
45614 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45615 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45616 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45617 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45618 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45619 +      0x01,                                 /* numSwitchPorts */
45620 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45621 +      BP_NOT_DEFINED},                      /* usReverseMii */
45622 +     {BP_ENET_EXTERNAL_SWITCH,              /* ucPhyType */
45623 +      0x00,                                 /* ucPhyAddress */
45624 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45625 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45626 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45627 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45628 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45629 +      0x03,                                 /* numSwitchPorts */
45630 +      BP_ENET_CONFIG_SPI_SSB_1,             /* usConfigType */
45631 +      BP_ENET_REVERSE_MII}},                /* usReverseMii */
45632 +    {{BP_VOIP_DSP,                          /* ucDspType */
45633 +      0x00,                                 /* ucDspAddress */
45634 +      BP_EXT_INTR_2,                        /* usExtIntrVoip */
45635 +      BP_UNEQUIPPED,                        /* usGpioVoipReset */
45636 +      BP_GPIO_34_AH,                        /* usGpioVoipIntr */
45637 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45638 +      BP_CS_2},                             /* usCsVoip */
45639 +     {BP_VOIP_DSP,                          /* ucDspType */
45640 +      0x01,                                 /* ucDspAddress */
45641 +      BP_EXT_INTR_3,                        /* usExtIntrVoip */
45642 +      BP_UNEQUIPPED ,                       /* usGpioVoipReset */
45643 +      BP_GPIO_35_AH,                        /* usGpioVoipIntr */
45644 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45645 +      BP_CS_3}},                            /* usCsVoip */
45646 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45647 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45648 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45649 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45650 +    BP_GPIO_33_AL,                          /* usGpioPressAndHoldReset */
45651 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45652 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45653 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45654 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45655 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45656 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45657 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45658 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45659 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45660 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45661 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45662 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45663 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45664 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45665 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45666 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45667 +    BP_HW_DEFINED,                          /* usExtIntrAdslDyingGasp */
45668 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45669 +    BP_NOT_DEFINED,                         /* usCsHpna */
45670 +    BP_WLAN_ANT_MAIN,                       /* usAntInUseWireless */
45671 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45672 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45673 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45674 +};
45675 +
45676 +
45677 +static BOARD_PARAMETERS g_bcmCustom_01 =
45678 +{
45679 +     "BCMCUST_01",                          /* szBoardId */
45680 +    {{BP_ENET_INTERNAL_PHY,                 /* ucPhyType */
45681 +      0x01,                                 /* ucPhyAddress */
45682 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45683 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45684 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45685 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45686 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45687 +      0x01,                                 /* numSwitchPorts */
45688 +      BP_ENET_CONFIG_MDIO,                  /* usConfigType */
45689 +      BP_NOT_DEFINED},                      /* usReverseMii */
45690 +     {BP_ENET_NO_PHY,                       /* ucPhyType */
45691 +      0x00,                                 /* ucPhyAddress */
45692 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSck */
45693 +      BP_NOT_DEFINED,                       /* usGpioPhySpiSs */
45694 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMosi */
45695 +      BP_NOT_DEFINED,                       /* usGpioPhySpiMiso */
45696 +      BP_NOT_DEFINED,                       /* usGpioPhyReset */
45697 +      0x01,                                 /* numSwitchPorts */
45698 +      BP_ENET_CONFIG_SPI_SSB_1,             /* usConfigType */
45699 +      BP_ENET_REVERSE_MII}},                /* usReverseMii */
45700 +    {{BP_VOIP_DSP,                          /* ucDspType */
45701 +      0x00,                                 /* ucDspAddress */
45702 +      BP_EXT_INTR_2,                        /* usExtIntrVoip */
45703 +      BP_GPIO_36_AH,                        /* usGpioVoipReset */
45704 +      BP_GPIO_34_AL,                        /* usGpioVoipIntr */
45705 +      BP_NOT_DEFINED,                       /* usGpioLedVoip */
45706 +      BP_CS_2},                             /* usCsVoip */
45707 +     {BP_VOIP_NO_DSP}},                     /* ucDspType */
45708 +    BP_MEMORY_16MB_2_CHIP,                  /* usSdramSize */
45709 +    BP_PSI_DEFAULT_SIZE,                    /* usPsiSize */
45710 +    BP_NOT_DEFINED,                         /* usGpioRj11InnerPair */
45711 +    BP_NOT_DEFINED,                         /* usGpioRj11OuterPair */
45712 +    BP_GPIO_33_AL,                          /* usGpioPressAndHoldReset */
45713 +    BP_NOT_DEFINED,                         /* usGpioPcmciaReset */
45714 +    BP_NOT_DEFINED,                         /* usGpioUartRts */
45715 +    BP_NOT_DEFINED,                         /* usGpioUartCts */
45716 +    BP_NOT_DEFINED,                         /* usGpioLedAdsl */
45717 +    BP_GPIO_2_AL,                           /* usGpioLedAdslFail */
45718 +    BP_NOT_DEFINED,                         /* usGpioLedWireless */
45719 +    BP_NOT_DEFINED,                         /* usGpioLedUsb */
45720 +    BP_NOT_DEFINED,                         /* usGpioLedHpna */
45721 +    BP_GPIO_3_AL,                           /* usGpioLedWanData */
45722 +    BP_GPIO_3_AL,                           /* usGpioLedPpp */
45723 +    BP_GPIO_4_AL,                           /* usGpioLedPppFail */
45724 +    BP_GPIO_0_AL,                           /* usGpioLedBlPowerOn */
45725 +    BP_NOT_DEFINED,                         /* usGpioLedBlAlarm */
45726 +    BP_GPIO_3_AL,                           /* usGpioLedBlResetCfg */
45727 +    BP_GPIO_1_AL,                           /* usGpioLedBlStop */
45728 +    BP_NOT_DEFINED,                         /* usExtIntrWireless */
45729 +    BP_NOT_DEFINED,                         /* usExtIntrAdslDyingGasp */
45730 +    BP_NOT_DEFINED,                         /* usExtIntrHpna */
45731 +    BP_NOT_DEFINED,                         /* usCsHpna */
45732 +    BP_NOT_DEFINED,                         /* usAntInUseWireless */
45733 +    BP_NOT_DEFINED,                         /* usGpioSesBtnWireless */
45734 +    BP_NOT_DEFINED,                         /* usExtIntrSesBtnWireless */
45735 +    BP_NOT_DEFINED                          /* usGpioLedSesWireless */
45736 +};
45737 +
45738 +static PBOARD_PARAMETERS g_BoardParms[] =
45739 +    {&g_bcm96348r, &g_bcm96348lv, &g_bcm96348gw, &g_bcm96348gw_10,
45740 +     &g_bcm96348gw_11, &g_bcm96348sv, &g_bcm96348gw_dualDsp,
45741 +     &g_bcmCustom_01, 0};
45742 +#endif
45743 +
45744 +static PBOARD_PARAMETERS g_pCurrentBp = 0;
45745 +
45746 +/**************************************************************************
45747 + * Name       : bpstrcmp
45748 + *
45749 + * Description: String compare for this file so it does not depend on an OS.
45750 + *              (Linux kernel and CFE share this source file.)
45751 + *
45752 + * Parameters : [IN] dest - destination string
45753 + *              [IN] src - source string
45754 + *
45755 + * Returns    : -1 - dest < src, 1 - dest > src, 0 dest == src
45756 + ***************************************************************************/
45757 +static int bpstrcmp(const char *dest,const char *src);
45758 +static int bpstrcmp(const char *dest,const char *src)
45759 +{
45760 +    while (*src && *dest)
45761 +    {
45762 +        if (*dest < *src) return -1;
45763 +        if (*dest > *src) return 1;
45764 +        dest++;
45765 +        src++;
45766 +    }
45767 +
45768 +    if (*dest && !*src) return 1;
45769 +    if (!*dest && *src) return -1;
45770 +    return 0;
45771 +} /* bpstrcmp */
45772 +
45773 +/**************************************************************************
45774 + * Name       : BpGetVoipDspConfig
45775 + *
45776 + * Description: Gets the DSP configuration from the board parameter
45777 + *              structure for a given DSP index.
45778 + *
45779 + * Parameters : [IN] dspNum - DSP index (number)
45780 + *
45781 + * Returns    : Pointer to DSP configuration block if found/valid, NULL
45782 + *              otherwise.
45783 + ***************************************************************************/
45784 +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum );
45785 +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum )
45786 +{
45787 +    VOIP_DSP_INFO *pDspConfig = 0;
45788 +    int i;
45789 +
45790 +    if( g_pCurrentBp )
45791 +    {
45792 +        for( i = 0 ; i < BP_MAX_VOIP_DSP ; i++ )
45793 +        {
45794 +            if( g_pCurrentBp->VoIPDspInfo[i].ucDspType != BP_VOIP_NO_DSP &&
45795 +                g_pCurrentBp->VoIPDspInfo[i].ucDspAddress == dspNum )
45796 +            {
45797 +                pDspConfig = &g_pCurrentBp->VoIPDspInfo[i];
45798 +                break;
45799 +            }
45800 +        }
45801 +    }
45802 +
45803 +    return pDspConfig;
45804 +}
45805 +
45806 +
45807 +/**************************************************************************
45808 + * Name       : BpSetBoardId
45809 + *
45810 + * Description: This function find the BOARD_PARAMETERS structure for the
45811 + *              specified board id string and assigns it to a global, static
45812 + *              variable.
45813 + *
45814 + * Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM.
45815 + *
45816 + * Returns    : BP_SUCCESS - Success, value is returned.
45817 + *              BP_BOARD_ID_NOT_FOUND - Error, board id input string does not
45818 + *                  have a board parameters configuration record.
45819 + ***************************************************************************/
45820 +int BpSetBoardId( char *pszBoardId )
45821 +{
45822 +    int nRet = BP_BOARD_ID_NOT_FOUND;
45823 +    PBOARD_PARAMETERS *ppBp;
45824 +
45825 +    for( ppBp = g_BoardParms; *ppBp; ppBp++ )
45826 +    {
45827 +        if( !bpstrcmp((*ppBp)->szBoardId, pszBoardId) )
45828 +        {
45829 +            g_pCurrentBp = *ppBp;
45830 +            nRet = BP_SUCCESS;
45831 +            break;
45832 +        }
45833 +    }
45834 +
45835 +    return( nRet );
45836 +} /* BpSetBoardId */
45837 +
45838 +/**************************************************************************
45839 + * Name       : BpGetBoardIds
45840 + *
45841 + * Description: This function returns all of the supported board id strings.
45842 + *
45843 + * Parameters : [OUT] pszBoardIds - Address of a buffer that the board id
45844 + *                  strings are returned in.  Each id starts at BP_BOARD_ID_LEN
45845 + *                  boundary.
45846 + *              [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that
45847 + *                  were allocated in pszBoardIds.
45848 + *
45849 + * Returns    : Number of board id strings returned.
45850 + ***************************************************************************/
45851 +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize )
45852 +{
45853 +    PBOARD_PARAMETERS *ppBp;
45854 +    int i;
45855 +    char *src;
45856 +    char *dest;
45857 +
45858 +    for( i = 0, ppBp = g_BoardParms; *ppBp && nBoardIdsSize;
45859 +        i++, ppBp++, nBoardIdsSize--, pszBoardIds += BP_BOARD_ID_LEN )
45860 +    {
45861 +        dest = pszBoardIds;
45862 +        src = (*ppBp)->szBoardId;
45863 +        while( *src )
45864 +            *dest++ = *src++;
45865 +        *dest = '\0';
45866 +    }
45867 +
45868 +    return( i );
45869 +} /* BpGetBoardIds */
45870 +
45871 +/**************************************************************************
45872 + * Name       : BpGetEthernetMacInfo
45873 + *
45874 + * Description: This function returns all of the supported board id strings.
45875 + *
45876 + * Parameters : [OUT] pEnetInfos - Address of an array of ETHERNET_MAC_INFO
45877 + *                  buffers.
45878 + *              [IN] nNumEnetInfos - Number of ETHERNET_MAC_INFO elements that
45879 + *                  are pointed to by pEnetInfos.
45880 + *
45881 + * Returns    : BP_SUCCESS - Success, value is returned.
45882 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
45883 + ***************************************************************************/
45884 +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos )
45885 +{
45886 +    int i, nRet;
45887 +
45888 +    if( g_pCurrentBp )
45889 +    {
45890 +        for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ )
45891 +        {
45892 +            if( i < BP_MAX_ENET_MACS )
45893 +            {
45894 +                unsigned char *src = (unsigned char *)
45895 +                    &g_pCurrentBp->EnetMacInfos[i];
45896 +                unsigned char *dest = (unsigned char *) pEnetInfos;
45897 +                int len = sizeof(ETHERNET_MAC_INFO);
45898 +                while( len-- )
45899 +                    *dest++ = *src++;
45900 +            }
45901 +            else
45902 +                pEnetInfos->ucPhyType = BP_ENET_NO_PHY;
45903 +        }
45904 +
45905 +        nRet = BP_SUCCESS;
45906 +    }
45907 +    else
45908 +    {
45909 +        for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ )
45910 +            pEnetInfos->ucPhyType = BP_ENET_NO_PHY;
45911 +
45912 +        nRet = BP_BOARD_ID_NOT_SET;
45913 +    }
45914 +
45915 +    return( nRet );
45916 +} /* BpGetEthernetMacInfo */
45917 +
45918 +/**************************************************************************
45919 + * Name       : BpGetSdramSize
45920 + *
45921 + * Description: This function returns a constant that describees the board's
45922 + *              SDRAM type and size.
45923 + *
45924 + * Parameters : [OUT] pulSdramSize - Address of short word that the SDRAM size
45925 + *                  is returned in.
45926 + *
45927 + * Returns    : BP_SUCCESS - Success, value is returned.
45928 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
45929 + ***************************************************************************/
45930 +int BpGetSdramSize( unsigned long *pulSdramSize )
45931 +{
45932 +    int nRet;
45933 +
45934 +    if( g_pCurrentBp )
45935 +    {
45936 +        *pulSdramSize = g_pCurrentBp->usSdramSize;
45937 +        nRet = BP_SUCCESS;
45938 +    }
45939 +    else
45940 +    {
45941 +        *pulSdramSize = BP_NOT_DEFINED;
45942 +        nRet = BP_BOARD_ID_NOT_SET;
45943 +    }
45944 +
45945 +    return( nRet );
45946 +} /* BpGetSdramSize */
45947 +
45948 +/**************************************************************************
45949 + * Name       : BpGetPsiSize
45950 + *
45951 + * Description: This function returns the persistent storage size in K bytes.
45952 + *
45953 + * Parameters : [OUT] pulPsiSize - Address of short word that the persistent
45954 + *                  storage size is returned in.
45955 + *
45956 + * Returns    : BP_SUCCESS - Success, value is returned.
45957 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
45958 + ***************************************************************************/
45959 +int BpGetPsiSize( unsigned long *pulPsiSize )
45960 +{
45961 +    int nRet;
45962 +
45963 +    if( g_pCurrentBp )
45964 +    {
45965 +        *pulPsiSize = g_pCurrentBp->usPsiSize;
45966 +        nRet = BP_SUCCESS;
45967 +    }
45968 +    else
45969 +    {
45970 +        *pulPsiSize = BP_NOT_DEFINED;
45971 +        nRet = BP_BOARD_ID_NOT_SET;
45972 +    }
45973 +
45974 +    return( nRet );
45975 +} /* BpGetPsiSize */
45976 +
45977 +/**************************************************************************
45978 + * Name       : BpGetRj11InnerOuterPairGpios
45979 + *
45980 + * Description: This function returns the GPIO pin assignments for changing
45981 + *              between the RJ11 inner pair and RJ11 outer pair.
45982 + *
45983 + * Parameters : [OUT] pusInner - Address of short word that the RJ11 inner pair
45984 + *                  GPIO pin is returned in.
45985 + *              [OUT] pusOuter - Address of short word that the RJ11 outer pair
45986 + *                  GPIO pin is returned in.
45987 + *
45988 + * Returns    : BP_SUCCESS - Success, values are returned.
45989 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
45990 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
45991 + *                  for the board.
45992 + ***************************************************************************/
45993 +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner,
45994 +    unsigned short *pusOuter )
45995 +{
45996 +    int nRet;
45997 +
45998 +    if( g_pCurrentBp )
45999 +    {
46000 +        *pusInner = g_pCurrentBp->usGpioRj11InnerPair;
46001 +        *pusOuter = g_pCurrentBp->usGpioRj11OuterPair;
46002 +
46003 +        if( g_pCurrentBp->usGpioRj11InnerPair != BP_NOT_DEFINED &&
46004 +            g_pCurrentBp->usGpioRj11OuterPair != BP_NOT_DEFINED )
46005 +        {
46006 +            nRet = BP_SUCCESS;
46007 +        }
46008 +        else
46009 +        {
46010 +            nRet = BP_VALUE_NOT_DEFINED;
46011 +        }
46012 +    }
46013 +    else
46014 +    {
46015 +        *pusInner = *pusOuter = BP_NOT_DEFINED;
46016 +        nRet = BP_BOARD_ID_NOT_SET;
46017 +    }
46018 +
46019 +    return( nRet );
46020 +} /* BpGetRj11InnerOuterPairGpios */
46021 +
46022 +/**************************************************************************
46023 + * Name       : BpGetPressAndHoldResetGpio
46024 + *
46025 + * Description: This function returns the GPIO pin assignment for the press
46026 + *              and hold reset button.
46027 + *
46028 + * Parameters : [OUT] pusValue - Address of short word that the press and hold
46029 + *                  reset button GPIO pin is returned in.
46030 + *
46031 + * Returns    : BP_SUCCESS - Success, value is returned.
46032 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46033 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46034 + *                  for the board.
46035 + ***************************************************************************/
46036 +int BpGetPressAndHoldResetGpio( unsigned short *pusValue )
46037 +{
46038 +    int nRet;
46039 +
46040 +    if( g_pCurrentBp )
46041 +    {
46042 +        *pusValue = g_pCurrentBp->usGpioPressAndHoldReset;
46043 +
46044 +        if( g_pCurrentBp->usGpioPressAndHoldReset != BP_NOT_DEFINED )
46045 +        {
46046 +            nRet = BP_SUCCESS;
46047 +        }
46048 +        else
46049 +        {
46050 +            nRet = BP_VALUE_NOT_DEFINED;
46051 +        }
46052 +    }
46053 +    else
46054 +    {
46055 +        *pusValue = BP_NOT_DEFINED;
46056 +        nRet = BP_BOARD_ID_NOT_SET;
46057 +    }
46058 +
46059 +    return( nRet );
46060 +} /* BpGetPressAndHoldResetGpio */
46061 +
46062 +/**************************************************************************
46063 + * Name       : BpGetVoipResetGpio
46064 + *
46065 + * Description: This function returns the GPIO pin assignment for the VOIP
46066 + *              Reset operation.
46067 + *
46068 + * Parameters : [OUT] pusValue - Address of short word that the VOIP reset
46069 + *                  GPIO pin is returned in.
46070 + *              [IN] dspNum - Address of the DSP to query.
46071 + *
46072 + * Returns    : BP_SUCCESS - Success, value is returned.
46073 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46074 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46075 + *                  for the board.
46076 + ***************************************************************************/
46077 +int BpGetVoipResetGpio( unsigned char dspNum, unsigned short *pusValue )
46078 +{
46079 +    int nRet;
46080 +
46081 +    if( g_pCurrentBp )
46082 +    {
46083 +        VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
46084 +
46085 +        if( pDspInfo )
46086 +        {
46087 +           *pusValue = pDspInfo->usGpioVoipReset;
46088 +
46089 +           if( *pusValue != BP_NOT_DEFINED ||
46090 +               *pusValue == BP_UNEQUIPPED )
46091 +           {
46092 +              nRet = BP_SUCCESS;
46093 +           }
46094 +           else
46095 +           {
46096 +              nRet = BP_VALUE_NOT_DEFINED;
46097 +           }
46098 +        }
46099 +        else
46100 +        {
46101 +           *pusValue = BP_NOT_DEFINED;
46102 +           nRet = BP_BOARD_ID_NOT_FOUND;
46103 +        }
46104 +    }
46105 +    else
46106 +    {
46107 +        *pusValue = BP_NOT_DEFINED;
46108 +        nRet = BP_BOARD_ID_NOT_SET;
46109 +    }
46110 +
46111 +    return( nRet );
46112 +} /* BpGetVoipResetGpio */
46113 +
46114 +/**************************************************************************
46115 + * Name       : BpGetVoipIntrGpio
46116 + *
46117 + * Description: This function returns the GPIO pin assignment for VoIP interrupt.
46118 + *
46119 + * Parameters : [OUT] pusValue - Address of short word that the VOIP interrupt
46120 + *                  GPIO pin is returned in.
46121 + *              [IN] dspNum - Address of the DSP to query.
46122 + *
46123 + * Returns    : BP_SUCCESS - Success, value is returned.
46124 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46125 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46126 + *                  for the board.
46127 + ***************************************************************************/
46128 +int BpGetVoipIntrGpio( unsigned char dspNum, unsigned short *pusValue )
46129 +{
46130 +    int nRet;
46131 +
46132 +    if( g_pCurrentBp )
46133 +    {
46134 +        VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
46135 +
46136 +        if( pDspInfo )
46137 +        {
46138 +           *pusValue = pDspInfo->usGpioVoipIntr;
46139 +
46140 +           if( *pusValue != BP_NOT_DEFINED )
46141 +           {
46142 +              nRet = BP_SUCCESS;
46143 +           }
46144 +           else
46145 +           {
46146 +              nRet = BP_VALUE_NOT_DEFINED;
46147 +           }
46148 +        }
46149 +        else
46150 +        {
46151 +           *pusValue = BP_NOT_DEFINED;
46152 +           nRet = BP_BOARD_ID_NOT_FOUND;
46153 +        }
46154 +    }
46155 +    else
46156 +    {
46157 +        *pusValue = BP_NOT_DEFINED;
46158 +        nRet = BP_BOARD_ID_NOT_SET;
46159 +    }
46160 +
46161 +    return( nRet );
46162 +} /* BpGetVoipIntrGpio */
46163 +
46164 +/**************************************************************************
46165 + * Name       : BpGetPcmciaResetGpio
46166 + *
46167 + * Description: This function returns the GPIO pin assignment for the PCMCIA
46168 + *              Reset operation.
46169 + *
46170 + * Parameters : [OUT] pusValue - Address of short word that the PCMCIA reset
46171 + *                  GPIO pin is returned in.
46172 + *
46173 + * Returns    : BP_SUCCESS - Success, value is returned.
46174 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46175 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46176 + *                  for the board.
46177 + ***************************************************************************/
46178 +int BpGetPcmciaResetGpio( unsigned short *pusValue )
46179 +{
46180 +    int nRet;
46181 +
46182 +    if( g_pCurrentBp )
46183 +    {
46184 +        *pusValue = g_pCurrentBp->usGpioPcmciaReset;
46185 +
46186 +        if( g_pCurrentBp->usGpioPcmciaReset != BP_NOT_DEFINED )
46187 +        {
46188 +            nRet = BP_SUCCESS;
46189 +        }
46190 +        else
46191 +        {
46192 +            nRet = BP_VALUE_NOT_DEFINED;
46193 +        }
46194 +    }
46195 +    else
46196 +    {
46197 +        *pusValue = BP_NOT_DEFINED;
46198 +        nRet = BP_BOARD_ID_NOT_SET;
46199 +    }
46200 +
46201 +    return( nRet );
46202 +} /* BpGetPcmciaResetGpio */
46203 +
46204 +/**************************************************************************
46205 + * Name       : BpGetUartRtsCtsGpios
46206 + *
46207 + * Description: This function returns the GPIO pin assignments for RTS and CTS
46208 + *              UART signals.
46209 + *
46210 + * Parameters : [OUT] pusRts - Address of short word that the UART RTS GPIO
46211 + *                  pin is returned in.
46212 + *              [OUT] pusCts - Address of short word that the UART CTS GPIO
46213 + *                  pin is returned in.
46214 + *
46215 + * Returns    : BP_SUCCESS - Success, values are returned.
46216 + *              BP_BOARD_ID_NOT_SET - Error, board id input string does not
46217 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46218 + *                  for the board.
46219 + ***************************************************************************/
46220 +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts )
46221 +{
46222 +    int nRet;
46223 +
46224 +    if( g_pCurrentBp )
46225 +    {
46226 +        *pusRts = g_pCurrentBp->usGpioUartRts;
46227 +        *pusCts = g_pCurrentBp->usGpioUartCts;
46228 +
46229 +        if( g_pCurrentBp->usGpioUartRts != BP_NOT_DEFINED &&
46230 +            g_pCurrentBp->usGpioUartCts != BP_NOT_DEFINED )
46231 +        {
46232 +            nRet = BP_SUCCESS;
46233 +        }
46234 +        else
46235 +        {
46236 +            nRet = BP_VALUE_NOT_DEFINED;
46237 +        }
46238 +    }
46239 +    else
46240 +    {
46241 +        *pusRts = *pusCts = BP_NOT_DEFINED;
46242 +        nRet = BP_BOARD_ID_NOT_SET;
46243 +    }
46244 +
46245 +    return( nRet );
46246 +} /* BpGetUartRtsCtsGpios */
46247 +
46248 +/**************************************************************************
46249 + * Name       : BpGetAdslLedGpio
46250 + *
46251 + * Description: This function returns the GPIO pin assignment for the ADSL
46252 + *              LED.
46253 + *
46254 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
46255 + *                  GPIO pin is returned in.
46256 + *
46257 + * Returns    : BP_SUCCESS - Success, value is returned.
46258 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46259 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46260 + *                  for the board.
46261 + ***************************************************************************/
46262 +int BpGetAdslLedGpio( unsigned short *pusValue )
46263 +{
46264 +    int nRet;
46265 +
46266 +    if( g_pCurrentBp )
46267 +    {
46268 +        *pusValue = g_pCurrentBp->usGpioLedAdsl;
46269 +
46270 +        if( g_pCurrentBp->usGpioLedAdsl != BP_NOT_DEFINED )
46271 +        {
46272 +            nRet = BP_SUCCESS;
46273 +        }
46274 +        else
46275 +        {
46276 +            nRet = BP_VALUE_NOT_DEFINED;
46277 +        }
46278 +    }
46279 +    else
46280 +    {
46281 +        *pusValue = BP_NOT_DEFINED;
46282 +        nRet = BP_BOARD_ID_NOT_SET;
46283 +    }
46284 +
46285 +    return( nRet );
46286 +} /* BpGetAdslLedGpio */
46287 +
46288 +/**************************************************************************
46289 + * Name       : BpGetAdslFailLedGpio
46290 + *
46291 + * Description: This function returns the GPIO pin assignment for the ADSL
46292 + *              LED that is used when there is a DSL connection failure.
46293 + *
46294 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
46295 + *                  GPIO pin is returned in.
46296 + *
46297 + * Returns    : BP_SUCCESS - Success, value is returned.
46298 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46299 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46300 + *                  for the board.
46301 + ***************************************************************************/
46302 +int BpGetAdslFailLedGpio( unsigned short *pusValue )
46303 +{
46304 +    int nRet;
46305 +
46306 +    if( g_pCurrentBp )
46307 +    {
46308 +        *pusValue = g_pCurrentBp->usGpioLedAdslFail;
46309 +
46310 +        if( g_pCurrentBp->usGpioLedAdslFail != BP_NOT_DEFINED )
46311 +        {
46312 +            nRet = BP_SUCCESS;
46313 +        }
46314 +        else
46315 +        {
46316 +            nRet = BP_VALUE_NOT_DEFINED;
46317 +        }
46318 +    }
46319 +    else
46320 +    {
46321 +        *pusValue = BP_NOT_DEFINED;
46322 +        nRet = BP_BOARD_ID_NOT_SET;
46323 +    }
46324 +
46325 +    return( nRet );
46326 +} /* BpGetAdslFailLedGpio */
46327 +
46328 +/**************************************************************************
46329 + * Name       : BpGetWirelessLedGpio
46330 + *
46331 + * Description: This function returns the GPIO pin assignment for the Wireless
46332 + *              LED.
46333 + *
46334 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
46335 + *                  GPIO pin is returned in.
46336 + *
46337 + * Returns    : BP_SUCCESS - Success, value is returned.
46338 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46339 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46340 + *                  for the board.
46341 + ***************************************************************************/
46342 +int BpGetWirelessLedGpio( unsigned short *pusValue )
46343 +{
46344 +    int nRet;
46345 +
46346 +    if( g_pCurrentBp )
46347 +    {
46348 +        *pusValue = g_pCurrentBp->usGpioLedWireless;
46349 +
46350 +        if( g_pCurrentBp->usGpioLedWireless != BP_NOT_DEFINED )
46351 +        {
46352 +            nRet = BP_SUCCESS;
46353 +        }
46354 +        else
46355 +        {
46356 +            nRet = BP_VALUE_NOT_DEFINED;
46357 +        }
46358 +    }
46359 +    else
46360 +    {
46361 +        *pusValue = BP_NOT_DEFINED;
46362 +        nRet = BP_BOARD_ID_NOT_SET;
46363 +    }
46364 +
46365 +    return( nRet );
46366 +} /* BpGetWirelessLedGpio */
46367 +
46368 +/**************************************************************************
46369 + * Name       : BpGetWirelessAntInUse
46370 + *
46371 + * Description: This function returns the antennas in use for wireless
46372 + *
46373 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Antenna
46374 + *                  is in use.
46375 + *
46376 + * Returns    : BP_SUCCESS - Success, value is returned.
46377 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46378 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46379 + *                  for the board.
46380 + ***************************************************************************/
46381 +int BpGetWirelessAntInUse( unsigned short *pusValue )
46382 +{
46383 +    int nRet;
46384 +
46385 +    if( g_pCurrentBp )
46386 +    {
46387 +        *pusValue = g_pCurrentBp->usAntInUseWireless;
46388 +
46389 +        if( g_pCurrentBp->usAntInUseWireless != BP_NOT_DEFINED )
46390 +        {
46391 +            nRet = BP_SUCCESS;
46392 +        }
46393 +        else
46394 +        {
46395 +            nRet = BP_VALUE_NOT_DEFINED;
46396 +        }
46397 +    }
46398 +    else
46399 +    {
46400 +        *pusValue = BP_NOT_DEFINED;
46401 +        nRet = BP_BOARD_ID_NOT_SET;
46402 +    }
46403 +
46404 +    return( nRet );    
46405 +} /* BpGetWirelessAntInUse */
46406 +
46407 +/**************************************************************************
46408 + * Name       : BpGetWirelessSesBtnGpio
46409 + *
46410 + * Description: This function returns the GPIO pin assignment for the Wireless
46411 + *              Ses Button.
46412 + *
46413 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
46414 + *                  GPIO pin is returned in.
46415 + *
46416 + * Returns    : BP_SUCCESS - Success, value is returned.
46417 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46418 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46419 + *                  for the board.
46420 + ***************************************************************************/
46421 +int BpGetWirelessSesBtnGpio( unsigned short *pusValue )
46422 +{
46423 +    int nRet;
46424 +
46425 +    if( g_pCurrentBp )
46426 +    {
46427 +        *pusValue = g_pCurrentBp->usGpioSesBtnWireless;
46428 +
46429 +        if( g_pCurrentBp->usGpioSesBtnWireless != BP_NOT_DEFINED )
46430 +        {
46431 +            nRet = BP_SUCCESS;
46432 +        }
46433 +        else
46434 +        {
46435 +            nRet = BP_VALUE_NOT_DEFINED;
46436 +        }
46437 +    }
46438 +    else
46439 +    {
46440 +        *pusValue = BP_NOT_DEFINED;
46441 +        nRet = BP_BOARD_ID_NOT_SET;
46442 +    }
46443 +
46444 +    return( nRet );    
46445 +} /* BpGetWirelessSesBtnGpio */
46446 +
46447 +/**************************************************************************
46448 + * Name       : BpGetWirelessSesExtIntr
46449 + *
46450 + * Description: This function returns the external interrupt number for the 
46451 + *              Wireless Ses Button.
46452 + *
46453 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
46454 + *                  external interrup is returned in.
46455 + *
46456 + * Returns    : BP_SUCCESS - Success, value is returned.
46457 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46458 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46459 + *                  for the board.
46460 + ***************************************************************************/
46461 +int BpGetWirelessSesExtIntr( unsigned short *pusValue )
46462 +{
46463 +    int nRet;
46464 +
46465 +    if( g_pCurrentBp )
46466 +    {
46467 +        *pusValue = g_pCurrentBp->usExtIntrSesBtnWireless;
46468 +
46469 +        if( g_pCurrentBp->usExtIntrSesBtnWireless != BP_NOT_DEFINED )
46470 +        {
46471 +            nRet = BP_SUCCESS;
46472 +        }
46473 +        else
46474 +        {
46475 +            nRet = BP_VALUE_NOT_DEFINED;
46476 +        }
46477 +    }
46478 +    else
46479 +    {
46480 +        *pusValue = BP_NOT_DEFINED;
46481 +        nRet = BP_BOARD_ID_NOT_SET;
46482 +    }
46483 +
46484 +    return( nRet );    
46485 +               
46486 +} /* BpGetWirelessSesExtIntr */
46487 +
46488 +/**************************************************************************
46489 + * Name       : BpGetWirelessSesLedGpio
46490 + *
46491 + * Description: This function returns the GPIO pin assignment for the Wireless
46492 + *              Ses Led.
46493 + *
46494 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
46495 + *                  Led GPIO pin is returned in.
46496 + *
46497 + * Returns    : BP_SUCCESS - Success, value is returned.
46498 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46499 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46500 + *                  for the board.
46501 + ***************************************************************************/
46502 +int BpGetWirelessSesLedGpio( unsigned short *pusValue )
46503 +{
46504 +    int nRet;
46505 +
46506 +    if( g_pCurrentBp )
46507 +    {
46508 +        *pusValue = g_pCurrentBp->usGpioLedSesWireless;
46509 +
46510 +        if( g_pCurrentBp->usGpioLedSesWireless != BP_NOT_DEFINED )
46511 +        {
46512 +            nRet = BP_SUCCESS;
46513 +        }
46514 +        else
46515 +        {
46516 +            nRet = BP_VALUE_NOT_DEFINED;
46517 +        }
46518 +    }
46519 +    else
46520 +    {
46521 +        *pusValue = BP_NOT_DEFINED;
46522 +        nRet = BP_BOARD_ID_NOT_SET;
46523 +    }
46524 +
46525 +    return( nRet );
46526 +       
46527 +} /* BpGetWirelessSesLedGpio */
46528 +
46529 +/**************************************************************************
46530 + * Name       : BpGetUsbLedGpio
46531 + *
46532 + * Description: This function returns the GPIO pin assignment for the USB
46533 + *              LED.
46534 + *
46535 + * Parameters : [OUT] pusValue - Address of short word that the USB LED
46536 + *                  GPIO pin is returned in.
46537 + *
46538 + * Returns    : BP_SUCCESS - Success, value is returned.
46539 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46540 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46541 + *                  for the board.
46542 + ***************************************************************************/
46543 +int BpGetUsbLedGpio( unsigned short *pusValue )
46544 +{
46545 +    int nRet;
46546 +
46547 +    if( g_pCurrentBp )
46548 +    {
46549 +        *pusValue = g_pCurrentBp->usGpioLedUsb;
46550 +
46551 +        if( g_pCurrentBp->usGpioLedUsb != BP_NOT_DEFINED )
46552 +        {
46553 +            nRet = BP_SUCCESS;
46554 +        }
46555 +        else
46556 +        {
46557 +            nRet = BP_VALUE_NOT_DEFINED;
46558 +        }
46559 +    }
46560 +    else
46561 +    {
46562 +        *pusValue = BP_NOT_DEFINED;
46563 +        nRet = BP_BOARD_ID_NOT_SET;
46564 +    }
46565 +
46566 +    return( nRet );
46567 +} /* BpGetUsbLedGpio */
46568 +
46569 +/**************************************************************************
46570 + * Name       : BpGetHpnaLedGpio
46571 + *
46572 + * Description: This function returns the GPIO pin assignment for the HPNA
46573 + *              LED.
46574 + *
46575 + * Parameters : [OUT] pusValue - Address of short word that the HPNA LED
46576 + *                  GPIO pin is returned in.
46577 + *
46578 + * Returns    : BP_SUCCESS - Success, value is returned.
46579 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46580 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46581 + *                  for the board.
46582 + ***************************************************************************/
46583 +int BpGetHpnaLedGpio( unsigned short *pusValue )
46584 +{
46585 +    int nRet;
46586 +
46587 +    if( g_pCurrentBp )
46588 +    {
46589 +        *pusValue = g_pCurrentBp->usGpioLedHpna;
46590 +
46591 +        if( g_pCurrentBp->usGpioLedHpna != BP_NOT_DEFINED )
46592 +        {
46593 +            nRet = BP_SUCCESS;
46594 +        }
46595 +        else
46596 +        {
46597 +            nRet = BP_VALUE_NOT_DEFINED;
46598 +        }
46599 +    }
46600 +    else
46601 +    {
46602 +        *pusValue = BP_NOT_DEFINED;
46603 +        nRet = BP_BOARD_ID_NOT_SET;
46604 +    }
46605 +
46606 +    return( nRet );
46607 +} /* BpGetHpnaLedGpio */
46608 +
46609 +/**************************************************************************
46610 + * Name       : BpGetWanDataLedGpio
46611 + *
46612 + * Description: This function returns the GPIO pin assignment for the WAN Data
46613 + *              LED.
46614 + *
46615 + * Parameters : [OUT] pusValue - Address of short word that the WAN Data LED
46616 + *                  GPIO pin is returned in.
46617 + *
46618 + * Returns    : BP_SUCCESS - Success, value is returned.
46619 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46620 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46621 + *                  for the board.
46622 + ***************************************************************************/
46623 +int BpGetWanDataLedGpio( unsigned short *pusValue )
46624 +{
46625 +    int nRet;
46626 +
46627 +    if( g_pCurrentBp )
46628 +    {
46629 +        *pusValue = g_pCurrentBp->usGpioLedWanData;
46630 +
46631 +        if( g_pCurrentBp->usGpioLedWanData != BP_NOT_DEFINED )
46632 +        {
46633 +            nRet = BP_SUCCESS;
46634 +        }
46635 +        else
46636 +        {
46637 +            nRet = BP_VALUE_NOT_DEFINED;
46638 +        }
46639 +    }
46640 +    else
46641 +    {
46642 +        *pusValue = BP_NOT_DEFINED;
46643 +        nRet = BP_BOARD_ID_NOT_SET;
46644 +    }
46645 +
46646 +    return( nRet );
46647 +} /* BpGetWanDataLedGpio */
46648 +
46649 +/**************************************************************************
46650 + * Name       : BpGetPppLedGpio
46651 + *
46652 + * Description: This function returns the GPIO pin assignment for the PPP
46653 + *              LED.
46654 + *
46655 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
46656 + *                  GPIO pin is returned in.
46657 + *
46658 + * Returns    : BP_SUCCESS - Success, value is returned.
46659 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46660 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46661 + *                  for the board.
46662 + ***************************************************************************/
46663 +int BpGetPppLedGpio( unsigned short *pusValue )
46664 +{
46665 +    int nRet;
46666 +
46667 +    if( g_pCurrentBp )
46668 +    {
46669 +        *pusValue = g_pCurrentBp->usGpioLedPpp;
46670 +
46671 +        if( g_pCurrentBp->usGpioLedPpp != BP_NOT_DEFINED )
46672 +        {
46673 +            nRet = BP_SUCCESS;
46674 +        }
46675 +        else
46676 +        {
46677 +            nRet = BP_VALUE_NOT_DEFINED;
46678 +        }
46679 +    }
46680 +    else
46681 +    {
46682 +        *pusValue = BP_NOT_DEFINED;
46683 +        nRet = BP_BOARD_ID_NOT_SET;
46684 +    }
46685 +
46686 +    return( nRet );
46687 +} /* BpGetPppLedGpio */
46688 +
46689 +/**************************************************************************
46690 + * Name       : BpGetPppFailLedGpio
46691 + *
46692 + * Description: This function returns the GPIO pin assignment for the PPP
46693 + *              LED that is used when there is a PPP connection failure.
46694 + *
46695 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
46696 + *                  GPIO pin is returned in.
46697 + *
46698 + * Returns    : BP_SUCCESS - Success, value is returned.
46699 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46700 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46701 + *                  for the board.
46702 + ***************************************************************************/
46703 +int BpGetPppFailLedGpio( unsigned short *pusValue )
46704 +{
46705 +    int nRet;
46706 +
46707 +    if( g_pCurrentBp )
46708 +    {
46709 +        *pusValue = g_pCurrentBp->usGpioLedPppFail;
46710 +
46711 +        if( g_pCurrentBp->usGpioLedPppFail != BP_NOT_DEFINED )
46712 +        {
46713 +            nRet = BP_SUCCESS;
46714 +        }
46715 +        else
46716 +        {
46717 +            nRet = BP_VALUE_NOT_DEFINED;
46718 +        }
46719 +    }
46720 +    else
46721 +    {
46722 +        *pusValue = BP_NOT_DEFINED;
46723 +        nRet = BP_BOARD_ID_NOT_SET;
46724 +    }
46725 +
46726 +    return( nRet );
46727 +} /* BpGetPppFailLedGpio */
46728 +
46729 +/**************************************************************************
46730 + * Name       : BpGetBootloaderPowerOnLedGpio
46731 + *
46732 + * Description: This function returns the GPIO pin assignment for the power
46733 + *              on LED that is set by the bootloader.
46734 + *
46735 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
46736 + *                  GPIO pin is returned in.
46737 + *
46738 + * Returns    : BP_SUCCESS - Success, value is returned.
46739 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46740 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46741 + *                  for the board.
46742 + ***************************************************************************/
46743 +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue )
46744 +{
46745 +    int nRet;
46746 +
46747 +    if( g_pCurrentBp )
46748 +    {
46749 +        *pusValue = g_pCurrentBp->usGpioLedBlPowerOn;
46750 +
46751 +        if( g_pCurrentBp->usGpioLedBlPowerOn != BP_NOT_DEFINED )
46752 +        {
46753 +            nRet = BP_SUCCESS;
46754 +        }
46755 +        else
46756 +        {
46757 +            nRet = BP_VALUE_NOT_DEFINED;
46758 +        }
46759 +    }
46760 +    else
46761 +    {
46762 +        *pusValue = BP_NOT_DEFINED;
46763 +        nRet = BP_BOARD_ID_NOT_SET;
46764 +    }
46765 +
46766 +    return( nRet );
46767 +} /* BpGetBootloaderPowerOn */
46768 +
46769 +/**************************************************************************
46770 + * Name       : BpGetBootloaderAlarmLedGpio
46771 + *
46772 + * Description: This function returns the GPIO pin assignment for the alarm
46773 + *              LED that is set by the bootloader.
46774 + *
46775 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
46776 + *                  GPIO pin is returned in.
46777 + *
46778 + * Returns    : BP_SUCCESS - Success, value is returned.
46779 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46780 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46781 + *                  for the board.
46782 + ***************************************************************************/
46783 +int BpGetBootloaderAlarmLedGpio( unsigned short *pusValue )
46784 +{
46785 +    int nRet;
46786 +
46787 +    if( g_pCurrentBp )
46788 +    {
46789 +        *pusValue = g_pCurrentBp->usGpioLedBlAlarm;
46790 +
46791 +        if( g_pCurrentBp->usGpioLedBlAlarm != BP_NOT_DEFINED )
46792 +        {
46793 +            nRet = BP_SUCCESS;
46794 +        }
46795 +        else
46796 +        {
46797 +            nRet = BP_VALUE_NOT_DEFINED;
46798 +        }
46799 +    }
46800 +    else
46801 +    {
46802 +        *pusValue = BP_NOT_DEFINED;
46803 +        nRet = BP_BOARD_ID_NOT_SET;
46804 +    }
46805 +
46806 +    return( nRet );
46807 +} /* BpGetBootloaderAlarmLedGpio */
46808 +
46809 +/**************************************************************************
46810 + * Name       : BpGetBootloaderResetCfgLedGpio
46811 + *
46812 + * Description: This function returns the GPIO pin assignment for the reset
46813 + *              configuration LED that is set by the bootloader.
46814 + *
46815 + * Parameters : [OUT] pusValue - Address of short word that the reset
46816 + *                  configuration LED GPIO pin is returned in.
46817 + *
46818 + * Returns    : BP_SUCCESS - Success, value is returned.
46819 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46820 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46821 + *                  for the board.
46822 + ***************************************************************************/
46823 +int BpGetBootloaderResetCfgLedGpio( unsigned short *pusValue )
46824 +{
46825 +    int nRet;
46826 +
46827 +    if( g_pCurrentBp )
46828 +    {
46829 +        *pusValue = g_pCurrentBp->usGpioLedBlResetCfg;
46830 +
46831 +        if( g_pCurrentBp->usGpioLedBlResetCfg != BP_NOT_DEFINED )
46832 +        {
46833 +            nRet = BP_SUCCESS;
46834 +        }
46835 +        else
46836 +        {
46837 +            nRet = BP_VALUE_NOT_DEFINED;
46838 +        }
46839 +    }
46840 +    else
46841 +    {
46842 +        *pusValue = BP_NOT_DEFINED;
46843 +        nRet = BP_BOARD_ID_NOT_SET;
46844 +    }
46845 +
46846 +    return( nRet );
46847 +} /* BpGetBootloaderResetCfgLedGpio */
46848 +
46849 +/**************************************************************************
46850 + * Name       : BpGetBootloaderStopLedGpio
46851 + *
46852 + * Description: This function returns the GPIO pin assignment for the break
46853 + *              into bootloader LED that is set by the bootloader.
46854 + *
46855 + * Parameters : [OUT] pusValue - Address of short word that the break into
46856 + *                  bootloader LED GPIO pin is returned in.
46857 + *
46858 + * Returns    : BP_SUCCESS - Success, value is returned.
46859 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46860 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46861 + *                  for the board.
46862 + ***************************************************************************/
46863 +int BpGetBootloaderStopLedGpio( unsigned short *pusValue )
46864 +{
46865 +    int nRet;
46866 +
46867 +    if( g_pCurrentBp )
46868 +    {
46869 +        *pusValue = g_pCurrentBp->usGpioLedBlStop;
46870 +
46871 +        if( g_pCurrentBp->usGpioLedBlStop != BP_NOT_DEFINED )
46872 +        {
46873 +            nRet = BP_SUCCESS;
46874 +        }
46875 +        else
46876 +        {
46877 +            nRet = BP_VALUE_NOT_DEFINED;
46878 +        }
46879 +    }
46880 +    else
46881 +    {
46882 +        *pusValue = BP_NOT_DEFINED;
46883 +        nRet = BP_BOARD_ID_NOT_SET;
46884 +    }
46885 +
46886 +    return( nRet );
46887 +} /* BpGetBootloaderStopLedGpio */
46888 +
46889 +/**************************************************************************
46890 + * Name       : BpGetVoipLedGpio
46891 + *
46892 + * Description: This function returns the GPIO pin assignment for the VOIP
46893 + *              LED.
46894 + *
46895 + * Parameters : [OUT] pusValue - Address of short word that the VOIP LED
46896 + *                  GPIO pin is returned in.
46897 + *
46898 + * Returns    : BP_SUCCESS - Success, value is returned.
46899 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46900 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46901 + *                  for the board.
46902 + *
46903 + * Note       : The VoIP structure would allow for having one LED per DSP
46904 + *              however, the board initialization function assumes only one
46905 + *              LED per functionality (ie one LED for VoIP).  Therefore in
46906 + *              order to keep this tidy and simple we do not make usage of the
46907 + *              one-LED-per-DSP function.  Instead, we assume that the LED for
46908 + *              VoIP is unique and associated with DSP 0 (always present on
46909 + *              any VoIP platform).  If changing this to a LED-per-DSP function
46910 + *              then one need to update the board initialization driver in
46911 + *              bcmdrivers\opensource\char\board\bcm963xx\impl1
46912 + ***************************************************************************/
46913 +int BpGetVoipLedGpio( unsigned short *pusValue )
46914 +{
46915 +    int nRet;
46916 +
46917 +    if( g_pCurrentBp )
46918 +    {
46919 +        VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( 0 );
46920 +
46921 +        if( pDspInfo )
46922 +        {
46923 +           *pusValue = pDspInfo->usGpioLedVoip;
46924 +
46925 +           if( *pusValue != BP_NOT_DEFINED )
46926 +           {
46927 +              nRet = BP_SUCCESS;
46928 +           }
46929 +           else
46930 +           {
46931 +              nRet = BP_VALUE_NOT_DEFINED;
46932 +           }
46933 +        }
46934 +        else
46935 +        {
46936 +           *pusValue = BP_NOT_DEFINED;
46937 +           nRet = BP_BOARD_ID_NOT_FOUND;
46938 +        }
46939 +    }
46940 +    else
46941 +    {
46942 +        *pusValue = BP_NOT_DEFINED;
46943 +        nRet = BP_BOARD_ID_NOT_SET;
46944 +    }
46945 +
46946 +    return( nRet );
46947 +} /* BpGetVoipLedGpio */
46948 +
46949 +/**************************************************************************
46950 + * Name       : BpGetWirelessExtIntr
46951 + *
46952 + * Description: This function returns the Wireless external interrupt number.
46953 + *
46954 + * Parameters : [OUT] pulValue - Address of short word that the wireless
46955 + *                  external interrupt number is returned in.
46956 + *
46957 + * Returns    : BP_SUCCESS - Success, value is returned.
46958 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46959 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
46960 + *                  for the board.
46961 + ***************************************************************************/
46962 +int BpGetWirelessExtIntr( unsigned long *pulValue )
46963 +{
46964 +    int nRet;
46965 +
46966 +    if( g_pCurrentBp )
46967 +    {
46968 +        *pulValue = g_pCurrentBp->usExtIntrWireless;
46969 +
46970 +        if( g_pCurrentBp->usExtIntrWireless != BP_NOT_DEFINED )
46971 +        {
46972 +            nRet = BP_SUCCESS;
46973 +        }
46974 +        else
46975 +        {
46976 +            nRet = BP_VALUE_NOT_DEFINED;
46977 +        }
46978 +    }
46979 +    else
46980 +    {
46981 +        *pulValue = BP_NOT_DEFINED;
46982 +        nRet = BP_BOARD_ID_NOT_SET;
46983 +    }
46984 +
46985 +    return( nRet );
46986 +} /* BpGetWirelessExtIntr */
46987 +
46988 +/**************************************************************************
46989 + * Name       : BpGetAdslDyingGaspExtIntr
46990 + *
46991 + * Description: This function returns the ADSL Dying Gasp external interrupt
46992 + *              number.
46993 + *
46994 + * Parameters : [OUT] pulValue - Address of short word that the ADSL Dying Gasp
46995 + *                  external interrupt number is returned in.
46996 + *
46997 + * Returns    : BP_SUCCESS - Success, value is returned.
46998 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
46999 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47000 + *                  for the board.
47001 + ***************************************************************************/
47002 +int BpGetAdslDyingGaspExtIntr( unsigned long *pulValue )
47003 +{
47004 +    int nRet;
47005 +
47006 +    if( g_pCurrentBp )
47007 +    {
47008 +        *pulValue = g_pCurrentBp->usExtIntrAdslDyingGasp;
47009 +
47010 +        if( g_pCurrentBp->usExtIntrAdslDyingGasp != BP_NOT_DEFINED )
47011 +        {
47012 +            nRet = BP_SUCCESS;
47013 +        }
47014 +        else
47015 +        {
47016 +            nRet = BP_VALUE_NOT_DEFINED;
47017 +        }
47018 +    }
47019 +    else
47020 +    {
47021 +        *pulValue = BP_NOT_DEFINED;
47022 +        nRet = BP_BOARD_ID_NOT_SET;
47023 +    }
47024 +
47025 +    return( nRet );
47026 +} /* BpGetAdslDyingGaspExtIntr */
47027 +
47028 +/**************************************************************************
47029 + * Name       : BpGetVoipExtIntr
47030 + *
47031 + * Description: This function returns the VOIP external interrupt number.
47032 + *
47033 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
47034 + *                  external interrupt number is returned in.
47035 + *              [IN] dspNum - Address of the DSP to query.
47036 + *
47037 + * Returns    : BP_SUCCESS - Success, value is returned.
47038 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47039 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47040 + *                  for the board.
47041 + ***************************************************************************/
47042 +int BpGetVoipExtIntr( unsigned char dspNum, unsigned long *pulValue )
47043 +{
47044 +    int nRet;
47045 +
47046 +    if( g_pCurrentBp )
47047 +    {
47048 +        VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
47049 +
47050 +        if( pDspInfo )
47051 +        {
47052 +           *pulValue = pDspInfo->usExtIntrVoip;
47053 +
47054 +           if( *pulValue != BP_NOT_DEFINED )
47055 +           {
47056 +              nRet = BP_SUCCESS;
47057 +           }
47058 +           else
47059 +           {
47060 +              nRet = BP_VALUE_NOT_DEFINED;
47061 +           }
47062 +        }
47063 +        else
47064 +        {
47065 +           *pulValue = BP_NOT_DEFINED;
47066 +           nRet = BP_BOARD_ID_NOT_FOUND;
47067 +        }
47068 +    }
47069 +    else
47070 +    {
47071 +        *pulValue = BP_NOT_DEFINED;
47072 +        nRet = BP_BOARD_ID_NOT_SET;
47073 +    }
47074 +
47075 +    return( nRet );
47076 +} /* BpGetVoipExtIntr */
47077 +
47078 +/**************************************************************************
47079 + * Name       : BpGetHpnaExtIntr
47080 + *
47081 + * Description: This function returns the HPNA external interrupt number.
47082 + *
47083 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
47084 + *                  external interrupt number is returned in.
47085 + *
47086 + * Returns    : BP_SUCCESS - Success, value is returned.
47087 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47088 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47089 + *                  for the board.
47090 + ***************************************************************************/
47091 +int BpGetHpnaExtIntr( unsigned long *pulValue )
47092 +{
47093 +    int nRet;
47094 +
47095 +    if( g_pCurrentBp )
47096 +    {
47097 +        *pulValue = g_pCurrentBp->usExtIntrHpna;
47098 +
47099 +        if( g_pCurrentBp->usExtIntrHpna != BP_NOT_DEFINED )
47100 +        {
47101 +            nRet = BP_SUCCESS;
47102 +        }
47103 +        else
47104 +        {
47105 +            nRet = BP_VALUE_NOT_DEFINED;
47106 +        }
47107 +    }
47108 +    else
47109 +    {
47110 +        *pulValue = BP_NOT_DEFINED;
47111 +        nRet = BP_BOARD_ID_NOT_SET;
47112 +    }
47113 +
47114 +    return( nRet );
47115 +} /* BpGetHpnaExtIntr */
47116 +
47117 +/**************************************************************************
47118 + * Name       : BpGetHpnaChipSelect
47119 + *
47120 + * Description: This function returns the HPNA chip select number.
47121 + *
47122 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
47123 + *                  chip select number is returned in.
47124 + *
47125 + * Returns    : BP_SUCCESS - Success, value is returned.
47126 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47127 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47128 + *                  for the board.
47129 + ***************************************************************************/
47130 +int BpGetHpnaChipSelect( unsigned long *pulValue )
47131 +{
47132 +    int nRet;
47133 +
47134 +    if( g_pCurrentBp )
47135 +    {
47136 +        *pulValue = g_pCurrentBp->usCsHpna;
47137 +
47138 +        if( g_pCurrentBp->usCsHpna != BP_NOT_DEFINED )
47139 +        {
47140 +            nRet = BP_SUCCESS;
47141 +        }
47142 +        else
47143 +        {
47144 +            nRet = BP_VALUE_NOT_DEFINED;
47145 +        }
47146 +    }
47147 +    else
47148 +    {
47149 +        *pulValue = BP_NOT_DEFINED;
47150 +        nRet = BP_BOARD_ID_NOT_SET;
47151 +    }
47152 +
47153 +    return( nRet );
47154 +} /* BpGetHpnaChipSelect */
47155 +
47156 +/**************************************************************************
47157 + * Name       : BpGetVoipChipSelect
47158 + *
47159 + * Description: This function returns the VOIP chip select number.
47160 + *
47161 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
47162 + *                  chip select number is returned in.
47163 + *              [IN] dspNum - Address of the DSP to query.
47164 + *
47165 + * Returns    : BP_SUCCESS - Success, value is returned.
47166 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47167 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47168 + *                  for the board.
47169 + ***************************************************************************/
47170 +int BpGetVoipChipSelect( unsigned char dspNum, unsigned long *pulValue )
47171 +{
47172 +    int nRet;
47173 +
47174 +    if( g_pCurrentBp )
47175 +    {
47176 +        VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
47177 +
47178 +        if( pDspInfo )
47179 +        {
47180 +           *pulValue = pDspInfo->usCsVoip;
47181 +
47182 +           if( *pulValue != BP_NOT_DEFINED )
47183 +           {
47184 +              nRet = BP_SUCCESS;
47185 +           }
47186 +           else
47187 +           {
47188 +              nRet = BP_VALUE_NOT_DEFINED;
47189 +           }
47190 +        }
47191 +        else
47192 +        {
47193 +           *pulValue = BP_NOT_DEFINED;
47194 +           nRet = BP_BOARD_ID_NOT_FOUND;
47195 +        }
47196 +    }
47197 +    else
47198 +    {
47199 +        *pulValue = BP_NOT_DEFINED;
47200 +        nRet = BP_BOARD_ID_NOT_SET;
47201 +    }
47202 +
47203 +    return( nRet );
47204 +} /* BpGetVoipChipSelect */
47205 +
47206 diff -urN linux-2.6.8.1/boardparams/bcm963xx/boardparms.h linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/boardparms.h
47207 --- linux-2.6.8.1/boardparams/bcm963xx/boardparms.h     1970-01-01 01:00:00.000000000 +0100
47208 +++ linux-2.6.8.1-brcm63xx/boardparms/bcm963xx/boardparms.h     2006-06-26 09:07:10.000000000 +0200
47209 @@ -0,0 +1,766 @@
47210 +/*
47211 +<:copyright-gpl 
47212 +
47213 + Copyright 2003 Broadcom Corp. All Rights Reserved. 
47214
47215 + This program is free software; you can distribute it and/or modify it 
47216 + under the terms of the GNU General Public License (Version 2) as 
47217 + published by the Free Software Foundation. 
47218
47219 + This program is distributed in the hope it will be useful, but WITHOUT 
47220 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
47221 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
47222 + for more details. 
47223
47224 + You should have received a copy of the GNU General Public License along 
47225 + with this program; if not, write to the Free Software Foundation, Inc., 
47226 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 
47227 +
47228 +:>
47229 +*/
47230 +/**************************************************************************
47231 + * File Name  : boardparms.h
47232 + *
47233 + * Description: This file contains definitions and function prototypes for
47234 + *              the BCM63xx board parameter access functions.
47235 + * 
47236 + * Updates    : 07/14/2003  Created.
47237 + ***************************************************************************/
47238 +
47239 +#if !defined(_BOARDPARMS_H)
47240 +#define _BOARDPARMS_H
47241 +#define CONFIG_BCM96348
47242 +#if __cplusplus
47243 +extern "C" {
47244 +#endif
47245 +
47246 +/* Return codes. */
47247 +#define BP_SUCCESS                              0
47248 +#define BP_BOARD_ID_NOT_FOUND                   1
47249 +#define BP_VALUE_NOT_DEFINED                    2
47250 +#define BP_BOARD_ID_NOT_SET                     3
47251 +
47252 +/* Values for BpGetSdramSize. */
47253 +#define BP_MEMORY_8MB_1_CHIP                    0
47254 +#define BP_MEMORY_16MB_1_CHIP                   1
47255 +#define BP_MEMORY_32MB_1_CHIP                   2
47256 +#define BP_MEMORY_64MB_2_CHIP                   3
47257 +#define BP_MEMORY_32MB_2_CHIP                   4
47258 +#define BP_MEMORY_16MB_2_CHIP                   5
47259 +
47260 +/* Values for EthernetMacInfo PhyType. */
47261 +#define BP_ENET_NO_PHY                          0
47262 +#define BP_ENET_INTERNAL_PHY                    1
47263 +#define BP_ENET_EXTERNAL_PHY                    2
47264 +#define BP_ENET_EXTERNAL_SWITCH                 3
47265 +
47266 +/* Values for EthernetMacInfo Configuration type. */
47267 +#define BP_ENET_CONFIG_MDIO                     0       /* Internal PHY, External PHY, Switch+(no GPIO, no SPI, no MDIO Pseudo phy */
47268 +#define BP_ENET_CONFIG_GPIO                     1       /* Bcm96345GW board + Bcm5325M/E */
47269 +#define BP_ENET_CONFIG_MDIO_PSEUDO_PHY          2       /* Bcm96348GW board + Bcm5325E */
47270 +#define BP_ENET_CONFIG_SPI_SSB_0                3       /* Bcm96348GW board + Bcm5325M/E */
47271 +#define BP_ENET_CONFIG_SPI_SSB_1                4       /* Bcm96348GW board + Bcm5325M/E */
47272 +#define BP_ENET_CONFIG_SPI_SSB_2                5       /* Bcm96348GW board + Bcm5325M/E */
47273 +#define BP_ENET_CONFIG_SPI_SSB_3                6       /* Bcm96348GW board + Bcm5325M/E */
47274 +
47275 +/* Values for EthernetMacInfo Reverse MII. */
47276 +#define BP_ENET_NO_REVERSE_MII                  0
47277 +#define BP_ENET_REVERSE_MII                     1
47278 +
47279 +/* Values for VoIPDSPInfo DSPType. */
47280 +#define BP_VOIP_NO_DSP                          0
47281 +#define BP_VOIP_DSP                             1
47282 +
47283 +
47284 +/* Values for GPIO pin assignments (AH = Active High, AL = Active Low). */
47285 +#define BP_ACTIVE_MASK                          0x8000
47286 +#define BP_ACTIVE_HIGH                          0x0000
47287 +#define BP_ACTIVE_LOW                           0x8000
47288 +#define BP_GPIO_0_AH                            (0  | BP_ACTIVE_HIGH)
47289 +#define BP_GPIO_0_AL                            (0  | BP_ACTIVE_LOW)
47290 +#define BP_GPIO_1_AH                            (1  | BP_ACTIVE_HIGH)
47291 +#define BP_GPIO_1_AL                            (1  | BP_ACTIVE_LOW)
47292 +#define BP_GPIO_2_AH                            (2  | BP_ACTIVE_HIGH)
47293 +#define BP_GPIO_2_AL                            (2  | BP_ACTIVE_LOW)
47294 +#define BP_GPIO_3_AH                            (3  | BP_ACTIVE_HIGH)
47295 +#define BP_GPIO_3_AL                            (3  | BP_ACTIVE_LOW)
47296 +#define BP_GPIO_4_AH                            (4  | BP_ACTIVE_HIGH)
47297 +#define BP_GPIO_4_AL                            (4  | BP_ACTIVE_LOW)
47298 +#define BP_GPIO_5_AH                            (5  | BP_ACTIVE_HIGH)
47299 +#define BP_GPIO_5_AL                            (5  | BP_ACTIVE_LOW)
47300 +#define BP_GPIO_6_AH                            (6  | BP_ACTIVE_HIGH)
47301 +#define BP_GPIO_6_AL                            (6  | BP_ACTIVE_LOW)
47302 +#define BP_GPIO_7_AH                            (7  | BP_ACTIVE_HIGH)
47303 +#define BP_GPIO_7_AL                            (7  | BP_ACTIVE_LOW)
47304 +#define BP_GPIO_8_AH                            (8  | BP_ACTIVE_HIGH)
47305 +#define BP_GPIO_8_AL                            (8  | BP_ACTIVE_LOW)
47306 +#define BP_GPIO_9_AH                            (9  | BP_ACTIVE_HIGH)
47307 +#define BP_GPIO_9_AL                            (9  | BP_ACTIVE_LOW)
47308 +#define BP_GPIO_10_AH                           (10 | BP_ACTIVE_HIGH)
47309 +#define BP_GPIO_10_AL                           (10 | BP_ACTIVE_LOW)
47310 +#define BP_GPIO_11_AH                           (11 | BP_ACTIVE_HIGH)
47311 +#define BP_GPIO_11_AL                           (11 | BP_ACTIVE_LOW)
47312 +#define BP_GPIO_12_AH                           (12 | BP_ACTIVE_HIGH)
47313 +#define BP_GPIO_12_AL                           (12 | BP_ACTIVE_LOW)
47314 +#define BP_GPIO_13_AH                           (13 | BP_ACTIVE_HIGH)
47315 +#define BP_GPIO_13_AL                           (13 | BP_ACTIVE_LOW)
47316 +#define BP_GPIO_14_AH                           (14 | BP_ACTIVE_HIGH)
47317 +#define BP_GPIO_14_AL                           (14 | BP_ACTIVE_LOW)
47318 +#define BP_GPIO_15_AH                           (15 | BP_ACTIVE_HIGH)
47319 +#define BP_GPIO_15_AL                           (15 | BP_ACTIVE_LOW)
47320 +#define BP_GPIO_16_AH                           (16 | BP_ACTIVE_HIGH)
47321 +#define BP_GPIO_16_AL                           (16 | BP_ACTIVE_LOW)
47322 +#define BP_GPIO_17_AH                           (17 | BP_ACTIVE_HIGH)
47323 +#define BP_GPIO_17_AL                           (17 | BP_ACTIVE_LOW)
47324 +#define BP_GPIO_18_AH                           (18 | BP_ACTIVE_HIGH)
47325 +#define BP_GPIO_18_AL                           (18 | BP_ACTIVE_LOW)
47326 +#define BP_GPIO_19_AH                           (19 | BP_ACTIVE_HIGH)
47327 +#define BP_GPIO_19_AL                           (19 | BP_ACTIVE_LOW)
47328 +#define BP_GPIO_20_AH                           (20 | BP_ACTIVE_HIGH)
47329 +#define BP_GPIO_20_AL                           (20 | BP_ACTIVE_LOW)
47330 +#define BP_GPIO_21_AH                           (21 | BP_ACTIVE_HIGH)
47331 +#define BP_GPIO_21_AL                           (21 | BP_ACTIVE_LOW)
47332 +#define BP_GPIO_22_AH                           (22 | BP_ACTIVE_HIGH)
47333 +#define BP_GPIO_22_AL                           (22 | BP_ACTIVE_LOW)
47334 +#define BP_GPIO_23_AH                           (23 | BP_ACTIVE_HIGH)
47335 +#define BP_GPIO_23_AL                           (23 | BP_ACTIVE_LOW)
47336 +#define BP_GPIO_24_AH                           (24 | BP_ACTIVE_HIGH)
47337 +#define BP_GPIO_24_AL                           (24 | BP_ACTIVE_LOW)
47338 +#define BP_GPIO_25_AH                           (25 | BP_ACTIVE_HIGH)
47339 +#define BP_GPIO_25_AL                           (25 | BP_ACTIVE_LOW)
47340 +#define BP_GPIO_26_AH                           (26 | BP_ACTIVE_HIGH)
47341 +#define BP_GPIO_26_AL                           (26 | BP_ACTIVE_LOW)
47342 +#define BP_GPIO_27_AH                           (27 | BP_ACTIVE_HIGH)
47343 +#define BP_GPIO_27_AL                           (27 | BP_ACTIVE_LOW)
47344 +#define BP_GPIO_28_AH                           (28 | BP_ACTIVE_HIGH)
47345 +#define BP_GPIO_28_AL                           (28 | BP_ACTIVE_LOW)
47346 +#define BP_GPIO_29_AH                           (29 | BP_ACTIVE_HIGH)
47347 +#define BP_GPIO_29_AL                           (29 | BP_ACTIVE_LOW)
47348 +#define BP_GPIO_30_AH                           (30 | BP_ACTIVE_HIGH)
47349 +#define BP_GPIO_30_AL                           (30 | BP_ACTIVE_LOW)
47350 +#define BP_GPIO_31_AH                           (31 | BP_ACTIVE_HIGH)
47351 +#define BP_GPIO_31_AL                           (31 | BP_ACTIVE_LOW)
47352 +#define BP_GPIO_32_AH                           (32 | BP_ACTIVE_HIGH)
47353 +#define BP_GPIO_32_AL                           (32 | BP_ACTIVE_LOW)
47354 +#define BP_GPIO_33_AH                           (33 | BP_ACTIVE_HIGH)
47355 +#define BP_GPIO_33_AL                           (33 | BP_ACTIVE_LOW)
47356 +#define BP_GPIO_34_AH                           (34 | BP_ACTIVE_HIGH)
47357 +#define BP_GPIO_34_AL                           (34 | BP_ACTIVE_LOW)
47358 +#define BP_GPIO_35_AH                           (35 | BP_ACTIVE_HIGH)
47359 +#define BP_GPIO_35_AL                           (35 | BP_ACTIVE_LOW)
47360 +#define BP_GPIO_36_AH                           (36 | BP_ACTIVE_HIGH)
47361 +#define BP_GPIO_36_AL                           (36 | BP_ACTIVE_LOW)
47362 +
47363 +/* Values for external interrupt assignments. */
47364 +#define BP_EXT_INTR_0                           0
47365 +#define BP_EXT_INTR_1                           1
47366 +#define BP_EXT_INTR_2                           2
47367 +#define BP_EXT_INTR_3                           3
47368 +
47369 +/* Values for chip select assignments. */
47370 +#define BP_CS_0                                 0
47371 +#define BP_CS_1                                 1
47372 +#define BP_CS_2                                 2
47373 +#define BP_CS_3                                 3
47374 +
47375 +/* Value for GPIO and external interrupt fields that are not used. */
47376 +#define BP_NOT_DEFINED                          0xffff
47377 +#define BP_HW_DEFINED                           0xfff0
47378 +#define BP_UNEQUIPPED                           0xfff1
47379 +
47380 +/* Maximum size of the board id string. */
47381 +#define BP_BOARD_ID_LEN                         16
47382 +
47383 +/* Maximum number of Ethernet MACs. */
47384 +#define BP_MAX_ENET_MACS                        2
47385 +
47386 +/* Maximum number of VoIP DSPs. */
47387 +#define BP_MAX_VOIP_DSP                         2
47388 +
47389 +/* Wireless Antenna Settings. */
47390 +#define BP_WLAN_ANT_MAIN                        0
47391 +#define BP_WLAN_ANT_AUX                         1
47392 +#define BP_WLAN_ANT_BOTH                        3
47393 +
47394 +#if !defined(__ASSEMBLER__)
47395 +
47396 +/* Information about an Ethernet MAC.  If ucPhyType is BP_ENET_NO_PHY,
47397 + * then the other fields are not valid.
47398 + */
47399 +typedef struct EthernetMacInfo
47400 +{
47401 +    unsigned char ucPhyType;                    /* BP_ENET_xxx             */
47402 +    unsigned char ucPhyAddress;                 /* 0 to 31                 */
47403 +    unsigned short usGpioPhySpiSck;             /* GPIO pin or not defined */
47404 +    unsigned short usGpioPhySpiSs;              /* GPIO pin or not defined */
47405 +    unsigned short usGpioPhySpiMosi;            /* GPIO pin or not defined */
47406 +    unsigned short usGpioPhySpiMiso;            /* GPIO pin or not defined */
47407 +    unsigned short usGpioPhyReset;              /* GPIO pin or not defined (96348LV) */
47408 +    unsigned short numSwitchPorts;              /* Number of PHY ports */
47409 +    unsigned short usConfigType;                /* Configuration type */
47410 +    unsigned short usReverseMii;                /* Reverse MII */
47411 +} ETHERNET_MAC_INFO, *PETHERNET_MAC_INFO;
47412 +
47413 +
47414 +/* Information about VoIP DSPs.  If ucDspType is BP_VOIP_NO_DSP,
47415 + * then the other fields are not valid.
47416 + */
47417 +typedef struct VoIPDspInfo
47418 +{
47419 +    unsigned char  ucDspType;
47420 +    unsigned char  ucDspAddress;
47421 +    unsigned short usExtIntrVoip;
47422 +    unsigned short usGpioVoipReset;
47423 +    unsigned short usGpioVoipIntr;
47424 +    unsigned short usGpioLedVoip;
47425 +    unsigned short usCsVoip;
47426 +
47427 +} VOIP_DSP_INFO;
47428 +
47429 +
47430 +/**************************************************************************
47431 + * Name       : BpSetBoardId
47432 + *
47433 + * Description: This function find the BOARD_PARAMETERS structure for the
47434 + *              specified board id string and assigns it to a global, static
47435 + *              variable.
47436 + *
47437 + * Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM.
47438 + *
47439 + * Returns    : BP_SUCCESS - Success, value is returned.
47440 + *              BP_BOARD_ID_NOT_FOUND - Error, board id input string does not
47441 + *                  have a board parameters configuration record.
47442 + ***************************************************************************/
47443 +int BpSetBoardId( char *pszBoardId );
47444 +
47445 +/**************************************************************************
47446 + * Name       : BpGetBoardIds
47447 + *
47448 + * Description: This function returns all of the supported board id strings.
47449 + *
47450 + * Parameters : [OUT] pszBoardIds - Address of a buffer that the board id
47451 + *                  strings are returned in.  Each id starts at BP_BOARD_ID_LEN
47452 + *                  boundary.
47453 + *              [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that
47454 + *                  were allocated in pszBoardIds.
47455 + *
47456 + * Returns    : Number of board id strings returned.
47457 + ***************************************************************************/
47458 +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize );
47459 +
47460 +/**************************************************************************
47461 + * Name       : BpGetEthernetMacInfo
47462 + *
47463 + * Description: This function returns all of the supported board id strings.
47464 + *
47465 + * Parameters : [OUT] pEnetInfos - Address of an array of ETHERNET_MAC_INFO
47466 + *                  buffers.
47467 + *              [IN] nNumEnetInfos - Number of ETHERNET_MAC_INFO elements that
47468 + *                  are pointed to by pEnetInfos.
47469 + *
47470 + * Returns    : BP_SUCCESS - Success, value is returned.
47471 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47472 + ***************************************************************************/
47473 +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos );
47474 +
47475 +/**************************************************************************
47476 + * Name       : BpGetSdramSize
47477 + *
47478 + * Description: This function returns a constant that describees the board's
47479 + *              SDRAM type and size.
47480 + *
47481 + * Parameters : [OUT] pulSdramSize - Address of short word that the SDRAM size
47482 + *                  is returned in.
47483 + *
47484 + * Returns    : BP_SUCCESS - Success, value is returned.
47485 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47486 + ***************************************************************************/
47487 +int BpGetSdramSize( unsigned long *pulSdramSize );
47488 +
47489 +/**************************************************************************
47490 + * Name       : BpGetPsiSize
47491 + *
47492 + * Description: This function returns the persistent storage size in K bytes.
47493 + *
47494 + * Parameters : [OUT] pulPsiSize - Address of short word that the persistent
47495 + *                  storage size is returned in.
47496 + *
47497 + * Returns    : BP_SUCCESS - Success, value is returned.
47498 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47499 + ***************************************************************************/
47500 +int BpGetPsiSize( unsigned long *pulPsiSize );
47501 +
47502 +/**************************************************************************
47503 + * Name       : BpGetRj11InnerOuterPairGpios
47504 + *
47505 + * Description: This function returns the GPIO pin assignments for changing
47506 + *              between the RJ11 inner pair and RJ11 outer pair.
47507 + *
47508 + * Parameters : [OUT] pusInner - Address of short word that the RJ11 inner pair
47509 + *                  GPIO pin is returned in.
47510 + *              [OUT] pusOuter - Address of short word that the RJ11 outer pair
47511 + *                  GPIO pin is returned in.
47512 + *
47513 + * Returns    : BP_SUCCESS - Success, values are returned.
47514 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47515 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47516 + *                  for the board.
47517 + ***************************************************************************/
47518 +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner,
47519 +    unsigned short *pusOuter );
47520 +
47521 +/**************************************************************************
47522 + * Name       : BpGetPressAndHoldResetGpio
47523 + *
47524 + * Description: This function returns the GPIO pin assignment for the press
47525 + *              and hold reset button.
47526 + *
47527 + * Parameters : [OUT] pusValue - Address of short word that the press and hold
47528 + *                  reset button GPIO pin is returned in.
47529 + *
47530 + * Returns    : BP_SUCCESS - Success, value is returned.
47531 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47532 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47533 + *                  for the board.
47534 + ***************************************************************************/
47535 +int BpGetPressAndHoldResetGpio( unsigned short *pusValue );
47536 +
47537 +/**************************************************************************
47538 + * Name       : BpGetVoipResetGpio
47539 + *
47540 + * Description: This function returns the GPIO pin assignment for the VOIP
47541 + *              Reset operation.
47542 + *
47543 + * Parameters : [OUT] pusValue - Address of short word that the VOIP reset
47544 + *                  GPIO pin is returned in.
47545 + *              [IN] dspNum - Address of the DSP to query.
47546 + *
47547 + * Returns    : BP_SUCCESS - Success, value is returned.
47548 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47549 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47550 + *                  for the board.
47551 + ***************************************************************************/
47552 +int BpGetVoipResetGpio( unsigned char dspNum, unsigned short *pusValue );
47553 +
47554 +/**************************************************************************
47555 + * Name       : BpGetVoipIntrGpio
47556 + *
47557 + * Description: This function returns the GPIO pin assignment for VoIP interrupt.
47558 + *
47559 + * Parameters : [OUT] pusValue - Address of short word that the VOIP interrupt
47560 + *                  GPIO pin is returned in.
47561 + *              [IN] dspNum - Address of the DSP to query.
47562 + *
47563 + * Returns    : BP_SUCCESS - Success, value is returned.
47564 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47565 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47566 + *                  for the board.
47567 + ***************************************************************************/
47568 +int BpGetVoipIntrGpio( unsigned char dspNum, unsigned short *pusValue );
47569 +
47570 +/**************************************************************************
47571 + * Name       : BpGetPcmciaResetGpio
47572 + *
47573 + * Description: This function returns the GPIO pin assignment for the PCMCIA
47574 + *              Reset operation.
47575 + *
47576 + * Parameters : [OUT] pusValue - Address of short word that the PCMCIA reset
47577 + *                  GPIO pin is returned in.
47578 + *
47579 + * Returns    : BP_SUCCESS - Success, value is returned.
47580 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47581 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47582 + *                  for the board.
47583 + ***************************************************************************/
47584 +int BpGetPcmciaResetGpio( unsigned short *pusValue );
47585 +
47586 +/**************************************************************************
47587 + * Name       : BpGetUartRtsCtsGpios
47588 + *
47589 + * Description: This function returns the GPIO pin assignments for RTS and CTS
47590 + *              UART signals.
47591 + *
47592 + * Parameters : [OUT] pusRts - Address of short word that the UART RTS GPIO
47593 + *                  pin is returned in.
47594 + *              [OUT] pusCts - Address of short word that the UART CTS GPIO
47595 + *                  pin is returned in.
47596 + *
47597 + * Returns    : BP_SUCCESS - Success, values are returned.
47598 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47599 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47600 + *                  for the board.
47601 + ***************************************************************************/
47602 +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts );
47603 +
47604 +/**************************************************************************
47605 + * Name       : BpGetAdslLedGpio
47606 + *
47607 + * Description: This function returns the GPIO pin assignment for the ADSL
47608 + *              LED.
47609 + *
47610 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
47611 + *                  GPIO pin is returned in.
47612 + *
47613 + * Returns    : BP_SUCCESS - Success, value is returned.
47614 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47615 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47616 + *                  for the board.
47617 + ***************************************************************************/
47618 +int BpGetAdslLedGpio( unsigned short *pusValue );
47619 +
47620 +/**************************************************************************
47621 + * Name       : BpGetAdslFailLedGpio
47622 + *
47623 + * Description: This function returns the GPIO pin assignment for the ADSL
47624 + *              LED that is used when there is a DSL connection failure.
47625 + *
47626 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
47627 + *                  GPIO pin is returned in.
47628 + *
47629 + * Returns    : BP_SUCCESS - Success, value is returned.
47630 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47631 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47632 + *                  for the board.
47633 + ***************************************************************************/
47634 +int BpGetAdslFailLedGpio( unsigned short *pusValue );
47635 +
47636 +/**************************************************************************
47637 + * Name       : BpGetWirelessLedGpio
47638 + *
47639 + * Description: This function returns the GPIO pin assignment for the Wireless
47640 + *              LED.
47641 + *
47642 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
47643 + *                  GPIO pin is returned in.
47644 + *
47645 + * Returns    : BP_SUCCESS - Success, value is returned.
47646 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47647 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47648 + *                  for the board.
47649 + ***************************************************************************/
47650 +int BpGetWirelessLedGpio( unsigned short *pusValue );
47651 +
47652 +/**************************************************************************
47653 + * Name       : BpGetWirelessAntInUse
47654 + *
47655 + * Description: This function returns the antennas in use for wireless
47656 + *
47657 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Antenna
47658 + *                  is in use.
47659 + *
47660 + * Returns    : BP_SUCCESS - Success, value is returned.
47661 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47662 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47663 + *                  for the board.
47664 + ***************************************************************************/
47665 +int BpGetWirelessAntInUse( unsigned short *pusValue );
47666 +
47667 +/**************************************************************************
47668 + * Name       : BpGetWirelessSesBtnGpio
47669 + *
47670 + * Description: This function returns the GPIO pin assignment for the Wireless
47671 + *              Ses Button.
47672 + *
47673 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
47674 + *                  Button GPIO pin is returned in.
47675 + *
47676 + * Returns    : BP_SUCCESS - Success, value is returned.
47677 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47678 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47679 + *                  for the board.
47680 + ***************************************************************************/
47681 +int BpGetWirelessSesBtnGpio( unsigned short *pusValue );
47682 +
47683 +/**************************************************************************
47684 + * Name       : BpGetWirelessSesExtIntr
47685 + *
47686 + * Description: This function returns the external interrupt number for the 
47687 + *              Wireless Ses Button.
47688 + *
47689 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
47690 + *                  external interrup is returned in.
47691 + *
47692 + * Returns    : BP_SUCCESS - Success, value is returned.
47693 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47694 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47695 + *                  for the board.
47696 + ***************************************************************************/
47697 +int BpGetWirelessSesExtIntr( unsigned short *pusValue );
47698 +
47699 +/**************************************************************************
47700 + * Name       : BpGetWirelessSesLedGpio
47701 + *
47702 + * Description: This function returns the GPIO pin assignment for the Wireless
47703 + *              Ses Led.
47704 + *
47705 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
47706 + *                  Led GPIO pin is returned in.
47707 + *
47708 + * Returns    : BP_SUCCESS - Success, value is returned.
47709 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47710 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47711 + *                  for the board.
47712 + ***************************************************************************/
47713 +int BpGetWirelessSesLedGpio( unsigned short *pusValue );
47714 +
47715 +/**************************************************************************
47716 + * Name       : BpGetUsbLedGpio
47717 + *
47718 + * Description: This function returns the GPIO pin assignment for the USB
47719 + *              LED.
47720 + *
47721 + * Parameters : [OUT] pusValue - Address of short word that the USB LED
47722 + *                  GPIO pin is returned in.
47723 + *
47724 + * Returns    : BP_SUCCESS - Success, value is returned.
47725 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47726 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47727 + *                  for the board.
47728 + ***************************************************************************/
47729 +int BpGetUsbLedGpio( unsigned short *pusValue );
47730 +
47731 +/**************************************************************************
47732 + * Name       : BpGetHpnaLedGpio
47733 + *
47734 + * Description: This function returns the GPIO pin assignment for the HPNA
47735 + *              LED.
47736 + *
47737 + * Parameters : [OUT] pusValue - Address of short word that the HPNA LED
47738 + *                  GPIO pin is returned in.
47739 + *
47740 + * Returns    : BP_SUCCESS - Success, value is returned.
47741 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47742 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47743 + *                  for the board.
47744 + ***************************************************************************/
47745 +int BpGetHpnaLedGpio( unsigned short *pusValue );
47746 +
47747 +/**************************************************************************
47748 + * Name       : BpGetWanDataLedGpio
47749 + *
47750 + * Description: This function returns the GPIO pin assignment for the WAN Data
47751 + *              LED.
47752 + *
47753 + * Parameters : [OUT] pusValue - Address of short word that the WAN Data LED
47754 + *                  GPIO pin is returned in.
47755 + *
47756 + * Returns    : BP_SUCCESS - Success, value is returned.
47757 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47758 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47759 + *                  for the board.
47760 + ***************************************************************************/
47761 +int BpGetWanDataLedGpio( unsigned short *pusValue );
47762 +
47763 +/**************************************************************************
47764 + * Name       : BpGetPppLedGpio
47765 + *
47766 + * Description: This function returns the GPIO pin assignment for the PPP
47767 + *              LED.
47768 + *
47769 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
47770 + *                  GPIO pin is returned in.
47771 + *
47772 + * Returns    : BP_SUCCESS - Success, value is returned.
47773 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47774 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47775 + *                  for the board.
47776 + ***************************************************************************/
47777 +int BpGetPppLedGpio( unsigned short *pusValue );
47778 +
47779 +/**************************************************************************
47780 + * Name       : BpGetPppFailLedGpio
47781 + *
47782 + * Description: This function returns the GPIO pin assignment for the PPP
47783 + *              LED that is used when there is a PPP connection failure.
47784 + *
47785 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
47786 + *                  GPIO pin is returned in.
47787 + *
47788 + * Returns    : BP_SUCCESS - Success, value is returned.
47789 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47790 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47791 + *                  for the board.
47792 + ***************************************************************************/
47793 +int BpGetPppFailLedGpio( unsigned short *pusValue );
47794 +
47795 +/**************************************************************************
47796 + * Name       : BpGetVoipLedGpio
47797 + *
47798 + * Description: This function returns the GPIO pin assignment for the VOIP
47799 + *              LED.
47800 + *
47801 + * Parameters : [OUT] pusValue - Address of short word that the VOIP LED
47802 + *                  GPIO pin is returned in.
47803 + *
47804 + * Returns    : BP_SUCCESS - Success, value is returned.
47805 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47806 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47807 + *                  for the board.
47808 + ***************************************************************************/
47809 +int BpGetVoipLedGpio( unsigned short *pusValue );
47810 +
47811 +/**************************************************************************
47812 + * Name       : BpGetBootloaderPowerOnLedGpio
47813 + *
47814 + * Description: This function returns the GPIO pin assignment for the power
47815 + *              on LED that is set by the bootloader.
47816 + *
47817 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
47818 + *                  GPIO pin is returned in.
47819 + *
47820 + * Returns    : BP_SUCCESS - Success, value is returned.
47821 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47822 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47823 + *                  for the board.
47824 + ***************************************************************************/
47825 +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue );
47826 +
47827 +/**************************************************************************
47828 + * Name       : BpGetBootloaderAlarmLedGpio
47829 + *
47830 + * Description: This function returns the GPIO pin assignment for the alarm
47831 + *              LED that is set by the bootloader.
47832 + *
47833 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
47834 + *                  GPIO pin is returned in.
47835 + *
47836 + * Returns    : BP_SUCCESS - Success, value is returned.
47837 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47838 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47839 + *                  for the board.
47840 + ***************************************************************************/
47841 +int BpGetBootloaderAlarmLedGpio( unsigned short *pusValue );
47842 +
47843 +/**************************************************************************
47844 + * Name       : BpGetBootloaderResetCfgLedGpio
47845 + *
47846 + * Description: This function returns the GPIO pin assignment for the reset
47847 + *              configuration LED that is set by the bootloader.
47848 + *
47849 + * Parameters : [OUT] pusValue - Address of short word that the reset
47850 + *                  configuration LED GPIO pin is returned in.
47851 + *
47852 + * Returns    : BP_SUCCESS - Success, value is returned.
47853 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47854 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47855 + *                  for the board.
47856 + ***************************************************************************/
47857 +int BpGetBootloaderResetCfgLedGpio( unsigned short *pusValue );
47858 +
47859 +/**************************************************************************
47860 + * Name       : BpGetBootloaderStopLedGpio
47861 + *
47862 + * Description: This function returns the GPIO pin assignment for the break
47863 + *              into bootloader LED that is set by the bootloader.
47864 + *
47865 + * Parameters : [OUT] pusValue - Address of short word that the break into
47866 + *                  bootloader LED GPIO pin is returned in.
47867 + *
47868 + * Returns    : BP_SUCCESS - Success, value is returned.
47869 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47870 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47871 + *                  for the board.
47872 + ***************************************************************************/
47873 +int BpGetBootloaderStopLedGpio( unsigned short *pusValue );
47874 +
47875 +/**************************************************************************
47876 + * Name       : BpGetWirelessExtIntr
47877 + *
47878 + * Description: This function returns the Wireless external interrupt number.
47879 + *
47880 + * Parameters : [OUT] pulValue - Address of short word that the wireless
47881 + *                  external interrupt number is returned in.
47882 + *
47883 + * Returns    : BP_SUCCESS - Success, value is returned.
47884 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47885 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47886 + *                  for the board.
47887 + ***************************************************************************/
47888 +int BpGetWirelessExtIntr( unsigned long *pulValue );
47889 +
47890 +/**************************************************************************
47891 + * Name       : BpGetAdslDyingGaspExtIntr
47892 + *
47893 + * Description: This function returns the ADSL Dying Gasp external interrupt
47894 + *              number.
47895 + *
47896 + * Parameters : [OUT] pulValue - Address of short word that the ADSL Dying Gasp
47897 + *                  external interrupt number is returned in.
47898 + *
47899 + * Returns    : BP_SUCCESS - Success, value is returned.
47900 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47901 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47902 + *                  for the board.
47903 + ***************************************************************************/
47904 +int BpGetAdslDyingGaspExtIntr( unsigned long *pulValue );
47905 +
47906 +/**************************************************************************
47907 + * Name       : BpGetVoipExtIntr
47908 + *
47909 + * Description: This function returns the VOIP external interrupt number.
47910 + *
47911 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
47912 + *                  external interrupt number is returned in.
47913 + *              [IN] dspNum - Address of the DSP to query.
47914 + *
47915 + * Returns    : BP_SUCCESS - Success, value is returned.
47916 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47917 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47918 + *                  for the board.
47919 + ***************************************************************************/
47920 +int BpGetVoipExtIntr( unsigned char dspNum, unsigned long *pulValue );
47921 +
47922 +/**************************************************************************
47923 + * Name       : BpGetHpnaExtIntr
47924 + *
47925 + * Description: This function returns the HPNA external interrupt number.
47926 + *
47927 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
47928 + *                  external interrupt number is returned in.
47929 + *
47930 + * Returns    : BP_SUCCESS - Success, value is returned.
47931 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47932 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47933 + *                  for the board.
47934 + ***************************************************************************/
47935 +int BpGetHpnaExtIntr( unsigned long *pulValue );
47936 +
47937 +/**************************************************************************
47938 + * Name       : BpGetHpnaChipSelect
47939 + *
47940 + * Description: This function returns the HPNA chip select number.
47941 + *
47942 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
47943 + *                  chip select number is returned in.
47944 + *
47945 + * Returns    : BP_SUCCESS - Success, value is returned.
47946 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47947 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47948 + *                  for the board.
47949 + ***************************************************************************/
47950 +int BpGetHpnaChipSelect( unsigned long *pulValue );
47951 +
47952 +/**************************************************************************
47953 + * Name       : BpGetVoipChipSelect
47954 + *
47955 + * Description: This function returns the VOIP chip select number.
47956 + *
47957 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
47958 + *                  chip select number is returned in.
47959 + *              [IN] dspNum - Address of the DSP to query.
47960 + *
47961 + * Returns    : BP_SUCCESS - Success, value is returned.
47962 + *              BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
47963 + *              BP_VALUE_NOT_DEFINED - At least one return value is not defined
47964 + *                  for the board.
47965 + ***************************************************************************/
47966 +int BpGetVoipChipSelect( unsigned char dspNum, unsigned long *pulValue );
47967 +
47968 +#endif /* __ASSEMBLER__ */
47969 +
47970 +#if __cplusplus
47971 +}
47972 +#endif
47973 +
47974 +#endif /* _BOARDPARMS_H */
47975 +
47976 --- linux-2.6.8.1/scripts/kconfig/mconf.c       2004-08-14 12:54:51.000000000 +0200
47977 +++ linux-2.6.8.1-brcm63xx/scripts/kconfig/mconf.c      2006-06-26 10:07:52.000000000 +0200
47978 @@ -88,7 +88,7 @@
47979  static int indent;
47980  static struct termios ios_org;
47981  static int rows = 0, cols = 0;
47982 -static struct menu *current_menu;
47983 +struct menu *current_menu; /* Fails while cross-compiling if keeping static */
47984  static int child_count;
47985  static int do_resize;
47986  static int single_menu_mode;
47987 --- linux-2.6.8.1/Makefile      2004-08-14 12:55:35.000000000 +0200
47988 +++ linux-2.6.8.1-brcm63xx/Makefile     2006-06-26 10:43:09.000000000 +0200
47989 @@ -149,9 +149,7 @@
47990  # then ARCH is assigned, getting whatever value it gets normally, and 
47991  # SUBARCH is subsequently ignored.
47992  
47993 -SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
47994 -                                 -e s/arm.*/arm/ -e s/sa110/arm/ \
47995 -                                 -e s/s390x/s390/ -e s/parisc64/parisc/ )
47996 +SUBARCH := mips
47997  
47998  # Cross compiling and selecting different set of gcc/bin-utils
47999  # ---------------------------------------------------------------------------
48000 @@ -294,7 +292,7 @@
48001  
48002  NOSTDINC_FLAGS  = -nostdinc -iwithprefix include
48003  
48004 -CPPFLAGS        := -D__KERNEL__ -Iinclude \
48005 +CPPFLAGS        := -D__KERNEL__ -Iinclude -Ibcmdrivers/opensource/include/bcm963xx/ -Iboardparms/bcm963xx/ -Ibcmdrivers/broadcom/include/bcm963xx/ -Ibcmdrivers/broadcom/char/adsl/bcm96348\
48006                    $(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
48007  
48008  CFLAGS                 := -Wall -Wstrict-prototypes -Wno-trigraphs \
48009 @@ -405,6 +403,13 @@
48010  core-y         := usr/
48011  endif # KBUILD_EXTMOD
48012  
48013 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48014 +BRCMDRIVERS_DIR := $(TOPDIR)/bcmdrivers
48015 +export HPATH   := $(TOPDIR)/include
48016 +brcmdrivers-y  := $(TOPDIR)/boardparms/bcm963xx/ $(BRCMDRIVERS_DIR)/
48017 +BRCMDRIVERS    := $(brcmdrivers-y)
48018 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48019 +
48020  ifeq ($(dot-config),1)
48021  # In this section, we need .config
48022  
48023 @@ -473,6 +478,10 @@
48024  # makefile but the arguement can be passed to make if needed.
48025  #
48026  
48027 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48028 +INSTALL_MOD_PATH := $(PROFILE_DIR)/modules
48029 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48030 +
48031  MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
48032  export MODLIB
48033  
48034 @@ -480,18 +489,25 @@
48035  ifeq ($(KBUILD_EXTMOD),)
48036  core-y         += kernel/ mm/ fs/ ipc/ security/ crypto/
48037  
48038 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48039  vmlinux-dirs   := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
48040                      $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
48041 +                    $(brcmdrivers-y) $(brcmdrivers-m) \
48042                      $(net-y) $(net-m) $(libs-y) $(libs-m)))
48043  
48044  vmlinux-alldirs        := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
48045                      $(init-n) $(init-) \
48046                      $(core-n) $(core-) $(drivers-n) $(drivers-) \
48047 +                    $(brcmdrivers-n) $(brcmdrivers-) \
48048                      $(net-n)  $(net-)  $(libs-n)    $(libs-))))
48049 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48050  
48051  init-y         := $(patsubst %/, %/built-in.o, $(init-y))
48052  core-y         := $(patsubst %/, %/built-in.o, $(core-y))
48053  drivers-y      := $(patsubst %/, %/built-in.o, $(drivers-y))
48054 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48055 +brcmdrivers-y   := $(patsubst %/, %/built-in.o, $(brcmdrivers-y))
48056 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48057  net-y          := $(patsubst %/, %/built-in.o, $(net-y))
48058  libs-y1                := $(patsubst %/, %/lib.a, $(libs-y))
48059  libs-y2                := $(patsubst %/, %/built-in.o, $(libs-y))
48060 @@ -507,7 +523,8 @@
48061  #       we cannot yet know if we will need to relink vmlinux.
48062  #      So we descend into init/ inside the rule for vmlinux again.
48063  head-y += $(HEAD)
48064 -vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(net-y)
48065 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48066 +vmlinux-objs := $(head-y) $(init-y) $(core-y) $(libs-y) $(drivers-y) $(brcmdrivers-y) $(net-y)
48067  
48068  quiet_cmd_vmlinux__ = LD      $@
48069  define cmd_vmlinux__
48070 @@ -516,11 +533,13 @@
48071         $(core-y) \
48072         $(libs-y) \
48073         $(drivers-y) \
48074 +       $(brcmdrivers-y) \
48075         $(net-y) \
48076         --end-group \
48077         $(filter .tmp_kallsyms%,$^) \
48078         -o $@
48079  endef
48080 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48081  
48082  #      set -e makes the rule exit immediately on error
48083  
48084 @@ -603,9 +622,12 @@
48085         $(rule_verify_kallsyms)
48086  endef
48087  
48088 -vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
48089 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48090 +vmlinux: preparebrcmdriver $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
48091         $(call if_changed_rule,vmlinux)
48092  
48093 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48094 +
48095  #      The actual objects are generated when descending, 
48096  #      make sure no implicit rule kicks in
48097  
48098 @@ -626,7 +648,13 @@
48099  # A multi level approach is used. prepare1 is updated first, then prepare0.
48100  # prepare-all is the collection point for the prepare targets.
48101  
48102 -.PHONY: prepare-all prepare prepare0 prepare1 prepare2
48103 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48104 +.PHONY: prepare-all prepare prepare0 prepare1 prepare2 preparebrcmdriver
48105 +
48106 +preparebrcmdriver:
48107 +#      $(Q)$(MAKE) -C $(BRCMDRIVERS_DIR)/opensource symlinks
48108 +       $(Q)$(MAKE) -C $(BRCMDRIVERS_DIR)/broadcom symlinks
48109 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48110  
48111  # prepare 2 generate Makefile to be placed in output directory, if
48112  # using a seperate output directory. This allows convinient use
48113 @@ -743,7 +771,10 @@
48114  #      Build modules
48115  
48116  .PHONY: modules
48117 -modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
48118 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48119 +modules: preparebrcmdriver $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
48120 +#modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
48121 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48122         @echo '  Building modules, stage 2.';
48123         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
48124  
48125 @@ -754,23 +785,31 @@
48126  
48127  # Target to install modules
48128  .PHONY: modules_install
48129 -modules_install: _modinst_ _modinst_post
48130 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48131 +#modules_install: _modinst_ _modinst_post
48132 +#We have no need for it "_modinst_post"
48133 +modules_install: _modinst_ 
48134 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48135  
48136  .PHONY: _modinst_
48137  _modinst_:
48138 -       @if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
48139 -               echo "Warning: you may need to install module-init-tools"; \
48140 -               echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
48141 -               sleep 1; \
48142 -       fi
48143 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48144 +#      @if [ -z "`$(DEPMOD) -V | grep module-init-tools`" ]; then \
48145 +#              echo "Warning: you may need to install module-init-tools"; \
48146 +#              echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
48147 +#              sleep 1; \
48148 +#      fi
48149 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48150         @rm -rf $(MODLIB)/kernel
48151         @rm -f $(MODLIB)/source
48152         @mkdir -p $(MODLIB)/kernel
48153 -       @ln -s $(srctree) $(MODLIB)/source
48154 -       @if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
48155 -               rm -f $(MODLIB)/build ; \
48156 -               ln -s $(objtree) $(MODLIB)/build ; \
48157 -       fi
48158 +# CONFIG_MIPS_BRCM Begin Broadcom changed code 
48159 +#      @ln -s $(srctree) $(MODLIB)/source
48160 +#      @if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
48161 +#              rm -f $(MODLIB)/build ; \
48162 +#              ln -s $(objtree) $(MODLIB)/build ; \
48163 +#      fi
48164 +# CONFIG_MIPS_BRCM End Broadcom changed code.  
48165         $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
48166  
48167  # If System.map exists, run depmod.  This deliberately does not have a
48168 @@ -853,10 +892,12 @@
48169  clean: archclean $(clean-dirs)
48170         $(call cmd,rmdirs)
48171         $(call cmd,rmfiles)
48172 +# CONFIG_MIPS_BRCM Begin Broadcom changed code.
48173         @find . $(RCS_FIND_IGNORE) \
48174                 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
48175                 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
48176                 -type f -print | xargs rm -f
48177 +# CONFIG_MIPS_BRCM End Broadcom changed code.
48178  
48179  # mrproper - Delete all generated files, including .config
48180  #
48181 @@ -883,7 +924,7 @@
48182                 -o -name '.*.rej' -o -size 0 \
48183                 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
48184                 -type f -print | xargs rm -f
48185 -
48186 +       rm vmlinux.bin vmlinux.lz
48187  
48188  # Packaging of the kernel to various formats
48189  # ---------------------------------------------------------------------------