Netboot Mailing List (by thread)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modifying bootp request





I use several hardware identical diskless clients. All of them should boot the same image, but client '1' should get the specific IP x.x.x.1, client '2' IP x.x.x.2 and so on.
To be able to exchange the client clients quickly, we don't wan't to use the MAC addresses of the network cards to identify the clients. I like to use a small plug to put on the parport, each configured with a specific client number. So I can simply replace the client with a new one, attatch the parport-ID-box, turn it on and be happy.

Well, to use this, I have to write a byte to the parport, read it back and include the result into the bootp request.
My code I wrote for a simple test, using gcc as compiler looks like:
______________________________________________________________________________
#ifndef ParPortTest
#define ParPortTest
#define ParPortTest_RCS_ID "$Id: $"
#define ParPortTest_RCS_REVISION "$Revision: $"
/*------------------------------------------------------------*\
 *	ParPortTest
 *	Author:		Norbert Pfistner
 *	Date:		Die Jul 02 14:26:29 2002
 *	Purpose:	Read ParPort-Switch 
 *	Description:
 *		Set DIP switches sink S4-S7 to ground if C2 is low.
 *		S7 S6 S5 S4	result (in hex and int)
 *		 0  0  0  0	0x00	0
 *		 0  0  0  1	0x01	1
 *		 0  0  1  0	0x02	2
 *		 0  0  1  1	0x03	3
 *		 :  :  :  :	  :     :
 *		 1  1  1  0	0x0e	14
 *		 1  1  1  1	0x0f	15
\*------------------------------------------------------------*/
#include <stdio.h>
#include <asm/io.h>

#define BASE (0x378)

int main (void){
  int i;
  int port;
  unsigned char aByte;
  
  ioperm(BASE,4,1);   		//-- Linux specific: get access to I/O-Ports below 0x3ff

  outb(0xc0, BASE+2);		//-- set Init (C2) to low to activate switch
  aByte = inb(BASE+1);		//-- read inverted status register
  aByte = aByte ^ 0x70;		//-- invert S4-S6 (S7 is already inverted)
  aByte = aByte >> 4;		//-- shift S0-S3 away
  
  printf("0x%02x\t%d\n",aByte, (unsigned int)aByte); //-- print the result

  return 1;
}


#endif /* ParPortTest */
______________________________________________________________________________


I tried outb and inb, but it seems they are not defined within bootrom/ and it's includes.

Can anybody give me some hints? 
Maybe also where there best place in the bootp request is for the result?

Greetings,
Norbert


--------------------------------------------------------------- 
TWI GmbH                          Tel:    +49 721 950 77-46 
Dipl.-Ing. Norbert Pfistner       Fax:    +49 721 57 48 32 
Industriestr. 6                   E-Mail: Pfistner@TWI-germany.com 
D-76189 Karlsruhe                 WWW:    www.TWI-germany.com 
 

===========================================================================
This Mail was sent to netboot mailing list by:
"Pfistner, Norbert" <Pfistner@TWI-Germany.com>
To get help about this list, send a mail with 'help' as the only string in
it's body to majordomo@baghira.han.de. If you have problems with this list,
send a mail to netboot-owner@baghira.han.de.



For requests or suggestions regarding this mailing list archive please write to netboot@gkminix.han.de.