Jan Breuer
2013-10-21 1c02f18e5b718da36a5d78d29434fea282c67cc4
Custom IDN; correct system:version?
7个文件已修改
48 ■■■■ 已修改文件
examples/common/scpi-def.c 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/common/scpi-def.cpp 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/constants.h 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/inc/scpi/types.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/ieee488.c 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/minimal.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/parser.c 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/common/scpi-def.c
@@ -193,4 +193,5 @@
    .registers = scpi_regs,
    .units = scpi_units_def,
    .special_numbers = scpi_special_numbers_def,
    .idn = {"MANUFACTURE", "INSTR2013", NULL, "01-02"},
};
examples/common/scpi-def.cpp
@@ -172,5 +172,6 @@
    /* units */ scpi_units_def,
    /* special_numbers */ scpi_special_numbers_def,
    /* user_context */ NULL,
    /* idn */ {"MANUFACTURE", "INSTR2013", NULL, "01-02"},
};
libscpi/inc/scpi/constants.h
@@ -42,9 +42,19 @@
#endif
#define SCPI_MANUFACTURE "CTU FEE"
#define SCPI_DEV_NAME "TEST SCPI INSTRUMENT TSI3225"
#define SCPI_DEV_VERSION "v1.0"
/*  4.1.3.6 *IDN? */
#define SCPI_DEFAULT_1_MANUFACTURE "CTU FEE"
#define SCPI_DEFAULT_2_MODEL "TSI3225"
#define SCPI_DEFAULT_3 "0"
#define SCPI_DEFAULT_4_REVISION "01-01"
/* 21.21 :VERSion?
 * YYYY.V
 * YYYY = SCPI year
 * V = SCPI revision
 */
#define SCPI_STD_VERSION_REVISION "1999.0"
#ifdef    __cplusplus
}
libscpi/inc/scpi/types.h
@@ -208,6 +208,7 @@
        const scpi_unit_def_t * units;
        const scpi_special_number_def_t * special_numbers;
        void * user_context;
        const char * idn[4];
    };
#ifdef  __cplusplus
libscpi/src/ieee488.c
@@ -240,13 +240,20 @@
/**
 * *IDN?
 *
 * field1: MANUFACTURE
 * field2: MODEL
 * field4: SUBSYSTEMS REVISIONS
 *
 * example: MANUFACTURE,MODEL,0,01-02-01
 * @param context
 * @return 
 */
scpi_result_t SCPI_CoreIdnQ(scpi_t * context) {
    SCPI_ResultString(context, SCPI_MANUFACTURE);
    SCPI_ResultString(context, SCPI_DEV_NAME);
    SCPI_ResultString(context, SCPI_DEV_VERSION);
    SCPI_ResultString(context, context->idn[0]);
    SCPI_ResultString(context, context->idn[1]);
    SCPI_ResultString(context, context->idn[2]);
    SCPI_ResultString(context, context->idn[3]);
    return SCPI_RES_OK;
}
libscpi/src/minimal.c
@@ -67,7 +67,7 @@
 * @return 
 */
scpi_result_t SCPI_SystemVersionQ(scpi_t * context) {
    SCPI_ResultString(context, SCPI_DEV_VERSION);
    SCPI_ResultString(context, SCPI_STD_VERSION_REVISION);
    return SCPI_RES_OK;
}
libscpi/src/parser.c
@@ -41,6 +41,7 @@
#include "scpi/parser.h"
#include "utils.h"
#include "scpi/error.h"
#include "scpi/constants.h"
static size_t cmdTerminatorPos(const char * cmd, size_t len);
@@ -285,6 +286,19 @@
 * @param interface
 */
void SCPI_Init(scpi_t * context) {
    if (context->idn[0] == NULL) {
        context->idn[0] = SCPI_DEFAULT_1_MANUFACTURE;
    }
    if (context->idn[1] == NULL) {
        context->idn[1] = SCPI_DEFAULT_2_MODEL;
    }
    if (context->idn[2] == NULL) {
        context->idn[2] = SCPI_DEFAULT_3;
    }
    if (context->idn[3] == NULL) {
        context->idn[3] = SCPI_DEFAULT_4_REVISION;
    }
    context->buffer.position = 0;
    SCPI_ErrorInit(context);
}