<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<IP DBVersion="V4.0" Name="FATFS" Version="STM32Cube_FW_L5_V0.5.0" RootFolder="Middlewares/Third_Party/FatFs/" CodeTemplate="fatfs_c.ftl;fatfs_h.ftl"
    IncludeFile="ff.h;ff_gen_drv.h"
    xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance"
    ns0:schemaLocation="http://mcd.rou.st.com/modules.php?name=mcu ../../../../../../../doc/V4/Development/Specifications/db/IP_Configs.xsd"
    xmlns="http://mcd.rou.st.com/modules.php?name=mcu">

    <RefConfig Name="FATFS_SDIO_Init" Comment="SD">
        <Component Name="Middleware:FATFS:SDIO"/>
        <Component Name="Middleware:FATFS:CODE_PAGE:$VIRTUAL_CODE_PAGE"/>
        <ConfigFile Name="FF_CONF"/>  
        <!-- <ConfigFile Name="BSP_SD_C"/> -->   <!-- BSP code no more generated (waiting for full BSP support in CubeMx -->
        <!-- <ConfigFile Name="BSP_SD_H"/> -->   <!-- BSP code no more generated (waiting for full BSP support in CubeMx -->
        <ConfigFile Name="FATFS_INIT"/>
        <ConfigFile Name="FATFS_HEADER"/>
        <ConfigFile Name="SD_DISKIO_TEMPLATE_H"/>
        <ConfigFile Name="SD_DISKIO_TEMPLATE_C"/>
    </RefConfig>
    
    <RefConfig Name="FATFS_SRAM_Init" Comment="SRAMDISK">
        <Component Name="Middleware:FATFS:SRAM"/>
        <Component Name="Middleware:FATFS:CODE_PAGE:$VIRTUAL_CODE_PAGE"/>
        <ConfigFile Name="FF_CONF"/>
        <!-- <ConfigFile Name="BSP_SRAM_C"/> --> <!-- BSP code no more generated (waiting for full BSP support in CubeMx -->
        <!-- <ConfigFile Name="BSP_SRAM_H"/> --> <!-- BSP code no more generated (waiting for full BSP support in CubeMx -->
        <ConfigFile Name="FATFS_INIT"/>
        <ConfigFile Name="FATFS_HEADER"/>
        <ConfigFile Name="SRAM_DISKIO_TEMPLATE_H"/>
        <ConfigFile Name="SRAM_DISKIO_TEMPLATE_C"/>
    </RefConfig>
    
    <RefConfig Name="FATFS_USER_DEFINED_Init" Comment="USER">
        <Component Name="Middleware:FATFS:GENERIC"/>
        <Component Name="Middleware:FATFS:CODE_PAGE:$VIRTUAL_CODE_PAGE"/>
        <ConfigFile Name="FF_CONF"/>
        <ConfigFile Name="USER_DISKIO_C"/>
        <ConfigFile Name="USER_DISKIO_H"/>
        <ConfigFile Name="FATFS_INIT"/>
        <ConfigFile Name="FATFS_HEADER"/>
    </RefConfig>
    
    <RefComponent Cclass="Middleware" Cgroup="FATFS" Cversion="0.1.0">
        <!-- <File Name="src/*.h" Category="header"/>  -->
        <File Name="src/diskio.h" Category="header"/>
        <File Name="src/ff.h" Category="header"/>
        <File Name="src/ff_gen_drv.h" Category="header"/>
        <File Name="src/integer.h" Category="header"/>
        
        <!--  <File Name="src/*.c" Category="source"/> -->
        <File Name="src/diskio.c" Category="source"/>
        <File Name="src/ff.c" Category="source"/>
        <File Name="src/ff_gen_drv.c" Category="source"/>
        
        <File Name="src/option/syscall.c" Category="source"/>

        <SubComponent Csub="CODE_PAGE" Cvariant="932" >
            <File Name="src/option/cc932.c" Category="source"/>
        </SubComponent>
        <SubComponent Csub="CODE_PAGE" Cvariant="936" >
            <File Name="src/option/cc936.c" Category="source"/>
        </SubComponent>
        <SubComponent Csub="CODE_PAGE" Cvariant="949" >
            <File Name="src/option/cc949.c" Category="source"/>
        </SubComponent>
        <SubComponent Csub="CODE_PAGE" Cvariant="950" >
            <File Name="src/option/cc950.c" Category="source"/>
        </SubComponent>
        <SubComponent Csub="CODE_PAGE" Cvariant="850" >
            <File Name="src/option/ccsbcs.c" Category="source"/>
        </SubComponent>
    </RefComponent>

    <!-- use specific template file "fatfs_conf_R12c.ftl" to generate header file containing #define -->
    <RefConfigFile Name="FF_CONF" Description="Header file for #define" Template="fatfs_conf_R12_l5.ftl">      
        <File Name="Target/ffconf.h" Category="header" Version="R0.12" Condition="all"/>
        <!-- Parameters for Function and Buffer Configurations -->
        <Argument Name="_FS_TINY" GenericType="simple" Comment="0:Normal or 1:Tiny"/>
        <Argument Name="_FS_READONLY" GenericType="simple" Comment="0:Read/Write or 1:Read only"/>
        <Argument Name="_FS_MINIMIZE" GenericType="simple" Comment="0 to 3"/>
        <Argument Name="_USE_STRFUNC" GenericType="simple" Comment="0:Disable or 1-2:Enable"/>
        <Argument Name="_USE_FIND" GenericType="simple" Comment="0:Disable or 1:Enable"/>                  <!-- New in R0.11 --> 
        <Argument Name="_USE_MKFS" GenericType="simple" Comment="0:Disable or 1:Enable"/>
        <Argument Name="_USE_FORWARD" GenericType="simple" Comment="0:Disable or 1:Enable"/>
        <Argument Name="_USE_LABEL" GenericType="simple" Comment="0:Disable or 1:Enable"/>
        <Argument Name="_USE_FASTSEEK" GenericType="simple" Comment="0:Disable or 1:Enable"/>
        <!-- Parameters for Locale and Namespace Configurations -->
        <Argument Name="_CODE_PAGE" GenericType="simple" Comment="The _CODE_PAGE specifies the OEM code page to be used on the target system"/>
        <Argument Name="_USE_LFN" GenericType="simple" Comment="0 to 3"/>
        <Argument Name="_MAX_LFN" GenericType="simple" Comment="Maximum LFN length to handle (12 to 255)"/>
        <Argument Name="_LFN_UNICODE" GenericType="simple" Comment="0:ANSI/OEM or 1:Unicode"/>
        <Argument Name="_STRF_ENCODE" GenericType="simple" Comment="0:ANSI/OEM, 1:UTF-16LE, 2:UTF-16BE, 3:UTF-8"/>
        <Argument Name="_FS_RPATH" GenericType="simple" Comment="0 to 2"/>	
        <!-- Parameters for Physical Drive Configurations  -->
        <Argument Name="_VOLUMES" GenericType="simple" Comment="Number of volumes (logical drives) to be used"/>
        <Argument Name="_MAX_SS" GenericType="simple" Comment="512, 1024, 2048 or 4096"/>
        <Argument Name="_MIN_SS" GenericType="simple" Comment="512, 1024, 2048 or 4096"/>
        <Argument Name="_MULTI_PARTITION" GenericType="simple" Comment="0:Single partition, 1:Enable multiple partition"/>
        <Argument Name="_USE_TRIM" GenericType="simple" Comment="0:Disable or 1:Enable"/>                  <!-- Renamed in R0.11 --> 
        <Argument Name="_FS_NOFSINFO" GenericType="simple" Comment="0: Load all informations in the FSINFO if available, 1: Do not trust free cluster count in the FSINFO"/>
        <!-- Parameters for System Configurations   -->
        <Argument Name="_FS_NORTC" GenericType="simple" Comment="0 or 1"/>                                 <!-- New in R0.11 -->  
        <Argument Name="_NORTC_YEAR" GenericType="simple" Comment="1980..2107"/>                           <!-- New in R0.11 -->  
        <Argument Name="_NORTC_MON" GenericType="simple" Comment="1..12"/>                                 <!-- New in R0.11 -->  
        <Argument Name="_NORTC_MDAY" GenericType="simple" Comment="1..31"/>                                <!-- New in R0.11 -->  
        <Argument Name="_WORD_ACCESS" GenericType="simple" Comment="0 or 1"/>
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment="0:Disable or 1:Enable"/>
        <Argument Name="_FS_TIMEOUT" GenericType="simple" Comment="Timeout period in unit of time ticks"/>
        <Argument Name="_SYNC_t" GenericType="simple" Comment="O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.."/>		
        <Argument Name="_FS_LOCK" GenericType="simple" Comment="0:Disable or >=1:Enable"/>        
        <!-- Internal: for detecting enabled modes and include the right files -->
        <Argument Name="_FS_FATFS_SDIO" GenericType="simple" Comment="0:Disable or >=1:Enable"/> 
        <Argument Name="_FS_FATFS_USB" GenericType="simple" Comment="0:Disable or >=1:Enable"/> 
        <!-- To get the right handle for USBH (FS or HS) -->
        <Argument Name="_HUSBH" GenericType="simple" Comment=""/>
        <!-- R0.12 -->
        <Argument Name="_USE_EXPAND" GenericType="simple" Comment=""/>
        <Argument Name="_USE_CHMOD" GenericType="simple" Comment=""/>
        <Argument Name="_FS_EXFAT" GenericType="simple" Comment=""/>
        <!-- Specific to SRAM on L5 -->  
        <Argument Name="SD_BSP_CODE" GenericType="simple" Comment=""/>
        <!-- To better support CMSIS-RTOS v2 with updated FatFS syscall.c -->
        <Argument Name="_USE_MUTEX" GenericType="simple" Comment="FatFS synchronization object"/>		
    </RefConfigFile> 

    <!-- ***************************************** SD Card mode **********************************************  -->
    <!-- Generate a driver file for SD that uses the right IP handle -->
    <RefConfigFile Name="BSP_SD_C" Description="C driver file for SD" Template="fatfs_bsp_sdio_c_l5.ftl">    
        <File Name="Target/bsp_driver_sd.c" Category="source" Version="R0.12" Condition="!S_CUSTOM_BSP_FOR_SD"/>  <!--  not generated if custom bsp in use -->
        <Argument Name="_HSD" GenericType="simple" Comment=""/>                 
        <Argument Name="SDMMC1_MODE" GenericType="simple" Comment="SD mode value"/>                     
    </RefConfigFile>
    
    <!-- Generate a driver file for SD that uses the right IP handle -->
    <RefConfigFile Name="BSP_SD_H" Description="H driver file for SD" Template="fatfs_bsp_sdio_h_l5.ftl">
        <File Name="Target/bsp_driver_sd.h" Category="header" Version="R0.12" Condition="!S_CUSTOM_BSP_FOR_SD"/>  <!--  not generated if custom bsp in use -->
    </RefConfigFile>

    <!-- NEW FILE FOR R12 -->
    <!-- 
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_H" Description="TEMPLATE for SD_DISKIO_H" Template="fatfs_sd_diskio_dma_template_h_L5.ftl">     
        <File Name="Target/sd_diskio.h" Category="header" Version="R0.12" Condition="S_DMA_TEMPLATE_ENABLED &amp; S_CUSTOM_BSP_FOR_SD"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/>
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
        <Argument Name="BOARD_NAME" GenericType="simple" Comment=""/>
    </RefConfigFile>
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_H" Description="TEMPLATE for SD_DISKIO_H" Template="fatfs_sd_diskio_no_dma_template_h_L5.ftl">     
        <File Name="Target/sd_diskio.h" Category="header" Version="R0.12" Condition="!S_DMA_TEMPLATE_ENABLED &amp; S_CUSTOM_BSP_FOR_SD"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="BOARD_NAME" GenericType="simple" Comment=""/> 
    </RefConfigFile>
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_H" Description="TEMPLATE for SD_DISKIO_H" Template="fatfs_sd_diskio_template_h.ftl">
        <File Name="Target/sd_diskio.h" Category="header" Version="R0.12" Condition="!S_CUSTOM_BSP_FOR_SD"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/> 
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
    </RefConfigFile>
    -->
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_H" Description="TEMPLATE for SD_DISKIO_H" Template="fatfs_sd_diskio_template_h_l5.ftl">    
        <File Name="Target/sd_diskio.h" Category="header" Version="R0.12" Condition="all"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/> 
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
    </RefConfigFile>  
    
    <!-- NEW FILE FOR R12 -->
    <!-- 
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_C" Description="TEMPLATE for SD_DISKIO_C" Template="fatfs_sd_diskio_dma_template_c_L5.ftl">
        <File Name="Target/sd_diskio.c" Category="source" Version="R0.12" Condition="S_DMA_TEMPLATE_ENABLED &amp; (S_STM32L552E_EVAL_BOARD | S_STM32L562E_DISCOVERY_BOARD)"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/>
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
    </RefConfigFile>
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_C" Description="TEMPLATE for SD_DISKIO_C" Template="fatfs_sd_diskio_no_dma_template_c_L5.ftl"> 
        <File Name="Target/sd_diskio.c" Category="header" Version="R0.12" Condition="(S_STM32L552E_EVAL_BOARD | S_STM32L562E_DISCOVERY_BOARD | S_STM32L552ZE_NUCLEO_BOARD)"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="BOARD_NAME" GenericType="simple" Comment=""/> 
    </RefConfigFile>
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_C" Description="TEMPLATE for SD_DISKIO_C" Template="fatfs_sd_diskio_template_c.ftl">
        <File Name="Target/sd_diskio.c" Category="source" Version="R0.12" Condition="!S_CUSTOM_BSP_FOR_SD"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/>
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
    </RefConfigFile>
    -->
    <RefConfigFile Name="SD_DISKIO_TEMPLATE_C" Description="TEMPLATE for SD_DISKIO_C" Template="fatfs_sd_diskio_template_c_l5.ftl"> 
        <File Name="Target/sd_diskio.c" Category="source" Version="R0.12" Condition="all"/>  
        <Argument Name="_HSD" GenericType="simple" Comment=""/>
        <Argument Name="USE_DMA_CODE_SD" GenericType="simple" Comment=""/>
        <Argument Name="_FS_REENTRANT" GenericType="simple" Comment=""/>
    </RefConfigFile>


    <!-- *************************************** External SRAM mode ***********************************************  -->
    <!-- Generate a driver file for SRAM that uses the right IP handle -->
    <RefConfigFile Name="BSP_SRAM_C" Description="C driver file for SRAM" Template="fatfs_bsp_sram_c_l5.ftl">  
        <File Name="Target/bsp_driver_sram.c" Category="source" Version="R0.12" Condition="all"/>  <!-- should not be generated if custom bsp in use -->
        <Argument Name="_HSRAM" GenericType="simple" Comment=""/>     
    </RefConfigFile>
    
    <!-- Generate a driver file for SRAM that uses the right IP handle -->
    <RefConfigFile Name="BSP_SRAM_H" Description="H driver file for SRAM" Template="fatfs_bsp_sram_h_l5.ftl">       
        <File Name="Target/bsp_driver_sram.h" Category="header" Version="R0.12" Condition="all"/>  <!-- should not be generated if custom bsp in use -->                 
    </RefConfigFile>

    <!-- GENERIC DISKIO files (when GENERIC code is used) -->
    <RefConfigFile Name="SRAM_DISKIO_TEMPLATE_H" Description="TEMPLATE for SRAM_DISKIO_H" Template="fatfs_sram_diskio_template_h_l5.ftl">       
        <File Name="Target/sram_diskio.h" Category="header" Version="R0.12" Condition="all"/>
        <Argument Name="_HSRAM" GenericType="simple" Comment=""/> 
    </RefConfigFile>
    
    <RefConfigFile Name="SRAM_DISKIO_TEMPLATE_C" Description="TEMPLATE for SRAM_DISKIO_C" Template="fatfs_sram_diskio_template_c_l5.ftl">       
        <File Name="Target/sram_diskio.c" Category="source" Version="R0.12" Condition="all"/>
        <Argument Name="_HSRAM" GenericType="simple" Comment=""/>
    </RefConfigFile>
    

    <!-- ***************** User defined mode (normal one, not the one of G0/WB/G4) *****************  -->
    <!--  GENERIC DISKIO C files -->
    <!-- Generate a generic diskio C driver file (user_diskio.c file)  -->
    <RefConfigFile Name="USER_DISKIO_C" Description="GENERIC C diskio driver file" Template="fatfs_user_diskio_c.ftl">       
        <File Name="Target/user_diskio.c" Category="source" Version="R0.12" Condition="all"/>    
        <Argument Name="NEW_DISKIO_API" GenericType="simple" Comment=""/>
    </RefConfigFile>
    
    <!-- Generate a generic diskio H driver file -->
    <RefConfigFile Name="USER_DISKIO_H" Description="GENERIC H driver file" Template="fatfs_user_diskio_h.ftl">       
        <File Name="Target/user_diskio.h" Category="header" Version="R0.12" Condition="all"/>                    
    </RefConfigFile>
    <!--  GENERIC DISKIO C files -->

    
    <!-- Generate a init code file (app_fatfs.c) -->
    <!--  DISKIO_CODE is used to detect USER Defined mode... On L5 will always be equals to 0, then USER_DEFINED standard (not the one of G0/WB/G4) -->
    <RefConfigFile Name="FATFS_INIT" Description="FATFS Init code file" Template="fatfs_init_l5.ftl">       
        <File Name="App/app_fatfs.c" Category="source" Version="R0.12" Condition="S_FATFS_Generic_FOR_M33"/>        
        <Argument Name="_FS_NORTC" GenericType="simple" Comment="0 or 1"/>                 
        <Argument Name="_MULTI_PARTITION" GenericType="simple" Comment="0 or 1"/>
        <Argument Name="DISKIO_CODE" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SRAM" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SDIO" GenericType="simple" Comment=""/>        
    </RefConfigFile>
    <RefConfigFile Name="FATFS_INIT" Description="FATFS Init code file" Template="fatfs_init_l5.ftl">       
        <File Name="App/app_fatfs.c" Category="source" Version="R0.12" Condition="!S_FATFS_Generic_FOR_M33"/>        
        <Argument Name="_FS_NORTC" GenericType="simple" Comment="0 or 1"/>                                 
        <Argument Name="_MULTI_PARTITION" GenericType="simple" Comment="0 or 1"/>
        <Argument Name="_FS_FATFS_SRAM" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SDIO" GenericType="simple" Comment=""/>   
    </RefConfigFile>    

    <!-- Generate header for the init code file (app_fatfs.h) -->
    <!--  DISKIO_CODE is used to detect USER Defined mode... On L5 will always be equals to 0, then USER_DEFINED standard (not the one of G0/WB/G4) -->
    <RefConfigFile Name="FATFS_HEADER" Description="FATFS header file" Template="fatfs_header_l5.ftl">       
        <File Name="App/app_fatfs.h" Category="source" Version="R0.12" Condition="S_FATFS_Generic_FOR_M33"/>
        <Argument Name="DISKIO_CODE" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SRAM" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SDIO" GenericType="simple" Comment=""/>   
    </RefConfigFile>
    <RefConfigFile Name="FATFS_HEADER" Description="FATFS header file" Template="fatfs_header_l5.ftl">       
        <File Name="App/app_fatfs.h" Category="source" Version="R0.12" Condition="!S_FATFS_Generic_FOR_M33"/>
        <Argument Name="_FS_FATFS_SRAM" GenericType="simple" Comment=""/>
        <Argument Name="_FS_FATFS_SDIO" GenericType="simple" Comment=""/>   
    </RefConfigFile>
    
    <!-- Code for BSP (SDIO mode) -->
    <!--  not used yet on L5
    <RefBspComponent Name="Detect_SDIO" BspIpName="GPIO" BspModeName="Input">       
        <File Category="template" Name="fatfs_platform_h.ftl"/>
        <File Category="template" Name="fatfs_platform_c.ftl"/>
    </RefBspComponent>
    -->

</IP>
