Some kernel library function doubts
I am trying to learn how to write a device driver for an input device. As a start I tried to understand the actual device driver code written for linux 2.6.9 kernel. It is always good to follow masters in programming . I understood some parts of the code . But I got stuck with some library functions and macros . Hope you masters can shed some light in to my doubts.
1. What is time_after() function ? It is used in the actual serial mouse driver for kernel 2.6.9. Below given is the line where it is used
if (time_after(jiffies, my_mouse->last + HZ/10))
my_mouse->count = 0;
I tried to get the logic behind the line but I failed to do so . I read that jiffies is a global variable that increase with every time tick starting from system log on. Can anybody help me to understand the logic behind this line.
2. There is a mouse connect function which is called whenever we connect a serial mouse to the serial port. The function takes two arguments, a pointer to struct serio and struct serio_drv. This struct serio pointer is used throughout the connect function but we are not initializing it anywhere. So What I understand is that when we connect the serial mouse the input sub system automatically initializes this structure with the details of the mouse we connected so that the driver program can use these details to select the protocol and type of mouse. I just want a conformation from you that what I understand is right (I hope so) .
3. in serio.h headerfile there are some macros defined. like
#define SERIO_TYPE 0xff000000UL
#define SERIO_PROTO 0xFFUL
In the both definition the label UL is used which I believe(?) stands for unsigned long. What my doubt is that why ff (small letter) and FF(capital letter ) is used . What is the difference between these two .
4. What is the need of macro BTN_EXTRA, BTN_SIDE when we have BTN_LEFT,BTN_RIGHT,BTN_MIDDLE. These macros are defined in headerfile linux/input.h
Sorry if the way I asked my questine is not right. My english is not that great . Can anyone help me to understand these points. Thanking you...