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 #ifndef _MSB_MACROS_H
00032 #define _MSB_MACROS_H
00033
00034
00035
00036
00037
00038
00039 #define put_lane(_data,_offset) {_data <<= ((_offset & 3) * 8);}
00040 #define get_lane(_data,_offset) {_data >>= ((_offset & 3) * 8); _data &= 0x000000ff;}
00041
00042
00043
00044
00045
00046 #define gain_normalize( ucb_ptr, channel, value) \
00047 { \
00048 if (value > ucb_ptr->msb_gain_limits[channel].max) \
00049 value = ucb_ptr->msb_gain_limits[channel].max; \
00050 \
00051 if (value < ucb_ptr->msb_gain_limits[channel].min) \
00052 value = ucb_ptr->msb_gain_limits[channel].min; \
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #define write_codec( _indirect_reg_offset, _data) \
00068 { \
00069 int _reg, _status,__data; \
00070 __data = _data; \
00071 _reg = _indirect_reg_offset; \
00072 put_lane(_reg, MSB_REG_CODEC_ADDRESS); \
00073 _status = ioc$write_io ( ucb_ptr->ucb$r_ucb.ucb$ps_adp, \
00074 &ucb_ptr->msb_iohandle, \
00075 MSB_REG_CODEC_ADDRESS, \
00076 1, \
00077 &_reg ); \
00078 put_lane(__data, MSB_REG_CODEC_DATA); \
00079 _status = ioc$write_io ( ucb_ptr->ucb$r_ucb.ucb$ps_adp, \
00080 &ucb_ptr->msb_iohandle, \
00081 MSB_REG_CODEC_DATA, \
00082 1, \
00083 &__data ); \
00084 }
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 #define read_codec( _indirect_reg_offset, _data ) \
00096 { \
00097 int _status, _reg; \
00098 _reg = _indirect_reg_offset; \
00099 put_lane(_reg, MSB_REG_CODEC_ADDRESS); \
00100 _status = ioc$write_io ( ucb_ptr->ucb$r_ucb.ucb$ps_adp, \
00101 &ucb_ptr->msb_iohandle, \
00102 MSB_REG_CODEC_ADDRESS, \
00103 1, \
00104 &_reg ); \
00105 _status = ioc$read_io ( ucb_ptr->ucb$r_ucb.ucb$ps_adp, \
00106 &ucb_ptr->msb_iohandle, \
00107 MSB_REG_CODEC_DATA, \
00108 1, \
00109 &_data ); \
00110 get_lane (_data, MSB_REG_CODEC_DATA); \
00111 }
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 #define write_dma( _reg_offset, _data ) \
00122 { \
00123 int _status,__data; \
00124 __data=_data; \
00125 put_lane(__data, _reg_offset); \
00126 _status = ioc$write_io ( ucb_ptr->ucb$r_ucb.ucb$ps_adp, \
00127 &ucb_ptr->dma_iohandle, \
00128 _reg_offset, \
00129 1, \
00130 &__data ); \
00131 }
00132
00133
00134
00135
00136
00137 #ifdef MSB__DEBUG
00138
00139
00140 int printf (const char *__format, ...);
00141 int putchar (int __c);
00142
00143
00144 extern int SGN$GL_USERD1;
00145
00146 void ini$brk();
00147
00148
00149
00150 #define MSBDBG$$_TABLE 0x0000001
00151 #define MSBDBG$$_CTRLINIT 0x0000002
00152 #define MSBDBG$$_UNITINIT 0x0000004
00153 #define MSBDBG$$_UNITINITFORK 0x0000008
00154 #define MSBDBG$$_CHANNELASSIGN 0X0000010
00155 #define MSBDBG$$_CANCEL 0x0000020
00156 #define MSBDBG$$_INT 0x0000040
00157 #define MSBDBG$$_IOCTL 0x0000080
00158
00159 #define debug_break(bit_mask) \
00160 { if ( (bit_mask) & SGN$GL_USERD1) ini$brk(); }
00161
00162 #define debug_printf(_printf_args) printf _printf_args
00163
00164 #else
00165
00166 #define debug_break(bit_num) {}
00167 #define debug_printf(_printf_args) {}
00168
00169 #endif
00170
00171 #endif