N957Lib.h 40.8 KB
Newer Older
Rafaela Meissner's avatar
novo    
Rafaela Meissner committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
////////////////////////////////////////////////////////////////////////////////////////////////
/*! \file    N957Lib.h
*   \brief   N957 board library public methods definitions
*   \author  CAEN S.p.A. ( http://www.caen.it )
*   \version 1.2
*   \date    05/2006
*            
*/
////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __N957LIB_DEF_H
#define __N957LIB_DEF_H

////////////////////////////////////////////
// File includes
////////////////////////////////////////////
#include "N957oslib.h"
#include "N957types.h"

////////////////////////////////////////////
// Global defines
////////////////////////////////////////////

////////////////////////////////////////////
// Global variables declaration
////////////////////////////////////////////

////////////////////////////////////////////
// Global methods declaration
////////////////////////////////////////////

////////////////////////////////////////////
// Public Library methods declaration
////////////////////////////////////////////

/*!
* \defgroup board_handling Boards handling APIs
*/
/*@{*/

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_Init( short BdNum, int32_t *handle)
*   \brief   Initialize a new board
*            
*            Call before any other API to to get a valid board handle: board number canno't be previously initialized
*   \param   BdNum board number (must be a new one)
*   \param   handle board handle (to use for any other API call)
*   \return  N957Success : operation ok
*   \note    Must be called before any other board specific API.
*   \sa      N957ErrorCodes
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_Init( short BdNum, int32_t *handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_End( int32_t handle)
*   \brief   Releases the resources allocated for the board
*            
*            Call after any other API for this board: the number of this board can be initialized again
*   \param   handle board's handle (to use for any other API call)
*   \return  N957Success : operation ok
*   \note    Must be called as last API for that board handle.
*   \sa      N957ErrorCodes
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_End( int32_t handle);
/*@}*/

/*!
* \defgroup miscellaneous Miscellaneous APIs
*/
/*@{*/

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_DecodeError( N957ErrorCodes code)
*   \brief   Decodes a N957 error code into string
*            
*   \param   code error to decode
*   \return  Decoded error string
*   \sa      N957ErrorCodes
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API const char* N957_DecodeError( N957ErrorCodes code);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SWRelease( char *SwRel, int buff_size)
*   \brief   Gets the library release string
*            
*            User must allocate a buffer enough large for library release storage
*            The software release string format is : ##.## ( major_version.minor_version ) 
*   \param   SwRel The caller allocated string buffer to be filled with library release string
*   \param   buff_size The caller allocated buffer size (BYTEs)
*   \return  N957Success : operation ok
*   \sa      N957ErrorCodes
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SWRelease( char *SwRel, int buff_size);
/*@}*/

/*!
* \defgroup level_0 Level 0 APIs
*/
/*@{*/
////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_WriteReg( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 data)
*   \brief   Writes data to board's register 
*            
*   \param   handle board's handle
*   \param   reg_addr register address
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_WriteReg( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_ReadReg( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 *data)
*   \brief   Reads data from board's register 
*            
*   \param   handle board's handle
*   \param   reg_addr register address
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_ReadReg( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetRegBitMsk( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 bitmsk)
*   \brief   Sets a mask of bits into board's register 
*            
*   \param   handle board's handle
*   \param   reg_addr register address
*   \param   bitmsk: mask of bits to set
*   \return  N957Success: procedure execution ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*            and register must have R/W properties
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetRegBitMsk( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 bitmsk);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_ClearRegBitMsk( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 bitmsk)
*   \brief   Clears a mask of bits into board's register 
*            
*   \param   handle board's handle
*   \param   reg_addr register address
*   \param   bitmsk: mask of bits to clear
*   \return  N957Success: procedure execution ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*            and register must have R/W properties
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_ClearRegBitMsk( int32_t handle, N957_UINT16 reg_addr, N957_UINT16 bitmsk);
/*@}*/

/*!
* \defgroup level_1 Level 1 APIs
*/
/*@{*/

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetStatus( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Status register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetStatus( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetControl( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Control register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetControl( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetControl( int32_t handle, N957_UINT16 data)
*   \brief   Sets Control register
*            
*   \param   handle board's handle
*   \param   data data to write read
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetControl( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetFWRelease( int32_t handle, char *FwRel, int buff_size)
*   \brief   Gets firmare release string
*            
*            The firmware release string format is : ##.## ( major_version.minor_version ) 
*   \param   handle board's handle
*   \param   FwRel Firmware release buffer (caller allocated) to be filled with firmware release string
*   \param   buff_size Allocated buffer size (BYTEs)
*   \return  N957Success: procedure execution ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetFWRelease( int32_t handle, char *FwRel, int buff_size);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetDAC( int32_t handle, N957_UINT16 *data)
*   \brief   Gets DAC register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetDAC( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetDAC( int32_t handle, N957_UINT16 data)
*   \brief   Sets DAC register 
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetDAC( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetBlDim( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Block Dimension register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetBlDim( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetBlDim( int32_t handle, N957_UINT16 data)
*   \brief   Sets Block Data Dimension
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetBlDim( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetPulser( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Pulser register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetPulser( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetPulser( int32_t handle, N957_UINT16 data)
*   \brief   Sets Pulser register
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetPulser( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetFwDwnld( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Firmware Download register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetFwDwnld( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetFwDwnld( int32_t handle, N957_UINT16 data)
*   \brief   Sets Firmware Download register
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetFwDwnld( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetFlashEna( int32_t handle, N957_UINT16 *data)
*   \brief   Gets Flash Enable register 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetFlashEna( int32_t handle, N957_UINT16 *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetFlashEna( int32_t handle, N957_UINT16 data)
*   \brief   Sets Flash Enable register 
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetFlashEna( int32_t handle, N957_UINT16 data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetUsbFlag( int32_t handle, N957_BOOL *usb_high_speed)
*   \brief   Gets USB flag status
*            
*   \param   handle board's handle
*   \param   usb_high_speed USB port type: FALSE = full speed (USB 1.1) , TRUE = high speed (USB 2.0) 
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetUsbFlag( int32_t handle, N957_BOOL *usb_high_speed);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetMemEmptyFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets memory empty flag status
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetMemEmptyFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetMemFullFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets memory full status flag 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetMemFullFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetFlashBusyFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Flash busy status flag 
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetFlashBusyFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetAcqModeFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Acquisition mode control flag
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetAcqModeFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetAcqModeFlag( int32_t handle, N957_BOOL data)
*   \brief   Sets Acquisition mode control flag
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetAcqModeFlag( int32_t handle, N957_BOOL data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetADCRate( int32_t handle, N957ControlADCRates *rate)
*   \brief   Gets ADC rate 
*            
*   \param   handle board's handle
*   \param   rate data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957ControlADCRates
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetADCRate( int32_t handle, N957ControlADCRates *rate);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetADCRate( int32_t handle, N957ControlADCRates rate)
*   \brief   Sets ADC rate
*            
*   \param   handle board's handle
*   \param   rate data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957ControlADCRates
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetADCRate( int32_t handle, N957ControlADCRates rate);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetSlsFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Sliding scale control flag
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetSlsFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetSlsFlag( int32_t handle, N957_BOOL data)
*   \brief   Sets Sliding scale control flag
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetSlsFlag( int32_t handle, N957_BOOL data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SwReset( int32_t handle)
*   \brief   Performs a software reset
*            
*   \param   handle board's handle
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SwReset( int32_t handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SwClear( int32_t handle)
*   \brief   Performs a software clear
*            
*            Clears data, Scaler counter, Timer and Live time timer
*   \param   handle board's handle
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SwClear( int32_t handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetConvEnFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Convertion enable control flag
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetConvEnFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetConvEnFlag( int32_t handle, N957_BOOL data)
*   \brief   Sets Convertion enable control flag
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetConvEnFlag( int32_t handle, N957_BOOL data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetSwConvFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Software convertion control flag
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetSwConvFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetSwConvFlag( int32_t handle, N957_BOOL data)
*   \brief   Sets Software convertion control flag
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetSwConvFlag( int32_t handle, N957_BOOL data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetPurEnFlag( int32_t handle, N957_BOOL *data)
*   \brief   Gets Pile UP rejection control flag
*            
*   \param   handle board's handle
*   \param   data data read
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetPurEnFlag( int32_t handle, N957_BOOL *data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetPurEnFlag( int32_t handle, N957_BOOL data)
*   \brief   Sets Pile UP rejection control flag
*            
*   \param   handle board's handle
*   \param   data data to write
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetPurEnFlag( int32_t handle, N957_BOOL data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetAcquisitionMode( int32_t handle, N957ControlModes *mode)
*   \brief   Gets acquisition mode
*            
*   \param   handle board's handle
*   \param   mode acquisition mode
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957ControlModes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetAcquisitionMode( int32_t handle, N957ControlModes *mode);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetAcquisitionMode( int32_t handle, N957ControlModes mode)
*   \brief   Sets acquisition mode
*            
*   \param   handle board's handle
*   \param   mode acquisition mode
*   \return  N957Success: write ok : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957ControlModes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetAcquisitionMode( int32_t handle, N957ControlModes mode);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetBufferOccupancy( int32_t handle, N957_UINT16 *buffer_size)
*   \brief   Gets the data buffer occupancy
*            
*   \param   handle board's handle
*   \param   buffer_size The buffer occupancy (WORDs) 
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetBufferOccupancy( int32_t handle, N957_UINT16 *buffer_size);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetRawData( int32_t handle, N957_UINT16 *data_buff, N957_UINT16 *read_data)
*   \brief   Gets raw data from board FIFO
*            
*   \param   handle board's handle
*   \param   data_buff data buffer (caller allocated)
*   \param   read_data The buffer size on input (WORDs) and the number of WORDs read on output
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetRawData( int32_t handle, N957_UINT16 *data_buff, N957_UINT16 *read_data);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetScaler( int32_t handle, N957_UINT32 *scaler)
*   \brief   Gets the scaler counter
*            
*            This is the number of convertions occurred
*   \param   handle board's handle
*   \param   scaler The scaler value (bits)
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetScaler( int32_t handle, N957_UINT32 *scaler);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetTimer( int32_t handle, N957_UINT32 *timer)
*   \brief   Gets the timer value
*            
*   \param   handle board's handle
*   \param   timer The timer value (1 msec resolution)
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetTimer( int32_t handle, N957_UINT32 *timer);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetLiveTime( int32_t handle, N957_UINT32 *live_time)
*   \brief   Gets the live time timer value
*            
*   \param   handle board's handle
*   \param   live_time The live time timer value (1 msec resolution)
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetLiveTime( int32_t handle, N957_UINT32 *live_time);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_SetLLD( int32_t handle, N957_BYTE lld)
*   \brief   Sets the low level detect treshold
*            
*   \param   handle board's handle
*   \param   lld The low level detect value in te range [0..99] (0= min value  99= max value)
*   \return  N957Success: read ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
 */
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_SetLLD( int32_t handle, N957_BYTE lld);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_ReadFlashPage( int32_t handle, N957_BYTE data_buff[N957_FLASH_PAGE_SIZE], N957_UINT16 page_number)
*   \brief   Reads a page from flash
*            
*   \param   handle board's handle
*   \param   data_buff data buffer (caller allocated)
*   \param   page_number number of the page to read
*   \return  N957Success: procedure ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_ReadFlashPage( int32_t handle, N957_BYTE data_buff[N957_FLASH_PAGE_SIZE], N957_UINT16 page_number);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_WriteFlashPage( int32_t handle, N957_BYTE data_buff[N957_FLASH_PAGE_SIZE], N957_UINT16 page_number)
*   \brief   Reads a page from flash
*            
*   \param   handle board's handle
*   \param   data_buff data buffer (caller allocated)
*   \param   page_number number of the page to write
*   \return  N957Success: procedure ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_WriteFlashPage( int32_t handle, N957_BYTE data_buff[N957_FLASH_PAGE_SIZE], N957_UINT16 page_number);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_EraseFlashPage( int32_t handle, N957_UINT16 page_number)
*   \brief   Reads a page from flash
*            
*   \param   handle board's handle
*   \param   page_number number of the page to erase
*   \return  N957Success: procedure ok : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_EraseFlashPage( int32_t handle, N957_UINT16 page_number);

/*@}*/

/*!
* \defgroup level_2 Level 2 APIs
*/
/*@{*/

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_StartAcquire( int32_t handle, N957ControlModes mode)
*   \brief   Starts an acquisition
*            
*   \param   handle board's handle
*   \param   mode  acquisition mode
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957ControlModes 
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_StartAcquire( int32_t handle, N957ControlModes mode);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_PauseAcquire( int32_t handle)
*   \brief   Pauses acquisition: internal buffer will NOT be resetted and scaler and timers  will not be stopped
*            
*   \param   handle board's handle
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_PauseAcquire( int32_t handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_ResumeAcquire( int32_t handle)
*   \brief   Resumes acquisition from pause
*            
*   \param   handle board's handle
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_API N957_ResumeAcquire( int32_t handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_StopAcquire( int32_t handle)
*   \brief   Stops acquisition: scaler and timers will be stopped (internal buffer still keep data: use \ref N957_SwClear to clear data/scaler/timers)
*            
*   \param   handle board's handle
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init)
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_StopAcquire( int32_t handle);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_ReadData( int32_t handle, N957_UINT16 *data_buff, N957_UINT16 *read_data)
*   \brief   Reads a block of data
*            
*   \param   handle board's handle
*   \param   data_buff data buffer (caller allocated)
*   \param   read_data The buffer size on input (WORDs) and the number of WORDs read on output
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init) 
*            and acquisition must be started
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_ReadData( int32_t handle, N957_UINT16 *data_buff, N957_UINT16 *read_data);


////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_GetConfigROM( int32_t handle, N957_ConfigROM* config_rom)
*   \brief   Gets the configuration ROM stored into board flash
*            
*   \param   handle board's handle
*   \param   config_rom The configuration ROM buffer (caller allocated)
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957_ConfigROM
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init) 
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_GetConfigROM( int32_t handle, N957_ConfigROM* config_rom);

////////////////////////////////////////////////////////////////////////////////////////////////
/*! \fn      N957_API N957_FwUpgrade( int32_t handle, const N957_BYTE* data_buff, N957_UINT32 data_size, N957FlashPageTypes page_type)
*   \brief   Updates board firmware
*            
*   \param   handle board's handle
*   \param   data_buff: firmware data buffer
*   \param   data_size buffer size (BYTEs)
*   \param   page_type the type of page to download (Boot or Backup)
*   \return  N957Success: procedure executed correctly : error code otherwise
*   \sa      N957ErrorCodes
*   \sa      N957FlashPageTypes
*   \note    <i>handle</i> must be a valid one (as returned from \ref N957_Init) 
*/
////////////////////////////////////////////////////////////////////////////////////////////////
N957_DLL_API N957_API N957_FwUpgrade( int32_t handle, const N957_BYTE* data_buff, N957_UINT32 data_size, N957FlashPageTypes page_type);

/*@}*/

#endif