2 pièce(s) jointe(s)
Probleme de programmation
Bonjour, je suis actuellement en stage, et j'ai un probleme que je n'arrive pas a resoudre...:
Je dois envoyer des donnees dans des buffers qui correspondent aux trois couleurs primaires, un traitement hardware vient ensuite tranformer ces trois couleurs en gris... mes fichiers .C et .H sont les suivants:
.C:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#include "xparameters.h"
#include "rgb2gray_sm_0.h"
#include "unistd.h"
int main (void) {
int i;
int gray, red, green, blue;
unsigned int RGB2GRAY_SM_0_RED,RGB2GRAY_SM_0_RED_DIN,RGB2GRAY_SM_0_GREEN,RGB2GRAY_SM_0_GREEN_DIN,RGB2GRAY_SM_0_BLUE,RGB2GRAY_SM_0_BLUE_DIN,RGB2GRAY_SM_0_RESULT, RGB2GRAY_SM_0_RESULT_DOUT;
print("-- Entering main() --\n\r");
for (i=15;i<30;i++){
red = i;
green = i+10;
blue = i+20;
// Write RGB value to peripheral
rgb2gray_sm_0_Write(RGB2GRAY_SM_0_RED,
RGB2GRAY_SM_0_RED_DIN, red);
rgb2gray_sm_0_Write(RGB2GRAY_SM_0_GREEN,
RGB2GRAY_SM_0_GREEN_DIN, green);
rgb2gray_sm_0_Write(RGB2GRAY_SM_0_BLUE,
RGB2GRAY_SM_0_BLUE_DIN, blue);
xil_printf("R = 0x%x, G = 0x%x, B = 0x%x -- ",
red, green, blue);
rgb2gray_sm_0_Read(RGB2GRAY_SM_0_RESULT,
RGB2GRAY_SM_0_RESULT_DOUT, &gray);
xil_printf("Gray = %x \n\r",gray);
}
print("-- Exiting main() --\n\r");
return 0;
} |
.H:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#ifndef rgb2gray_sm_0_H
#define rgb2gray_sm_0_H
class rgb2gray_sm_0 {
public:
int rgb2gray_sm_0_Write(unsigned int memName,unsigned int addr,unsigned int val);
int rgb2gray_sm_0_Read(unsigned int memName,unsigned int addr, unsigned int* val);
private:
}
#endif |
et le message d'erreur... est:
Citation:
In file included from /cygdrive/c/Armin/rgb2gray/rgb2gray_sm_0.c:11:
/cygdrive/c/Armin/rgb2gray/rgb2gray_sm_0.h:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rgb2gray_sm_0'
In file included from /cygdrive/c/Armin/rgb2gray/rgb2gray_sm_0.c:11:
/cygdrive/c/Armin/rgb2gray/rgb2gray_sm_0.h:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rgb2gray_sm_0'
In file included from /cygdrive/c/Armin/rgb2gray/rgb2gray.c:2:
/cygdrive/c/Armin/rgb2gray/rgb2gray_sm_0.h:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rgb2gray_sm_0'
Si vous avez une idee... je suis preneur!
Merci d'avance!
Toujours le meme probleme...
J'ai ajoute le point virgule, mais j'ai toujours le meme message d'erreur...
je n'ai pas compris ce que voulait dire mettre le code dans les balises... cela vient-il de la?