Skip to content

Commit c052358

Browse files
author
Ronnie Beck
committed
- Added Serial Number as the basis for a MAC Address
- Removed the fixed buffer address (no longer needed for debugging)
1 parent b43ca5a commit c052358

4 files changed

Lines changed: 42 additions & 37 deletions

File tree

source/device.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -293,32 +293,27 @@ ASM SAVEDS LONG DevOpen( ASMR(a1) struct IOSana2Req *ioreq ASMREG(a1),
293293
char macAddress[6] = { 0x06,0x80,0x11,0x01,0x02,0x03};
294294
UWORD *lastTwoOctets = &macAddress[4];
295295
*lastTwoOctets = RangeRand( 0xffff );
296-
// STRPTR iconName = "v4net.device";
297-
// struct DiskObject *diskObject = GetDiskObject( iconName );
298-
// if( diskObject )
299-
// {
300-
// STRPTR macString = FindToolType( diskObject->do_ToolTypes, (STRPTR)"mac" );
301-
// if( macString )
302-
// {
303-
// D(( "[OpenDev] Mac address: %s\n", macString ));
304-
// //struct Library *SysBase = SysBase;
305-
// //sprintf( macString, "%x:%x:%x:%x:%x:%x", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5] );
306-
// //stringToMACAddress( macString, addr );
307-
// //sscanf( macString, "%02X:%02X:%02X:%02X:%02X:%02X", &macAddress[0], &macAddress[1], &macAddress[2], &macAddress[3], &macAddress[4], &macAddress[5] );
308-
// }
309-
// }
310296
hw_SetMacAddress( db, unit, macAddress );
311297
#else
312298
char MACAddressStr[32];
313299
LONG variableLength = GetVar( "V4NETMAC", MACAddressStr, sizeof( MACAddressStr ), GVF_GLOBAL_ONLY|GVF_LOCAL_ONLY );
314-
char macAddress[6] = { 0x06,0x80,0x11,0x01,0x02,0x03};
315-
if( variableLength == 2 )
316-
{
317-
macParserLastOctet( macAddress, MACAddressStr, variableLength );
318-
}else if( variableLength == 17 )
319-
{
320-
macParser( macAddress, MACAddressStr, variableLength );
321-
}
300+
char macAddress[6] = { 0x06,0x80,0x11,0x01,0x02,0x03 };
301+
302+
//See if we have an FPGA-ID
303+
ULONG *SN_LO = 0x00DFF3F0;
304+
ULONG *SN_HI = 0x00DFF3F4;
305+
306+
if( variableLength == 2 )
307+
{
308+
macParserLastOctet( macAddress, MACAddressStr, variableLength );
309+
}else if( variableLength == 17 )
310+
{
311+
macParser( macAddress, MACAddressStr, variableLength );
312+
}else if( *SN_LO != 0 )
313+
{
314+
memcpy( &macAddress[ 2 ], SN_LO, 4 );
315+
}
316+
322317
hw_SetMacAddress( db, unit, macAddress );
323318
#endif
324319

source/server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ static LONG server_readqueue( DEVBASEP, ULONG unit)
905905
LONG framesize;
906906
LONG frametype;
907907
LONG dropflag;
908-
UBYTE maxReads = 10;
908+
UBYTE maxReads = 5;
909909
LONG returnCode = SERR_OK;
910910

911911
//Obtain the semaphore

source/v4net/hw.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ extern void KGetChar(void);
3131
#define VREG_BOARD_V1200 6
3232
#define VREG_BOARD_V4MC 7
3333

34+
//Use this for debugging the DMA buffer
35+
//It will put the buffer at address 0x0f000000
36+
#define FIXED_BUFFER_ADDRESS 0
37+
3438
#define V_V4NET 5
3539
#define PORTID V_V4NET /* this is 5, update vampire/vampire.h if necessary */
3640

@@ -170,18 +174,8 @@ ASM SAVEDS LONG hw_GetMacAddress( ASMR(a0) DEVBASEP ASMREG(a0),
170174
{
171175
UBYTE vsn[8];
172176
LONG i;
173-
#if 0
174-
if( vampire_UUID( vsn ) > 0 )
175-
{
176-
for(i=0 ; i<3 ; i++ )
177-
{
178-
addr[3+i] = vsn[i] ^ vsn[i+5];
179-
}
180-
}
181-
#endif
182177
for( i=0 ; i<6 ; i++ )
183178
mac[i] = addr[i];
184-
185179
return 1;
186180
}
187181

@@ -194,9 +188,18 @@ ASM SAVEDS LONG hw_SetMacAddress( ASMR(a0) DEVBASEP ASMREG(a0),
194188
{
195189
LONG i;
196190

191+
#if 0
192+
if( vampire_UUID( vsn ) > 0 )
193+
{
194+
for(i=0 ; i<3 ; i++ )
195+
{
196+
addr[3+i] = vsn[i] ^ vsn[i+5];
197+
}
198+
}
199+
#endif
200+
197201
for( i=0 ; i<6 ; i++ )
198202
addr[i] = mac[i];
199-
200203
return 1;
201204
}
202205

@@ -219,9 +222,12 @@ ASM SAVEDS LONG hw_Setup( ASMR(a0) DEVBASEP ASMREG(a0) )
219222
ret = 1;
220223
}
221224

222-
//hwd->hwd_mem = AllocVec( MEMSIZE + 2048, MEMF_FAST );
225+
#if FIXED_BUFFER_ADDRESS != 0
223226
hwd->hwd_mem = AllocAbs( MEMSIZE*4, 0x0f000000 );
224227
hwd->hwd_mem += MEMSIZE*2 + 2048;
228+
#else
229+
hwd->hwd_mem = AllocVec( MEMSIZE + 2048, MEMF_FAST );
230+
#endif
225231
if( hwd->hwd_mem )
226232
{
227233
ULONG aln = (ULONG)hwd->hwd_mem;
@@ -249,7 +255,11 @@ ASM SAVEDS void hw_Shutdown( ASMR(a0) DEVBASEP ASMREG(a0) )
249255

250256
if( hwd->hwd_mem )
251257
{
258+
#if FIXED_BUFFER_ADDRESS != 0
259+
FreeMem( 0x0f000000, MEMSIZE*4 );
260+
#else
252261
FreeVec( hwd->hwd_mem );
262+
#endif
253263
hwd->hwd_mem = (0);
254264
}
255265

source/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#define _INC_VERSION_H
1010

1111
#define DEVICEVERSION 2
12-
#define DEVICEREVISION 30
12+
#define DEVICEREVISION 34
1313
#define DEVICEEXTRA 0
1414
/* #define DEVICEEXTRA Beta */
15-
#define DEVICEDATE 5.11.2022
15+
#define DEVICEDATE 22.1.2023
1616

1717
#endif

0 commit comments

Comments
 (0)