OSDN Git Service

final adjustment for 0.6.0
[unagi/old-svn-converted.git] / client / trunk / reader_master.h
1 #ifndef _READER_MASTER_H_
2 #define _READER_MASTER_H_
3 #include "type.h"
4 #include <windows.h>
5 //C++ ¤Î Class ¤â¤É¤­¤ò C ¤Ç¼ÂÁõ¤·¤Æ¤¤¤ë´¶¤¬Áý¤·¤Æ¤­¤¿...
6 enum reader_control{
7         READER_OPEN, READER_CLOSE
8 };
9 struct reader_driver{
10         const char *name;
11         int (*open_or_close)(enum reader_control oc);
12         void (*init)(void);
13         void (*cpu_read)(long address, long length, uint8_t *data);
14         void (*cpu_write_6502)(long address, long length, const uint8_t *data);
15         void (*ppu_read)(long address, long length, uint8_t *data);
16         void (*ppu_write)(long address, long length, const uint8_t *data);
17         bool flash_support;
18         void (*cpu_flash_config)(long c000x, long c2aaa, long c5555, long unit);
19         void (*cpu_flash_erase)(long address, bool wait);
20         long (*cpu_flash_program)(long address, long length, const uint8_t *data, bool wait);
21         void (*cpu_flash_device_get)(uint8_t s[2]);
22         void (*ppu_flash_config)(long c000x, long c2aaa, long c5555, long unit);
23         void (*ppu_flash_erase)(long address, bool wait);
24         long (*ppu_flash_program)(long address, long length, const uint8_t *data, bool wait);
25         void (*ppu_flash_device_get)(uint8_t s[2]);
26         void (*flash_status)(uint8_t s[2]);
27         uint8_t (*vram_connection)(void);
28 };
29 int paralellport_open_or_close(enum reader_control oc);
30 const struct reader_driver *reader_driver_get(const char *name);
31 enum{
32         ADDRESS_MASK_A0toA12 = 0x1fff,
33         ADDRESS_MASK_A0toA14 = 0x7fff,
34         ADDRESS_MASK_A15 = 0x8000
35 };
36 enum{ 
37         M2_CONTROL_TRUE, M2_CONTROL_FALSE
38 };
39 /*
40 static inline ¤Ï¶¦Í­¥Þ¥¯¥í°·¤¤
41 */
42 static inline int bit_set(int data, const int bit)
43 {
44         data |= 1 << bit;
45         return data;
46 }
47
48 static inline int bit_clear(int data, const int bit)
49 {
50         data &= ~(1 << bit);
51         return data;
52 }
53
54 static inline void wait(long msec)
55 {
56         if(msec == 0){
57                 return;
58         }
59         Sleep(msec);
60 }
61 #endif