summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_internal.h44
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_pin.c7
-rw-r--r--nuttx/configs/freedom-kl25z/README.txt2
-rw-r--r--nuttx/configs/freedom-kl25z/include/board.h18
-rw-r--r--nuttx/configs/freedom-kl25z/src/kl_led.c2
6 files changed, 44 insertions, 33 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 5ece07698..d7df4e1c1 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -4680,4 +4680,6 @@
* arch/arm/src/kl/kl_gpio.c and .h, configs/freedom-kl25z/src/freedom-kl25z.h,
and configs/freedom-kl25z/src/kl_led.c: Fixes LEDs on the Freedom KL25Z
board (2013-5-6).
-
+ * arch/arm/src/kinetis/kinetis_pin.c and arch/arm/src/kinetis/kinetis_internal.h:
+ The Kinetis GPIO logic had some of the same issues as did the
+ Kinetis L (2013-5-6).
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_internal.h b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
index 79cb542cc..3b1525355 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_internal.h
+++ b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/kinetis/kinetis_internal.h
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -69,26 +69,34 @@
/* Bits 25-31: 7 bits are used to encode the basic pin configuration:
*
* oooo mmm- ---- ---- ---- ---- ---- ----
- * oooommm:
- * | `--- mmm: mode
+ * | `--- mmm: mode
* `------- oooo: options (may be combined)
*/
-#define _PIN_MODE_SHIFT (25) /* Bits 25-27: Pin mode */
+#define _PIN_MODE_SHIFT (25) /* Bits 25-27: Pin mode */
#define _PIN_MODE_MASK (7 << _PIN_MODE_SHIFT)
-#define _PIN_OPTIONS_SHIFT (28) /* Bits 28-31: Pin mode options */
+#define _PIN_OPTIONS_SHIFT (28) /* Bits 28-31: Pin mode options */
#define _PIN_OPTIONS_MASK (15 << _PIN_OPTIONS_SHIFT)
/* Port Modes */
-
-#define _PIN_MODE_ANALOG (0 << _PIN_MODE_SHIFT) /* 000 Pin Disabled (Analog) */
-#define _PIN_MODE_GPIO (1 << _PIN_MODE_SHIFT) /* 001 Alternative 1 (GPIO) */
-#define _PIN_MODE_ALT2 (2 << _PIN_MODE_SHIFT) /* 010 Alternative 2 */
-#define _PIN_MODE_ALT3 (3 << _PIN_MODE_SHIFT) /* 011 Alternative 3 */
-#define _PIN_MODE_ALT4 (4 << _PIN_MODE_SHIFT) /* 100 Alternative 4 */
-#define _PIN_MODE_ALT5 (5 << _PIN_MODE_SHIFT) /* 101 Alternative 5 */
-#define _PIN_MODE_ALT6 (6 << _PIN_MODE_SHIFT) /* 110 Alternative 6 */
-#define _PIN_MODE_ALT7 (7 << _PIN_MODE_SHIFT) /* 111 Alternative 7 */
+ /* Unshifted versions: */
+#define PIN_MODE_ANALOG (0) /* 000 Pin Disabled (Analog) */
+#define PIN_MODE_GPIO (1) /* 001 Alternative 1 (GPIO) */
+#define PIN_MODE_ALT2 (2) /* 010 Alternative 2 */
+#define PIN_MODE_ALT3 (3) /* 011 Alternative 3 */
+#define PIN_MODE_ALT4 (4) /* 100 Alternative 4 */
+#define PIN_MODE_ALT5 (5) /* 101 Alternative 5 */
+#define PIN_MODE_ALT6 (6) /* 110 Alternative 6 */
+#define PIN_MODE_ALT7 (7) /* 111 Alternative 7 */
+ /* Shifted versions: */
+#define _PIN_MODE_ANALOG (0 << _PIN_MODE_SHIFT) /* 000 Pin Disabled (Analog) */
+#define _PIN_MODE_GPIO (1 << _PIN_MODE_SHIFT) /* 001 Alternative 1 (GPIO) */
+#define _PIN_MODE_ALT2 (2 << _PIN_MODE_SHIFT) /* 010 Alternative 2 */
+#define _PIN_MODE_ALT3 (3 << _PIN_MODE_SHIFT) /* 011 Alternative 3 */
+#define _PIN_MODE_ALT4 (4 << _PIN_MODE_SHIFT) /* 100 Alternative 4 */
+#define _PIN_MODE_ALT5 (5 << _PIN_MODE_SHIFT) /* 101 Alternative 5 */
+#define _PIN_MODE_ALT6 (6 << _PIN_MODE_SHIFT) /* 110 Alternative 6 */
+#define _PIN_MODE_ALT7 (7 << _PIN_MODE_SHIFT) /* 111 Alternative 7 */
/* Options for all digital modes (Alternatives 1-7). None of the digital
* options apply if the analog mode is selected.
@@ -240,7 +248,7 @@
#define PIN_PASV_FILTER (1 << 18) /* Bit 18: Enable passive filter */
#define PIN_DIG_FILTER (1 << 17) /* Bit 17: Enable digital filter */
-
+
/* Three bits are used to define the port number:
*
* ---- ---- ---- ---- ---- -ppp ---- ----
@@ -581,7 +589,7 @@ void kinetis_clrpend(int irq);
* Description:
* These external functions must be provided by board-specific logic. They are
* implementations of the select, status, and cmddata methods of the SPI interface
- * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
+ * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods
* including up_spiinitialize()) are provided by common Kinetis logic. To use
* this common SPI logic on your board:
*
@@ -597,7 +605,7 @@ void kinetis_clrpend(int irq);
* 3. Add a call to up_spiinitialize() in your low level application
* initialization logic
* 4. The handle returned by up_spiinitialize() may then be used to bind the
- * SPI driver to higher level logic (e.g., calling
+ * SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
@@ -800,7 +808,7 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno);
*
* Input Parameters:
* dev - An instance of the SDIO driver device state structure.
- * cardinslot - true is a card has been detected in the slot; false if a
+ * cardinslot - true is a card has been detected in the slot; false if a
* card has been removed from the slot. Only transitions
* (inserted->removed or removed->inserted should be reported)
*
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_pin.c b/nuttx/arch/arm/src/kinetis/kinetis_pin.c
index 43bfae61e..dcf381dd9 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_pin.c
+++ b/nuttx/arch/arm/src/kinetis/kinetis_pin.c
@@ -106,7 +106,7 @@ int kinetis_pinconfig(uint32_t cfgset)
* options are applicable.
*/
- if (mode == _PIN_MODE_ANALOG)
+ if (mode == PIN_MODE_ANALOG)
{
/* Set the analog mode with all digital options zeroed */
@@ -148,7 +148,7 @@ int kinetis_pinconfig(uint32_t cfgset)
{
regval |= PORT_PCR_ODE;
}
-
+
/* Check for high drive output */
if ((cfgset & _PIN_OUTPUT_DRIVE_MASK) == _PIN_OUTPUT_HIGHDRIVE)
@@ -187,7 +187,7 @@ int kinetis_pinconfig(uint32_t cfgset)
/* Additional configuration for the case of Alternative 1 (GPIO) modes */
- if (mode == _PIN_MODE_GPIO)
+ if (mode == PIN_MODE_GPIO)
{
/* Set the GPIO port direction */
@@ -216,6 +216,7 @@ int kinetis_pinconfig(uint32_t cfgset)
return OK;
}
+
return -EINVAL;
}
diff --git a/nuttx/configs/freedom-kl25z/README.txt b/nuttx/configs/freedom-kl25z/README.txt
index 5a278d3fa..fa1d3a6be 100644
--- a/nuttx/configs/freedom-kl25z/README.txt
+++ b/nuttx/configs/freedom-kl25z/README.txt
@@ -90,7 +90,7 @@ LEDs
------------------- ----------------------- --------------------------
LED_STARTED NuttX has been started R=OFF G=OFF B=OFF
LED_HEAPALLOCATE Heap has been allocated (no change)
- LED_IRQSENABLED Interrupts enabled (no change)
+ LED_IRQSENABLED Interrupts enabled (no change)
LED_STACKCREATED Idle stack created R=OFF G=OFF B=ON
LED_INIRQ In an interrupt (no change)
LED_SIGNAL In a signal handler (no change)
diff --git a/nuttx/configs/freedom-kl25z/include/board.h b/nuttx/configs/freedom-kl25z/include/board.h
index 11d375e05..cb42980da 100644
--- a/nuttx/configs/freedom-kl25z/include/board.h
+++ b/nuttx/configs/freedom-kl25z/include/board.h
@@ -151,15 +151,15 @@
* SYMBOL Meaning LED state
* Initially all LED is OFF
* ------------------- ----------------------- --------------------------
- * LED_STARTED NuttX has been started
- * LED_HEAPALLOCATE Heap has been allocated
- * LED_IRQSENABLED Interrupts enabled
- * LED_STACKCREATED Idle stack created
- * LED_INIRQ In an interrupt
- * LED_SIGNAL In a signal handler
- * LED_ASSERTION An assertion failed
- * LED_PANIC The system has crashed
- * LED_IDLE K25Z1XX is in sleep mode (Optional, not used)
+ * LED_STARTED NuttX has been started R=OFF G=OFF B=OFF
+ * LED_HEAPALLOCATE Heap has been allocated (no change)
+ * LED_IRQSENABLED Interrupts enabled (no change)
+ * LED_STACKCREATED Idle stack created R=OFF G=OFF B=ON
+ * LED_INIRQ In an interrupt (no change)
+ * LED_SIGNAL In a signal handler (no change)
+ * LED_ASSERTION An assertion failed (no change)
+ * LED_PANIC The system has crashed R=FLASHING G=OFF B=OFF
+ * LED_IDLE K25Z1XX is in sleep mode (Optional, not used)
*/
#define LED_STARTED 0
diff --git a/nuttx/configs/freedom-kl25z/src/kl_led.c b/nuttx/configs/freedom-kl25z/src/kl_led.c
index 1d54be45c..12ab55538 100644
--- a/nuttx/configs/freedom-kl25z/src/kl_led.c
+++ b/nuttx/configs/freedom-kl25z/src/kl_led.c
@@ -50,7 +50,7 @@
* ------------------- ----------------------- --------------------------
* LED_STARTED NuttX has been started R=OFF G=OFF B=OFF
* LED_HEAPALLOCATE Heap has been allocated (no change)
- * LED_IRQSENABLED Interrupts enabled (no change)
+ * LED_IRQSENABLED Interrupts enabled (no change)
* LED_STACKCREATED Idle stack created R=OFF G=OFF B=ON
* LED_INIRQ In an interrupt (no change)
* LED_SIGNAL In a signal handler (no change)