scpi_commands.c 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  1. #define SCPI_CORE_PRIVATE // access to 'scpi_core_private.h'
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <errno.h>
  5. #include "app/scpi/scpi_core.h"
  6. #include "app/scpi/scpi_core_private.h"
  7. #include "app/scpi/scpi_commands.h"
  8. #include "app/scpi/scpi_parser.h"
  9. #include "app/scpi/scpi_tlst_ex.h"
  10. #include "app/scpi/CommandHandlers/idn.h"
  11. #include "app/scpi/CommandHandlers/rst.h"
  12. #include "app/scpi/CommandHandlers/cls.h"
  13. #include "app/scpi/CommandHandlers/esr_stb.h"
  14. #include "app/scpi/CommandHandlers/ese_sre.h"
  15. #include "app/scpi/CommandHandlers/opc.h"
  16. //#include "app/scpi/CommandHandlers/test.h"
  17. #include "app/scpi/CommandHandlers/syst_error.h"
  18. #include "app/scpi/CommandHandlers/syst_version.h"
  19. #include "app/scpi/commandHandlers/memory_table_adapter.h"
  20. #include "app/scpi/commandHandlers/memory_table_connector.h"
  21. #include "app/scpi/commandHandlers/memory_table_group.h"
  22. #include "app/scpi/commandHandlers/memory_table_ther_corr_group.h"
  23. #include "app/scpi/commandHandlers/measurement_and_switch.h"
  24. #include "app/scpi/commandHandlers/led_switch.h"
  25. #include "app/scpi/commandHandlers/scpi_service.h"
  26. #include "app/scpi/commandHandlers/power_switch.h"
  27. #include "app/scpi/commandHandlers/trigger_state.h"
  28. #include "app/scpi/commandHandlers/memory_table_freq_data.h"
  29. #include "app/scpi/commandHandlers/memory_table_freq_segm_data.h"
  30. #include "app/scpi/commandHandlers/interface_switch.h"
  31. #include "app/scpi/commandHandlers/memory_table_data.h"
  32. #include "app/scpi/commandHandlers/memory_table_ther_corr_data.h"
  33. #include "app/scpi/commandHandlers/trg.h"
  34. #include "app/scpi/commandHandlers/scpi_table.h"
  35. //----------------------------------------------------------------
  36. // Refer to:
  37. // [1] IEEE 488.2 Standard, revision IEEE Std 488.2-1987 (1992)
  38. // "IEEE Standard Codes, Formats, Protocols, and Common Commands for Use With IEEE Std 488.1-1987, IEEE
  39. // Standard Digital Interface for Programmable Instrumentation"
  40. // [2] SCPI Specification, revision 1999.0
  41. // "Standard Commands for Programmable Instruments (SCPI), VERSION 1999.0, May 1999"
  42. //----------------------------------------------------------------
  43. // ========================================================================================================
  44. static bool compareCharacter( xArgument_t allowedOption, const sStrToken_t * testingString )
  45. {
  46. assert( allowedOption );
  47. assert( testingString );
  48. assert( testingString->shead < testingString->stail );
  49. return scpi_command_header_compare( allowedOption, testingString );
  50. }
  51. // @processCharacterArgument
  52. // Argument Validation Function
  53. // Processes specified SCPI Character Parameter (Character Program Data) and searches it in the allowed values list.
  54. // Function uses smart comparing the source parameter to each one of the list allowing short and long form of value.
  55. // References:
  56. // "7.7.1 <CHARACTER PROGRAM DATA>", [1]
  57. // "7.7.1.2 Encoding Syntax", [1]
  58. // @allowedList - values allowed list, use @DECLARE_ARGUMENT_CHARACTER_ALLOWED_LIST to create this parameter;
  59. // Note 1: each element in the list must be a NULL-terminated string;
  60. // Note 2: the list must contain NULL-pointer in the end of list;
  61. // @arg - parsed argument token filled by @parseArguments (SCPI_PARSE_ARGUMENTS macro)
  62. // @pIdx - optional pointer to the variable to store index of matched element in the @allowedList array, only valid if
  63. // the 'true' is returned; only positive number is returned;
  64. // Return:
  65. // - true: parameter processed successfully, passed parameter is valid due to it matchs to
  66. // one of the element of allowed list;
  67. // - false: parameter fail, passed parameter not recognized or invalid function parameter;
  68. bool processCharacterArgument( const xArgument_t * allowedList, const sStrToken_t * arg, int8_t * pIdx )
  69. {
  70. assert( allowedList );
  71. assert( allowedList[0] ); // allowed list must contain at least one element
  72. assert( arg );
  73. assert( arg->shead < arg->stail ); // argument can not be empty
  74. if( NULL == allowedList || NULL == allowedList[0] || NULL == arg || (arg->shead >= arg->stail) )
  75. {
  76. return false;
  77. }
  78. bool status = false;
  79. uint8_t idx = 0;
  80. while( NULL != allowedList[ idx ] )
  81. {
  82. if( compareCharacter( allowedList[ idx ], arg ) )
  83. {
  84. if( NULL != pIdx ) *pIdx = idx;
  85. status = true;
  86. break;
  87. }
  88. idx++;
  89. }
  90. return status;
  91. }
  92. // ========================================================================================================
  93. // @scpiSearchCommandHandler
  94. // Searches for the registered SCPI-command handler for the
  95. // ... command specified by pair of @shead and @stail.
  96. // @proot - pointer to the root element pointer to search in, can not be NULL;
  97. // @shead - string head (begining), can not be NULL;
  98. // @stail - string tail (ending), can not be NULL;
  99. // @cmdType - the command header type, see @eScpiEntityType_t.
  100. // @pFoundHandler - pointer to the string token structure to store found handler mnemonic (optional);
  101. // Returns: the command handler entry pointer in success case,
  102. // ... and NULL in case no command handler found or on error condition.
  103. // Note: pair of @shead and @stail shall represent a valid SCPI Command
  104. // ... Program Header ("7.6.1 <COMMAND PROGPRAM HEADER>", [1]), processed
  105. // ... by @parseCommandProgramHeader function.
  106. // Note: if the value referred by @proot is NULL, this value is considered
  107. // ... as global root branch (scpi_commands_root_node)
  108. // References:
  109. // 6.2.4 Traversal of the Header Tree, [2]
  110. // A.1.1 Use of the Compound Header Rules, [1]
  111. const sScpiCommandHandlerEntry_t * scpiSearchCommandHandler(
  112. const sTreeList_t * * proot,
  113. const char * shead,
  114. const char * stail,
  115. uint8_t cmdType,
  116. sStrToken_t * pFoundHandler,
  117. bool bRememberOverride )
  118. {
  119. // Since this function is called after the @parseCommandProgramHeader
  120. // ... call, it is assumed that the string is a valid SCPI-command,
  121. // ... and can contain only one of the following types of command:
  122. // * common command, begins with '*' sign, e.g. "*IDN?";
  123. // * simple/compound command, begins with the optional ':' and contain optional
  124. // ... ':' between "subsystems", e.g. "MEM:TABLE:DATA";
  125. const sTreeList_t * found = NULL;
  126. const sTreeList_t * root = NULL;
  127. bool bRememberLastBranch = true;
  128. if( NULL == proot || NULL == shead || NULL == stail || shead > stail )
  129. return NULL;
  130. switch( cmdType )
  131. {
  132. // common command:
  133. case eScpiEntityTypeCmnCommandProgHdr:
  134. case eScpiEntityTypeCmnQueryProgHdr:
  135. {
  136. root = &scpi_commands_root_node; // reset current branch to the root
  137. sStrToken_t token = { shead, stail };
  138. // Search for mandatory commands (common form): flat search in the root
  139. found = tree_list_search( root, &token, treelist_header_compare, NULL );
  140. }
  141. break;
  142. // simple/compound command
  143. case eScpiEntityTypeCmpCommandProgHdr:
  144. case eScpiEntityTypeCmpQueryProgHdr:
  145. {
  146. root = *proot; // move to global context
  147. if( NULL == root )
  148. root = &scpi_commands_root_node; // reset current branch to the root
  149. // check if there is leading colon:
  150. if( scpi_iscmdsep( *shead ) )
  151. {
  152. // "root subsystem" found, reset current branch to the root
  153. root = &scpi_commands_root_node;
  154. shead++;
  155. }
  156. else
  157. {
  158. // A.1.1 Use of the Compound Header Rules, [1]
  159. bRememberLastBranch = false;
  160. }
  161. sTreeListSearchCtx_t ts_search;
  162. // initialize compound command chain context
  163. scpi_command_search_prepare( &ts_search, shead, stail );
  164. // Search for compound commands: deep search from the root
  165. found = tree_list_search_deep( root, &scpi_commands_tlds, &ts_search );
  166. if( found )
  167. {
  168. root = ts_search.parent;
  169. }
  170. }
  171. break;
  172. }
  173. if( found )
  174. {
  175. // If the command is the first in the line, the branch must be set as default branch (@bRememberOverride)
  176. if( bRememberLastBranch || bRememberOverride ) *proot = root; // remember last branch
  177. if( NULL != pFoundHandler )
  178. {
  179. pFoundHandler->shead = shead;
  180. pFoundHandler->stail = stail;
  181. }
  182. return (const sScpiCommandHandlerEntry_t*)(found->c_ctx);
  183. }
  184. return NULL;
  185. }
  186. // ========================================================================================================
  187. // ========================================================================================================
  188. // ========================================================================================================
  189. // ========================================================================================================
  190. //// @CommandEntryMEMoryTABLeADAPter
  191. //// MEMory:TABLe:ADAPter? command entry
  192. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeADAPter = {
  193. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeADAPter }, // connect the MemoryTableAdapter handler
  194. // .ctx = NULL
  195. //};
  196. //
  197. //// @CommandEntryMEMoryTABLeCONNector
  198. //// MEMory:TABLe:CONNector? command entry
  199. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeCONNector = {
  200. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeCONNector }, // connect the MemoryTableConnector handler
  201. // .ctx = NULL
  202. //};
  203. //
  204. //// @CommandEntryMEMoryTABLeANALyzer
  205. //// MEMory:TABLe:ANALyzer? command entry
  206. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeANALyzer = {
  207. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableAnalyzer handler
  208. // .ctx = &fsqvbl_CommandHandlerMemoryTableAnalyzer // grouped handler context
  209. //};
  210. //
  211. //// @CommandEntryMEMoryTABLeDATE
  212. //// MEMory:TABLe:DATE? command entry
  213. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeDATE = {
  214. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableDate handler
  215. // .ctx = &fsqvbl_CommandHandlerMemoryTableDate // grouped handler context
  216. //};
  217. //
  218. //// @CommandEntryMEMoryTABLeOPERator
  219. //// MEMory:TABLe:OPERator? command entry
  220. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeOPERator = {
  221. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableOperator handler
  222. // .ctx = &fsqvbl_CommandHandlerMemoryTableOperator // grouped handler context
  223. //};
  224. //
  225. //// @CommandEntryMEMoryTABLePLACe
  226. //// MEMory:TABLe:PLACe? command entry
  227. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLePLACe = {
  228. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTablePlace handler
  229. // .ctx = &fsqvbl_CommandHandlerMemoryTablePlace // grouped handler context
  230. //};
  231. //
  232. //// @CommandEntryMEMoryTABLePOINts
  233. //// MEMory:TABLe:POINts? command entry
  234. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLePOINts = {
  235. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTablePoints handler
  236. // .ctx = &fsqvbl_CommandHandlerMemoryTablePoints // grouped handler context
  237. //};
  238. //
  239. //// @CommandEntryMEMoryTABLeTEMPerature
  240. //// MEMory:TABLe:TEMPerature? command entry
  241. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTEMPerature = {
  242. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableTemperature handler
  243. // .ctx = &fsqvbl_CommandHandlerMemoryTableTemperature // grouped handler context
  244. //};
  245. //
  246. //// @CommandEntryMEMoryTABLeTIME
  247. //// MEMory:TABLe:TIME? command entry
  248. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTIME = {
  249. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableTime handler
  250. // .ctx = &fsqvbl_CommandHandlerMemoryTableTime // grouped handler context
  251. //};
  252. //// @CommandEntryMEMoryTABLeFREQuencySTARt
  253. //// MEMory:TABLe:FREQuency:STARt? command entry
  254. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeFREQuencySTARt = {
  255. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableFrequencyStart handler
  256. // .ctx = &fsqvbl_CommandHandlerMemoryTableFrequencyStart // grouped handler context
  257. //};
  258. //
  259. //// @CommandEntryMEMoryTABLeFREQuencySTOP
  260. //// MEMory:TABLe:FREQuency:STOP? command entry
  261. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeFREQuencySTOP = {
  262. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableFrequencyStop handler
  263. // .ctx = &fsqvbl_CommandHandlerMemoryTableFrequencyStop // grouped handler context
  264. //};
  265. //
  266. //// @CommandEntryMEMoryTABLeFREQuencyTYPE
  267. //// MEMory:TABLe:FREQuency:TYPE? command entry
  268. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeFREQuencyTYPE = {
  269. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLe_group }, // connect the MemoryTableFrequencyType handler
  270. // .ctx = &fsqvbl_CommandHandlerMemoryTableFrequencyType // grouped handler context
  271. //};
  272. //// @CommandEntryMEMoryTABLeTHERmoCorrectionFREQuencySTARt
  273. //// MEMory:TABLe:THERmo:CORRection:FREQuency:STARt? command entry
  274. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTARt = {
  275. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeTHERmoCORRection_group }, // connect the MemoryTableThermoCorrectionFrequencyStart handler
  276. // .ctx = &fsqvbl_CommandHandlerMemoryTableThermoCorrectionFrequencyStart // grouped handler context
  277. //};
  278. //
  279. //// @CommandEntryMEMoryTABLeTHERmoCorrectionFREQuencySTOP
  280. //// MEMory:TABLe:THERmo:CORRection:FREQuency:STOP? command entry
  281. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTOP = {
  282. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeTHERmoCORRection_group }, // connect the MemoryTableThermoCorrectionFrequencyStop handler
  283. // .ctx = &fsqvbl_CommandHandlerMemoryTableThermoCorrectionFrequencyStop // grouped handler context
  284. //};
  285. //// @CommandEntryMEMoryTABLeTHERmoCorrectionFREQuencyPOINts
  286. //// MEMory:TABLe:THERmo:CORRection:FREQuency:POINTs? command entry
  287. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencyPOINts = {
  288. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeTHERmoCORRection_group }, // connect the MemoryTableThermoCorrectionFrequencyPoints handler
  289. // .ctx = &fsqvbl_CommandHandlerMemoryTableThermoCorrectionFrequencyPoints // grouped handler context
  290. //};
  291. //// @CommandEntryMEMoryTABLeFREQuencySEGMentDATA
  292. //// :MEMory:TABLe:FREQuency:SEGMent:DATA? command entry
  293. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeFREQuencySEGMentDATA = {
  294. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeFREQuencySEGMentDATA }, // connect the MemoryTableFrequencySegmentData handler
  295. // .ctx = NULL
  296. //};
  297. //// @CommandEntryMEMoryTABLeFREQuencyDATA
  298. //// :MEMory:TABLe:FREQuency:DATA? command entry
  299. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeFREQuencyDATA = {
  300. // .entry = { &fsqvbl_CommandHandlerMEMoryTABLeFREQuencyDATA }, // connect the MemoryTableFrequencyData handler
  301. // .ctx = NULL
  302. //};
  303. //// @CommandEntryMEMoryTABLeTHERmoCorrectionMAGNitude
  304. //// MEMory:TABLe:THERmo:CORRection:MAGNitude? command entry
  305. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTHERmoCORRectionMAGNitude = {
  306. // .entry = { &fsqvbl_CommandHandlerMemoryTableThermoCorrectionData }, // connect the MemoryTableThermoCorrectionData handler
  307. // .ctx = &fsqvbl_CommandHandlerMemoryTableThermoCorrectionMagnitude_context // grouped handler context
  308. //};
  309. //
  310. //// @CommandEntryMEMoryTABLeTHERmoCorrectionPHASe
  311. //// MEMory:TABLe:THERmo:CORRection:PHASe? command entry
  312. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeTHERmoCORRectionPHASe = {
  313. // .entry = { &fsqvbl_CommandHandlerMemoryTableThermoCorrectionData }, // connect the MemoryTableThermoCorrectionData handler
  314. // .ctx = &fsqvbl_CommandHandlerMemoryTableThermoCorrectionPhase_context // grouped handler context
  315. //};
  316. //// @NodeEntry_FREQuencySEGMent
  317. //// "MEMory:TABLe:FREQuency:SEGMent:" command node
  318. //static const sTreeList_t NodeEntry_FREQuencySEGMent[] = {
  319. //
  320. // // create ':MEMory:TABLe:FREQuency:SEGMent:DATA' query, link @CommandEntryMEMoryTABLeFREQuencySEGMentDATA entry
  321. // DECLARE_TREE_LIST_CLEAF( "DATA", &CommandEntryMEMoryTABLeFREQuencySEGMentDATA ),
  322. //
  323. // DECLARE_TREE_LIST_LAST() // end-of-list
  324. //};
  325. //// @CommandEntryMEMoryTABLeDATA
  326. //// :MEMory:TABLe:DATA? command entry
  327. //static const sScpiCommandHandlerEntry_t CommandEntryMEMoryTABLeDATA = {
  328. // .entry = { &fsqvbl_CommandHandlerMemoryTableData }, // connect the MemoryTableData handler
  329. // .ctx = NULL
  330. //};
  331. //
  332. //// @NodeEntry_FREQuency
  333. //// "MEMory:TABLe:FREQuency:" command node
  334. //static const sTreeList_t NodeEntry_FREQuency[] = {
  335. //
  336. // // create ':MEMory:TABLe:FREQuency:SEGMent' sub-system for SCPI
  337. // DECLARE_TREE_LIST_CNODE( "SEGMent", NodeEntry_FREQuencySEGMent ),
  338. //
  339. // // create ':MEMory:TABLe:FREQ:STAR query, link @CommandEntryMEMoryTABLeFREQuencySTARt entry
  340. // DECLARE_TREE_LIST_CLEAF( "STARt", &CommandEntryMEMoryTABLeFREQuencySTARt ),
  341. //
  342. // // create ':MEMory:TABLe:FREQ:STOP query, link @CommandEntryMEMoryTABLeFREQuencySTOP entry
  343. // DECLARE_TREE_LIST_CLEAF( "STOP", &CommandEntryMEMoryTABLeFREQuencySTOP ),
  344. //
  345. // // create ':MEMory:TABLe:FREQ:TYPE query, link @CommandEntryMEMoryTABLeFREQuencyTYPE entry
  346. // DECLARE_TREE_LIST_CLEAF( "TYPE", &CommandEntryMEMoryTABLeFREQuencyTYPE ),
  347. //
  348. // // create ':MEMory:TABLe:FREQuency:DATA' query, link @CommandEntryMEMoryTABLeFREQuencyDATA entry
  349. // DECLARE_TREE_LIST_CLEAF( "DATA", &CommandEntryMEMoryTABLeFREQuencyDATA ),
  350. //
  351. // DECLARE_TREE_LIST_LAST() // end-of-list
  352. //};
  353. //// @NodeEntry_CORRectionFREQuency
  354. //// "MEMory:TABLe:THERmo:CORRection:FREQuency:" command node
  355. //static const sTreeList_t NodeEntry_CORRectionFREQuency[] = {
  356. //
  357. // // create ':MEMory:TABLe:FREQ:STAR query, link @CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTARt entry
  358. // DECLARE_TREE_LIST_CLEAF( "STARt", &CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTARt ),
  359. //
  360. // // create ':MEMory:TABLe:FREQ:STOP query, link @CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTOP entry
  361. // DECLARE_TREE_LIST_CLEAF( "STOP", &CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencySTOP ),
  362. //
  363. // DECLARE_TREE_LIST_LAST() // end-of-list
  364. //};
  365. //// @NodeEntry_CORRection
  366. //// "MEMory:TABLe:THERmo:CORRection:" command node
  367. //static const sTreeList_t NodeEntry_CORRection[] = {
  368. //
  369. //// // create ':MEMory:TABLe:THERmo:CORRection:FREQuency:' sub-system for SCPI
  370. //// DECLARE_TREE_LIST_CNODE( "FREQuency", NodeEntry_CORRectionFREQuency ),
  371. ////
  372. //// // create ':MEMory:TABLe:FREQ:POINts query, link @CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencyPOINts entry
  373. //// DECLARE_TREE_LIST_CLEAF( "POINts", &CommandEntryMEMoryTABLeTHERmoCORRectionFREQuencyPOINts ),
  374. ////
  375. //// // create ':MEMory:TABLe:FREQ:MAGNitude query, link @CommandEntryMEMoryTABLeTHERmoCORRectionMAGNitude entry
  376. //// DECLARE_TREE_LIST_CLEAF( "MAGNitude", &CommandEntryMEMoryTABLeTHERmoCORRectionMAGNitude ),
  377. ////
  378. //// // create ':MEMory:TABLe:FREQ:PHASe query, link @CommandEntryMEMoryTABLeTHERmoCORRectionPHASe entry
  379. //// DECLARE_TREE_LIST_CLEAF( "PHASe", &CommandEntryMEMoryTABLeTHERmoCORRectionPHASe ),
  380. //
  381. // DECLARE_TREE_LIST_LAST() // end-of-list
  382. //};
  383. //// @NodeEntry_THERmo
  384. //// "MEMory:TABLe:THERmo:" command node
  385. //static const sTreeList_t NodeEntry_THERmo[] = {
  386. //
  387. // // create ':MEMory:TABLe:THERmo:CORRection:' sub-system for SCPI
  388. // DECLARE_TREE_LIST_CNODE( "CORRection", NodeEntry_CORRection ),
  389. //
  390. // DECLARE_TREE_LIST_LAST() // end-of-list
  391. //};
  392. //// @NodeEntry_TABLe
  393. //// ":TABLE:" command node
  394. //static const sTreeList_t NodeEntry_TABLe[] = {
  395. //
  396. //// // create ':MEMory:TABLe:FREQuency:' sub-system for SCPI
  397. //// DECLARE_TREE_LIST_CNODE( "FREQuency", NodeEntry_FREQuency ),
  398. ////
  399. //// // create ':MEMory:TABLe:THERmo:' sub-system for SCPI
  400. //// DECLARE_TREE_LIST_CNODE( "THERmo", NodeEntry_THERmo ),
  401. ////
  402. //// // create ':MEMory:TABLe:ADAPter' query, link @CommandEntryMEMoryTABLeADAPter entry
  403. //// DECLARE_TREE_LIST_CLEAF( "ADAPter", &CommandEntryMEMoryTABLeADAPter ),
  404. ////
  405. //// // create ':MEMory:TABLe:CONNector' query, link @CommandEntryMEMoryTABLeCONNector entry
  406. //// DECLARE_TREE_LIST_CLEAF( "CONNector", &CommandEntryMEMoryTABLeCONNector ),
  407. ////
  408. //// // create ':MEMory:TABLe:ANALyzer' query, link @CommandEntryMEMoryTABLeANALyzer entry
  409. //// DECLARE_TREE_LIST_CLEAF( "ANALyzer", &CommandEntryMEMoryTABLeANALyzer ),
  410. ////
  411. //// // create ':MEMory:TABLe:DATE' query, link @CommandEntryMEMoryTABLeDATE entry
  412. //// DECLARE_TREE_LIST_CLEAF( "DATE", &CommandEntryMEMoryTABLeDATE ),
  413. ////
  414. //// // create ':MEMory:TABLe:OPERator' query, link @CommandEntryMEMoryTABLeOPERator entry
  415. //// DECLARE_TREE_LIST_CLEAF( "OPERator", &CommandEntryMEMoryTABLeOPERator ),
  416. ////
  417. //// // create ':MEMory:TABLe:PLACe' query, link @CommandEntryMEMoryTABLePLACe entry
  418. //// DECLARE_TREE_LIST_CLEAF( "PLACe", &CommandEntryMEMoryTABLePLACe ),
  419. ////
  420. //// // create ':MEMory:TABLe:POINts' query, link @CommandEntryMEMoryTABLePOINts entry
  421. //// DECLARE_TREE_LIST_CLEAF( "POINts", &CommandEntryMEMoryTABLePOINts ),
  422. ////
  423. //// // create ':MEMory:TABLe:TEMPerature' query, link @CommandEntryMEMoryTABLeTEMPerature entry
  424. //// DECLARE_TREE_LIST_CLEAF( "TEMPerature", &CommandEntryMEMoryTABLeTEMPerature ),
  425. ////
  426. //// // create ':MEMory:TABLe:TIME' query, link @CommandEntryMEMoryTABLeTIME entry
  427. //// DECLARE_TREE_LIST_CLEAF( "TIME", &CommandEntryMEMoryTABLeTIME ),
  428. ////
  429. //// // create ':MEMory:TABLe:DATA' query, link @CommandEntryMEMoryTABLeDATA entry
  430. //// DECLARE_TREE_LIST_CLEAF( "DATA", &CommandEntryMEMoryTABLeDATA ),
  431. //
  432. // DECLARE_TREE_LIST_LAST() // end-of-list
  433. //};
  434. //// @scpi_cmd_memory
  435. //// "MEM:" command node
  436. //static const sTreeList_t NodeEntry_MEMory[] = {
  437. //
  438. // // create ':MEMory:TABLe:' sub-system for SCPI
  439. // DECLARE_TREE_LIST_CNODE( "TABLe", NodeEntry_TABLe ),
  440. //
  441. // DECLARE_TREE_LIST_LAST() // end-of-list
  442. //};
  443. // @CommandEntrySystemError
  444. // [:SYSTem]:ERRor? command entry
  445. static const sScpiCommandHandlerEntry_t CommandEntrySystemError = {
  446. .entry = { &fsqvbl_CommandHandlerSystemError }, // connect the SYSTem:ERRor handler
  447. .ctx = NULL
  448. };
  449. // @CommandEntrySystemVersion
  450. // [:SYSTem]:VERSion? command entry
  451. static const sScpiCommandHandlerEntry_t CommandEntrySystemVersion = {
  452. .entry = { &fsqvbl_CommandHandlerSystemVersion }, // connect the SYSTem:VERSion handler
  453. .ctx = NULL
  454. };
  455. //// @CommandEntryMeasureInternalTemperature
  456. //// MEASure:TEMPerature:INTernal? command entry
  457. //static const sScpiCommandHandlerEntry_t CommandEntryMeasureIntTemperature = {
  458. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the MEASure:TEMPerature handler
  459. // .ctx = &fsqvbl_CommandHandlerMeasurementInternalTemperature // grouped handler context
  460. //};
  461. //
  462. //// @CommandEntryMeasureExternalTemperature
  463. //// MEASure:TEMPerature:EXTernal? command entry
  464. //static const sScpiCommandHandlerEntry_t CommandEntryMeasureExtTemperature = {
  465. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the MEASure:TEMPerature handler
  466. // .ctx = &fsqvbl_CommandHandlerMeasurementExternalTemperature // grouped handler context
  467. //};
  468. //
  469. //// @CommandEntryMeasureExternalTemperature
  470. //// MEASure:TEMPerature:EXTernal? command entry
  471. //static const sScpiCommandHandlerEntry_t CommandEntryMeasureExtTempCoefficient = {
  472. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the MEASure:TEMPerature handler
  473. // .ctx = &fsqvbl_CommandHandlerMeasurementTempCoefficient // grouped handler context
  474. //};
  475. //
  476. //// @CommandEntryGainCount
  477. //// [:SYSTEM]:GAIN:COUNt? command entry
  478. //static const sScpiCommandHandlerEntry_t CommandEntryGainCount = {
  479. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the SWITch:COUNt handler
  480. // .ctx = &fsqvbl_CommandHandlerAmpSwitchCount // grouped handler context
  481. //};
  482. //
  483. //// @CommandEntryFiltCount
  484. //// [:SYSTEM]:FILT:COUNt? command entry
  485. //static const sScpiCommandHandlerEntry_t CommandEntryFiltCount = {
  486. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group },
  487. // .ctx = &fsqvbl_CommandHandlerFiltSwitchCount
  488. //};
  489. //
  490. //// @CommandEntrySwitchList
  491. //// [:SYSTEM]:AMP:SWITch:LIST? command entry
  492. //static const sScpiCommandHandlerEntry_t CommandEntryAmpSwitchList = {
  493. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the SWITch:LIST handler
  494. // .ctx = &fsqvbl_CommandHandlerAmpSwitchList // grouped handler context
  495. //};
  496. //
  497. //static const sScpiCommandHandlerEntry_t CommandEntryFiltList = {
  498. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the SWITch:LIST handler
  499. // .ctx = &fsqvbl_CommandHandlerFiltSwitchList // grouped handler context
  500. //};
  501. //// @CommandEntrySwitchList
  502. //// [:SYSTEM]:FLIT:SWITch:LIST? command entry
  503. //static const sScpiCommandHandlerEntry_t CommandEntryFiltSwitchList = {
  504. // .entry = { &fsqvbl_CommandHandlerMEASnSWITCH_group }, // connect the SWITch:LIST handler
  505. // .ctx = &fsqvbl_CommandHandlerFiltSwitchList // grouped handler context
  506. //};
  507. //// @CommandEntrySwitchState
  508. //// [:SYSTEM]:GAIN:STATe? command entry
  509. //static const sScpiCommandHandlerEntry_t CommandEntrySwitchState = {
  510. // .entry = { &fsqvbl_CommandHandlerSERVice }, // connect the SWITch:STATe handler
  511. // .ctx = &fsqvbl_CommandHandlerServiceState
  512. //};
  513. //
  514. //// @CommandEntrySwitchState
  515. //// [:SYSTEM]:BAND:STATe? command entry
  516. //static const sScpiCommandHandlerEntry_t CommandEntrySwitchBandState = {
  517. // .entry = { &fsqvbl_CommandHandlerSERVice }, // connect the SWITch:STATe handler
  518. // .ctx = &fsqvbl_CommandHandlerSwitchSerial
  519. //};
  520. // @CommandEntryInterfaceSwitch
  521. // :INTerface:SWitch? command entry
  522. static const sScpiCommandHandlerEntry_t CommandEntryInterfaceSwitch = {
  523. .entry = { &fsqvbl_CommandHandlerInterfaceSwitch }, // connect the :INTerface:SWitch handler
  524. .ctx = NULL // grouped handler context
  525. };
  526. //// @CommandEntryMeasureInternalTemperature
  527. //// Power:VEXTernal? command entry
  528. //static const sScpiCommandHandlerEntry_t CommandEntryExternalPower = {
  529. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:VEXT handler
  530. // .ctx = &fsqvbl_CommandHandlerPowerVExternal // grouped handler context
  531. //};
  532. //
  533. //// @CommandEntryMeasureInternalTemperature
  534. //// Power:VBUS? command entry
  535. //static const sScpiCommandHandlerEntry_t CommandEntryVBUSPower = {
  536. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:VBUS handler
  537. // .ctx = &fsqvbl_CommandHandlerPowerVBUS // grouped handler context
  538. //};
  539. //
  540. //// @CommandEntryMeasureInternalTemperature
  541. //// Power:EXT? command entry
  542. //static const sScpiCommandHandlerEntry_t CommandEntryEXTPower = {
  543. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:EXT handler
  544. // .ctx = &fsqvbl_CommandHandlerPowerEXTernal // grouped handler context
  545. //};
  546. //
  547. //// @CommandEntryMeasureInternalTemperature
  548. //// Power:EXT? command entry
  549. //static const sScpiCommandHandlerEntry_t CommandEntryMeasPower = {
  550. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:MEASurement handler
  551. // .ctx = &fsqvbl_CommandHandlerPowerMeasurement // grouped handler context
  552. //};
  553. //
  554. //// @CommandEntryMeasureInternalTemperature
  555. //// Power:AMPlifier:AMP1? command entry
  556. //static const sScpiCommandHandlerEntry_t CommandEntryAMP1Power = {
  557. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:AMPlifier:AMP1 handler
  558. // .ctx = &fsqvbl_CommandHandlerPowerAMPlifier1 // grouped handler context
  559. //};
  560. //
  561. //// @CommandEntryMeasureInternalTemperature
  562. //// Power:AMPlifier:AMP2? command entry
  563. //static const sScpiCommandHandlerEntry_t CommandEntryAMP2Power = {
  564. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:AMPlifier:AMP2 handler
  565. // .ctx = &fsqvbl_CommandHandlerPowerAMPlifier2 // grouped handler context
  566. //};
  567. //
  568. //// @CommandEntryMeasureInternalTemperature
  569. //// Power:AMPlifier:AMP3? command entry
  570. //static const sScpiCommandHandlerEntry_t CommandEntryAMP3Power = {
  571. // .entry = { &fsqvbl_CommandHandlerPowerSWITCH_group }, // connect the POWer:AMPlifier:AMP3 handler
  572. // .ctx = &fsqvbl_CommandHandlerPowerAMPlifier3 // grouped handler context
  573. //};
  574. //
  575. //// @CommandEntryMeasureInternalTemperature
  576. //// INDication:WRMP? command entry
  577. //static const sScpiCommandHandlerEntry_t CommandEntryWRMP = {
  578. // .entry = { &fsqvbl_CommandHandlerLEDSWITCH_group }, // connect the POWer:VBUS handler
  579. // .ctx = &fsqvbl_CommandHandlerWRMP // grouped handler context
  580. //};
  581. //
  582. //// @CommandEntryMeasureInternalTemperature
  583. //// INDication:LED:LED1? command entry
  584. //static const sScpiCommandHandlerEntry_t CommandEntryLED1 = {
  585. // .entry = { &fsqvbl_CommandHandlerLEDSWITCH_group }, // connect the POWer:VBUS handler
  586. // .ctx = &fsqvbl_CommandHandlerLED1 // grouped handler context
  587. //};
  588. //
  589. //// @CommandEntryMeasureInternalTemperature
  590. //// INDication:LED:LED1? command entry
  591. //static const sScpiCommandHandlerEntry_t CommandEntryLED2 = {
  592. // .entry = { &fsqvbl_CommandHandlerLEDSWITCH_group }, // connect the POWer:VBUS handler
  593. // .ctx = &fsqvbl_CommandHandlerLED2 // grouped handler context
  594. //};
  595. // @CommandEntryTableAddPnts
  596. // TABle:ADD
  597. static const sScpiCommandHandlerEntry_t CommandEntryTableAddPnts = {
  598. .entry = { &fsqvbl_CommandHandlerTable_group }, // connect the TABLe:ADD handler
  599. .ctx = &fsqvbl_CommandHandlerTableMatrixAddPoints // grouped handler context
  600. };
  601. // @CommandEntryTableRemPnts
  602. // TABle:CLR
  603. static const sScpiCommandHandlerEntry_t CommandEntryTableClearTable = {
  604. .entry = { &fsqvbl_CommandHandlerTable_group }, // connect the TABLe:REM handler
  605. .ctx = &fsqvbl_CommandHandlerTableMatrixClear // grouped handler context
  606. };
  607. // @CommandEntryTableDone
  608. // TABle:DONE
  609. static const sScpiCommandHandlerEntry_t CommandEntryTableDone = {
  610. .entry = { &fsqvbl_CommandHandlerTable_group }, // connect the TABLe:DONE handler
  611. .ctx = &fsqvbl_CommandHandlerTableMatrixDone // grouped handler context
  612. };
  613. // @CommandEntryTableEdit
  614. // TABle:EDIT
  615. static const sScpiCommandHandlerEntry_t CommandEntryTableEdit = {
  616. .entry = { &fsqvbl_CommandHandlerTable_group }, // connect the TABLe:EDIT handler
  617. .ctx = &fsqvbl_CommandHandlerTableMatrixEdit // grouped handler context
  618. };
  619. // @CommandEntryTableGet
  620. // TABle:GET
  621. static const sScpiCommandHandlerEntry_t CommandEntryTableGet = {
  622. .entry = { &fsqvbl_CommandHandlerTable_group }, // connect the TABLe:GET handler
  623. .ctx = &fsqvbl_CommandHandlerTableMatrixGet // grouped handler context
  624. };
  625. // @CommandEntryPORT
  626. // CTRL:SET:SW
  627. static const sScpiCommandHandlerEntry_t CommandEntryPortSet = {
  628. .entry = { &fsqvbl_CommandHandlerCtrl_group }, // connect the CTRL:SW
  629. .ctx = &fsqvbl_CommandHandlerSwCtrl // grouped handler context
  630. };
  631. // @CommandEntryMeasStart
  632. // MEAS:START
  633. static const sScpiCommandHandlerEntry_t CommandEntryMeasStart = {
  634. .entry = { &fsqvbl_CommandHandlerCtrl_group }, // connect the MEAS:START
  635. .ctx = &fsqvbl_CommandHandlerMeasStart // grouped handler context
  636. };
  637. // @CommandEntryMeasStop
  638. // MEAS:STOP
  639. static const sScpiCommandHandlerEntry_t CommandEntryMeasStop = {
  640. .entry = { &fsqvbl_CommandHandlerCtrl_group }, // connect the MEAS:STOP
  641. .ctx = &fsqvbl_CommandHandlerMeasStop // grouped handler context
  642. };
  643. // @CommandEntryMeasContinue
  644. // MEAS:CONTinue
  645. static const sScpiCommandHandlerEntry_t CommandEntryMeasCont = {
  646. .entry = { &fsqvbl_CommandHandlerCtrl_group }, // connect the MEAS:CONT
  647. .ctx = &fsqvbl_CommandHandlerMeasCont // grouped handler context
  648. };
  649. // @CommandEntryMeasMode
  650. // MEAS:MODE
  651. static const sScpiCommandHandlerEntry_t CommandEntryMeasMode = {
  652. .entry = { &fsqvbl_CommandHandlerCtrl_group }, // connect the MEAS:MODE
  653. .ctx = &fsqvbl_CommandHandlerMeasMode // grouped handler context
  654. };
  655. // @CommandEntryTRIGger
  656. // TRIGger:POLARity
  657. static const sScpiCommandHandlerEntry_t CommandEntryTriggerPolarity = {
  658. .entry = { &fsqvbl_CommandHandlerTRIGgerSTATe_group }, // connect the TRIG:POLARity
  659. .ctx = &fsqvbl_CommandHandlerTriggerPolarity // grouped handler context
  660. };
  661. // @CommandEntryTRIGger
  662. // TRIGger:COUNter
  663. static const sScpiCommandHandlerEntry_t CommandEntryTriggerCounter = {
  664. .entry = { &fsqvbl_CommandHandlerTRIGgerSTATe_group }, // connect the TRIG:POLARity
  665. .ctx = &fsqvbl_CommandHandlerTriggerCounter // grouped handler context
  666. };
  667. // @CommandEntrySERVice
  668. // SERVice:STATE
  669. static const sScpiCommandHandlerEntry_t CommandEntryServiceState = {
  670. .entry = { &fsqvbl_CommandHandlerSERVice_group }, // connect the SERVice:STATE
  671. .ctx = &fsqvbl_CommandHandlerServiceState // grouped handler context
  672. };
  673. // @CommandEntrySERVice
  674. // SERVice:SERIAL
  675. static const sScpiCommandHandlerEntry_t CommandEntryServiceSerial = {
  676. .entry = { &fsqvbl_CommandHandlerSERVice_group }, // connect the SERVice:SERIAL
  677. .ctx = &fsqvbl_CommandHandlerSwitchSerial // grouped handler context
  678. };
  679. // @CommandEntrySERVice
  680. // SERVice:MODEL
  681. static const sScpiCommandHandlerEntry_t CommandEntryServiceModel = {
  682. .entry = { &fsqvbl_CommandHandlerSERVice_group }, // connect the SERVice:MODEL
  683. .ctx = &fsqvbl_CommandHandlerSwitchModel // grouped handler context
  684. };
  685. // @CommandEntrySERVice
  686. // SERVice:REBOOT?
  687. static const sScpiCommandHandlerEntry_t CommandEntryServiceReboot = {
  688. .entry = { &fsqvbl_CommandHandlerSERVice_group }, // connect the SERVice:REBOOT
  689. .ctx = &fsqvbl_CommandHandlerServiceReboot // grouped handler context
  690. };
  691. //// @NodeEntry_Amp_SWITch
  692. //// "[:SYSTEM]:AMP:SWITch:" command node
  693. //static const sTreeList_t NodeEntry_AMP[] = {
  694. //
  695. // // create '[:SYSTEM]:GAIN:COUNt' query, link @CommandEntryGainCount
  696. // DECLARE_TREE_LIST_CLEAF( "COUNt", &CommandEntryGainCount ),
  697. //
  698. // // create '[:SYSTEM]:GAIN:LIST' query, link @CommandEntrySwitchList
  699. // DECLARE_TREE_LIST_CLEAF( "LIST", &CommandEntryAmpSwitchList ),
  700. //
  701. // // create '[:SYSTEM]:GAIN:STATe' command/query, link @CommandEntrySwitchState
  702. // DECLARE_TREE_LIST_CLEAF( "STATe", &CommandEntrySwitchState ),
  703. //
  704. // DECLARE_TREE_LIST_LAST() // end-of-list
  705. //};
  706. //
  707. //static const sTreeList_t NodeEntry_FILT[] = {
  708. // // create '[:SYSTEM]:FILT:COUNt' query, link @CommandEntryFiltCount
  709. // DECLARE_TREE_LIST_CLEAF( "COUNt", &CommandEntryFiltCount ),
  710. //
  711. // // create '[:SYSTEM]:FILT:LIST' query, link @CommandEntrySwitchList
  712. // DECLARE_TREE_LIST_CLEAF( "LIST", &CommandEntryFiltList ),
  713. //
  714. // // create '[:SYSTEM]:FILT:STATe' command/query, link @CommandEntrySwitchState
  715. // DECLARE_TREE_LIST_CLEAF( "STATe", &CommandEntrySwitchBandState ),
  716. //
  717. // DECLARE_TREE_LIST_LAST() // end-of-list
  718. //};
  719. //
  720. //// @NodeEntry_TEMP
  721. //// "[:SYSTEM]:MEAS:TEMPerature:" command node
  722. //static const sTreeList_t NodeEntry_TEMP[] = {
  723. //
  724. // // create 'MEASure:TEMP:INTernal' query, link @CommandEntryMeasureIntTemperature
  725. // DECLARE_TREE_LIST_CLEAF( "INTernal", &CommandEntryMeasureIntTemperature ),
  726. //
  727. // // create 'MEASure:TEMP:EXTernal' query, link @CommandEntryMeasureExtTemperature
  728. // DECLARE_TREE_LIST_CLEAF( "EXTernal", &CommandEntryMeasureExtTemperature ),
  729. //
  730. // // create 'MEASure:TEMP:TCOEFficient' query, link @CommandEntrySwitchList
  731. // DECLARE_TREE_LIST_CLEAF( "TCOEFficient", &CommandEntryMeasureExtTempCoefficient ),
  732. //
  733. // DECLARE_TREE_LIST_LAST() // end-of-list
  734. //};
  735. //
  736. //// @NodeEntry_AMPlifier
  737. //// "POWer:AMPlifier:AMP:" command node
  738. //static const sTreeList_t NodeEntry_AMPlifier[] = {
  739. //
  740. // // create 'MEASure:TEMP:INTernal' query, link @CommandEntryMeasureIntTemperature
  741. // DECLARE_TREE_LIST_CLEAF( "AMP1", &CommandEntryAMP1Power ),
  742. //
  743. // // create 'MEASure:TEMP:EXTernal' query, link @CommandEntryMeasureExtTemperature
  744. // DECLARE_TREE_LIST_CLEAF( "AMP2", &CommandEntryAMP2Power ),
  745. //
  746. // // create 'MEASure:TEMP:TCOEFficient' query, link @CommandEntrySwitchList
  747. // DECLARE_TREE_LIST_CLEAF( "AMP3", &CommandEntryAMP3Power ),
  748. //
  749. // DECLARE_TREE_LIST_LAST() // end-of-list
  750. //};
  751. //
  752. //// @NodeEntry_LED
  753. //// "INDication:LED:LED[1,2]" command node
  754. //static const sTreeList_t NodeEntry_LED[] = {
  755. //
  756. // // create 'MEASure:TEMP:INTernal' query, link @CommandEntryMeasureIntTemperature
  757. // DECLARE_TREE_LIST_CLEAF( "LED1", &CommandEntryLED1 ),
  758. //
  759. // // create 'MEASure:TEMP:EXTernal' query, link @CommandEntryMeasureExtTemperature
  760. // DECLARE_TREE_LIST_CLEAF( "LED2", &CommandEntryLED2 ),
  761. //
  762. // DECLARE_TREE_LIST_LAST() // end-of-list
  763. //};
  764. static const sTreeList_t NodeEntry_CONTrol[] = {
  765. // create ':CTRL:SW' query, link @CommandEntryPortSet
  766. DECLARE_TREE_LIST_CLEAF( "SW", &CommandEntryPortSet ),
  767. DECLARE_TREE_LIST_LAST() // end-of-list
  768. };
  769. static const sTreeList_t NodeEntry_MEASure[] = {
  770. // create ':MEAS:START' query, link @CommandEntryMeasStart
  771. DECLARE_TREE_LIST_CLEAF( "START", &CommandEntryMeasStart ),
  772. // create ':MEAS:STOP' query, link @CommandEntryMeasStop
  773. DECLARE_TREE_LIST_CLEAF( "STOP", &CommandEntryMeasStop ),
  774. // create ':MEAS:CONTinue' query, link @CommandEntryMeasCont
  775. DECLARE_TREE_LIST_CLEAF( "CONTinue", &CommandEntryMeasCont ),
  776. // create ':MEAS:MODE' query, link @CommandEntryMeasMode
  777. DECLARE_TREE_LIST_CLEAF( "MODE", &CommandEntryMeasMode ),
  778. DECLARE_TREE_LIST_LAST() // end-of-list
  779. };
  780. static const sTreeList_t NodeEntry_TRIGger[] = {
  781. // create ':TRIGger:POLARity' query, link @CommandEntryTRIGgerPolarity
  782. DECLARE_TREE_LIST_CLEAF( "POLarity", &CommandEntryTriggerPolarity ),
  783. // create ':TRIGger:POLARity' query, link @CommandEntryTRIGgerPolarity
  784. DECLARE_TREE_LIST_CLEAF( "COUNter", &CommandEntryTriggerCounter ),
  785. DECLARE_TREE_LIST_LAST() // end-of-list
  786. };
  787. static const sTreeList_t NodeEntry_SERVice[] = {
  788. // create 'SERVice:STATE' query, link @CommandEntryServiceState
  789. DECLARE_TREE_LIST_CLEAF( "STATE", &CommandEntryServiceState ),
  790. // create 'SERVice:SERIAL' query, link @CommandEntryServiceSerial
  791. DECLARE_TREE_LIST_CLEAF( "SERIAL", &CommandEntryServiceSerial ),
  792. // create 'SERVice:MODEL' query, link @CommandEntryServiceModel
  793. DECLARE_TREE_LIST_CLEAF( "MODEL", &CommandEntryServiceModel ),
  794. // create 'SERVice:REBOOT?' query, link @CommandEntryServiceREBOOT
  795. DECLARE_TREE_LIST_CLEAF( "REBOOT", &CommandEntryServiceReboot ),
  796. DECLARE_TREE_LIST_LAST() // end-of-list
  797. };
  798. static const sTreeList_t NodeEntry_TABle[] = {
  799. // create 'TABLe:ADD:' query, link @CommandEntryTableAdd...
  800. DECLARE_TREE_LIST_CLEAF( "ADD", &CommandEntryTableAddPnts ),
  801. // create 'TABLe:CLR:' query, link @CommandEntryTableRemove...
  802. DECLARE_TREE_LIST_CLEAF( "CLR", &CommandEntryTableClearTable ),
  803. // create 'TABLe:DONE' query, link @CommandEntryTableDone
  804. DECLARE_TREE_LIST_CLEAF( "DONE", &CommandEntryTableDone ),
  805. // create 'TABLe:EDIT' query, link @CommandEntryTableEdit
  806. DECLARE_TREE_LIST_CLEAF( "EDIT", &CommandEntryTableEdit ),
  807. // create 'TABLe:GET' query, link @CommandEntryTableGet
  808. DECLARE_TREE_LIST_CLEAF( "GET", &CommandEntryTableGet ),
  809. DECLARE_TREE_LIST_LAST() // end-of-list
  810. };
  811. // @NodeEntry_SYSTem
  812. // ":SYSTem:" command node
  813. static const sTreeList_t NodeEntry_SYSTem[] = {
  814. // // create ':SYSTem:GAIN' sub-system command for SCPI
  815. // DECLARE_TREE_LIST_CNODE( "GAIN", NodeEntry_AMP ),
  816. //
  817. // create ':SYSTem:CTRL' sub-system command for SCPI
  818. DECLARE_TREE_LIST_CNODE( "CTRL", NodeEntry_CONTrol ),
  819. // create ':SYSTem:MEASure' sub-system command for SCPI
  820. DECLARE_TREE_LIST_CNODE( "MEASure", NodeEntry_MEASure ),
  821. // create ':SYSTem:TABLe' sub-system command for SCPI
  822. DECLARE_TREE_LIST_CNODE( "TABLe", NodeEntry_TABle ),
  823. // create ':SYSTem:TRIGger' sub-system command for SCPI
  824. DECLARE_TREE_LIST_CNODE( "TRIGger", NodeEntry_TRIGger ),
  825. // create ':SYSTem:SERVice' sub-system command for SCPI
  826. DECLARE_TREE_LIST_CNODE( "SERVice", NodeEntry_SERVice ),
  827. // create ':SYSTem:ERRor' query, link @CommandEntrySystemError
  828. DECLARE_TREE_LIST_CLEAF( "ERRor", &CommandEntrySystemError ),
  829. // create ':SYSTem:VERSion' query, link @CommandEntrySystemVersion
  830. DECLARE_TREE_LIST_CLEAF( "VERSion", &CommandEntrySystemVersion ),
  831. DECLARE_TREE_LIST_LAST() // end-of-list
  832. };
  833. //// @NodeEntry_MEASure
  834. //// ":MEASure:" command node
  835. //static const sTreeList_t NodeEntry_MEASure[] = {
  836. //
  837. // // create ':MEASure:TEMPerature' query, link @CommandEntryMeasureTemperature
  838. // //DECLARE_TREE_LIST_CLEAF( "TEMPerature", &CommandEntryMeasureTemperature ),
  839. // DECLARE_TREE_LIST_CNODE( "TEMPerature", NodeEntry_TEMP ),
  840. //
  841. // DECLARE_TREE_LIST_LAST() // end-of-list
  842. //};
  843. //
  844. //// @NodeEntry_POWer
  845. //// ":POWer:" command node
  846. //static const sTreeList_t NodeEntry_POWer[] = {
  847. //
  848. // DECLARE_TREE_LIST_CLEAF( "P28Voltage", &CommandEntryExternalPower ),
  849. //
  850. // // Development command list
  851. // DECLARE_TREE_LIST_CLEAF( "VBUS", &CommandEntryVBUSPower ),
  852. //
  853. // DECLARE_TREE_LIST_CLEAF( "EXTernal", &CommandEntryEXTPower ),
  854. //
  855. // DECLARE_TREE_LIST_CLEAF( "MEASurement", &CommandEntryMeasPower ),
  856. //
  857. // DECLARE_TREE_LIST_CNODE( "AMPlifier", NodeEntry_AMPlifier ),
  858. // // DECLARE_TREE_LIST_CLEAF( "AMPlifier", &CommandEntryMeasureIntTemperature ),
  859. //
  860. // DECLARE_TREE_LIST_LAST() // end-of-list
  861. //};
  862. //
  863. //// @NodeEntry_INDIcation
  864. //// ":INDIcation:" command node
  865. //static const sTreeList_t NodeEntry_INDication[] = {
  866. //
  867. // DECLARE_TREE_LIST_CNODE( "LED", NodeEntry_LED ),
  868. //
  869. // // Development command list
  870. // DECLARE_TREE_LIST_CLEAF( "WRMP", &CommandEntryWRMP ),
  871. //
  872. // DECLARE_TREE_LIST_LAST() // end-of-list
  873. //};
  874. // @NodeEntry_INTerface
  875. // ":INTerface:" command node
  876. static const sTreeList_t NodeEntry_INTerface[] = {
  877. // create ':INTerface:SWitch' query, link @CommandEntryInterfaceSwitch
  878. DECLARE_TREE_LIST_CLEAF( "SWitch", &CommandEntryInterfaceSwitch ),
  879. DECLARE_TREE_LIST_LAST() // end-of-list
  880. };
  881. // --------------------------------------------------------------------------------------------------------
  882. // @CommandEntryIDN
  883. // *IDN? command entry
  884. static const sScpiCommandHandlerEntry_t CommandEntryIDN = {
  885. .entry = { &fsqvbl_CommandHandlerIDN }, // connect the IDN handler
  886. .ctx = NULL
  887. };
  888. // @CommandEntryRST
  889. // *RST command entry
  890. static const sScpiCommandHandlerEntry_t CommandEntryRST = {
  891. .entry = { &fsqvbl_CommandHandlerRST }, // connect the RST handler
  892. .ctx = NULL
  893. };
  894. // @CommandEntryESR
  895. // *ESR command entry
  896. static const sScpiCommandHandlerEntry_t CommandEntryESR = {
  897. .entry = { &fsqvbl_CommandHandlerESRSTB }, // connect the ESR handler
  898. .ctx = &fsqvbl_CommandHandlerESR_context // grouped handler context
  899. };
  900. // @CommandEntrySTB
  901. // *STB command entry
  902. static const sScpiCommandHandlerEntry_t CommandEntrySTB = {
  903. .entry = { &fsqvbl_CommandHandlerESRSTB }, // connect the ESR handler
  904. .ctx = &fsqvbl_CommandHandlerSTB_context // grouped handler context
  905. };
  906. // @CommandEntryESE
  907. // *ESE command/query entry
  908. static const sScpiCommandHandlerEntry_t CommandEntryESE = {
  909. .entry = { &fsqvbl_CommandHandlerESESRE }, // connect the ESE handler
  910. .ctx = &fsqvbl_CommandHandlerESE_context // handler context
  911. };
  912. // @CommandEntrySRE
  913. // *SRE command/query entry
  914. static const sScpiCommandHandlerEntry_t CommandEntrySRE = {
  915. .entry = { &fsqvbl_CommandHandlerESESRE }, // connect the SRE handler
  916. .ctx = &fsqvbl_CommandHandlerSRE_context // handler context
  917. };
  918. // @CommandEntryCLS
  919. // *CLS command entry
  920. static const sScpiCommandHandlerEntry_t CommandEntryCLS = {
  921. .entry = { &fsqvbl_CommandHandlerCLS }, // connect the CLS handler
  922. .ctx = NULL
  923. };
  924. // @CommandEntryOPC
  925. // *OPC command entry
  926. static const sScpiCommandHandlerEntry_t CommandEntryOPC = {
  927. .entry = { &fsqvbl_CommandHandlerOPC }, // connect the CLS handler
  928. .ctx = NULL
  929. };
  930. // @CommandEntryTRG
  931. // *TRG command entry
  932. static const sScpiCommandHandlerEntry_t CommandEntryTRG = {
  933. .entry = { &fsqvbl_CommandHandlerTRG }, // connect the TRG handler
  934. .ctx = NULL
  935. };
  936. #if 0
  937. // @CommandEntryTEST
  938. // *TEST? command entry
  939. static const sScpiCommandHandlerEntry_t CommandEntryTEST = {
  940. .entry = { &fsqvbl_CommandHandlerTEST }, // connect the TEST handler
  941. .ctx = NULL
  942. };
  943. #endif
  944. // ========================================================================================================
  945. // @scpi_commands_root_list
  946. // Contains all supported commands and handlers as a tree.
  947. // Each group of commands shall be implemented as an external
  948. // ... array of sTreeList_t[] and referred by DECLARE_TREE_LIST_NODE.
  949. // Each command shall be implemented as a cell of array using
  950. // ... DECLARE_TREE_LIST_LEAF.
  951. // The command shall not contain question mark character in the
  952. // ... end for proper operation.
  953. // The command shall not contain colon character in the beginning
  954. // ... for proper operation.
  955. // The command can have either full and short forms in the
  956. // ... same entry while the leading UPPER case characters
  957. // ... of each mnemonic express the short form and the lower
  958. // ... case characters in the ending of each mnemonic express
  959. // ... the full form, e.g:
  960. // COMmand1:SUBCommand2 represents short form "COM:SUBC" and
  961. // ... the full one - "COMMAND1:SUBCOMMAND2".
  962. // Operator is free about of combining the forms of each mnemonic,
  963. // ... thus COMMAND1:SUBC is a valid command.
  964. static const sTreeList_t scpi_commands_root_list[] = {
  965. // create *IDN? command, link @CommandEntryIDN entry
  966. DECLARE_TREE_LIST_CLEAF( "*IDN", &CommandEntryIDN ),
  967. // create *RST command, link @CommandEntryRST entry
  968. DECLARE_TREE_LIST_CLEAF( "*RST", &CommandEntryRST ),
  969. // create *CLS command, link @CommandEntryRST entry
  970. DECLARE_TREE_LIST_CLEAF( "*CLS", &CommandEntryCLS ),
  971. // create *ESR? query, link @CommandEntryESR entry
  972. DECLARE_TREE_LIST_CLEAF( "*ESR", &CommandEntryESR ),
  973. // create *STB? query, link @CommandEntrySTB entry
  974. DECLARE_TREE_LIST_CLEAF( "*STB", &CommandEntrySTB ),
  975. // create *ESE command/query, link @CommandEntryESR entry
  976. DECLARE_TREE_LIST_CLEAF( "*ESE", &CommandEntryESE ),
  977. // create *SRE command/query, link @CommandEntrySRE entry
  978. DECLARE_TREE_LIST_CLEAF( "*SRE", &CommandEntrySRE ),
  979. // create *OPC command/query, link @CommandEntryOPC entry
  980. DECLARE_TREE_LIST_CLEAF( "*OPC", &CommandEntryOPC ),
  981. // create *TRG command/query, link @CommandEntryTRG entry
  982. DECLARE_TREE_LIST_CLEAF( "*TRG", &CommandEntryTRG ),
  983. #if 0
  984. // create *TEST? query, link @CommandEntryTEST entry
  985. DECLARE_TREE_LIST_CLEAF( "*TEST", &CommandEntryTEST ),
  986. #endif
  987. // create 'SYSTem' sub-system command for SCPI
  988. DECLARE_TREE_LIST_CNODE( "[SYSTem]", NodeEntry_SYSTem ),
  989. // // create 'SYSTem' sub-system command for SCPI
  990. // DECLARE_TREE_LIST_CNODE( "TABle", NodeEntry_TABle ),
  991. // // create ':MEMory' sub-system command for SCPI
  992. // DECLARE_TREE_LIST_CNODE( "MEMory", NodeEntry_MEMory ),
  993. // create ':MEASure' sub-system command for SCPI
  994. //DECLARE_TREE_LIST_CNODE( "MEASure", NodeEntry_MEASure ),
  995. // create ':POWer' sub-system command for SCPI
  996. //DECLARE_TREE_LIST_CNODE( "POWer", NodeEntry_POWer ),
  997. // create ':INDication' sub-system command for SCPI
  998. //DECLARE_TREE_LIST_CNODE( "INDIcation", NodeEntry_INDication ),
  999. // create ':INTerface' sub-system command for SCPI
  1000. DECLARE_TREE_LIST_CNODE( "INTerface",NodeEntry_INTerface ),
  1001. DECLARE_TREE_LIST_LAST() // end-of-list
  1002. };
  1003. // ========================================================================================================
  1004. // @scpi_commands_root_node
  1005. // Entire the supported SCPI commands tree (global root branch)
  1006. const sTreeList_t scpi_commands_root_node = DECLARE_TREE_LIST_CNODE( "/", scpi_commands_root_list );
  1007. // ========================================================================================================
  1008. void scpi_command_test()
  1009. {
  1010. const char * command = "*idn?"; // "MeMoRy:TABL:DATA?" "MeM:TABLe:DATA?"
  1011. const char * shead = command;
  1012. const char * stail = shead + strlen(command);
  1013. const sTreeList_t * branch = NULL;
  1014. const sScpiCommandHandlerEntry_t * cmd = scpiSearchCommandHandler( &branch, shead, stail, eScpiEntityTypeCmpQueryProgHdr, NULL, false );
  1015. (void)cmd;
  1016. asm( "bkpt #0" );
  1017. command = "mem:table:data?"; // "MeMoRy:TABL:DATA?" "MeM:TABLe:DATA?"
  1018. shead = command;
  1019. stail = shead + strlen(command);
  1020. cmd = scpiSearchCommandHandler( &branch, shead, stail, eScpiEntityTypeCmpQueryProgHdr, NULL, false );
  1021. (void)cmd;
  1022. asm( "bkpt #0" );
  1023. }