// monitor.h // モニタ関数用32ビットサイズの引数 union param32{ long l32; int i32; unsigned long ul32; short s16[2]; unsigned short us16[2]; char c8[4]; unsigned char uc8[4]; char *cpoint; unsigned char *ucpoint; short *spoint; unsigned short *uspoint; long *lpoint; unsigned long *ulpoint; union param32 *upoint; long (*ppoint)(); // アドレスとして関数呼び出し float f32; // 単精度浮動小数点 サインビット、指数8ビット、化数部24ビット float *f32point; }; #define COLUMN 80 // コマンド入力バッファーサイズ #define MBUFLEN 512 #define PARAMN 9 char htol(long *,char **); void crlf(void); int chex(char );// ヘキサ文字コードから、4ビットのバイナリに変換。ヘキサ以外なら−1。 void ckasci(int );// void spacen(int ); //==================================================== void putscon(char *); int dumpm(union param32 *,int mode); int cksjis(unsigned int s); // シフトJISの漢字コードかをチェック void dumpmt(void); void movem(union param32 *,long ); // メモリのコピー int argck(char **,union param32 *,int ); // コマンド文字列の引数チェック char htol(long *,char **); // ヘキサ文字列からバイナリに変換 void paramer(void); int verify(union param32 *); // メモリを比較 void srload(union param32 *,int); // モトローラSレコードをホストから受信してメモリにロード int setmemo(union param32 *,int,int ); // メモリの変更 void findp(union param32 *); // データ列をメモリから探す。 int cpynstr(char *d,char *s,int n); int cstrlen(char *cp,char f); long gosub(union param32 addr); // アセンブラ呼び出しの場合 int dhrymain(void);// dhrystone int mainmoni (int);// monitor エントリー void putcon(int c);// コンソールに1文字出力(RS232C) int getcon(void);// コンソールから1文字受信するまで待つ(RS232C) int statcon(void);// コンソールから1文字受信したとき、!=0 // MMC BIOS 関連 int initmmc(int flg); int waittim0(long count); // 21.3333333 μsec x n void mmcclk(int c); // speed int mmccs(int c); // output CS. Low or High int mmcout(int data); // output SPI int mmcoutwo(int data); // output SPI no return int checkcommand(char *cp,union param32 *param,int len); // len: command length long execcommand(union param32 *param,int cmdcode); // control SD card int sdctl(union param32 *param,int mode); #define CMD0 0x40 #define CMD1 0x41 #define CMD8 0x48 #define CMD55 0x77 // APP_CMD #define ACMD41 0x69 #define CMD9 0x49 #define CMD10 0x4A #define CMD17 0x51 #define CMD23 0x57 // MMC 専用マルチブロック転送個数設定 #define CMD24 0x58 #define CMD58 0x7A #define MMCINIT 0x100 #define MMCREADY 0x101 #define MMCREAD 0x102 #define MMCREADM 0x103 #define MMCWRITE 0x104 #define MMCWRITEM 0x105 #define CRC7 0x106 #define CRC16 0x107 #define ENCRC 0x108 #define DSCRC 0x109 #define CLKSPEED 0x10A #define CHECKSECTS 0x10B #define NOTFOUND -1 // crc unsigned char crc7c(unsigned char *cp,int n); // crc7 計算 unsigned short crc16c(unsigned char *cp,int n); // crc16 計算 //