mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-04-18 17:07:02 +02:00
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
//---
|
|
// gint:core:mpu - Runtime MPU detection
|
|
//
|
|
// This component detects the architecture and MPU type of the underlying
|
|
// hardware by relying on version registers and/or side-information. It
|
|
// provides macros isSH3() and isSH4() to perform MPU-dependent jobs:
|
|
//
|
|
// if(isSH3()) { ... } else { ... }
|
|
//---
|
|
|
|
#ifndef GINT_CORE_MPU
|
|
#define GINT_CORE_MPU
|
|
|
|
#include <defs/attributes.h>
|
|
|
|
/* mpu_t - Supported MPUs */
|
|
typedef enum
|
|
{
|
|
mpu_unknown = 0,
|
|
mpu_sh7337 = 1, /* fx9860g, SH-3 based */
|
|
mpu_sh7305 = 2, /* fx9860g II, fxcg50, SH-4A based */
|
|
mpu_sh7355 = 3, /* fx9860g II, SH-3 based */
|
|
mpu_sh7724 = 4, /* For reference */
|
|
} mpu_t;
|
|
|
|
#ifdef FX9860G
|
|
|
|
/* mpu_id() - get the name of the underlying MPU */
|
|
HDRFUNC mpu_t mpu_id(void)
|
|
{
|
|
extern const mpu_t mpu;
|
|
return mpu;
|
|
}
|
|
|
|
/* Quick SH-3/SH-4 tests. Unknown models are assumed to be SH-4A */
|
|
#define isSH3() (mpu_id() & 1)
|
|
#define isSH4() (!isSH3())
|
|
|
|
/* mpu_init() - probe the MPU type
|
|
This function must be executed before mpu_id() can be used. */
|
|
void mpu_init(void);
|
|
|
|
#else /* FXCG50 */
|
|
|
|
/* All fxcg50 machines have an SH7305, which makes things simpler. */
|
|
#define mpu_id() mpu_sh7305
|
|
#define isSH3() 0
|
|
#define isSH4() 1
|
|
|
|
#endif /* FX9860G */
|
|
|
|
#endif /* GINT_CORE_MPU */
|