@@ -342,8 +342,8 @@ static ATCA_STATUS kit_host_ca_select(ascii_kit_host_context_t* ctx, int argc, c
342342
343343#if ATCA_CA_SUPPORT
344344static kit_host_map_entry_t kit_host_ca_physical_map [] = {
345- { "select" , kit_host_ca_select },
346- { NULL , NULL }
345+ { "select" , kit_host_ca_select },
346+ { NULL , NULL }
347347};
348348
349349static ATCA_STATUS kit_host_ca_physical (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
@@ -353,12 +353,12 @@ static ATCA_STATUS kit_host_ca_physical(ascii_kit_host_context_t* ctx, int argc,
353353
354354/* Cryptoauth Device commands */
355355static kit_host_map_entry_t kit_host_ca_map [] = {
356- { "wake" , kit_host_ca_wake },
357- { "idle" , kit_host_ca_idle },
358- { "sleep" , kit_host_ca_sleep },
359- { "talk" , kit_host_ca_talk },
360- { "physical" , kit_host_ca_physical },
361- { NULL , NULL }
356+ { "wake" , kit_host_ca_wake },
357+ { "idle" , kit_host_ca_idle },
358+ { "sleep" , kit_host_ca_sleep },
359+ { "talk" , kit_host_ca_talk },
360+ { "physical" , kit_host_ca_physical },
361+ { NULL , NULL }
362362};
363363
364364static ATCA_STATUS kit_host_process_ca (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
@@ -392,17 +392,18 @@ static ATCA_STATUS kit_host_ta_talk(ascii_kit_host_context_t* ctx, int argc, cha
392392
393393 if (ctx && argc && response && rlen )
394394 {
395- ATCA_TA_CmdPacket * packet = ( ATCA_TA_CmdPacket * ) ctx -> buffer ;
395+ cal_buffer * packet = talib_packet_alloc () ;
396396
397- if (packet )
397+ if (NULL != packet )
398398 {
399399 size_t plen = sizeof (ctx -> buffer ) - 2 ;
400+ packet -> buf = ctx -> buffer ;
400401
401- atcab_hex2bin (argv [0 ], strlen (argv [0 ]), ( uint8_t * ) & packet -> length , & plen );
402+ atcab_hex2bin (argv [0 ], strlen (argv [0 ]), packet -> buf , & plen );
402403 if (ATCA_SUCCESS == (status = talib_execute_command_raw (packet , ctx -> device )))
403404 {
404- ATCA_TA_RspPacket * resp = ( ATCA_TA_RspPacket * ) packet ;
405- * rlen = kit_host_format_response (response , * rlen , status , resp -> data , resp -> resp_code );
405+
406+ * rlen = kit_host_format_response (response , * rlen , status , & packet -> buf [ PKT_CAL_BUF_DATA_IDX ], packet -> buf [ 2 ] );
406407 }
407408 else
408409 {
@@ -477,7 +478,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
477478 status = ATCA_SMALL_BUFFER ;
478479 break ;
479480 }
480- if (read_length < (3 + length_size )) //status(1) and CRC(2) size are same for CA and TA, length is variable.
481+ if (read_length < (3 + length_size )) //status(1) and CRC(2) size are same for CA and TA, length is variable.
481482 {
482483 status = ATCA_RX_FAIL ;
483484 break ;
@@ -513,8 +514,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
513514 }
514515
515516 (void )atcontrol (& ctx -> device -> mIface , ATCA_HAL_CONTROL_DESELECT , NULL , 0 );
516- }
517- while (0 );
517+ } while (0 );
518518 if (ATCA_SUCCESS == status )
519519 {
520520 * rlen = kit_host_format_response (ctx -> buffer , sizeof (ctx -> buffer ), status , & ctx -> buffer [sizeof (ctx -> buffer ) / 2 ], read_length + length_size );
@@ -528,8 +528,8 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
528528}
529529
530530static kit_host_map_entry_t kit_host_ta_physical_map [] = {
531- { "select" , kit_host_ca_select }, /* Selection logic is the same */
532- { NULL , NULL }
531+ { "select" , kit_host_ca_select }, /* Selection logic is the same */
532+ { NULL , NULL }
533533};
534534
535535static ATCA_STATUS kit_host_ta_physical (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
@@ -538,14 +538,14 @@ static ATCA_STATUS kit_host_ta_physical(ascii_kit_host_context_t* ctx, int argc,
538538}
539539
540540static kit_host_map_entry_t kit_host_ta_map [] = {
541- { "wake" , kit_host_ta_wake },
542- { "idle" , kit_host_ta_idle },
543- { "sleep" , kit_host_ta_sleep },
544- { "talk" , kit_host_ta_talk },
545- { "send" , kit_host_ta_send },
546- { "receive" , kit_host_ta_receive },
547- { "physical" , kit_host_ta_physical },
548- { NULL , NULL }
541+ { "wake" , kit_host_ta_wake },
542+ { "idle" , kit_host_ta_idle },
543+ { "sleep" , kit_host_ta_sleep },
544+ { "talk" , kit_host_ta_talk },
545+ { "send" , kit_host_ta_send },
546+ { "receive" , kit_host_ta_receive },
547+ { "physical" , kit_host_ta_physical },
548+ { NULL , NULL }
549549};
550550
551551ATCA_STATUS kit_host_process_ta (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
@@ -586,10 +586,10 @@ static ATCA_STATUS kit_host_board_get_device(ascii_kit_host_context_t* ctx, int
586586
587587
588588static kit_host_map_entry_t kit_host_board_map [] = {
589- { "version" , kit_host_board_get_version },
590- { "firmware" , kit_host_board_get_firmware },
591- { "device" , kit_host_board_get_device },
592- { NULL , NULL }
589+ { "version" , kit_host_board_get_version },
590+ { "firmware" , kit_host_board_get_firmware },
591+ { "device" , kit_host_board_get_device },
592+ { NULL , NULL }
593593};
594594
595595static ATCA_STATUS kit_host_process_board (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
@@ -599,15 +599,15 @@ static ATCA_STATUS kit_host_process_board(ascii_kit_host_context_t* ctx, int arg
599599
600600
601601static const kit_host_map_entry_t kit_host_target_map [] = {
602- { "board" , kit_host_process_board },
602+ { "board" , kit_host_process_board },
603603#if ATCA_CA_SUPPORT
604- { "ecc" , kit_host_process_ca },
605- { "sha" , kit_host_process_ca },
604+ { "ecc" , kit_host_process_ca },
605+ { "sha" , kit_host_process_ca },
606606#endif
607607#if ATCA_TA_SUPPORT
608- { "ta" , kit_host_process_ta },
608+ { "ta" , kit_host_process_ta },
609609#endif
610- { NULL , NULL }
610+ { NULL , NULL }
611611};
612612
613613static ATCA_STATUS kit_host_process_target (ascii_kit_host_context_t * ctx , int argc , char * argv [], uint8_t * response , size_t * rlen )
0 commit comments