mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-05-18 15:29:16 +02:00
fygue: support FXCP400 (work, but broken for BFile syscalls)
This commit is contained in:
parent
d9b03e7052
commit
a56d57ad61
7 changed files with 39 additions and 12 deletions
|
@ -62,8 +62,8 @@ static int _fygue_flash_cluster_convert(
|
|||
0xdd, 0xee, 0xee, 0xee,
|
||||
};
|
||||
struct _bfile_cluster_metadata *meta[2] = {
|
||||
(void*)(bfile_meta | 0x80000000),
|
||||
(void*)(bfile_meta | 0xa0000000),
|
||||
(void*)(bfile_meta | 0x80000000),
|
||||
};
|
||||
if (fcluster == NULL)
|
||||
return -1;
|
||||
|
@ -87,12 +87,21 @@ static int _fygue_flash_cluster_convert(
|
|||
continue;
|
||||
if (meta[i]->bitmask[0] != 0x11 && meta[i]->lcluster_id != 0xffff)
|
||||
continue;
|
||||
#if GINT_HW_CP
|
||||
// on the fxcp400, only some flash sector have the constants used
|
||||
// in other device. Casio check an CRC that is performed on the
|
||||
// whole cluster
|
||||
// TODO: CRC check
|
||||
(void)_constant1;
|
||||
(void)_constant2;
|
||||
#else
|
||||
if (
|
||||
memcmp(&(meta[i]->constant), _constant1, 0x18) != 0 &&
|
||||
memcmp(&(meta[i]->constant), _constant2, 0x18) != 0
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
fcluster->lcluster_id = meta[i]->lcluster_id;
|
||||
fcluster->kind = meta[i]->bitmask[0];
|
||||
fcluster->version = meta[i]->fcluster_version;
|
||||
|
@ -121,9 +130,9 @@ int fygue_flash_cluster_geometry(
|
|||
uint16_t *fsector_id,
|
||||
uint16_t *fcluster_off
|
||||
) {
|
||||
if ((addr & 0x0fffffff) < 0x00c80000)
|
||||
if ((addr & 0x0fffffff) < __FYGUE_FSECTOR_START_ADDR)
|
||||
return -1;
|
||||
addr = (addr & 0x0fffffff) - 0x00c80000;
|
||||
addr = (addr & 0x0fffffff) - __FYGUE_FSECTOR_START_ADDR;
|
||||
if (fcluster_id != NULL) {
|
||||
*fcluster_id = ((addr & 0xfffe0000) >> 17) * 32;
|
||||
*fcluster_id += ((addr & 0x0001ffff) >> 12);
|
||||
|
@ -162,13 +171,13 @@ int fygue_flash_cluster_get(
|
|||
fcluster->lcluster_id = 0xffff;
|
||||
fcluster->version = 0xffffffff;
|
||||
} else {
|
||||
bfile_meta = 0x00c80000;
|
||||
bfile_meta = __FYGUE_FSECTOR_START_ADDR;
|
||||
bfile_meta += (fsector_id * 0x20000) + 0x1f000;
|
||||
bfile_meta += (fcluster_off * 0x40);
|
||||
if (_fygue_flash_cluster_convert(fcluster, bfile_meta) != 0)
|
||||
return -2;
|
||||
}
|
||||
bfile_data = 0x00c80000;
|
||||
bfile_data = __FYGUE_FSECTOR_START_ADDR;
|
||||
bfile_data += (fsector_id * 0x20000);
|
||||
bfile_data += (fcluster_off * 0x1000);
|
||||
fcluster->data_p1 = bfile_data | 0xa0000000;
|
||||
|
|
|
@ -121,9 +121,9 @@ int fygue_flash_cmap_init(struct fygue_flash_cmap *cmap)
|
|||
}
|
||||
}
|
||||
if (cmap->lcluster == NULL)
|
||||
return -1;
|
||||
return -2;
|
||||
if (cmap->lcluster[0].fcluster_id == 0xffff)
|
||||
return -1;
|
||||
return -3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,19 @@
|
|||
#define FS_FYGUE_FLASH_H 1
|
||||
|
||||
#include <gint/defs/types.h>
|
||||
#include <gint/config.h>
|
||||
|
||||
/* __FYGUE_* - hardcoded fygue information */
|
||||
//FIXME: change between OS version ?
|
||||
#if GINT_HW_CP
|
||||
# define __FYGUE_FSECTOR_START_ADDR (0x01a20000)
|
||||
# define __FYGUE_FSECTOR_COUNT (0xf2)
|
||||
# define __FYGUE_FCLUSTER_COUNT (__FYGUE_FSECTOR_COUNT * 32)
|
||||
#else
|
||||
# define __FYGUE_FSECTOR_START_ADDR (0x00c80000)
|
||||
# define __FYGUE_FSECTOR_COUNT (0x9c)
|
||||
# define __FYGUE_FCLUSTER_COUNT (__FYGUE_FSECTOR_COUNT * 32)
|
||||
#endif
|
||||
|
||||
/* fygue_fcluster - generic flash cluster information */
|
||||
struct fygue_flash_cluster
|
||||
|
|
|
@ -33,7 +33,7 @@ int fygue_mount(struct fygue_fsinfo **fsinfo, bool refresh)
|
|||
}
|
||||
if (refresh && __fygue_fsinfo->dirty) {
|
||||
if (fygue_fat_init_hot(&(__fygue_fsinfo->fat)) != 0)
|
||||
return -3;
|
||||
return -4;
|
||||
__fygue_fsinfo->dirty = false;
|
||||
}
|
||||
*fsinfo = __fygue_fsinfo;
|
||||
|
|
|
@ -27,6 +27,7 @@ int fygue_open(char const *path, int flags, GUNUSED mode_t mode)
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* if opening fails and the previous check as not returned an error,
|
||||
* it is certainly because of a creation request. We are a read-only
|
||||
* file-system, so, fail */
|
||||
|
|
|
@ -176,8 +176,7 @@ void hw_detect(void)
|
|||
gint[HWCPUVR] = PVR;
|
||||
gint[HWCPUPR] = PRR;
|
||||
gint[HWCALC] = HWCALC_FXCP400;
|
||||
// TODO: What filesystem implementation on the fx-CP 400?
|
||||
gint[HWFS] = HWFS_NONE;
|
||||
gint[HWFS] = HWFS_FUGUE;
|
||||
gint[HWRAM] = 16 << 20;
|
||||
// TOOD: How much ROM on the fx-CP 400?
|
||||
gint[HWROM] = 0;
|
||||
|
|
|
@ -289,4 +289,13 @@ ___VRAMRestore:
|
|||
___Reset:
|
||||
fixed(0xa0000000)
|
||||
|
||||
_BFile_Size:
|
||||
_BFile_Read:
|
||||
_BFile_Seek:
|
||||
_BFile_Write:
|
||||
_BFile_Close:
|
||||
_BFile_FindFirst:
|
||||
_BFile_FindClose:
|
||||
fixed(0xa0000000)
|
||||
|
||||
#endif /* GINT_OS_CP */
|
||||
|
|
Loading…
Add table
Reference in a new issue