Commit 2f9a6d59 authored by Federico Asara's avatar Federico Asara

Files cleanup.

parent e616927c
This source diff could not be displayed because it is too large. You can view the blob instead.
h1. ADC testing
This is a collection of programs to measure ADC characteristics
h2. Prerequisites
Python must be installed.
wx-python must be installed. On Ubuntu, you can install them as indicated in the following url:
http://wiki.wxpython.org/InstallingOnUbuntuOrDebian
h2. Execution
<pre>
python adctest.py
</pre>
[SIGNAL]
nbits = 14
rate = 100000000
data = 7818
7721
7632
7548
7479
7421
7376
7343
7329
7326
7339
7366
7409
7461
7524
7606
7694
7792
7896
8005
8113
8231
8349
8459
8574
8678
8774
8863
8946
9019
9067
9120
9146
9161
9166
9154
9126
9084
9028
8960
8884
8795
8704
8597
8488
8377
8261
8146
8029
7921
7813
7715
7626
7543
7476
7420
7377
7340
7327
7322
7338
7364
7407
7457
7522
7603
7691
7790
7890
8001
8113
8228
8347
8459
8569
8675
8775
8861
8942
9015
9070
9113
9142
9159
9165
9153
9124
9088
9031
8963
8885
8800
8700
8597
8485
8376
8260
8145
8033
7923
7819
7720
7630
7546
7471
7419
7375
7343
7328
7326
7340
7363
7407
7461
7527
7602
7692
7789
7893
8003
8117
8231
8348
8462
8569
8675
8773
8865
8942
9014
9068
9114
9144
9164
9162
9153
9124
9084
9029
8964
8885
8795
8703
8595
8489
8375
8260
8145
8033
7920
7815
7717
7629
7548
7477
7422
7374
7346
7327
7322
7336
7362
7404
7458
7526
7599
7692
7789
7890
8001
8113
8232
8347
8459
8568
8672
8776
8859
8943
9012
9069
9115
9147
9161
9163
9153
9129
9084
9029
8961
8885
8796
8701
8598
8487
8373
8259
8146
8031
7919
7816
7717
7627
7546
7478
7417
7376
7343
7330
7321
7335
7363
7406
7456
7525
7601
7686
7788
7892
8000
8113
8228
8342
8458
8567
8676
8772
8863
8942
9015
9074
9118
9150
9165
9164
9151
9124
9082
9031
8963
8886
8800
8706
8602
8488
8380
8262
8147
8034
7923
7821
7722
7633
7548
7480
7421
7375
7346
7328
7328
7338
7364
7406
7461
7527
7606
7692
7793
7894
8002
8116
8230
8348
8460
8570
8675
8773
8861
8943
9011
9069
9114
9144
9159
9166
9149
9123
9084
9027
8963
8883
8796
8700
8595
8486
8376
8259
8148
8031
7919
7814
7716
7624
7547
7477
7420
7377
7346
7330
7327
7338
7367
7403
7461
7526
7604
7691
7788
7897
8002
8114
8232
8347
8462
8572
8679
8774
8866
8946
9016
9075
9119
9148
9160
9168
9153
9127
9088
9034
8964
8883
8800
8703
8597
8492
8377
8262
8149
8031
7922
7815
7715
7629
7550
7480
7424
7375
7347
7328
7324
7337
7366
7407
7460
7527
7601
7692
7791
7893
8003
8115
8232
8347
8458
8568
8674
8773
8863
8941
9011
9069
9115
9149
9161
9164
9152
9121
9083
9026
8960
8884
8794
8697
8595
8486
8374
8257
8146
8031
7922
7816
7715
7629
7546
7477
7422
7373
7344
7331
7329
7338
7364
7409
7460
7529
7604
7691
7788
7894
8006
8118
8233
8346
8464
8573
8675
8776
8868
8943
9012
9075
9117
9147
9162
9168
9151
9127
9089
9030
8962
8887
8799
8703
8598
8490
8375
8261
8147
8034
7921
7816
7718
7631
7547
7474
7420
7377
7345
7329
7324
7337
7366
7405
7460
7528
7601
7691
7789
7893
8001
8116
8231
8346
8461
8568
8672
8773
8861
8944
9013
9069
9115
9148
9164
9167
9151
9126
9085
9031
8963
8882
8799
8702
8599
8489
8378
8260
8146
8032
7922
7816
7718
7629
7545
7476
7420
7375
7345
7327
7326
7337
7368
7402
7457
7527
7605
7692
7790
7891
8006
8114
8233
8348
8462
8572
8677
8776
8862
8945
9014
9068
9113
9148
9165
9166
9151
9125
9083
9027
8964
8886
8802
8704
8600
8488
8376
8257
8146
8032
7920
7819
7720
7627
7546
7476
7421
7375
7344
7328
7327
7338
7366
7403
7462
7525
7604
7693
7794
7895
8004
8116
8232
8348
8463
8570
8673
8777
8862
8944
9016
9074
9117
9146
9163
9167
9155
9127
9085
9033
8963
8889
8799
8704
8598
8490
8378
8261
8146
8033
7921
7817
7718
7628
7549
7477
7422
7377
7346
7327
7323
7337
7365
7408
7463
7527
7603
7694
7787
7893
8001
8113
8231
8345
8462
8570
8679
8777
8865
8944
9011
9070
9115
9149
9166
9166
9151
9127
9087
9031
8963
8887
8797
8699
8598
8485
8373
8260
8144
8032
7917
7813
7714
7622
7545
7475
7420
7375
7339
7323
7322
7335
7362
7405
7460
7523
7598
7691
7787
7891
8000
8113
8231
8348
8457
8569
8672
8772
8863
8941
9012
9068
9112
9145
9160
9166
9151
9123
9083
9031
8963
8884
8798
8701
8594
8485
8374
8256
8144
8031
7919
7818
7718
7628
7549
7479
7418
7372
7347
7328
7327
7338
7362
7401
7458
7527
7606
7693
7792
7895
8005
8117
8232
8348
8461
8569
8673
8776
8863
8942
9014
9070
9114
9144
9159
9166
9151
9125
9088
9032
8964
8887
8798
8703
8603
8489
8373
8262
8145
8030
7921
7817
7718
7628
7545
7475
7421
7376
7346
7328
7328
7337
7368
7407
7458
7525
7605
7687
7790
7893
8004
8114
8229
8346
8457
8569
8671
8769
8862
8938
9012
9071
9115
9146
9158
9164
9150
9122
9085
9029
8961
8881
8794
8699
8598
8485
8372
8259
8144
8028
7916
7813
7715
7623
7544
7477
7419
7372
7342
7324
7321
7337
7366
7404
7458
7521
7602
7689
7789
7893
8001
8113
8229
8347
8460
8570
8673
8772
8863
8942
9015
9068
9117
9141
9162
9163
9153
9126
9085
9032
8963
8887
8797
8703
8599
8490
8377
8261
8148
8031
7923
7817
7718
7628
7545
7477
7422
7376
7344
7328
7325
7337
7367
7406
7460
7527
7608
7691
7787
7895
8005
8115
8231
8348
8461
8570
8676
8774
8866
8947
9016
9070
9116
9144
9162
9167
9153
9127
9086
9034
8965
8888
8797
8700
8598
8489
8377
8258
8149
8037
7924
7819
7720
7630
7549
7481
7421
7375
7346
7332
7327
7340
7367
7405
7459
7529
7603
7696
7792
7893
8003
8114
8234
8346
8459
8570
8677
8776
8862
8943
9014
9069
9115
9147
9161
9162
9151
9123
9082
9028
8964
8885
8799
8700
8595
8485
8379
8258
8141
8032
7922
7817
7716
7628
7545
7474
7421
7372
7345
7326
7323
7337
7363
7403
7464
7528
7604
7693
7791
7896
8003
8112
8234
8349
8463
8572
8679
8773
8863
8943
9014
9074
9117
9148
9162
9162
9152
9125
9083
9030
8964
8885
8795
8701
8596
8488
8376
8262
8145
8033
7920
7819
7718
7629
7548
7479
7422
7374
7341
7326
7327
7338
7365
7409
7461
7524
7604
7694
7790
7893
8004
8116
8231
8349
8463
8570
8676
8774
8866
8944
9014
9070
9118
9149
9164
9164
9153
9126
9088
9034
8963
8886
8801
8702
8596
8492
8378
8261
8148
8033
7922
7816
7718
7630
7549
7480
7422
7377
7345
7329
7324
7339
7365
7410
7462
7529
7606
7694
7789
7900
8001
8116
8234
8349
8463
8570
8677
8775
8865
8947
9016
9072
9119
9148
9164
9168
9150
9125
9085
9032
8962
8887
8798
8704
8600
8489
8370
8259
8147
8032
7922
7815
7719
7626
7547
7476
7424
7372
7345
7329
7326
7338
7365
7403
7459
7526
7604
7695
7789
7895
8000
8118
8232
8348
8461
8569
8674
8775
8863
8943
9015
9074
9116
9145
9162
9164
9152
9127
9085
9032
8963
8887
8797
8703
8598
8488
8378
8262
8149
8033
7919
7815
7718
7625
7544
7475
7421
7373
7346
7330
7327
7337
7367
7406
7463
7530
7605
7693
7792
7895
8003
8115
8230
8347
8464
8571
8678
8775
8866
8945
9013
9073
9115
9143
9160
9165
9153
9128
9084
9033
8964
8885
8798
8701
8598
8486
8376
8261
8143
8031
7920
7814
7715
7627
7543
7475
7419
7373
7344
7326
7321
7335
7366
7407
7457
7523
7601
7691
7789
7892
7999
8115
8232
8345
8461
8568
8676
8773
8866
8943
9010
9068
9114
9144
9161
9165
9152
9127
9085
9029
8961
8886
8798
8706
8602
8489
8378
8260
8145
8033
7921
7819
7716
7625
7544
7478
7423
7374
7346
7327
7325
7337
7366
7408
7458
7525
7604
7692
7792
7895
8003
8116
8232
8346
8461
8569
8675
8772
8863
8942
9013
9072
9117
9146
9161
9165
9153
9128
9083
9032
8962
8884
8796
8702
8595
8488
8377
8258
8145
8031
7920
7813
7713
7628
7546
7472
7421
7374
7341
7326
7321
7333
7363
7403
7456
7523
7602
7694
7792
7893
7999
8115
8230
8346
8457
8571
8676
8776
8865
8942
9010
9069
9115
9144
9162
9162
9151
9120
9083
9029
8961
8880
8799
8701
8597
8485
8376
8259
8145
8032
7916
7812
7718
7624
7545
7475
7418
7377
7340
7331
7324
7338
7365
7407
7465
7529
7602
7693
7791
7895
8005
8115
8231
8346
8461
8569
8672
8772
8863
8942
9013
9072
9115
9145
9162
9166
9148
9123
9082
9032
8962
8884
8798
8700
8601
8487
8373
8256
8144
8031
7914
7812
7717
7625
7546
7477
7418
7374
7343
7324
7323
7335
7362
7406
7459
7525
7603
7691
7788
7892
8000
8114
8227
8346
8459
8568
8672
8774
8863
8945
9015
9069
9118
9146
9161
9164
9150
9124
9084
9031
8960
8883
8799
8703
8598
8486
8374
8259
8144
8032
7921
7815
7717
7629
7545
7477
7421
7376
7341
7328
7323
7335
7368
7407
7459
7527
7604
7693
7794
7894
8003
8114
8227
8349
8457
8569
8673
8773
8865
8941
9010
9069
9115
9142
9161
9163
9149
9121
9083
9031
8962
8884
8798
8699
8597
8486
8374
8257
8144
8030
7918
7813
7715
7626
7545
7476
7418
7374
7342
7327
7325
7336
7367
7408
7460
7527
7601
7691
7788
7896
8004
8113
8232
8348
8458
8569
8675
8774
8866
8944
9015
9071
9116
9149
9161
9164
9152
9125
9082
9034
8959
8884
8796
8702
8599
8488
8376
8262
8146
8032
7920
7815
7715
7626
7541
7475
7420
7373
7341
7324
7324
7334
7367
7404
7460
7526
7606
7693
7788
7894
8002
8116
8234
8346
8462
8571
8674
8775
8861
8945
9015
9070
9117
9145
9163
9165
9155
9127
9085
9032
8962
8888
8797
8703
8601
8491
8375
8256
8147
8033
7921
7815
7720
7629
7550
7478
7419
7374
7345
7328
7325
7340
7364
7406
7462
7526
7601
7694
7787
7894
8005
8116
8231
8348
8458
8568
8675
8772
8863
8945
9014
9072
9116
9146
9160
9166
9152
9125
9082
9033
8960
8886
8795
8699
8598
8488
8376
8262
8143
8034
7920
7814
7719
7628
7546
7474
7421
7373
7341
7328
7323
7337
7364
7407
7459
7526
7605
7693
7789
7893
8003
8115
8233
8347
8462
8571
8672
8774
8864
8944
9012
9069
9114
9145
9161
9165
9156
9124
9085
9032
8964
8887
8796
8703
8595
8486
8372
8260
8149
8028
7921
7817
7716
7628
7545
7477
7418
7376
7346
7329
7324
7337
7369
7404
7459
7529
7602
7693
7789
7893
8000
8116
8230
8344
8461
8570
8675
8775
8864
8945
9013
9069
9115
9146
9163
9166
9154
9127
9082
9034
8962
8887
8796
8700
8598
8489
8373
8260
8147
8029
7920
7814
7718
7628
7547
7477
7422
7374
7343
7327
7323
7336
7361
7404
7463
7526
7602
7692
7789
7894
8004
8117
8232
8346
8462
8569
8675
8776
8862
8943
9016
9068
9114
9148
9161
9164
9153
9126
9085
9029
8959
8884
8795
8701
8595
8486
8372
8254
8142
8030
7919
7813
7716
7625
7544
7475
7419
7369
7342
7326
7323
7336
7361
7405
7458
7524
7603
7692
7788
7891
8001
8111
8228
8349
8461
8571
8675
8774
8863
8945
9014
9070
9115
9146
9161
9168
9152
9123
9084
9031
8962
8885
8798
8701
8596
8488
8377
8262
8147
8032
7919
7811
7718
7628
7547
7474
7419
7372
7343
7325
7322
7335
7363
7406
7462
7524
7601
7694
7789
7894
8002
8114
8229
8349
8459
8569
8673
8773
8864
8943
9013
9071
9114
9148
9161
9164
9153
9126
9083
9032
8961
8885
8796
8703
8599
8489
8374
8257
8144
8029
7918
7818
7716
7623
7545
7476
7419
7373
7346
7329
7326
7336
7365
7407
7459
7525
7604
7690
7791
7893
8002
8112
8233
8345
8458
8568
8674
8772
8862
8942
9014
9069
9112
9147
9159
9163
9150
9120
9082
9029
8960
8883
8795
8701
8594
8483
8371
8255
8141
8027
7917
7814
7715
7621
7540
7474
7419
7370
7341
7324
7320
7334
7364
7400
7457
7520
7598
7689
7787
7893
8000
8112
8228
8344
8455
8566
8673
8773
8862
8939
9014
9068
9112
9142
9157
9165
9148
9121
9082
9028
8958
8882
8796
8698
8598
8488
8369
8258
8142
8030
7920
\ No newline at end of file
doc:
pydoc -w ./adc-oop.py ./adc.py
clean:
rm -f *.pyc *.html
#! /usr/bin/env python
# coding: utf8
__doc__ = """
Interface for the adc ADC characterization module
This is a preliminary spec of the interface to be expected from the
GUI of the ADC characterization environment
Some notes:
- A Signal object packs all the info we may need from a signal, to
wit,
* its raw data vector and, implicitly,
* raw data vector length == number of samples,
* number of bits (size of the integer samples in raw data vector)
* sampling rate
"""
window_types = [
'RECTANGULAR',
'HANN',
'HAMMING',
'TUKEY',
'COSINE',
'LANCZOS',
'BARTLETT_HANN',
]
class Signal(object):
"""a representation of a time-domain sampled signal
"""
def __init__(self, data, nbits, rate):
"""initialize a signal object
data: an array of samples (usually nbits-long words, stored in
a numpy array)
nbits: bit width of the sample values
rate: sampling rate of sample production
"""
self.data = data
self.nbits = nbits
self.rate = rate
def histogram(self):
"""Compute histogram of a sampled signal
The number of bins in the histogram is implicitly given by the number
of bits of the samples: 2**signal.nbits bins.
returns: an array of 2**signal.nbits numbers (frequencies)
"""
def ideal_histogram(self):
"""Produce an ideal vector of frequencies (histogram) for the
nsamples samples of a perfect nbits ADC. Mostly for auxiliary and
display purposes
returns: an array of 2**signal.nbits numbers (frequencies)
"""
def DNL(self):
"""Compute differential non-linearity vector for a given time-domain
signal
returns: a pair (dnl, total) where
- dnl is an array of 2**signal.nbits real values and
- total is a real value (computed from dnl)
"""
def INL(self):
"""Compute integral non-linearity vector for a given time-domain signal
returns: a pair (inl, total) where
- inl is an array of 2**signal.nbits real values and
- total is a real (computed from inl)
"""
def FFT(self, navg, window):
"""Compute the amplitudes (in dB) of the FFT of signal, averaging navg
slices of it and applying window to it
navg: number of signal slices to average
window: a value from a finite list of windows defined in window_types
returns: an FFTSignal object
"""
class FFTSignal(object):
"""a representation of a frequency-domain signal
"""
def __init__(self, fft, dB = None, time_domain = None):
"""initialize an FFTSignal object
fft: array of numeric values of the fft
dB: true when in dB units, false if raw amplitude
time_domain: the original time-domain signal if available, None
otherwise
self.fft = fft
self.dB = dB
self.time_domain = time_domain
"""
def process_gain(self):
"""compute the process gain for a given number of samples
returns: process gain (a number in dB)
"""
def harmonic_peaks(self, max_peaks):
"""peak detector
This auxiliary function computes an array of indices into the fft
array, pointing to the positions of the first max_peaks most
significant peaks
max_peaks: integer (usually in a small range, < 10)
returns: an array of at most max_peak indices into
the fft.fft array
"""
def noise_floor(self):
"""noise floor of a frequency-domain signal
returns: the real value of the fft noise floor
"""
def SFDR(self):
"""spurious free dynamic range
returns: a real number
"""
def SINAD(self):
"""signal to noise and distortion ratio
returns: a real number
"""
def THD(self):
"""total harmonic distortion
fft: FFTSignal object
returns: a real number
"""
def SNR(self):
"""signal-to-noise ratio
returns: a real number
"""
def ENOB(self):
"""effective number of bits
A direct function of the SINAD, relating both scalar values
"""
if __name__ == '__main__':
pass
#! /usr/bin/env python
# coding: utf8
__doc__ = """
Interface for the adc ADC characterization module
This is a preliminary spec of the interface to be expected from the
GUI of the ADC characterization environment
Some notes:
- A Signal object packs all the info we may need from a signal, to
wit,
* its raw data vector and, implicitly,
* raw data vector length == number of samples,
* number of bits (size of the integer samples in raw data vector)
* sampling rate
- The calls requiring an fft array of numbers use an FFTSignal
object containing the array of samples, whether it is in dB or
absolute units, and the original Signal it comes from. The latter
is mostly ignored, except when some alternative algorithms for
harmonic peak detection are used behing THD, SINAD, etc. In
general, an array of numbers can replace this argument type
everywhere, and the passing of a bare array of reals can
be easily accomodated in each function taking an FFTSignal.
- Some function might vary in spec slightly, but changes, if any,
should be minor.
- In particular, the functions taking an FFT as input might well
take a frequency domain signal object FFTSignal as an argument,
allowing us to compute parameters like distortion or the
best-fitting sinewave in the input from that. This would be
transparent to the callers, who can limit themselves to put
an array of real values in the fft.fft field of the fft argument
passed to THD, SINAD, etc. Do not care about this now, though:
it's easy to change if needed.
"""
window_types = [
'RECTANGULAR',
'HANN',
'HAMMING',
'TUKEY',
'COSINE',
'LANCZOS',
'BARTLETT_HANN',
]
class Signal(object):
"""a representation of a time-domain sampled signal
"""
def __init__(self, data, nbits, rate):
"""initialize a signal object
data: an array of samples (usually nbits-long words, stored in
a numpy array)
nbits: bit width of the sample values
rate: sampling rate of sample production
"""
self.data = data
self.nbits = nbits
self.rate = rate
class FFTSignal(object):
"""a representation of a frequency-domain signal
"""
def __init__(self, fft, dB = None, time_domain = None):
"""initialize an FFTSignal object
fft: array of numeric values of the fft
dB: true when in dB units, false if raw amplitude
time_domain: the original time-domain signal if available, None
otherwise
self.fft = fft
self.dB = dB
self.time_domain = time_domain
"""
def histogram(signal):
"""Compute histogram of a sampled signal
The number of bins in the histogram is implicitly given by the number
of bits of the samples: 2**signal.nbits bins.
signal: a Signal object
returns: an array of 2**signal.nbits numbers (frequencies)
"""
def ideal_histogram(nbits, nsamples):
"""Produce an ideal vector of frequencies (histogram) for the
nsamples samples of a perfect nbits ADC. Mostly for auxiliary and
display purposes
nbits: number of bits of the ideal ADC
nsamples: number of samples
returns: an array of 2**signal.nbits numbers (frequencies)
"""
def DNL(signal):
"""
Compute differential non-linearity vector for a given time-domain
signal
signal: a Signal objectA
returns: a pair (dnl, total) where
- dnl is an array of 2**signal.nbits real values and
- total is a real value (computed from dnl)
"""
def INL(signal):
"""Compute integral non-linearity vector for a given time-domain signal
signal: a Signal object
returns: a pair (inl, total) where
- inl is an array of 2**signal.nbits real values and
- total is a real (computed from inl)
"""
def FFT(signal, navg, window):
"""
Compute the amplitudes (in dB) of the FFT of signal, averaging navg
slices of it and applying window to it
signal: a Signal object
navg: number of signal slices to average
window: a value from a finite list of windows defined in window_types
returns: an FFTSignal object
"""
def process_gain(nsamples):
"""compute the process gain for a given number of samples
nsamples: number of samples for computing an FFT
returns: process gain (a number in dB)
"""
def harmonic_peaks(fft, max_peaks):
"""peak detector
This auxiliary function computes an array of indices into the fft
array, pointing to the positions of the first max_peaks most
significant peaks
fft: FFTSignal object
max_peaks: integer (usually in a small range, < 10)
returns: an array of at most max_peak indices into
the fft.fft array
"""
def noise_floor(fft):
"""noise floor of a frequency-domain signal
fft: FFTSignal object
returns: the real value of the fft noise floor
"""
def SFDR(fft):
"""spurious free dynamic range
fft: FFTSignal object
returns: a real number
"""
def SINAD(fft):
"""signal to noise and distortion ratio
fft: FFTSignal object
returns: a real number
"""
def THD(fft):
"""total harmonic distortion
fft: FFTSignal object
returns: a real number
"""
def SNR(fft):
"""signal-to-noise ratio
fft: FFTSignal object
returns: a real number
"""
def ENOB(sinad):
"""effective number of bits
A direct function of the SINAD, relating both scalar values
"""
return (sinad - 1.76) / 6.02
if __name__ == '__main__':
pass
import sys
import time
import threading
from itertools import izip, count
def foreach(f,l,threads=3,return_=False):
"""
Apply f to each element of l, in parallel
"""
if threads>1:
iteratorlock = threading.Lock()
exceptions = []
if return_:
n = 0
d = {}
i = izip(count(),l.__iter__())
else:
i = l.__iter__()
def runall():
while True:
iteratorlock.acquire()
try:
try:
if exceptions:
return
v = i.next()
finally:
iteratorlock.release()
except StopIteration:
return
try:
if return_:
n,x = v
d[n] = f(x)
else:
f(v)
except:
e = sys.exc_info()
iteratorlock.acquire()
try:
exceptions.append(e)
finally:
iteratorlock.release()
threadlist = [threading.Thread(target=runall) for j in xrange(threads)]
for t in threadlist:
t.start()
for t in threadlist:
t.join()
if exceptions:
a, b, c = exceptions[0]
raise a, b, c
if return_:
r = d.items()
r.sort()
return [v for (n,v) in r]
else:
if return_:
return [f(v) for v in l]
else:
for v in l:
f(v)
return
def parallel_map(f,l,threads=3):
return foreach(f,l,threads=threads,return_=True)
if __name__=='__main__':
def f(x):
print x
time.sleep(0.5)
foreach(f,range(10))
def g(x):
time.sleep(0.5)
print x
raise ValueError, x
time.sleep(0.5)
foreach(g,range(10))
* parser error display freezes compiz. Shorten it to 25 lines or less in
the popup
* automatically parse? An Open button and the parse button is not needed
* in general, test all out-of-bounds conditions and deal with errors
properly
* draw some plots with lines (time-domain signal/done), FFT?, INL/DNL?
* keyboard navigation
* use rfft instead of fft
* fix order of FFT windows in the dialog FFT
* zoom and pan viewports (at least time domain and fft)
* fix the issue with the parameters of Kaiser window
[SIGNAL]
nbits = 16
rate = 123
data = 5985
12339
2643
14924
1018
15458
1615
13775
4247
10402
8112
6357
12014
2901
14757
1081
15509
1459
14026
3925
10768
7713
6744
11668
3175
14569
1164
15533
1323
14259
3610
11145
7322
7130
11313
3468
14364
1267
15539
1212
14473
3316
11494
6929
7522
10951
3771
14138
1391
15522
1117
14670
3031
11842
6547
7920
10583
4094
13898
1543
15483
1046
14842
2761
12182
6164
8311
10202
4424
13637
1706
15421
993
15006
2513
12510
5786
8709
9818
4764
13364
1891
15344
965
15142
2277
12820
5421
9101
9425
5116
13075
2095
15240
956
15263
2056
13127
5058
9496
9042
5477
12778
2308
15127
967
15357
1856
13410
4705
9877
8642
5844
12458
2550
14978
1002
15434
1674
13682
4367
10260
8250
6224
12134
2802
14824
1056
15491
1515
13938
4039
10634
7854
6600
11791
3073
14640
1131
15526
1373
14176
3726
11008
7464
6994
11441
3363
14438
1229
15537
1254
14396
3419
11364
7068
7378
11083
3660
14225
1344
15527
1147
14600
3128
11722
6682
7773
10717
3976
13991
1486
15501
1068
14783
2855
12060
6295
8172
10339
4302
13736
1642
15445
1010
14945
2600
12391
5925
8565
9956
4636
13469
1818
15378
966
15099
2355
12713
5547
8955
9572
4984
13182
2014
15283
954
15221
2133
13018
5188
9350
9180
5346
12887
2230
15168
959
15326
1925
13305
4835
9737
8786
5709
12576
2455
15035
984
15410
1736
13589
4492
10125
8400
6086
12254
2713
14882
1034
15474
1567
13843
4157
10501
7996
6465
11917
2974
14707
1101
15516
1422
14095
3833
10878
7606
6849
11575
3253
14514
1190
15535
1294
14315
3528
11237
7213
7239
11210
3549
14301
1304
15534
1188
14530
3236
11598
6825
7633
10853
3858
14076
1431
15513
1093
14721
2954
11938
6436
8028
10475
4182
13827
1585
15468
1030
14894
2692
12277
6056
8426
10102
4516
13564
1754
15404
987
15048
2443
12599
5682
8817
9714
4854
13291
1938
15321
959
15178
2209
12913
5321
9208
9322
5216
13000
2151
15213
953
15292
1999
13204
4959
9601
8930
5574
12689
2375
15086
972
15383
1804
13490
4614
9990
8537
5945
12372
2616
14944
1010
15453
1627
13756
4274
10365
8139
6321
12042
2872
14775
1072
15503
1472
14010
3949
10741
7749
6710
11699
3154
14586
1157
15531
1333
14237
3637
11109
7350
7099
11346
3441
14381
1259
15537
1219
14458
3338
11469
6964
7493
10985
3746
14162
1380
15523
1123
14651
3054
11814
6579
7880
10614
4060
13919
1525
15487
1050
14834
2787
12153
6198
8276
10242
4388
13668
1686
15432
994
14991
2528
12479
5820
8672
9849
4730
13390
1868
15354
964
15133
2291
12801
5453
9067
9469
5082
13110
2068
15253
953
15254
2076
13102
5088
9455
9077
5441
12802
2289
15133
965
15355
1872
13388
4744
9839
8686
5811
12493
2531
14993
999
15424
1688
13658
4395
10226
8281
6188
12162
2781
14834
1049
15485
1525
13913
4068
10605
7889
6570
11824
3050
14659
1123
15524
1381
14157
3750
10975
7498
6959
11474
3334
14458
1221
15537
1261
14376
3446
11339
7106
7349
11114
3637
14242
1334
15536
1156
14583
3155
11689
6713
7739
10749
3944
14010
1469
15502
1076
14771
2877
12031
6333
8138
10373
4269
13764
1623
15454
1010
14934
2621
12366
5959
8528
9995
4608
13492
1800
15384
972
15085
2378
12684
5583
8924
9610
4955
13210
1997
15292
957
15210
2151
12987
5222
9318
9214
5314
12909
2211
15178
957
15320
1941
13287
4864
9702
8829
5676
12608
2437
15048
981
15400
1756
13560
4522
10088
8426
6046
12279
2687
14895
1027
15467
1584
13823
4188
10467
8036
6434
11948
2948
14721
1096
15513
1436
14071
3859
10841
7639
6816
11601
3229
14531
1184
15536
1303
14299
3554
11207
7248
7206
11247
3527
14320
1289
15537
1190
14510
3261
11559
6860
7595
10885
3829
14096
1420
15514
1102
14705
2980
11911
6474
7993
10509
4153
13852
1568
15474
1037
14876
2709
12247
6094
8384
10132
4481
13591
1737
15411
983
15034
2463
12567
5719
8782
9748
4828
13316
1923
15329
959
15168
2228
12883
5353
9171
9361
5175
13025
2126
15223
954
15282
2019
13181
4995
9563
8973
5543
12721
2354
15101
973
15375
1818
13465
4643
9951
8573
5913
12402
2594
14948
1009
15449
1642
13731
4305
10329
8179
6292
12070
2852
14788
1065
15501
1487
13984
3977
10709
7784
6671
11729
3123
14605
1146
15530
1348
14218
3668
11074
7391
7062
11379
3413
14399
1249
15540
1232
14433
3365
11434
7000
7455
11013
3715
14184
1367
15531
1129
14637
3082
11786
6614
7843
10649
4034
13943
1512
15494
1054
14817
2808
12124
6227
8242
10272
4360
13689
1675
15436
1002
14980
2551
12455
5856
8636
9891
4703
13417
1853
15360
966
15122
2313
12770
5479
9029
9501
5050
13135
2048
15266
949
15244
2090
13075
5127
9420
9115
5403
12836
2268
15147
964
15340
1889
13363
4772
9808
8717
5778
12519
2502
15013
992
15424
1705
13636
4427
10194
8327
6155
12192
2757
14849
1042
15482
1538
13893
4094
10570
7930
6532
11856
3021
14674
1112
15521
1398
14136
3780
10944
7537
6923
11505
3309
14480
1208
15538
1269
14359
3473
11302
7141
7310
11149
3605
14264
1322
15535
1166
14569
3183
11663
6749
7704
10783
3912
14037
1459
15511
1080
14756
2900
12003
6369
8096
10408
4239
13787
1612
15462
1016
14925
2642
12339
5990
8492
10035
4579
13519
1785
15388
979
15070
2402
12654
5615
8888
9639
4919
13238
1973
15302
954
15200
2170
12964
5254
9280
9254
5284
12943
2187
15189
957
15307
1962
13259
4898
9671
8859
5641
12633
2416
15063
979
15396
1770
13539
4550
10058
8470
6018
12312
2669
14907
1026
15457
1600
13801
4216
10434
8069
6397
11981
2922
14742
1084
15511
1448
14052
3892
10811
7674
6779
11632
3205
14552
1174
15536
1314
14276
3583
11172
7278
7169
11279
3495
14344
1280
15540
1200
14493
3286
11529
6892
7562
10916
3802
14119
1407
15520
1108
14687
3002
11878
6508
7957
10546
4121
13880
1550
15482
1040
14864
2735
12217
6123
8357
10169
4452
13616
1718
15421
986
15022
2484
12539
5750
8743
9781
4794
13342
1905
15338
959
15159
2255
12853
5388
9137
9395
5150
13053
2107
15234
953
15273
2035
13154
5027
9528
9002
5512
12744
2333
15108
967
15370
1837
13440
4676
9917
8611
5881
12431
2575
14964
1007
15441
1659
13708
4331
10296
8216
6255
12100
2823
14805
1061
15499
1503
13962
4011
10678
7820
6639
11762
3105
14618
1138
15528
1356
14198
3691
11040
7428
7029
11410
3388
14421
1240
15539
1238
14416
3394
11404
7031
7417
11052
3689
14202
1354
15530
1137
14619
3103
11752
6643
7809
10680
4003
13969
1495
15499
1061
14801
2830
12096
6260
8208
10305
4329
13715
1654
15443
1006
14965
2573
12424
5886
8599
9919
4672
13437
1832
15367
968
15108
2336
12742
5516
8995
9533
5022
13158
2039
15272
953
15230
2110
13046
5158
9386
9141
5376
12859
2248
15155
960
15336
1905
13338
4798
9776
8756
5746
12549
2482
15024
987
15417
1719
13611
4463
10157
8359
6120
12219
2737
14865
1039
15482
1556
13874
4126
10538
7965
6502
11888
2999
14689
1108
15519
1408
14114
3802
10910
7565
6888
11538
3281
14497
1197
15541
1282
14341
3500
11274
7178
7278
11183
3581
14287
1316
15536
1173
14545
3206
11621
6789
7666
10816
3887
14052
1446
15513
1089
14740
2930
11974
6402
8064
10446
4210
13806
1599
15465
1023
14904
2667
12300
6022
8462
10064
4546
13543
1771
15396
979
15059
2424
12629
5653
8852
9678
4890
13266
1957
15311
956
15189
2190
12939
5280
9245
9288
5249
12970
2163
15202
950
15304
1983
13233
4932
9633
8896
5611
12663
2396
15073
976
15389
1787
13512
4585
10020
8500
5981
12340
2642
14923
1019
15457
1616
13780
4242
10406
8106
6360
12010
2900
14755
1081
15505
1458
14027
3922
10772
7709
6744
11667
3176
14569
1165
15533
1324
14260
3611
11136
7324
7136
11314
3469
14364
1270
15536
1210
14472
3310
11500
6929
7524
10948
3778
14139
1392
15523
1115
14673
3030
11846
6543
7920
10584
4092
13900
1538
15484
1044
14846
2760
12185
6157
8313
10199
4425
13642
1705
15420
992
15007
2508
12515
5786
8713
9820
4766
13364
1891
15344
965
15144
2272
12824
5414
9105
9430
5113
13081
2092
15245
953
15258
2059
13128
5059
9496
9040
5481
12775
2315
15120
970
15355
1856
13404
4709
9879
8643
5843
12458
2550
14980
1002
15433
1679
13681
4372
10262
8253
6224
12132
2807
14814
1058
15488
1515
13935
4041
10638
7856
6606
11790
3073
14638
1136
15526
1372
14174
3721
11010
7465
6994
11439
3361
14441
1227
15538
1250
14398
3418
11369
7067
7378
11082
3663
14222
1349
15530
1153
14600
3132
11721
6680
7781
10713
3977
13990
1486
15499
1067
14786
2851
12067
6294
8169
10339
4302
13736
1640
15447
1008
14948
2596
12395
5921
8569
9961
4642
13467
1820
15373
974
15095
2352
12709
5549
8955
9572
4988
13182
2017
15283
958
15220
2131
13023
5188
9351
9184
5346
12884
2228
15168
961
15327
1925
13308
4832
9744
8788
5711
12572
2463
15032
991
15406
1742
13588
4489
10124
8393
6087
12256
2707
14879
1035
15472
1569
13845
4154
10504
7996
6467
11912
2976
14707
1103
15515
1417
14093
3836
10875
7603
6853
11569
3258
14515
1189
15537
1294
14317
3530
11236
7213
7238
11209
3549
14301
1303
15533
1184
14526
3236
11595
6825
7633
10846
3863
14073
1433
15513
1095
14718
2952
11943
6435
8031
10479
4181
13827
1584
15475
1027
14893
2688
12275
6059
8422
10097
4517
13564
1756
15405
981
15047
2443
12600
5678
8819
9712
4859
13288
1939
15319
958
15181
2209
12911
5315
9210
9324
5215
12997
2151
15213
955
15293
1994
13206
4957
9597
8931
5582
12689
2377
15084
974
15382
1808
13488
4610
9991
8539
5949
12371
2618
14936
1012
15452
1626
13758
4274
10365
8140
6327
12039
2875
14771
1075
15504
1473
14009
3951
10742
7748
6714
11696
3154
14588
1156
15530
1336
14237
3633
11110
7348
7100
11340
3447
14380
1263
15537
1218
14459
3339
11470
6963
7496
10985
3747
14160
1383
15518
1125
14650
3056
11814
6574
7879
10613
4062
13920
1525
15487
1053
14833
2787
12157
6190
8281
10235
4396
13663
1686
15433
994
14995
2528
12487
5817
8674
9848
4732
13388
1869
15349
963
15132
2291
12797
5447
9067
9465
5086
13105
2071
15254
952
15252
2074
13098
5085
9461
9077
5442
12801
2292
15135
966
15351
1868
13389
4737
9848
8681
5812
12488
2530
14999
997
15430
1690
13660
4397
10227
8282
6189
12161
2777
14834
1050
15487
1526
13918
4065
10612
7889
6573
11823
3053
14655
1125
15522
1382
14158
3745
10974
7497
6958
11475
3337
14460
1218
15542
1259
14382
3445
11337
7103
7347
11114
3636
14240
1336
15533
1154
14582
3154
11687
6712
7742
10745
3949
14009
1473
15504
1072
14770
2880
12033
6331
8139
10373
4274
13762
1628
15451
1016
14933
2621
12365
5955
8532
9991
4609
13491
1806
15379
978
15082
2376
12687
5585
8931
9603
4961
13207
2001
15289
957
15212
2147
12992
5215
9320
9211
5314
12914
2207
15180
953
15319
1940
13289
4867
9707
8825
5680
12603
2442
15048
980
15404
1753
13560
4517
10091
8427
6051
12277
2691
14889
1028
15468
1582
13828
4185
10468
8036
6434
11944
2952
14723
1097
15513
1432
14074
3862
10842
7637
6818
11595
3231
14531
1184
15536
1301
14300
3554
11209
7250
7206
11245
3528
14324
1295
15536
1190
14513
3260
11556
6856
7595
10883
3830
14094
1422
15515
1104
14706
2978
11912
6470
7993
10510
4155
13853
1571
15478
1034
14877
2711
12246
6088
8388
10131
4486
13590
1737
15410
985
15031
2464
12572
5716
8785
9745
4832
13316
1924
15325
961
15169
2229
12881
5349
9171
9356
5184
13019
2128
15223
952
15282
2016
13181
4993
9568
8964
5548
12721
2358
15096
972
15375
1821
13464
4639
9949
8572
5916
12402
2595
14952
1008
15446
1642
13734
4305
10332
8176
6292
12072
2852
14789
1063
15505
1482
13983
3976
10709
7781
6675
11726
3127
14602
1147
15530
1345
14222
3666
11073
7391
7063
11380
3414
14398
1252
15537
1232
14435
3366
11435
6997
7454
11012
3718
14177
1374
15522
1133
14638
3079
11787
6608
7850
10644
4039
13939
1513
15493
1059
14818
2805
12125
6224
8249
10263
4367
13687
1673
15438
998
14977
2545
12460
5849
8641
9885
4705
13419
1854
15357
967
15122
2313
12770
5480
9034
9495
5053
13130
2055
15263
953
15244
2093
13071
5117
9428
9110
5412
12829
2271
15143
960
15345
1886
13362
4766
9810
8713
5778
12517
2507
15007
992
15421
1707
13638
4425
10197
8320
6158
12191
2760
14848
1047
15481
1539
13894
4091
10571
7921
6537
11847
3028
14668
1116
15520
1395
14138
3777
10945
7532
6925
11506
3311
14480
1209
15540
1265
14359
3471
11307
7135
7314
11142
3605
14259
1323
15534
1169
14570
3181
11663
6747
7706
10784
3915
14033
1459
15508
1081
14755
2905
12001
6365
8101
10408
4241
13782
1612
15458
1018
14923
2643
12338
5988
8499
10027
4582
13517
1787
15391
973
15075
2397
12656
5612
8891
9640
4924
13239
1978
15303
957
15199
2169
12966
5252
9281
9247
5282
12939
2192
15188
955
15312
1957
13260
4890
9667
8855
5645
12629
2414
15059
979
15398
1768
13540
4550
10061
8464
6020
12317
2667
14912
1023
15463
1599
13801
4216
10435
8067
6398
11977
2927
14738
1093
15509
1449
14050
3889
10807
7673
6784
11631
3206
14549
1174
15536
1311
14282
3578
11175
7281
7172
11277
3499
14342
1280
15537
1200
14493
3284
11531
6893
7565
10913
3804
14114
1406
15520
1108
14688
3000
11879
6499
7957
10540
4122
13873
1553
15481
1039
14864
2737
12220
6125
8352
10170
4456
13613
1723
15417
987
15022
2486
12540
5749
8745
9782
4795
13335
1904
15332
963
15155
2251
12856
5379
9140
9392
5152
13051
2111
15231
956
15273
2035
13154
5022
9527
9002
5509
12745
2332
15108
969
15370
1839
13438
4675
9917
8606
5882
12430
2577
14963
1005
15443
1660
13705
4333
10296
8211
6258
12095
2828
14804
1062
15498
1498
13963
4011
10674
7818
6642
11761
3105
14620
1140
15533
1357
14201
3693
11038
7421
7030
11405
3387
14414
1240
15539
1239
14422
3387
11405
7030
7421
11048
3693
14200
1358
15527
1139
14620
3101
11753
6638
7817
10676
4008
13965
1498
15500
1060
14802
2827
12095
6260
8211
10304
4332
13711
1654
15441
1005
14964
2574
12423
5882
8600
9921
4669
13440
1838
15363
971
15110
2335
12745
5520
8998
9536
5020
13153
2036
15269
954
15236
2109
13048
5150
9386
9140
5382
12856
2251
15155
960
15334
1907
13338
4795
9780
8752
5748
12544
2483
15025
988
15415
1722
13608
4459
10164
8353
6122
12215
2734
14865
1039
15482
1550
13874
4130
10537
7964
6501
11891
3001
14686
1110
15520
1408
14116
3807
10908
7567
6887
11532
3281
14494
1201
15536
1279
14340
3506
11273
7176
7278
11178
3585
14282
1318
15532
1172
14549
3204
11628
6785
7670
10810
3890
14050
1448
15510
1088
14741
2930
11979
6403
8067
10443
4215
13807
1598
15466
1021
14908
2666
12305
6024
8458
10062
4547
13541
1769
15396
975
15062
2419
12624
5651
8854
9679
4893
13268
1961
15312
957
15189
2190
12941
5284
9248
9287
5244
12967
2174
15201
957
15300
1982
13233
4928
9637
8898
5610
12659
2403
15070
980
15387
1786
13513
4580
10020
8496
5986
12339
2641
14925
1020
15460
1614
13781
4243
10406
8106
6364
12006
2904
14755
1077
15508
1456
14032
3917
10776
7710
6746
11665
3174
14568
1164
15533
1325
14260
3606
11148
7313
7142
11309
3471
14362
1274
15536
1211
14473
3306
11505
6924
7529
10945
3775
14136
1395
15522
1116
14675
3027
11852
6538
7923
10580
4094
13893
1540
15482
1044
14850
2759
12185
6155
8318
10199
4427
13638
1707
15419
994
15008
2506
12515
5783
8712
9817
4768
13363
1892
15344
965
15144
2269
12827
5414
9106
9426
5117
13073
2090
15243
949
15262
2054
13131
5058
9495
9036
5480
12777
2315
15123
969
15357
1853
13414
4702
9884
8642
5850
12453
2552
14976
1002
15436
1675
13686
4362
10264
8248
6228
12129
2810
14819
1056
15492
1511
13940
4032
10643
7853
6608
11790
3077
14636
1131
15524
1371
14177
3720
11012
7461
6997
11442
3361
14442
1228
15539
1244
14398
3414
11374
7061
7385
11080
3664
14220
1347
15531
1147
14603
3126
11728
6677
7780
10712
3977
13988
1487
15502
1069
14787
2854
12066
6295
8176
10334
4305
13730
1645
15448
1009
14948
2597
12395
5922
8571
9958
4641
13464
1821
15376
970
15096
2350
12716
5548
8963
9565
4984
13184
2013
15283
954
15220
2126
13025
5185
9357
9178
5350
12882
2229
15166
959
15328
1921
13315
4827
9744
8787
5711
12573
2460
15034
986
15413
1736
13591
4488
10127
8391
6087
12253
2710
14884
1033
15477
1566
13853
4151
10505
7997
6469
11914
2976
14708
1102
15518
1422
14095
3835
10880
7603
6857
11568
3257
14517
1193
15537
1291
14322
3527
11240
7208
7243
11210
3552
14303
1300
15540
1183
14532
3229
11599
6818
7634
10847
3863
14076
1431
15517
1094
14720
2952
11942
6435
8028
10473
4181
13831
1581
15475
1028
14896
2687
12276
6056
8427
10094
4518
13565
1757
15403
982
15046
2442
12605
5680
8821
9706
4860
13287
1942
15319
956
15180
2210
12912
5312
9217
9321
5215
12995
2153
15211
957
15294
1993
13211
4957
9602
8928
5578
12689
2374
15086
972
15382
1802
13493
4610
9988
8533
5952
12365
2623
14934
1013
15456
1622
13758
4274
10365
8143
6321
12042
2875
14769
1075
15505
1469
14010
3948
10742
7742
6714
11695
3155
14585
1158
15534
1333
14241
3634
11108
7349
7099
11340
3444
14379
1259
15541
1224
14461
3336
11470
6959
7498
10984
3750
14158
1382
15523
1124
14657
3051
11817
6572
7889
10609
4066
13917
1528
15488
1048
14834
2781
12161
6191
8281
10236
4393
13664
1688
15430
996
14992
2528
12485
5812
8678
9852
4734
13392
1870
15355
961
15135
2291
12803
5449
9072
9460
5088
13104
2071
15251
952
15252
2073
13102
5081
9459
9076
5446
12803
2289
15136
960
15356
1870
13390
4740
9845
8681
5811
12488
2532
14992
995
15429
1687
13660
4396
10226
8279
6192
12159
2782
14832
1051
15490
1524
13921
4063
10609
7888
6572
11824
3054
14657
1123
15525
1381
14159
3748
10977
7492
6961
11476
3336
14463
1216
15541
1258
14384
3442
11345
7103
7349
11113
3636
14246
1333
15533
1156
14583
3155
11693
6711
7742
10742
3949
14009
1469
15508
1073
14772
2878
12037
6325
8144
10368
4274
13756
1628
15452
1011
14939
2613
12369
5947
8531
9987
4611
13493
1804
15381
976
15086
2373
12687
5579
8928
9602
4964
13206
2002
15291
955
15215
2145
12994
5219
9317
9212
5313
12913
2209
15178
956
15315
1944
13286
4862
9711
8820
5682
12600
2440
15044
985
15402
1754
13560
4520
10093
8424
6050
12276
2689
14889
1028
15469
1582
13827
4184
10473
8032
6436
11945
2953
14720
1094
15515
1430
14073
3859
10846
7636
6818
11598
3232
14532
1180
15537
1295
14299
3551
11213
7243
7210
11248
3525
14324
1290
15538
1190
14515
3251
11565
6854
7601
10878
3833
14090
1421
15516
1103
14705
2977
11917
6466
7995
10508
4156
13851
1570
15477
1033
14880
2710
12250
6082
8390
10128
4487
13591
1738
15411
981
15035
2463
12574
5713
8785
9745
4829
13312
1930
15325
962
15164
2231
12885
5345
9175
9354
5184
13021
2132
15223
951
15284
2012
13184
4986
9570
8964
5550
12717
2358
15095
969
15376
1814
13468
4639
9955
8569
5914
12402
2594
14952
1008
15448
1642
13735
4302
10339
8177
6295
12067
2852
14786
1071
15500
1482
13988
3974
10712
7779
6682
11722
3131
14605
1147
15530
1346
14227
3661
11083
7383
7071
11372
3418
14400
1249
15539
1229
14439
3358
11439
6990
7459
11011
3722
14178
1370
15528
1130
14639
3078
11793
6609
7854
10645
4038
13944
1512
15496
1055
14818
2801
12128
6226
8247
10265
4367
13685
1675
15437
1001
14981
2549
12460
5849
8644
9886
4710
13413
1855
15363
964
15127
2308
12771
5475
9035
9500
5050
13128
2057
15266
950
15246
2089
13074
5116
9430
9105
5417
12830
2273
15146
961
15344
1883
13364
4767
9810
8715
5781
12513
2512
15003
994
15422
1707
13639
4419
10202
8316
6160
12189
2760
14844
1046
15484
1538
13901
4092
10579
7923
6537
11854
3025
14672
1119
15523
1394
14138
3772
10948
7529
6931
11500
3314
14474
1213
15538
1268
14361
3469
11315
7133
7314
11145
3607
14258
1324
15535
1165
14572
3176
11666
6743
7715
10773
3921
14028
1461
15513
1080
14755
2894
12009
6357
8100
10403
4242
13779
1611
15459
1018
14923
2642
12338
5986
8498
10026
4579
13515
1785
15391
974
15074
2391
12659
5614
8893
9638
4926
13236
1981
15301
955
15203
2167
12975
5251
9290
9249
5291
12939
2192
15188
956
15312
1954
13264
4892
9673
8857
5648
12630
2418
15058
980
15395
1767
13543
4546
10064
8459
6024
12308
2669
14907
1022
15465
1596
13807
4212
10437
8062
6399
11974
2927
14738
1088
15511
1447
14049
3889
10818
7666
6788
11628
3210
14548
1174
15534
1308
14285
3579
11180
7278
7174
11273
3501
14337
1280
15539
1200
14495
3279
11539
6886
7572
10910
3804
14117
1405
15521
1105
14693
2998
11884
6502
7957
10543
4121
13872
1550
15483
1037
14866
2733
12222
6120
8357
10164
4462
13614
1719
15418
989
15023
2485
12543
5745
8751
9777
4796
13334
1907
15338
962
15158
2248
12855
5378
9146
9390
5153
13046
2115
15232
957
15275
2032
13157
5019
9534
8996
5513
12744
2333
15107
972
15367
1838
13440
4670
9923
8609
5883
12427
2575
14967
1007
15443
1653
13710
4329
10304
8209
6259
12094
2830
14800
1060
15497
1496
13965
4009
10679
7814
6644
11758
3104
14617
1137
15530
1355
14203
3688
11047
7423
7030
11404
3386
14419
1241
15539
1237
14420
3388
11410
7027
7427
11043
3695
14196
1360
15528
1139
14618
3100
11758
6644
7811
10670
4007
13960
1500
15496
1063
14799
2832
12097
6262
8208
10300
4336
13707
1661
15440
1007
14964
2573
12427
5873
8607
9916
4673
13438
1838
15365
962
15114
2333
12747
5513
9000
9532
5024
13155
2036
15272
951
15234
2109
13048
5151
9388
9140
5380
12853
2251
15152
961
15337
1906
13340
4797
9779
8749
5750
12542
2489
15019
989
15417
1717
13613
4460
10163
8349
6124
12217
2736
14859
1041
15481
1554
13874
4118
10543
7957
6504
11881
3005
14690
1110
15520
1405
14113
3801
10912
7560
6892
11531
3283
14497
1201
15540
1276
14342
3501
11275
7176
7280
11177
3580
14281
1315
15534
1174
14549
3203
11633
6780
7671
10805
3891
14050
1447
15513
1085
14740
2926
11974
6399
8067
10439
4217
13805
1599
15463
1020
14909
2668
12307
6019
8460
10060
4546
13538
1775
15391
982
15059
2421
12632
5650
8856
9674
4894
13262
1963
15309
958
15189
2189
12940
5281
9249
9282
5250
12962
2170
15201
953
15302
1978
13234
4927
9641
8890
5616
12658
2399
15071
976
15392
1783
13514
4575
10022
8499
5987
12334
2643
14920
1022
15455
1614
13780
4240
10406
8101
6365
12004
2905
14753
1082
15505
1459
14029
3917
10780
7701
6753
11658
3182
14564
1168
15530
1324
14262
3608
11148
7314
7143
11301
3477
14357
1271
15537
1212
14476
3308
11503
6923
7531
10941
3779
14134
1398
15519
1116
14675
3027
11854
6538
7927
10574
4096
13893
1542
15483
1044
14851
2751
12192
6154
8320
10192
4429
13636
1707
15423
992
15013
2504
12521
5779
8721
9814
4770
13363
1890
15342
963
15144
2268
12828
5413
9104
9425
5120
13073
2093
15245
953
15263
2055
13132
5053
9497
9035
5486
12774
2314
15120
969
15362
1851
13417
4700
9884
8640
5848
12454
2556
14973
1003
15433
1675
13685
4366
10267
8244
6228
12128
2811
14816
1053
15491
1511
13942
4032
10643
7847
6611
11784
3079
14635
1132
15526
1366
14184
3718
11017
7460
6999
11438
3365
14436
1228
15538
1244
14399
3417
11374
7066
7387
11077
3666
14215
1353
15529
1151
14605
3128
11729
6676
7783
10706
3985
13981
1490
15501
1070
14786
2854
12062
6292
8173
10332
4305
13733
1645
15444
1012
14947
2596
12396
5917
8575
9950
4647
13466
1821
15377
968
15093
2352
12716
5545
8960
9560
4991
13180
2018
15283
958
15220
2132
13024
5180
9360
9178
5348
12882
2235
15169
959
15328
1919
13314
4824
9746
8781
5715
12568
2461
15033
983
15413
1736
13593
4486
10131
8387
6093
12247
2713
14879
1034
15474
1568
13850
4150
10509
7993
6469
11908
2979
14704
1103
15517
1421
14096
3835
10879
7603
6857
11566
3263
14509
1190
15536
1292
14321
3521
11243
7206
7246
11208
3550
14302
1302
15535
1181
14536
3229
11605
6813
7640
10841
3865
14071
1433
15513
1097
14725
2951
11944
6431
8033
10470
4184
13828
1582
15473
1023
14893
2688
12280
6054
8429
10092
4521
13566
1757
15401
982
15048
2438
12606
5680
8819
9710
4859
13287
1945
15316
957
15181
2209
12909
5312
9215
9320
5222
12992
2152
15212
953
15293
1994
13207
4957
9607
8926
5581
12686
2375
15081
977
15384
1803
13493
4606
9993
8533
5958
12367
2625
14935
1014
15451
1627
13758
4269
10371
8135
6329
12036
2875
14768
1077
15501
1472
14010
3946
10747
7745
6717
11692
3157
14585
1158
15533
1329
14240
3634
11114
7347
7102
11336
3447
14379
1258
15544
1217
14459
3332
11473
6953
7499
10976
3750
14158
1384
15524
1123
14659
3045
11820
6571
7889
10608
4064
13918
1526
15488
1048
14832
2777
12163
6191
8284
10232
4400
13659
1690
15431
996
14999
2524
12489
5810
8675
9847
4736
13389
1870
15352
964
15134
2288
12804
5446
9074
9463
5087
13108
2070
15251
950
15254
2070
13104
5086
9461
9067
5449
12798
2292
15131
964
15351
1867
13392
4738
9852
8678
5817
12485
2531
14995
999
15429
1689
13661
4392
10235
8277
6194
12153
2787
14830
1053
15487
1525
13917
4063
10613
7882
6577
11816
3057
14651
1129
15522
1385
14156
3744
10984
7488
6962
11467
3338
14453
1224
15542
1260
14381
3440
11346
7102
7354
11111
3639
14240
1335
15532
1152
14583
3148
11697
6708
7748
10742
3951
14004
1469
15502
1074
14771
2878
12038
6327
8144
10368
4276
13756
1628
15453
1016
14935
2621
12366
5952
8537
9984
4614
13493
1804
15379
976
15089
2378
12691
5578
8929
9603
4965
13206
1998
15291
954
15213
2147
12994
5212
9323
9208
5318
12909
2214
15174
954
15317
1940
13292
4860
9714
8817
5684
12599
2445
15044
983
15406
1752
13563
4511
10096
8421
6061
12274
2690
14892
1027
15472
1585
13827
4179
10478
8027
6437
11944
2954
14720
1096
15512
1432
14075
3858
10843
7634
6821
11596
3232
14529
1185
15533
1301
14302
3550
11214
7239
7213
11239
3532
14320
1295
15533
1190
14515
3254
11568
6848
7602
10876
3836
14090
1424
15516
1106
14707
2975
11919
6469
7999
10505
4156
13851
1572
15476
1033
14878
2710
12250
6086
8390
10126
4489
13586
1738
15409
986
15037
2463
12579
5712
8789
9743
4830
13312
1926
15327
959
15170
2232
12883
5344
9178
9353
5191
13017
2132
15217
951
15282
2011
13186
4991
9573
8962
5553
12713
2356
15095
972
15376
1818
13470
4635
9958
8565
5922
12394
2596
14949
1008
15447
1641
13736
4304
10340
8170
6301
12064
2858
14785
1069
15501
1482
13988
3973
10710
7777
6681
11723
3132
14597
1150
15531
1345
14222
3660
11085
7384
7071
11367
3425
14395
1254
15537
1226
14440
3359
11438
6991
7459
11009
3724
14173
1371
15525
1131
14640
3075
11793
6606
7857
10638
4038
13940
1514
15491
1055
14821
2801
12128
6222
8250
10261
4369
13687
1672
15435
998
14981
2546
12466
5847
8645
9882
4709
13414
1855
15360
962
15122
2311
12776
5479
9040
9494
5058
13126
2052
15259
955
15247
2089
13080
5119
9429
9103
5417
12828
2272
15145
966
15342
1886
13368
4762
9817
8708
5786
12512
2511
15003
993
15428
1705
13643
4425
10200
8317
6161
12184
2762
14849
1043
15485
1540
13898
4092
10580
7919
6540
11847
3028
14667
1115
15522
1394
14138
3773
10951
7522
6933
11503
3317
14471
1212
15538
1264
14363
3463
11314
7131
7318
11141
3609
14259
1323
15532
1164
14569
3176
11668
6742
7712
10775
3921
14030
1461
15511
1078
14758
2901
12006
6358
8109
10400
4242
13777
1618
15458
1018
14925
2645
12341
5984
8502
10021
4584
13513
1788
15387
975
15071
2395
12661
5609
8892
9634
4928
13231
1982
15298
954
15200
2169
12969
5247
9290
9247
5283
12939
2192
15186
959
15312
1957
13267
4888
9675
8849
5653
12623
2419
15059
978
15400
1766
13546
4547
10062
8460
6022
12309
2666
14909
1020
15466
1592
13806
4210
10440
8064
6404
11970
2935
14738
1089
15514
1441
14057
3885
10819
7668
6791
11631
3213
14549
1176
15532
1305
14285
3577
11180
7274
7176
11275
3503
14338
1282
15539
1201
14496
3281
11535
6889
7570
10908
3811
14113
1409
15515
1109
14691
2997
11888
6498
7964
10536
4130
13869
1554
15479
1040
14864
2733
12222
6121
8358
10158
4461
13611
1724
15416
989
15022
2482
12545
5745
8753
9774
4805
13333
1909
15336
959
15158
2247
12858
5382
9148
9389
5158
13049
2111
15232
949
15277
2031
13160
5014
9536
8991
5520
12740
2336
15106
970
15371
1833
13446
4664
9925
8599
5888
12427
2577
14964
1002
15445
1652
13715
4330
10302
8210
6264
12094
2831
14800
1063
15498
1496
13966
4005
10680
7814
6648
11755
3108
14621
1140
15527
1354
14205
3687
11049
7416
7032
11402
3391
14415
1235
15542
1236
14422
3384
11409
7029
7427
11041
3698
14196
1356
15531
1136
14624
3094
11758
6637
7814
10677
4011
13964
1496
15494
1060
14800
2828
12102
6257
8213
10298
4341
13707
1659
15442
1002
14968
2571
12430
5877
8606
9916
4674
13437
1839
15364
962
15114
2331
12749
5510
9003
9533
5027
13152
2041
15272
953
15236
2107
13054
5144
9392
9137
5381
12850
2253
15155
960
15336
1906
13341
4795
9781
8746
5750
12536
2488
15017
992
15418
1717
13619
4447
10171
8346
6128
12213
2736
14859
1037
15485
1549
13877
4118
10547
7956
6511
11885
3003
14686
1108
15519
1403
14120
3798
10912
7557
6895
11530
3284
14489
1201
15538
1278
14345
3494
11283
7172
7281
11174
3584
14280
1315
15535
1171
14551
3205
11631
6780
7671
10809
3891
14047
1450
15507
1089
14740
2925
11979
6394
8071
10432
4216
13800
1600
15464
1022
14908
2661
12312
6011
8464
10057
4553
13533
1771
15396
977
15063
2412
12634
5645
8863
9670
4902
13260
1966
15308
955
15190
2185
12946
5274
9255
9276
5256
12963
2176
15198
954
15304
1976
13241
4921
9641
8891
5617
12658
2399
15074
977
15392
1779
13520
4573
10027
8490
5986
12338
2644
14920
1019
15457
1609
13781
4241
10410
8096
6369
12004
2910
14752
1080
15510
1453
14032
3915
10782
7699
6747
11662
3181
14566
1170
15531
1324
14261
3604
11150
7309
7144
11304
3478
14356
1273
15542
1212
14481
3304
11507
6917
7533
10941
3780
14133
1393
15526
1115
14671
3027
11856
6537
7925
10575
4098
13893
1542
15482
1043
14849
2755
12191
6152
8323
10194
4428
13633
1708
15423
991
15011
2502
12521
5779
8718
9813
4772
13363
1888
15344
960
15148
2266
12832
5407
9108
9424
5120
13074
2091
15241
952
15264
2051
13132
5051
9504
9030
5486
12771
2318
15120
967
15361
1852
13416
4701
9884
8637
5853
12449
2553
14976
1001
15436
1669
13685
4361
10273
8243
6233
12120
2810
14819
1056
15497
1509
13941
4029
10648
7845
6610
11784
3082
14634
1131
15529
1366
14185
3716
11015
7456
7000
11436
3366
14438
1232
15541
1248
14400
3410
11380
7057
7391
11068
3669
14216
1349
15530
1146
14605
3125
11729
6676
7785
10705
3980
13984
1488
15501
1066
14786
2848
12068
6294
8175
10331
4305
13728
1645
15445
1007
14956
2591
12401
5915
8571
9955
4643
13464
1821
15374
970
15095
2352
12721
5541
8968
9556
4995
13177
2022
15280
956
15223
2129
13023
5182
9360
9173
5355
12881
2232
15166
959
15329
1922
13314
4823
9747
8781
5720
12568
2464
15030
986
15413
1733
13593
4488
10133
8387
6094
12244
2714
14877
1033
15476
1564
13851
4150
10507
7989
6472
11909
2977
14705
1100
15518
1417
14101
3826
10884
7597
6859
11566
3262
14511
1198
15537
1289
14323
3519
11246
7201
7246
11206
3556
14297
1303
15532
1182
14533
3226
11602
6815
7642
10842
3865
14071
1433
15513
1092
14720
2948
11951
6427
8036
10471
4185
13820
1587
15467
1027
14896
2686
12280
6052
8431
10089
4520
13563
1754
15402
983
15049
2441
12602
5678
8821
9704
4868
13285
1945
15317
958
15185
2207
12919
5310
9219
9316
5223
12991
2160
15208
958
15290
1996
13214
4952
9607
8922
5585
12684
2376
15081
977
15383
1798
13497
4608
9999
8527
5958
12363
2624
14936
1015
15455
1625
13757
4268
10372
8131
6332
12027
2882
14764
1077
15501
1471
14008
3949
10751
7740
6720
11692
3162
14581
1156
15532
1331
14245
3632
11113
7345
7105
11333
3449
14376
1264
15537
1218
14459
3334
11480
6959
7498
10976
3751
14156
1384
15523
1122
14659
3047
11823
6565
7889
10608
4067
13910
1528
15489
1050
14835
2779
12163
6191
8284
10227
4400
13659
1693
15429
998
14997
2523
12488
5808
8678
9843
4741
13388
1873
15351
963
15136
2287
12808
5440
9076
9459
5087
13104
2073
15251
957
15251
2070
13105
5080
9462
9067
5450
12798
2295
15132
966
15354
1867
13393
4728
9857
8672
5822
12483
2534
14992
1000
15430
1687
13662
4390
10236
8275
6194
12153
2786
14830
1052
15490
1522
13925
4056
10613
7880
6582
11816
3057
14651
1126
15525
1380
14165
3741
10980
7488
6965
11468
3341
14460
1217
15538
1256
14387
3440
11349
7095
7353
11107
3642
14239
1341
15530
1152
14585
3148
11697
6706
7750
10737
3953
14002
1476
15503
1073
14771
2874
12042
6323
8146
10367
4277
13753
1630
15453
1012
14938
2614
12375
5942
8540
9984
4616
13483
1805
15383
973
15091
2370
12692
5576
8934
9597
4965
13204
2004
15293
954
15211
2143
12997
5209
9325
9208
5319
12907
2213
15178
959
15318
1943
13291
4857
9718
8815
5686
12598
2447
15043
981
15409
1748
13567
4514
10098
8421
6062
12273
2693
14888
1030
15471
1582
13832
4178
10481
8027
6441
11938
2958
14717
1095
15512
1431
14074
3856
10848
7631
6826
11594
3235
14530
1182
15536
1298
14306
3549
11217
7239
7216
11241
3530
14322
1293
15538
1189
14516
3253
11572
6848
7602
10875
3832
14091
1416
15518
1103
14708
2974
11919
6465
8002
10505
4160
13841
1572
15475
1031
14883
2705
12255
6076
8398
10124
4489
13584
1739
15406
984
15037
2460
12579
5708
8789
9741
4838
13309
1928
15323
956
15169
2225
12890
5338
9186
9350
5187
13016
2134
15222
952
15286
2009
13188
4983
9576
8952
5557
12715
2361
15096
970
15378
1815
13470
4633
9958
8563
5926
12390
2603
14948
1008
15450
1637
13742
4295
10344
8170
6299
12062
2858
14790
1066
15503
1483
13988
3970
10714
7772
6682
11722
3129
14601
1148
15533
1341
14226
3660
11085
7383
7071
11372
3421
14396
1253
15541
1225
14442
3354
11443
6988
7467
11006
3723
14177
1372
15527
1129
14643
3073
11792
6604
7856
10640
4040
13937
1515
15493
1055
14821
2801
12131
6221
8246
10260
4372
13683
1674
15436
998
14981
2546
12467
5843
8652
9880
4710
13410
1858
15359
964
15125
2309
12776
5472
9043
9494
5056
13124
2058
15258
956
15244
2090
13081
5117
9435
9096
5423
12820
2277
15138
968
15346
1882
13366
4759
9819
8705
5789
12509
2508
15006
993
15426
1701
13642
4424
10203
8314
6164
12183
2766
14843
1046
15489
1536
13901
4084
10579
7918
6548
11842
3030
14670
1117
15523
1392
14144
3770
10956
7520
6934
11497
3313
14473
1215
15539
1268
14362
3464
11310
7129
7322
11138
3611
14258
1328
15529
1167
14570
3174
11669
6743
7720
10772
3925
14027
1462
15508
1077
14759
2894
12010
6358
8109
10396
4249
13774
1621
15453
1021
14920
2639
12341
5977
8507
10013
4592
13513
1792
15390
975
15078
2388
12665
5604
8899
9632
4930
13231
1984
15299
958
15203
2165
12973
5246
9294
9248
5291
12934
2197
15185
960
15311
1960
13263
4888
9681
8847
5652
12624
2421
15056
979
15399
1766
13550
4541
10063
8458
6034
12302
2674
14908
1023
15472
1591
13810
4204
10446
8063
6405
11973
2934
14738
1087
15511
1444
14055
3887
10816
7664
6792
11625
3209
14549
1178
15533
1311
14284
3576
11185
7272
7176
11268
3501
14338
1284
15537
1199
14500
3281
11543
6886
7571
10908
3806
14111
1409
15520
1111
14691
2994
11883
6497
7964
10537
4127
13871
1554
15480
1036
14868
2733
12220
6118
8361
10160
4464
13609
1726
15416
988
15022
2477
12552
5742
8757
9773
4803
13331
1914
15331
961
15161
2247
12860
5378
9149
9384
5159
13046
2117
15230
953
15273
2028
13161
5017
9535
8994
5522
12738
2336
15104
971
15370
1834
13445
4669
9928
8604
5890
12423
2579
14964
1006
15444
1651
13712
4325
10307
8207
6266
12093
2834
14801
1061
15499
1493
13971
4002
10685
7809
6651
11754
3110
14616
1143
15529
1353
14207
3688
11046
7416
7034
11400
3396
14414
1240
15536
1238
14425
3385
11410
7025
7432
11041
3696
14199
1357
15529
1135
14625
3095
11760
6640
7817
10673
4015
13961
1498
15497
1066
14804
2825
12105
6259
8220
10297
4337
13707
1658
15441
1000
14965
2570
12429
5878
8611
9913
4673
13436
1841
15368
966
15110
2329
12750
5508
9004
9529
5031
13151
2040
15272
951
15232
2104
13053
5142
9394
9136
5388
12850
2255
15156
963
15340
1902
13343
4793
9786
8744
5757
12541
2489
15017
992
15416
1719
13617
4447
10169
8346
6130
12212
2737
14866
1038
15480
1551
13877
4118
10551
7955
6511
11875
3010
14685
1110
15518
1404
14120
3798
10913
7555
6897
11527
3289
14489
1201
15541
1276
14346
3490
11285
7167
7283
11173
3587
14280
1316
15536
1168
14556
3200
11636
6772
7678
10806
3893
14049
1446
15513
1084
14744
2921
11987
6395
8077
10431
4218
13801
1601
15466
1022
14910
2659
12314
6016
8468
10052
4553
13537
1774
15393
981
15058
2420
12635
5642
8864
9674
4900
13258
1965
15310
958
15191
2182
12947
5275
9254
9273
5256
12962
2175
15194
956
15304
1977
13243
4920
9644
8886
5621
12653
2401
15070
977
15392
1779
13520
4573
10030
8493
5989
12333
2645
14919
1020
15464
1613
13782
4237
10412
8100
6375
11999
2914
14750
1086
15510
1455
14035
3914
10782
7699
6756
11657
3182
14566
1164
15537
1321
14266
3604
11151
7314
7144
11302
3479
14355
1274
15538
1209
14478
3305
11511
6918
7536
10939
3780
14132
1397
15522
1114
14676
3021
11859
6533
7932
10574
4105
13889
1544
15483
1045
14852
2752
12195
6148
8326
10193
4429
13631
1709
15422
994
15008
2504
12523
5777
8722
9806
4776
13361
1893
15341
959
15147
2264
12834
5403
9110
9418
5126
13071
2094
15240
953
15266
2048
13133
5049
9506
9032
5488
12768
2320
15119
967
15357
1852
13418
4697
9886
8635
5853
12451
2557
14972
1003
15435
1674
13688
4357
10271
8244
6229
12120
2813
14814
1061
15492
1508
13941
4029
10648
7839
6616
11783
3083
14633
1134
15529
1365
14184
3715
11020
7451
7005
11433
3366
14440
1231
15539
1245
14404
3409
11378
7059
7390
11072
3666
14213
1348
15528
1143
14607
3123
11729
6673
7787
10704
3986
13985
1487
15504
1065
14792
2846
12069
6288
8176
10330
4306
13728
1647
15445
1008
14953
2592
12402
5910
8579
9943
4652
13460
1824
15376
970
15101
2347
12720
5538
8970
9557
4996
13176
2020
15276
954
15224
2125
13031
5175
9361
9173
5354
12881
2233
15166
960
15326
1923
13320
4822
9747
8776
5716
12566
2467
15033
984
15412
1733
13591
4483
10137
8386
6096
12244
2720
14876
1035
15478
1563
13854
4147
10511
7987
6475
11903
2983
14702
1105
15518
1416
14101
3827
10885
7597
6862
11562
3260
14515
1192
15540
1287
14321
3519
11251
7199
7250
11202
3558
14297
1306
15534
1181
14535
3225
11606
6811
7645
10838
3871
14066
1441
15513
1098
14725
2947
11953
6424
8038
10467
4192
13819
1590
15466
1027
14897
2681
12285
6043
8435
10088
4530
13562
1756
15403
980
15049
2432
12610
5671
8823
9700
4872
13278
1947
15316
953
15182
2205
12917
5311
9218
9317
5227
12993
2154
15210
955
15295
1993
13213
4949
9616
8914
5588
12680
2380
15085
975
15381
1800
13497
4608
9997
8526
5964
12364
2627
14932
1017
15451
1620
13765
4266
10376
8133
6333
12031
2882
14769
1075
15506
1467
14017
3943
10752
7736
6723
11691
3159
14584
1159
15531
1331
14244
3630
11117
7341
7110
11331
3450
14374
1262
15540
1214
14464
3328
11476
6955
7504
10974
3753
14155
1384
15524
1122
14657
3046
11828
6566
7891
10606
4068
13913
1528
15486
1046
14834
2776
12165
6185
8287
10224
4400
13661
1690
15428
993
15000
2519
12494
5808
8682
9842
4742
13387
1871
15348
964
15136
2290
12806
5445
9078
9457
5095
13096
2076
15250
954
15253
2068
13108
5082
9468
9060
5455
12796
2298
15130
964
15356
1869
13396
4727
9856
8669
5826
12479
2539
14990
1000
15428
1684
13664
4382
10237
8275
6198
12149
2791
14828
1051
15486
1522
13925
4056
10614
7881
6583
11812
3061
14649
1127
15524
1373
14167
3738
10987
7483
6965
11460
3344
14452
1223
15539
1255
14387
3438
11347
7091
7360
11104
3646
14232
1342
15528
1158
14589
3146
11698
6701
7751
10737
3953
14004
1474
15504
1074
14776
2874
12040
6323
8146
10365
4282
13750
1633
15453
1012
14937
2611
12370
5941
8538
9986
4615
13483
1806
15379
976
15085
2373
12691
5575
8934
9597
4963
13206
2005
15288
957
15214
2146
13000
5212
9327
9205
5321
12904
2218
15176
961
15318
1938
13295
4854
9717
8812
5693
12595
2451
15045
985
15405
1746
13570
4510
10099
8413
6064
12272
2694
14887
1029
15464
1581
13833
4177
10480
8024
6441
11937
2961
14716
1100
15514
1429
14075
3854
10851
7630
6820
11586
3237
14525
1181
15537
1299
14304
3549
11218
7238
7217
11241
3533
14317
1296
15536
1189
14517
3247
11574
6838
7613
10868
3840
14087
1425
15513
1101
14707
2970
11922
6461
8001
10502
4163
13842
1574
15470
1031
14880
2705
12254
6079
8399
10115
4496
13582
1743
15407
983
15041
2455
12583
5708
8790
9734
4840
13305
1931
15324
961
15169
2227
12892
5334
9184
9347
5191
13013
2137
15217
958
15283
2014
13189
4985
9574
8956
5556
12710
2360
15092
974
15377
1818
13465
4636
9963
8564
5928
12387
2604
14945
1014
15448
1642
13740
4298
10342
8170
6308
12061
2861
14782
1072
15503
1482
13987
3970
10714
7770
6685
11719
3134
14596
1149
15528
1347
14224
3659
11085
7378
7079
11367
3424
14394
1251
15538
1223
14444
3352
11448
6988
7463
11006
3727
14173
1372
15526
1129
14644
3073
11796
6601
7858
10637
4043
13935
1517
15494
1052
14827
2800
12135
6218
8252
10258
4368
13682
1675
15435
1000
14979
2545
12463
5842
8646
9877
4713
13410
1856
15357
966
15126
2309
12778
5471
9042
9492
5060
13123
2059
15258
954
15245
2089
13083
5114
9434
9098
5423
12822
2279
15137
965
15344
1886
13367
4756
9820
8707
5787
12505
2511
15001
995
15423
1702
13643
4419
10206
8313
6165
12186
2767
14845
1046
15484
1538
13902
4084
10581
7914
6544
11843
3031
14664
1119
15522
1395
14141
3772
10954
7527
6934
11501
3315
14472
1212
15539
1267
14363
3464
11316
7126
7321
11138
3614
14257
1324
15534
1161
14573
3171
11670
6742
7716
10774
3923
14029
1461
15507
1079
14762
2894
12010
6356
8111
10399
4245
13776
1613
15459
1015
14928
2635
12346
5976
8507
10021
4588
13511
1791
15391
976
15076
2392
12666
5605
8902
9630
4932
13231
1987
15297
955
15205
2164
12977
5241
9294
9238
5293
12938
2195
15188
954
15312
1953
13269
4881
9681
8848
5655
12622
2426
15057
979
15399
1763
13549
4540
10069
8455
6031
12303
2674
14905
1024
15466
1592
13809
4206
10445
8057
6405
11971
2933
14736
1085
15513
1444
14057
3886
10819
7668
6791
11623
3214
14547
1172
15534
1307
14284
3572
11181
7269
7178
11270
3507
14334
1284
15537
1199
14501
3274
11545
6882
7573
10904
3814
14112
1410
15518
1104
14694
2995
11890
6495
7964
10535
4131
13867
1560
15480
1038
14868
2731
12226
6115
8361
10156
4461
13609
1729
15411
992
15024
2478
12548
5741
8754
9772
4802
13332
1912
15335
963
15159
2247
12862
5372
9151
9382
5162
13044
2116
15231
951
15276
2029
13162
5015
9540
8989
5520
12737
2337
15107
970
15370
1836
13446
4664
9929
8602
5894
12421
2579
14964
1005
15444
1653
13715
4323
10310
8201
6268
12091
2836
14797
1063
15499
1492
13970
3997
10686
7804
6654
11748
3110
14615
1141
15531
1350
14206
3680
11051
7414
7039
11397
3397
14413
1239
15541
1234
14424
3379
11418
7024
7433
11038
3696
14195
1358
15528
1138
14624
3095
11760
6637
7819
10671
4012
13961
1504
15498
1060
14809
2824
12106
6249
8218
10293
4339
13705
1661
15439
1002
14967
2571
12432
5875
8613
9913
4679
13432
1837
15365
967
15116
2326
12753
5502
9011
9525
5034
13149
2039
15273
951
15237
2105
13056
5143
9399
9130
5390
12850
2255
15156
961
15336
1901
13348
4792
9786
8747
5756
12541
2490
15018
991
15418
1714
13620
4446
10169
8345
6127
12210
2739
14861
1039
15481
1552
13878
4115
10549
7950
6512
11876
3006
14685
1109
15524
1399
14122
3792
10919
7553
6898
11526
3288
14489
1200
15539
1276
14349
3489
11286
7165
7291
11171
3590
14277
1313
15535
1170
14557
3193
11637
6771
7678
10803
3894
14048
1448
15513
1085
14739
2922
11984
6394
8077
10434
4220
13800
1604
15463
1020
14911
2657
12315
6010
8470
10045
4556
13534
1772
15396
979
15064
2409
12637
5638
8864
9667
4902
13259
1964
15309
957
15194
2182
12948
5271
9256
9277
5256
12959
2174
15198
955
15305
1974
13243
4919
9646
8884
5623
12656
2405
15066
980
15393
1781
13525
4568
10030
8487
5991
12332
2644
14921
1014
15461
1611
13787
4235
10410
8097
6370
12004
2908
14752
1082
15509
1455
14036
3912
10784
7697
6755
11658
3183
14565
1166
15537
1319
14266
3602
11154
7308
7149
11301
3475
14357
1275
15538
1207
14482
3298
11515
6910
7540
10936
3785
14136
1399
15524
1110
14679
3019
11860
6531
7929
10574
4105
13892
1546
15483
1043
14854
2752
12196
6145
8333
10185
4432
13631
1710
15421
990
15013
2500
12527
5772
8724
9806
4777
13357
1894
15344
961
15150
2268
12831
5405
9112
9419
5127
13069
2099
15241
954
15266
2048
13139
5043
9508
9025
5494
12767
2316
15121
967
15367
1848
13421
4695
9891
8633
5858
12448
2554
14976
1000
15440
1669
13695
4356
10276
8239
6235
12121
2812
14816
1056
15496
1506
13945
4027
10650
7838
6614
11778
3085
14634
1135
15526
1365
14187
3710
11020
7451
7007
11433
3367
14435
1234
15539
1244
14403
3406
11379
7056
7395
11065
3672
14215
1348
15528
1142
14608
3121
11734
6672
7789
10705
3985
13979
1491
15502
1066
14794
2843
12074
6281
8182
10323
4310
13727
1646
15448
1008
14956
2588
12406
5907
8578
9947
4652
13463
1826
15376
970
15104
2346
12724
5536
8973
9556
4997
13175
2022
15280
954
15221
2123
13033
5172
9366
9168
5355
12874
2239
15164
956
15328
1918
13319
4818
9757
8773
5721
12563
2468
15030
983
15413
1730
13600
4478
10141
8379
6099
12243
2719
14878
1033
15475
1562
13853
4140
10518
7982
6479
11906
2981
14701
1103
15516
1417
14102
3824
10887
7590
6866
11558
3264
14511
1193
15541
1284
14329
3517
11251
7196
7250
11199
3561
14292
1306
15531
1183
14537
3226
11607
6807
7648
10833
3875
14066
1433
15512
1093
14726
2942
11951
6424
8035
10464
4188
13818
1589
15466
1022
14896
2680
12287
6041
8437
10084
4532
13558
1760
15401
984
15051
2435
12609
5670
8831
9698
4870
13274
1949
15316
956
15182
2201
12919
5306
9223
9313
5226
12986
2154
15213
954
15295
1990
13213
4946
9614
8914
5591
12676
2384
15080
974
15387
1797
13498
4604
9997
8529
5961
12364
2629
14934
1017
15454
1620
13763
4264
10377
8131
6335
12031
2884
14766
1078
15505
1468
14012
3939
10756
7737
6728
11685
3162
14581
1158
15535
1331
14244
3632
11119
7341
7111
11334
3450
14370
1263
15539
1218
14464
3326
11482
6952
7507
10975
3755
14155
1386
15529
1121
14660
3042
11826
6564
7896
10601
4075
13910
1531
15487
1047
14840
2777
12166
6187
8293
10224
4401
13656
1692
15431
995
14997
2524
12493
5805
8687
9837
4745
13381
1876
15346
961
15138
2285
12810
5436
9083
9455
5096
13096
2076
15251
951
15256
2068
13110
5075
9472
9062
5453
12796
2296
15129
967
15352
1865
13395
4727
9860
8664
5825
12480
2539
14988
1001
15430
1686
13668
4384
10239
8273
6200
12151
2790
14827
1051
15486
1523
13926
4056
10620
7878
6583
11810
3058
14649
1129
15523
1377
14166
3736
10989
7484
6969
11461
3342
14455
1224
15538
1255
14388
3433
11352
7096
7360
11106
3647
14236
1337
15532
1153
14589
3142
11704
6700
7752
10737
3956
14003
1477
15500
1075
14775
2870
12045
6321
8149
10361
4283
13750
1638
15451
1009
14941
2610
12372
5940
[SIGNAL]
nbits = 12
rate = 1110
data = 0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
This source diff could not be displayed because it is too large. You can view the blob instead.
[SIGNAL]
nbits = 16
rate = 123
data = 1
2
3
4
5
-0.0139388910499
0.0756613283641
0.128759127602
0.169575809817
0.244099439553
0.306779721623
0.375048880639
0.425027260066
0.484185545203
0.535421457098
0.591754384546
0.619414359581
0.687367305494
0.730445183176
0.773202705162
0.815470355326
0.844011499105
0.875280563655
0.900282819658
0.926638791334
0.952639501932
0.966977862275
0.969674255213
1.00198945358
0.981079126722
1.007817229
0.997527816021
0.994226242771
0.988549746779
0.968969798004
0.961382701302
0.940630319908
0.921477072425
0.866496012822
0.843734203894
0.817917693515
0.767138189045
0.724103628976
0.676820098275
0.636729241868
0.587238486772
0.547481768193
0.483829299129
0.42766303586
0.361268122452
0.302087025471
0.258784141815
0.182385331159
0.113858537263
0.0668136363639
0.00927897621256
-0.0701149564905
-0.135020225869
-0.18493204501
-0.246262058332
-0.315120604573
-0.379369268698
-0.426213780707
-0.485519591091
-0.537120876094
-0.597022415245
-0.627126718401
-0.691513911185
-0.716619564037
-0.76833225414
-0.802031287717
-0.85216960123
-0.882476561339
-0.891286115932
-0.927169692758
-0.937679159348
-0.961516883106
-0.977622840092
-1.00073607962
-0.997377280586
-0.99872923133
-0.992706267503
-0.996058135359
-0.987415419325
-0.977516994888
-0.953092683785
-0.927896757013
-0.921581038383
-0.873139853179
-0.84335529775
-0.819544059154
-0.777849859037
-0.725212422197
-0.679382760045
-0.64160346947
-0.588515246869
-0.536935656739
-0.484613091446
-0.432437173482
-0.372268373293
-0.300333618858
-0.256697655616
-0.189626702835
-0.123154588856
-0.0660641664756
pure_sin.txt Pure sinewave, A = 2.9, fa = 100, phi = 0, 1MHz, t=0.02s
gaussian_100th.txt Same with 0.01 rms gaussian noise (SNR = 2e2)
gaussian_1000th.txt Same with 0.001 rms gaussian noise (SNR = 2e3)
incoherent.txt Pure sinewave as above, incoherently sampled (t = 0.025s)
incoherent_1000gaussian.txt Same as above with 0.001 rms gaussian noise (SNR = 2e3)
thd_44_7_times.txt Same as above with 0.01 and 0.02 harmonics (SNR = 44.7)
thd_0.1_0.08_n_0.005.txt With 0.1 and 0.08 harmonics and 0.005 gaussian noise
log How these were made
Delivered-To: david.cobas@gmail.com
Received: by 10.68.64.233 with SMTP id r9cs42520pbs;
Fri, 24 Jun 2011 01:50:19 -0700 (PDT)
Received: by 10.204.138.136 with SMTP id a8mr1804484bku.106.1308905417812;
Fri, 24 Jun 2011 01:50:17 -0700 (PDT)
Return-Path: <manohar.vanga@cern.ch>
Received: from CERNMX31.cern.ch (cernmx31.cern.ch [137.138.144.179])
by mx.google.com with ESMTPS id q26si3339694faa.192.2011.06.24.01.50.17
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 24 Jun 2011 01:50:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of manohar.vanga@cern.ch designates 137.138.144.179 as permitted sender) client-ip=137.138.144.179;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of manohar.vanga@cern.ch designates 137.138.144.179 as permitted sender) smtp.mail=manohar.vanga@cern.ch
Received: from CERNFE21.cern.ch (137.138.144.150) by cernmxgwlb2.cern.ch
(137.138.144.179) with Microsoft SMTP Server (TLS) id 14.1.270.1; Fri, 24 Jun
2011 10:50:16 +0200
Received: from becoht-mvanga (137.138.192.18) by smtp.cern.ch
(137.138.144.172) with Microsoft SMTP Server (TLS) id 14.1.270.2; Fri, 24 Jun
2011 10:50:10 +0200
Date: Fri, 24 Jun 2011 10:47:47 +0200
From: Manohar Vanga <manohar.vanga@cern.ch>
To: <ht-drivers@cern.ch>
Subject: [ru@gnudd.com: Re: vme_intree_driver.txt]
Message-ID: <20110624084747.GA14398@becoht-mvanga>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
Return-Path: manohar.vanga@cern.ch
X-Originating-IP: [137.138.192.18]
List-ID: <ht-drivers.cern.ch>
Precedence: list
X-Auto-Response-Suppress: DR, OOF, AutoReply
Keywords: CERN SpamKiller Note: -50
Hi all,
I have been writing up a document describing the differences between the in-tree
driver and Emilio's (which we currently use). Below is the inlined document
followed by Alessandro's reply.
The document is still incomplete but this is where it is at so far. I am not
an expert at this and have many gaping holes in my knowledge and experience so
please _don't_ go easy on me with the criticism. I learn best that way :-)
----- BEGIN DOCUMENT -----
I have been studying the in-tree VME driver by Martyn Welsh and below are
the notes from my tests with it.
Note on Structure
-----------------
Just to mention beforehand, Emilio's driver (the one used at CERN currently
has one lesser level of indirection within most of the code when compared
with the in-tree driver. In this regard, the in-tree driver is better written
when compared with ours which was written for a specific purpose. For example,
here is an exerpt from the CERN driver (vme_dma.c):
static int vme_dma_setup(struct dma_channel *channel, int to_user)
{
...
rc = tsi148_dma_setup(channel);
...
return rc;
}
And below is an example from the in-tree one:
int vme_dma_list_exec(struct vme_dma_list *list)
{
struct vme_bridge *bridge;
...
retval = bridge->dma_list_exec(list);
...
return retval;
}
This has an extra level of indirection through the vme_bridge structure which
makes it more generic.
Bridge Registration
===================
The TSI148 bridge driver is available as part of the in-tree driver. It
registers into the bridge framework of the VME driver. It does this using:
static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
...
struct vme_bridge *tsi148_bridge;
/* ... allocate and fill up the structure ... */
vme_register_bridge(tsi148_bridge);
...
}
vme_register_bridge assigns the bridge a bus number and registers VME_SLOTS_MAX
devices from within the bridge structure.
struct vme_bridge {
...
int num;
...
struct device dev[VME_SLOTS_MAX];
...
};
The bus number is assigned based on a bitvector that can hold 32 bits
(unsigned int). This means we can have upto 32 bridges registered.
One other thing to note is that the vme_bridge->dev[] structure contains devices
all pointing to the bridge itself from what I can see. This means when probe and
remove are called, the received dev in the parameters is the bridge and not the
device being probed or removed. Below is code from vme_register_bridge().
for (i = 0; i < VME_SLOTS_MAX; i++) {
dev = &bridge->dev[i];
memset(dev, 0, sizeof(struct device));
dev->parent = bridge->parent;
dev->bus = &vme_bus_type;
/*
* We save a pointer to the bridge in platform_data so that we
* can get to it later. We keep driver_data for use by the
* driver that binds against the slot
*/
dev->platform_data = bridge;
dev_set_name(dev, "vme-%x.%x", bridge->num, i + 1);
retval = device_register(dev);
if (retval)
goto err_reg;
}
The parent of the device is being set to the parent of the bridge. I wasn't sure
about whether this was correct but from the the probe function of the vme_user
device, it is more clear.
static struct device *vme_user_bridge; /* Pointer to bridge device */
static int __devinit vme_user_probe(struct device *dev, int cur_bus,
int cur_slot)
{
...
/* Save pointer to the bridge device */
vme_user_bridge = dev;
...
Emilio also seems to have found this. Below is the snippet from his LKML reply
at https://lkml.org/lkml/2010/10/22/43
> * .probe and .remove pass a pointer to a struct device representing a VME
> bridge, instead of representing the device to be added/removed.
> * a bridge's module may be removed anytime and things do fall over;
> there is no refcounting at all and thus all drivers attached to
> the removed bus will oops.
Driver Registration
===================
VME drivers can register themselves using vme_register_driver. I wrote a driver
for the CVORA VME card to test things out and below is a snippet from its init
function.
static int cvora_init(void)
{
...
retval = vme_register_driver(&cvora_driver);
...
}
The cvora_driver above is of the type 'struct vme_driver'. In the very least,
we need to fill the 'name', 'probe' and 'release' fields. We also need to fill the
'bind_table' field (see below).
struct cvora_driver {
.name = "cvora",
.probe = cvora_probe,
.remove = __devexit_p(cvora_remove),
};
Bind Table
----------
The in-tree driver seems to have taken its structure from the way PCI works and
requires each driver to provide a list of buses and slots within these buses
where it expects its card to be.
The problem is that if multiple bridges are ever present in the same
crate, the numbering of the buses/bridges depends on the load-order of the
bridge drivers. Not pretty. I don't think we have such a crate around (with
multiple bridges) so we can simply assume the bus number to be 0. If however,
we have such a configuration, we would have to ensure that the load-order of
the bridge drivers is always the same.
At CERN, we use a database to feed in the information to drivers (D:) so this
shouldn't be too big an issue.
The second issue however, is more "aesthetic". If we allow the slot numbers of
the driver to be fed in through parameters, we have to write boring, repetitive
code that creates this bind table. The code in my CVORA driver, for example,
looks something like the one below.
#define VME_BUS_MAX 32
static int bus[VME_BUS_MAX];
static int bus_num;
MODULE_PARM_DESC(bus, "Enumeration of VMEbus to which the driver is connected");
module_param_array(bus, int, &bus_num, 0);
static int cvora_init(void)
{
int i;
struct vme_device_id *ids;
/* Dynamically create the bind table based on module parameters */
ids = kmalloc(sizeof(struct vme_device_id) * (bus_num + 1), GFP_KERNEL);
if (ids == NULL) {
retval = -ENOMEM;
goto err_id;
}
memset(ids, 0, (sizeof(struct vme_device_id) * (bus_num + 1)));
for (i = 0; i < bus_num; i++) {
ids[i].bus = bus[i];
ids[i].slot = VME_SLOT_ALL;
}
cvora_driver.bind_table = ids;
/* registration and error checking */
...
}
The driver is loaded using the bus id of the TSI148 bridge (0, since its the
only one):
$ insmod cvora.ko bus=0
Note that above, I have simply set the slot number in the bind table array
to VME_SLOT_ALL. This makes it _probe_ on all the slots. Note that this is
a probe and not a match. If we say a device will be in a specific slot, it is
fixed and no other device may be put in there (well, the wrong driver will get
probed based on the order of insmod). To avoid this, the slot numbers must
either be made unique for each driver (eg. if A has slots 1, 2 and 3, card B
should not have any of those). The other solution is to make these slot numbers
be per-driver rather than global.
The way that Emilio fixed this is to defer the matching to the driver itself.
So now the VME framework calls the match function of the driver which can then
do a device specific match (which cannot be done anywhere else as only the
driver knows how to identify its cards). This way, we don't need to provide any
bus/slot ids and we don't have ugly code for generating this table in each and
every VME driver. The driver simply gives the number of devices it wants to
match and these devices are created and the match is called for each one. The
device-specific matching is done in the driver and finally the non-matching
ones are removed.
Emilio's discussion of this issue on LKML: https://lkml.org/lkml/2010/10/22/43
We can also use VME_SLOT_CURRENT which takes the index of the device being
matched (in the vme_bridge->dev[] array) and compares with the geographical
address of the card being probed.
static int vme_bus_match(struct device *dev, struct device_driver *drv)
{
....
while ((driver->bind_table[i].bus != 0) ||
(driver->bind_table[i].slot != 0)) {
...
if ((driver->bind_table[i].slot == VME_SLOT_CURRENT) &&
(num == vme_slot_get(dev)))
return 1;
...
}
return 0;
}
The vme_slot_dev() function just calls the slot_get field of the bridge
structure.
int vme_slot_get(struct device *bus)
{
struct vme_bridge *bridge;
bridge = dev_to_bridge(bus);
...
return bridge->slot_get(bridge);
}
This one requires the bridge to have geographical addressing capability (it
should be able to tell what slot a card is in). I don't know if this is
crate-specific or not but the bridge (TSI148) does support it. Below is the
code from 'bridges/vme_tsi148.c'.
/*
* Determine Geographical Addressing
*/
static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
{
u32 slot = 0;
struct tsi148_driver *bridge;
bridge = tsi148_bridge->driver_priv;
if (!geoid) {
slot = ioread32be(bridge->base + TSI148_LCSR_VSTAT);
slot = slot & TSI148_LCSR_VSTAT_GA_M;
} else
slot = geoid;
return (int)slot;
}
As can be seen in the code above, geographical addressing can be disabled
by passing a non-zero 'geoid' parameter to the vme_tsi148 driver during
load. If this is not supported, we cannot use VME_SLOT_CURRENT in the bind
table.
VME Resources
=============
The in-tree driver provides a way to request master, slave and/or DMA windows
and it does this through something called resources. This is simply a way to
identify and keep track of the different windows and DMA channels. So instead
of requesting a specific window or channel, we request a resource with the
specific attributes we want (eg. for slaves, A24 with MBLT).
This is managed by the vme_resource structure. It is a simple structure that
specifies the type of resource.
/* Resource Type */
enum vme_resource_type {
VME_MASTER,
VME_SLAVE,
VME_DMA,
VME_LM
};
...
struct vme_resource {
enum vme_resource_type type;
struct list_head *entry;
};
NOTE: VME_LM in vme_resource_type is referring to the Location Monitor.
The bridge device registers a set of master, slave and DMA windows/channels
when it's driver is install and probe is run. Below is a snippet from
tsi148_probe().
/* Add slave windows to list */
for (i = 0; i < TSI148_MAX_SLAVE; i++) {
slave_image = kmalloc(sizeof(struct vme_slave_resource),
GFP_KERNEL);
...
slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 |
VME_USER3 | VME_USER4;
slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
VME_PROG | VME_DATA;
list_add_tail(&slave_image->list,
&tsi148_bridge->slave_resources);
}
Here the bridge is registering TSI148_MAX_SLAVE slave windows with the specific
attributes. The attributes are simply a set of bits being set in the specific
slave image. These are stored in the slave_resources list within the bridge
structure.
A similar procedure is done for masters and DMA channels in tsi148_probe().
Also it is useful to note that for the TSI148, the following are defined in
the header:
#define TSI148_MAX_MASTER 8 /* Max Master Windows */
#define TSI148_MAX_SLAVE 8 /* Max Slave Windows */
#define TSI148_MAX_DMA 2 /* Max DMA Controllers */
From what I can make out:
Master resources: Those for drivers running on the master. Pretty much any
driver we use.
Slave resources : These are for drivers running on "intelligent slaves" that have
the kernel running on them.
DMA resources : For any DMA transfers.
This document mostly concerns itself with master resources as these are what we
will be using for everything (we have no intelligent slaves running Linux at the
moment).
Requesting Resources
--------------------
As mentioned earlier, we can request resources based on a set of attributes. In
the case of the CVORA card, it has a 24 bit address space (A24). I requested a
master resource (the driver is running on a VME master, the main CPU) in the probe
function like so:
card->resource = vme_master_request(card->bridge, VME_A24, VME_SCT, VME_D32);
In the above, VME_SCT refers to Single Cycle Transfer (or something like that...).
The VME_D32 refers to a data width of 32 bits. This was taken from the CVORA manual
available as a PDF at:
http://isscvs.cern.ch/cgi-bin/cvsweb.cgi/cvora/doc/CVORA%20user%20Manual.pdf?cvsroot=abcofpga
There are similarly other functions for slaves and DMA.
struct vme_resource * vme_master_request(struct device *dev,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
struct vme_resource * vme_slave_request(struct device *dev,
vme_address_t aspace, vme_cycle_t cycle);
struct vme_resource *vme_dma_request(struct device *dev,
vme_dma_route_t route);
These functions loop through the bridge structures resource lists as registered
above and simply search for a free one with that requested bits set. Here is a
snippet from vme_slave_request():
/* Loop through slave resources */
list_for_each(slave_pos, &bridge->slave_resources) {
slave_image = list_entry(slave_pos,
struct vme_slave_resource, list);
...
/* Find an unlocked and compatible image */
if (((slave_image->address_attr & address) == address) &&
((slave_image->cycle_attr & cycle) == cycle) &&
(slave_image->locked == 0)) {
...
slave_image->locked = 1;
allocated_image = slave_image;
break;
}
}
They also set the "entry" pointer (to struct list_head) in the
vme_[master|slave|dma]_resource structure to point to &allocated_image->list
so that the vme resource structure (vme_[master|slave|dma]_resource) can be
retrieved later from the one passed by the user (struct vme_resource). Below
is an example of this from vme_master_set().
int vme_master_set(struct vme_resource *resource, int enabled,
unsigned long long vme_base, unsigned long long size,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
{
struct vme_master_resource *image;
...
image = list_entry(resource->entry, struct vme_master_resource, list);
...
}
Similar stuff happens in vme_[master|dma]_request(). Consequently, there are
also a set of vme_*_free() functions:
void vme_master_free(struct vme_resource *res);
void vme_slave_free(struct vme_resource *res);
void vme_dma_free(struct vme_resource *res);
From the above, I think we can only register up to 8 master windows using this
driver. If we have more than 8 master drivers requesting windows, vme_request_master
would fail. I am not sure how people are using this driver but I suppose there is
a layer written on top to support more than 8 slaves.
In Emilio's driver, there is an abstraction over this to allow for more than 8
slave windows. Parts of one window are logically mapped allowing for different
devices to use the same window. For example if one window supports A24/D32 (24
bit address space and 32 bit data width), all devices requiring these window
attributes can map to different parts of this window (as long as there is
enough memory available).
Allocating Buffers
------------------
The driver documentation recommends using the vme_[alloc|free]_consistent() set
of functions to allocate and deallocate contiguous buffers in memory. These
functions simply do some checks and calls pci_[alloc|free]_consistent().
void *vme_alloc_consistent(struct vme_resource *resource, size_t size,
dma_addr_t *dma)
{
...
pdev = container_of(bridge->parent, struct pci_dev, dev);
...
return pci_alloc_consistent(pdev, size, dma);
}
void vme_free_consistent(struct vme_resource *resource, size_t size,
void *vaddr, dma_addr_t dma)
{
...
pdev = container_of(bridge->parent, struct pci_dev, dev);
...
pci_free_consistent(pdev, size, vaddr, dma);
}
One thing to note is that since it is calling pci_* functions, this means the
driver is assuming a PCI-VME bridge at all times (also the struct vme_bridge
contains a struct pci_dev as the parent device). I don't suppose
any other bridge apart from PCI is available or widely used so this is not a
problem. For us, it's fine since we use the TSI148 everywhere.
The vme_user driver (which allows user-space access for VME cards), which
is also the guide for my CVORA driver, however, doesn't use this stuff for
masters and instead uses it only for slaves.
For slaves:
image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = vme_alloc_consistent(image[i].resource,
image[i].size_buf, &image[i].pci_buf);
For masters:
image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
For the CVORA driver (master driver), I used kmalloc in my code:
card->size_buf = PCI_BUF_SIZE;
card->kern_buf = kmalloc(card->size_buf, GFP_KERNEL);
if (card->kern_buf == NULL) {
printk(KERN_ERR PFX "kmalloc for buffer failed\n");
goto vme_alloc_fail;
}
Configuring the Master
----------------------
After requesting the required resources, we need to configure the channel
correctly by providing the base address, size of mapping etc.
In the case of masters and slaves, this is done using the
vme_[master|slave]_set() set of functions.
int vme_master_set(struct vme_resource *, int, unsigned long long,
unsigned long long, vme_address_t, vme_cycle_t, vme_width_t);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
The first parameter is the resource we requested earlier. The second parameter
is whether to enable the master/slave or not (non-zero is to enable, zero to
disable). The third and fourth parameters are the base address and size of
mapping respectively. The last three parameters are the same as the ones passed
in the vme_*_request function. In the CVORA card, I do the following:
card->base = bases[ndev]; /* array of bases passed as parameter to module */
card->size = 0x8000; /* Taken from CVORA manual */
...
vme_master_set(card->resource, 1, card->base, card->size,
VME_A24, VME_SCT, VME_D32);
I then load the driver using:
insmod cvora.ko bus=0 bases=0x3000000
Here, 0x3000000 is the default base address for the new card which I stuck into
the crate.
----- END DOCUMENT -----
----- Forwarded message from Alessandro Rubini <ru@gnudd.com> -----
Date: Thu, 23 Jun 2011 13:09:13 +0200
From: Alessandro Rubini <ru@gnudd.com>
To: manohar.vanga@cern.ch
Subject: Re: vme_intree_driver.txt
[btw: why doesn't this go to ht-drivers?]
> Just to mention beforehand, Emilio's driver (the one used at CERN
> currently has one lesser level of indirection within most of the
> code when compared with the in-tree driver. In this regard, the
> in-tree driver is better written when compared with ours which was
> written for a specific purpose.
One level less means more preformance -- is it useful? -- but
as your said it means it's tsi148-specific.
> retval = bridge->dma_list_exec(list);
That's definitely better. You need structures of methods everywhere
except where perofmance is critical.
> This has an extra level of indirection through the vme_bridge structure which
> makes it more generic.
Exactly.
> The bus number is assigned based on a bitvector that can hold 32 bits
> (unsigned int). This means we can have upto 32 bridges registered.
This is suboptimal but I don't think people will ever exveed 32 buses.
If (when) it's possible to exceed it, a better mechanism should be used.
> One other thing to note is that the vme_bridge->dev[] structure
> contains devices all pointing to the bridge itself from what I can
> see. This means when probe and remove are called, the received dev
> in the parameters is the bridge and not the device being probed or
> removed.
This is bad. Can't is be a bus like other buses, with a list of
devices and drivers and a match function? Then, each device should
host a pointer to the hosting bus, which has a bridge field. Probe
and remove should receive the device itself, not the parent bus
controller.
> Below is code from vme_register_bridge().
> [...]
> retval = device_register(dev);
Why does it register a device (0..slot-max) with no real device
being detected?
> Emilio also seems to have found this.
>> * .probe and .remove pass a pointer to a struct device representing a VME
>> bridge, instead of representing the device to be added/removed.
>> * a bridge's module may be removed anytime and things do fall over;
>> there is no refcounting at all and thus all drivers attached to
>> the removed bus will oops.
Exactly.
> Driver Registration
> ===================
>
> [...]
> The in-tree driver seems to have taken its structure from the way
> PCI works and requires each driver to provide a list of buses and
> slots within these buses where it expects its card to be.
Doesn't look like PCI. I mean, if you have no autodetection you must
say where your hardware is known to be. More like a platform device
than PCI/USB.
> The problem is that if multiple bridges are ever present in the same
> crate, the numbering of the buses/bridges depends on the load-order
> of the bridge drivers. Not pretty.
No, not pretty. It's like the eth0/eth1 problem (which has been solved
in the wrong way, in my opinion: I must remove the udev rules for that
or I have serious problems when switching boards).
Naming and numbering should depend on hardware address, not on load
order. Like ether device should be named according to the pci slot
(and once I've done this trivial change for a client).
> I don't think we have such a crate around (with multiple bridges) so
> we can simply assume the bus number to be 0. If however, we have
> such a configuration, we would have to ensure that the load-order of
> the bridge drivers is always the same.
Not good. But not easy to fix. I think existing drivers are using
the hardwired bus number, so changing it may be an issue.
But it can be done: the bus should be named by something which is not
a number, or at least not a zero, and specifying 0 means "all busses".
Existing drivers use 0, I assume, so that would work. The probe
function for the driver should verify that the device is there,
if using "0" as a bus number. Anyway, I see no regression here as
currently everybody has one bus only, I suppose.
> At CERN, we use a database to feed in the information to drivers
> (D:) so this shouldn't be too big an issue.
But this database is a pain to maintain, isn't it?
> The second issue however, is more "aesthetic". If we allow the slot
> numbers of the driver to be fed in through parameters, we have to
> write boring, repetitive code that creates this bind table. The code
> in my CVORA driver, for example, looks something like the one below.
> #define VME_BUS_MAX 32
isn't this elsewhere?
> ids = kmalloc(sizeof(struct vme_device_id) * (bus_num + 1), GFP_KERNEL);
> memset(ids, 0, (sizeof(struct vme_device_id) * (bus_num + 1)));
kzalloc please.
> The driver is loaded using the bus id of the TSI148 bridge (0, since its the
> only one):
>
> $ insmod cvora.ko bus=0
Then have this as a default. But yes, it's bad to go through this in each
driver.
> to VME_SLOT_ALL. This makes it _probe_ on all the slots. Note that this is
> a probe and not a match.
So you can look for the device and tell whether it's there or not, I suppose.
> The way that Emilio fixed this is to defer the matching to the
> driver itself. So now the VME framework calls the match function of
> the driver which can then do a device specific match (which cannot
> be done anywhere else as only the driver knows how to identify its
> cards).
Unfortunately, like what happens on ISA, probing is not save. Even
reading has side effects on some devices, so you can't just touch
inside every slot. I mean: you have no other choice unless you have
more information, but usually you do, so you may specify bus+slot
(platform_device again).
So I think Emilio's approach is better but not best.
> We can also use VME_SLOT_CURRENT which takes the index of the device being
> matched (in the vme_bridge->dev[] array) and compares with the geographical
> address of the card being probed.
This should belong to the match function in the vme bus driver.
> int vme_slot_get(struct device *bus)
Note that the *_get functins are usually increasing refcounts. (and
*_put is the opposite). I suggest to choose a different name for this
function.
> This one requires the bridge to have geographical addressing capability (it
> should be able to tell what slot a card is in).
The bridge must know something in any case. Isn't the address
in VME uniquely identifying the slot?
> As can be seen in the code above, geographical addressing can be disabled
> by passing a non-zero 'geoid' parameter to the vme_tsi148 driver during
> load. If this is not supported, we cannot use VME_SLOT_CURRENT in the bind
> table.
I see.
> VME Resources
> =============
>
> The in-tree driver provides a way to request master, slave and/or
> DMA windows and it does this through something called
> resources. This is simply a way to identify and keep track of the
> different windows and DMA channels. So instead of requesting a
> specific window or channel, we request a resource with the specific
> attributes we want (eg. for slaves, A24 with MBLT).
resources in the kernel are continuous ranges you register in.
i.e., memory, I/O port (bleah!) and interrupts. You remember the
resouce array associated to platform devices...
This looks like a similar thing, is it?
> The bridge device registers a set of master, slave and DMA windows/channels
> when it's driver is install and probe is run. Below is a snippet from
> tsi148_probe().
Ouch! Does this make sense?
> /* Add slave windows to list */
> for (i = 0; i < TSI148_MAX_SLAVE; i++) {
> slave_image = kmalloc(sizeof(struct vme_slave_resource),
> GFP_KERNEL);
> ...
> slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
> VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 |
> VME_USER3 | VME_USER4;
> slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
> VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
> VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
> VME_PROG | VME_DATA;
> list_add_tail(&slave_image->list,
> &tsi148_bridge->slave_resources);
> }
Fuck! If this is an array of TSI148_MAX_SLAVE things, why isn't this
an array+len instead of a list? Doesn't make too much sense to me.
I'd expect a resource thing like memory and i/o. The request should get
to the bridge, that knows its own capabilities.
> Requesting Resources
> --------------------
>
> [...]
>
> There are similarly other functions for slaves and DMA.
>
> struct vme_resource * vme_master_request(struct device *dev,
> vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
> struct vme_resource * vme_slave_request(struct device *dev,
> vme_address_t aspace, vme_cycle_t cycle);
> struct vme_resource *vme_dma_request(struct device *dev,
> vme_dma_route_t route);
The kernel has a generic request_resource() thing, but I don't think
the set of resource is dynamic (there's mem_resource etc created at
boot time, I think). We'd benefit from a similar approach. Actually,
we have an enum that names the different resources, you quoted it.
> These functions loop through the bridge structures resource lists [...]
The thing below is hairy, I'll quote it entirely:
> They also set the "entry" pointer (to struct list_head) in the
> vme_[master|slave|dma]_resource structure to point to &allocated_image->list
> so that the vme resource structure (vme_[master|slave|dma]_resource) can be
> retrieved later from the one passed by the user (struct vme_resource). Below
> is an example of this from vme_master_set().
>
> int vme_master_set(struct vme_resource *resource, int enabled,
> unsigned long long vme_base, unsigned long long size,
> vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
> {
> struct vme_master_resource *image;
> ...
> image = list_entry(resource->entry, struct vme_master_resource, list);
> ...
> }
Uh! But "list_entry" is simply a "container_of". So why doesn't it
save directly the pointer to the wme_master_resource? It doesn't make
sense to have it like this! If I misunderstood I'll get to the code
myself.
> From the above, I think we can only register up to 8 master windows
> using this driver. If we have more than 8 master drivers requesting
> windows, vme_request_master would fail. I am not sure how people are
> using this driver but I suppose there is a layer written on top to
> support more than 8 slaves.
Really, if they are windows they should be handled like the
mem_resource or ioport_resource. And I wouldn't be sure people
use more than 8 slaves. Most users have small requirements, there's
only 1 LHS and a few other accelerators out there.
> In Emilio's driver, there is an abstraction over this to allow for
> more than 8 slave windows. Parts of one window are logically mapped
> allowing for different devices to use the same window. For example
> if one window supports A24/D32 (24 bit address space and 32 bit data
> width), all devices requiring these window attributes can map to
> different parts of this window (as long as there is enough memory
> available).
Seems saner.
> Allocating Buffers
> ------------------
>
> The driver documentation recommends using the
> vme_[alloc|free]_consistent() set of functions to allocate and
> deallocate contiguous buffers in memory. These functions simply do
> some checks and calls pci_[alloc|free]_consistent().
Does this mean that a VME bus has consistent memory directlty
and persistently mapped on PCI? It is quite a contraint, but maybe
the TSI bridge honors this -- no, I haven't yet read the whole TSI
manual, just a few pages.
> void *vme_alloc_consistent(struct vme_resource *resource, size_t size,
> dma_addr_t *dma)
> {
> ...
> pdev = container_of(bridge->parent, struct pci_dev, dev);
> ...
> return pci_alloc_consistent(pdev, size, dma);
> }
Also, this requires to bridge to be a PCI device. We'll need to lift
this requirement sooner or later -- shouldn't the function be
passed over to the bridge method? We _do_ have a bridge, this is
the extra layer advantage of this driver.
> One thing to note is that since it is calling pci_* functions, this means the
> driver is assuming a PCI-VME bridge at all times (also the struct vme_bridge
> contains a struct pci_dev as the parent device).
I should read all before beginning to write :)
> I don't suppose any other bridge apart from PCI is available or
> widely used so this is not a problem. For us, it's fine since we use
> the TSI148 everywhere.
Well, until somebody at CERN will etherbone the vme, you mean!
> The vme_user driver (which allows user-space access for VME cards), which
> is also the guide for my CVORA driver, however, doesn't use this stuff for
> masters and instead uses it only for slaves.
>
> For slaves:
>
> image[i].size_buf = PCI_BUF_SIZE;
> image[i].kern_buf = vme_alloc_consistent(image[i].resource,
> image[i].size_buf, &image[i].pci_buf);
>
> For masters:
>
> image[i].size_buf = PCI_BUF_SIZE;
> image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
I understand the former is a buffer within the VME memory space
as a DMA target and the latter is a normal buffer within the bridge
driver. Correct?
----- End forwarded message -----
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
1 : import syn
2 : syn.synth(2.9, 100, 0.0, 1000000, 0, 0.02)
3 : s = +
4 : s = _
5 : s
6 : plot s
7 : from matplotlib import pyplot
8 : pyplot.plot(s)
9 : pyplot.show()
10: _ip.magic("save ")
11: help(save)
12: _ip.magic("save ")
13: save(s, 'pure_sin.txt')
14: save(s, 'pure_sin.txt')
15: from numpy import *
16: save(s, 'pure_sin.txt')
17: save('pure_sin.txt', s)
18: _ip.magic("edit pure_sin.txt.npy")
19: help(save)
20: out = file('pure_sin.txt', 'w')
21:
for i in s:
print >>out, i
22: out.close()
23: _ip.system("view pure*")
24: _ip.system("rm pure_sin.txt.npy")
25:
def w(s, f):
out = file(f, 'w')
for i in s:
print >>out, i
out.close()
26:
27:
28:
29: s
30: t
31: syn.synth(2.9, 100, 0.0, 1000000, 0, 0.02)
32: random.randn(len(s))
33:
34:
35: r = 2.9 * 0.001 * random.randn(len(s))
36: s+r
37: sn = s+r
38: w(s, 'gaussian_1000th.txt')
39: plot s
40: w(sn, 'gaussian_1000th.txt')
41: plot s
42: plot = pyplot.plot
43: plot(s)
44: sn = s+r
45: r = 2.9 * 0.01 * random.randn(len(s))
46: sn = s+r
47: w(sn, 'gaussian_100th.txt')
48: plot(sn)
49: r = 2.9 * 0.001 * random.randn(len(s))
50: sn = s+r
51: w(sn, 'gaussian_100th.txt')
52: plot(sn)
53: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
54: sincoh = s
55: w(sincoh, 'incoherent.txt')
56: sincohn = s + 0.001 * 2.9 * random.randn(len(s))
57: w(sincohn, 'incoherent_1000gaussian.txt')
58: plot(sincohn)
59: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
60: s = s + 0.01 * syn.synth(2.9, 300, 0.0, 1000000, 0, 0.025)
61: s = s + 0.02 * syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
62: plot(s)
63: plot(s)
64: plot(s)
65: 1 / sqrt(5)
66: w(s, 'thd_44_7_times.txt')
67: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
68: s = s + 0.1 syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
69: s = s + 0.1 * syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
70: s = s + 0.08 * syn.synth(2.9, 800, 0.0, 1000000, 0, 0.025)
71: s = s + 0.005 * random.randn(len(s))
72: w(s,'thd_0.1_0.08_n_0.005.txt)
73: w(s,'thd_0.1_0.08_n_0.005.txt')
74: help
75: help()
76: #?
77: #?save
78: #?history
79: histogram
80: _ip.magic("history ")
81: _ip.magic("history -h")
82: #?history -
83: _ip.magic("history -f")
84: #?history
85: _ip.magic("history -f log 1")
86: _ip.system(" view log")
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
0
501
995
1474
1931
2359
2751
3102
3406
3659
3857
3996
4076
4095
4052
3948
3784
3564
3290
2967
2598
2191
1751
1285
799
301
-200
-699
-1188
-1659
-2105
-2519
-2895
-3228
-3512
-3744
-3919
-4035
-4090
-4084
-4016
-3888
-3702
-3460
-3165
-2823
-2439
-2018
-1566
-1091
-600
-100
401
897
1380
1842
2276
2675
3035
3349
3612
3822
3973
4065
4096
4065
3973
3822
3612
3349
3035
2675
2276
1842
1380
897
401
-100
-600
-1091
-1566
-2018
-2439
-2823
-3165
-3460
-3702
-3888
-4016
-4084
-4090
-4035
-3919
-3744
-3512
-3228
-2895
-2519
-2105
-1659
-1188
-699
-200
301
799
1285
1751
2191
2598
2967
3290
3564
3784
3948
4052
4095
4076
3996
3857
3659
3406
3102
2751
2359
1931
1474
995
501
0
-500
-994
-1473
-1930
-2358
-2750
-3101
-3405
-3658
-3856
-3995
-4075
-4094
-4051
-3947
-3783
-3563
-3289
-2966
-2597
-2190
-1750
-1284
-798
-300
201
700
1189
1660
2106
2520
2896
3229
3513
3745
3920
4036
4091
4085
4017
3889
3703
3461
3166
2824
2440
2019
1567
1092
601
101
-400
-896
-1379
-1841
-2275
-2674
-3034
-3348
-3611
-3821
-3972
-4064
-4095
-4064
-3972
-3821
-3611
-3348
-3034
-2674
-2275
-1841
-1379
-896
-400
101
601
1092
1567
2019
2440
2824
3166
3461
3703
3889
4017
4085
4091
4036
3920
3745
3513
3229
2896
2520
2106
1660
1189
700
201
-300
-798
-1284
-1750
-2190
-2597
-2966
-3289
-3563
-3783
-3947
-4051
-4094
-4075
-3995
-3856
-3658
-3405
-3101
-2750
-2358
-1930
-1473
-994
-500
pure_sin.txt Pure sinewave, A = 2.9, fa = 100, phi = 0, 1MHz, t=0.02s
gaussian_100th.txt Same with 0.01 rms gaussian noise (SNR = 2e2)
gaussian_1000th.txt Same with 0.001 rms gaussian noise (SNR = 2e3)
incoherent.txt Pure sinewave as above, incoherently sampled (t = 0.025s)
incoherent_1000gaussian.txt Same as above with 0.001 rms gaussian noise (SNR = 2e3)
thd_44_7_times.txt Same as above with 0.01 and 0.02 harmonics (SNR = 44.7)
thd_0.1_0.08_n_0.005.txt With 0.1 and 0.08 harmonics and 0.005 gaussian noise
log How these were made
0, 0x361F
1, 0x34A5
2, 0x3318
3, 0x317C
4, 0x2FC7
5, 0x2E09
6, 0x2C38
7, 0x2A5E
8, 0x287C
9, 0x268B
10, 0x2498
11, 0x229E
12, 0x20A4
13, 0x1EAC
14, 0x1CB3
15, 0x1ABE
16, 0x18D1
17, 0x16E4
18, 0x1506
19, 0x1336
20, 0x1172
21, 0x0FBD
22, 0x0E18
23, 0x0C89
24, 0x0B05
25, 0x099D
26, 0x084A
27, 0x0710
28, 0x05EC
29, 0x04E5
30, 0x03FA
31, 0x0329
32, 0x0279
33, 0x01E2
34, 0x016D
35, 0x0115
36, 0x00D9
37, 0x00BF
38, 0x00C5
39, 0x00ED
40, 0x0132
41, 0x0197
42, 0x0220
43, 0x02C5
44, 0x0387
45, 0x0469
46, 0x0565
47, 0x067D
48, 0x07AC
49, 0x08F9
50, 0x0A5F
51, 0x0BD3
52, 0x0D5E
53, 0x0F00
54, 0x10B0
55, 0x1272
56, 0x143F
57, 0x1618
58, 0x17FC
59, 0x19E9
60, 0x1BDE
61, 0x1DD6
62, 0x1FCA
63, 0x21C4
64, 0x23BF
65, 0x25B2
66, 0x279F
67, 0x298C
68, 0x2B65
69, 0x2D39
70, 0x2F00
71, 0x30B2
72, 0x3256
73, 0x33E9
74, 0x356B
75, 0x36D4
76, 0x3825
77, 0x3960
78, 0x3A83
79, 0x3B88
80, 0x3C74
81, 0x3D46
82, 0x3DF9
83, 0x3E8D
84, 0x3F03
85, 0x3F5B
86, 0x3F95
87, 0x3FB2
88, 0x3FAD
89, 0x3F87
90, 0x3F41
91, 0x3EDD
92, 0x3E55
93, 0x3DB1
94, 0x3CEB
95, 0x3C11
96, 0x3B12
97, 0x39F8
98, 0x38CA
99, 0x3780
100, 0x361E
101, 0x34A4
102, 0x331B
103, 0x317C
104, 0x2FCA
105, 0x2E09
106, 0x2C3A
107, 0x2A61
108, 0x287B
109, 0x268A
110, 0x2499
111, 0x229F
112, 0x20A8
113, 0x1EB1
114, 0x1CB5
115, 0x1AC1
116, 0x18D3
117, 0x16E7
118, 0x150C
119, 0x133A
120, 0x1174
121, 0x0FBF
122, 0x0E1C
123, 0x0C88
124, 0x0B08
125, 0x099C
126, 0x0847
127, 0x0711
128, 0x05EE
129, 0x04E9
130, 0x03FA
131, 0x032A
132, 0x027A
133, 0x01E3
134, 0x016A
135, 0x0114
136, 0x00D8
137, 0x00C2
138, 0x00C7
139, 0x00EE
140, 0x0130
141, 0x019A
142, 0x0220
143, 0x02C4
144, 0x0386
145, 0x0467
146, 0x0565
147, 0x067A
148, 0x07AC
149, 0x08F5
150, 0x0A5C
151, 0x0BD2
152, 0x0D5E
153, 0x0EFD
154, 0x10AC
155, 0x126D
156, 0x143C
157, 0x1618
158, 0x17FB
159, 0x19EB
160, 0x1BDF
161, 0x1DD5
162, 0x1FCA
163, 0x21C6
164, 0x23C4
165, 0x25B4
166, 0x27A3
167, 0x298D
168, 0x2B68
169, 0x2D3A
170, 0x2F00
171, 0x30B5
172, 0x325A
173, 0x33ED
174, 0x356B
175, 0x36D2
176, 0x3828
177, 0x3962
178, 0x3A84
179, 0x3B87
180, 0x3C78
181, 0x3D45
182, 0x3DF7
183, 0x3E8B
184, 0x3F03
185, 0x3F5C
186, 0x3F98
187, 0x3FB1
188, 0x3FAD
189, 0x3F84
190, 0x3F3F
191, 0x3EDA
192, 0x3E4F
193, 0x3DAF
194, 0x3CEC
195, 0x3C0D
196, 0x3B11
197, 0x39F7
198, 0x38C9
199, 0x3780
200, 0x361A
201, 0x34A6
202, 0x3319
203, 0x317A
204, 0x2FC7
205, 0x2E08
206, 0x2C39
207, 0x2A5E
208, 0x2878
209, 0x2686
210, 0x2496
211, 0x229D
212, 0x20A2
213, 0x1EAB
214, 0x1CB2
215, 0x1ABC
216, 0x18CE
217, 0x16E5
218, 0x1507
219, 0x1333
220, 0x1172
221, 0x0FB9
222, 0x0E11
223, 0x0C83
224, 0x0B02
225, 0x0999
226, 0x0846
227, 0x070C
228, 0x05E6
229, 0x04E2
230, 0x03F5
231, 0x0325
232, 0x0274
233, 0x01E4
234, 0x016C
235, 0x0110
236, 0x00D9
237, 0x00C0
238, 0x00C4
239, 0x00EB
240, 0x012F
241, 0x0194
242, 0x0220
243, 0x02C3
244, 0x0387
245, 0x0469
246, 0x0562
247, 0x067D
248, 0x07AE
249, 0x08F8
250, 0x0A58
251, 0x0BCF
252, 0x0D5E
253, 0x0EFE
254, 0x10AF
255, 0x1272
256, 0x143D
257, 0x1616
258, 0x17FF
259, 0x19E9
260, 0x1BDF
261, 0x1DD4
262, 0x1FCF
263, 0x21C6
264, 0x23BF
265, 0x25B5
266, 0x27A2
267, 0x298B
268, 0x2B6C
269, 0x2D3B
270, 0x2EFE
271, 0x30B7
272, 0x325B
273, 0x33EA
274, 0x356D
275, 0x36D1
276, 0x3829
277, 0x395F
278, 0x3A83
279, 0x3B8D
280, 0x3C75
281, 0x3D49
282, 0x3DFC
283, 0x3E90
284, 0x3F08
285, 0x3F5F
286, 0x3F99
287, 0x3FB4
288, 0x3FAE
289, 0x3F86
290, 0x3F40
291, 0x3EDF
292, 0x3E54
293, 0x3DB1
294, 0x3CF0
295, 0x3C0E
296, 0x3B14
297, 0x39F9
298, 0x38CE
299, 0x377E
300, 0x3620
301, 0x34A6
302, 0x3319
303, 0x317B
304, 0x2FCA
305, 0x2E09
306, 0x2C3D
307, 0x2A60
308, 0x287B
309, 0x268B
310, 0x2497
311, 0x22A0
312, 0x20A5
313, 0x1EAE
314, 0x1CB5
315, 0x1ABE
316, 0x18CE
317, 0x16E6
318, 0x150E
319, 0x133C
320, 0x1174
321, 0x0FBD
322, 0x0E19
323, 0x0C88
324, 0x0B0B
325, 0x099F
326, 0x084A
327, 0x070F
328, 0x05F2
329, 0x04E9
330, 0x03FC
331, 0x0330
332, 0x027E
333, 0x01E7
334, 0x016F
335, 0x0117
336, 0x00DD
337, 0x00C3
338, 0x00CA
339, 0x00F0
340, 0x0133
341, 0x019B
342, 0x0222
343, 0x02C8
344, 0x038C
345, 0x0473
346, 0x0568
347, 0x067E
348, 0x07B2
349, 0x08FD
350, 0x0A5E
351, 0x0BD5
352, 0x0D61
353, 0x0F01
354, 0x10B0
355, 0x1273
356, 0x1441
357, 0x161A
358, 0x1801
359, 0x19EB
360, 0x1BE1
361, 0x1DD7
362, 0x1FD5
363, 0x21CC
364, 0x23C3
365, 0x25B7
366, 0x27A8
367, 0x298B
368, 0x2B68
369, 0x2D3C
370, 0x2F01
371, 0x30B9
372, 0x325B
373, 0x33F1
374, 0x356B
375, 0x36D4
376, 0x3829
377, 0x3963
378, 0x3A87
379, 0x3B8E
380, 0x3C76
381, 0x3D46
382, 0x3DF9
383, 0x3E8E
384, 0x3F06
385, 0x3F5E
386, 0x3F97
387, 0x3FB1
388, 0x3FAE
389, 0x3F86
390, 0x3F40
391, 0x3EDB
392, 0x3E52
393, 0x3DAE
394, 0x3CF0
395, 0x3C0C
396, 0x3B10
397, 0x39F9
398, 0x38C8
399, 0x377E
400, 0x361A
401, 0x34A8
402, 0x3318
403, 0x3179
404, 0x2FC7
405, 0x2E06
406, 0x2C34
407, 0x2A5A
408, 0x2875
409, 0x268A
410, 0x2495
411, 0x229E
412, 0x20A4
413, 0x1EA7
414, 0x1CB1
415, 0x1ABA
416, 0x18CA
417, 0x16E7
418, 0x1509
419, 0x1336
420, 0x1173
421, 0x0FB9
422, 0x0E18
423, 0x0C84
424, 0x0B02
425, 0x0999
426, 0x0845
427, 0x070C
428, 0x05EC
429, 0x04E7
430, 0x03FD
431, 0x032C
432, 0x0277
433, 0x01E2
434, 0x016A
435, 0x0115
436, 0x00D9
437, 0x00C2
438, 0x00C5
439, 0x00EE
440, 0x0132
441, 0x019A
442, 0x0221
443, 0x02C6
444, 0x0389
445, 0x046B
446, 0x0564
447, 0x0679
448, 0x07AD
449, 0x08F6
450, 0x0A5A
451, 0x0BCE
452, 0x0D5F
453, 0x0EFD
454, 0x10AD
455, 0x126D
456, 0x1442
457, 0x1618
458, 0x17FC
459, 0x19E9
460, 0x1BDA
461, 0x1DD2
462, 0x1FCC
463, 0x21C6
464, 0x23BE
465, 0x25B1
466, 0x27A1
467, 0x298A
468, 0x2B68
469, 0x2D38
470, 0x2EFE
471, 0x30B4
472, 0x3258
473, 0x33EA
474, 0x3569
475, 0x36D1
476, 0x3827
477, 0x395F
478, 0x3A81
479, 0x3B82
480, 0x3C6F
481, 0x3D45
482, 0x3DF5
483, 0x3E8E
484, 0x3F02
485, 0x3F5B
486, 0x3F96
487, 0x3FB0
488, 0x3FAB
489, 0x3F83
490, 0x3F3D
491, 0x3EDA
492, 0x3E54
493, 0x3DAE
494, 0x3CEB
495, 0x3C0A
496, 0x3B12
497, 0x39FA
498, 0x38C6
499, 0x377D
500, 0x361A
501, 0x34A2
502, 0x3318
503, 0x3178
504, 0x2FC6
505, 0x2E05
506, 0x2C35
507, 0x2A5A
508, 0x2876
509, 0x268B
510, 0x2496
511, 0x229D
512, 0x20A3
513, 0x1EAC
514, 0x1CAF
515, 0x1ABC
516, 0x18D1
517, 0x16E7
518, 0x150A
519, 0x1338
520, 0x1176
521, 0x0FBA
522, 0x0E19
523, 0x0C84
524, 0x0B02
525, 0x099D
526, 0x084A
527, 0x070F
528, 0x05F0
529, 0x04E7
530, 0x03FA
531, 0x0329
532, 0x0279
533, 0x01E6
534, 0x016B
535, 0x0115
536, 0x00DB
537, 0x00C3
538, 0x00CA
539, 0x00ED
540, 0x0132
541, 0x0198
542, 0x021F
543, 0x02C7
544, 0x038A
545, 0x046B
546, 0x0564
547, 0x067D
548, 0x07B0
549, 0x08F9
550, 0x0A5B
551, 0x0BD3
552, 0x0D5F
553, 0x0F00
554, 0x10AE
555, 0x126F
556, 0x143C
557, 0x1617
558, 0x17FB
559, 0x19E9
560, 0x1BDF
561, 0x1DD6
562, 0x1FD1
563, 0x21C7
564, 0x23C1
565, 0x25B8
566, 0x27A6
567, 0x298E
568, 0x2B67
569, 0x2D3B
570, 0x2F01
571, 0x30B4
572, 0x325B
573, 0x33EC
574, 0x356E
575, 0x36D3
576, 0x3828
577, 0x3963
578, 0x3A88
579, 0x3B8B
580, 0x3C77
581, 0x3D45
582, 0x3DFA
583, 0x3E8C
584, 0x3F0A
585, 0x3F5E
586, 0x3F96
587, 0x3FB0
588, 0x3FAD
589, 0x3F83
590, 0x3F43
591, 0x3EDB
592, 0x3E54
593, 0x3DAF
594, 0x3CED
595, 0x3C09
596, 0x3B13
597, 0x39F7
598, 0x38C7
599, 0x377F
600, 0x361C
601, 0x34A6
602, 0x3318
603, 0x317C
604, 0x2FC6
605, 0x2E09
606, 0x2C35
607, 0x2A5C
608, 0x2877
609, 0x268B
610, 0x2497
611, 0x229F
612, 0x20A3
613, 0x1EAB
614, 0x1CB3
615, 0x1ABB
616, 0x18CD
617, 0x16E5
618, 0x1509
619, 0x1338
620, 0x1175
621, 0x0FBD
622, 0x0E18
623, 0x0C85
624, 0x0B05
625, 0x0999
626, 0x0847
627, 0x070D
628, 0x05EF
629, 0x04E9
630, 0x03FB
631, 0x0327
632, 0x0277
633, 0x01E6
634, 0x016A
635, 0x0116
636, 0x00DA
637, 0x00C2
638, 0x00C7
639, 0x00EE
640, 0x0133
641, 0x019D
642, 0x0220
643, 0x02C8
644, 0x0386
645, 0x046A
646, 0x0567
647, 0x0680
648, 0x07AF
649, 0x08FE
650, 0x0A5C
651, 0x0BD3
652, 0x0D5F
653, 0x0F00
654, 0x10AE
655, 0x1271
656, 0x1445
657, 0x161C
658, 0x17FE
659, 0x19EA
660, 0x1BDE
661, 0x1DD6
662, 0x1FCF
663, 0x21CF
664, 0x23C4
665, 0x25BA
666, 0x27A7
667, 0x298D
668, 0x2B6A
669, 0x2D3B
670, 0x2EFF
671, 0x30B8
672, 0x325F
673, 0x33F3
674, 0x356E
675, 0x36D2
676, 0x3829
677, 0x3962
678, 0x3A85
679, 0x3B8D
680, 0x3C76
681, 0x3D49
682, 0x3DF9
683, 0x3E8F
684, 0x3F04
685, 0x3F5E
686, 0x3F97
687, 0x3FB0
688, 0x3FAE
689, 0x3F85
690, 0x3F42
691, 0x3EDB
692, 0x3E53
693, 0x3DB0
694, 0x3CEC
695, 0x3C0C
696, 0x3B13
697, 0x39F6
698, 0x38C7
699, 0x377D
700, 0x361C
701, 0x34A5
702, 0x3316
703, 0x3179
704, 0x2FC7
705, 0x2E05
706, 0x2C35
707, 0x2A5C
708, 0x287A
709, 0x2683
710, 0x2494
711, 0x229C
712, 0x20A5
713, 0x1EA8
714, 0x1CB0
715, 0x1ABD
716, 0x18CA
717, 0x16E4
718, 0x150A
719, 0x1331
720, 0x1171
721, 0x0FBB
722, 0x0E16
723, 0x0C84
724, 0x0B05
725, 0x099A
726, 0x084B
727, 0x070D
728, 0x05EE
729, 0x04E5
730, 0x03FA
731, 0x0329
732, 0x0278
733, 0x01E3
734, 0x0167
735, 0x0114
736, 0x00DA
737, 0x00C1
738, 0x00C8
739, 0x00EB
740, 0x0135
741, 0x019A
742, 0x0221
743, 0x02C3
744, 0x0387
745, 0x0467
746, 0x0567
747, 0x067C
748, 0x07AE
749, 0x08FA
750, 0x0A5F
751, 0x0BD5
752, 0x0D5D
753, 0x0EFE
754, 0x10AE
755, 0x1271
756, 0x1440
757, 0x1617
758, 0x17FE
759, 0x19EB
760, 0x1BE1
761, 0x1DD6
762, 0x1FD2
763, 0x21CA
764, 0x23C3
765, 0x25B5
766, 0x27A2
767, 0x298B
768, 0x2B68
769, 0x2D38
770, 0x2EFD
771, 0x30B8
772, 0x3258
773, 0x33ED
774, 0x356A
775, 0x36D3
776, 0x382A
777, 0x3961
778, 0x3A83
779, 0x3B87
780, 0x3C77
781, 0x3D44
782, 0x3DF9
783, 0x3E8C
784, 0x3F04
785, 0x3F5D
786, 0x3F95
787, 0x3FAF
788, 0x3FAD
789, 0x3F83
790, 0x3F3F
791, 0x3EDA
792, 0x3E52
793, 0x3DB0
794, 0x3CEB
795, 0x3C0A
796, 0x3B0C
797, 0x39F4
798, 0x38C4
799, 0x377B
800, 0x3618
801, 0x349E
802, 0x3315
803, 0x3175
804, 0x2FC2
805, 0x2E01
806, 0x2C35
807, 0x2A5D
808, 0x2877
809, 0x2686
810, 0x2492
811, 0x229D
812, 0x209D
813, 0x1EA7
814, 0x1CAD
815, 0x1AB7
816, 0x18C9
817, 0x16E2
818, 0x1504
819, 0x1333
820, 0x116E
821, 0x0FB4
822, 0x0E15
823, 0x0C80
824, 0x0B02
825, 0x0997
826, 0x0846
827, 0x070A
828, 0x05EA
829, 0x04E1
830, 0x03F6
831, 0x0327
832, 0x0277
833, 0x01DF
834, 0x0165
835, 0x0111
836, 0x00D8
837, 0x00BD
838, 0x00C6
839, 0x00ED
840, 0x012F
841, 0x0198
842, 0x021D
843, 0x02C4
844, 0x0385
845, 0x0469
846, 0x0565
847, 0x067B
848, 0x07B1
849, 0x08F7
850, 0x0A5B
851, 0x0BCE
852, 0x0D5C
853, 0x0EFF
854, 0x10AD
855, 0x126F
856, 0x143F
857, 0x1619
858, 0x1800
859, 0x19EA
860, 0x1BE0
861, 0x1DD7
862, 0x1FD0
863, 0x21CB
864, 0x23C3
865, 0x25B9
866, 0x27A6
867, 0x298C
868, 0x2B6A
869, 0x2D3A
870, 0x2EFE
871, 0x30B4
872, 0x325C
873, 0x33EF
874, 0x356C
875, 0x36D2
876, 0x3829
877, 0x395F
878, 0x3A82
879, 0x3B88
880, 0x3C74
881, 0x3D44
882, 0x3DFA
883, 0x3E90
884, 0x3F00
885, 0x3F5C
886, 0x3F96
887, 0x3FAE
888, 0x3FA9
889, 0x3F81
890, 0x3F3F
891, 0x3EDA
892, 0x3E54
893, 0x3DAF
894, 0x3CE9
895, 0x3C07
896, 0x3B0C
897, 0x39F5
898, 0x38C6
899, 0x3778
900, 0x3619
901, 0x34A0
902, 0x3315
903, 0x3176
904, 0x2FC2
905, 0x2E07
906, 0x2C35
907, 0x2A59
908, 0x2875
909, 0x2682
910, 0x2490
911, 0x229E
912, 0x209E
913, 0x1EA9
914, 0x1CAE
915, 0x1ABB
916, 0x18CB
917, 0x16E0
918, 0x1506
919, 0x1335
920, 0x1172
921, 0x0FB7
922, 0x0E18
923, 0x0C80
924, 0x0B04
925, 0x099A
926, 0x0847
927, 0x070B
928, 0x05ED
929, 0x04E6
930, 0x03FD
931, 0x032C
932, 0x0279
933, 0x01E4
934, 0x016A
935, 0x0113
936, 0x00DF
937, 0x00C1
938, 0x00C8
939, 0x00F0
940, 0x0137
941, 0x019C
942, 0x0223
943, 0x02C8
944, 0x038D
945, 0x046E
946, 0x0566
947, 0x0680
948, 0x07B3
949, 0x08FC
950, 0x0A5F
951, 0x0BD5
952, 0x0D63
953, 0x0F01
954, 0x10B3
955, 0x1272
956, 0x1440
957, 0x161B
958, 0x1804
959, 0x19EC
960, 0x1BE1
961, 0x1DD9
962, 0x1FD2
963, 0x21CA
964, 0x23C5
965, 0x25BB
966, 0x27A8
967, 0x2991
968, 0x2B6C
969, 0x2D3B
970, 0x2F00
971, 0x30B5
972, 0x325E
973, 0x33ED
974, 0x356F
975, 0x36D5
976, 0x3829
977, 0x3963
978, 0x3A81
979, 0x3B8B
980, 0x3C77
981, 0x3D45
982, 0x3DFA
983, 0x3E92
984, 0x3F06
985, 0x3F5D
986, 0x3F97
987, 0x3FAD
988, 0x3FAC
989, 0x3F83
990, 0x3F3E
991, 0x3ED8
992, 0x3E51
993, 0x3DAF
994, 0x3CE8
995, 0x3C07
996, 0x3B0D
997, 0x39F7
998, 0x38C7
999, 0x377C
1000, 0x361A
1001, 0x34A0
1002, 0x3317
1003, 0x3177
1004, 0x2FC7
1005, 0x2E01
1006, 0x2C35
1007, 0x2A59
1008, 0x2874
1009, 0x2684
1010, 0x2493
1011, 0x2299
1012, 0x209E
1013, 0x1EA7
1014, 0x1CAE
1015, 0x1ABB
1016, 0x18CA
1017, 0x16E3
1018, 0x1505
1019, 0x1334
1020, 0x1173
1021, 0x0FBA
1022, 0x0E17
1023, 0x0C83
1024, 0x0B06
1025, 0x099B
1026, 0x0847
1027, 0x070A
1028, 0x05E9
1029, 0x04E3
1030, 0x03FC
1031, 0x032D
1032, 0x0279
1033, 0x01E6
1034, 0x016D
1035, 0x0114
1036, 0x00DA
1037, 0x00C2
1038, 0x00CA
1039, 0x00EF
1040, 0x0134
1041, 0x0198
1042, 0x0221
1043, 0x02C6
1044, 0x0389
1045, 0x046E
1046, 0x0569
1047, 0x0681
1048, 0x07B3
1049, 0x08FD
1050, 0x0A5C
1051, 0x0BD5
1052, 0x0D61
1053, 0x0F01
1054, 0x10B3
1055, 0x1273
1056, 0x1442
1057, 0x161A
1058, 0x1805
1059, 0x19ED
1060, 0x1BDF
1061, 0x1DD9
1062, 0x1FD1
1063, 0x21CE
1064, 0x23C4
1065, 0x25B7
1066, 0x27A7
1067, 0x298E
1068, 0x2B6E
1069, 0x2D3D
1070, 0x2F01
1071, 0x30BA
1072, 0x325D
1073, 0x33F0
1074, 0x356E
1075, 0x36D6
1076, 0x3829
1077, 0x3964
1078, 0x3A85
1079, 0x3B8C
1080, 0x3C76
1081, 0x3D46
1082, 0x3DF9
1083, 0x3E8E
1084, 0x3F05
1085, 0x3F60
1086, 0x3F99
1087, 0x3FB2
1088, 0x3FAD
1089, 0x3F83
1090, 0x3F3F
1091, 0x3EDA
1092, 0x3E55
1093, 0x3DAF
1094, 0x3CED
1095, 0x3C0D
1096, 0x3B11
1097, 0x39FB
1098, 0x38CA
1099, 0x377E
1100, 0x361C
1101, 0x34A2
1102, 0x3319
1103, 0x3176
1104, 0x2FC6
1105, 0x2E06
1106, 0x2C39
1107, 0x2A5D
1108, 0x287A
1109, 0x2689
1110, 0x2496
1111, 0x22A1
1112, 0x20A6
1113, 0x1EA9
1114, 0x1CAF
1115, 0x1ABC
1116, 0x18CC
1117, 0x16E9
1118, 0x150B
1119, 0x1336
1120, 0x1172
1121, 0x0FBC
1122, 0x0E19
1123, 0x0C84
1124, 0x0B06
1125, 0x099F
1126, 0x084D
1127, 0x070F
1128, 0x05F0
1129, 0x04E9
1130, 0x03FC
1131, 0x032D
1132, 0x027E
1133, 0x01E6
1134, 0x0170
1135, 0x0119
1136, 0x00DC
1137, 0x00C7
1138, 0x00C9
1139, 0x00F3
1140, 0x0138
1141, 0x019F
1142, 0x0226
1143, 0x02CA
1144, 0x038D
1145, 0x0470
1146, 0x056A
1147, 0x0681
1148, 0x07B5
1149, 0x08FE
1150, 0x0A63
1151, 0x0BD9
1152, 0x0D66
1153, 0x0F05
1154, 0x10B7
1155, 0x1277
1156, 0x1445
1157, 0x161D
1158, 0x1801
1159, 0x19EF
1160, 0x1BE5
1161, 0x1DD9
1162, 0x1FD2
1163, 0x21D0
1164, 0x23C7
1165, 0x25BA
1166, 0x27A9
1167, 0x2992
1168, 0x2B69
1169, 0x2D3E
1170, 0x2F04
1171, 0x30BB
1172, 0x325E
1173, 0x33F0
1174, 0x3571
1175, 0x36D5
1176, 0x3828
1177, 0x3965
1178, 0x3A85
1179, 0x3B90
1180, 0x3C77
1181, 0x3D48
1182, 0x3DFA
1183, 0x3E90
1184, 0x3F06
1185, 0x3F5F
1186, 0x3F9B
1187, 0x3FB3
1188, 0x3FB0
1189, 0x3F82
1190, 0x3F40
1191, 0x3EDA
1192, 0x3E55
1193, 0x3DAF
1194, 0x3CEE
1195, 0x3C0C
1196, 0x3B11
1197, 0x39F8
1198, 0x38C8
1199, 0x377A
1200, 0x361A
1201, 0x34A2
1202, 0x3314
1203, 0x3176
1204, 0x2FC3
1205, 0x2E03
1206, 0x2C36
1207, 0x2A5F
1208, 0x2875
1209, 0x2688
1210, 0x2492
1211, 0x229B
1212, 0x20A0
1213, 0x1EA7
1214, 0x1CB0
1215, 0x1AB7
1216, 0x18CA
1217, 0x16E2
1218, 0x1506
1219, 0x1334
1220, 0x1170
1221, 0x0FBA
1222, 0x0E15
1223, 0x0C82
1224, 0x0B02
1225, 0x0999
1226, 0x0848
1227, 0x070C
1228, 0x05ED
1229, 0x04E3
1230, 0x03FB
1231, 0x0326
1232, 0x0275
1233, 0x01E1
1234, 0x0167
1235, 0x0112
1236, 0x00D9
1237, 0x00C0
1238, 0x00C5
1239, 0x00EB
1240, 0x0132
1241, 0x0198
1242, 0x0220
1243, 0x02C5
1244, 0x0387
1245, 0x0469
1246, 0x0567
1247, 0x067E
1248, 0x07AF
1249, 0x08FA
1250, 0x0A5E
1251, 0x0BD4
1252, 0x0D61
1253, 0x0F03
1254, 0x10B2
1255, 0x1274
1256, 0x1442
1257, 0x1618
1258, 0x17FC
1259, 0x19EF
1260, 0x1BDF
1261, 0x1DD3
1262, 0x1FD0
1263, 0x21CD
1264, 0x23C3
1265, 0x25B8
1266, 0x27A6
1267, 0x298D
1268, 0x2B69
1269, 0x2D3D
1270, 0x2F00
1271, 0x30B5
1272, 0x3259
1273, 0x33F1
1274, 0x356F
1275, 0x36D8
1276, 0x382B
1277, 0x3962
1278, 0x3A84
1279, 0x3B8B
1280, 0x3C78
1281, 0x3D4B
1282, 0x3DF7
1283, 0x3E8F
1284, 0x3F07
1285, 0x3F5E
1286, 0x3F99
1287, 0x3FB6
1288, 0x3FA9
1289, 0x3F87
1290, 0x3F41
1291, 0x3EDC
1292, 0x3E52
1293, 0x3DAF
1294, 0x3CEB
1295, 0x3C0A
1296, 0x3B0E
1297, 0x39F6
1298, 0x38C3
1299, 0x377E
1300, 0x361C
1301, 0x34A2
1302, 0x3319
1303, 0x3179
1304, 0x2FC6
1305, 0x2E05
1306, 0x2C37
1307, 0x2A5A
1308, 0x2874
1309, 0x2684
1310, 0x2492
1311, 0x229C
1312, 0x20A4
1313, 0x1EA6
1314, 0x1CAF
1315, 0x1ABD
1316, 0x18CE
1317, 0x16E5
1318, 0x1507
1319, 0x1333
1320, 0x116E
1321, 0x0FBA
1322, 0x0E16
1323, 0x0C81
1324, 0x0B06
1325, 0x0999
1326, 0x0846
1327, 0x070C
1328, 0x05EA
1329, 0x04E7
1330, 0x03F6
1331, 0x032A
1332, 0x0273
1333, 0x01E4
1334, 0x016D
1335, 0x0112
1336, 0x00DA
1337, 0x00BF
1338, 0x00CB
1339, 0x00EF
1340, 0x0133
1341, 0x019B
1342, 0x0220
1343, 0x02C5
1344, 0x038B
1345, 0x046C
1346, 0x0567
1347, 0x067F
1348, 0x07AF
1349, 0x08FB
1350, 0x0A5A
1351, 0x0BD5
1352, 0x0D64
1353, 0x0F00
1354, 0x10B3
1355, 0x1274
1356, 0x1443
1357, 0x161C
1358, 0x1801
1359, 0x19F1
1360, 0x1BE2
1361, 0x1DD8
1362, 0x1FD2
1363, 0x21CD
1364, 0x23C5
1365, 0x25BC
1366, 0x27A7
1367, 0x298F
1368, 0x2B6D
1369, 0x2D3F
1370, 0x2F03
1371, 0x30B9
1372, 0x325E
1373, 0x33F0
1374, 0x3570
1375, 0x36D4
1376, 0x3828
1377, 0x3963
1378, 0x3A87
1379, 0x3B87
1380, 0x3C77
1381, 0x3D45
1382, 0x3DF9
1383, 0x3E91
1384, 0x3F08
1385, 0x3F5F
1386, 0x3F98
1387, 0x3FAE
1388, 0x3FAE
1389, 0x3F82
1390, 0x3F41
1391, 0x3EDB
1392, 0x3E53
1393, 0x3DAF
1394, 0x3CE9
1395, 0x3C09
1396, 0x3B0F
1397, 0x39F7
1398, 0x38C6
1399, 0x377C
1400, 0x3615
1401, 0x349F
1402, 0x3314
1403, 0x3175
1404, 0x2FC4
1405, 0x2E01
1406, 0x2C33
1407, 0x2A5A
1408, 0x2875
1409, 0x2684
1410, 0x2491
1411, 0x229C
1412, 0x20A1
1413, 0x1EA7
1414, 0x1CAC
1415, 0x1ABB
1416, 0x18C9
1417, 0x16E3
1418, 0x1505
1419, 0x1335
1420, 0x116E
1421, 0x0FB6
1422, 0x0E12
1423, 0x0C82
1424, 0x0B02
1425, 0x0999
1426, 0x0845
1427, 0x0709
1428, 0x05EB
1429, 0x04E5
1430, 0x03F8
1431, 0x0328
1432, 0x0277
1433, 0x01E0
1434, 0x0169
1435, 0x0114
1436, 0x00D8
1437, 0x00BE
1438, 0x00C5
1439, 0x00EA
1440, 0x0135
1441, 0x0199
1442, 0x0220
1443, 0x02C2
1444, 0x0388
1445, 0x046D
1446, 0x0567
1447, 0x0681
1448, 0x07B0
1449, 0x08FB
1450, 0x0A5A
1451, 0x0BD4
1452, 0x0D5D
1453, 0x0F00
1454, 0x10B2
1455, 0x1274
1456, 0x1443
1457, 0x161B
1458, 0x1802
1459, 0x19EC
1460, 0x1BE1
1461, 0x1DD6
1462, 0x1FD0
1463, 0x21CB
1464, 0x23C3
1465, 0x25B7
1466, 0x27A6
1467, 0x298D
1468, 0x2B6F
1469, 0x2D3E
1470, 0x2F03
1471, 0x30B8
1472, 0x325A
1473, 0x33EB
1474, 0x356C
1475, 0x36D6
1476, 0x3827
1477, 0x3964
1478, 0x3A86
1479, 0x3B8A
1480, 0x3C79
1481, 0x3D47
1482, 0x3DFC
1483, 0x3E91
1484, 0x3F05
1485, 0x3F5F
1486, 0x3F95
1487, 0x3FAC
1488, 0x3FA9
1489, 0x3F85
1490, 0x3F3F
1491, 0x3ED8
1492, 0x3E50
1493, 0x3DB0
1494, 0x3CEB
1495, 0x3C08
1496, 0x3B0E
1497, 0x39F7
1498, 0x38C5
1499, 0x377B
1500, 0x361A
1501, 0x349D
1502, 0x3314
1503, 0x3176
1504, 0x2FC7
1505, 0x2E00
1506, 0x2C33
1507, 0x2A59
1508, 0x2875
1509, 0x2688
1510, 0x2492
1511, 0x229E
1512, 0x209F
1513, 0x1EAB
1514, 0x1CAD
1515, 0x1AB8
1516, 0x18CB
1517, 0x16E0
1518, 0x1507
1519, 0x1332
1520, 0x1170
1521, 0x0FBA
1522, 0x0E15
1523, 0x0C80
1524, 0x0B04
1525, 0x099C
1526, 0x0848
1527, 0x070B
1528, 0x05EA
1529, 0x04E5
1530, 0x03FC
1531, 0x0329
1532, 0x0278
1533, 0x01E4
1534, 0x016C
1535, 0x0111
1536, 0x00DC
1537, 0x00C5
1538, 0x00CC
1539, 0x00F1
1540, 0x0136
1541, 0x019C
1542, 0x0222
1543, 0x02C8
1544, 0x038B
1545, 0x046E
1546, 0x0566
1547, 0x0682
1548, 0x07B3
1549, 0x08FB
1550, 0x0A60
1551, 0x0BD6
1552, 0x0D61
1553, 0x0F06
1554, 0x10B8
1555, 0x1273
1556, 0x1446
1557, 0x161F
1558, 0x1802
1559, 0x19F2
1560, 0x1BE1
1561, 0x1DDC
1562, 0x1FD4
1563, 0x21CE
1564, 0x23C4
1565, 0x25BE
1566, 0x27A9
1567, 0x2993
1568, 0x2B70
1569, 0x2D40
1570, 0x2F03
1571, 0x30BB
1572, 0x3265
1573, 0x33F0
1574, 0x3571
1575, 0x36D9
1576, 0x382A
1577, 0x3969
1578, 0x3A87
1579, 0x3B8E
1580, 0x3C7A
1581, 0x3D47
1582, 0x3DFB
1583, 0x3E8E
1584, 0x3F05
1585, 0x3F5E
1586, 0x3F9B
1587, 0x3FB5
1588, 0x3FB1
1589, 0x3F88
1590, 0x3F42
1591, 0x3EE1
1592, 0x3E57
1593, 0x3DB3
1594, 0x3CEF
1595, 0x3C0C
1596, 0x3B0C
1597, 0x39FA
1598, 0x38C8
1599, 0x377C
1600, 0x361E
1601, 0x34A6
1602, 0x3316
1603, 0x3176
1604, 0x2FC9
1605, 0x2E06
1606, 0x2C33
1607, 0x2A5C
1608, 0x2873
1609, 0x2685
1610, 0x2495
1611, 0x229E
1612, 0x20A4
1613, 0x1EA9
1614, 0x1CAE
1615, 0x1ABA
1616, 0x18CC
1617, 0x16E5
1618, 0x150B
1619, 0x1332
1620, 0x1172
1621, 0x0FB7
1622, 0x0E17
1623, 0x0C84
1624, 0x0B08
1625, 0x099B
1626, 0x0849
1627, 0x070D
1628, 0x05ED
1629, 0x04E6
1630, 0x03FB
1631, 0x032B
1632, 0x0279
1633, 0x01E3
1634, 0x016C
1635, 0x0115
1636, 0x00DB
1637, 0x00C0
1638, 0x00C7
1639, 0x00EE
1640, 0x0133
1641, 0x019B
1642, 0x0222
1643, 0x02C9
1644, 0x038B
1645, 0x046E
1646, 0x0566
1647, 0x0682
1648, 0x07B2
1649, 0x08FC
1650, 0x0A5B
1651, 0x0BD4
1652, 0x0D66
1653, 0x0F03
1654, 0x10B4
1655, 0x1274
1656, 0x1444
1657, 0x161F
1658, 0x1802
1659, 0x19EB
1660, 0x1BE4
1661, 0x1DD7
1662, 0x1FD2
1663, 0x21CD
1664, 0x23C3
1665, 0x25BB
1666, 0x27A7
1667, 0x298F
1668, 0x2B6B
1669, 0x2D3E
1670, 0x2F03
1671, 0x30B7
1672, 0x325D
1673, 0x33F2
1674, 0x3571
1675, 0x36D8
1676, 0x3829
1677, 0x3965
1678, 0x3A89
1679, 0x3B8D
1680, 0x3C76
1681, 0x3D47
1682, 0x3DFD
1683, 0x3E8F
1684, 0x3F07
1685, 0x3F60
1686, 0x3F97
1687, 0x3FB2
1688, 0x3FAD
1689, 0x3F87
1690, 0x3F41
1691, 0x3ED8
1692, 0x3E54
1693, 0x3DB1
1694, 0x3CF0
1695, 0x3C0C
1696, 0x3B10
1697, 0x39F8
1698, 0x38C4
1699, 0x377C
1700, 0x3619
1701, 0x34A2
1702, 0x3314
1703, 0x3175
1704, 0x2FC2
1705, 0x2E04
1706, 0x2C34
1707, 0x2A58
1708, 0x2876
1709, 0x2689
1710, 0x2491
1711, 0x229A
1712, 0x209E
1713, 0x1EA5
1714, 0x1CAD
1715, 0x1AB9
1716, 0x18C8
1717, 0x16E1
1718, 0x1503
1719, 0x1332
1720, 0x116F
1721, 0x0FB6
1722, 0x0E10
1723, 0x0C85
1724, 0x0B02
1725, 0x0999
1726, 0x0842
1727, 0x070A
1728, 0x05E8
1729, 0x04E3
1730, 0x03F3
1731, 0x032A
1732, 0x0274
1733, 0x01E0
1734, 0x0169
1735, 0x0112
1736, 0x00DB
1737, 0x00BC
1738, 0x00C4
1739, 0x00EB
1740, 0x0134
1741, 0x0198
1742, 0x021F
1743, 0x02C5
1744, 0x0388
1745, 0x0468
1746, 0x0568
1747, 0x067D
1748, 0x07B0
1749, 0x08FC
1750, 0x0A5F
1751, 0x0BD4
1752, 0x0D5F
1753, 0x0F00
1754, 0x10B0
1755, 0x1273
1756, 0x1441
1757, 0x161C
1758, 0x17FD
1759, 0x19EF
1760, 0x1BE2
1761, 0x1DD9
1762, 0x1FD2
1763, 0x21CE
1764, 0x23C3
1765, 0x25B7
1766, 0x27A9
1767, 0x2992
1768, 0x2B6F
1769, 0x2D41
1770, 0x2F02
1771, 0x30B7
1772, 0x325B
1773, 0x33F3
1774, 0x356F
1775, 0x36D4
1776, 0x3829
1777, 0x3965
1778, 0x3A86
1779, 0x3B8E
1780, 0x3C76
1781, 0x3D49
1782, 0x3DFC
1783, 0x3E90
1784, 0x3F07
1785, 0x3F5C
1786, 0x3F99
1787, 0x3FB1
1788, 0x3FA8
1789, 0x3F86
1790, 0x3F44
1791, 0x3EDC
1792, 0x3E51
1793, 0x3DAE
1794, 0x3CEE
1795, 0x3C0D
1796, 0x3B0F
1797, 0x39F6
1798, 0x38C4
1799, 0x377A
1800, 0x3619
1801, 0x34A3
1802, 0x3316
1803, 0x3176
1804, 0x2FC3
1805, 0x2E00
1806, 0x2C36
1807, 0x2A5C
1808, 0x2876
1809, 0x2684
1810, 0x2494
1811, 0x229C
1812, 0x209B
1813, 0x1EA5
1814, 0x1CAD
1815, 0x1AB7
1816, 0x18CA
1817, 0x16E2
1818, 0x1508
1819, 0x1334
1820, 0x116F
1821, 0x0FBB
1822, 0x0E13
1823, 0x0C7D
1824, 0x0B01
1825, 0x0997
1826, 0x0845
1827, 0x0708
1828, 0x05EA
1829, 0x04E4
1830, 0x03F6
1831, 0x0329
1832, 0x0278
1833, 0x01DF
1834, 0x016B
1835, 0x0112
1836, 0x00DC
1837, 0x00C0
1838, 0x00C6
1839, 0x00ED
1840, 0x0135
1841, 0x019E
1842, 0x0224
1843, 0x02C6
1844, 0x038A
1845, 0x046A
1846, 0x0568
1847, 0x0683
1848, 0x07B0
1849, 0x08FD
1850, 0x0A5F
1851, 0x0BD4
1852, 0x0D62
1853, 0x0EFF
1854, 0x10B6
1855, 0x1276
1856, 0x1444
1857, 0x161D
1858, 0x1801
1859, 0x19EF
1860, 0x1BE1
1861, 0x1DDD
1862, 0x1FD3
1863, 0x21CC
1864, 0x23C4
1865, 0x25B5
1866, 0x27A7
1867, 0x2990
1868, 0x2B6C
1869, 0x2D3E
1870, 0x2F01
1871, 0x30BB
1872, 0x325F
1873, 0x33F1
1874, 0x3570
1875, 0x36D7
1876, 0x3828
1877, 0x3963
1878, 0x3A85
1879, 0x3B8D
1880, 0x3C76
1881, 0x3D49
1882, 0x3DF8
1883, 0x3E8B
1884, 0x3F02
1885, 0x3F5A
1886, 0x3F98
1887, 0x3FB2
1888, 0x3FAB
1889, 0x3F85
1890,
\ No newline at end of file
[SIGNAL]
nbits = 14
rate = 100000000
data = 9151
9650
10143
10636
11109
11577
12032
12466
12886
13289
13675
14036
14373
14688
14979
15240
15476
15686
15865
16013
16131
16219
16277
16306
16301
16263
16193
16093
15957
15793
15595
15377
15122
14840
14538
14208
13854
13476
13083
12668
12234
11785
11322
10849
10363
9866
9369
8863
8360
7857
7349
6849
6355
5863
5388
4922
4468
4031
3612
3208
2824
2460
2119
1809
1518
1257
1018
810
634
483
362
276
216
194
199
238
304
410
544
708
902
1127
1381
1658
1964
2293
2652
3026
3422
3837
4268
4717
5180
5656
6139
6635
7135
7637
8138
8646
9156
9652
10147
10637
11112
11578
12032
12469
12890
13293
13675
14034
14376
14690
14980
15239
15480
15685
15863
16011
16131
16220
16280
16305
16301
16260
16191
16090
15951
15791
15596
15373
15121
14839
14537
14208
13850
13478
13081
12666
12231
11784
11321
10846
10360
9862
9366
8861
8354
7851
7346
6844
6350
5861
5383
4915
4466
4025
3601
3203
2818
2457
2118
1804
1510
1250
1013
805
628
484
364
272
217
192
196
235
303
404
544
707
903
1129
1378
1661
1966
2296
2648
3023
3422
3838
4271
4722
5181
5654
6143
6633
7135
7636
8143
8646
9151
9653
10146
10635
11116
11579
12030
12471
12891
13290
13677
14033
14377
14687
14979
15245
15477
15689
15868
16016
16136
16223
16281
16308
16302
16262
16192
16095
15956
15793
15600
15374
15124
14841
14542
14206
13856
13478
13081
12667
12234
11785
11325
10848
10363
9867
9367
8864
8357
7854
7349
6846
6350
5862
5390
4924
4468
4029
3609
3208
2827
2463
2122
1807
1522
1257
1020
816
638
487
367
279
221
195
202
240
307
411
546
712
908
1139
1384
1662
1970
2301
2654
3029
3425
3841
4272
4723
5185
5658
6145
6635
7137
7639
8149
8652
9155
9655
10152
10635
11112
11580
12033
12473
12891
13297
13675
14036
14377
14691
14983
15246
15478
15686
15865
16014
16134
16222
16279
16305
16302
16262
16192
16091
15954
15790
15600
15372
15120
14841
14536
14206
13850
13480
13080
12665
12231
11782
11316
10842
10357
9866
9365
8862
8356
7847
7345
6842
6346
5863
5385
4918
4467
4025
3608
3204
2818
2457
2117
1804
1516
1255
1021
812
631
482
362
277
217
194
197
238
306
410
545
710
905
1131
1380
1657
1965
2294
2650
3022
3423
3837
4269
4717
5186
5656
6140
6633
7130
7634
8140
8646
9150
9649
10145
10634
11112
11576
12030
12468
12888
13290
13673
14033
14375
14687
14977
15234
15471
15685
15861
16014
16130
16219
16278
16304
16299
16259
16189
16090
15956
15790
15595
15370
15122
14842
14534
14205
13850
13474
13080
12664
12230
11781
11317
10842
10358
9867
9366
8861
8355
7852
7343
6844
6353
5863
5386
4920
4470
4026
3609
3204
2818
2461
2122
1807
1520
1255
1018
809
633
486
363
277
219
195
202
237
306
408
543
711
906
1131
1380
1661
1968
2297
2651
3027
3423
3840
4270
4719
5180
5655
6139
6633
7135
7638
8145
8647
9153
9656
10150
10638
11111
11579
12033
12468
12891
13292
13678
14035
14376
14691
14984
15243
15479
15685
15866
16012
16138
16222
16278
16304
16301
16259
16195
16091
15956
15791
15597
15369
15123
14839
14535
14207
13852
13478
13080
12668
12230
11785
11317
10844
10359
9867
9367
8863
8355
7851
7347
6843
6349
5861
5385
4920
4469
4029
3608
3205
2821
2457
2119
1805
1519
1257
1019
807
631
486
362
278
218
194
199
238
307
413
544
712
902
1130
1383
1664
1967
2302
2652
3027
3423
3840
4270
4721
5189
5660
6142
6634
7134
7638
8143
8655
9156
9658
10151
10637
11114
11579
12031
12472
12895
13299
13678
14034
14377
14690
14981
15245
15478
15689
15865
16015
16132
16222
16279
16304
16302
16261
16194
16091
15955
15792
15596
15372
15123
14838
14535
14205
13852
13477
13078
12665
12231
11781
11317
10844
10362
9859
9364
8860
8357
7848
7344
6845
6346
5860
5386
4913
4465
4027
3606
3204
2821
2458
2123
1805
1518
1253
1018
809
632
483
359
276
218
193
200
235
309
410
545
707
903
1127
1383
1660
1966
2298
2655
3029
3421
3838
4270
4721
5184
5655
6142
6635
7137
7638
8146
8650
9155
9653
10146
10635
11112
11576
12029
12472
12888
13293
13674
14035
14378
14689
14979
15239
15479
15684
15865
16012
16132
16221
16277
16303
16301
16259
16191
16090
15954
15792
15595
15370
15116
14836
14532
14203
13848
13470
13077
12661
12226
11777
11317
10845
10359
9862
9362
8861
8349
7847
7341
6839
6345
5858
5380
4915
4462
4020
3605
3200
2818
2455
2118
1802
1514
1249
1014
807
631
479
357
273
216
189
198
237
303
408
541
708
901
1129
1381
1659
1969
2295
2651
3022
3420
3839
4269
4719
5183
5657
6144
6634
7136
7639
8144
8651
9155
9657
10150
10636
11114
11578
12030
12468
12892
13295
13676
14034
14377
14687
14978
15240
15476
15684
15866
16016
16128
16220
16278
16302
16297
16257
16191
16090
15956
15791
15593
15367
15116
14837
14534
14200
13849
13472
13077
12662
12226
11783
11317
10841
10357
9858
9360
8862
8350
7849
7342
6843
6347
5856
5382
4917
4466
4023
3608
3200
2820
2458
2119
1803
1517
1254
1021
812
633
484
362
275
223
193
200
240
311
412
547
712
909
1134
1382
1664
1971
2300
2655
3029
3427
3841
4275
4722
5184
5659
6148
6636
7137
7641
8146
8650
9157
9659
10152
10641
11116
11579
12032
12469
12894
13293
13679
14037
14377
14691
14977
15243
15479
15685
15866
16018
16134
16221
16279
16301
16300
16259
16190
16088
15953
15791
15592
15367
15117
14839
14535
14204
13850
13472
13079
12663
12231
11777
11317
10841
10356
9860
9363
8857
8350
7847
7342
6843
6346
5859
5381
4916
4467
4026
3607
3203
2822
2459
2119
1802
1513
1251
1020
813
633
486
365
276
218
194
202
239
308
408
545
710
905
1134
1385
1665
1971
2301
2652
3029
3425
3841
4275
4723
5186
5658
6149
6637
7135
7641
8145
8654
9156
9655
10151
10638
11118
11581
12033
12474
12893
13296
13678
14038
14377
14692
14981
15244
15478
15686
15865
16014
16133
16224
16281
16306
16301
16259
16191
16090
15957
15791
15597
15373
15121
14843
14538
14206
13852
13474
13081
12662
12230
11782
11321
10845
10362
9865
9366
8865
8358
7849
7343
6844
6348
5865
5387
4918
4466
4028
3609
3204
2822
2463
2125
1807
1520
1257
1020
813
638
486
368
281
220
199
201
243
312
415
550
714
909
1136
1386
1665
1973
2302
2659
3033
3430
3845
4279
4727
5189
5661
6145
6639
7141
7641
8146
8656
9159
9658
10153
10642
11113
11582
12036
12475
12894
13296
13681
14037
14376
14693
14981
15248
15479
15688
15866
16016
16134
16223
16283
16307
16304
16258
16192
16090
15957
15791
15598
15372
15121
14840
14536
14202
13850
13474
13076
12662
12227
11779
11318
10847
10357
9864
9362
8859
8352
7847
7344
6839
6346
5858
5382
4916
4464
4026
3605
3202
2818
2457
2120
1804
1517
1251
1019
806
629
481
359
274
217
192
197
235
306
408
544
709
903
1129
1383
1662
1967
2298
2654
3028
3425
3843
4274
4724
5186
5656
6140
6639
7135
7635
8144
8653
9155
9656
10150
10637
11113
11581
12032
12469
12889
13297
13679
14040
14379
14690
14980
15243
15480
15691
15863
16015
16135
16222
16281
16310
16297
16263
16193
16092
15954
15791
15595
15370
15118
14838
14531
14206
13852
13474
13081
12665
12230
11781
11319
10842
10356
9860
9362
8860
8356
7846
7343
6845
6350
5861
5383
4915
4462
4026
3606
3201
2822
2457
2118
1804
1514
1255
1014
810
627
484
365
274
218
191
203
239
307
411
544
709
907
1132
1383
1663
1967
2299
2650
3029
3428
3840
4275
4724
5187
5660
6145
6641
7138
7640
8146
8653
9157
9660
10151
10639
11117
11583
12035
12473
12894
13296
13680
14036
14376
14691
14983
15239
15479
15685
15865
16017
16136
16223
16280
16302
16302
16258
16193
16091
15955
15791
15593
15369
15119
14839
14534
14204
13845
13471
13076
12661
12228
11777
11315
10842
10357
9860
9361
8860
8353
7847
7340
6843
6345
5859
5381
4917
4462
4022
3602
3202
2818
2457
2117
1801
1515
1253
1016
808
631
480
361
276
216
190
197
234
309
409
544
706
904
1133
1383
1665
1968
2299
2650
3028
3421
3840
4274
4724
5187
5659
6146
6636
7137
7638
8144
8651
9155
9655
10150
10637
11119
11582
12035
12472
12890
13291
13676
14038
14375
14692
14982
15242
15481
15687
15868
16017
16133
16223
16277
16300
16297
16261
16191
16088
15952
15792
15595
15368
15118
14839
14533
14203
13850
13469
13076
12662
12231
11776
11315
10841
10357
9864
9362
8862
8351
7851
7341
6840
6347
5856
5383
4914
4464
4026
3605
3200
2820
2460
2120
1803
1514
1253
1020
809
632
484
364
273
220
197
204
241
310
412
546
712
907
1134
1382
1666
1971
2299
2656
3030
3425
3846
4280
4723
5190
5663
6146
6642
7137
7644
8148
8654
9156
9662
10153
10643
11120
11584
12035
12475
12901
13296
13681
14041
14378
14697
14983
15246
15482
15687
15867
16014
16133
16222
16283
16309
16305
16264
16194
16097
15959
15795
15599
15372
15116
14842
14536
14204
13854
13478
13078
12662
12233
11782
11315
10844
10355
9861
9365
8862
8356
7849
7342
6842
6348
5861
5387
4914
4466
4023
3607
3204
2824
2459
2121
1805
1517
1254
1019
811
633
483
364
277
219
192
199
238
307
411
546
713
907
1134
1382
1666
1970
2300
2651
3028
3430
3843
4276
4724
5188
5663
6146
6635
7140
7639
8146
8653
9155
9659
10151
10639
11115
11582
12035
12471
12893
13298
13681
14040
14377
14693
14985
15245
15478
15687
15869
16015
16135
16224
16279
16306
16301
16263
16193
16088
15956
15793
15600
15372
15120
14840
14532
14204
13849
13474
13076
12661
12226
11780
11316
10840
10358
9865
9361
8858
8350
7845
7341
6841
6344
5857
5379
4914
4463
4022
3600
3205
2818
2457
2114
1802
1512
1251
1011
810
628
480
361
274
219
188
196
235
308
408
543
709
904
1128
1384
1661
1968
2300
2655
3028
3423
3840
4272
4723
5185
5660
6141
6639
7138
7641
8146
8654
9155
9655
10153
10642
11119
11585
12034
12471
12891
13299
13679
14036
14377
14693
14982
15246
15478
15689
15868
16016
16135
16220
16281
16305
16296
16262
16196
16092
15953
15790
15598
15373
15119
14838
14532
14202
13849
13475
13078
12662
12227
11776
11318
10844
10358
9860
9364
8860
8347
7845
7341
6839
6346
5858
5384
4916
4463
4027
3603
3197
2817
2455
2117
1800
1514
1252
1014
809
632
479
363
274
220
192
198
237
309
414
548
710
906
1130
1384
1667
1968
2301
2655
3028
3426
3839
4278
4726
5188
5661
6145
6639
7137
7645
8147
8652
9156
9653
10151
10640
11116
11582
12033
12475
12895
13297
13680
14039
14376
14691
14981
15245
15478
15689
15864
16011
16130
16218
16280
16306
16299
16261
Delivered-To: david.cobas@gmail.com
Received: by 10.68.64.233 with SMTP id r9cs42520pbs;
Fri, 24 Jun 2011 01:50:19 -0700 (PDT)
Received: by 10.204.138.136 with SMTP id a8mr1804484bku.106.1308905417812;
Fri, 24 Jun 2011 01:50:17 -0700 (PDT)
Return-Path: <manohar.vanga@cern.ch>
Received: from CERNMX31.cern.ch (cernmx31.cern.ch [137.138.144.179])
by mx.google.com with ESMTPS id q26si3339694faa.192.2011.06.24.01.50.17
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 24 Jun 2011 01:50:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of manohar.vanga@cern.ch designates 137.138.144.179 as permitted sender) client-ip=137.138.144.179;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of manohar.vanga@cern.ch designates 137.138.144.179 as permitted sender) smtp.mail=manohar.vanga@cern.ch
Received: from CERNFE21.cern.ch (137.138.144.150) by cernmxgwlb2.cern.ch
(137.138.144.179) with Microsoft SMTP Server (TLS) id 14.1.270.1; Fri, 24 Jun
2011 10:50:16 +0200
Received: from becoht-mvanga (137.138.192.18) by smtp.cern.ch
(137.138.144.172) with Microsoft SMTP Server (TLS) id 14.1.270.2; Fri, 24 Jun
2011 10:50:10 +0200
Date: Fri, 24 Jun 2011 10:47:47 +0200
From: Manohar Vanga <manohar.vanga@cern.ch>
To: <ht-drivers@cern.ch>
Subject: [ru@gnudd.com: Re: vme_intree_driver.txt]
Message-ID: <20110624084747.GA14398@becoht-mvanga>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
Return-Path: manohar.vanga@cern.ch
X-Originating-IP: [137.138.192.18]
List-ID: <ht-drivers.cern.ch>
Precedence: list
X-Auto-Response-Suppress: DR, OOF, AutoReply
Keywords: CERN SpamKiller Note: -50
Hi all,
I have been writing up a document describing the differences between the in-tree
driver and Emilio's (which we currently use). Below is the inlined document
followed by Alessandro's reply.
The document is still incomplete but this is where it is at so far. I am not
an expert at this and have many gaping holes in my knowledge and experience so
please _don't_ go easy on me with the criticism. I learn best that way :-)
----- BEGIN DOCUMENT -----
I have been studying the in-tree VME driver by Martyn Welsh and below are
the notes from my tests with it.
Note on Structure
-----------------
Just to mention beforehand, Emilio's driver (the one used at CERN currently
has one lesser level of indirection within most of the code when compared
with the in-tree driver. In this regard, the in-tree driver is better written
when compared with ours which was written for a specific purpose. For example,
here is an exerpt from the CERN driver (vme_dma.c):
static int vme_dma_setup(struct dma_channel *channel, int to_user)
{
...
rc = tsi148_dma_setup(channel);
...
return rc;
}
And below is an example from the in-tree one:
int vme_dma_list_exec(struct vme_dma_list *list)
{
struct vme_bridge *bridge;
...
retval = bridge->dma_list_exec(list);
...
return retval;
}
This has an extra level of indirection through the vme_bridge structure which
makes it more generic.
Bridge Registration
===================
The TSI148 bridge driver is available as part of the in-tree driver. It
registers into the bridge framework of the VME driver. It does this using:
static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
...
struct vme_bridge *tsi148_bridge;
/* ... allocate and fill up the structure ... */
vme_register_bridge(tsi148_bridge);
...
}
vme_register_bridge assigns the bridge a bus number and registers VME_SLOTS_MAX
devices from within the bridge structure.
struct vme_bridge {
...
int num;
...
struct device dev[VME_SLOTS_MAX];
...
};
The bus number is assigned based on a bitvector that can hold 32 bits
(unsigned int). This means we can have upto 32 bridges registered.
One other thing to note is that the vme_bridge->dev[] structure contains devices
all pointing to the bridge itself from what I can see. This means when probe and
remove are called, the received dev in the parameters is the bridge and not the
device being probed or removed. Below is code from vme_register_bridge().
for (i = 0; i < VME_SLOTS_MAX; i++) {
dev = &bridge->dev[i];
memset(dev, 0, sizeof(struct device));
dev->parent = bridge->parent;
dev->bus = &vme_bus_type;
/*
* We save a pointer to the bridge in platform_data so that we
* can get to it later. We keep driver_data for use by the
* driver that binds against the slot
*/
dev->platform_data = bridge;
dev_set_name(dev, "vme-%x.%x", bridge->num, i + 1);
retval = device_register(dev);
if (retval)
goto err_reg;
}
The parent of the device is being set to the parent of the bridge. I wasn't sure
about whether this was correct but from the the probe function of the vme_user
device, it is more clear.
static struct device *vme_user_bridge; /* Pointer to bridge device */
static int __devinit vme_user_probe(struct device *dev, int cur_bus,
int cur_slot)
{
...
/* Save pointer to the bridge device */
vme_user_bridge = dev;
...
Emilio also seems to have found this. Below is the snippet from his LKML reply
at https://lkml.org/lkml/2010/10/22/43
> * .probe and .remove pass a pointer to a struct device representing a VME
> bridge, instead of representing the device to be added/removed.
> * a bridge's module may be removed anytime and things do fall over;
> there is no refcounting at all and thus all drivers attached to
> the removed bus will oops.
Driver Registration
===================
VME drivers can register themselves using vme_register_driver. I wrote a driver
for the CVORA VME card to test things out and below is a snippet from its init
function.
static int cvora_init(void)
{
...
retval = vme_register_driver(&cvora_driver);
...
}
The cvora_driver above is of the type 'struct vme_driver'. In the very least,
we need to fill the 'name', 'probe' and 'release' fields. We also need to fill the
'bind_table' field (see below).
struct cvora_driver {
.name = "cvora",
.probe = cvora_probe,
.remove = __devexit_p(cvora_remove),
};
Bind Table
----------
The in-tree driver seems to have taken its structure from the way PCI works and
requires each driver to provide a list of buses and slots within these buses
where it expects its card to be.
The problem is that if multiple bridges are ever present in the same
crate, the numbering of the buses/bridges depends on the load-order of the
bridge drivers. Not pretty. I don't think we have such a crate around (with
multiple bridges) so we can simply assume the bus number to be 0. If however,
we have such a configuration, we would have to ensure that the load-order of
the bridge drivers is always the same.
At CERN, we use a database to feed in the information to drivers (D:) so this
shouldn't be too big an issue.
The second issue however, is more "aesthetic". If we allow the slot numbers of
the driver to be fed in through parameters, we have to write boring, repetitive
code that creates this bind table. The code in my CVORA driver, for example,
looks something like the one below.
#define VME_BUS_MAX 32
static int bus[VME_BUS_MAX];
static int bus_num;
MODULE_PARM_DESC(bus, "Enumeration of VMEbus to which the driver is connected");
module_param_array(bus, int, &bus_num, 0);
static int cvora_init(void)
{
int i;
struct vme_device_id *ids;
/* Dynamically create the bind table based on module parameters */
ids = kmalloc(sizeof(struct vme_device_id) * (bus_num + 1), GFP_KERNEL);
if (ids == NULL) {
retval = -ENOMEM;
goto err_id;
}
memset(ids, 0, (sizeof(struct vme_device_id) * (bus_num + 1)));
for (i = 0; i < bus_num; i++) {
ids[i].bus = bus[i];
ids[i].slot = VME_SLOT_ALL;
}
cvora_driver.bind_table = ids;
/* registration and error checking */
...
}
The driver is loaded using the bus id of the TSI148 bridge (0, since its the
only one):
$ insmod cvora.ko bus=0
Note that above, I have simply set the slot number in the bind table array
to VME_SLOT_ALL. This makes it _probe_ on all the slots. Note that this is
a probe and not a match. If we say a device will be in a specific slot, it is
fixed and no other device may be put in there (well, the wrong driver will get
probed based on the order of insmod). To avoid this, the slot numbers must
either be made unique for each driver (eg. if A has slots 1, 2 and 3, card B
should not have any of those). The other solution is to make these slot numbers
be per-driver rather than global.
The way that Emilio fixed this is to defer the matching to the driver itself.
So now the VME framework calls the match function of the driver which can then
do a device specific match (which cannot be done anywhere else as only the
driver knows how to identify its cards). This way, we don't need to provide any
bus/slot ids and we don't have ugly code for generating this table in each and
every VME driver. The driver simply gives the number of devices it wants to
match and these devices are created and the match is called for each one. The
device-specific matching is done in the driver and finally the non-matching
ones are removed.
Emilio's discussion of this issue on LKML: https://lkml.org/lkml/2010/10/22/43
We can also use VME_SLOT_CURRENT which takes the index of the device being
matched (in the vme_bridge->dev[] array) and compares with the geographical
address of the card being probed.
static int vme_bus_match(struct device *dev, struct device_driver *drv)
{
....
while ((driver->bind_table[i].bus != 0) ||
(driver->bind_table[i].slot != 0)) {
...
if ((driver->bind_table[i].slot == VME_SLOT_CURRENT) &&
(num == vme_slot_get(dev)))
return 1;
...
}
return 0;
}
The vme_slot_dev() function just calls the slot_get field of the bridge
structure.
int vme_slot_get(struct device *bus)
{
struct vme_bridge *bridge;
bridge = dev_to_bridge(bus);
...
return bridge->slot_get(bridge);
}
This one requires the bridge to have geographical addressing capability (it
should be able to tell what slot a card is in). I don't know if this is
crate-specific or not but the bridge (TSI148) does support it. Below is the
code from 'bridges/vme_tsi148.c'.
/*
* Determine Geographical Addressing
*/
static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
{
u32 slot = 0;
struct tsi148_driver *bridge;
bridge = tsi148_bridge->driver_priv;
if (!geoid) {
slot = ioread32be(bridge->base + TSI148_LCSR_VSTAT);
slot = slot & TSI148_LCSR_VSTAT_GA_M;
} else
slot = geoid;
return (int)slot;
}
As can be seen in the code above, geographical addressing can be disabled
by passing a non-zero 'geoid' parameter to the vme_tsi148 driver during
load. If this is not supported, we cannot use VME_SLOT_CURRENT in the bind
table.
VME Resources
=============
The in-tree driver provides a way to request master, slave and/or DMA windows
and it does this through something called resources. This is simply a way to
identify and keep track of the different windows and DMA channels. So instead
of requesting a specific window or channel, we request a resource with the
specific attributes we want (eg. for slaves, A24 with MBLT).
This is managed by the vme_resource structure. It is a simple structure that
specifies the type of resource.
/* Resource Type */
enum vme_resource_type {
VME_MASTER,
VME_SLAVE,
VME_DMA,
VME_LM
};
...
struct vme_resource {
enum vme_resource_type type;
struct list_head *entry;
};
NOTE: VME_LM in vme_resource_type is referring to the Location Monitor.
The bridge device registers a set of master, slave and DMA windows/channels
when it's driver is install and probe is run. Below is a snippet from
tsi148_probe().
/* Add slave windows to list */
for (i = 0; i < TSI148_MAX_SLAVE; i++) {
slave_image = kmalloc(sizeof(struct vme_slave_resource),
GFP_KERNEL);
...
slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 |
VME_USER3 | VME_USER4;
slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
VME_PROG | VME_DATA;
list_add_tail(&slave_image->list,
&tsi148_bridge->slave_resources);
}
Here the bridge is registering TSI148_MAX_SLAVE slave windows with the specific
attributes. The attributes are simply a set of bits being set in the specific
slave image. These are stored in the slave_resources list within the bridge
structure.
A similar procedure is done for masters and DMA channels in tsi148_probe().
Also it is useful to note that for the TSI148, the following are defined in
the header:
#define TSI148_MAX_MASTER 8 /* Max Master Windows */
#define TSI148_MAX_SLAVE 8 /* Max Slave Windows */
#define TSI148_MAX_DMA 2 /* Max DMA Controllers */
From what I can make out:
Master resources: Those for drivers running on the master. Pretty much any
driver we use.
Slave resources : These are for drivers running on "intelligent slaves" that have
the kernel running on them.
DMA resources : For any DMA transfers.
This document mostly concerns itself with master resources as these are what we
will be using for everything (we have no intelligent slaves running Linux at the
moment).
Requesting Resources
--------------------
As mentioned earlier, we can request resources based on a set of attributes. In
the case of the CVORA card, it has a 24 bit address space (A24). I requested a
master resource (the driver is running on a VME master, the main CPU) in the probe
function like so:
card->resource = vme_master_request(card->bridge, VME_A24, VME_SCT, VME_D32);
In the above, VME_SCT refers to Single Cycle Transfer (or something like that...).
The VME_D32 refers to a data width of 32 bits. This was taken from the CVORA manual
available as a PDF at:
http://isscvs.cern.ch/cgi-bin/cvsweb.cgi/cvora/doc/CVORA%20user%20Manual.pdf?cvsroot=abcofpga
There are similarly other functions for slaves and DMA.
struct vme_resource * vme_master_request(struct device *dev,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
struct vme_resource * vme_slave_request(struct device *dev,
vme_address_t aspace, vme_cycle_t cycle);
struct vme_resource *vme_dma_request(struct device *dev,
vme_dma_route_t route);
These functions loop through the bridge structures resource lists as registered
above and simply search for a free one with that requested bits set. Here is a
snippet from vme_slave_request():
/* Loop through slave resources */
list_for_each(slave_pos, &bridge->slave_resources) {
slave_image = list_entry(slave_pos,
struct vme_slave_resource, list);
...
/* Find an unlocked and compatible image */
if (((slave_image->address_attr & address) == address) &&
((slave_image->cycle_attr & cycle) == cycle) &&
(slave_image->locked == 0)) {
...
slave_image->locked = 1;
allocated_image = slave_image;
break;
}
}
They also set the "entry" pointer (to struct list_head) in the
vme_[master|slave|dma]_resource structure to point to &allocated_image->list
so that the vme resource structure (vme_[master|slave|dma]_resource) can be
retrieved later from the one passed by the user (struct vme_resource). Below
is an example of this from vme_master_set().
int vme_master_set(struct vme_resource *resource, int enabled,
unsigned long long vme_base, unsigned long long size,
vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
{
struct vme_master_resource *image;
...
image = list_entry(resource->entry, struct vme_master_resource, list);
...
}
Similar stuff happens in vme_[master|dma]_request(). Consequently, there are
also a set of vme_*_free() functions:
void vme_master_free(struct vme_resource *res);
void vme_slave_free(struct vme_resource *res);
void vme_dma_free(struct vme_resource *res);
From the above, I think we can only register up to 8 master windows using this
driver. If we have more than 8 master drivers requesting windows, vme_request_master
would fail. I am not sure how people are using this driver but I suppose there is
a layer written on top to support more than 8 slaves.
In Emilio's driver, there is an abstraction over this to allow for more than 8
slave windows. Parts of one window are logically mapped allowing for different
devices to use the same window. For example if one window supports A24/D32 (24
bit address space and 32 bit data width), all devices requiring these window
attributes can map to different parts of this window (as long as there is
enough memory available).
Allocating Buffers
------------------
The driver documentation recommends using the vme_[alloc|free]_consistent() set
of functions to allocate and deallocate contiguous buffers in memory. These
functions simply do some checks and calls pci_[alloc|free]_consistent().
void *vme_alloc_consistent(struct vme_resource *resource, size_t size,
dma_addr_t *dma)
{
...
pdev = container_of(bridge->parent, struct pci_dev, dev);
...
return pci_alloc_consistent(pdev, size, dma);
}
void vme_free_consistent(struct vme_resource *resource, size_t size,
void *vaddr, dma_addr_t dma)
{
...
pdev = container_of(bridge->parent, struct pci_dev, dev);
...
pci_free_consistent(pdev, size, vaddr, dma);
}
One thing to note is that since it is calling pci_* functions, this means the
driver is assuming a PCI-VME bridge at all times (also the struct vme_bridge
contains a struct pci_dev as the parent device). I don't suppose
any other bridge apart from PCI is available or widely used so this is not a
problem. For us, it's fine since we use the TSI148 everywhere.
The vme_user driver (which allows user-space access for VME cards), which
is also the guide for my CVORA driver, however, doesn't use this stuff for
masters and instead uses it only for slaves.
For slaves:
image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = vme_alloc_consistent(image[i].resource,
image[i].size_buf, &image[i].pci_buf);
For masters:
image[i].size_buf = PCI_BUF_SIZE;
image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
For the CVORA driver (master driver), I used kmalloc in my code:
card->size_buf = PCI_BUF_SIZE;
card->kern_buf = kmalloc(card->size_buf, GFP_KERNEL);
if (card->kern_buf == NULL) {
printk(KERN_ERR PFX "kmalloc for buffer failed\n");
goto vme_alloc_fail;
}
Configuring the Master
----------------------
After requesting the required resources, we need to configure the channel
correctly by providing the base address, size of mapping etc.
In the case of masters and slaves, this is done using the
vme_[master|slave]_set() set of functions.
int vme_master_set(struct vme_resource *, int, unsigned long long,
unsigned long long, vme_address_t, vme_cycle_t, vme_width_t);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
The first parameter is the resource we requested earlier. The second parameter
is whether to enable the master/slave or not (non-zero is to enable, zero to
disable). The third and fourth parameters are the base address and size of
mapping respectively. The last three parameters are the same as the ones passed
in the vme_*_request function. In the CVORA card, I do the following:
card->base = bases[ndev]; /* array of bases passed as parameter to module */
card->size = 0x8000; /* Taken from CVORA manual */
...
vme_master_set(card->resource, 1, card->base, card->size,
VME_A24, VME_SCT, VME_D32);
I then load the driver using:
insmod cvora.ko bus=0 bases=0x3000000
Here, 0x3000000 is the default base address for the new card which I stuck into
the crate.
----- END DOCUMENT -----
----- Forwarded message from Alessandro Rubini <ru@gnudd.com> -----
Date: Thu, 23 Jun 2011 13:09:13 +0200
From: Alessandro Rubini <ru@gnudd.com>
To: manohar.vanga@cern.ch
Subject: Re: vme_intree_driver.txt
[btw: why doesn't this go to ht-drivers?]
> Just to mention beforehand, Emilio's driver (the one used at CERN
> currently has one lesser level of indirection within most of the
> code when compared with the in-tree driver. In this regard, the
> in-tree driver is better written when compared with ours which was
> written for a specific purpose.
One level less means more preformance -- is it useful? -- but
as your said it means it's tsi148-specific.
> retval = bridge->dma_list_exec(list);
That's definitely better. You need structures of methods everywhere
except where perofmance is critical.
> This has an extra level of indirection through the vme_bridge structure which
> makes it more generic.
Exactly.
> The bus number is assigned based on a bitvector that can hold 32 bits
> (unsigned int). This means we can have upto 32 bridges registered.
This is suboptimal but I don't think people will ever exveed 32 buses.
If (when) it's possible to exceed it, a better mechanism should be used.
> One other thing to note is that the vme_bridge->dev[] structure
> contains devices all pointing to the bridge itself from what I can
> see. This means when probe and remove are called, the received dev
> in the parameters is the bridge and not the device being probed or
> removed.
This is bad. Can't is be a bus like other buses, with a list of
devices and drivers and a match function? Then, each device should
host a pointer to the hosting bus, which has a bridge field. Probe
and remove should receive the device itself, not the parent bus
controller.
> Below is code from vme_register_bridge().
> [...]
> retval = device_register(dev);
Why does it register a device (0..slot-max) with no real device
being detected?
> Emilio also seems to have found this.
>> * .probe and .remove pass a pointer to a struct device representing a VME
>> bridge, instead of representing the device to be added/removed.
>> * a bridge's module may be removed anytime and things do fall over;
>> there is no refcounting at all and thus all drivers attached to
>> the removed bus will oops.
Exactly.
> Driver Registration
> ===================
>
> [...]
> The in-tree driver seems to have taken its structure from the way
> PCI works and requires each driver to provide a list of buses and
> slots within these buses where it expects its card to be.
Doesn't look like PCI. I mean, if you have no autodetection you must
say where your hardware is known to be. More like a platform device
than PCI/USB.
> The problem is that if multiple bridges are ever present in the same
> crate, the numbering of the buses/bridges depends on the load-order
> of the bridge drivers. Not pretty.
No, not pretty. It's like the eth0/eth1 problem (which has been solved
in the wrong way, in my opinion: I must remove the udev rules for that
or I have serious problems when switching boards).
Naming and numbering should depend on hardware address, not on load
order. Like ether device should be named according to the pci slot
(and once I've done this trivial change for a client).
> I don't think we have such a crate around (with multiple bridges) so
> we can simply assume the bus number to be 0. If however, we have
> such a configuration, we would have to ensure that the load-order of
> the bridge drivers is always the same.
Not good. But not easy to fix. I think existing drivers are using
the hardwired bus number, so changing it may be an issue.
But it can be done: the bus should be named by something which is not
a number, or at least not a zero, and specifying 0 means "all busses".
Existing drivers use 0, I assume, so that would work. The probe
function for the driver should verify that the device is there,
if using "0" as a bus number. Anyway, I see no regression here as
currently everybody has one bus only, I suppose.
> At CERN, we use a database to feed in the information to drivers
> (D:) so this shouldn't be too big an issue.
But this database is a pain to maintain, isn't it?
> The second issue however, is more "aesthetic". If we allow the slot
> numbers of the driver to be fed in through parameters, we have to
> write boring, repetitive code that creates this bind table. The code
> in my CVORA driver, for example, looks something like the one below.
> #define VME_BUS_MAX 32
isn't this elsewhere?
> ids = kmalloc(sizeof(struct vme_device_id) * (bus_num + 1), GFP_KERNEL);
> memset(ids, 0, (sizeof(struct vme_device_id) * (bus_num + 1)));
kzalloc please.
> The driver is loaded using the bus id of the TSI148 bridge (0, since its the
> only one):
>
> $ insmod cvora.ko bus=0
Then have this as a default. But yes, it's bad to go through this in each
driver.
> to VME_SLOT_ALL. This makes it _probe_ on all the slots. Note that this is
> a probe and not a match.
So you can look for the device and tell whether it's there or not, I suppose.
> The way that Emilio fixed this is to defer the matching to the
> driver itself. So now the VME framework calls the match function of
> the driver which can then do a device specific match (which cannot
> be done anywhere else as only the driver knows how to identify its
> cards).
Unfortunately, like what happens on ISA, probing is not save. Even
reading has side effects on some devices, so you can't just touch
inside every slot. I mean: you have no other choice unless you have
more information, but usually you do, so you may specify bus+slot
(platform_device again).
So I think Emilio's approach is better but not best.
> We can also use VME_SLOT_CURRENT which takes the index of the device being
> matched (in the vme_bridge->dev[] array) and compares with the geographical
> address of the card being probed.
This should belong to the match function in the vme bus driver.
> int vme_slot_get(struct device *bus)
Note that the *_get functins are usually increasing refcounts. (and
*_put is the opposite). I suggest to choose a different name for this
function.
> This one requires the bridge to have geographical addressing capability (it
> should be able to tell what slot a card is in).
The bridge must know something in any case. Isn't the address
in VME uniquely identifying the slot?
> As can be seen in the code above, geographical addressing can be disabled
> by passing a non-zero 'geoid' parameter to the vme_tsi148 driver during
> load. If this is not supported, we cannot use VME_SLOT_CURRENT in the bind
> table.
I see.
> VME Resources
> =============
>
> The in-tree driver provides a way to request master, slave and/or
> DMA windows and it does this through something called
> resources. This is simply a way to identify and keep track of the
> different windows and DMA channels. So instead of requesting a
> specific window or channel, we request a resource with the specific
> attributes we want (eg. for slaves, A24 with MBLT).
resources in the kernel are continuous ranges you register in.
i.e., memory, I/O port (bleah!) and interrupts. You remember the
resouce array associated to platform devices...
This looks like a similar thing, is it?
> The bridge device registers a set of master, slave and DMA windows/channels
> when it's driver is install and probe is run. Below is a snippet from
> tsi148_probe().
Ouch! Does this make sense?
> /* Add slave windows to list */
> for (i = 0; i < TSI148_MAX_SLAVE; i++) {
> slave_image = kmalloc(sizeof(struct vme_slave_resource),
> GFP_KERNEL);
> ...
> slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
> VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 |
> VME_USER3 | VME_USER4;
> slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
> VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
> VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
> VME_PROG | VME_DATA;
> list_add_tail(&slave_image->list,
> &tsi148_bridge->slave_resources);
> }
Fuck! If this is an array of TSI148_MAX_SLAVE things, why isn't this
an array+len instead of a list? Doesn't make too much sense to me.
I'd expect a resource thing like memory and i/o. The request should get
to the bridge, that knows its own capabilities.
> Requesting Resources
> --------------------
>
> [...]
>
> There are similarly other functions for slaves and DMA.
>
> struct vme_resource * vme_master_request(struct device *dev,
> vme_address_t aspace, vme_cycle_t cycle, vme_width_t width);
> struct vme_resource * vme_slave_request(struct device *dev,
> vme_address_t aspace, vme_cycle_t cycle);
> struct vme_resource *vme_dma_request(struct device *dev,
> vme_dma_route_t route);
The kernel has a generic request_resource() thing, but I don't think
the set of resource is dynamic (there's mem_resource etc created at
boot time, I think). We'd benefit from a similar approach. Actually,
we have an enum that names the different resources, you quoted it.
> These functions loop through the bridge structures resource lists [...]
The thing below is hairy, I'll quote it entirely:
> They also set the "entry" pointer (to struct list_head) in the
> vme_[master|slave|dma]_resource structure to point to &allocated_image->list
> so that the vme resource structure (vme_[master|slave|dma]_resource) can be
> retrieved later from the one passed by the user (struct vme_resource). Below
> is an example of this from vme_master_set().
>
> int vme_master_set(struct vme_resource *resource, int enabled,
> unsigned long long vme_base, unsigned long long size,
> vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth)
> {
> struct vme_master_resource *image;
> ...
> image = list_entry(resource->entry, struct vme_master_resource, list);
> ...
> }
Uh! But "list_entry" is simply a "container_of". So why doesn't it
save directly the pointer to the wme_master_resource? It doesn't make
sense to have it like this! If I misunderstood I'll get to the code
myself.
> From the above, I think we can only register up to 8 master windows
> using this driver. If we have more than 8 master drivers requesting
> windows, vme_request_master would fail. I am not sure how people are
> using this driver but I suppose there is a layer written on top to
> support more than 8 slaves.
Really, if they are windows they should be handled like the
mem_resource or ioport_resource. And I wouldn't be sure people
use more than 8 slaves. Most users have small requirements, there's
only 1 LHS and a few other accelerators out there.
> In Emilio's driver, there is an abstraction over this to allow for
> more than 8 slave windows. Parts of one window are logically mapped
> allowing for different devices to use the same window. For example
> if one window supports A24/D32 (24 bit address space and 32 bit data
> width), all devices requiring these window attributes can map to
> different parts of this window (as long as there is enough memory
> available).
Seems saner.
> Allocating Buffers
> ------------------
>
> The driver documentation recommends using the
> vme_[alloc|free]_consistent() set of functions to allocate and
> deallocate contiguous buffers in memory. These functions simply do
> some checks and calls pci_[alloc|free]_consistent().
Does this mean that a VME bus has consistent memory directlty
and persistently mapped on PCI? It is quite a contraint, but maybe
the TSI bridge honors this -- no, I haven't yet read the whole TSI
manual, just a few pages.
> void *vme_alloc_consistent(struct vme_resource *resource, size_t size,
> dma_addr_t *dma)
> {
> ...
> pdev = container_of(bridge->parent, struct pci_dev, dev);
> ...
> return pci_alloc_consistent(pdev, size, dma);
> }
Also, this requires to bridge to be a PCI device. We'll need to lift
this requirement sooner or later -- shouldn't the function be
passed over to the bridge method? We _do_ have a bridge, this is
the extra layer advantage of this driver.
> One thing to note is that since it is calling pci_* functions, this means the
> driver is assuming a PCI-VME bridge at all times (also the struct vme_bridge
> contains a struct pci_dev as the parent device).
I should read all before beginning to write :)
> I don't suppose any other bridge apart from PCI is available or
> widely used so this is not a problem. For us, it's fine since we use
> the TSI148 everywhere.
Well, until somebody at CERN will etherbone the vme, you mean!
> The vme_user driver (which allows user-space access for VME cards), which
> is also the guide for my CVORA driver, however, doesn't use this stuff for
> masters and instead uses it only for slaves.
>
> For slaves:
>
> image[i].size_buf = PCI_BUF_SIZE;
> image[i].kern_buf = vme_alloc_consistent(image[i].resource,
> image[i].size_buf, &image[i].pci_buf);
>
> For masters:
>
> image[i].size_buf = PCI_BUF_SIZE;
> image[i].kern_buf = kmalloc(image[i].size_buf, GFP_KERNEL);
I understand the former is a buffer within the VME memory space
as a DMA target and the latter is a normal buffer within the bridge
driver. Correct?
----- End forwarded message -----
from sys import argv
def adj(x):
return round(x/5.0 * (2**15))
src = open(argv[1], "r")
lines = [int(i.split(", ")[-1][:-1], int(argv[5])) for i in src.readlines()]
src.close()
dest = open(argv[2], "w")
dest.write("[SIGNAL]\nnbits = %s\nrate = %s\ndata = " % (argv[3], argv[4]))
dest.writelines('\t%d\n ' % i for i in lines[int(argv[6]):])
dest.close()
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
1 : import syn
2 : syn.synth(2.9, 100, 0.0, 1000000, 0, 0.02)
3 : s = +
4 : s = _
5 : s
6 : plot s
7 : from matplotlib import pyplot
8 : pyplot.plot(s)
9 : pyplot.show()
10: _ip.magic("save ")
11: help(save)
12: _ip.magic("save ")
13: save(s, 'pure_sin.txt')
14: save(s, 'pure_sin.txt')
15: from numpy import *
16: save(s, 'pure_sin.txt')
17: save('pure_sin.txt', s)
18: _ip.magic("edit pure_sin.txt.npy")
19: help(save)
20: out = file('pure_sin.txt', 'w')
21:
for i in s:
print >>out, i
22: out.close()
23: _ip.system("view pure*")
24: _ip.system("rm pure_sin.txt.npy")
25:
def w(s, f):
out = file(f, 'w')
for i in s:
print >>out, i
out.close()
26:
27:
28:
29: s
30: t
31: syn.synth(2.9, 100, 0.0, 1000000, 0, 0.02)
32: random.randn(len(s))
33:
34:
35: r = 2.9 * 0.001 * random.randn(len(s))
36: s+r
37: sn = s+r
38: w(s, 'gaussian_1000th.txt')
39: plot s
40: w(sn, 'gaussian_1000th.txt')
41: plot s
42: plot = pyplot.plot
43: plot(s)
44: sn = s+r
45: r = 2.9 * 0.01 * random.randn(len(s))
46: sn = s+r
47: w(sn, 'gaussian_100th.txt')
48: plot(sn)
49: r = 2.9 * 0.001 * random.randn(len(s))
50: sn = s+r
51: w(sn, 'gaussian_100th.txt')
52: plot(sn)
53: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
54: sincoh = s
55: w(sincoh, 'incoherent.txt')
56: sincohn = s + 0.001 * 2.9 * random.randn(len(s))
57: w(sincohn, 'incoherent_1000gaussian.txt')
58: plot(sincohn)
59: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
60: s = s + 0.01 * syn.synth(2.9, 300, 0.0, 1000000, 0, 0.025)
61: s = s + 0.02 * syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
62: plot(s)
63: plot(s)
64: plot(s)
65: 1 / sqrt(5)
66: w(s, 'thd_44_7_times.txt')
67: s = syn.synth(2.9, 100, 0.0, 1000000, 0, 0.025)
68: s = s + 0.1 syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
69: s = s + 0.1 * syn.synth(2.9, 500, 0.0, 1000000, 0, 0.025)
70: s = s + 0.08 * syn.synth(2.9, 800, 0.0, 1000000, 0, 0.025)
71: s = s + 0.005 * random.randn(len(s))
72: w(s,'thd_0.1_0.08_n_0.005.txt)
73: w(s,'thd_0.1_0.08_n_0.005.txt')
74: help
75: help()
76: #?
77: #?save
78: #?history
79: histogram
80: _ip.magic("history ")
81: _ip.magic("history -h")
82: #?history -
83: _ip.magic("history -f")
84: #?history
85: _ip.magic("history -f log 1")
86: _ip.system(" view log")
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment