Skip to content

Commit

Permalink
Merge pull request #26 from simoninns/20200208-dev
Browse files Browse the repository at this point in the history
20200208 dev
  • Loading branch information
Simon Inns authored Feb 8, 2020
2 parents dde3257 + 50d79ef commit e5dc25a
Show file tree
Hide file tree
Showing 29 changed files with 5,647 additions and 3,011 deletions.
27 changes: 10 additions & 17 deletions BeebSCSI_AVR/BeebSCSI_AVR/BeebSCSI_AVR.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<eraseonlaunchrule>0</eraseonlaunchrule>
<AsfFrameworkConfig>
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" />
</dependencies>
</framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.34.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<ResetRule>0</ResetRule>
<EraseKey />
Expand Down Expand Up @@ -147,7 +147,7 @@
<Compile Include="fatfs\ffconf.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="fatfs\integer.h">
<Compile Include="fatfs\ffunicode_avr.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="fatfs\mmc_avr.h">
Expand All @@ -156,12 +156,6 @@
<Compile Include="fatfs\mmc_avr_spi.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="fatfs\options\ccsbcs_avr.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="fatfs\options\unicode_avr.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="fcode.c">
<SubType>compile</SubType>
</Compile>
Expand Down Expand Up @@ -210,7 +204,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="fatfs" />
<Folder Include="fatfs\options" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>
2 changes: 1 addition & 1 deletion BeebSCSI_AVR/BeebSCSI_AVR/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI serial debug functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018-2019 Simon Inns
Copyright (C) 2018-2020 Simon Inns
This file is part of BeebSCSI.
Expand Down
2 changes: 1 addition & 1 deletion BeebSCSI_AVR/BeebSCSI_AVR/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BeebSCSI serial debug functions
BeebSCSI - BBC Micro SCSI Drive Emulator
Copyright (C) 2018-2019 Simon Inns
Copyright (C) 2018-2020 Simon Inns
This file is part of BeebSCSI.
Expand Down
41 changes: 28 additions & 13 deletions BeebSCSI_AVR/BeebSCSI_AVR/fatfs/diskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/

/* Definitions of physical drive number for each drive */
#define DRV_MMC 0 /* Example: Map MMC/SD card to physical drive 0 (default) */

#include "ff.h" /* Obtains integer types for FatFs */
#include "diskio.h" /* FatFs lower layer API */
#ifdef DRV_CFC
#include "cfc_avr.h" /* Header file of existing CF control module */
Expand All @@ -28,7 +26,10 @@ DSTATUS disk_status (
)
{
switch (pdrv) {

#ifdef DRV_CFC
case DRV_CFC :
return cf_disk_status();
#endif
#ifdef DRV_MMC
case DRV_MMC :
return mmc_disk_status();
Expand All @@ -44,11 +45,14 @@ DSTATUS disk_status (
/*-----------------------------------------------------------------------*/

DSTATUS disk_initialize (
BYTE pdrv /* Physical drive number to identify the drive */
BYTE pdrv /* Physical drive nmuber to identify the drive */
)
{
switch (pdrv) {

#ifdef DRV_CFC
case DRV_CFC :
return cf_disk_initialize();
#endif
#ifdef DRV_MMC
case DRV_MMC :
return mmc_disk_initialize();
Expand All @@ -66,12 +70,15 @@ DSTATUS disk_initialize (
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address in LBA */
LBA_t sector, /* Sector address in LBA */
UINT count /* Number of sectors to read */
)
{
switch (pdrv) {

#ifdef DRV_CFC
case DRV_CFC :
return cf_disk_read(buff, sector, count);
#endif
#ifdef DRV_MMC
case DRV_MMC :
return mmc_disk_read(buff, sector, count);
Expand All @@ -86,16 +93,19 @@ DRESULT disk_read (
/* Write Sector(s) */
/*-----------------------------------------------------------------------*/

#if _USE_WRITE
#if !FF_FS_READONLY
DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address in LBA */
LBA_t sector, /* Sector address in LBA */
UINT count /* Number of sectors to write */
)
{
switch (pdrv) {

#ifdef DRV_CFC
case DRV_CFC :
return cf_disk_write(buff, sector, count);
#endif
#ifdef DRV_MMC
case DRV_MMC :
return mmc_disk_write(buff, sector, count);
Expand All @@ -118,7 +128,10 @@ DRESULT disk_ioctl (
)
{
switch (pdrv) {

#ifdef DRV_CFC
case DRV_CFC :
return cf_disk_ioctl(cmd, buff);
#endif
#ifdef DRV_MMC
case DRV_MMC :
return mmc_disk_ioctl(cmd, buff);
Expand All @@ -136,7 +149,9 @@ DRESULT disk_ioctl (

void disk_timerproc (void)
{

#ifdef DRV_CFC
cf_disk_timerproc();
#endif
#ifdef DRV_MMC
mmc_disk_timerproc();
#endif
Expand Down
33 changes: 17 additions & 16 deletions BeebSCSI_AVR/BeebSCSI_AVR/fatfs/diskio.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*-----------------------------------------------------------------------
/ Low level disk interface modlue include file (C)ChaN, 2014
/ Low level disk interface module include file (C)ChaN, 2014
/-----------------------------------------------------------------------*/

#include "ff.h"
#ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED

#ifdef __cplusplus
extern "C" {
#endif

#define _USE_WRITE 1 /* 1: Enable disk_write function */
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
#define _USE_ISDIO 1 /* 1: Enable iSDIO controls via disk_ioctl */

#include "integer.h"

/* Status of Disk Functions */
typedef BYTE DSTATUS;

Expand Down Expand Up @@ -42,8 +40,8 @@ typedef struct {

DSTATUS disk_initialize (BYTE pdrv);
DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
void disk_timerproc (void);

Expand All @@ -57,11 +55,11 @@ void disk_timerproc (void);
/* Command code for disk_ioctrl fucntion */

/* Generic command (Used by FatFs) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */

/* Generic command (Not used by FatFs) */
#define CTRL_FORMAT 5 /* Create physical format on the media */
Expand All @@ -70,13 +68,14 @@ void disk_timerproc (void);
#define CTRL_LOCK 8 /* Lock media removal */
#define CTRL_UNLOCK 9 /* Unlock media removal */
#define CTRL_EJECT 10 /* Eject media */
#define CTRL_GET_SMART 11 /* Read SMART information */

/* MMC/SDC specific command (Not used by FatFs) */
#define MMC_GET_TYPE 50 /* Get card type */
#define MMC_GET_CSD 51 /* Get CSD */
#define MMC_GET_CID 52 /* Get CID */
#define MMC_GET_OCR 53 /* Get OCR */
#define MMC_GET_SDSTAT 54 /* Get SD status */
#define MMC_GET_CSD 51 /* Read CSD */
#define MMC_GET_CID 52 /* Read CID */
#define MMC_GET_OCR 53 /* Read OCR */
#define MMC_GET_SDSTAT 54 /* Read SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
Expand All @@ -94,6 +93,8 @@ void disk_timerproc (void);
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
#define CT_BLOCK 0x08 /* Block addressing */

/* Definitions of physical drive number for each drive */
#define DRV_MMC 0 /* Map MMC/SD card to physical drive 0 */

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit e5dc25a

Please sign in to comment.