diff --git a/BaS_gcc/include/cache.h b/BaS_gcc/include/cache.h index 0136163..d852d74 100644 --- a/BaS_gcc/include/cache.h +++ b/BaS_gcc/include/cache.h @@ -55,8 +55,8 @@ #define CF_CACR_EUSP (0x00000020) /* Switch stacks in user mode */ #define CF_CACR_DF (0x00000010) /* Disable FPU */ -#define _DCACHE_SET_MASK ((DCACHE_SIZE/64-1)< @@ -20,11 +20,11 @@ typedef uint8_t DSTATUS; /* Results of Disk Functions */ typedef enum { - RES_OK = 0, /* 0: Successful */ - RES_ERROR, /* 1: R/W Error */ - RES_WRPRT, /* 2: Write Protected */ - RES_NOTRDY, /* 3: Not Ready */ - RES_PARERR /* 4: Invalid Parameter */ + RES_OK = 0, /* 0: Successful */ + RES_ERROR, /* 1: R/W Error */ + RES_WRPRT, /* 2: Write Protected */ + RES_NOTRDY, /* 3: Not Ready */ + RES_PARERR /* 4: Invalid Parameter */ } DRESULT; @@ -43,45 +43,45 @@ DRESULT disk_ioctl (uint8_t, uint8_t, void*); /* Disk Status Bits (DSTATUS) */ -#define STA_NOINIT 0x01 /* Drive not initialized */ -#define STA_NODISK 0x02 /* No medium in the drive */ -#define STA_PROTECT 0x04 /* Write protected */ +#define STA_NOINIT 0x01 /* Drive not initialized */ +#define STA_NODISK 0x02 /* No medium in the drive */ +#define STA_PROTECT 0x04 /* Write protected */ /* Command code for disk_ioctrl fucntion */ /* Generic command (used by FatFs) */ -#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ -#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ -#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ -#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ -#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ +#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */ +#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */ +#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */ +#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */ +#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */ /* Generic command (not used by FatFs) */ -#define CTRL_POWER 5 /* Get/Set power status */ -#define CTRL_LOCK 6 /* Lock/Unlock media removal */ -#define CTRL_EJECT 7 /* Eject media */ -#define CTRL_FORMAT 8 /* Create physical format on the media */ +#define CTRL_POWER 5 /* Get/Set power status */ +#define CTRL_LOCK 6 /* Lock/Unlock media removal */ +#define CTRL_EJECT 7 /* Eject media */ +#define CTRL_FORMAT 8 /* Create physical format on the media */ /* MMC/SDC specific ioctl command */ -#define MMC_GET_TYPE 10 /* Get card type */ -#define MMC_GET_CSD 11 /* Get CSD */ -#define MMC_GET_CID 12 /* Get CID */ -#define MMC_GET_OCR 13 /* Get OCR */ -#define MMC_GET_SDSTAT 14 /* Get SD status */ +#define MMC_GET_TYPE 10 /* Get card type */ +#define MMC_GET_CSD 11 /* Get CSD */ +#define MMC_GET_CID 12 /* Get CID */ +#define MMC_GET_OCR 13 /* Get OCR */ +#define MMC_GET_SDSTAT 14 /* Get SD status */ /* ATA/CF specific ioctl command */ -#define ATA_GET_REV 20 /* Get F/W revision */ -#define ATA_GET_MODEL 21 /* Get model name */ -#define ATA_GET_SN 22 /* Get serial number */ +#define ATA_GET_REV 20 /* Get F/W revision */ +#define ATA_GET_MODEL 21 /* Get model name */ +#define ATA_GET_SN 22 /* Get serial number */ /* MMC card type flags (MMC_GET_TYPE) */ -#define CT_MMC 0x01 /* MMC ver 3 */ -#define CT_SD1 0x02 /* SD ver 1 */ -#define CT_SD2 0x04 /* SD ver 2 */ -#define CT_SDC (CT_SD1|CT_SD2) /* SD */ -#define CT_BLOCK 0x08 /* Block addressing */ +#define CT_MMC 0x01 /* MMC ver 3 */ +#define CT_SD1 0x02 /* SD ver 1 */ +#define CT_SD2 0x04 /* SD ver 2 */ +#define CT_SDC (CT_SD1 | CT_SD2) /* SD */ +#define CT_BLOCK 0x08 /* Block addressing */ #ifdef __cplusplus diff --git a/BaS_gcc/include/fecbd.h b/BaS_gcc/include/fecbd.h index 5f71454..f25847b 100644 --- a/BaS_gcc/include/fecbd.h +++ b/BaS_gcc/include/fecbd.h @@ -40,9 +40,9 @@ */ typedef struct { - uint16_t status; /* control and status */ - uint16_t length; /* transfer length */ - uint8_t *data; /* buffer address */ + uint16_t status; /* control and status */ + uint16_t length; /* transfer length */ + uint8_t *data; /* buffer address */ } FECBD; /* diff --git a/BaS_gcc/include/firebee.h b/BaS_gcc/include/firebee.h index aed4254..4018764 100644 --- a/BaS_gcc/include/firebee.h +++ b/BaS_gcc/include/firebee.h @@ -27,24 +27,24 @@ * Author: Markus Fröschle */ -#define SYSCLK 132000 /* NOTE: 132 _is_ correct. 133 _is_ wrong. Do not change! */ +#define SYSCLK 132000 /* NOTE: 132 _is_ correct. 133 _is_ wrong. Do not change! */ -#define BOOTFLASH_BASE_ADDRESS 0xE0000000 -#define BOOTFLASH_SIZE 0x800000 /* FireBee has 8 MByte Flash */ -#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) +#define BOOTFLASH_BASE_ADDRESS 0xE0000000 +#define BOOTFLASH_SIZE 0x800000 /* FireBee has 8 MByte Flash */ +#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) -#define SDRAM_START 0x00000000 /* start at address 0 */ -#define SDRAM_SIZE 0x20000000 /* 512 MB on the Firebee */ +#define SDRAM_START 0x00000000 /* start at address 0 */ +#define SDRAM_SIZE 0x20000000 /* 512 MB on the Firebee */ #ifdef COMPILE_RAM -#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) +#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) #else -#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS -#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ +#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS +#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ #endif /* COMPILE_RAM */ -#define DRIVER_MEM_BUFFER_SIZE 0x100000 +#define DRIVER_MEM_BUFFER_SIZE 0x100000 #define EMUTOS_BASE_ADDRESS 0xe0600000 diff --git a/BaS_gcc/include/m54455.h b/BaS_gcc/include/m54455.h index 513c174..3f3ae24 100644 --- a/BaS_gcc/include/m54455.h +++ b/BaS_gcc/include/m54455.h @@ -27,24 +27,24 @@ * Author: Markus Fröschle */ -#define SYSCLK 133000 +#define SYSCLK 133000 -#define BOOTFLASH_BASE_ADDRESS 0xe0000000 -#define BOOTFLASH_SIZE 0x800000 -#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) +#define BOOTFLASH_BASE_ADDRESS 0xe0000000 +#define BOOTFLASH_SIZE 0x800000 +#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) -#define SDRAM_START 0x40000000 /* start at address 40000000 */ -#define SDRAM_SIZE 0x10000000 /* 256 MB */ +#define SDRAM_START 0x40000000 /* start at address 40000000 */ +#define SDRAM_SIZE 0x10000000 /* 256 MB */ #ifdef COMPILE_RAM -#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) +#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) #else -#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS +#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS #endif /* COMPILE_RAM */ -#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ +#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ -#define DRIVER_MEM_BUFFER_SIZE 0x100000 +#define DRIVER_MEM_BUFFER_SIZE 0x100000 -#define EMUTOS_BASE_ADDRESS 0xe0100000 +#define EMUTOS_BASE_ADDRESS 0xe0100000 #endif /* _M54455_H_ */ diff --git a/BaS_gcc/include/m5484l.h b/BaS_gcc/include/m5484l.h index 351188a..192b29d 100644 --- a/BaS_gcc/include/m5484l.h +++ b/BaS_gcc/include/m5484l.h @@ -27,24 +27,24 @@ * Author: Markus Fröschle */ -#define SYSCLK 100000UL +#define SYSCLK 100000UL -#define BOOTFLASH_BASE_ADDRESS 0xe0000000 -#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */ -#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) +#define BOOTFLASH_BASE_ADDRESS 0xe0000000 +#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */ +#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) -#define SDRAM_START 0x00000000 /* start at address 0 */ -#define SDRAM_SIZE 0x4000000 /* 64 MB on the LITEKIT */ +#define SDRAM_START 0x00000000 /* start at address 0 */ +#define SDRAM_SIZE 0x4000000 /* 64 MB on the LITEKIT */ #ifdef COMPILE_RAM -#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) +#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) #else -#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS +#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS #endif /* COMPILE_RAM */ -#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ +#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */ -#define DRIVER_MEM_BUFFER_SIZE 0x100000 +#define DRIVER_MEM_BUFFER_SIZE 0x100000 -#define EMUTOS_BASE_ADDRESS 0xe0100000 +#define EMUTOS_BASE_ADDRESS 0xe0100000 #endif /* _M5484L_H_ */ diff --git a/BaS_gcc/sys/BaS.c b/BaS_gcc/sys/BaS.c index b2b91aa..39a23d2 100644 --- a/BaS_gcc/sys/BaS.c +++ b/BaS_gcc/sys/BaS.c @@ -35,7 +35,6 @@ #include "sd_card.h" #include "wait.h" -#include "diskio.h" #include "ff.h" #include "s19reader.h" #include "mmu.h" diff --git a/BaS_gcc/sys/cache.c b/BaS_gcc/sys/cache.c index 3980f5c..62cd565 100644 --- a/BaS_gcc/sys/cache.c +++ b/BaS_gcc/sys/cache.c @@ -63,23 +63,23 @@ void enable_data_cache(void) void flush_and_invalidate_caches(void) { __asm__ __volatile__( - " clr.l d0 \n\t" - " clr.l d1 \n\t" - " move.l d0,a0 \n\t" - "1: \n\t" - " cpushl bc,(a0) | flush\n\t" - " lea 0x10(a0),a0 | index+1\n\t" - " addq.l #1,d1 | index+1\n\t" - " cmpi.w #512,d1 | all sets?\n\t" - " bne.s 1b | no->\n\t" - " clr.l d1 \n\t" - " addq.l #1,d0 \n\t" - " move.l d0,a0 \n\t" - " cmpi.w #4,d0 | all ways?\n\t" - " bne.s 1b | no->\n\t" - /* input */ : - /* output */ : - /* clobber */ : "cc", "d0", "d1", "a0" + " clr.l d0 \n\t" + " clr.l d1 \n\t" + " move.l d0,a0 \n\t" + "cfa_setloop%=: \n\t" + " cpushl bc,(a0) | flush\n\t" + " lea 0x10(a0),a0 | index+1\n\t" + " addq.l #1,d1 | index+1\n\t" + " cmpi.w #512,d1 | all sets?\n\t" + " bne.s cfa_setloop%= | no->\n\t" + " clr.l d1 \n\t" + " addq.l #1,d0 \n\t" + " move.l d0,a0 \n\t" + " cmpi.w #4,d0 | all ways?\n\t" + " bne.s cfa_setloop%= | no->\n\t" + /* input */ : + /* output */ : + /* clobber */ : "cc", "d0", "d1", "a0" ); }