@@ -101,6 +101,9 @@ where
101101 }
102102 // Bit 4: Atomic commands not supported
103103 // Bit 5: Test Domain Timer not supported
104+ if dependencies. timer_available ( ) {
105+ caps. insert ( Capabilities :: TEST_DOMAIN_TIMER ) ;
106+ }
104107 // Bit 6: SWO Streaming Trace optional
105108 if swo. support ( ) . streaming {
106109 caps. insert ( Capabilities :: SWO_STREAMING ) ;
@@ -705,7 +708,8 @@ where
705708 let a = swd:: DPRegister :: try_from ( ( transfer_req & ( 3 << 2 ) ) >> 2 ) . unwrap ( ) ;
706709 let vmatch = ( transfer_req & ( 1 << 4 ) ) != 0 ;
707710 let mmask = ( transfer_req & ( 1 << 5 ) ) != 0 ;
708- let _ts = ( transfer_req & ( 1 << 7 ) ) != 0 ;
711+ // Bit 7 (Time Stamp) cannot be combined with Bit 4 (Value Match) or Bit 5 (Match Mask).
712+ let timestamp = ( transfer_req & ( 1 << 7 ) ) != 0 ;
709713
710714 if rnw == swd:: RnW :: R {
711715 // Issue register read
@@ -720,11 +724,20 @@ where
720724 if swd. read_ap ( wait_retries, a) . check ( resp. mut_at ( 2 ) ) . is_none ( ) {
721725 break ;
722726 }
727+ if timestamp {
728+ // Store Timestamp of next AP read
729+ resp. write_u32 ( swd. timestamp ( ) ) ;
730+ }
723731 match swd. read_dp ( wait_retries, rdbuff) . check ( resp. mut_at ( 2 ) ) {
724732 Some ( v) => v,
725733 None => break ,
726734 }
727735 } else {
736+ if timestamp {
737+ // Store Timestamp
738+ resp. write_u32 ( swd. timestamp ( ) ) ;
739+ }
740+
728741 // Reads from DP are not posted, so directly read the register.
729742 match swd. read_dp ( wait_retries, a) . check ( resp. mut_at ( 2 ) ) {
730743 Some ( v) => v,
@@ -781,6 +794,11 @@ where
781794 {
782795 break ;
783796 }
797+
798+ if timestamp {
799+ // Store Timestamp
800+ resp. write_u32 ( swd. timestamp ( ) ) ;
801+ }
784802 }
785803 }
786804 }
@@ -848,7 +866,7 @@ where
848866 }
849867
850868 if post_read && request_value. timestamp {
851- resp. write_u32 ( 0 ) ; // TODO real timestamp
869+ resp. write_u32 ( jtag . timestamp ( ) ) ;
852870 }
853871 }
854872
@@ -906,7 +924,7 @@ where
906924 }
907925
908926 if request_value. timestamp {
909- resp. write_u32 ( 0 ) ; // TODO real timestamp
927+ resp. write_u32 ( jtag . timestamp ( ) ) ;
910928 }
911929 post_read = true ;
912930 }
@@ -951,7 +969,7 @@ where
951969 }
952970
953971 if request_value. timestamp {
954- resp. write_u32 ( 0 ) ; // TODO real timestamp
972+ resp. write_u32 ( jtag . timestamp ( ) ) ;
955973 }
956974 }
957975 }
0 commit comments