annotate packages/devs/eth/arm/netarm/current/src/netarm_eth_drv.c @ 2105:e7d311287dec

* Fixed data alignment problems. Cleaned up the naming of functions to avoid name space pollution. Us the HAL macros to access the hardware
author asl
date Wed, 23 Nov 2005 21:12:40 +0000
parents e256aea3e373
children 74dbf4c3f2e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
1 //==========================================================================
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
2 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
3 // netarm_eth_drv.c
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
4 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
5 // NetSilion NET+ARM Ethernet Driver (DMA driven)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
6 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
7 //==========================================================================
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
8 //####ECOSGPLCOPYRIGHTBEGIN####
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
9 // -------------------------------------------
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
11 // Copyright (C) 2005 eCosCentric Ltd.
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
12 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
13 // eCos is free software; you can redistribute it and/or modify it under
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
14 // the terms of the GNU General Public License as published by the Free
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
15 // Software Foundation; either version 2 or (at your option) any later version.
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
16 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
20 // for more details.
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
21 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
22 // You should have received a copy of the GNU General Public License along
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
23 // with eCos; if not, write to the Free Software Foundation, Inc.,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
25 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
26 // As a special exception, if other files instantiate templates or use macros
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
27 // or inline functions from this file, or you compile this file and link it
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
28 // with other works to produce a work based on this file, this file does not
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
29 // by itself cause the resulting work to be covered by the GNU General Public
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
30 // License. However the source code for this file must still be made available
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
31 // in accordance with section (3) of the GNU General Public License.
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
32 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
33 // This exception does not invalidate any other reasons why a work based on
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
34 // this file might be covered by the GNU General Public License.
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
35 //
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
36 // -------------------------------------------
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
37 //####ECOSGPLCOPYRIGHTEND####
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
38 //==========================================================================
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
39 //#####DESCRIPTIONBEGIN####
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
40 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
41 // Author(s): Harald Brandl (harald.brandl@fh-joanneum.at)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
42 // Contributors: Harald Brandl
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
43 // Date: 01.08.2004
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
44 // Purpose: NET+ARM Ethernet Driver (DMA driven)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
45 // Description:
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
46 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
47 //####DESCRIPTIONEND####
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
48 //
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
49 //==========================================================================
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
50
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
51 #include <cyg/infra/cyg_type.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
52 #include <cyg/hal/hal_arch.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
53 #include <cyg/infra/diag.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
54 #include <cyg/hal/drv_api.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
55 #include <cyg/io/eth/netdev.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
56 #include <cyg/io/eth/eth_drv.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
57
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
58 #include <pkgconf/devs_eth_arm_netarm.h>
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
59 #include <cyg/hal/hal_platform_ints.h>
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
60 #include <cyg/hal/plf_mmap.h>
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
61 #include "eth_regs.h"
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
62 #include "MII.h"
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
63 #include "netarm_eth_drv.h"
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
64 #include "eeprom.h"
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
65
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
66
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
67 #define BufferSizeA 128
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
68 #define BufferSizeB 512
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
69 #define BufferSizeC 1524
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
70
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
71 #define NumA 16
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
72 #define NumB 8
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
73 #define NumC 8
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
74
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
75 #define EEPROM_MAC 0 // location of MAC address inside eeprom
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
76
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
77
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
78 static cyg_mutex_t Key_Mutex;
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
79 static private_data_t driver_private;
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
80
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
81 static unsigned char RxBufferA[NumA][BufferSizeA] __attribute__ ((aligned (4)));
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
82 static unsigned char RxBufferB[NumB][BufferSizeB] __attribute__ ((aligned (4)));
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
83 static unsigned char RxBufferC[NumC][BufferSizeC] __attribute__ ((aligned (4)));
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
84
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
85 static unsigned char TxBuffer[1518] __attribute__ ((aligned (4)));
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
86
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
87 static BDP_t RxBDP_A[NumA];
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
88 static BDP_t RxBDP_B[NumB];
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
89 static BDP_t RxBDP_C[NumC];
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
90
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
91 static BDP_t TxBDP;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
92
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
93 // relocation pointer for data accessed by DMA to enable caching
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
94 static unsigned char *pRxBufferA = (unsigned char *)RxBufferA,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
95 *pRxBufferB = (unsigned char *)RxBufferB,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
96 *pRxBufferC = (unsigned char *)RxBufferC;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
97 static unsigned char *pTxBuffer = TxBuffer;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
98
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
99 static BDP_t *pRxBDP_A = RxBDP_A, *pRxBDP_B = RxBDP_B, *pRxBDP_C = RxBDP_C;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
100 static BDP_t *pTxBDP = &TxBDP;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
101
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
102
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
103 ETH_DRV_SC(netarm_sc,
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
104 (void *)&driver_private, // driver specific data
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
105 "eth0", // name for this interface
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
106 netarm_start,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
107 netarm_stop,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
108 netarm_control,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
109 netarm_can_send,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
110 netarm_send,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
111 netarm_recv,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
112 netarm_deliver,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
113 netarm_poll,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
114 netarm_int_vector);
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
115
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
116
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
117 NETDEVTAB_ENTRY(netarm_netdev,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
118 "ETH_DRV",
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
119 netarm_init,
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
120 &netarm_sc);
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
121
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
122
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
123 #ifdef __thumb__
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
124 #define fastcopy memcpy
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
125 #else
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
126 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
127 fastcopy(void *buf, void *data, unsigned long len)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
128 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
129 asm volatile(
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
130
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
131 "STMDB SP!, {R11};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
132
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
133 "TST R1, #2;" // test if aligned
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
134 "LDRNEH R3, [R1], #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
135 "STRNEH R3, [R0], #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
136 "SUBNE R2, R2, #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
137 "TST R1, #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
138 "LDRNEB R3, [R1], #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
139 "STRNEB R3, [R0], #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
140 "SUBNE R2, R2, #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
141
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
142 ".START%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
143
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
144 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
145 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
146 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
147 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
148 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
149
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
150 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
151 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
152 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
153 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
154 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
155
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
156 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
157 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
158 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
159 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
160 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
161
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
162 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
163 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
164 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
165 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
166 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
167
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
168 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
169 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
170 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
171 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
172 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
173
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
174 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
175 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
176 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
177 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
178 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
179
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
180 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
181 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
182 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
183 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
184 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
185
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
186 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
187 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
188 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
189 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
190 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
191
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
192 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
193 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
194 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
195 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
196 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
197
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
198 "CMP R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
199 "BLT .LASTBYTES%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
200 "LDMIA R1!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
201 "STMIA R0!, {R3 - R12, R14};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
202 "SUB R2, R2, #44;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
203
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
204 "BGE .START%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
205
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
206
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
207 ".LASTBYTES%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
208
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
209 "AND R14, R2, #0xfffffffc;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
210 "LDR PC, [PC, R14];"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
211 "NOP;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
212
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
213 ".SWITCH%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
214 ".word .CASE0%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
215 ".word .CASE1%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
216 ".word .CASE2%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
217 ".word .CASE3%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
218 ".word .CASE4%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
219 ".word .CASE5%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
220 ".word .CASE6%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
221 ".word .CASE7%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
222 ".word .CASE8%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
223 ".word .CASE9%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
224 ".word .CASE10%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
225
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
226 ".CASE0%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
227 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
228
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
229 ".CASE1%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
230 "LDMIA R1!, {R3};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
231 "STMIA R0!, {R3};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
232 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
233
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
234 ".CASE2%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
235 "LDMIA R1!, {R3, R4};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
236 "STMIA R0!, {R3, R4};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
237 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
238
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
239 ".CASE3%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
240 "LDMIA R1!, {R3 - R5};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
241 "STMIA R0!, {R3 - R5};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
242 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
243
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
244 ".CASE4%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
245 "LDMIA R1!, {R3 - R6};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
246 "STMIA R0!, {R3 - R6};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
247 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
248
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
249 ".CASE5%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
250 "LDMIA R1!, {R3 - R7};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
251 "STMIA R0!, {R3 - R7};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
252 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
253
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
254 ".CASE6%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
255 "LDMIA R1!, {R3 - R8};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
256 "STMIA R0!, {R3 - R8};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
257 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
258
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
259 ".CASE7%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
260 "LDMIA R1!, {R3 - R9};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
261 "STMIA R0!, {R3 - R9};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
262 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
263
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
264 ".CASE8%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
265 "LDMIA R1!, {R3 - R10};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
266 "STMIA R0!, {R3 - R10};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
267 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
268
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
269 ".CASE9%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
270 "LDMIA R1!, {R3 - R11};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
271 "STMIA R0!, {R3 - R11};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
272 "B .END%=;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
273
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
274 ".CASE10%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
275 "LDMIA R1!, {R3 - R12};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
276 "STMIA R0!, {R3 - R12};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
277
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
278 ".END%=:"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
279 "TST R2, #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
280 "LDRNEH R3, [R1], #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
281 "STRNEH R3, [R0], #2;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
282 "TST R2, #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
283 "LDRNEB R3, [R1], #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
284 "STRNEB R3, [R0], #1;"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
285
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
286 "LDMIA SP!, {R11};"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
287
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
288 :
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
289 : "r" (buf), "r" (data), "r" (len)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
290 : "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r14"
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
291 );
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
292 }
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
293 #endif
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
294
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
295 static bool
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
296 KeyBufferFull(private_data_t *pd)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
297 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
298 int tmp = 0;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
299
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
300 cyg_drv_mutex_lock(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
301
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
302 if((pd->key_head + 1) % MaxKeys == pd->key_tail)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
303 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
304 tmp = 1;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
305 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
306
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
307 cyg_drv_mutex_unlock(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
308
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
309 return tmp;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
310 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
311
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
312
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
313 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
314 AddKey(unsigned long key, private_data_t *pd)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
315 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
316
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
317 cyg_drv_mutex_lock(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
318
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
319 pd->KeyBuffer[pd->key_head] = key;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
320 pd->key_head = (pd->key_head + 1) % MaxKeys;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
321
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
322 cyg_drv_mutex_unlock(&Key_Mutex);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
323 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
324
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
325 static unsigned
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
326 GetKey(private_data_t *pd)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
327 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
328 unsigned key = 0;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
329
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
330 cyg_drv_mutex_lock(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
331
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
332 if(pd->key_tail != pd->key_head)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
333 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
334 key = pd->KeyBuffer[pd->key_tail];
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
335 pd->key_tail = (pd->key_tail + 1) % MaxKeys;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
336 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
337
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
338 cyg_drv_mutex_unlock(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
339
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
340 return key;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
341 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
342
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
343
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
344 static cyg_uint32
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
345 dma_rx_isr(cyg_vector_t vector, cyg_addrword_t data)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
346 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
347
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
348 // block this interrupt until the dsr completes
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
349 cyg_drv_interrupt_mask(vector);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
350
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
351 // tell ecos to allow further interrupt processing
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
352 cyg_drv_interrupt_acknowledge(vector);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
353
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
354 return CYG_ISR_CALL_DSR; // call the dsr
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
355 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
356
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
357 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
358 dma_rx_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
359 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
360
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
361 eth_drv_dsr( vector, count, data );
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
362
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
363 HAL_WRITE_UINT32(DMA1A_SR, 0x80000000); // acknowledge and mask interrupts
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
364 HAL_WRITE_UINT32(DMA1B_SR, 0x80000000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
365 HAL_WRITE_UINT32(DMA1C_SR, 0x80000000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
366
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
367 cyg_drv_interrupt_unmask(vector);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
368 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
369
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
370 static cyg_uint32
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
371 dma_tx_isr(cyg_vector_t vector, cyg_addrword_t data)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
372 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
373
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
374 // block this interrupt until the dsr completes
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
375 cyg_drv_interrupt_mask(vector);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
376
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
377 // tell ecos to allow further interrupt processing
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
378 cyg_drv_interrupt_acknowledge(vector);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
379
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
380 return CYG_ISR_CALL_DSR; // invoke the dsr
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
381 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
382
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
383 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
384 dma_tx_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
385 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
386
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
387 eth_drv_dsr( vector, count, data );
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
388
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
389 HAL_OR_UINT32(DMA2_SR, 0x80000000); // acknowledge interrupt
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
390
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
391 cyg_drv_interrupt_unmask(vector);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
392 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
393
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
394 static void
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
395 setupDMA(void)
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
396 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
397 int i;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
398
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
399 /* map DMA shared data to non-cached ram */
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
400 #ifdef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
401 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBufferA, pRxBufferA, unsigned char *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
402 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBufferB, pRxBufferB, unsigned char *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
403 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBufferC, pRxBufferC, unsigned char *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
404
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
405 HAL_CACHED_TO_UNCACHED_ADDRESS(TxBuffer, pTxBuffer, unsigned char *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
406
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
407 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBDP_A, pRxBDP_A, BDP_t *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
408 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBDP_B, pRxBDP_B, BDP_t *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
409 HAL_CACHED_TO_UNCACHED_ADDRESS(RxBDP_C, pRxBDP_C, BDP_t *);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
410
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
411 HAL_CACHED_TO_UNCACHED_ADDRESS(TxBDP, pTxBDP, BDP_t * );
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
412 #endif
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
413
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
414 HAL_OR_UINT32(SYSCON, 0x40); // reset DMA module
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
415
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
416 for(i = 0; i < NumA; i++)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
417 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
418 pRxBDP_A[i].lo = ((unsigned)(pRxBufferA + i*BufferSizeA)) & 0x3fffffff;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
419 pRxBDP_A[i].hi = BufferSizeA;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
420 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
421
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
422 pRxBDP_A[i - 1].lo |= 0x80000000; // set W bit
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
423
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
424 for(i = 0; i < NumB; i++)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
425 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
426 pRxBDP_B[i].lo = ((unsigned)(pRxBufferB + i*BufferSizeB)) & 0x3fffffff;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
427 pRxBDP_B[i].hi = BufferSizeB;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
428 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
429
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
430 pRxBDP_B[i - 1].lo |= 0x80000000;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
431
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
432 for(i = 0; i < NumC; i++)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
433 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
434 pRxBDP_C[i].lo = ((unsigned)(pRxBufferC + i*BufferSizeC)) & 0x3fffffff;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
435 pRxBDP_C[i].hi = BufferSizeC;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
436 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
437
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
438 pRxBDP_C[i - 1].lo |= 0x80000000;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
439
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
440 HAL_AND_UINT32(SYSCON, ~0x40);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
441
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
442 HAL_WRITE_UINT32(DMA1A_BDP, (unsigned)pRxBDP_A);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
443 HAL_WRITE_UINT32(DMA1A_CR, 0x82000000); //burst transfer
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
444 HAL_WRITE_UINT32(DMA1A_SR, 0xa00000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
445
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
446 HAL_WRITE_UINT32(DMA1B_BDP, (unsigned)pRxBDP_B);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
447 HAL_WRITE_UINT32(DMA1B_CR, 0x82000000); //burst transfer
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
448 HAL_WRITE_UINT32(DMA1B_SR, 0xa00000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
449
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
450 HAL_WRITE_UINT32(DMA1C_BDP, (unsigned)pRxBDP_C);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
451 HAL_WRITE_UINT32(DMA1C_CR, 0x82000000); //burst transfer
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
452 HAL_WRITE_UINT32(DMA1C_SR, 0xa00000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
453
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
454
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
455 pTxBDP->lo = ((unsigned)pTxBuffer) & 0x3fffffff;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
456 pTxBDP->lo |= 0xa0000000; // set W and L bit
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
457
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
458 HAL_WRITE_UINT32(DMA2_BDP, (unsigned)pTxBDP);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
459 HAL_WRITE_UINT32(DMA2_CR, 0x86000000); //burst transfer
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
460 HAL_WRITE_UINT32(DMA2_SR, 0x800000);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
461 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
462
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
463
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
464 static bool
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
465 netarm_init(struct cyg_netdevtab_entry *tab)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
466 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
467 struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
468 cyg_bool duplex;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
469 static cyg_interrupt dma_rx_int_object, dma_tx_int_object;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
470 static cyg_handle_t dma_rx_int_handle, dma_tx_int_handle;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
471
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
472 #ifdef CYGSEM_DEVS_ETH_ARM_NETARM_ETH0_SET_ESA
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
473
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
474 unsigned char esa[6] = CYGDAT_DEVS_ETH_ARM_NETARM_ETH0_ESA;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
475 #else
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
476 unsigned char esa[6];
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
477
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
478 cyg_netarm_initI2C();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
479 cyg_netarm_eepromRead(0x50, EEPROM_MAC, esa, 6);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
480 #endif
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
481
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
482 // setup dma receiver
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
483 setupDMA();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
484
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
485 cyg_netarm_mii_reset();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
486 cyg_netarm_mii_negotiate(); // initialize PHY
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
487 duplex = cyg_netarm_mii_check_duplex();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
488
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
489 // Ethernet Controller Initializatition
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
490
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
491 // auto CRC, late collision retry
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
492 HAL_WRITE_UINT32(MACCR, 0x1c | (duplex << 1));
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
493 // insert MAC source address into ethernet frame
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
494 HAL_WRITE_UINT32(STLCR, 0x3);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
495 HAL_WRITE_UINT32(BtBIPGGapTimerR, 0x14); // standard values
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
496 HAL_WRITE_UINT32(NonBtBIPGGapTimerR, (0x9 << 7) | 0x11);// standard values
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
497 HAL_WRITE_UINT32(CollWinR, (0x37 << 8) | 0xf); // standard values
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
498 HAL_WRITE_UINT32(SAFR, 0x1); // broadcast mode
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
499 // dma mode, full duplex, enable pNA mode(needed for alignment)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
500 HAL_WRITE_UINT32(EthGenCR, 0x40400400 | (duplex << 16));
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
501
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
502 cyg_drv_interrupt_create(
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
503 CYGNUM_HAL_INTERRUPT_DMA1, // Interrupt Vector
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
504 0, // Interrupt Priority
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
505 (cyg_addrword_t)&netarm_sc, // Reference to Driver Instance
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
506 dma_rx_isr,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
507 dma_rx_dsr,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
508 &dma_rx_int_handle,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
509 &dma_rx_int_object);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
510
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
511 cyg_drv_interrupt_create(
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
512 CYGNUM_HAL_INTERRUPT_DMA2, // Interrupt Vector
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
513 0, // Interrupt Priority
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
514 (cyg_addrword_t)&netarm_sc, // Reference to Driver Instance
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
515 dma_tx_isr,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
516 dma_tx_dsr,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
517 &dma_tx_int_handle,
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
518 &dma_tx_int_object);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
519
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
520 cyg_drv_interrupt_attach(dma_rx_int_handle);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
521
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
522 cyg_drv_interrupt_attach(dma_tx_int_handle);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
523
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
524 cyg_mutex_init(&Key_Mutex);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
525
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
526 sc->funs->eth_drv->init(sc, esa);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
527
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
528 return true;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
529 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
530
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
531
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
532 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
533 netarm_recv(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list, int sg_len)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
534 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
535 int i, len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
536 private_data_t *pd = (private_data_t *)(sc->driver_private);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
537 unsigned char *data, *buf = pd->RxBuffer;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
538
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
539 for (i = 0; i < sg_len; i++) {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
540 data = (unsigned char *)(sg_list[i].buf);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
541 len = sg_list[i].len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
542 if(len)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
543 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
544 if(i == 1)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
545 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
546 buf += 2;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
547 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
548
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
549 fastcopy(data, buf, len);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
550 buf += len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
551 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
552 }
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
553 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
554
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
555
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
556 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
557 netarm_deliver(struct eth_drv_sc *sc)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
558 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
559 static int a = 0, b = 0, c = 0;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
560 unsigned key, rega, regb, regc;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
561 private_data_t *pd = (private_data_t *)(sc->driver_private);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
562
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
563
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
564 while((key = GetKey(pd)))
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
565 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
566 sc->funs->eth_drv->tx_done(sc, key, 0);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
567 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
568
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
569 while(pRxBDP_A[a].hi & 0x8000)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
570 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
571 pd->RxBuffer = (unsigned char *)(pRxBDP_A[a].lo & 0x1FFFFFFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
572 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
573 sc->funs->eth_drv->recv(sc, pRxBDP_A[a].hi & 0x7FFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
574 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
575 pRxBDP_A[a].hi = BufferSizeA;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
576 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
577 a = (a + 1) % NumA;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
578 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
579
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
580 while(pRxBDP_B[b].hi & 0x8000)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
581 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
582 pd->RxBuffer = (unsigned char *)(pRxBDP_B[b].lo & 0x1FFFFFFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
583 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
584 sc->funs->eth_drv->recv(sc, pRxBDP_B[b].hi & 0x7FFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
585 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
586 pRxBDP_B[b].hi = BufferSizeB;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
587 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
588 b = (b + 1) % NumB;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
589 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
590
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
591 while(pRxBDP_C[c].hi & 0x8000)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
592 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
593 pd->RxBuffer = (unsigned char *)(pRxBDP_C[c].lo & 0x1FFFFFFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
594 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
595 sc->funs->eth_drv->recv(sc, pRxBDP_C[c].hi & 0x7FFF);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
596 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
597 pRxBDP_C[c].hi = BufferSizeC;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
598 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
599 c = (c + 1) % NumC;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
600 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
601
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
602 HAL_READ_UINT32(DMA1A_SR, rega);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
603 HAL_READ_UINT32(DMA1B_SR, regb);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
604 HAL_READ_UINT32(DMA1C_SR, regc);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
605
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
606 if((rega & 0x20000000) || (regb & 0x20000000) || (regc & 0x20000000))
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
607 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
608 HAL_AND_UINT32(EthGenCR, ~0xc0000000); // reset Rx FIFO
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
609 HAL_OR_UINT32(EthGenCR, 0xc0000000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
610 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
611
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
612 HAL_WRITE_UINT32(DMA1A_SR, 0x20a00000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
613 HAL_WRITE_UINT32(DMA1B_SR, 0x20a00000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
614 HAL_WRITE_UINT32(DMA1C_SR, 0x20a00000);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
615 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
616
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
617
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
618 static int
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
619 netarm_can_send(struct eth_drv_sc *sc)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
620 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
621 private_data_t *pd = (private_data_t *)(sc->driver_private);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
622
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
623 if((pTxBDP->hi & 0x8000) || KeyBufferFull(pd))
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
624 return 0;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
625
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
626 return 1;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
627 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
628
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
629 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
630 netarm_send(struct eth_drv_sc *sc, struct eth_drv_sg *sg_list,
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
631 int sg_len, int total_len, unsigned long key)
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
632 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
633 private_data_t *pd = (private_data_t *)(sc->driver_private);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
634 int i, len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
635 unsigned char *data, *buf = pTxBuffer;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
636
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
637 AddKey(key, pd);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
638
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
639 // Put data into buffer
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
640 for(i = 0; i < sg_len; i++) {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
641 data = (unsigned char *)sg_list[i].buf;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
642 len = sg_list[i].len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
643
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
644 if(len)
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
645 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
646 if(((unsigned)buf & 0x3) != ((unsigned)data & 0x3))
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
647 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
648 memcpy(buf, data, len);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
649 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
650 else
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
651 {
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
652 fastcopy(buf, data, len);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
653 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
654
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
655 buf += len;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
656 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
657 }
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
658
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
659 cyg_drv_dsr_lock();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
660 pTxBDP->hi = total_len | 0x8000;
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
661 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
662 HAL_OR_UINT32(DMA2_SR, 0xf0000000);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
663 cyg_drv_dsr_unlock();
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
664 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
665
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
666
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
667 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
668 netarm_start(struct eth_drv_sc *sc, unsigned char *enaddr, int flags)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
669 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
670 setMAC(enaddr); // set MAC address
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
671 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
672 HAL_OR_UINT32(EthGenCR, 0x80800000); // enable Rx und Tx FIFO
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
673 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
674 cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_DMA1);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
675 cyg_drv_interrupt_unmask(CYGNUM_HAL_INTERRUPT_DMA2);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
676 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
677
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
678 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
679 netarm_stop(struct eth_drv_sc *sc)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
680 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
681 HAL_AND_UINT32(EthGenCR, 0x7f7fffff);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
682 HAL_REORDER_BARRIER();
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
683 cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_DMA1);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
684 cyg_drv_interrupt_mask(CYGNUM_HAL_INTERRUPT_DMA2);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
685 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
686
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
687 static int
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
688 netarm_control(struct eth_drv_sc *sc, unsigned long key, void *data, int len)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
689 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
690 return -1;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
691 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
692
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
693 static void
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
694 netarm_poll(struct eth_drv_sc *sc)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
695 {
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
696 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
697
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
698 static int
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
699 netarm_int_vector(struct eth_drv_sc *sc)
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
700 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
701 return CYGNUM_HAL_INTERRUPT_DMA1;
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
702 }
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
703
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
704 static void
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
705 setMAC(unsigned char *esa)
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
706 {
2105
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
707 HAL_WRITE_UINT32(SAR1, (esa[1] << 8) | esa[0]); // set MAC address
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
708 HAL_WRITE_UINT32(SAR2, (esa[3] << 8) | esa[2]);
e7d311287dec * Fixed data alignment problems. Cleaned up the naming of
asl
parents: 1986
diff changeset
709 HAL_WRITE_UINT32(SAR3, (esa[5] << 8) | esa[4]);
1986
e256aea3e373 * First import of an ethernet device driver for the NETARM
asl
parents:
diff changeset
710 }