Changeset 154 for uKadecot


Ignore:
Timestamp:
Feb 2, 2016, 9:54:35 PM (8 years ago)
Author:
coas-nagasima
Message:

SDカードの中身を/~/でアクセスできるよう変更

Location:
uKadecot/trunk
Files:
4 added
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • uKadecot/trunk/csp/flash/ukadecot_cat.bat

    r101 r154  
    22set fn=%date:~-10,4%%date:~-5,2%%date:~-2,2%%time2:~0,2%%time2:~3,2%%time2:~6,2%
    33
    4 ..\..\srecord\srec_cat --address-length=4 --line-length=70 ..\ukadecot\DefaultBuild\ukadecot.mot ..\..\uip\apps\webserver\httpd-fs.bin -binary -offset 0xFFF00000 ..\..\kadecot\kadecot_names.bin -binary -offset 0xFFFE0000  -o ukadecot_%fn%.mot
     4..\..\srecord\srec_cat --address-length=4 --line-length=70 ..\ukadecot\DefaultBuild\ukadecot.mot ..\..\uip\apps\webserver\httpd-fs.bin -binary -offset 0xFFF00000 ..\..\kadecot\kadecot_names.bin -binary -offset 0xFFFE0000  -o ..\flash\ukadecot_%fn%.mot
  • uKadecot/trunk/csp/ukadecot/cfg/cfg.mtsp

    r101 r154  
    150150      <GeneralOptionSaveAcc-DefaultValue>False</GeneralOptionSaveAcc-DefaultValue>
    151151      <IsLockedByUser>False</IsLockedByUser>
    152       <TimeTagModified--0>-8587688952440286552</TimeTagModified--0>
     152      <TimeTagModified--0>-8587473084430197473</TimeTagModified--0>
    153153      <BuildMode-0>DefaultBuild</BuildMode-0>
    154154      <Memo-0 />
     
    156156      <FormatBuildOptionList-0>%TargetFiles% : %Program% %Options%</FormatBuildOptionList-0>
    157157      <PreBuildCommands-0>if exist "%OutputDir%\%ProjectName%.syms" del "%OutputDir%\%ProjectName%.syms"
    158 ..\..\..\ssp\cfg\cfg\cfg.exe --pass 1 --kernel ssp --api-table ..\..\..\ssp\kernel\ssp_kernel_api.csv --api-table ..\..\..\ecnl_ssp\echonet_api.csv --cfg1-def-table ..\..\..\ssp\kernel\ssp_kernel_def.csv --cfg1-def-table ..\..\..\ssp\syssvc\syssvc_def.csv --cfg1-def-table ..\..\..\ssp\arch\rx630_ccrx\prc_def.csv --cfg1-def-table ..\..\..\ssp\target\grsakura_ccrx\target_def.csv --cfg1-def-table ..\..\..\ecnl_ssp\echonet_def.csv -I ..\..\..\ssp -I ..\..\..\ssp\arch -I ..\..\..\ssp\include -I ..\..\..\ssp\target\grsakura_ccrx -I ..\..\..\uip\task -I ..\..\..\uip\target\if_rx62n -I ..\..\..\ecnl_ssp -I ..\..\..\src\ukadecot ..\..\..\src\ukadecot\main.cfg
     158..\..\..\ssp\cfg\cfg\cfg.exe --pass 1 --kernel ssp --api-table ..\..\..\ssp\kernel\ssp_kernel_api.csv --api-table ..\..\..\ecnl_ssp\echonet_api.csv --cfg1-def-table ..\..\..\ssp\kernel\ssp_kernel_def.csv --cfg1-def-table ..\..\..\ssp\syssvc\syssvc_def.csv --cfg1-def-table ..\..\..\ssp\arch\rx630_ccrx\prc_def.csv --cfg1-def-table ..\..\..\ssp\target\grsakura_ccrx\target_def.csv --cfg1-def-table ..\..\..\ecnl_ssp\echonet_def.csv -I ..\..\..\ssp -I ..\..\..\ssp\arch -I ..\..\..\ssp\include -I ..\..\..\ssp\target\grsakura_ccrx -I ..\..\..\uip\task -I ..\..\..\uip\target\if_rx62n -I ..\..\..\pfatfs -I ..\..\..\ecnl_ssp -I ..\..\..\src\ukadecot ..\..\..\src\ukadecot\main.cfg
    159159</PreBuildCommands-0>
    160160      <PostBuildCommands-0>..\..\..\ssp\arch\ccrx\gensyms.exe "%OutputDir%\%ProjectName%.map"
    161161%WinDir%\cscript //Nologo ..\..\tools\update.js "%OutputDir%\%ProjectName%.mot" cfg1_out.srec
    162 ..\..\..\ssp\cfg\cfg\cfg.exe --pass 2 --kernel ssp --api-table ..\..\..\ssp\kernel\ssp_kernel_api.csv --api-table ..\..\..\ecnl_ssp\echonet_api.csv --cfg1-def-table ..\..\..\ssp\kernel\ssp_kernel_def.csv --cfg1-def-table ..\..\..\ssp\syssvc\syssvc_def.csv --cfg1-def-table ..\..\..\ssp\arch\rx630_ccrx\prc_def.csv --cfg1-def-table ..\..\..\ssp\target\grsakura_ccrx\target_def.csv --cfg1-def-table ..\..\..\ecnl_ssp\echonet_def.csv -I ..\..\..\ssp -I ..\..\..\ssp\arch -I ..\..\..\ssp\arch\rx630_ccrx -I ..\..\..\ssp\include -I ..\..\..\ssp\kernel -I ..\..\..\ssp\target\grsakura_ccrx -I ..\..\..\uip\task -I ..\..\..\uip\target\if_rx62n -I ..\..\..\ecnl_ssp -I ..\..\..\src\ukadecot --template-file ..\..\..\ssp\target\grsakura_ccrx\target_echonet.tf ..\..\..\src\ukadecot\main.cfg
     162..\..\..\ssp\cfg\cfg\cfg.exe --pass 2 --kernel ssp --api-table ..\..\..\ssp\kernel\ssp_kernel_api.csv --api-table ..\..\..\ecnl_ssp\echonet_api.csv --cfg1-def-table ..\..\..\ssp\kernel\ssp_kernel_def.csv --cfg1-def-table ..\..\..\ssp\syssvc\syssvc_def.csv --cfg1-def-table ..\..\..\ssp\arch\rx630_ccrx\prc_def.csv --cfg1-def-table ..\..\..\ssp\target\grsakura_ccrx\target_def.csv --cfg1-def-table ..\..\..\ecnl_ssp\echonet_def.csv -I ..\..\..\ssp -I ..\..\..\ssp\arch -I ..\..\..\ssp\arch\rx630_ccrx -I ..\..\..\ssp\include -I ..\..\..\ssp\kernel -I ..\..\..\ssp\target\grsakura_ccrx -I ..\..\..\uip\task -I ..\..\..\uip\target\if_rx62n -I ..\..\..\pfatfs -I ..\..\..\ecnl_ssp -I ..\..\..\src\ukadecot --template-file ..\..\..\ssp\target\grsakura_ccrx\target_echonet.tf ..\..\..\src\ukadecot\main.cfg
    163163%WinDir%\cscript //Nologo ..\..\tools\cmp_update.js kernel_cfg.c ..\kernel_cfg.c
    164164%WinDir%\cscript //Nologo ..\..\tools\cmp_update.js kernel_cfg.h ..\kernel_cfg.h
     
    252252      <COptionShowExpansions-DefaultValue>False</COptionShowExpansions-DefaultValue>
    253253      <COptionCommandLine-DefaultValue>-cpu=rx600
     254-fpu
    254255-include=.
    255256-include=..\..\..\ssp
     
    262263-include=..\..\..\uip\task
    263264-include=..\..\..\uip\target\if_rx62n
     265-include=..\..\..\pfatfs
    264266-include=..\..\..\ecnl_ssp
    265267-include=..\..\..\src\ukadecot
     
    268270-obj_path=%BuildModeName%
    269271-debug
    270 -fpu
    271272-nologo
    272273</COptionCommandLine-DefaultValue>
     
    323324      <COptionIncode-DefaultValue>Sjis</COptionIncode-DefaultValue>
    324325      <IsLockedByUser>False</IsLockedByUser>
    325       <TimeTagModified--0>-8587805601566661072</TimeTagModified--0>
     326      <TimeTagModified--0>-8587473084216714553</TimeTagModified--0>
    326327      <COptionLangC-0>C99</COptionLangC-0>
    327328      <COptionListfile-0>False</COptionListfile-0>
     
    349350..\..\..\uip\task
    350351..\..\..\uip\target\if_rx62n
     352..\..\..\pfatfs
    351353..\..\..\ecnl_ssp
    352354..\..\..\src\ukadecot
     
    369371      <COptionShowExpansions-0>False</COptionShowExpansions-0>
    370372      <COptionCommandLine-0>-cpu=rx600
     373-fpu
    371374-include=.
    372375-include=..\..\..\ssp
     
    379382-include=..\..\..\uip\task
    380383-include=..\..\..\uip\target\if_rx62n
     384-include=..\..\..\pfatfs
    381385-include=..\..\..\ecnl_ssp
    382386-include=..\..\..\src\ukadecot
     
    385389-obj_path=%BuildModeName%
    386390-debug
    387 -fpu
    388391-nologo
    389392</COptionCommandLine-0>
     
    456459      <AsmOptionPostAssembleCommands-DefaultValue />
    457460      <AsmOptionOtherAdditionalOptions-DefaultValue />
    458       <AsmOptionCommandLine-DefaultValue />
     461      <AsmOptionCommandLine-DefaultValue>-cpu=rx600
     462-fpu
     463-output=obj
     464-obj_path=%BuildModeName%
     465-debug
     466-nologo
     467</AsmOptionCommandLine-DefaultValue>
    459468      <IsLockedByUser>False</IsLockedByUser>
    460469      <TimeTagModified--0>-8588053503357851523</TimeTagModified--0>
     
    477486      <AsmOptionPostAssembleCommands-0 />
    478487      <AsmOptionOtherAdditionalOptions-0 />
    479       <AsmOptionCommandLine-0 />
     488      <AsmOptionCommandLine-0>-cpu=rx600
     489-fpu
     490-output=obj
     491-obj_path=%BuildModeName%
     492-debug
     493-nologo
     494</AsmOptionCommandLine-0>
    480495    </Instance>
    481496    <Instance Guid="dbb16727-3e81-4169-956a-790355cab4a1">
  • uKadecot/trunk/csp/ukadecot/ukadecot.mtpj

    r152 r154  
    493493      <Property>de34d294-295e-4251-bd6b-48cc727775f3</Property>
    494494    </Instance>
     495    <Instance Guid="d0c23ad0-6fec-42a7-8e61-72b8e19d5edb">
     496      <Name>mmc_rspi.c</Name>
     497      <Type>File</Type>
     498      <RelativePath>..\..\pfatfs\mmc_rspi.c</RelativePath>
     499      <TreeImageGuid>941832c1-fc3b-4e1b-94e8-01ea17128b42</TreeImageGuid>
     500      <ParentItem>fba78777-38ea-4ff3-b3f8-b7e7823ae080</ParentItem>
     501      <Property>83a38444-6bd9-4d09-acd0-b4b45d3a092e</Property>
     502    </Instance>
    495503  </Class>
    496504  <Class Guid="9033e9fb-2b12-4437-a25e-27b28d42582b">
     
    672680    </Instance>
    673681    <Instance Guid="de34d294-295e-4251-bd6b-48cc727775f3">
     682      <MemoCount>0</MemoCount>
     683    </Instance>
     684    <Instance Guid="83a38444-6bd9-4d09-acd0-b4b45d3a092e">
    674685      <MemoCount>0</MemoCount>
    675686    </Instance>
     
    841852      <SourceItemGuid55>f80fdc1d-1a42-4612-9e72-6cec4e709c34</SourceItemGuid55>
    842853      <SourceItemType55>CSource</SourceItemType55>
    843       <SourceItemCount>56</SourceItemCount>
     854      <SourceItemGuid56>d0c23ad0-6fec-42a7-8e61-72b8e19d5edb</SourceItemGuid56>
     855      <SourceItemType56>CSource</SourceItemType56>
     856      <SourceItemCount>57</SourceItemCount>
    844857      <LastDeviceChangedCounter>0</LastDeviceChangedCounter>
    845858    </Instance>
     
    923936      <GeneralOptionSaveAcc-DefaultValue>False</GeneralOptionSaveAcc-DefaultValue>
    924937      <IsLockedByUser>False</IsLockedByUser>
    925       <TimeTagModified--0>-8587688952440286552</TimeTagModified--0>
     938      <TimeTagModified--0>-8587472822773086219</TimeTagModified--0>
    926939      <BuildMode-0>DefaultBuild</BuildMode-0>
    927940      <Memo-0 />
     
    929942      <FormatBuildOptionList-0>%TargetFiles% : %Program% %Options%</FormatBuildOptionList-0>
    930943      <PreBuildCommands-0 />
    931       <PostBuildCommands-0 />
     944      <PostBuildCommands-0>call ..\flash\ukadecot_cat.bat
     945</PostBuildCommands-0>
    932946      <GeneralOptionIsa-0>None</GeneralOptionIsa-0>
    933947      <GeneralOptionOutput-0>LoadModuleFile</GeneralOptionOutput-0>
     
    10211035-include=..\..\ssp\pdic
    10221036-include=..\..\ssp\target\grsakura_ccrx
    1023 -include=..\..\ccrx\sim\rx63n
    10241037-include=..\..\uip\uip
    10251038-include=..\..\uip\task
     
    10291042-include=..\..\pfatfs
    10301043-include=..\..\ecnl_ssp
     1044-include=..\..\kadecot
    10311045-include=..\..\src\ukadecot
    10321046-define=__LIT,TARGET_KERNEL_SSP,SUPPORT_UIP,JSONSL_NO_JPR
     
    11431157-include=..\..\ssp\pdic
    11441158-include=..\..\ssp\target\grsakura_ccrx
    1145 -include=..\..\ccrx\sim\rx63n
    11461159-include=..\..\uip\uip
    11471160-include=..\..\uip\task
     
    11511164-include=..\..\pfatfs
    11521165-include=..\..\ecnl_ssp
     1166-include=..\..\kadecot
    11531167-include=..\..\src\ukadecot
    11541168-define=__LIT,TARGET_KERNEL_SSP,SUPPORT_UIP,JSONSL_NO_JPR
     
    18991913      <ItemAddTime>635681959164315263</ItemAddTime>
    19001914      <ItemAddTimeCount>1</ItemAddTimeCount>
     1915    </Instance>
     1916    <Instance Guid="d0c23ad0-6fec-42a7-8e61-72b8e19d5edb">
     1917      <ItemAddTime>635899275212434767</ItemAddTime>
     1918      <ItemAddTimeCount>0</ItemAddTimeCount>
    19011919    </Instance>
    19021920    <Instance Guid="a7be515f-f007-45ed-9059-4e1500c0f74d">
     
    21132131      <SourceItem55-BuildingTarget-0>True</SourceItem55-BuildingTarget-0>
    21142132      <SourceItem55-IndividualCompileOption-0>False</SourceItem55-IndividualCompileOption-0>
     2133      <TimeTagModified-SourceItem56--0>-8587473085642341041</TimeTagModified-SourceItem56--0>
     2134      <SourceItem56-IsLockedByUser>False</SourceItem56-IsLockedByUser>
     2135      <SourceItem56-BuildingTarget-0>True</SourceItem56-BuildingTarget-0>
     2136      <SourceItem56-IndividualCompileOption-0>False</SourceItem56-IndividualCompileOption-0>
    21152137    </Instance>
    21162138    <Instance Guid="c20a78d9-8038-46fe-9b87-bc2fa2aa9bdc">
  • uKadecot/trunk/ecnl_ssp/echonet_fbs.c

    r153 r154  
    8989        ER ret = E_OK;
    9090
    91         if ((buf < mpfid->blockes[0]) || (buf >= mpfid->blockes[NUM_ECHONET_MEMPOOL_BLOCK]))
     91        if ((buf < (void *)&mpfid->blockes[0]) || (buf >= (void *)&mpfid->blockes[NUM_ECHONET_MEMPOOL_BLOCK]))
    9292                return E_PAR;
    9393
  • uKadecot/trunk/pfatfs/diskio.c

    r108 r154  
    2121#define RamDisk         ((unsigned char *)0xfff00000)
    2222#else
    23 #include <windows.h>
    24 #include <tchar.h>
    25 #include <winioctl.h>
    26 
    2723unsigned char RamDisk[SZ_RAMDISK * 1024];
     24extern void win_disk_initialize(void *ramDisk, int size);
    2825#endif
    2926
     
    3431        DWORD wip;
    3532        DWORD n_sectors;
    36 } STAT;
     33} RD_STAT;
    3734
    3835static volatile
    39 STAT Stat[MAX_DRIVES];
     36RD_STAT Stat[MAX_DRIVES];
    4037
    4138static
     
    4340
    4441static
    45 int get_status(volatile STAT *stat) {
     42int get_status(volatile RD_STAT *stat) {
    4643        stat->sz_sector = SS_RAMDISK;
    4744        if(stat->sz_sector < _MIN_SS || stat->sz_sector > _MAX_SS) return 0;
     
    5451/* Initialize Disk Drive                                                 */
    5552/*-----------------------------------------------------------------------*/
    56 DSTATUS disk_initialize (void)
     53DSTATUS ramdisk_initialize (void)
    5754{
    5855        DSTATUS sta;
    5956#ifdef _MSC_VER
    60         HANDLE h;
    61         DWORD br;
    62 
    63         h = CreateFile(_T("..\\..\\..\\..\\uip\\apps\\webserver\\httpd-fs.bin"), GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
    64         if (h != INVALID_HANDLE_VALUE) {
    65                 ReadFile(h, RamDisk, sizeof(RamDisk), &br, 0);
    66                 CloseHandle(h);
    67         }
     57        win_disk_initialize(RamDisk, sizeof(RamDisk));
    6858#endif
    6959        get_status(&Stat[0]);
     
    7767/* Get Disk Status                                                       */
    7868/*-----------------------------------------------------------------------*/
    79 DSTATUS disk_get_status (void)
     69DSTATUS ramdisk_get_status (void)
    8070{
    8171        return Stat[0].status;
     
    8575/* Read Partial Sector                                                   */
    8676/*-----------------------------------------------------------------------*/
    87 DRESULT disk_readp (
     77DRESULT ramdisk_readp (
    8878        BYTE* buff,             /* Data read buffer */
    8979        DWORD sector,   /* Sector number (LBA) */
     
    118108/* Write Partial Sector                                                  */
    119109/*-----------------------------------------------------------------------*/
    120 DRESULT disk_writep (
     110DRESULT ramdisk_writep (
    121111        const BYTE* buff,       /* Pointer to the write data */
    122112        DWORD sc                        /* Sector number (LBA), Number of bytes to send */
  • uKadecot/trunk/pfatfs/diskio.h

    r108 r154  
    1919/* Results of Disk Functions */
    2020typedef enum {
    21         RES_OK = 0,             /* 0: Function succeeded */
    22         RES_ERROR,              /* 1: Disk error */
    23         RES_NOTRDY,             /* 2: Not ready */
    24         RES_PARERR              /* 3: Invalid parameter */
     21        RES_OK = 0,             /* 0: Successful */
     22        RES_ERROR,              /* 1: R/W Error */
     23        RES_WRPRT,              /* 2: Write Protected */
     24        RES_NOTRDY,             /* 3: Not Ready */
     25        RES_PARERR              /* 4: Invalid Parameter */
    2526} DRESULT;
    2627
     
    2930/* Prototypes for disk control functions */
    3031
    31 DSTATUS disk_initialize (void);
    32 DSTATUS disk_get_status (void);
    33 DRESULT disk_readp (BYTE* buff, DWORD sector, UINT offset, UINT count);
    34 DRESULT disk_writep (const BYTE* buff, DWORD sc);
     32DSTATUS ramdisk_initialize (void);
     33DSTATUS ramdisk_get_status (void);
     34DRESULT ramdisk_readp (BYTE* buff, DWORD sector, UINT offset, UINT count);
     35DRESULT ramdisk_writep (const BYTE* buff, DWORD sc);
    3536
    3637#define STA_NOINIT              0x01    /* Drive not initialized */
    3738#define STA_NODISK              0x02    /* No medium in the drive */
     39#define STA_PROTECT             0x04    /* Write protected */
    3840
     41/* Generic command (Used by FatFs) */
     42#define CTRL_SYNC                       0       /* Complete pending write process (needed at _FS_READONLY == 0) */
     43#define GET_SECTOR_COUNT        1       /* Get media size (needed at _USE_MKFS == 1) */
     44#define GET_SECTOR_SIZE         2       /* Get sector size (needed at _MAX_SS != _MIN_SS) */
     45#define GET_BLOCK_SIZE          3       /* Get erase block size (needed at _USE_MKFS == 1) */
     46#define CTRL_TRIM                       4       /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
     47
     48/* MMC/SDC specific command (Not used by FatFs) */
     49#define MMC_GET_TYPE            50      /* Get card type */
     50#define MMC_GET_CSD                     51      /* Get CSD */
     51#define MMC_GET_CID                     52      /* Get CID */
     52#define MMC_GET_OCR                     53      /* Get OCR */
     53#define MMC_GET_SDSTAT          54      /* Get SD status */
     54
     55/* MMC card type flags (MMC_GET_TYPE) */
     56#define CT_MMC          0x01            /* MMC ver 3 */
     57#define CT_SD1          0x02            /* SD ver 1 */
     58#define CT_SD2          0x04            /* SD ver 2 */
     59#define CT_SDC          (CT_SD1|CT_SD2) /* SD */
     60#define CT_BLOCK        0x08            /* Block addressing */
    3961
    4062#ifdef __cplusplus
  • uKadecot/trunk/pfatfs/pff.c

    r108 r154  
    5858#define ABORT(err)      {fs->flag = 0; return err;}
    5959
    60 #if _USE_LFN
    61 static WCHAR LfnBuf[_MAX_LFN+1];
    62 #endif
    63 
    6460/*--------------------------------------------------------*/
    6561/* DBCS code ranges and SBCS extend char conversion table */
     
    509505                ofs = bc % 512; bc /= 512;
    510506                if (ofs != 511) {
    511                         if (disk_readp(buf, fs->fatbase + bc, ofs, 2)) break;
     507                        if (fs->disk_readp(buf, fs->fatbase + bc, ofs, 2)) break;
    512508                } else {
    513                         if (disk_readp(buf, fs->fatbase + bc, 511, 1)) break;
    514                         if (disk_readp(buf+1, fs->fatbase + bc + 1, 0, 1)) break;
     509                        if (fs->disk_readp(buf, fs->fatbase + bc, 511, 1)) break;
     510                        if (fs->disk_readp(buf+1, fs->fatbase + bc + 1, 0, 1)) break;
    515511                }
    516512                wc = LD_WORD(buf);
     
    520516#if _FS_FAT16
    521517        case FS_FAT16 :
    522                 if (disk_readp(buf, fs->fatbase + clst / 256, ((UINT)clst % 256) * 2, 2)) break;
     518                if (fs->disk_readp(buf, fs->fatbase + clst / 256, ((UINT)clst % 256) * 2, 2)) break;
    523519                return LD_WORD(buf);
    524520#endif
    525521#if _FS_FAT32
    526522        case FS_FAT32 :
    527                 if (disk_readp(buf, fs->fatbase + clst / 128, ((UINT)clst % 128) * 4, 4)) break;
     523                if (fs->disk_readp(buf, fs->fatbase + clst / 128, ((UINT)clst % 128) * 4, 4)) break;
    528524                return LD_DWORD(buf) & 0x0FFFFFFF;
    529525#endif
     
    673669        BYTE a, ord, sum;
    674670#endif
     671        FATFS *fs = dj->fs;
    675672
    676673        res = dir_rewind(dj);                   /* Rewind directory object */
     
    681678#endif
    682679        do {
    683                 res = disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32)      /* Read an entry */
     680                res = fs->disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32)  /* Read an entry */
    684681                        ? FR_DISK_ERR : FR_OK;
    685682                if (res != FR_OK) break;
     
    735732        BYTE ord = 0xFF, sum = 0xFF;
    736733#endif
     734        FATFS *fs = dj->fs;
    737735
    738736        res = FR_NO_FILE;
    739737        while (dj->sect) {
    740                 res = disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32)      /* Read an entry */
     738                res = fs->disk_readp(dir, dj->sect, (dj->index % 16) * 32, 32)  /* Read an entry */
    741739                        ? FR_DISK_ERR : FR_OK;
    742740                if (res != FR_OK) break;
     
    10721070)
    10731071{
    1074         if (disk_readp(buf, sect, 510, 2))              /* Read the boot record */
     1072        if (fs->disk_readp(buf, sect, 510, 2))          /* Read the boot record */
    10751073                return 3;
    10761074        if (LD_WORD(buf) != 0xAA55)                             /* Check record signature */
    10771075                return 2;
    10781076
    1079         if (!_FS_32ONLY && !disk_readp(buf, sect, BS_FilSysType, 2) && LD_WORD(buf) == 0x4146)  /* Check FAT12/16 */
     1077        if (!_FS_32ONLY && !fs->disk_readp(buf, sect, BS_FilSysType, 2) && LD_WORD(buf) == 0x4146)      /* Check FAT12/16 */
    10801078                return 0;
    1081         if (_FS_FAT32 && !disk_readp(buf, sect, BS_FilSysType32, 2) && LD_WORD(buf) == 0x4146)  /* Check FAT32 */
     1079        if (_FS_FAT32 && !fs->disk_readp(buf, sect, BS_FilSysType32, 2) && LD_WORD(buf) == 0x4146)      /* Check FAT32 */
    10821080                return 0;
    10831081        return 1;
     
    11061104        DWORD bsect, fsize, tsect, mclst;
    11071105
    1108         if (disk_get_status() & STA_NOINIT)     /* Check if the drive is ready or not */
     1106        if (fs->disk_get_status() & STA_NOINIT) /* Check if the drive is ready or not */
    11091107                return FR_NOT_READY;
    11101108
     
    11141112        if (fmt == 1) {                                         /* Not an FAT boot record, it may be FDISK format */
    11151113                /* Check a partition listed in top of the partition table */
    1116                 if (disk_readp(buf, bsect, MBR_Table, 16)) {    /* 1st partition entry */
     1114                if (fs->disk_readp(buf, bsect, MBR_Table, 16)) {        /* 1st partition entry */
    11171115                        fmt = 3;
    11181116                } else {
     
    11271125
    11281126        /* Initialize the file system object */
    1129         if (disk_readp(buf, bsect, 13, sizeof (buf))) return FR_DISK_ERR;
     1127        if (fs->disk_readp(buf, bsect, 13, sizeof (buf))) return FR_DISK_ERR;
    11301128
    11311129        fsize = LD_WORD(buf+BPB_FATSz16-13);                            /* Number of sectors per FAT */
     
    11871185        dj.fn = sp;
    11881186#if _USE_LFN
    1189         dj.lfn = LfnBuf;
     1187        dj.lfn = fs->LfnBuf;
    11901188#endif
    11911189        res = follow_path(&dj, dir, path);      /* Follow the file path */
     
    12491247                rcnt = 512 - (UINT)fs->fptr % 512;                      /* Get partial sector data from sector buffer */
    12501248                if (rcnt > btr) rcnt = btr;
    1251                 dr = disk_readp(!buff ? 0 : rbuff, fs->dsect, (UINT)fs->fptr % 512, rcnt);
     1249                dr = fs->disk_readp(!buff ? 0 : rbuff, fs->dsect, (UINT)fs->fptr % 512, rcnt);
    12521250                if (dr) ABORT(FR_DISK_ERR);
    12531251                fs->fptr += rcnt; rbuff += rcnt;                        /* Update pointers and counters */
     
    12861284
    12871285        if (!btw) {             /* Finalize request */
    1288                 if ((fs->flag & FA__WIP) && disk_writep(0, 0)) ABORT(FR_DISK_ERR);
     1286                if ((fs->flag & FA__WIP) && fs->disk_writep(0, 0)) ABORT(FR_DISK_ERR);
    12891287                fs->flag &= ~FA__WIP;
    12901288                return FR_OK;
     
    13101308                        if (!sect) ABORT(FR_DISK_ERR);
    13111309                        fs->dsect = sect + cs;
    1312                         if (disk_writep(0, fs->dsect)) ABORT(FR_DISK_ERR);      /* Initiate a sector write operation */
     1310                        if (fs->disk_writep(0, fs->dsect)) ABORT(FR_DISK_ERR);  /* Initiate a sector write operation */
    13131311                        fs->flag |= FA__WIP;
    13141312                }
    13151313                wcnt = 512 - (UINT)fs->fptr % 512;                      /* Number of bytes to write to the sector */
    13161314                if (wcnt > btw) wcnt = btw;
    1317                 if (disk_writep(p, wcnt)) ABORT(FR_DISK_ERR);   /* Send data to the sector */
     1315                if (fs->disk_writep(p, wcnt)) ABORT(FR_DISK_ERR);       /* Send data to the sector */
    13181316                fs->fptr += wcnt; p += wcnt;                            /* Update pointers and counters */
    13191317                btw -= wcnt; *bw += wcnt;
    13201318                if ((UINT)fs->fptr % 512 == 0) {
    1321                         if (disk_writep(0, 0)) ABORT(FR_DISK_ERR);      /* Finalize the currtent secter write operation */
     1319                        if (fs->disk_writep(0, 0)) ABORT(FR_DISK_ERR);  /* Finalize the currtent secter write operation */
    13221320                        fs->flag &= ~FA__WIP;
    13231321                }
     
    14011399                dj->fn = sp;
    14021400#if _USE_LFN
    1403                 dj->lfn = LfnBuf;
     1401                dj->lfn = fs->LfnBuf;
    14041402#endif
    14051403                res = follow_path(dj, dir, path);               /* Follow the path to the directory */
  • uKadecot/trunk/pfatfs/pff.h

    r108 r154  
    2424#include "integer.h"
    2525#include "pffconf.h"
     26#include "diskio.h"
    2627
    2728#if _PFATFS != _PFFCONF
     
    3940
    4041typedef struct {
     42        DSTATUS (* disk_get_status)(void);
     43        DRESULT (* disk_readp)(BYTE* buff, DWORD sector, UINT offset, UINT count);
     44        DRESULT (* disk_writep)(const BYTE* buff, DWORD sc);
    4145        BYTE    fs_type;        /* FAT sub type */
    4246        BYTE    flag;           /* File status flags */
     
    5357        CLUST   curr_clust;     /* File current cluster */
    5458        DWORD   dsect;          /* File current data sector */
     59#if _USE_LFN
     60        WCHAR LfnBuf[_MAX_LFN + 1];
     61#endif
    5562} FATFS;
    5663
  • uKadecot/trunk/pfatfs/pffconf.h

    r108 r154  
    1414#define _USE_LSEEK      1       /* Enable pf_lseek() function */
    1515#define _USE_WRITE      1       /* Enable pf_write() function */
     16#define _USE_IOCTL      1       /* Enable pf_ioctl() function */
    1617
    1718#define _FS_FAT12       1       /* Enable FAT12 */
  • uKadecot/trunk/src/ukadecot/main.cfg

    r107 r154  
    4848INCLUDE("nic_ssp.cfg");
    4949INCLUDE("uip_task.cfg");
     50INCLUDE("mmc_rspi.cfg");
    5051INCLUDE("echonet_ssp.cfg");
    5152
  • uKadecot/trunk/ssp/arch/rx630_ccrx/prc_sil.h

    r108 r154  
    4343#define TOPPERS_PRC_SIL_H
    4444
     45#define TOPPERS_OMIT_SIL_ACCESS
    4546
    4647#ifndef TOPPERS_MACRO_ONLY
     
    106107 *  プロセッサのエンディアン
    107108 */
     109#ifdef __LIT
    108110#define SIL_ENDIAN_LITTLE                       /* リトルエンディアン */
    109 
     111#endif
     112#ifdef __BIG
     113#define SIL_ENDIAN_BIG                          /* ビッグエンディアン */
     114#endif
     115
     116
     117/*
     118 *  8ビット単位の読出し/書込み
     119 */
     120#ifdef UINT8_MAX
     121
     122#pragma inline(sil_reb_mem)
     123static uint8_t
     124sil_reb_mem(const volatile uint8_t __evenaccess *mem)
     125{
     126        uint8_t data;
     127
     128        data = *mem;
     129        return(data);
     130}
     131
     132#pragma inline(sil_wrb_mem)
     133static void
     134sil_wrb_mem(volatile uint8_t __evenaccess *mem, uint8_t data)
     135{
     136        *mem = data;
     137}
     138
     139#endif /* UINT8_MAX */
     140
     141/*
     142 *  16ビット単位の読出し/書込み
     143 */
     144
     145#pragma inline(sil_reh_mem)
     146static uint16_t
     147sil_reh_mem(const volatile uint16_t __evenaccess *mem)
     148{
     149        uint16_t        data;
     150
     151        data = *mem;
     152        return(data);
     153}
     154
     155#pragma inline(sil_wrh_mem)
     156static void
     157sil_wrh_mem(volatile uint16_t __evenaccess *mem, uint16_t data)
     158{
     159        *mem = data;
     160}
     161
     162#ifdef SIL_ENDIAN_BIG                   /* ビッグエンディアンプロセッサ */
     163
     164#define sil_reh_bem(mem)                sil_reh_mem(mem)
     165#define sil_wrh_bem(mem, data)  sil_wrh_mem(mem, data)
     166
     167#ifndef TOPPERS_OMIT_SIL_REH_LEM
     168
     169#pragma inline(sil_reh_lem)
     170static uint16_t
     171sil_reh_lem(const volatile uint16_t __evenaccess *mem)
     172{
     173        uint16_t        data;
     174
     175        data = *mem;
     176        return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
     177}
     178
     179#endif /* TOPPERS_OMIT_SIL_REH_LEM */
     180#ifndef TOPPERS_OMIT_SIL_WRH_LEM
     181
     182#pragma inline(sil_wrh_lem)
     183static void
     184sil_wrh_lem(volatile uint16_t __evenaccess *mem, uint16_t data)
     185{
     186        *mem = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
     187}
     188
     189#endif /* TOPPERS_OMIT_SIL_WRH_LEM */
     190#else /* SIL_ENDIAN_BIG */
     191#ifdef SIL_ENDIAN_LITTLE                /* リトルエンディアンプロセッサ */
     192
     193#define sil_reh_lem(mem)                sil_reh_mem(mem)
     194#define sil_wrh_lem(mem, data)  sil_wrh_mem(mem, data)
     195
     196#ifndef TOPPERS_OMIT_SIL_REH_BEM
     197
     198#pragma inline(sil_reh_bem)
     199static uint16_t
     200sil_reh_bem(const volatile uint16_t __evenaccess *mem)
     201{
     202        uint16_t        data;
     203
     204        data = *mem;
     205        return(TOPPERS_SIL_REV_ENDIAN_UINT16(data));
     206}
     207
     208#endif /* TOPPERS_OMIT_SIL_REH_BEM */
     209#ifndef TOPPERS_OMIT_SIL_WRH_BEM
     210
     211#pragma inline(sil_wrh_bem)
     212static void
     213sil_wrh_bem(volatile uint16_t __evenaccess *mem, uint16_t data)
     214{
     215        *mem = TOPPERS_SIL_REV_ENDIAN_UINT16(data);
     216}
     217
     218#endif /* TOPPERS_OMIT_SIL_WRH_BEM */
     219#else /* SIL_ENDIAN_LITTLE */
     220
     221#error Neither SIL_ENDIAN_BIG nor SIL_ENDIAN_LITTLE is defined.
     222
     223#endif /* SIL_ENDIAN_LITTLE */
     224#endif /* SIL_ENDIAN_BIG */
     225
     226/*
     227 *  32ビット単位の読出し/書込み
     228 */
     229
     230#pragma inline(sil_rew_mem)
     231static uint32_t
     232sil_rew_mem(const volatile uint32_t __evenaccess *mem)
     233{
     234        uint32_t        data;
     235
     236        data = *mem;
     237        return(data);
     238}
     239
     240#pragma inline(sil_wrw_mem)
     241static void
     242sil_wrw_mem(volatile uint32_t __evenaccess *mem, uint32_t data)
     243{
     244        *mem = data;
     245}
     246
     247#ifdef SIL_ENDIAN_BIG                   /* ビッグエンディアンプロセッサ */
     248
     249#define sil_rew_bem(mem)                sil_rew_mem(mem)
     250#define sil_wrw_bem(mem, data)  sil_wrw_mem(mem, data)
     251
     252#ifndef TOPPERS_OMIT_SIL_REW_LEM
     253
     254#pragma inline(sil_rew_lem)
     255static uint32_t
     256sil_rew_lem(const volatile uint32_t __evenaccess *mem)
     257{
     258        uint32_t        data;
     259
     260        data = *mem;
     261        return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
     262}
     263
     264#endif /* TOPPERS_OMIT_SIL_REW_LEM */
     265#ifndef TOPPERS_OMIT_SIL_WRW_LEM
     266
     267#pragma inline(sil_wrw_lem)
     268static void
     269sil_wrw_lem(volatile uint32_t __evenaccess *mem, uint32_t data)
     270{
     271        *mem = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
     272}
     273
     274#endif /* TOPPERS_OMIT_SIL_WRW_LEM */
     275#else /* SIL_ENDIAN_BIG */              /* リトルエンディアンプロセッサ */
     276
     277#define sil_rew_lem(mem)                sil_rew_mem(mem)
     278#define sil_wrw_lem(mem, data)  sil_wrw_mem(mem, data)
     279
     280#ifndef TOPPERS_OMIT_SIL_REW_BEM
     281
     282#pragma inline(sil_rew_bem)
     283static uint32_t
     284sil_rew_bem(const volatile uint32_t __evenaccess *mem)
     285{
     286        uint32_t        data;
     287
     288        data = *mem;
     289        return(TOPPERS_SIL_REV_ENDIAN_UINT32(data));
     290}
     291
     292#endif /* TOPPERS_OMIT_SIL_REW_BEM */
     293#ifndef TOPPERS_OMIT_SIL_WRW_BEM
     294
     295#pragma inline(sil_wrw_bem)
     296static void
     297sil_wrw_bem(volatile uint32_t __evenaccess *mem, uint32_t data)
     298{
     299        *mem = TOPPERS_SIL_REV_ENDIAN_UINT32(data);
     300}
     301
     302#endif /* TOPPERS_OMIT_SIL_WRW_BEM */
     303#endif /* SIL_ENDIAN_BIG */
    110304
    111305#endif /* TOPPERS_PRC_SIL_H */
  • uKadecot/trunk/ssp/arch/rx630_ccrx/rx630.h

    r108 r154  
    14751475#define PORT_PCR_B6_BIT                 ( 0x01U << 6U )
    14761476#define PORT_PCR_B7_BIT                 ( 0x01U << 7U )
     1477#define PORT0_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C080 )
     1478#define PORT1_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C082 )
     1479#define PORT2_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C084 )
     1480#define PORT3_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C086 )
     1481#define PORT4_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C088 )
     1482#define PORT5_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08A )
     1483#define PORT6_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08C )
     1484#define PORT7_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08E )
     1485#define PORT8_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C090 )
     1486#define PORT9_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C092 )
     1487#define PORTA_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C094 )
     1488#define PORTB_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C096 )
     1489#define PORTC_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C098 )
     1490#define PORTD_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09A )
     1491#define PORTE_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09C )
     1492#define PORTF_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09E )
     1493#define PORTG_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C0A0 )
     1494#define PORTJ_ODR0_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C0A4 )
     1495#define PORT0_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C081 )
     1496#define PORT1_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C083 )
     1497#define PORT2_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C085 )
     1498#define PORT3_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C087 )
     1499#define PORT4_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C089 )
     1500#define PORT5_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08B )
     1501#define PORT6_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08D )
     1502#define PORT7_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C08F )
     1503#define PORT8_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C091 )
     1504#define PORT9_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C093 )
     1505#define PORTA_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C095 )
     1506#define PORTB_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C097 )
     1507#define PORTC_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C099 )
     1508#define PORTD_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09B )
     1509#define PORTE_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09D )
     1510#define PORTF_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C09F )
     1511#define PORTG_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C0A1 )
     1512#define PORTJ_ODR1_ADDR                 ( ( volatile uint8_t __evenaccess * )0x0008C0A5 )
    14771513
    14781514/*
     
    17671803
    17681804/*
     1805 * RSPI
     1806 */
     1807#define RSPI0_SPCR_ADDR         ( ( volatile uint8_t __evenaccess * )0x00088380 )
     1808#define RSPI1_SPCR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883A0 )
     1809#define RSPI2_SPCR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883C0 )
     1810#define RSPI_SPCR_SPMS_BIT      ( 0x01U << 0U )
     1811#define RSPI_SPCR_TXMD_BIT      ( 0x01U << 1U )
     1812#define RSPI_SPCR_MODFEN_BIT    ( 0x01U << 2U )
     1813#define RSPI_SPCR_MSTR_BIT      ( 0x01U << 3U )
     1814#define RSPI_SPCR_SPEIE_BIT     ( 0x01U << 4U )
     1815#define RSPI_SPCR_SPTIE_BIT     ( 0x01U << 5U )
     1816#define RSPI_SPCR_SPE_BIT       ( 0x01U << 6U )
     1817#define RSPI_SPCR_SPRIE_BIT     ( 0x01U << 7U )
     1818
     1819#define RSPI0_SSLP_ADDR         ( ( volatile uint8_t __evenaccess * )0x00088381 )
     1820#define RSPI1_SSLP_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883A1 )
     1821#define RSPI2_SSLP_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883C1 )
     1822
     1823#define RSPI0_SPPCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x00088382 )
     1824#define RSPI1_SPPCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883A2 )
     1825#define RSPI2_SPPCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883C2 )
     1826
     1827#define RSPI0_SPSR_ADDR         ( ( volatile uint8_t __evenaccess * )0x00088383 )
     1828#define RSPI1_SPSR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883A3 )
     1829#define RSPI2_SPSR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883C3 )
     1830
     1831#define RSPI0_SPDR_ADDR         ( ( volatile uint32_t __evenaccess * )0x00088384 )
     1832#define RSPI1_SPDR_ADDR         ( ( volatile uint32_t __evenaccess * )0x000883A4 )
     1833#define RSPI2_SPDR_ADDR         ( ( volatile uint32_t __evenaccess * )0x000883C4 )
     1834
     1835#define RSPI0_SPSCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x00088388 )
     1836#define RSPI1_SPSCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883A8 )
     1837#define RSPI2_SPSCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883C8 )
     1838
     1839#define RSPI0_SPSSR_ADDR        ( ( volatile uint8_t __evenaccess * )0x00088389 )
     1840#define RSPI1_SPSSR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883A9 )
     1841#define RSPI2_SPSSR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883C9 )
     1842
     1843#define RSPI0_SPBR_ADDR         ( ( volatile uint8_t __evenaccess * )0x0008838A )
     1844#define RSPI1_SPBR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883AA )
     1845#define RSPI2_SPBR_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883CA )
     1846
     1847#define RSPI0_SPDCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x0008838B )
     1848#define RSPI1_SPDCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883AB )
     1849#define RSPI2_SPDCR_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883CB )
     1850
     1851#define RSPI0_SPCKD_ADDR        ( ( volatile uint8_t __evenaccess * )0x0008838C )
     1852#define RSPI1_SPCKD_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883AC )
     1853#define RSPI2_SPCKD_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883CC )
     1854
     1855#define RSPI0_SSLND_ADDR        ( ( volatile uint8_t __evenaccess * )0x0008838D )
     1856#define RSPI1_SSLND_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883AD )
     1857#define RSPI2_SSLND_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883CD )
     1858
     1859#define RSPI0_SPND_ADDR         ( ( volatile uint8_t __evenaccess * )0x0008838E )
     1860#define RSPI1_SPND_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883AE )
     1861#define RSPI2_SPND_ADDR         ( ( volatile uint8_t __evenaccess * )0x000883CE )
     1862
     1863#define RSPI0_SPCR2_ADDR        ( ( volatile uint8_t __evenaccess * )0x0008838F )
     1864#define RSPI1_SPCR2_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883AF )
     1865#define RSPI2_SPCR2_ADDR        ( ( volatile uint8_t __evenaccess * )0x000883CF )
     1866
     1867#define RSPI0_SPCMD0_ADDR       ( ( volatile uint16_t __evenaccess * )0x00088390 )
     1868#define RSPI0_SPCMD1_ADDR       ( ( volatile uint16_t __evenaccess * )0x00088392 )
     1869#define RSPI0_SPCMD2_ADDR       ( ( volatile uint16_t __evenaccess * )0x00088394 )
     1870#define RSPI0_SPCMD3_ADDR       ( ( volatile uint16_t __evenaccess * )0x00088396 )
     1871#define RSPI0_SPCMD4_ADDR       ( ( volatile uint16_t __evenaccess * )0x00088398 )
     1872#define RSPI0_SPCMD5_ADDR       ( ( volatile uint16_t __evenaccess * )0x0008839A )
     1873#define RSPI0_SPCMD6_ADDR       ( ( volatile uint16_t __evenaccess * )0x0008839C )
     1874#define RSPI0_SPCMD7_ADDR       ( ( volatile uint16_t __evenaccess * )0x0008839E )
     1875#define RSPI1_SPCMD0_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883B0 )
     1876#define RSPI1_SPCMD1_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883B2 )
     1877#define RSPI1_SPCMD2_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883B4 )
     1878#define RSPI1_SPCMD3_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883B6 )
     1879#define RSPI1_SPCMD4_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883B8 )
     1880#define RSPI1_SPCMD5_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883BA )
     1881#define RSPI1_SPCMD6_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883BC )
     1882#define RSPI1_SPCMD7_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883BE )
     1883#define RSPI2_SPCMD0_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883D0 )
     1884#define RSPI2_SPCMD1_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883D2 )
     1885#define RSPI2_SPCMD2_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883D4 )
     1886#define RSPI2_SPCMD3_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883D6 )
     1887#define RSPI2_SPCMD4_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883D8 )
     1888#define RSPI2_SPCMD5_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883DA )
     1889#define RSPI2_SPCMD6_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883DC )
     1890#define RSPI2_SPCMD7_ADDR       ( ( volatile uint16_t __evenaccess * )0x000883DE )
     1891#define RSPI_SPCMD_SPB_OFFSET   (8)
     1892#define RSPI_SPCMD_SPB_MASK (0xF << RSPI_SPCMD_SPB_OFFSET)
     1893
     1894/*
    17691895 *  UART関連の定義
    17701896 *
  • uKadecot/trunk/uip/apps/webserver/httpd-fs.c

    r108 r154  
    3838#include "pff.h"
    3939#include "diskio.h"
     40#include "mmc_rspi.h"
     41#include <string.h>
    4042
    4143//#define FILE_DUMP
    4244#ifdef FILE_DUMP
    43 #include <string.h>
    4445char path[256] = "";
    4546FATFS fs;
     
    9899        FRESULT res;
    99100#endif
    100         disk_initialize();
     101        ramdisk_initialize();
     102        mmc_rspi_initialize();
    101103#ifdef FILE_DUMP
    102104        if((res = pf_mount(&fs)) != FR_OK){
     
    112114/*-----------------------------------------------------------------------------------*/
    113115int
    114 httpd_fs_open(const char *name, struct httpd_fs_file *file)
     116httpd_fs_open(int drv, const char *name, struct httpd_fs_file *file)
    115117{
    116118        FRESULT res;
    117         FATFS *fs = (FATFS *)&file->fs;
     119        FATFS *fs = (FATFS *)file->fs;
     120
     121        file->pos = 0;
     122        file->len = 0;
     123        file->drv = drv;
     124        file->name = name;
     125        memset(fs, 0, sizeof(FATFS));
     126
     127        if (drv == 0) {
     128                fs->disk_get_status = ramdisk_get_status;
     129                fs->disk_readp = ramdisk_readp;
     130                fs->disk_writep = ramdisk_writep;
     131        }
     132        else {
     133                fs->disk_get_status = mmc_rspi_get_status;
     134                fs->disk_readp = mmc_rspi_readp;
     135                fs->disk_writep = mmc_rspi_writep;
     136        }
    118137
    119138        if (fs->fs_type == 0){
     
    125144
    126145        if((res = pf_open(fs, name)) != FR_OK){
    127                 printf("pf_open(%s) => %d\n", name, res);
     146                printf("pf_open(%d:%s) => %d\n", drv, name, res);
    128147                return 0;
    129148        }
    130149
    131         file->pos = 0;
    132150        file->len = fs->fsize;
    133         file->name = name;
    134151
    135         //printf("httpd_fs_open(%s) %d\n", name, file->len);
     152        //printf("httpd_fs_open(%d:%s) %d\n", drv, name, file->len);
    136153
    137154        return 1;
     
    143160        FRESULT ret;
    144161        UINT rlen;
    145         FATFS *fs = (FATFS *)&file->fs;
     162        FATFS *fs = (FATFS *)file->fs;
    146163
    147164        if((ret = pf_lseek(fs, file->pos)) != FR_OK){
    148                 printf("pf_lseek(%d) => %d\n", file->pos, ret);
     165                printf("pf_lseek(%d:%s, %d) => %d\n", file->drv, file->name, file->pos, ret);
    149166                return 0;
    150167        }
    151168
    152169        if(file->pos != fs->fptr){
    153                 printf("pf_lseek(%d) != %d\n", file->pos, fs->fptr);
     170                printf("pf_lseek(%d:%s, %d) != %d\n", file->drv, file->name, file->pos, fs->fptr);
    154171        }
    155172
    156173        if((ret = pf_read(fs, dst, len, &rlen)) != FR_OK){
    157                 printf("pf_read(%x, %d) => %d\n", dst, len, ret);
     174                printf("pf_read(%d:%s, 0x%p, %d) => %d\n", file->drv, file->name, dst, len, ret);
    158175                return 0;
    159176        }
    160177
    161         //printf("httpd_fs_read(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);
     178        //printf("httpd_fs_read(%d:%s, %d, %d) => %d\n", file->drv, file->name, file->pos, len, rlen);
    162179
    163180        return rlen;
  • uKadecot/trunk/uip/apps/webserver/httpd-fs.h

    r108 r154  
    4141  int pos;
    4242  int len;
     43  int drv;
    4344  const char *name;
    44   char fs[64/*>sizeof(FATFS)*/];
     45  void *fs;
    4546};
    4647
    4748/* file must be allocated by caller and will be filled in
    4849   by the function. */
    49 int httpd_fs_open(const char *name, struct httpd_fs_file *file);
     50int httpd_fs_open(int drv, const char *name, struct httpd_fs_file *file);
    5051int httpd_fs_read(struct httpd_fs_file *file, void *dst, int len);
    5152
  • uKadecot/trunk/uip/apps/webserver/httpd.c

    r152 r154  
    198198  memcpy(pos, statushdr, len); pos += len;
    199199
    200   len = strlen(http_content_encoding_gzip);
    201   memcpy(pos, http_content_encoding_gzip, len); pos += len;
     200  if (s->drv == 0) {
     201    len = strlen(http_content_encoding_gzip);
     202    memcpy(pos, http_content_encoding_gzip, len); pos += len;
     203  }
    202204
    203205  ptr = strrchr(s->message.request_url, ISO_period);
     
    244246PT_THREAD(handle_output(struct httpd_state *s))
    245247{
    246   char *ptr;
    247 
    248248  PT_BEGIN(&s->outputpt);
    249249
    250   if (!httpd_fs_open(s->message.request_url, &s->file)) {
    251     httpd_fs_open(http_404_html, &s->file);
     250  s->file.fs = ((char *)&s[1]) - 64 - 512;
     251
     252  if (!httpd_fs_open(s->drv, s->filename, &s->file)) {
     253    s->drv = 0;
     254    httpd_fs_open(s->drv, http_404_html, &s->file);
    252255    strcpy_s(s->message.request_url, sizeof(s->message.request_url), http_404_html);
    253256    PT_WAIT_THREAD(&s->outputpt,
     
    259262      send_headers(s,
    260263      http_header_200));
    261     ptr = strchr(s->message.request_url, ISO_period);
    262264    PT_WAIT_THREAD(&s->outputpt, send_file(s));
    263265  }
     
    406408  if ((s->message.request_url[0] == '\0') || ((s->message.request_url[0] == '/') && (s->message.request_url[1] == '\0'))) {
    407409    strncpy_s(s->message.request_url, sizeof(s->message.request_url), http_index_html, sizeof(s->message.request_url));
     410    s->filename = s->message.request_url;
     411  }
     412  /* "/~/"ならSDカードから読み込み */
     413  else if ((s->message.request_url[0] == '/') && (s->message.request_url[1] == '~') && (s->message.request_url[2] == '/')) {
     414    s->drv = 1;
     415    s->filename = &s->message.request_url[2];
     416  }
     417  else {
     418    s->drv = 0;
     419    s->filename = s->message.request_url;
    408420  }
    409421
  • uKadecot/trunk/uip/apps/webserver/httpd.h

    r108 r154  
    4747  char inputbuf[50];
    4848  char state;
     49  int drv;
     50  char *filename;
     51  int len;
    4952  struct httpd_fs_file file;
    50   int len;
    51   unsigned short count;
    5253  int parse_pos;
    5354  int parse_len;
Note: See TracChangeset for help on using the changeset viewer.