00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _MOSTDRV_H
00033 #define _MOSTDRV_H
00034
00035
00036
00037
00038
00039
00040
00041 #ifdef CP_I2C
00042 #include "sw_i2c.h"
00043 #endif
00044
00045
00046
00047
00048
00049
00050 #ifdef CP_SPI
00051 #include "spi.h"
00052 #endif
00053
00054
00055
00056
00057
00058
00059 #ifdef CP_PAR
00060 #include "par_cp.h"
00061 #endif
00062
00063
00064
00065
00066
00067
00068
00069 #ifdef CP_COM
00070 #include "com_port.h"
00071 #endif
00072
00073
00074
00075
00076
00077
00078
00079 #ifdef PADT
00080 #include "par_sp.h"
00081 #endif
00082
00083
00084
00085
00086
00087
00088
00089 #define I2C_ADDR_MOST 0x40
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #ifdef CP_I2C
00100 #define MOST_WRITE(map,value) I2cWrite((tMostMap)(map), (byte)(value), (byte)I2C_ADDR_MOST)
00101
00102 #define MOST_WRITEBLOCK(map,num,ptr) I2cWriteBlock((tMostMap)(map), (byte)(num), (byte *)(ptr), (byte)I2C_ADDR_MOST)
00103
00104 #define MOST_READ(map) I2cRead((tMostMap)(map), (byte)I2C_ADDR_MOST)
00105
00106 #define MOST_READBLOCK(map,num,ptr) I2cReadBlock((tMostMap)(map), (byte)(num), (byte *)(ptr), (byte)I2C_ADDR_MOST)
00107 #endif
00108
00109 #ifdef CP_SPI
00110 #define MOST_WRITE(map,value) SPIWrite((tMostMap)(map), (byte)(value))
00111
00112 #define MOST_WRITEBLOCK(map,num,ptr) SPIWriteBlock((tMostMap)(map), (byte)(num), (byte *)(ptr))
00113
00114 #define MOST_READ(map) SPIRead((tMostMap)(map))
00115
00116 #define MOST_READBLOCK(map,num,ptr) SPIReadBlock((tMostMap)(map), (byte)(num), (byte *)(ptr))
00117 #endif
00118
00119 #ifdef CP_PAR
00120 #define MOST_WRITE(map,value) ParWrite((tMostMap)(map),(byte)(value))
00121
00122 #define MOST_WRITEBLOCK(map,num,ptr) ParWriteBlock((tMostMap)(map),(byte)(num), (byte *)(ptr))
00123
00124 #define MOST_READ(map) ParRead((tMostMap)(map))
00125
00126 #define MOST_READBLOCK(map,num,ptr) ParReadBlock((tMostMap)(map),(byte)(num), (byte *)(ptr))
00127 #endif
00128
00129
00130 #ifdef CP_COM
00131 #define MOST_WRITE(map,value) CheWrite((tMostMap)(map),(byte)(value))
00132
00133 #define MOST_WRITEBLOCK(map,num,ptr) CheWriteBlock((tMostMap)(map),(byte)(num), (byte *)(ptr))
00134
00135 #define MOST_READ(map) CheRead((tMostMap)(map))
00136
00137 #define MOST_READBLOCK(map,num,ptr) CheReadBlock((tMostMap)(map),(byte)(num), (byte *)(ptr))
00138 #endif
00139
00140
00141
00142
00143
00144
00145 #ifdef PADT
00146
00147 #ifndef MOST_MAP_16BIT // 8Bit map
00148 #define PAR_A_WRITE_MAP(page, map) ParAWriteMap((byte)(page), (byte)(map))
00149
00150 #define PAR_A_WRITE_SINGLE_BYTE(page, map, value) ParAWriteSingleByte((byte)(page), (byte)(map), (byte)(value))
00151
00152 #define PAR_A_WRITE_DATA(num, ptr) ParAWriteData((byte)(num), (byte*)(ptr))
00153
00154 #define PAR_A_READ_DATA(num, ptr) ParAReadData((byte)(num), (byte*)(ptr))
00155 #endif
00156
00157 #ifdef MOST_MAP_16BIT // 16Bit map (page+map)
00158 #define PAR_A_WRITE_MAP(page, map) ParAWriteMap((word)(map)) // parameter page is not used
00159
00160 #define PAR_A_WRITE_SINGLE_BYTE(page, map, value) ParAWriteSingleByte((word)(map), (byte)(value)) // parameter page is not used
00161
00162 #define PAR_A_WRITE_DATA(num, ptr) ParAWriteData((byte)(num), (byte*)(ptr))
00163
00164 #define PAR_A_READ_DATA(num, ptr) ParAReadData((byte)(num), (byte*)(ptr))
00165 #endif
00166
00167 #endif
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 #ifdef SECONDARY_NODE
00180
00181 #define I2C_ADDR_MOST_SEC 0x42
00182
00183 #define MOST_WRITE_SEC(map, value) I2cWrite((tMostMap)(map), (byte)(value), (byte)I2C_ADDR_MOST_SEC)
00184
00185 #define MOST_WRITEBLOCK_SEC(map, num, ptr) I2cWriteBlock((tMostMap)(map), (byte)(num), (byte *)(ptr), (byte)I2C_ADDR_MOST_SEC)
00186
00187 #define MOST_READ_SEC(map) I2cRead((tMostMap)(map), (byte)I2C_ADDR_MOST_SEC)
00188
00189 #define MOST_READBLOCK_SEC(map, num, ptr) I2cReadBlock((tMostMap)(map), (byte)(num), (byte *)(ptr), (byte)I2C_ADDR_MOST_SEC)
00190
00191 #endif
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226 #endif // _MOSTDRV_H
00227
00228
00229
00230