Just understanding, what you have done ..... pls answer my following inline points. On 3/29/06, Doron Bleiberg <kernel.doron@xxxxxxxxx> wrote: > Hi, > I'm trying to initialize the PIT such that it will call my designated ISR. > Listed down is my code. The problem is that my ISR is only being called once > and then never again. What I'm trying to reach is a timer interrupt to be > called at a 100Hz rate. Can eny one point me to what I'm doing wrong? What > am I missing here? > > The CODE: > ----------------- > #define HZ 100 > #define LATCH (1193180/HZ) /* 1193180Hz (1.19MHz) is the device input clock > */ > > > /* > * Initializing PIT (System Clock) > * Further information can be found at: > * http://www.mega-tokyo.com/osfaq2/index.php/PIT > * or pit.txt > */ > static void init_pit(void) { > outb_p(0x34, 0x43); > outb_p(LATCH & 0xFF, 0x40); > outb_p(LATCH >> 8, 0x40); > } > > #define _set_gate(gate_addr,type,dpl,addr) \ > __asm__ ("movw %%dx,%%ax\n\t" \ > "movw %0,%%dx\n\t" \ > "movl %%eax,%1\n\t" \ > "movl %%edx,%2" \ > : \ > : "i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ > "o" (*((char *) (gate_addr))), \ > "o" (*(4+(char *) (gate_addr))), \ > "d" ((char *) (addr)),"a" (0x00080000)) > > #define set_intr_gate(n,addr) \ > _set_gate(&_idt[n],14,0,addr) > > > static int inter_count = 0; > void interrupt_hdlr() { > k_clrscr(); > str_printk("interrupt "); /* print given string to screen */ > int_printk(inter_count++); /* print given integer to screen */ > > /*iret();*/ > } > what type of function is k_main(), from where it will be called or executed ?? > int k_main() { > > str_printk("Starting the kernel...\n"); /* print given string to screen > */ > init_pit(); > set_intr_gate(0x20,&interrupt_hdlr); /* 0x20 is mapped to > IRQ 0 which is connected to the output chanel of the PIT */ Dont u think you should first install the handler and then init the PIT > outb(0x20,0x21); > sti(); Are you assuming that interrupts will be disabled when you enter k_main() function, that is why I want to know what type of function is k_main(), from where the control will come here. As I can guess, this code is not dependent on any kernel rather its a small kernel inteself only handling the PIT interrupt and doing nothing else. Am I right ?? Gaurav > > while(1) > ; > > return 0; > } > > > > What I would like to see is a count of the times my interrupt_hdlr() ISR was > called. > > Any suggestions? > > -- > Respectfully yours, > > Doron Bleiberg > Tel-Aviv, Israel > Mobile: +972-54-7916711 > E-Mail: kernel.doron@xxxxxxxxx > -- -- -Gaurav Email: gauravd.chd@xxxxxxxxx --------------------------------- Read my blog at: http://lkdp.blogspot.com/ --------------------------------- -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/