MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / receive_data

Function receive_data

libsigrok4DSL/hardware/DSL/dscope.c:1910–1961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1908}
1909
1910static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
1911{
1912 int completed = 0;
1913 struct timeval tv;
1914 struct drv_context *drvc;
1915 struct DSL_context *devc;
1916 struct ctl_rd_cmd rd_cmd;
1917 struct sr_usb_dev_inst *usb;
1918 int ret;
1919
1920 (void)fd;
1921 (void)revents;
1922
1923 drvc = di->priv;
1924 devc = sdi->priv;
1925 usb = sdi->conn;
1926
1927 tv.tv_sec = tv.tv_usec = 0;
1928 libusb_handle_events_timeout_completed(drvc->sr_ctx->libusb_ctx, &tv, &completed);
1929
1930 if (devc->trf_completed)
1931 devc->empty_poll_count = 0;
1932 else
1933 devc->empty_poll_count++;
1934
1935 if (devc->zero && devc->trf_completed) {
1936 dso_zero(sdi, FALSE);
1937 }
1938 if (devc->tune && devc->trf_completed) {
1939 dso_tune(sdi);
1940 }
1941
1942 // progress check
1943 if ((devc->empty_poll_count > MAX_EMPTY_POLL) && (devc->status == DSL_START)) {
1944 devc->mstatus.captured_cnt0 = 0;
1945 rd_cmd.header.dest = DSL_CTL_I2C_STATUS;
1946 rd_cmd.header.offset = 0;
1947 rd_cmd.header.size = 4;
1948 rd_cmd.data = (unsigned char*)&devc->mstatus;
1949 if ((ret = command_ctl_rd(usb->devhdl, rd_cmd)) != SR_OK)
1950 sr_err("Failed to get progress infos.");
1951
1952 devc->empty_poll_count = 0;
1953 }
1954
1955 if (devc->status == DSL_FINISH) {
1956 remove_sources(devc);
1957 }
1958
1959 devc->trf_completed = 0;
1960 return TRUE;
1961}
1962
1963static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
1964{

Callers

nothing calls this directly

Calls 4

dso_zeroFunction · 0.85
dso_tuneFunction · 0.85
command_ctl_rdFunction · 0.85
remove_sourcesFunction · 0.70

Tested by

no test coverage detected