2 * This file is part of the sigrok project.
4 * Copyright (C) 2011 Daniel Ribeiro <drwyrm@gmail.com>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
15 /* our private per-instance data */
21 // uint8_t num_sample_rates;
25 uint16_t offset_range;
32 uint8_t dso_probe_attn;
34 uint8_t trigger_slope;
35 uint8_t trigger_spimode;
36 uint8_t trigger_outsrc;
37 uint8_t trigger_state;
39 uint8_t la_trigger_mask;
40 double dso_trigger_voltage;
41 uint16_t dso_trigger_width;
48 #define mso_trans(a, v) \
49 (((v) & 0x3f) | (((v) & 0xc0) << 6) | (((a) & 0xf) << 8) | \
50 ((~(v) & 0x20) << 1) | ((~(v) & 0x80) << 7))
52 const char mso_head[] = { 0x40, 0x4c, 0x44, 0x53, 0x7e };
53 const char mso_foot[] = { 0x7e };
58 #define REG_CLKRATE1 9
59 #define REG_CLKRATE2 10
65 #define BIT_CTL_RESETFSM (1 << 0)
66 #define BIT_CTL_ARM (1 << 1)
67 #define BIT_CTL_ADC_UNKNOWN4 (1 << 4) /* adc enable? */
68 #define BIT_CTL_RESETADC (1 << 6)
69 #define BIT_CTL_LED (1 << 7)
77 static struct rate_map rate_map[] = {
78 { MHZ(200), 0x0205, 0 },
79 { MHZ(100), 0x0105, 0 },
80 { MHZ(50), 0x0005, 0 },
81 { MHZ(20), 0x0303, 0 },
82 { MHZ(10), 0x0308, 0 },
83 { MHZ(5), 0x030c, 0 },
84 { MHZ(2), 0x0330, 0 },
85 { MHZ(1), 0x0362, 0 },
86 { KHZ(500), 0x03c6, 0 },
87 { KHZ(200), 0x07f2, 0 },
88 { KHZ(100), 0x0fe6, 0 },
89 { KHZ(50), 0x1fce, 0 },
90 { KHZ(20), 0x4f86, 0 },
91 { KHZ(10), 0x9f0e, 0 },
92 { KHZ(5), 0x03c7, 0x20 },
93 { KHZ(2), 0x07f3, 0x20 },
94 { KHZ(1), 0x0fe7, 0x20 },
95 { 500, 0x1fcf, 0x20 },
96 { 200, 0x4f87, 0x20 },
97 { 100, 0x9f0f, 0x20 },
100 /* FIXME: Determine corresponding voltages */
101 uint16_t la_threshold_map[] = {