Lines Matching refs:rx_packet

23 				union r502a_packet *rx_packet, uint16_t data_len)  in transceive_packet()  argument
56 if (rx_packet) { in transceive_packet()
57 drv_data->rx_buf.data = rx_packet->buf; in transceive_packet()
70 static int r502a_validate_rx_packet(union r502a_packet *rx_packet) in r502a_validate_rx_packet() argument
75 if (sys_be16_to_cpu(rx_packet->start) == R502A_STARTCODE) { in r502a_validate_rx_packet()
76 LOG_DBG("startcode matched 0x%X", sys_be16_to_cpu(rx_packet->start)); in r502a_validate_rx_packet()
78 LOG_ERR("startcode didn't match 0x%X", sys_be16_to_cpu(rx_packet->start)); in r502a_validate_rx_packet()
82 if (sys_be32_to_cpu(rx_packet->addr) == R502A_DEFAULT_ADDRESS) { in r502a_validate_rx_packet()
83 LOG_DBG("Address matched 0x%X", sys_be32_to_cpu(rx_packet->addr)); in r502a_validate_rx_packet()
85 LOG_ERR("Address didn't match 0x%X", sys_be32_to_cpu(rx_packet->addr)); in r502a_validate_rx_packet()
89 switch (rx_packet->pid) { in r502a_validate_rx_packet()
91 LOG_DBG("Data Packet Received 0x%X", rx_packet->pid); in r502a_validate_rx_packet()
94 LOG_DBG("End of Data Packet Received 0x%X", rx_packet->pid); in r502a_validate_rx_packet()
97 LOG_DBG("Acknowledgment Packet Received 0x%X", rx_packet->pid); in r502a_validate_rx_packet()
100 LOG_ERR("Error Package ID 0x%X", rx_packet->pid); in r502a_validate_rx_packet()
104 cks_start_idx = sys_be16_to_cpu(rx_packet->len) - R502A_CHECKSUM_LEN; in r502a_validate_rx_packet()
106 recv_cks = sys_get_be16(&rx_packet->data[cks_start_idx]); in r502a_validate_rx_packet()
108 calc_cks += rx_packet->pid + (sys_be16_to_cpu(rx_packet->len) >> 8) + in r502a_validate_rx_packet()
109 (sys_be16_to_cpu(rx_packet->len) & 0xFF); in r502a_validate_rx_packet()
112 calc_cks += rx_packet->data[i]; in r502a_validate_rx_packet()
189 union r502a_packet rx_packet = {0}; in fps_set_sys_param() local
198 ret = transceive_packet(dev, &tx_packet, &rx_packet, set_sys_param_len); in fps_set_sys_param()
203 ret = r502a_validate_rx_packet(&rx_packet); in fps_set_sys_param()
208 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_set_sys_param()
211 LOG_ERR("R502A set system parameter error %d", rx_packet.buf[R502A_CC_IDX]); in fps_set_sys_param()
222 union r502a_packet rx_packet = {0}; in r502a_read_sys_param() local
233 ret = transceive_packet(dev, &tx_packet, &rx_packet, read_sys_param_len); in r502a_read_sys_param()
238 ret = r502a_validate_rx_packet(&rx_packet); in r502a_read_sys_param()
243 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in r502a_read_sys_param()
246 LOG_ERR("R502A read system parameter error %d", rx_packet.buf[R502A_CC_IDX]); in r502a_read_sys_param()
252 &rx_packet.data[offsetof(struct r502a_sys_param, status_reg) + 1] in r502a_read_sys_param()
255 &rx_packet.data[offsetof(struct r502a_sys_param, system_id) + 1] in r502a_read_sys_param()
258 &rx_packet.data[offsetof(struct r502a_sys_param, lib_size) + 1] in r502a_read_sys_param()
261 &rx_packet.data[offsetof(struct r502a_sys_param, sec_level) + 1] in r502a_read_sys_param()
264 &rx_packet.data[offsetof(struct r502a_sys_param, addr) + 1] in r502a_read_sys_param()
267 &rx_packet.data[offsetof(struct r502a_sys_param, data_pkt_size) + 1] in r502a_read_sys_param()
271 &rx_packet.data[offsetof(struct r502a_sys_param, baud) + 1] in r502a_read_sys_param()
281 union r502a_packet rx_packet = {0}; in fps_led_control() local
291 ret = transceive_packet(dev, &tx_packet, &rx_packet, led_ctrl_len); in fps_led_control()
296 ret = r502a_validate_rx_packet(&rx_packet); in fps_led_control()
301 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_led_control()
305 LOG_ERR("R502A LED control error %d", rx_packet.buf[R502A_CC_IDX]); in fps_led_control()
314 union r502a_packet rx_packet = {0}; in fps_verify_password() local
325 ret = transceive_packet(dev, &tx_packet, &rx_packet, verify_pwd_len); in fps_verify_password()
330 ret = r502a_validate_rx_packet(&rx_packet); in fps_verify_password()
335 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_verify_password()
338 LOG_ERR("Password verification error 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_verify_password()
348 union r502a_packet rx_packet = {0}; in fps_get_template_count() local
357 ret = transceive_packet(dev, &tx_packet, &rx_packet, get_temp_cnt_len); in fps_get_template_count()
362 ret = r502a_validate_rx_packet(&rx_packet); in fps_get_template_count()
367 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_get_template_count()
369 drv_data->template_count = sys_get_be16(&rx_packet.data[1]); in fps_get_template_count()
382 union r502a_packet rx_packet = {0}; in fps_read_template_table() local
393 ret = transceive_packet(dev, &tx_packet, &rx_packet, temp_table_len); in fps_read_template_table()
398 ret = r502a_validate_rx_packet(&rx_packet); in fps_read_template_table()
403 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_read_template_table()
412 uint8_t group = rx_packet.data[group_idx + 1]; in fps_read_template_table()
430 union r502a_packet rx_packet = {0}; in fps_get_image() local
446 ret = transceive_packet(dev, &tx_packet, &rx_packet, get_img_len); in fps_get_image()
451 ret = r502a_validate_rx_packet(&rx_packet); in fps_get_image()
456 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_get_image()
463 LOG_ERR("Error getting image 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_get_image()
472 union r502a_packet rx_packet = {0}; in fps_image_to_char() local
481 ret = transceive_packet(dev, &tx_packet, &rx_packet, img_to_char_len); in fps_image_to_char()
486 ret = r502a_validate_rx_packet(&rx_packet); in fps_image_to_char()
491 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_image_to_char()
494 LOG_ERR("Error converting image 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_image_to_char()
503 union r502a_packet rx_packet = {0}; in fps_create_model() local
512 ret = transceive_packet(dev, &tx_packet, &rx_packet, create_model_len); in fps_create_model()
517 ret = r502a_validate_rx_packet(&rx_packet); in fps_create_model()
522 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_create_model()
525 LOG_ERR("Error creating model 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_create_model()
535 union r502a_packet rx_packet = {0}; in fps_store_model() local
554 ret = transceive_packet(dev, &tx_packet, &rx_packet, store_model_len); in fps_store_model()
559 ret = r502a_validate_rx_packet(&rx_packet); in fps_store_model()
564 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_store_model()
571 LOG_ERR("Error storing model 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_store_model()
582 union r502a_packet rx_packet = {0}; in fps_delete_model() local
595 ret = transceive_packet(dev, &tx_packet, &rx_packet, delete_model_len); in fps_delete_model()
600 ret = r502a_validate_rx_packet(&rx_packet); in fps_delete_model()
605 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_delete_model()
608 LOG_ERR("Error deleting image 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_delete_model()
619 union r502a_packet rx_packet = {0}; in fps_empty_db() local
630 ret = transceive_packet(dev, &tx_packet, &rx_packet, empty_db_len); in fps_empty_db()
635 ret = r502a_validate_rx_packet(&rx_packet); in fps_empty_db()
640 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_empty_db()
644 rx_packet.buf[R502A_CC_IDX]); in fps_empty_db()
656 union r502a_packet rx_packet = {0}; in fps_search() local
676 ret = transceive_packet(dev, &tx_packet, &rx_packet, search_len); in fps_search()
681 ret = r502a_validate_rx_packet(&rx_packet); in fps_search()
686 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_search()
691 val->val1 = sys_get_be16(&rx_packet.data[1]); in fps_search()
692 val->val2 = sys_get_be16(&rx_packet.data[3]); in fps_search()
694 } else if (rx_packet.buf[R502A_CC_IDX] == R502A_NOT_FOUND_CC) { in fps_search()
705 LOG_ERR("Error searching for image 0x%X", rx_packet.buf[R502A_CC_IDX]); in fps_search()
716 union r502a_packet rx_packet = {0}; in fps_load_template() local
728 ret = transceive_packet(dev, &tx_packet, &rx_packet, load_tmp_len); in fps_load_template()
733 ret = r502a_validate_rx_packet(&rx_packet); in fps_load_template()
738 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_load_template()
742 rx_packet.buf[R502A_CC_IDX]); in fps_load_template()
754 union r502a_packet rx_packet = {0}; in fps_match_templates() local
772 ret = transceive_packet(dev, &tx_packet, &rx_packet, match_templates_len); in fps_match_templates()
777 ret = r502a_validate_rx_packet(&rx_packet); in fps_match_templates()
782 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_match_templates()
785 val->val2 = sys_get_be16(&rx_packet.data[1]); in fps_match_templates()
787 } else if (rx_packet.buf[R502A_CC_IDX] == R502A_NOT_MATCH_CC) { in fps_match_templates()
796 rx_packet.buf[R502A_CC_IDX]); in fps_match_templates()
842 union r502a_packet rx_packet = {0}; in fps_upload_char_buf() local
858 ret = transceive_packet(dev, &tx_packet, &rx_packet, upload_temp_len); in fps_upload_char_buf()
863 ret = r502a_validate_rx_packet(&rx_packet); in fps_upload_char_buf()
868 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_upload_char_buf()
872 rx_packet.buf[R502A_CC_IDX]); in fps_upload_char_buf()
878 ret = transceive_packet(dev, NULL, &rx_packet, 0); in fps_upload_char_buf()
883 ret = r502a_validate_rx_packet(&rx_packet); in fps_upload_char_buf()
888 memcpy(&temp->data[idx], &rx_packet.data, in fps_upload_char_buf()
889 sys_be16_to_cpu(rx_packet.len) - R502A_CHECKSUM_LEN); in fps_upload_char_buf()
890 idx += sys_be16_to_cpu(rx_packet.len) - R502A_CHECKSUM_LEN; in fps_upload_char_buf()
891 } while (rx_packet.pid != R502A_END_DATA_PACKET); in fps_upload_char_buf()
909 union r502a_packet rx_packet = {0}; in fps_download_char_buf() local
925 ret = transceive_packet(dev, &tx_packet, &rx_packet, down_temp_len); in fps_download_char_buf()
930 ret = r502a_validate_rx_packet(&rx_packet); in fps_download_char_buf()
935 if (rx_packet.buf[R502A_CC_IDX] == R502A_OK) { in fps_download_char_buf()
939 rx_packet.buf[R502A_CC_IDX]); in fps_download_char_buf()