ioctl-gpio-int.h 2.06 KB
/*-----------------------------------------------------------------------------
  파 일 : gpio-int.h
  설 명 : gpio 인터럽트를 활성화 하고 인터럽트 발생을 app 에 알려주는 드라이버
  작 성 : freefrug@falinux.com
  날 짜 : 2010-03 ~
  주 의 :

-------------------------------------------------------------------------------*/
#ifndef _GPIO_INT_H_
#define _GPIO_INT_H_


/* 모듈관련 -------------------------------------------------------------------*/
#define     GPIO_INT_DRIVER_MAJOR      202

#ifdef MODULE


#endif


/* ioctl 함수의 command -------------------------------------------------------*/
#define		GPIO_INT_DRIVER_MAJOR_KEY         'g'
#define		IOCTL_REGISTER_GPIO_INT           _IOW( GPIO_INT_DRIVER_MAJOR_KEY, 0 , ioctl_arg_gpio_int_info_t )	
#define		IOCTL_UNREGISTER_GPIO_INT         _IOW( GPIO_INT_DRIVER_MAJOR_KEY, 1 , gpdesc_t )	
#define		IOCTL_ENABLE_EVENT                _IOW( GPIO_INT_DRIVER_MAJOR_KEY, 2 , gpdesc_t )	
#define		IOCTL_DISABLE_EVENT               _IOW( GPIO_INT_DRIVER_MAJOR_KEY, 3 , gpdesc_t )	

#define		IOCTL_WAIT_EVENT                  _IOR( GPIO_INT_DRIVER_MAJOR_KEY, 10, gpdesc_t )	
#define		IOCTL_WAIT_EVENT_TIMEOUT          _IOR( GPIO_INT_DRIVER_MAJOR_KEY, 11, ioctl_arg_gpio_wait_timeout_t )	
#define		IOCTL_NOWAIT_EVENT                _IOR( GPIO_INT_DRIVER_MAJOR_KEY, 12, gpdesc_t )	
#define		IOCTL_CLEAR_EVENT                 _IOW( GPIO_INT_DRIVER_MAJOR_KEY, 13, gpdesc_t )	



enum { 
	GPIO_INT_FALLING = 0, 
	GPIO_INT_RAISING = 1,
};

enum { 
	GPIO_PULL_NONE = 0, 
	GPIO_PULL_UP   = 1, 
	GPIO_PULL_DOWN = 2, 
};


	 
#define  MAKE_GPDESC( g, n )    ( ((g )<<24) | (n)    )
#define  GPDESC_TO_GRP( gd )    ( ((gd)>>24) & 0xff   )
#define  GPDESC_TO_NR(  gd )    (  (gd)      & 0xffff )


typedef unsigned int gpdesc_t;


typedef struct {
	
	gpdesc_t gpdesc;
	int   pull_updn;
	int   edge_type;
	
} ioctl_arg_gpio_int_info_t;


typedef struct {
	
	gpdesc_t gpdesc;
	int   msec;
	
} ioctl_arg_gpio_wait_timeout_t;



#endif  // _GPIO_INT_H_