test real hardware

This commit is contained in:
Olaf Rempel 2008-02-29 19:50:08 +01:00
parent 0302d9bdb0
commit 60cccae208
4 changed files with 22 additions and 17 deletions

View File

@ -12,16 +12,16 @@
#define BAUD_TO_DIV(BAUD) (MCK / (16 * BAUD)) #define BAUD_TO_DIV(BAUD) (MCK / (16 * BAUD))
/* LED PIOs */ /* LED PIOs */
#define LED_ORANGE AT91C_PIO_PA17 #define LED_ORANGE AT91C_PIO_PA24
#define LED_GREEN AT91C_PIO_PA18 #define LED_GREEN AT91C_PIO_PA23
/* Taster PIOs */ /* Taster PIOs */
#define TAST1 AT91C_PIO_PA19 #define TAST1 AT91C_PIO_PA0
#define TAST2 AT91C_PIO_PA20 #define TAST2 AT91C_PIO_PA1
/* USB PIOs */ /* USB PIOs */
#define UDP_VBUS_MON AT91C_PIO_PA24 #define UDP_VBUS_MON AT91C_PIO_PA8
#define UDP_PULLUP AT91C_PIO_PA25 #define UDP_PULLUP AT91C_PIO_PA16
/* ATMEL IDs */ /* ATMEL IDs */
#define USB_VENDOR_ID 0x03EB #define USB_VENDOR_ID 0x03EB

View File

@ -23,7 +23,7 @@
#include "board.h" #include "board.h"
#include "at91_pitc.h" #include "at91_pitc.h"
static uint16_t adc_result[4]; static uint16_t adc_result[7];
static void at91_adc_isr(void) static void at91_adc_isr(void)
{ {
@ -40,12 +40,18 @@ static void at91_adc_isr(void)
static uint32_t adc_trigger(struct pitc_timer *timer) static uint32_t adc_trigger(struct pitc_timer *timer)
{ {
uint32_t i;
for (i = 0; i < ARRAY_SIZE(adc_result); i++)
printf("0x%03x ", adc_result[i]);
printf("\n\r");
*AT91C_ADC_CR = AT91C_ADC_START; *AT91C_ADC_CR = AT91C_ADC_START;
return PITC_RESTART_TIMER; return PITC_RESTART_TIMER;
} }
static struct pitc_timer adc_timer = { static struct pitc_timer adc_timer = {
.interval = 100, .interval = 10,
.func = &adc_trigger, .func = &adc_trigger,
}; };
@ -79,7 +85,7 @@ void at91_adc_test_init(void)
pdc->PDC_PTCR = AT91C_PDC_RXTEN; pdc->PDC_PTCR = AT91C_PDC_RXTEN;
/* enable 4 channels, PDC Interrupt */ /* enable 4 channels, PDC Interrupt */
adc->ADC_CHER = 0xF0; adc->ADC_CHER = 0xF7;
adc->ADC_IER = AT91C_ADC_ENDRX; adc->ADC_IER = AT91C_ADC_ENDRX;
/* low priority, level triggered, own vector */ /* low priority, level triggered, own vector */
@ -88,5 +94,5 @@ void at91_adc_test_init(void)
aic->AIC_SVR[AT91C_ID_ADC] = (uint32_t)at91_adc_isr; aic->AIC_SVR[AT91C_ID_ADC] = (uint32_t)at91_adc_isr;
aic->AIC_IECR = (1<<AT91C_ID_ADC); aic->AIC_IECR = (1<<AT91C_ID_ADC);
pitc_schedule_timer(&adc_timer); // pitc_schedule_timer(&adc_timer);
} }

View File

@ -6,12 +6,11 @@
static void rtt_isr(uint32_t status) static void rtt_isr(uint32_t status)
{ {
*AT91C_RTTC_RTAR = *AT91C_RTTC_RTVR +1; *AT91C_RTTC_RTAR = *AT91C_RTTC_RTVR +1;
/*
static uint32_t i; static uint32_t i;
*AT91C_PIOA_SODR = i; *AT91C_PIOA_SODR = i;
i = i ^ LED_ORANGE; i = i ^ LED_ORANGE;
*AT91C_PIOA_CODR = i; *AT91C_PIOA_CODR = i;
*/
} }
void at91_rttc_test_init(void) void at91_rttc_test_init(void)

View File

@ -543,10 +543,10 @@ static void udp_vbus_monitor(uint32_t status, uint32_t input)
{ {
if (input & UDP_VBUS_MON) if (input & UDP_VBUS_MON)
/* usb connected -> enable pullup */ /* usb connected -> enable pullup */
*AT91C_PIOA_SODR = UDP_PULLUP; *AT91C_PIOA_CODR = UDP_PULLUP;
else else
/* usb got diconnected -> disable pullup */ /* usb got diconnected -> disable pullup */
*AT91C_PIOA_CODR = UDP_PULLUP; *AT91C_PIOA_SODR = UDP_PULLUP;
} }
PIO_PINCHANGE_ISR(UDP_VBUS_MON, udp_vbus_monitor); PIO_PINCHANGE_ISR(UDP_VBUS_MON, udp_vbus_monitor);