File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use kernel::{
66 device,
77 io:: poll:: read_poll_timeout,
88 prelude:: * ,
9- time:: delay:: fsleep,
109 time:: Delta , //
1110} ;
1211
@@ -147,13 +146,7 @@ impl<E: FalconEngine> FalconHal<E> for Ga102<E> {
147146 Delta :: from_micros ( 150 ) ,
148147 ) ;
149148
150- regs:: NV_PFALCON_FALCON_ENGINE :: update ( bar, & E :: ID , |v| v. set_reset ( true ) ) ;
151-
152- // TIMEOUT: falcon engine should not take more than 10us to reset.
153- fsleep ( Delta :: from_micros ( 10 ) ) ;
154-
155- regs:: NV_PFALCON_FALCON_ENGINE :: update ( bar, & E :: ID , |v| v. set_reset ( false ) ) ;
156-
149+ regs:: NV_PFALCON_FALCON_ENGINE :: reset_engine :: < E > ( bar) ;
157150 self . reset_wait_mem_scrubbing ( bar) ?;
158151
159152 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ use core::marker::PhantomData;
55use kernel:: {
66 io:: poll:: read_poll_timeout,
77 prelude:: * ,
8- time:: delay:: fsleep,
98 time:: Delta , //
109} ;
1110
@@ -65,13 +64,7 @@ impl<E: FalconEngine> FalconHal<E> for Tu102<E> {
6564 }
6665
6766 fn reset_eng ( & self , bar : & Bar0 ) -> Result {
68- regs:: NV_PFALCON_FALCON_ENGINE :: update ( bar, & E :: ID , |v| v. set_reset ( true ) ) ;
69-
70- // TIMEOUT: falcon engine should not take more than 10us to reset.
71- fsleep ( Delta :: from_micros ( 10 ) ) ;
72-
73- regs:: NV_PFALCON_FALCON_ENGINE :: update ( bar, & E :: ID , |v| v. set_reset ( false ) ) ;
74-
67+ regs:: NV_PFALCON_FALCON_ENGINE :: reset_engine :: < E > ( bar) ;
7568 self . reset_wait_mem_scrubbing ( bar) ?;
7669
7770 Ok ( ( ) )
Original file line number Diff line number Diff line change 77#[ macro_use]
88pub ( crate ) mod macros;
99
10- use kernel:: prelude:: * ;
10+ use kernel:: {
11+ prelude:: * ,
12+ time, //
13+ } ;
1114
1215use crate :: {
16+ driver:: Bar0 ,
1317 falcon:: {
1418 DmaTrfCmdSize ,
1519 FalconCoreRev ,
1620 FalconCoreRevSubversion ,
21+ FalconEngine ,
1722 FalconFbifMemType ,
1823 FalconFbifTarget ,
1924 FalconMem ,
@@ -365,6 +370,18 @@ register!(NV_PFALCON_FALCON_ENGINE @ PFalconBase[0x000003c0] {
365370 0 : 0 reset as bool ;
366371} ) ;
367372
373+ impl NV_PFALCON_FALCON_ENGINE {
374+ /// Resets the falcon
375+ pub ( crate ) fn reset_engine < E : FalconEngine > ( bar : & Bar0 ) {
376+ Self :: read ( bar, & E :: ID ) . set_reset ( true ) . write ( bar, & E :: ID ) ;
377+
378+ // TIMEOUT: falcon engine should not take more than 10us to reset.
379+ time:: delay:: fsleep ( time:: Delta :: from_micros ( 10 ) ) ;
380+
381+ Self :: read ( bar, & E :: ID ) . set_reset ( false ) . write ( bar, & E :: ID ) ;
382+ }
383+ }
384+
368385register ! ( NV_PFALCON_FBIF_TRANSCFG @ PFalconBase [ 0x00000600 [ 8 ] ] {
369386 1 : 0 target as u8 ?=> FalconFbifTarget ;
370387 2 : 2 mem_type as bool => FalconFbifMemType ;
You can’t perform that action at this time.
0 commit comments