Lines Matching refs:hal

143 	hal_proto_init(&h->hal, trans, flags);  in v3hil_init()
151 return hal_proto_execute(&h->hal, HAL_PROTO_FID_SET_VCC, data, 2); in v3hil_set_vcc()
159 if (hal_proto_send(&h->hal, HAL_PROTO_TYPE_EXCEPTION, NULL, 0) < 0) in v3hil_comm_init()
162 if (hal_proto_execute(&h->hal, 0, &ver_payload, 1) < 0) in v3hil_comm_init()
164 if (h->hal.length < 8) { in v3hil_comm_init()
167 const uint8_t major = h->hal.payload[1] >> 6; in v3hil_comm_init()
168 const uint8_t minor = h->hal.payload[1] & 0x3f; in v3hil_comm_init()
169 const uint8_t patch = h->hal.payload[0]; in v3hil_comm_init()
170 const uint16_t flavour = r16le(h->hal.payload + 2); in v3hil_comm_init()
174 r32le(h->hal.payload + 4)); in v3hil_comm_init()
178 if (hal_proto_execute(&h->hal, in v3hil_comm_init()
190 if (hal_proto_execute(&h->hal, HAL_PROTO_FID_START_JTAG, in v3hil_start_jtag()
194 if (!h->hal.length) { in v3hil_start_jtag()
199 if (!h->hal.payload[0]) { in v3hil_start_jtag()
204 printc_dbg("Device count: %d\n", h->hal.payload[0]); in v3hil_start_jtag()
205 return hal_proto_execute(&h->hal, HAL_PROTO_FID_SET_DEVICE_CHAIN_INFO, in v3hil_start_jtag()
211 return hal_proto_execute(&h->hal, HAL_PROTO_FID_STOP_JTAG, NULL, 0); in v3hil_stop_jtag()
241 if (hal_proto_execute(&h->hal, in v3hil_sync()
248 if (h->hal.length < 8) { in v3hil_sync()
249 printc_err("v3hil: short reply: %d\n", h->hal.length); in v3hil_sync()
253 h->wdtctl = h->hal.payload[0]; in v3hil_sync()
254 h->regs[MSP430_REG_PC] = r32le(h->hal.payload + 2); in v3hil_sync()
255 h->regs[MSP430_REG_SR] = r16le(h->hal.payload + 6); in v3hil_sync()
277 if (hal_proto_execute(&h->hal, in v3hil_read()
283 if (h->hal.length < size) { in v3hil_read()
284 printc_err("v3hil: short reply: %d\n", h->hal.length); in v3hil_read()
288 memcpy(mem, h->hal.payload, size); in v3hil_read()
335 if (hal_proto_execute(&h->hal, in calibrate_dco()
339 if (h->hal.length < 6) { in calibrate_dco()
340 printc_err("v3hil: short reply: %d\n", h->hal.length); in calibrate_dco()
353 if (hal_proto_execute(&h->hal, in calibrate_dco()
381 if (hal_proto_execute(&h->hal, in calibrate_fll()
385 if (h->hal.length < 10) { in calibrate_fll()
386 printc_err("v3hil: short reply: %d\n", h->hal.length); in calibrate_fll()
402 if (hal_proto_execute(&h->hal, in calibrate_fll()
473 if (hal_proto_execute(&h->hal, in upload_funclet()
532 if (hal_proto_execute(&h->hal, in write_flash()
553 if (hal_proto_execute(&h->hal, in write_ram()
606 if (hal_proto_execute(&h->hal, in call_erase()
674 if (hal_proto_execute(&h->hal, fid, NULL, 0) < 0) { in v3hil_update_regs()
679 if (h->hal.length < reg_size * 13) { in v3hil_update_regs()
680 printc_err("v3hil: short read: %d\n", h->hal.length); in v3hil_update_regs()
694 r |= ((address_t)(h->hal.payload[sptr++])) << in v3hil_update_regs()
727 if (hal_proto_execute(&h->hal, fid, data, reg_size * 13) < 0) { in v3hil_flush_regs()
750 if (hal_proto_execute(&h->hal, in v3hil_context_restore()
772 if (hal_proto_execute(&h->hal, in v3hil_context_save()
776 if (h->hal.length < 8) { in v3hil_context_save()
777 printc_err("v3hil: short reply: %d\n", h->hal.length); in v3hil_context_save()
781 h->wdtctl = r16le(h->hal.payload); in v3hil_context_save()
782 h->regs[MSP430_REG_PC] = r32le(h->hal.payload + 2); in v3hil_context_save()
783 h->regs[MSP430_REG_SR] = r16le(h->hal.payload + 6); in v3hil_context_save()
803 if (hal_proto_execute(&h->hal, in v3hil_single_step()
810 if (h->hal.length < 8) { in v3hil_single_step()
811 printc_err("do_step: short reply: %d\n", h->hal.length); in v3hil_single_step()
815 h->wdtctl = r16le(h->hal.payload); in v3hil_single_step()
816 h->regs[MSP430_REG_PC] = r32le(h->hal.payload + 2); in v3hil_single_step()
817 h->regs[MSP430_REG_SR] = r16le(h->hal.payload + 6); in v3hil_single_step()
837 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_CONFIGURE, in set_param()
857 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_READ_MEM_WORDS, in idproc_89()
860 if (fet->hal.length < 16) { in idproc_89()
861 printc_err("v3hil: short reply: %d\n", fet->hal.length); in idproc_89()
865 id->ver_id = r16le(fet->hal.payload); in idproc_89()
867 id->revision = r16le(fet->hal.payload + 2); in idproc_89()
868 id->fab = fet->hal.payload[3]; in idproc_89()
869 id->self = r16le(fet->hal.payload + 4); in idproc_89()
870 id->config = fet->hal.payload[13] & 0x7f; in idproc_89()
873 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_GET_FUSES, NULL, 0) < 0) in idproc_89()
875 if (!fet->hal.length) { in idproc_89()
876 printc_err("v3hil: short reply: %d\n", fet->hal.length); in idproc_89()
880 id->fuses = fet->hal.payload[0]; in idproc_89()
897 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_READ_MEM_QUICK_XV2, in idproc_9x()
900 if (fet->hal.length < 8) { in idproc_9x()
901 printc_err("v3hil: short reply: %d\n", fet->hal.length); in idproc_9x()
905 info_len = fet->hal.payload[0]; in idproc_9x()
906 id->ver_id = r16le(fet->hal.payload + 4); in idproc_9x()
907 id->revision = fet->hal.payload[6]; in idproc_9x()
908 id->config = fet->hal.payload[7]; in idproc_9x()
921 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_READ_MEM_QUICK_XV2, in idproc_9x()
924 if (fet->hal.length < tlv_size) { in idproc_9x()
925 printc_err("v3hil: short reply: %d\n", fet->hal.length); in idproc_9x()
932 uint8_t tag = fet->hal.payload[i++]; in idproc_9x()
933 uint8_t len = fet->hal.payload[i++]; in idproc_9x()
939 id->ver_sub_id = r16le(fet->hal.payload); in idproc_9x()
955 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_GET_JTAG_ID, in v3hil_identify()
959 if (fet->hal.length < 12) { in v3hil_identify()
960 printc_err("v3hil: short reply: %d\n", fet->hal.length); in v3hil_identify()
965 for (i = 0; i < fet->hal.length; i++) in v3hil_identify()
966 printc_dbg(" %02x", fet->hal.payload[i]); in v3hil_identify()
972 fet->jtag_id = fet->hal.payload[0]; in v3hil_identify()
973 dev_id_ptr = r32le(fet->hal.payload + 4); in v3hil_identify()
974 id_data_addr = r32le(fet->hal.payload + 8); in v3hil_identify()
990 if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_IS_JTAG_FUSE_BLOWN, in v3hil_identify()
993 if ((fet->hal.length >= 2) && in v3hil_identify()
994 (fet->hal.payload[0] == 0x55) && in v3hil_identify()
995 (fet->hal.payload[1] == 0x55)) { in v3hil_identify()