From 4f94d90d4dba522a2fcf451da9c78e810782e2c0 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Wed, 4 Mar 2015 20:35:41 +0000
Subject: [PATCH] stmhal: Include fatfs headers using lib/fatfs prefix.

This helps make files reusable across other ports.
---
 stmhal/Makefile           | 1 -
 stmhal/diskio.c           | 5 ++---
 stmhal/ffconf.c           | 2 +-
 stmhal/file.c             | 2 +-
 stmhal/fsusermount.c      | 2 +-
 stmhal/import.c           | 2 +-
 stmhal/lexerfatfs.c       | 2 +-
 stmhal/main.c             | 3 ++-
 stmhal/modpyb.c           | 4 ++--
 stmhal/moduos.c           | 5 ++---
 stmhal/usbd_msc_storage.c | 2 +-
 11 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/stmhal/Makefile b/stmhal/Makefile
index c457e2ff1..46125d10b 100644
--- a/stmhal/Makefile
+++ b/stmhal/Makefile
@@ -39,7 +39,6 @@ INC += -I$(CMSIS_DIR)/devinc
 INC += -I$(HAL_DIR)/inc
 INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc
 #INC += -I$(USBHOST_DIR)
-INC += -I../$(FATFS_DIR)
 INC += -I../lib/mp-readline
 
 CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
diff --git a/stmhal/diskio.c b/stmhal/diskio.c
index 948297aa4..9cae46eb1 100644
--- a/stmhal/diskio.c
+++ b/stmhal/diskio.c
@@ -33,12 +33,11 @@
 #include "stm32f4xx_hal.h"
 
 #include "py/runtime.h"
-#include "systick.h"
+#include "lib/fatfs/ff.h"        /* FatFs lower layer API */
+#include "lib/fatfs/diskio.h"        /* FatFs lower layer API */
 #include "rtc.h"
 #include "storage.h"
 #include "sdcard.h"
-#include "ff.h"        /* FatFs lower layer API */
-#include "diskio.h"        /* FatFs lower layer API */
 #include "fsusermount.h"
 
 const PARTITION VolToPart[] = {
diff --git a/stmhal/ffconf.c b/stmhal/ffconf.c
index 0a4745462..b8dada3cc 100644
--- a/stmhal/ffconf.c
+++ b/stmhal/ffconf.c
@@ -27,7 +27,7 @@
 #include <string.h>
 
 #include "py/obj.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 #include "ffconf.h"
 #include "fsusermount.h"
 
diff --git a/stmhal/file.c b/stmhal/file.c
index 66bb51f49..62e582874 100644
--- a/stmhal/file.c
+++ b/stmhal/file.c
@@ -30,8 +30,8 @@
 #include "py/nlr.h"
 #include "py/runtime.h"
 #include "py/stream.h"
+#include "lib/fatfs/ff.h"
 #include "file.h"
-#include "ff.h"
 
 extern const mp_obj_type_t mp_type_fileio;
 extern const mp_obj_type_t mp_type_textio;
diff --git a/stmhal/fsusermount.c b/stmhal/fsusermount.c
index 0cd36480e..5ddb4c29b 100644
--- a/stmhal/fsusermount.c
+++ b/stmhal/fsusermount.c
@@ -26,7 +26,7 @@
 
 #include "py/nlr.h"
 #include "py/runtime.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 #include "fsusermount.h"
 
 // for user-mountable block device
diff --git a/stmhal/import.c b/stmhal/import.c
index e94cf620e..c28fe8762 100644
--- a/stmhal/import.c
+++ b/stmhal/import.c
@@ -27,7 +27,7 @@
 #include <stdio.h>
 
 #include "py/lexer.h"
-#include "ff.h"
+#include "lib/fatfs/ff.h"
 
 mp_import_stat_t mp_import_stat(const char *path) {
     FILINFO fno;
diff --git a/stmhal/lexerfatfs.c b/stmhal/lexerfatfs.c
index 639cd1f2f..ddab89a5c 100644
--- a/stmhal/lexerfatfs.c
+++ b/stmhal/lexerfatfs.c
@@ -27,8 +27,8 @@
 #include <stdio.h>
 
 #include "py/lexer.h"
+#include "lib/fatfs/ff.h"
 #include "lexerfatfs.h"
-#include "ff.h"
 
 typedef struct _mp_lexer_file_buf_t {
     FIL fp;
diff --git a/stmhal/main.c b/stmhal/main.c
index f91d10d32..d57bb2b2d 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -35,6 +35,8 @@
 #include "py/stackctrl.h"
 #include "py/gc.h"
 
+#include "lib/fatfs/ff.h"
+
 #include "systick.h"
 #include "pendsv.h"
 #include "gccollect.h"
@@ -52,7 +54,6 @@
 #include "rtc.h"
 #include "storage.h"
 #include "sdcard.h"
-#include "ff.h"
 #include "rng.h"
 #include "accel.h"
 #include "servo.h"
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c
index 40189c1e7..b81f43c1d 100644
--- a/stmhal/modpyb.c
+++ b/stmhal/modpyb.c
@@ -33,6 +33,8 @@
 #include "py/nlr.h"
 #include "py/obj.h"
 #include "py/gc.h"
+#include "lib/fatfs/ff.h"
+#include "lib/fatfs/diskio.h"
 #include "gccollect.h"
 #include "irq.h"
 #include "systick.h"
@@ -56,8 +58,6 @@
 #include "dac.h"
 #include "lcd.h"
 #include "usb.h"
-#include "ff.h"
-#include "diskio.h"
 #include "fsusermount.h"
 #include "portmodules.h"
 
diff --git a/stmhal/moduos.c b/stmhal/moduos.c
index 9f8de8046..7c73d6051 100644
--- a/stmhal/moduos.c
+++ b/stmhal/moduos.c
@@ -30,11 +30,10 @@
 #include "py/nlr.h"
 #include "py/obj.h"
 #include "py/objtuple.h"
-#include "systick.h"
+#include "lib/fatfs/ff.h"
+#include "lib/fatfs/diskio.h"
 #include "rng.h"
 #include "storage.h"
-#include "ff.h"
-#include "diskio.h"
 #include "file.h"
 #include "sdcard.h"
 #include "fsusermount.h"
diff --git a/stmhal/usbd_msc_storage.c b/stmhal/usbd_msc_storage.c
index 03483ef09..82fa550dc 100644
--- a/stmhal/usbd_msc_storage.c
+++ b/stmhal/usbd_msc_storage.c
@@ -37,8 +37,8 @@
 #include "usbd_msc_storage.h"
 
 #include "py/misc.h"
+#include "lib/fatfs/diskio.h"
 #include "storage.h"
-#include "diskio.h"
 #include "sdcard.h"
 
 // These are needed to support removal of the medium, so that the USB drive
-- 
GitLab