paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [4926] update max3100 module


From: Pascal Brisset
Subject: [paparazzi-commits] [4926] update max3100 module
Date: Mon, 14 Jun 2010 16:13:22 +0000

Revision: 4926
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4926
Author:   hecto
Date:     2010-06-14 16:13:21 +0000 (Mon, 14 Jun 2010)
Log Message:
-----------
update max3100 module

Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.c
    paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.h

Modified: paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.c   2010-06-14 
14:11:14 UTC (rev 4925)
+++ paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.c   2010-06-14 
16:13:21 UTC (rev 4926)
@@ -43,7 +43,7 @@
 bool read_bytes = false;
 
 
-static void EXTINT2_ISR(void) __attribute__((naked));
+static void EXTINT_ISR(void) __attribute__((naked));
 static void SPI1_ISR(void) __attribute__((naked));
 
 #define PINSEL1_SCK  (2 << 2)
@@ -104,10 +104,10 @@
   SetBit(EXTINT, MAX3100_IRQ_EINT);
 
    /* Configure interrupt vector for external pin interrupt */
-  VICIntSelect &= ~VIC_BIT( VIC_EINT2 );                     // EXTINT2 
selected as IRQ
-  VICIntEnable = VIC_BIT( VIC_EINT2 );                       // EXTINT2 
interrupt enabled
-  VICVectCntl8 = VIC_ENABLE | VIC_EINT2;
-  VICVectAddr8 = (uint32_t)EXTINT2_ISR;   // address of the ISR 
+  VICIntSelect &= ~VIC_BIT( MAX3100_VIC_EINT );    // EXTINT selected as IRQ
+  VICIntEnable = VIC_BIT( MAX3100_VIC_EINT );             // EXTINT interrupt 
enabled
+  VICVectCntl8 = VIC_ENABLE | MAX3100_VIC_EINT;
+  VICVectAddr8 = (uint32_t)EXTINT_ISR;   // address of the ISR 
 
   /* Configure interrupt vector for SPI */
   VICIntSelect &= ~VIC_BIT(VIC_SPI1);   /* SPI1 selected as IRQ */
@@ -121,7 +121,7 @@
 
 
 /******* External interrupt: Data input available ***********/
-void EXTINT2_ISR(void) {
+void EXTINT_ISR(void) {
   ISR_ENTRY();
 
   LED_ON(2);
@@ -162,5 +162,5 @@
 }
 
 void max3100_debug(void) {
-  /***/     DOWNLINK_SEND_DEBUG(16, max3100_rx_buf); /***/
+  /***     DOWNLINK_SEND_DEBUG(16, max3100_rx_buf); ***/
 }

Modified: paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.h   2010-06-14 
14:11:14 UTC (rev 4925)
+++ paparazzi3/trunk/sw/airborne/modules/max3100/max3100_hw.h   2010-06-14 
16:13:21 UTC (rev 4926)
@@ -7,11 +7,22 @@
 #include "led.h"
 
 /* Pin configuration for max3100 IRQ */
-#define MAX3100_IRQ_PIN 7
+// #define MAX3100_IRQ_PIN 7
+#if MAX3100_IRQ_PIN == 7
 #define MAX3100_IRQ_PINSEL PINSEL0
 #define MAX3100_IRQ_PINSEL_BIT 14
 #define MAX3100_IRQ_PINSEL_VAL 0x3
 #define MAX3100_IRQ_EINT 2
+#define MAX3100_VIC_EINT VIC_EINT2
+#elif MAX3100_IRQ_PIN == 16
+#define MAX3100_IRQ_PINSEL PINSEL1
+#define MAX3100_IRQ_PINSEL_BIT 0
+#define MAX3100_IRQ_PINSEL_VAL 0x1
+#define MAX3100_IRQ_EINT 0
+#define MAX3100_VIC_EINT VIC_EINT0
+#else
+#error "Define MAX3100_IRQ_PIN"
+#endif
 
 #define MAX3100_SS_PORT 0
 #define MAX3100_SS_PIN 20
@@ -57,9 +68,16 @@
 #define MAX3100_WRITE_DATA ((1U<<15) | (0U<<14))
 #define MAX3100_READ_DATA ((0U<<15) | (0U<<14))
 
+/* Datasheet page 12 */
+#if MAX3100_FOSC == 1843200
 #define MAX3100_B57600 0x1
 #define MAX3100_B19200 0x9 
 #define MAX3100_B9600 0xA
+#elif MAX3100_FOSC == 3686400
+#define MAX3100_B9600 0xB
+#else
+#error "MAX3100_FOSC must be defined to 1843200 or 3686400"
+#endif
 
 #define MAX3100_BIT_NOT_RM (1U<<10)
 #define MAX3100_BIT_NOT_TM (1U<<11)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]