#NEWLINE# def init( self , frequency = 1000000 ) : #NEWLINE# #INDENT# self . flush ( ) #NEWLINE# self . mode = self . _protocol . connect ( ) #NEWLINE# self . _protocol . setSWJClock ( self ) #NEWLINE# self . _protocol . transferConfigure ( ) #NEWLINE# if ( self . mode == DAP_MODE_SWD ) : #NEWLINE# #INDENT# self . _protocol . swdConfigure ( ) #NEWLINE# self . JTAG2SWD ( ) #NEWLINE# self . readDP ( DP_REG [ 'IDCODE' ] ) #NEWLINE# logging . info ( 'IDCODE: 0x%X' , self . flush ( ) [ 0 ] ) #NEWLINE# self . _protocol . writeAbort ( 30 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . mode == DAP_MODE_JTAG ) : #NEWLINE# #INDENT# self . _protocol . jtagConfigure ( 4 ) #NEWLINE# self . _protocol . swjSequence ( [ 31 ] ) #NEWLINE# logging . info ( 'IDCODE: 0x%X' , self . _protocol . jtagIDCode ( ) ) #NEWLINE# self . writeDP ( DP_REG [ 'CTRL_STAT' ] , ( ( CTRLSTAT_STICKYERR | CTRLSTAT_STICKYCMP ) | CTRLSTAT_STICKYORUN ) ) #NEWLINE# self . flush ( ) #NEWLINE# #UNINDENT# #UNINDENT# return