Skip to content

Commit 40ed1be

Browse files
committed
Merge remote-tracking branch 'origin/filesystem_porting_dev' into usb_host_dev
2 parents ad237f6 + 1ab5038 commit 40ed1be

File tree

182 files changed

+80615
-2026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+80615
-2026
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "extras/tinyusb"]
22
path = extras/tinyusb
3-
url = https://github.com/bcmi-labs/tinyusb.git
3+
url = git@github.com:bcmi-labs/tinyusb.git

cores/arduino/FspTransfer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ class FspDma {
3333
extend_cfg.p_callback = NULL;
3434
extend_cfg.p_context = NULL;
3535
extend_cfg.activation_source = ELC_EVENT_NONE;
36+
37+
instance.p_ctrl = &ctrl;
38+
instance.p_cfg = &cfg;
39+
instance.p_api = &g_transfer_on_dmac;
3640
}
3741

3842
bool set_activation_source(elc_event_t ev) {
@@ -58,6 +62,7 @@ class FspDma {
5862
dmac_instance_ctrl_t ctrl;
5963
transfer_info_t info;
6064
dmac_extended_cfg_t extend_cfg;
65+
transfer_instance_t instance;
6166
};
6267

6368

cores/arduino/IRQManager.cpp

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
#define SPI_MASTER_REQ_NUM 4
1919
#define CAN_REQ_NUM 3
2020
#define ETHERNET_REQ_NUM 1
21+
#define SDCARD_REQ_NUM 3
2122
#define ETHERNET_PRIORITY 12
23+
#define SDCARD_ACCESS_PRIORITY 12
24+
#define SDCARD_DMA_REQ_PRIORITY 12
25+
#define SDCARD_CARD_PRIORITY 12
2226
#define EXTERNAL_PIN_PRIORITY 12
2327
#define UART_SCI_PRIORITY 12
2428
#define USB_PRIORITY 12
@@ -904,7 +908,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
904908
********************************************************************** */
905909
else if(p == IRQ_ETHERNET && cfg != NULL) {
906910
ether_cfg_t *eth = (ether_cfg_t *)cfg;
907-
if ((last_interrupt_index + SPI_MASTER_REQ_NUM) < PROG_IRQ_NUM && eth->irq == FSP_INVALID_VECTOR) {
911+
if ((last_interrupt_index + ETHERNET_REQ_NUM) < PROG_IRQ_NUM && eth->irq == FSP_INVALID_VECTOR) {
908912
eth->irq = (IRQn_Type)last_interrupt_index;
909913
eth->interrupt_priority = ETHERNET_PRIORITY;
910914
*(irq_ptr + last_interrupt_index) = (uint32_t)ether_eint_isr;
@@ -951,6 +955,49 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
951955
}
952956
#endif /* CANFD_HOWMANY > 0 */
953957

958+
#if SDCARD_HOWMANY > 0
959+
/* **********************************************************************
960+
SDCARD
961+
********************************************************************** */
962+
else if(p == IRQ_SDCARD && cfg != NULL) {
963+
sdmmc_cfg_t *sd_cfg = (sdmmc_cfg_t *)cfg;
964+
/* SDCARD_ACCESS */
965+
if ((last_interrupt_index + SDCARD_REQ_NUM) < PROG_IRQ_NUM ) {
966+
if(sd_cfg->access_irq == FSP_INVALID_VECTOR) {
967+
968+
sd_cfg->access_irq = (IRQn_Type)last_interrupt_index;
969+
sd_cfg->access_ipl = SDCARD_ACCESS_PRIORITY;
970+
*(irq_ptr + last_interrupt_index) = (uint32_t)sdhimmc_accs_isr;
971+
R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SDHIMMC0_ACCS);
972+
last_interrupt_index++;
973+
}
974+
/*
975+
this interrupt is neeed if DTC is used but it must not be used if
976+
DMA is used
977+
-----------
978+
if(sd_cfg->dma_req_irq == FSP_INVALID_VECTOR) {
979+
sd_cfg->dma_req_irq = (IRQn_Type)last_interrupt_index;
980+
sd_cfg->dma_req_ipl = SDCARD_DMA_REQ_PRIORITY;
981+
*(irq_ptr + last_interrupt_index) = (uint32_t)sdhimmc_dma_req_isr;
982+
R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SDHIMMC0_DMA_REQ);
983+
last_interrupt_index++;
984+
}
985+
*/
986+
if(sd_cfg->card_irq == FSP_INVALID_VECTOR) {
987+
sd_cfg->card_irq = (IRQn_Type)last_interrupt_index;
988+
sd_cfg->card_ipl = SDCARD_CARD_PRIORITY;
989+
*(irq_ptr + last_interrupt_index) = (uint32_t)sdhimmc_card_isr;
990+
R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SDHIMMC0_CARD);
991+
last_interrupt_index++;
992+
}
993+
}
994+
995+
if(sd_cfg->access_irq == FSP_INVALID_VECTOR || sd_cfg->dma_req_irq == FSP_INVALID_VECTOR || sd_cfg->card_irq == FSP_INVALID_VECTOR) {
996+
rv = false;
997+
}
998+
rv = true;
999+
}
1000+
#endif
9541001
else {
9551002
rv = false;
9561003
}

cores/arduino/IRQManager.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ typedef enum {
4343
IRQ_CAN,
4444
IRQ_ETHERNET,
4545
IRQ_CANFD,
46+
IRQ_SDCARD
4647
} Peripheral_t;
4748

49+
#if SDCARD_HOWMANY > 0
50+
#include "r_sdhi.h"
51+
#endif
52+
53+
4854
#if RTC_HOWMANY > 0
4955
#include "r_rtc_api.h"
5056
#include "r_rtc.h"
@@ -180,6 +186,9 @@ void ether_eint_isr (void);
180186
void canfd_error_isr(void);
181187
void canfd_rx_fifo_isr(void);
182188
void canfd_channel_tx_isr(void);
189+
void sdhimmc_dma_req_isr(void);
190+
void sdhimmc_accs_isr(void);
191+
void sdhimmc_card_isr(void);
183192
#ifdef __cplusplus
184193
}
185194
#endif

extras/Filesystems/FatFs/LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FatFs License
2+
3+
FatFs has being developped as a personal project of the author, ChaN. It is free from the code anyone else wrote at current release. Following code block shows a copy of the FatFs license document that heading the source files.
4+
5+
/*----------------------------------------------------------------------------/
6+
/ FatFs - Generic FAT Filesystem Module Rx.xx /
7+
/-----------------------------------------------------------------------------/
8+
/
9+
/ Copyright (C) 20xx, ChaN, all right reserved.
10+
/
11+
/ FatFs module is an open source software. Redistribution and use of FatFs in
12+
/ source and binary forms, with or without modification, are permitted provided
13+
/ that the following condition is met:
14+
/
15+
/ 1. Redistributions of source code must retain the above copyright notice,
16+
/ this condition and the following disclaimer.
17+
/
18+
/ This software is provided by the copyright holder and contributors "AS IS"
19+
/ and any warranties related to this software are DISCLAIMED.
20+
/ The copyright owner or contributors be NOT LIABLE for any damages caused
21+
/ by use of this software.
22+
/----------------------------------------------------------------------------*/
23+
24+
Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.

0 commit comments

Comments
 (0)