Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

cbHwlibHi.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* =STS=> cbHwlibHi.h[1689].aa11 submit SMID:13 */
  2. //////////////////////////////////////////////////////////////////////////////////////////////////
  3. //
  4. // (c) Copyright 2003-2008 Cyberkinetics, Inc.
  5. // (c) Copyright 2008-2012 Blackrock Microsystems
  6. //
  7. // $Workfile: cbHwlibHi.h $
  8. // $Archive: /Cerebus/WindowsApps/cbhwlib/cbHwlibHi.h $
  9. // $Revision: 10 $
  10. // $Date: 2/11/04 1:49p $
  11. // $Author: Kkorver $
  12. //
  13. // $NoKeywords: $
  14. //
  15. ///////////////////////////////////////////////////////////////////////////////////////////////////
  16. #ifndef CBHWLIBHI_H_INCLUDED
  17. #define CBHWLIBHI_H_INCLUDED
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif // _MSC_VER > 1000
  21. #include "cbhwlib.h"
  22. #define MIN_CHANS 1
  23. #define MAX_CHANS_ARRAY 96 // In neuroport there are only 96 channels
  24. // Currently we have 8 acquisition groups:
  25. // Sampling Filter
  26. enum { ACQGRP_NONE, // not sampled
  27. ACQGRP_1KS_EEG, // 1 kS/s EEG/ECG/EOG/ERG
  28. ACQGRP_1KS, // 1 kS/s LFP Wide
  29. ACQGRP_1KS_SPIKE_MED, // 1 kS/s Spike Medium
  30. ACQGRP_2KS, // 2 kS/s LFP XWide
  31. ACQGRP_10KS, // 10 kS/s Activity
  32. ACQGRP_30KS, // 30 kS/s Unfiltered
  33. ACQGRP_30KS_EMG, // 30 kS/s EMG
  34. ACQGRP_30KS_EEG, // 30 kS/s EEG
  35. ACQ_GROUP_COUNT
  36. };
  37. // Currently we have 5 sampling rates:
  38. // Sampling
  39. enum { SMPGRP_NONE, // not sampled
  40. SMPGRP_500S, // 500 S/s
  41. SMPGRP_1KS, // 1 kS/s
  42. SMPGRP_2KS, // 2 kS/s
  43. SMPGRP_10KS, // 10 kS/s
  44. SMPGRP_30KS, // 30 kS/s
  45. SMP_GROUP_COUNT
  46. };
  47. ///////////////////////////////////////////////////////////////////////////////////////////////////
  48. bool IsSimRunning(uint32_t nInstance = 0); // TRUE means that CentralSim is being used; FALSE, not
  49. bool IsSpikeProcessingEnabled(uint32_t nChan, uint32_t nInstance = 0); // TRUE means yes; FALSE, no
  50. bool IsContinuousProcessingEnabled(uint32_t nChan, uint32_t nInstance = 0); // TRUE means yes; FALSE, no
  51. bool IsRawProcessingEnabled(uint32_t nChan, uint32_t nInstance = 0); // true means yes
  52. // Is this channel enabled?
  53. // This will figure out what kind of channel, and then find out if it is enabled
  54. bool IsChannelEnabled(uint32_t nChannel, uint32_t nInstance = 0);
  55. // Use these with care. make sure you know what kind of channel you have
  56. bool IsAnalogInEnabled(uint32_t nChannel);
  57. bool IsAudioEnabled(uint32_t nChannel);
  58. bool IsAnalogOutEnabled(uint32_t nChannel);
  59. bool IsDigitalInEnabled(uint32_t nChannel);
  60. bool IsSerialEnabled(uint32_t nChannel, uint32_t nInstance = 0);
  61. bool IsDigitalOutEnabled(uint32_t nChannel, uint32_t nInstance = 0);
  62. // Is it "this" kind of channel? (very fast)
  63. bool IsChanAnalogIn(uint32_t dwChan); // TRUE means yes; FALSE, no
  64. bool IsChanFEAnalogIn(uint32_t dwChan); // TRUE means yes; FALSE, no
  65. bool IsChanAIAnalogIn(uint32_t dwChan); // TRUE means yes; FALSE, no
  66. bool IsChanSerial(uint32_t dwChan); // TRUE means yes; FALSE, no
  67. bool IsChanDigin(uint32_t dwChan); // TRUE means yes; FALSE, no
  68. bool IsChanDigout(uint32_t dwChan); // TRUE means yes; FALSE, no
  69. bool IsChanCont(uint32_t dwChan, uint32_t nInstance = 0); // TRUE means yes; FALSE, no
  70. bool AreHoopsDefined(uint32_t nChannel, uint32_t nInstance = 0);
  71. bool AreHoopsDefined(uint32_t nChannel, uint32_t nUnit, uint32_t nInstance = 0);
  72. // Author & Date: Ehsan Azar June 3, 2009
  73. // Purpose: determine if a channel has valid sorting unit
  74. // Input: nChannel = channel to track 1 - based
  75. // dwUnit the unit number (1=< dwUnit <=cbMAXUNITS)
  76. bool cbHasValidUnit(uint32_t dwChan, uint32_t dwUnit, uint32_t nInstance = 0); // TRUE means yes; FALSE, no
  77. // Author & Date: Ehsan Azar June 2, 2009
  78. // Purpose: Return TRUE if given channel has a sorting algorithm
  79. // If cbAINPSPK_ALLSORT is passed it returns TRUE if there is any sorting
  80. // If cbAINPSPK_NOSORT is passed it returns TRUE if there is no sorting
  81. // Input: spkSrtOpt = Sorting methods:
  82. // cbAINPSPK_HOOPSORT, cbAINPSPK_SPREADSORT,
  83. // cbAINPSPK_CORRSORT, cbAINPSPK_PEAKMAJSORT,
  84. // cbAINPSPK_PEAKFISHSORT, cbAINPSPK_PCAMANSORT,
  85. // cbAINPSPK_PCAKMEANSORT, cbAINPSPK_PCAEMSORT,
  86. // cbAINPSPK_PCADBSORT, cbAINPSPK_NOSORT,
  87. // cbAINPSPK_OLDAUTOSORT, cbAINPSPK_ALLSORT
  88. bool cbHasSpikeSorting(uint32_t dwChan, uint32_t spkSrtOpt, uint32_t nInstance = 0);
  89. // Author & Date: Ehsan Azar June 2, 2009
  90. // Purpose: Set a sorting algorithm for a channel
  91. // Input: spkSrtOpt = Sorting methods:
  92. // cbAINPSPK_HOOPSORT, cbAINPSPK_SPREADSORT,
  93. // cbAINPSPK_CORRSORT, cbAINPSPK_PEAKMAJSORT,
  94. // cbAINPSPK_PEAKFISHSORT, cbAINPSPK_PCAMANSORT,
  95. // cbAINPSPK_PCAKMEANSORT, cbAINPSPK_PCAEMSORT,
  96. // cbAINPSPK_PCADBSORT, cbAINPSPK_NOSORT
  97. cbRESULT cbSetSpikeSorting(uint32_t dwChan, uint32_t spkSrtOpt, uint32_t nInstance = 0);
  98. // Other functions
  99. void TrackChannel(uint32_t nChannel, uint32_t nInstance = 0);
  100. // Purpose: update the analog input scaling. If there is an Analog Output
  101. // channel which is monitoring this channel, then update the output
  102. // scaling to match the displayed scaling
  103. // Inputs:
  104. // chan - the analog input channel being altered (1 based)
  105. // smpdispmax - the maximum digital value of the continuous display
  106. // spkdispmax - the maximum digital value of the spike display
  107. // lncdispmax - the maximum digital value of the LNC display
  108. cbRESULT cbSetAnaInOutDisplay(uint32_t chan, int32_t smpdispmax, int32_t spkdispmax, int32_t lncdispmax, uint32_t nInstance = 0);
  109. // Purpose: transfrom a digital value to an analog value
  110. // Inputs:
  111. // nChan - the 1 based channel of interest
  112. // nDigital - the digital value
  113. // Outputs:
  114. // the corresponding analog value
  115. inline int32_t cbXfmDigToAna(uint32_t nChan, int32_t nDigital, uint32_t nInstance = 0)
  116. {
  117. int32_t nVal = nDigital;
  118. cbSCALING isScaling;
  119. ::cbGetAinpScaling(nChan, &isScaling, nInstance);
  120. if (0 != isScaling.anagain)
  121. nVal = nDigital * (isScaling.anamax / isScaling.anagain) / isScaling.digmax;
  122. return nVal;
  123. }
  124. // Purpose: transform an analog value to a digital value
  125. // Inputs:
  126. // nChan - the 1 based channel of interest
  127. // nAnalog - the analog value
  128. // Outputs:
  129. // the corresponding digital value
  130. inline int32_t cbXfmAnaToDig(uint32_t nChan, int32_t nAnalog, uint32_t nInstance = 0)
  131. {
  132. cbSCALING isScaling;
  133. ::cbGetAinpScaling(nChan, &isScaling, nInstance);
  134. int32_t nVal = nAnalog * isScaling.digmax / (isScaling.anamax / isScaling.anagain);
  135. return nVal;
  136. }
  137. // Author & Date: Hyrum L. Sessions 25 Jan 2006
  138. // Purpose: Get the scaling of spike and analog channels
  139. // Inputs: nChan - the 1 based channel of interest
  140. // anSpikeScale - pointer to array to store spike scaling
  141. // anContScale - pointer to array to store continuous scaling
  142. // anLncScale - pointer to array to store LNC scaling
  143. cbRESULT cbGetScaling(uint32_t nChan,
  144. uint32_t *anSpikeScale,
  145. uint32_t *anContScale,
  146. uint32_t *anLncScale,
  147. uint32_t nInstance = 0);
  148. // Purpose: tell which acquisition group this channel is part of
  149. // Inputs:
  150. // nChan - the 1 based channel of interest
  151. // Outpus:
  152. // 0 means not part of any acquisition group; 1+ means part of that group
  153. uint32_t cbGetAcqGroup(uint32_t nChan, uint32_t nInstance = 0);
  154. cbRESULT cbSetAcqGroup(uint32_t nChan, uint32_t nGroup, uint32_t nInstance = 0);
  155. // Author & Date: Ehsan Azar 28 May 2009
  156. // Purpose: tell which sampling group this channel is part of
  157. // Inputs:
  158. // nChan - the 1 based channel of interest
  159. // Outpus:
  160. // 0 means SMPGRP_NONEuint32_t
  161. uint32_t cbGetSmpGroup(uint32_t nChan, uint32_t nInstance = 0);
  162. // Author & Date: Ehsan Azar 28 May 2009
  163. // Purpose: tell me how many sampling groups exist
  164. // this number will always be larger than 1 because group 0 (empty)
  165. // will always exist
  166. uint32_t cbGetSmpGroupCount();
  167. // Purpose: tell me how many acquisition groups exist
  168. // this number will always be larger than 1 because group 0 (empty)
  169. // will always exist
  170. uint32_t cbGetAcqGroupCount();
  171. // Purpose: get a textual description of the acquisition group
  172. // Inputs: nGroup - group in question
  173. // Outputs: pointer to the description of the group
  174. const char * cbGetAcqGroupDesc(uint32_t nGroup);
  175. // Purpose: get the individual components (filter & sample group)
  176. // Inputs: nGroup - group in question
  177. // Outputs: component value
  178. uint32_t cbGetAcqGroupFilter(uint32_t nGroup);
  179. uint32_t cbGetAcqGroupSampling(uint32_t nGroup);
  180. // Purpose: get the number of units for this channel
  181. // Inputs: nChan - 1 based channel of interest
  182. // Returns: number of valid units for this channel
  183. uint32_t cbGetChanUnits(uint32_t nChan, uint32_t nInstance = 0);
  184. // Purpose: tells if the unit in the channel is valid
  185. // Inputs: nChan - 1 based channel of interest
  186. // nUnit - 1 based unit of interest (0 is noise unit)
  187. // Returns: 1 if the unit in the channel is valid, 0 is otherwise
  188. uint32_t cbIsChanUnitValid(uint32_t nChan, int32_t nUnit, uint32_t nInstance = 0);
  189. // Purpose: Set the noise boundary parameters (compatibility for int16_t)
  190. cbRESULT cbSSSetNoiseBoundary(uint32_t chanIdx, int16_t anCentroid[3], int16_t anMajor[3], int16_t anMinor_1[3], int16_t anMinor_2[3], uint32_t nInstance = 0);
  191. // Purpose: Get NTrode unitmapping for a particular site
  192. cbRESULT cbGetNTrodeUnitMapping(uint32_t ntrode, uint16_t nSite, cbMANUALUNITMAPPING *unitmapping, uint32_t nInstance = 0);
  193. // Purpose: Set NTrode unitmapping of a particular site
  194. cbRESULT cbSetNTrodeUnitMapping(uint32_t ntrode, uint16_t nSite, cbMANUALUNITMAPPING *unitmapping, int16_t fs = -1, uint32_t nInstance = 0);
  195. // Purpose: Set NTrode feature space, keeping the rest of NTrode information intact
  196. cbRESULT cbSetNTrodeFeatureSpace(uint32_t ntrode, uint16_t fs, uint32_t nInstance = 0);
  197. // Returns: returns if file is being recorded
  198. bool IsFileRecording(uint32_t nInstance = 0);
  199. #endif // include guards