373a8c32b2
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
103 lines
3.3 KiB
C
103 lines
3.3 KiB
C
/* ---------------------------------------------------------------------------
|
|
* dio.c - v0.1 (c) 2007 Micro-key bv
|
|
* ---------------------------------------------------------------------------
|
|
* Micro-key bv
|
|
* Industrieweg 28, 9804 TG Noordhorn
|
|
* Postbus 92, 9800 AB Zuidhorn
|
|
* The Netherlands
|
|
* Tel: +31 594 503020
|
|
* Fax: +31 594 505825
|
|
* Email: support@microkey.nl
|
|
* Web: www.microkey.nl
|
|
* ---------------------------------------------------------------------------
|
|
* Description: Digital inputs/outputs interface.
|
|
* ---------------------------------------------------------------------------
|
|
* Version(s): 0.1, 28-11-2007, fvds.
|
|
* Creation.
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* System include files
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Application include files
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
#include "LPC23xx.h"
|
|
#include "types.h"
|
|
#include "dio.h"
|
|
#include "dioISR.h"
|
|
#include "armVIC.h"
|
|
|
|
/* FreeRTOS includes */
|
|
#include "FreeRTOS.h"
|
|
#include "Task.h"
|
|
#include "queue.h"
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Local constant and macro definitions
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Global variable definitions
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
extern xQueueHandle dispatchedIsrQueue;
|
|
t_IsrDispatchQueueItem dispatchItem;
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Local variable definitions
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
volatile UINT32 receivedInts = 0;
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
* Local function definitions
|
|
* ---------------------------------------------------------------------------
|
|
*/
|
|
static void GpioHandler( void );
|
|
|
|
|
|
void gpioISR()
|
|
{
|
|
/* Save the context of the interrupted task. */
|
|
portSAVE_CONTEXT();
|
|
{
|
|
/* Call the handler to do the work. This must be a separate function to
|
|
the wrapper to ensure the correct stack frame is set up. */
|
|
GpioHandler();
|
|
}
|
|
/* Restore the context of whichever task is going to run once the interrupt
|
|
completes. */
|
|
portRESTORE_CONTEXT();
|
|
}
|
|
|
|
|
|
void GpioHandler( void )
|
|
{
|
|
receivedInts++;
|
|
|
|
// Check flags
|
|
// -=NOTE=- Because input signal is inverted; the rising and
|
|
// falling signal are switched.
|
|
dispatchItem.riseInterrupts[0] = IO0_INT_STAT_F;
|
|
dispatchItem.fallInterrupts[0] = IO0_INT_STAT_R;
|
|
dispatchItem.riseInterrupts[1] = IO2_INT_STAT_R;
|
|
dispatchItem.fallInterrupts[1] = IO2_INT_STAT_F;
|
|
|
|
xQueueSendToBackFromISR( dispatchedIsrQueue, &dispatchItem, pdFALSE );
|
|
|
|
IO0_INT_CLR = 0xFFFFFFFF;
|
|
IO2_INT_CLR = 0xFFFFFFFF;
|
|
|
|
VICVectAddr = 0x00000000; // clear this interrupt from the VIC
|
|
}
|
|
|