Altera_Forum
Honored Contributor
12 years agoFunctions Inclusion
Hello every body; I have created macros to deal with my hardware component and put them in a separate .c file, how can I include these macros in my main.c file. Thanks.
What you have are functions, not macros.
Create a file "altera_avalon_aes.h" with function declarations similar to the codes at the end of this post. Then include this altera_avalon_aes.h at the beginning of main.c and altera_avalon_aes.c. You can leave out the other# includes from altera_avalon_aes.c. Make sure altera_avalon_aes.c is a file in your project, but not# include in other files. The project will compile. //////////////////// # ifndef _MY_AESHEADER_ # define _MY_AESHEADER_ # include "system.h" # include "altera_avalon_aes_regs.h" # include <io.h> void Write_Array(alt_u8 array[4][4]); void Write_key1(alt_u8 array[4][8]); void Write_key2(alt_u8 array[4][8]); void Read_Array(alt_u8 array[4][4]); void Cipher128(alt_u8 InText[4][4],alt_u8 Cipherkey[4][8],alt_u8 OutText[4][4]); # endif /////////////////////////////////////