Lines Matching refs:num
46 size_t num; member
57 priv->num = 0; in sps30_serial_xfer()
122 static unsigned char sps30_serial_calc_chksum(const unsigned char *buf, size_t num) in sps30_serial_calc_chksum() argument
127 for (i = 0; i < num; i++) in sps30_serial_calc_chksum()
137 int num = 0; in sps30_serial_prep_frame() local
140 buf[num++] = SPS30_SERIAL_SOF_EOF; in sps30_serial_prep_frame()
141 buf[num++] = 0; in sps30_serial_prep_frame()
142 num += sps30_serial_put_byte(buf + num, cmd); in sps30_serial_prep_frame()
143 num += sps30_serial_put_byte(buf + num, arg_size); in sps30_serial_prep_frame()
146 num += sps30_serial_put_byte(buf + num, arg[i]); in sps30_serial_prep_frame()
149 chksum = sps30_serial_calc_chksum(buf + 1, num - 1); in sps30_serial_prep_frame()
150 num += sps30_serial_put_byte(buf + num, chksum); in sps30_serial_prep_frame()
151 buf[num++] = SPS30_SERIAL_SOF_EOF; in sps30_serial_prep_frame()
153 return num; in sps30_serial_prep_frame()
161 if ((priv->num < SPS30_SERIAL_FRAME_MIN_SIZE) || in sps30_serial_frame_valid()
162 (priv->num != SPS30_SERIAL_FRAME_MIN_SIZE + in sps30_serial_frame_valid()
181 chksum = sps30_serial_calc_chksum(priv->buf + 1, priv->num - 3); in sps30_serial_frame_valid()
182 if (priv->buf[priv->num - 2] != chksum) { in sps30_serial_frame_valid()
233 if (!priv->num && size && buf[0] != SPS30_SERIAL_SOF_EOF) in sps30_serial_receive_buf()
236 if (priv->num + size >= ARRAY_SIZE(priv->buf)) in sps30_serial_receive_buf()
237 size = ARRAY_SIZE(priv->buf) - priv->num; in sps30_serial_receive_buf()
251 priv->buf[priv->num++] = byte; in sps30_serial_receive_buf()
255 if (priv->num < SPS30_SERIAL_FRAME_MIN_SIZE) in sps30_serial_receive_buf()
298 static int sps30_serial_read_meas(struct sps30_state *state, __be32 *meas, size_t num) in sps30_serial_read_meas() argument
306 ret = sps30_serial_command(state, SPS30_SERIAL_READ_MEAS, NULL, 0, meas, num * sizeof(num)); in sps30_serial_read_meas()
312 if (ret != num * sizeof(*meas)) in sps30_serial_read_meas()