• Home
  • Raw
  • Download

Lines Matching refs:frame

73 	struct pms7003_frame frame;  member
111 struct pms7003_frame *frame = &state->frame; in pms7003_trigger_handler() local
122 pms7003_get_pm(frame->data + PMS7003_PM1_OFFSET); in pms7003_trigger_handler()
124 pms7003_get_pm(frame->data + PMS7003_PM2P5_OFFSET); in pms7003_trigger_handler()
126 pms7003_get_pm(frame->data + PMS7003_PM10_OFFSET); in pms7003_trigger_handler()
142 struct pms7003_frame *frame = &state->frame; in pms7003_read_raw() local
156 *val = pms7003_get_pm(frame->data + chan->address); in pms7003_read_raw()
194 static u16 pms7003_calc_checksum(struct pms7003_frame *frame) in pms7003_calc_checksum() argument
197 (frame->length >> 8) + (u8)frame->length; in pms7003_calc_checksum()
200 for (i = 0; i < frame->length - PMS7003_CHECKSUM_LENGTH; i++) in pms7003_calc_checksum()
201 checksum += frame->data[i]; in pms7003_calc_checksum()
206 static bool pms7003_frame_is_okay(struct pms7003_frame *frame) in pms7003_frame_is_okay() argument
208 int offset = frame->length - PMS7003_CHECKSUM_LENGTH; in pms7003_frame_is_okay()
209 u16 checksum = get_unaligned_be16(frame->data + offset); in pms7003_frame_is_okay()
211 return checksum == pms7003_calc_checksum(frame); in pms7003_frame_is_okay()
219 struct pms7003_frame *frame = &state->frame; in pms7003_receive_buf() local
222 if (!frame->expected_length) { in pms7003_receive_buf()
235 frame->expected_length = num; in pms7003_receive_buf()
236 frame->length = 0; in pms7003_receive_buf()
242 num = min(size, (size_t)(frame->expected_length - frame->length)); in pms7003_receive_buf()
243 memcpy(frame->data + frame->length, buf, num); in pms7003_receive_buf()
244 frame->length += num; in pms7003_receive_buf()
246 if (frame->length == frame->expected_length) { in pms7003_receive_buf()
247 if (pms7003_frame_is_okay(frame)) in pms7003_receive_buf()
250 frame->expected_length = 0; in pms7003_receive_buf()