Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Getting sysinterupt value ?
PostPosted: Fri Nov 30, 2007 6:06 pm 
Offline

Joined: Mon Nov 26, 2007 2:11 pm
Posts: 5
In the header file at91sam9263_oal_intr.h we cab read this:
Code:
/ the following values are used to compute the LOGINTR associated with a PIO pin.
// For example LOGINTR for PIOA pin 4 is LOGINTR_BASE_PIOA + 4
#define LOGINTR_BASE_PIOA         64
#define LOGINTR_BASE_PIOB         96                           
#define LOGINTR_BASE_PIOC         128
#define LOGINTR_BASE_PIOD         160
#define LOGINTR_BASE_PIOE         192                         

//////////////////////////////////////////////////////////////////////
//                         
// SYSINTR values
//
#define SYSINTR_SYS             (SYSINTR_FIRMWARE+0)
#define SYSINTR_ETHER         (SYSINTR_FIRMWARE+1)


My question is, touse my pio setted interupt with InterruptInitialize, the sysinterupt valur is
LOGINTR_BASE_PIOC+5 (for user button one in sam9263-ek)
or morelikely
SYSINTR_FIRMWARE+LOGINTR_BASE_PIOC+5 ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 03, 2007 10:02 am 
Offline

Joined: Fri May 14, 2004 9:58 am
Posts: 183
Location: France - USA
Hi,

If you want to use a PIO, you must use a sysinterrupt value like LOGINTR_BASE_PIOC+5.

Best Regards


Top
 Profile  
 
 Post subject: .
PostPosted: Mon Dec 03, 2007 11:43 am 
Offline

Joined: Mon Nov 26, 2007 2:11 pm
Posts: 5
Ok, now I assume i get the correct sysint value.
My question now is the following.
Is the wince 6.0 bianry bsp is configure to handle PIO interrupts ?
I set up the PIOC like this.

Code:
   PHYSICAL_ADDRESS PhysAddr = {0};
   AT91PS_PIO g_pPIO = NULL;
   AT91PS_PMC pPmc = NULL;
   AT91PS_AIC pAic = NULL;

// Get the virtual address of the PMC
   PhysAddr.LowPart = (DWORD) AT91C_BASE_PMC;
   PhysAddr.HighPart = 0;
   pPmc = (AT91PS_PMC) MmMapIoSpace(PhysAddr,sizeof(AT91PS_PMC),FALSE);

// Get the virtual address of the PIOC
   PhysAddr.LowPart = (DWORD) AT91C_BASE_PIOC;
   PhysAddr.HighPart = 0;
   g_pPIO = (AT91PS_PIO) MmMapIoSpace(PhysAddr,sizeof(AT91PS_PIO),FALSE);

// Get the virtual address of the AIC
   PhysAddr.LowPart = (DWORD) AT91C_BASE_AIC;
   PhysAddr.HighPart = 0;
   pAic = (AT91PS_AIC) MmMapIoSpace(PhysAddr,sizeof(AT91PS_AIC),FALSE);
   
   /* Enable the periph clock for the PIO controller */
   /* This is mandatory when PIO are configured as input */
   pPmc->PMC_PCER = (1 << AT91C_ID_PIOCDE);

   /* Set the PIO line in input */
   g_pPIO->PIO_ODR = AT91C_PIO_PC5;

   /* Set the PIO controller in PIO mode instead of peripheral mode */
   g_pPIO->PIO_PER = AT91C_PIO_PC5;

   /* Disable the interrupt on the interrupt controller */
   pAic->AIC_IDCR = (1 << AT91C_ID_PIOCDE);

   /* Store the Source Mode Register */
   pAic->AIC_SMR[AT91C_ID_PIOCDE] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | AT91C_AIC_PRIOR_LOWEST;

   /* Clear the interrupt on the interrupt controller */
   pAic->AIC_ICCR = (1 << AT91C_ID_PIOCDE);

   /* Enable button interrupts generation through the PIO controller */
   g_pPIO->PIO_IER = AT91C_ID_PIOCDE;

   /* Enable PIO interrupt in the interrupt controller */
   pAic->AIC_IECR = (1 << AT91C_ID_PIOCDE);

   MmUnmapIoSpace(pPmc,sizeof(AT91PS_PMC));
   MmUnmapIoSpace(g_pPIO,sizeof(AT91S_PIO));
   MmUnmapIoSpace(pAic,sizeof(AT91PS_AIC));   


Assuming that the sysint is the the good one (it's set as 128+5), I should handle some interupts in my IST when the buton is pressed. But nothing happens. Dis I miss somethnig in my PIO configuration ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 04, 2007 12:18 pm 
Offline

Joined: Fri May 14, 2004 9:58 am
Posts: 183
Location: France - USA
First, there is a mistake for MmmapIOSpace declarations. sizeof(AT91PS_PMC) must be sizeof(AT91S_PMC) to have the size of the structure and not the size of the pointer.

Many initialization is made by the interruption management. You just have to change PIO_PER and PIO_ODR registers to enable interrupt on a PIO.

An example for BP2 (PC4):

PHYSICAL_ADDRESS PhysicalBase;
DWORD dwInBuf,dwSysIntr;
AT91PS_PIO pAdressPIOC;
HANDLE hLEDIST,hLEDEvent ;

dwInBuf=(LOGINTR_BASE_PIOC+4);
PhysicalBase.QuadPart = (LONGLONG)AT91C_BASE_PIOC;
pAdressPIOC = (AT91PS_PIO)MmMapIoSpace(PhysicalBase, sizeof(AT91S_PIO), FALSE);

pAdressPIOC->PIO_PER = AT91C_PIO_PC4;
pAdressPIOC->PIO_ODR = AT91C_PIO_PC4;

KernelIoControl( IOCTL_HAL_REQUEST_SYSINTR,
(LPVOID)&dwInBuf,
sizeof(dwInBuf),
&dwSysIntr,
sizeof(dwSysIntr)
,NULL)
)


hLEDIST = CreateThread( NULL, // Security
0, // No Stack Size
LEDIST, // Interrupt Thread
NULL, // Init stucture give by parameters
CREATE_SUSPENDED, // Create Suspended
NULL // Thread Id
);


hLEDEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

InterruptInitialize(dwSysIntr,
hLEDEvent,
NULL,
0))


The IST LEDIST just make waitforsingleobject on the hLEDEvent.

Best regards.


Top
 Profile  
 
 Post subject: .
PostPosted: Wed Dec 05, 2007 11:51 am 
Offline

Joined: Mon Nov 26, 2007 2:11 pm
Posts: 5
That's it, many thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: