2016-05-05 11:49:05 +02:00
|
|
|
//---
|
2016-07-06 11:28:51 +02:00
|
|
|
//
|
|
|
|
// gint core module: mpu
|
|
|
|
//
|
2016-08-29 11:29:07 +02:00
|
|
|
// Determines which kind of MPU is running the program. This module
|
|
|
|
// provides macro tests isSH3(), isSH4(), and the identifier of the MPU,
|
2017-02-25 19:02:07 +01:00
|
|
|
// which is stored in a global variable MPU_CURRENT and determined at
|
|
|
|
// startup.
|
2016-07-06 11:28:51 +02:00
|
|
|
//
|
2017-02-25 19:02:07 +01:00
|
|
|
// If you need to do MPU-dependant jobs, use isSH3() or (possibly) isSH4()
|
|
|
|
// instead of testing the value of MPU_CURRENT because these macros take
|
|
|
|
// care of assuming unknown MPUs are SH4, which is the more reasonable
|
|
|
|
// option.
|
|
|
|
//
|
|
|
|
// In a general way, it is advised to always use the following
|
|
|
|
// alternative (which gint does):
|
2016-08-29 11:29:07 +02:00
|
|
|
//
|
|
|
|
// if(isSH3())
|
|
|
|
// {
|
|
|
|
// ...
|
|
|
|
// }
|
2017-02-25 19:02:07 +01:00
|
|
|
// else
|
2016-08-29 11:29:07 +02:00
|
|
|
// {
|
|
|
|
// ...
|
|
|
|
// }
|
2016-07-06 11:28:51 +02:00
|
|
|
//
|
2016-05-05 11:49:05 +02:00
|
|
|
//---
|
|
|
|
|
2016-07-06 11:28:51 +02:00
|
|
|
#ifndef _MPU_H
|
|
|
|
#define _MPU_H 1
|
|
|
|
|
|
|
|
/*
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_t
|
2016-07-06 11:28:51 +02:00
|
|
|
This type holds information about the calculator's MPU.
|
|
|
|
*/
|
2017-02-25 19:02:07 +01:00
|
|
|
typedef enum
|
2016-05-05 11:49:05 +02:00
|
|
|
{
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_unknown = 0,
|
2016-05-05 11:49:05 +02:00
|
|
|
// fx-9860G SH3.
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_sh7337 = 1,
|
2016-05-05 11:49:05 +02:00
|
|
|
// fx-9860G II SH3.
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_sh7355 = 2,
|
2016-05-05 11:49:05 +02:00
|
|
|
// fx-9860G II SH4.
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_sh7305 = 3,
|
|
|
|
// Just for reference (no calculator uses it).
|
|
|
|
mpu_sh7724 = 4,
|
|
|
|
|
|
|
|
} mpu_t;
|
2016-05-05 11:49:05 +02:00
|
|
|
|
2016-07-06 11:28:51 +02:00
|
|
|
// Global MPU variable, accessible for direct tests. Initialized at the
|
|
|
|
// beginning of execution.
|
2017-02-25 19:02:07 +01:00
|
|
|
extern mpu_t MPU_CURRENT;
|
2016-05-05 11:49:05 +02:00
|
|
|
|
|
|
|
// Quick SH3 test. It is safer to assume that an unknown model is SH4 because
|
|
|
|
// SH3-based models are not produced anymore.
|
2017-02-25 19:02:07 +01:00
|
|
|
#define isSH3() (MPU_CURRENT == mpu_sh7337 || MPU_CURRENT == mpu_sh7355)
|
2016-05-05 11:49:05 +02:00
|
|
|
#define isSH4() !isSH3()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---
|
|
|
|
// Public API.
|
|
|
|
//---
|
|
|
|
|
|
|
|
/*
|
|
|
|
getMPU()
|
|
|
|
Determines the MPU type and returns it. MPU_CURRENT is not updated.
|
|
|
|
*/
|
2017-02-25 19:02:07 +01:00
|
|
|
mpu_t getMPU(void);
|
2016-05-05 22:33:15 +02:00
|
|
|
|
2016-05-05 11:49:05 +02:00
|
|
|
#endif // _MPU_H
|