cancel
Showing results for 
Search instead for 
Did you mean: 

Compile error!

tinkerBOY
Associate II

I have two files fifo.h and fifo.c:

#ifndef __FIFO_H__
#define __FIFO_H__
 
//#include <stdint.h>
 
typedef uint8_t FIFO_Data_t;
typedef uint8_t FIFO_Index_t;
 
typedef struct
{
    FIFO_Index_t SizeMask;   
    volatile FIFO_Index_t Head;
    volatile FIFO_Index_t Tail;
} FIFO;
 
#define FIFO_DECL(Name,Size)    FIFO_Data_t Name[Size+sizeof(FIFO)] = { Size-1 }
#define FIFO_BUF(X)             ((FIFO_Data_t *)&X[1])
#define FIFO_INC(INDEX,MOD1)    ((INDEX+1)&(MOD1))
 
void    FIFO_Clear(FIFO *Queue);
uint8_t FIFO_Write(FIFO *Queue, FIFO_Data_t data);
uint8_t FIFO_WriteAvail(FIFO *Queue);
uint8_t FIFO_Read(FIFO *Queue, FIFO_Data_t *data);
uint8_t FIFO_ReadAvail(FIFO *Queue);
uint8_t Getc(FIFO *Queue);
uint8_t Getc_Timeout(FIFO *Queue, FIFO_Data_t *data, uint16_t Timeout);
 
#define TIME_INFINITE 0
 
#endif /* __FIFO_H__ */
#include "fifo.h"
 
void FIFO_Clear(FIFO *Queue)
{
	Queue->Head = Queue->Tail = 0;
}
 
uint8_t FIFO_WriteAvail(FIFO *Queue)
{
  return(FIFO_INC(Queue->Head,Queue->SizeMask)!=Queue->Tail);
}
 
uint8_t FIFO_Write(FIFO *Queue, FIFO_Data_t data)
{
	if(FIFO_WriteAvail(Queue))
	{
		Queue->Head = FIFO_INC(Queue->Head,Queue->SizeMask);
		FIFO_BUF(Queue)[Queue->Head] = data;
		return 1;	
	}
	return 0;
}
 
uint8_t FIFO_ReadAvail(FIFO *Queue)
{
	return(Queue->Head != Queue->Tail);
}
 
uint8_t FIFO_Read(FIFO *Queue, FIFO_Data_t *data)
{
	if (FIFO_ReadAvail(Queue))
	{
		Queue->Tail = FIFO_INC(Queue->Tail,Queue->SizeMask);	
		*data = FIFO_BUF(Queue)[Queue->Tail];
		return 1;
	}
	return 0;	
}
 
uint8_t Getc(FIFO *Queue)
{
	uint8_t ch;
	
	while(!FIFO_Read(Queue,&ch))
	  /* busy wait */;
	
	return ch;
}
 
#if 0
uint8_t Getc_Timeout(FIFO *Queue, FIFO_Data_t *data, uint16_t Timeout)
{
	MicroTimer0=Timeout;
	
	while(!FIFO_Read(Queue,data))
	{
		if((Timeout!= TIME_INFINITE)&& !MicroTimer0)
			return 0;
	}
 
	return 1;
}
 
#endif

I keep getting these errors when compiling:

#error cpstm8 ps2_keyboard\fifo.h:6(8+7) missing ;
#error cpstm8 ps2_keyboard\fifo.h:21(30) bad proto argument type
#error cpstm8 ps2_keyboard\fifo.h:21(25+5) missing )
#error cpstm8 ps2_keyboard\fifo.h:21(49) missing ;
#error cpstm8 ps2_keyboard\fifo.h:23(29) bad proto argument type
#error cpstm8 ps2_keyboard\fifo.h:23(24+5) missing )
#error cpstm8 ps2_keyboard\fifo.h:23(31+11) missing ;
#error cpstm8 ps2_keyboard\fifo.h:26(32) bad proto argument type
#error cpstm8 ps2_keyboard\fifo.h:26(27+5) missing )
#error cpstm8 ps2_keyboard\fifo.c:26(70) missing ;
#error cpstm8 ps2_keyboard\fifo.c:5(30) missing ;
#error cpstm8 ps2_keyboard\fifo.c:10(60) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:17(53) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:18(2+11) missing )
#error cpstm8 ps2_keyboard\fifo.c:18(37) missing ;
#error cpstm8 ps2_keyboard\fifo.c:19(10) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:21(9) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:26(35) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:33(53) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:34(10) missing expression
#error cpstm8 ps2_keyboard\fifo.c:34(33+4) bad struct/union operand
#error cpstm8 ps2_keyboard\fifo.c:34(37) invalid pointer initializer
#error cpstm8 ps2_keyboard\fifo.c:34(38) missing ;
#error cpstm8 ps2_keyboard\fifo.c:35(10) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:37(9) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:42(11) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:45(18) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:47(10) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:64(0) incomplete declaration
#error cpstm8 ps2_keyboard\fifo.c:34(10+5) Queue undefined
ps2_keyboard\fifo.c:
 The command: "cxstm8 -iinc -ips2_keyboard +debug -pxp -no -l +mods0 -pp -i"C:\Program Files (x86)\COSMIC\FSE_Compilers\CXSTM8\Hstm8"  -clDebug\ -coDebug\ ps2_keyboard\fifo.c " has failed, the returned value is: 1
exit code=1.
 

1 REPLY 1
tinkerBOY
Associate II

Oops it looks like i missed to uncomment the line:

//#include <stdint.h>