X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Flibsigrok-internal.h;h=0dfacbce1f09188fde9b0e0dca99893a277b7ff1;hb=bf5c4d46f8453f810b6f7615d2c16c9f752f9246;hp=df2b038e0bc34809f5b69e25c5f27dc3524ea974;hpb=7c8ae47dcb3ba2e31a377da9624a7b07a41694b3;p=libsigrok.git diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index df2b038e..0dfacbce 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -731,6 +731,9 @@ struct sr_serial_dev_inst; #ifdef HAVE_SERIAL_COMM struct ser_lib_functions; struct ser_hid_chip_functions; +struct sr_bt_desc; +typedef void (*serial_rx_chunk_callback)(struct sr_serial_dev_inst *serial, + void *cb_data, const void *buf, size_t count); struct sr_serial_dev_inst { /** Port name, e.g. '/dev/tty42'. */ char *port; @@ -744,6 +747,8 @@ struct sr_serial_dev_inst { int stop_bits; } comm_params; GString *rcv_buffer; + serial_rx_chunk_callback rx_chunk_cb_func; + void *rx_chunk_cb_data; #ifdef HAVE_LIBSERIALPORT /** libserialport port handle */ struct sp_port *sp_data; @@ -762,6 +767,25 @@ struct sr_serial_dev_inst { hid_device *hid_dev; GSList *hid_source_args; #endif +#ifdef HAVE_BLUETOOTH + enum ser_bt_conn_t { + SER_BT_CONN_UNKNOWN, /**!< place holder */ + SER_BT_CONN_RFCOMM, /**!< BT classic, RFCOMM channel */ + SER_BT_CONN_BLE122, /**!< BLE, BLE122 module, indications */ + SER_BT_CONN_NRF51, /**!< BLE, Nordic nRF51, notifications */ + SER_BT_CONN_CC254x, /**!< BLE, TI CC254x, notifications */ + SER_BT_CONN_MAX, /**!< sentinel */ + } bt_conn_type; + char *bt_addr_local; + char *bt_addr_remote; + size_t bt_rfcomm_channel; + uint16_t bt_notify_handle_read; + uint16_t bt_notify_handle_write; + uint16_t bt_notify_handle_cccd; + uint16_t bt_notify_value_cccd; + struct sr_bt_desc *bt_desc; + GSList *bt_source_args; +#endif }; #endif @@ -1139,6 +1163,8 @@ SR_PRIV int serial_read_blocking(struct sr_serial_dev_inst *serial, void *buf, size_t count, unsigned int timeout_ms); SR_PRIV int serial_read_nonblocking(struct sr_serial_dev_inst *serial, void *buf, size_t count); +SR_PRIV int serial_set_read_chunk_cb(struct sr_serial_dev_inst *serial, + serial_rx_chunk_callback cb, void *cb_data); SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate, int bits, int parity, int stopbits, int flowcontrol, int rts, int dtr); SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial, @@ -1149,7 +1175,7 @@ SR_PRIV int serial_stream_detect(struct sr_serial_dev_inst *serial, uint8_t *buf, size_t *buflen, size_t packet_size, packet_valid_callback is_valid, - uint64_t timeout_ms, int baudrate); + uint64_t timeout_ms); SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_device, const char **serial_options); SR_PRIV int serial_source_add(struct sr_session *session, @@ -1197,6 +1223,8 @@ struct ser_lib_functions { extern SR_PRIV struct ser_lib_functions *ser_lib_funcs_libsp; SR_PRIV int ser_name_is_hid(struct sr_serial_dev_inst *serial); extern SR_PRIV struct ser_lib_functions *ser_lib_funcs_hid; +SR_PRIV int ser_name_is_bt(struct sr_serial_dev_inst *serial); +extern SR_PRIV struct ser_lib_functions *ser_lib_funcs_bt; #ifdef HAVE_LIBHIDAPI struct vid_pid_item { @@ -1591,21 +1619,26 @@ SR_PRIV int sr_vc96_parse(const uint8_t *buf, float *floatval, /*--- lcr/es51919.c ---------------------------------------------------------*/ -SR_PRIV void es51919_serial_clean(void *priv); -SR_PRIV struct sr_dev_inst *es51919_serial_scan(GSList *options, - const char *vendor, - const char *model); -SR_PRIV int es51919_serial_config_get(uint32_t key, GVariant **data, - const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg); -SR_PRIV int es51919_serial_config_set(uint32_t key, GVariant *data, - const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg); -SR_PRIV int es51919_serial_config_list(uint32_t key, GVariant **data, - const struct sr_dev_inst *sdi, - const struct sr_channel_group *cg); -SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi); -SR_PRIV int es51919_serial_acquisition_stop(struct sr_dev_inst *sdi); +/* Acquisition details which apply to all supported serial-lcr devices. */ +struct lcr_parse_info { + size_t ch_idx; + uint64_t output_freq; + const char *circuit_model; +}; + +#define ES51919_PACKET_SIZE 17 +#define ES51919_CHANNEL_COUNT 2 +#define ES51919_COMM_PARAM "9600/8n1/rts=1/dtr=1" + +SR_PRIV int es51919_config_get(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); +SR_PRIV int es51919_config_set(uint32_t key, GVariant *data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); +SR_PRIV int es51919_config_list(uint32_t key, GVariant **data, + const struct sr_dev_inst *sdi, const struct sr_channel_group *cg); +SR_PRIV gboolean es51919_packet_valid(const uint8_t *pkt); +SR_PRIV int es51919_packet_parse(const uint8_t *pkt, float *floatval, + struct sr_datafeed_analog *analog, void *info); /*--- dmm/ut372.c -----------------------------------------------------------*/ @@ -1704,8 +1737,10 @@ SR_PRIV int sr_kern_parse(const uint8_t *buf, float *floatval, struct sr_sw_limits { uint64_t limit_samples; + uint64_t limit_frames; uint64_t limit_msec; uint64_t samples_read; + uint64_t frames_read; uint64_t start_time; }; @@ -1717,6 +1752,8 @@ SR_PRIV void sr_sw_limits_acquisition_start(struct sr_sw_limits *limits); SR_PRIV gboolean sr_sw_limits_check(struct sr_sw_limits *limits); SR_PRIV void sr_sw_limits_update_samples_read(struct sr_sw_limits *limits, uint64_t samples_read); +SR_PRIV void sr_sw_limits_update_frames_read(struct sr_sw_limits *limits, + uint64_t frames_read); SR_PRIV void sr_sw_limits_init(struct sr_sw_limits *limits); #endif