www.pudn.com > AT91RM9200-BasicSPIKeyboard-ARM1_2-2_0.zip > keyboard.h


#ifndef AT91_KEYBOARD_H 
#define AT91_KEYBOARD_H 
 
#define MASTER_CLOCK	         60000000 
#define PS2_CLK	                 400000 
#define SPICLK_FOR_PS2	         (MASTER_CLOCK / (2*PS2_CLK)) 
 
 
#define BUFF_SIZE				    64		// Keyboard buffer size 
 
//* defines for keyboard 
#define AT91C_ISKEYBOARD_FRAME	    (1 << 6) 
#define AT91C_CAPSLOCK			    0x10 
#define AT91C_ISKEYUP				0x02 
#define AT91C_KEY_RELEASE			0 
#define AT91C_KEY_PRESSED			1 
 
//* defines for mouse 
#define AT91C_ISMOUSE_FRAME			0x40 
#define AT91C_BUTTON_UP			    0 
#define AT91C_BUTTON_CLICK		    1 
#define AT91C_LEFT_BUTTONCLICK	    0x01 
#define AT91C_RIGHT_BUTTONCLICK	    0x02 
#define AT91C_MIDDLE_BUTTONCLICK	0x04 
#define AT91C_MOUSE_XSIGN    	    0x08 
#define AT91C_MOUSE_YSIGN    	    0x10 
		 
#define  NULL	0 
 
 
typedef struct _AT91S_MOUSE{ 
	// Public Method: 
	// ============== 
	void (*Handler)(struct _AT91S_MOUSE *, unsigned char *); 
	int (*IsMouseMove) (struct _AT91S_MOUSE *); 
	int (*ReadMouse)(struct _AT91S_MOUSE *, int *); 
 
	// Following pointers are used to handle a circular buffer 
	int *pStartMousseBuffer; 
	int *pInMousseBuffer; 
	int *pOutMousseBuffer; 
	int  NbKey;	 
	 
}AT91S_MOUSE, *AT91PS_MOUSE; 
 
 
typedef struct _AT91S_KEYBOARD { 
	// Public Method: 
	// ============== 
	void (*Handler)(struct _AT91S_KEYBOARD *, unsigned char *); 
	int (*IsKeyPressed) (struct _AT91S_KEYBOARD *); 
	int (*ReadKey) (struct _AT91S_KEYBOARD *, char *); 
 
	// Following pointers are used to handle a circular buffer 
	char *pStartBuffer; 
	char *pInBuffer; 
	char *pOutBuffer; 
	int  NbKey;	 
	 
} AT91S_KEYBOARD, *AT91PS_KEYBOARD; 
 
typedef struct _AT91S_PS2CTRL { 
	AT91PS_KEYBOARD pSkeyBoard; 
	AT91PS_MOUSE    pSMouse; 
	 
	// Private data: 
	// ============= 
	char IsKeyToRead; 
	unsigned char *pPs2_Fifo;	 
		 
}AT91S_PS2CTRL, *AT91PS_PS2CTRL; 
 
#endif