summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/host/bare_api/CMakeLists.txt17
-rw-r--r--examples/host/bare_api/src/tusb_config.h6
-rw-r--r--examples/host/cdc_msc_hid/CMakeLists.txt27
-rw-r--r--examples/host/cdc_msc_hid/src/msc_app.c42
-rw-r--r--examples/host/hid_controller/CMakeLists.txt17
-rw-r--r--examples/host/hid_controller/src/tusb_config.h6
-rw-r--r--examples/host/msc_file_explorer/CMakeLists.txt27
-rw-r--r--examples/host/msc_file_explorer/src/msc_app.c15
8 files changed, 84 insertions, 73 deletions
diff --git a/examples/host/bare_api/CMakeLists.txt b/examples/host/bare_api/CMakeLists.txt
index bc04b01a7..019adaacd 100644
--- a/examples/host/bare_api/CMakeLists.txt
+++ b/examples/host/bare_api/CMakeLists.txt
@@ -26,5 +26,18 @@ target_include_directories(${PROJECT} PUBLIC
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})
-# For rp2040, un-comment to enable pico-pio-usb
-# family_add_pico_pio_usb(${PROJECT}) \ No newline at end of file
+# For rp2040 enable pico-pio-usb
+if(FAMILY STREQUAL "rp2040")
+ family_add_pico_pio_usb(${PROJECT})
+
+ # due to warnings from Pico-PIO-USB
+ target_compile_options(${PROJECT} PUBLIC
+ -Wno-error=shadow
+ -Wno-error=cast-align
+ -Wno-error=cast-qual
+ -Wno-error=redundant-decls
+ -Wno-error=sign-conversion
+ -Wno-error=conversion
+ -Wno-error=unused-function
+ )
+endif() \ No newline at end of file
diff --git a/examples/host/bare_api/src/tusb_config.h b/examples/host/bare_api/src/tusb_config.h
index ed0aaf7da..701aa6d90 100644
--- a/examples/host/bare_api/src/tusb_config.h
+++ b/examples/host/bare_api/src/tusb_config.h
@@ -34,6 +34,12 @@
// Board Specific Configuration
//--------------------------------------------------------------------+
+#if CFG_TUSB_MCU == OPT_MCU_RP2040
+// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
+#define CFG_TUH_RPI_PIO_USB 0
+#define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_USB
+#endif
+
// RHPort number used for host can be defined by board.mk, default to port 0
#ifndef BOARD_TUH_RHPORT
#define BOARD_TUH_RHPORT 0
diff --git a/examples/host/cdc_msc_hid/CMakeLists.txt b/examples/host/cdc_msc_hid/CMakeLists.txt
index 5b44ef217..870134376 100644
--- a/examples/host/cdc_msc_hid/CMakeLists.txt
+++ b/examples/host/cdc_msc_hid/CMakeLists.txt
@@ -28,17 +28,18 @@ target_include_directories(${PROJECT} PUBLIC
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})
-# For rp2040, un-comment to enable pico-pio-usb
-family_add_pico_pio_usb(${PROJECT})
+# For rp2040 enable pico-pio-usb
+if(FAMILY STREQUAL "rp2040")
+ family_add_pico_pio_usb(${PROJECT})
-# due to warnings from Pico-PIO-USB
-target_compile_options(${PROJECT} PUBLIC
- -Wno-error=shadow
- -Wno-error=cast-align
- -Wno-error=cast-qual
- -Wno-error=redundant-decls
- -Wno-error=sign-conversion
- -Wno-error=conversion
- -Wno-error=sign-compare
- -Wno-error=unused-function
- )
+ # due to warnings from Pico-PIO-USB
+ target_compile_options(${PROJECT} PUBLIC
+ -Wno-error=shadow
+ -Wno-error=cast-align
+ -Wno-error=cast-qual
+ -Wno-error=redundant-decls
+ -Wno-error=sign-conversion
+ -Wno-error=conversion
+ -Wno-error=unused-function
+ )
+endif()
diff --git a/examples/host/cdc_msc_hid/src/msc_app.c b/examples/host/cdc_msc_hid/src/msc_app.c
index 80a5eab6f..797d55f8a 100644
--- a/examples/host/cdc_msc_hid/src/msc_app.c
+++ b/examples/host/cdc_msc_hid/src/msc_app.c
@@ -30,8 +30,11 @@
//--------------------------------------------------------------------+
static scsi_inquiry_resp_t inquiry_resp;
-bool inquiry_complete_cb(uint8_t dev_addr, msc_cbw_t const* cbw, msc_csw_t const* csw)
+bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
{
+ msc_cbw_t const* cbw = cb_data->cbw;
+ msc_csw_t const* csw = cb_data->csw;
+
if (csw->status != 0)
{
printf("Inquiry failed\r\n");
@@ -57,47 +60,12 @@ void tuh_msc_mount_cb(uint8_t dev_addr)
printf("A MassStorage device is mounted\r\n");
uint8_t const lun = 0;
- tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb);
-//
-// //------------- file system (only 1 LUN support) -------------//
-// uint8_t phy_disk = dev_addr-1;
-// disk_initialize(phy_disk);
-//
-// if ( disk_is_ready(phy_disk) )
-// {
-// if ( f_mount(phy_disk, &fatfs[phy_disk]) != FR_OK )
-// {
-// puts("mount failed");
-// return;
-// }
-//
-// f_chdrive(phy_disk); // change to newly mounted drive
-// f_chdir("/"); // root as current dir
-//
-// cli_init();
-// }
+ tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb, 0);
}
void tuh_msc_umount_cb(uint8_t dev_addr)
{
(void) dev_addr;
printf("A MassStorage device is unmounted\r\n");
-
-// uint8_t phy_disk = dev_addr-1;
-//
-// f_mount(phy_disk, NULL); // unmount disk
-// disk_deinitialize(phy_disk);
-//
-// if ( phy_disk == f_get_current_drive() )
-// { // active drive is unplugged --> change to other drive
-// for(uint8_t i=0; i<CFG_TUH_DEVICE_MAX; i++)
-// {
-// if ( disk_is_ready(i) )
-// {
-// f_chdrive(i);
-// cli_init(); // refractor, rename
-// }
-// }
-// }
}
diff --git a/examples/host/hid_controller/CMakeLists.txt b/examples/host/hid_controller/CMakeLists.txt
index 6153d399a..aea99e404 100644
--- a/examples/host/hid_controller/CMakeLists.txt
+++ b/examples/host/hid_controller/CMakeLists.txt
@@ -27,5 +27,18 @@ target_include_directories(${PROJECT} PUBLIC
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})
-# For rp2040, un-comment to enable pico-pio-usb
-# family_add_pico_pio_usb(${PROJECT})
+# For rp2040 enable pico-pio-usb
+if(FAMILY STREQUAL "rp2040")
+ family_add_pico_pio_usb(${PROJECT})
+
+ # due to warnings from Pico-PIO-USB
+ target_compile_options(${PROJECT} PUBLIC
+ -Wno-error=shadow
+ -Wno-error=cast-align
+ -Wno-error=cast-qual
+ -Wno-error=redundant-decls
+ -Wno-error=sign-conversion
+ -Wno-error=conversion
+ -Wno-error=unused-function
+ )
+endif() \ No newline at end of file
diff --git a/examples/host/hid_controller/src/tusb_config.h b/examples/host/hid_controller/src/tusb_config.h
index 475b9ca8f..e6d6f873d 100644
--- a/examples/host/hid_controller/src/tusb_config.h
+++ b/examples/host/hid_controller/src/tusb_config.h
@@ -34,6 +34,12 @@
// Board Specific Configuration
//--------------------------------------------------------------------+
+ #if CFG_TUSB_MCU == OPT_MCU_RP2040
+// change to 1 if using pico-pio-usb as host controller for raspberry rp2040
+#define CFG_TUH_RPI_PIO_USB 0
+#define BOARD_TUH_RHPORT CFG_TUH_RPI_PIO_USB
+#endif
+
// RHPort number used for host can be defined by board.mk, default to port 0
#ifndef BOARD_TUH_RHPORT
#define BOARD_TUH_RHPORT 0
diff --git a/examples/host/msc_file_explorer/CMakeLists.txt b/examples/host/msc_file_explorer/CMakeLists.txt
index 5d443ea9b..e51a170d3 100644
--- a/examples/host/msc_file_explorer/CMakeLists.txt
+++ b/examples/host/msc_file_explorer/CMakeLists.txt
@@ -32,17 +32,18 @@ target_include_directories(${PROJECT} PUBLIC
# in hw/bsp/FAMILY/family.cmake for details.
family_configure_host_example(${PROJECT})
-# For rp2040, un-comment to enable pico-pio-usb
-family_add_pico_pio_usb(${PROJECT})
+# For rp2040 enable pico-pio-usb
+if(FAMILY STREQUAL "rp2040")
+ family_add_pico_pio_usb(${PROJECT})
-# due to warnings from Pico-PIO-USB and fatfs
-target_compile_options(${PROJECT} PUBLIC
- -Wno-error=shadow
- -Wno-error=cast-align
- -Wno-error=cast-qual
- -Wno-error=redundant-decls
- -Wno-error=sign-conversion
- -Wno-error=conversion
- -Wno-error=sign-compare
- -Wno-error=unused-function
- )
+ # due to warnings from Pico-PIO-USB
+ target_compile_options(${PROJECT} PUBLIC
+ -Wno-error=shadow
+ -Wno-error=cast-align
+ -Wno-error=cast-qual
+ -Wno-error=redundant-decls
+ -Wno-error=sign-conversion
+ -Wno-error=conversion
+ -Wno-error=unused-function
+ )
+endif()
diff --git a/examples/host/msc_file_explorer/src/msc_app.c b/examples/host/msc_file_explorer/src/msc_app.c
index aa193f3ce..5a1635015 100644
--- a/examples/host/msc_file_explorer/src/msc_app.c
+++ b/examples/host/msc_file_explorer/src/msc_app.c
@@ -93,8 +93,11 @@ void msc_app_task(void)
//--------------------------------------------------------------------+
-bool inquiry_complete_cb(uint8_t dev_addr, msc_cbw_t const* cbw, msc_csw_t const* csw)
+bool inquiry_complete_cb(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
{
+ msc_cbw_t const* cbw = cb_data->cbw;
+ msc_csw_t const* csw = cb_data->csw;
+
if (csw->status != 0)
{
printf("Inquiry failed\r\n");
@@ -140,7 +143,7 @@ void tuh_msc_mount_cb(uint8_t dev_addr)
printf("A MassStorage device is mounted\r\n");
uint8_t const lun = 0;
- tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb);
+ tuh_msc_inquiry(dev_addr, lun, &inquiry_resp, inquiry_complete_cb, 0);
}
void tuh_msc_umount_cb(uint8_t dev_addr)
@@ -178,9 +181,9 @@ static void wait_for_disk_io(BYTE pdrv)
}
}
-static bool disk_io_complete(uint8_t dev_addr, msc_cbw_t const* cbw, msc_csw_t const* csw)
+static bool disk_io_complete(uint8_t dev_addr, tuh_msc_complete_data_t const * cb_data)
{
- (void) dev_addr; (void) cbw; (void) csw;
+ (void) dev_addr; (void) cb_data;
_disk_busy[dev_addr-1] = false;
return true;
}
@@ -212,7 +215,7 @@ DRESULT disk_read (
uint8_t const lun = 0;
_disk_busy[pdrv] = true;
- tuh_msc_read10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete);
+ tuh_msc_read10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete, 0);
wait_for_disk_io(pdrv);
return RES_OK;
@@ -231,7 +234,7 @@ DRESULT disk_write (
uint8_t const lun = 0;
_disk_busy[pdrv] = true;
- tuh_msc_write10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete);
+ tuh_msc_write10(dev_addr, lun, buff, sector, (uint16_t) count, disk_io_complete, 0);
wait_for_disk_io(pdrv);
return RES_OK;