Clean up board specific functions.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 19 Oct 2010 04:56:43 +0000 (13:56 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 19 Oct 2010 04:56:43 +0000 (13:56 +0900)
.gitignore [new file with mode: 0644]
boards/OLIMEX_STM32_H103/board.c
boards/OLIMEX_STM32_H103/board.mk
boards/OLIMEX_STM32_H103/hw_config.c [deleted file]
boards/STM32_PRIMER2/board.c
boards/STM32_PRIMER2/board.mk
boards/STM32_PRIMER2/hw_config.c [deleted file]
boards/common/hw_config.c [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..6cc6a0c
--- /dev/null
@@ -0,0 +1,4 @@
+# generated files by 'configure'
+src/Makefile
+src/config.h
+src/gnuk.ld
index 5f00d74..ba87239 100644 (file)
@@ -45,3 +45,21 @@ void hwinit0(void) {
 void hwinit1(void) {
 #include "../common/hwinit1.c"
 }
+
+void
+USB_Cable_Config (FunctionalState NewState)
+{
+  if (NewState != DISABLE)
+    palClearPad (IOPORT3, GPIOC_DISC);
+  else
+    palSetPad (IOPORT3, GPIOC_DISC);
+}
+
+void
+set_led (int value)
+{
+  if (value)
+    palClearPad (IOPORT3, GPIOC_LED);
+  else
+    palSetPad (IOPORT3, GPIOC_LED);
+}
index c5f9dd4..8b13624 100644 (file)
@@ -1,6 +1,6 @@
 # List of all the board related files.
 BOARDSRC = ../boards/OLIMEX_STM32_H103/board.c \
-       ../boards/OLIMEX_STM32_H103/hw_config.c
+       ../boards/common/hw_config.c
 
 # Required include directories
 BOARDINC = ../boards/OLIMEX_STM32_H103
diff --git a/boards/OLIMEX_STM32_H103/hw_config.c b/boards/OLIMEX_STM32_H103/hw_config.c
deleted file mode 100644 (file)
index 61a4b26..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Hardware specific USB functions */
-/*
- * For detail, please see the documentation of 
- * STM32F10x USB Full Speed Device Library (USB-FS-Device_Lib)
- * by STMicroelectronics' MCD Application Team
- */
-
-#include "ch.h"
-#include "hal.h"
-#include "board.h"
-#include "usb_lib.h"
-#include "usb_prop.h"
-#include "usb_desc.h"
-#include "hw_config.h"
-#include "platform_config.h"
-#include "usb_pwr.h"
-
-void
-Enter_LowPowerMode (void)
-{
-  bDeviceState = SUSPENDED;
-}
-
-void
-Leave_LowPowerMode (void)
-{
-  DEVICE_INFO *pInfo = &Device_Info;
-
-  if (pInfo->Current_Configuration != 0)
-    bDeviceState = CONFIGURED;
-  else
-    bDeviceState = ATTACHED;
-}
-
-void
-USB_Cable_Config (FunctionalState NewState)
-{
-  if (NewState != DISABLE)
-    palClearPad (IOPORT3, GPIOC_DISC);
-  else
-    palSetPad (IOPORT3, GPIOC_DISC);
-}
-
-void
-Get_SerialNum (void)
-{
-}
-
-void
-set_led (int value)
-{
-  if (value)
-    palClearPad (IOPORT3, GPIOC_LED);
-  else
-    palSetPad (IOPORT3, GPIOC_LED);
-}
index 56969d3..d0648a9 100644 (file)
@@ -51,3 +51,21 @@ void hwinit1(void) {
   palClearPad (IOPORT5, GPIOE_LED);
   palClearPad (IOPORT3, GPIOC_SHUTDOWN);
 }
+
+void
+USB_Cable_Config (FunctionalState NewState)
+{
+  if (NewState != DISABLE)
+    palClearPad (IOPORT4, GPIOD_DISC);
+  else
+    palSetPad (IOPORT4, GPIOD_DISC);
+}
+
+void
+set_led (int value)
+{
+  if (value)
+    palClearPad (IOPORT5, GPIOE_LEDR);
+  else
+    palSetPad (IOPORT5, GPIOE_LEDR);
+}
index f8e6af1..1648041 100644 (file)
@@ -1,6 +1,6 @@
 # List of all the board related files.
 BOARDSRC = ../boards/STM32_PRIMER2/board.c \
-       ../boards/STM32_PRIMER2/hw_config.c
+       ../boards/common/hw_config.c
 
 # Required include directories
 BOARDINC = ../boards/STM32_PRIMER2
diff --git a/boards/STM32_PRIMER2/hw_config.c b/boards/STM32_PRIMER2/hw_config.c
deleted file mode 100644 (file)
index 0a38c8d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Hardware specific USB functions */
-/*
- * For detail, please see the documentation of 
- * STM32F10x USB Full Speed Device Library (USB-FS-Device_Lib)
- * by STMicroelectronics' MCD Application Team
- */
-
-#include "ch.h"
-#include "hal.h"
-#include "board.h"
-#include "usb_lib.h"
-#include "usb_prop.h"
-#include "usb_desc.h"
-#include "hw_config.h"
-#include "platform_config.h"
-#include "usb_pwr.h"
-
-void
-Enter_LowPowerMode (void)
-{
-  bDeviceState = SUSPENDED;
-}
-
-void
-Leave_LowPowerMode (void)
-{
-  DEVICE_INFO *pInfo = &Device_Info;
-
-  if (pInfo->Current_Configuration != 0)
-    bDeviceState = CONFIGURED;
-  else
-    bDeviceState = ATTACHED;
-}
-
-void
-USB_Cable_Config (FunctionalState NewState)
-{
-  if (NewState != DISABLE)
-    palClearPad (IOPORT4, GPIOD_DISC);
-  else
-    palSetPad (IOPORT4, GPIOD_DISC);
-}
-
-void
-Get_SerialNum (void)
-{
-}
-
-void
-set_led (int value)
-{
-  if (value)
-    palClearPad (IOPORT5, GPIOE_LEDR);
-  else
-    palSetPad (IOPORT5, GPIOE_LEDR);
-}
diff --git a/boards/common/hw_config.c b/boards/common/hw_config.c
new file mode 100644 (file)
index 0000000..69f7d54
--- /dev/null
@@ -0,0 +1,38 @@
+/* Hardware specific USB functions */
+/*
+ * For detail, please see the documentation of 
+ * STM32F10x USB Full Speed Device Library (USB-FS-Device_Lib)
+ * by STMicroelectronics' MCD Application Team
+ */
+
+#include "ch.h"
+#include "hal.h"
+#include "board.h"
+#include "usb_lib.h"
+#include "usb_prop.h"
+#include "usb_desc.h"
+#include "hw_config.h"
+#include "platform_config.h"
+#include "usb_pwr.h"
+
+void
+Enter_LowPowerMode (void)
+{
+  bDeviceState = SUSPENDED;
+}
+
+void
+Leave_LowPowerMode (void)
+{
+  DEVICE_INFO *pInfo = &Device_Info;
+
+  if (pInfo->Current_Configuration != 0)
+    bDeviceState = CONFIGURED;
+  else
+    bDeviceState = ATTACHED;
+}
+
+void
+Get_SerialNum (void)
+{
+}