hw/hantek-6022be/$(dirstamp) \
hw/hantek-6022bl/$(dirstamp) \
hw/sainsmart-dds120/$(dirstamp) \
- hw/yixingdianzi-mdso/$(dirstamp)
+ hw/yixingdianzi-mdso/$(dirstamp) \
+ hw/instrustar-isds205b/$(dirstamp)
# Final firmware files
firmware_binaries = \
hw/hantek-6022be/fx2lafw-hantek-6022be.fw \
hw/hantek-6022bl/fx2lafw-hantek-6022bl.fw \
hw/sainsmart-dds120/fx2lafw-sainsmart-dds120.fw \
- hw/yixingdianzi-mdso/fx2lafw-yixingdianzi-mdso.fw
+ hw/yixingdianzi-mdso/fx2lafw-yixingdianzi-mdso.fw \
+ hw/instrustar-isds205b/fx2lafw-instrustar-isds205b.fw
fx2lafw_headers = \
include/command.h \
hantek_6022bl_sources = hw/hantek-6022bl/fw.c
hantek_6022bl_objects = hw/hantek-6022bl/fw.rel
+instrustar_isds205b_headers = $(scope_headers)
+instrustar_isds205b_sources = hw/instrustar-isds205b/fw.c
+instrustar_isds205b_objects = hw/instrustar-isds205b/fw.rel
+
sainsmart_dds120_headers = $(scope_headers)
sainsmart_dds120_sources = hw/sainsmart-dds120/fw.c
sainsmart_dds120_objects = hw/sainsmart-dds120/fw.rel
hw/hantek-6022be/dscr.a51 \
hw/hantek-6022bl/dscr.a51 \
hw/sainsmart-dds120/dscr.a51 \
- hw/yixingdianzi-mdso/dscr.a51
+ hw/yixingdianzi-mdso/dscr.a51 \
+ hw/instrustar-isds205b/dscr.a51
firmwaredir = $(datadir)/sigrok-firmware
firmware_DATA = $(firmware_binaries)
$(hantek_6022bl_headers) $(hantek_6022bl_sources) \
$(sainsmart_dds120_sources) $(sainsmart_dds120_headers) \
$(yixingdianzi_mdso_sources) $(yixingdianzi_mdso_headers) \
+ $(instrustar_isds205b_headers) $(instrustar_isds205b_sources) \
$(fx2lib_headers) $(fx2lib_sources) $(fx2lib_ints_sources) $(hw_sources)
dist_noinst_SCRIPTS = autogen.sh
$(hantek_6022be_objects): $(hantek_6022be_headers)
$(fx2lib_objects): fx2lib/lib/$(dirstamp) $(fx2lib_headers)
$(fx2lib_ints_objects): fx2lib/lib/interrupts/$(dirstamp) $(fx2lib_headers)
+$(instrustar_isds205b_objects): $(instrustar_isds205b_headers)
hw/braintechnology-usb-lps/dscr.rel: hw/braintechnology-usb-lps/$(dirstamp) include/dscr.inc
hw/cwav-usbeeax/dscr.rel: hw/cwav-usbeeax/$(dirstamp) include/dscr.inc
hw/hantek-6022bl/dscr.rel: hw/hantek-6022bl/$(dirstamp) include/dscr_scope.inc
hw/sainsmart-dds120/dscr.rel: hw/sainsmart-dds120/$(dirstamp) include/dscr_scope.inc
hw/yixingdianzi-mdso/dscr.rel: hw/yixingdianzi-mdso/$(dirstamp) include/dscr_scope.inc
+hw/instrustar-isds205b/dscr.rel: hw/instrustar-isds205b/$(dirstamp) include/dscr_scope.inc
# Create build subdirectories
hw/hantek-6022bl/fx2lafw-hantek-6022bl.ihx: hw/hantek-6022bl/dscr.rel $(hantek_6022bl_objects) $(fx2lib_libs)
$(AM_V_GEN)$(SDCC) -mmcs51 $(SDCC_LINK_FLAGS_SCOPE) -o $@ hw/hantek-6022bl/dscr.rel $(hantek_6022bl_objects) $(fx2lib_libs)
+hw/instrustar-isds205b/fx2lafw-instrustar-isds205b.ihx: hw/instrustar-isds205b/dscr.rel $(instrustar_isds205b_objects) $(fx2lib_libs)
+ $(AM_V_GEN)$(SDCC) -mmcs51 $(SDCC_LINK_FLAGS_SCOPE) -o $@ hw/instrustar-isds205b/dscr.rel $(instrustar_isds205b_objects) $(fx2lib_libs)
+
hw/sainsmart-dds120/fx2lafw-sainsmart-dds120.ihx: hw/sainsmart-dds120/dscr.rel $(sainsmart_dds120_objects) $(fx2lib_libs)
$(AM_V_GEN)$(SDCC) -mmcs51 $(SDCC_LINK_FLAGS_SCOPE) -o $@ hw/sainsmart-dds120/dscr.rel $(sainsmart_dds120_objects) $(fx2lib_libs)
--- /dev/null
+;;
+;; This file is part of the sigrok-firmware-fx2lafw project.
+;;
+;; Copyright (C) 2016 Uwe Hermann <uwe@hermann-uwe.de>
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+;;
+
+VID = 0x501d ; Manufacturer ID (0x1d50)
+PID = 0x8e60 ; Product ID (0x608e)
+VER = 0x0500 ; Product "version". 0x0005 == Instrustar ISDS205B.
+
+.include "dscr_scope.inc"
+string_descriptor_a 3,^"Instrustar ISDS205B"
+_dev_strings_end:
+ .dw 0x0000
--- /dev/null
+/*
+ * This file is part of the sigrok-firmware-fx2lafw project.
+ *
+ * Copyright (C) 2009 Ubixum, Inc.
+ * Copyright (C) 2015 Jochen Hoenicke
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <fx2macros.h>
+#include <fx2ints.h>
+#include <autovector.h>
+#include <delay.h>
+#include <setupdat.h>
+
+#define SET_ANALOG_MODE() do { PA7 = 1; } while (0)
+
+#define SET_COUPLING(x) set_coupling_isds205(x)
+
+#define SET_CALIBRATION_PULSE(x)
+
+#define TOGGLE_CALIBRATION_PIN() do { PA0 = !PA0; } while (0)
+
+#define LED_CLEAR() NOP
+#define LED_GREEN()
+#define LED_RED()
+
+#define TIMER2_VAL 500
+
+/* CTLx pin index (IFCLK, ADC clock input). */
+#define CTL_BIT 0
+
+#define OUT0 ((1 << CTL_BIT) << 4) /* OEx = 1, CTLx = 0 */
+
+#define SRCLK PA6
+#define SRIN PA4
+#define STOCLK PA5
+
+volatile BYTE vol_state = 0 ; /* ISDS205C uses 74HC595 to expand ports, here we save his actual state. */
+
+static void drive_74hc595(BYTE bits)
+{
+ BYTE i;
+
+ for(i = 0; i < 8; i++)
+ {
+ SRCLK = 0;
+ SRIN = bits >> 7;
+ SRCLK = 1;
+ bits = bits << 1;
+ }
+ STOCLK = 1;
+ STOCLK = 0;
+}
+
+static const struct samplerate_info samplerates[] = {
+ { 48, 0x80, 0, 3, 0, 0x00, 0xea },
+ { 30, 0x80, 0, 3, 0, 0x00, 0xaa },
+ { 24, 1, 0, 2, 1, OUT0, 0xca },
+ { 16, 1, 1, 2, 0, OUT0, 0xca },
+ { 12, 2, 1, 2, 0, OUT0, 0xca },
+ { 8, 3, 2, 2, 0, OUT0, 0xca },
+ { 4, 6, 5, 2, 0, OUT0, 0xca },
+ { 2, 12, 11, 2, 0, OUT0, 0xca },
+ { 1, 24, 23, 2, 0, OUT0, 0xca },
+ { 50, 48, 47, 2, 0, OUT0, 0xca },
+ { 20, 120, 119, 2, 0, OUT0, 0xca },
+ { 10, 240, 239, 2, 0, OUT0, 0xca },
+};
+
+/*
+ * This sets three bits for each channel, one channel at a time.
+ * For channel 0 we want to set bits 0, 1 & 6
+ * For channel 1 we want to set bits 2, 3 & 4
+ *
+ * We directly set the relevant bits for both channels and then
+ * we mask them out to only affect the channel currently requested.
+ */
+static BOOL set_voltage(BYTE channel, BYTE val)
+{
+ BYTE bits, mask;
+
+ switch (val) {
+ case 1:
+ bits = 0b00001001;
+ break;
+ case 2:
+ bits = 0b00000110;
+ break;
+ case 5:
+ bits = 0b00000000;
+ break;
+ case 10:
+ bits = 0b01010110;
+ break;
+ case 11:
+ bits = 0b01010000;
+ break;
+ case 12:
+ bits = 0b01011111;
+ break;
+ default:
+ return FALSE;
+ }
+
+ mask = (channel) ? 0b00011100 : 0b01000011;
+ vol_state = (vol_state & ~mask) | (bits & mask);
+
+ drive_74hc595(vol_state);
+
+ return TRUE;
+}
+
+/**
+ * Bits 5 & 7 of the byte controls the coupling per channel.
+ *
+ * Setting bit 7 enables AC coupling relay on CH0.
+ * Setting bit 5 enables AC coupling relay on CH1.
+ */
+static void set_coupling_isds205(BYTE coupling_cfg)
+{
+ if (coupling_cfg & 0x01)
+ vol_state &= ~0x80;
+ else
+ vol_state |= 0x80;
+
+ if (coupling_cfg & 0x10)
+ vol_state &= ~0x20;
+ else
+ vol_state |= 0x20;
+
+ drive_74hc595(vol_state);
+}
+
+#include <scope.inc>