Forum Discussion
Altera_Forum
Honored Contributor
21 years agoconditional compilation ?
Hello. I'm working with two kits of development NIOSII. I wish to use the following conditional compilation in a common file (as user.h) : // --- choice of board ---------------...
Altera_Forum
Honored Contributor
21 years agoHi. Excuse me for the response time.
I had arrived at the same solution but I was not satisfied. I thus have modify the way of writing the address : # ifdef NIOSII_1 // adresse MAC de la carte en hexadecimal# define ADRESSE_MAC "01:02:03:04:05:06" # endif # ifdef NIOSII_2 // adresse MAC de la carte en hexadecimal# define ADRESSE_MAC "11:12:13:14:15:16" # endif and I have to create a function ether_aton(ADRESSE_MAC) : void ether_aton(char *pt_addr_ethernet) { int i ; int adresse_tmp[6] ; int *pt_int = adresse_tmp ; // conversion de la chaine ASCII en adresse MAC 48 bits i = sscanf(pt_addr_ethernet, " %02x:%02x:%02x:%02x:%02x:%02x", (pt_int + 0), (pt_int + 1), (pt_int + 2), (pt_int + 3), (pt_int + 4), (pt_int + 5)) ; // mise au format 8 bits des composantes de l'adresse MAC for (i = 0 ; i < 6 ; i++) { adresse_mac_ethernet = (unsigned char)(adresse_tmp) ; } } Thank you for all.