ARM Linux at91: installing Timer Controller Interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there, 

I'm trying to handle a timer interrupt within the at91 processor... 

The Problem is: nothing happens, my interrupt handler is never called... 

 Maybe someone here knows about the at91... 

this is my setup routine: 

static int __init ad_irq_init(void) 
{
 	unsigned int ret;
	
	printk(KERN_INFO "init timer");

	// unsigned int base, unsigned int reg_offset, unsigned long value

	// disable clock: 
	printk(KERN_INFO "ccr: %i\n", (unsigned int)at91_sys_read(AT91_TC_CCR) );
	at91_sys_write(AT91_TC_CCR,  (at91_sys_read(AT91_TC_CCR) | 2) );
	printk(KERN_INFO "ccr: %i\n", (unsigned int)at91_sys_read(AT91_TC_CCR) );

	// disable all interrupts: 
	at91_sys_write(AT91_TC_IDR, 0xFFFFFFFF  );

	// enable timer clock 5, reset counter and start clock
	at91_sys_write(AT91_TC_CMR, 0x4 |  0x4000 );

	// enable clock :
	at91_sys_write(AT91_TC_CCR, 0x1 );

	//  Enables the RC Compare Interrupt. :
	at91_sys_write(AT91_TC_IER, 0x10 );


	// set isr
	//at91_sys_write( AT91_AIC_SVR(6), timer_interrupt);
	// setup_irq(AT91_ID_TC0, &timer_interrupt);
	if (request_irq(AT91_ID_TC0, (void *)ad_irq_interrupt, SA_INTERRUPT
,AD_IRQ_DEVICE_NAME, NULL)) {
        	printk(KERN_ERR "ad_irq: irq alrdy claimed!\n");
		return -EIO;
    }

	// write something to timer register c (taken from sample code without OS
support):
	at91_sys_write( AT91_TC_RC , 0xFBC5 );

	at91_sys_write(AT91_TC_CCR , 0x4 );

	// set capture mode:
	at91_sys_write(AT91_TC_CMR,  (0 << 15) );

    return 0;
}

when i load the kernel module, it works fine (except that nothing
happens...). 
When i do unload dmesg says: 
Trying to free free IRQ17
ad_irq module removed.

then i do: 
cat /proc/interrupts
Segmentation fault

dmesg

Unable to handle kernel paging request at virtual address bf09e144
pgd = c1510000
[bf09e144] *pgd=21988011, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1]
Modules linked in: at91_wdt vfat fat jffs2 nls_iso8859_1 nls_cp437 nls_base
usb_                                   storage sd_mod sg scsi_mod dnp9200
cfi_cmdset_0001 cfi_probe cfi_util gen_probe                               
    chipreg mtdblock mtd_blkdevs mtdchar mtdpart mtdcore unix af_packet
zlib_inflate                                    zlib_deflate intermodule
CPU: 0
PC is at strnlen+0x1c/0x44
LR is at vsnprintf+0x310/0x5a4
pc : [<c00b846c>]    lr : [<c00b8fac>]    Tainted: P
sp : c1443e64  ip : c1443e74  fp : c1443e70
r10: c1518fff  r9 : c151805a  r8 : 00000000
r7 : ffffffff  r6 : c1443ed0  r5 : bf09e144  r4 : c151805c
r3 : c0156fb4  r2 : bf09e144  r1 : fffffffe  r0 : bf09e144
Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  Segment user
Control: C000317F  Table: 21510000  DAC: 00000015
Process cat (pid: 875, stack limit = 0xc1442198)
Stack: (0xc1443e64 to 0xc1444000)
3e60:          c1443eb4 c1443e74 c00b8fac c00b8460 0000000a 0000000a
ffffffff
3e80: 00000000 00000fa6 c014fe07 c0684360 00000011 c0684360 80000013
000411c0
3ea0: 00000000 00002000 c1443ec8 c1443eb8 c0086fc0 c00b8cac c1ac7b20
c1443f00
3ec0: c1443ed8 c001c74c c0086f98 c014fe04 bf09e144 0000005a 30555043
00002000
3ee0: c1443f00 c1443f18 0000004a c0684360 c1443f18 c1443f50 c1443f04
c00869d0
3f00: c001c698 c0684370 c0684378 c0684380 c1443f78 c0627120 00000011
00000000
3f20: 00000010 00000000 c0627120 000411c0 c1443f78 00002000 c1442000
c1442000
3f40: 0003a804 c1443f74 c1443f54 c0066d8c c008675c c0627140 c0627120
c1443f78
3f60: 00000000 00000000 c1443fa4 c1443f78 c0067110 c0066ce0 00000000
00000000
3f80: 00000000 00002000 00002000 000411c0 00000003 c001be64 00000000
c1443fa8
3fa0: c001bcc0 c00670d4 00002000 00002000 00000003 000411c0 00002000
00002000
3fc0: 00002000 00002000 000411c0 00000003 00000001 00000003 0003a804
ffffffff
3fe0: 00000000 becc5d38 00003744 400c6fd0 60000010 00000003 0003a230
000315e4
Backtrace:
[<c00b8450>] (strnlen+0x0/0x44) from [<c00b8fac>] (vsnprintf+0x310/0x5a4)
[<c00b8c9c>] (vsnprintf+0x0/0x5a4) from [<c0086fc0>] (seq_printf+0x3c/0x64)
[<c0086f84>] (seq_printf+0x0/0x64) from [<c001c74c>]
(show_interrupts+0xc4/0x13c                                   )
 r3 = 0000005A  r2 = BF09E144  r1 = C014FE04
 r4 = C1AC7B20
[<c001c688>] (show_interrupts+0x0/0x13c) from [<c00869d0>]
(seq_read+0x284/0x3dc                                   )
 r7 = C1443F18  r6 = C0684360  r5 = 0000004A  r4 = C1443F18
[<c008674c>] (seq_read+0x0/0x3dc) from [<c0066d8c>] (vfs_read+0xbc/0x174)
[<c0066cd0>] (vfs_read+0x0/0x174) from [<c0067110>] (sys_read+0x4c/0x74)
 r8 = 00000000  r7 = 00000000  r6 = C1443F78  r5 = C0627120
 r4 = C0627140
[<c00670c4>] (sys_read+0x0/0x74) from [<c001bcc0>]
(ret_fast_syscall+0x0/0x2c)
 r8 = C001BE64  r7 = 00000003  r6 = 000411C0  r5 = 00002000
 r4 = 00002000
Code: e2411001 e3710001 e1a02000 0a000007 (e5d23000)

Maybe someone can help me on this issue or point me at an misstake? Maybe I
missunderstood the at91_sys_write() function?  

Cheers,

Ole



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux