Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need add some time delay definitions to keep code clean and consistent (Bugzilla Bug 124) #9559

Open
tianocore-issues opened this issue Sep 19, 2016 · 2 comments
Labels
package:mdepkg priority:low Little to no impact. No urgency to fix. type:feature-request A new feature proposal

Comments

@tianocore-issues
Copy link

This issue was created automatically with bugzilla2github

Bugzilla Bug 124

Date: 2016-09-19T23:08:45+00:00
From: Feng Tian <<feng.tian>>
To: @lzeng14
CC: jie.b.gao, yonghong.zhu

Last updated: 2018-05-03T03:10:44+00:00

@tianocore-issues
Copy link
Author

Comment 498

Date: 2016-09-19 23:08:45 +0000
From: Feng Tian <<feng.tian>>

  • Industry Specification: ---
  • Release Observed: EDK II Master
  • Releases to Fix: EDK II Master
  • Target OS: ---
  • Bugzilla Assignee(s): @lzeng14

Community is asking if we can eliminate so many separate definitions of how many microseconds go in a milisecond or second.

USB_BUS_1_MILLISECOND (Pei and Dxe)
XHC_1_MILLISECOND (Pei and Dxe)
EHC_1_MILLISECOND (Pei and Dxe)
UHC_1_MILLISECOND (Dxe, Pei defines STALL_1_MILLI_SECOND instead)

Mike recommended several ways like below:

> Maybe we should consider some additional macros in UefiLib.h
>
> #define EFI_STALL_PERIOD_MICROSECONDS(Microseconds) (Microseconds)
> #define EFI_STALL_PERIOD_MILLISECONDS(Milliseconds) ((Milliseconds) * 1000)
> #define EFI_STALL_PERIOD_SECONDS(Seconds) ((Seconds) * 1000000)
>
> Or maybe some macros that actually do the call to gBS->Stall() too.
>
> #define EFI_STALL_MICROSECONDS(Microseconds) gBS->Stall (Microseconds)
> #define EFI_STALL_MILLISECONDS(Milliseconds) gBS->Stall ((Milliseconds) * 1000)
> #define EFI_STALL_SECONDS(Seconds) gBS->Stall ((Seconds) * 1000000)
>
> The other method of generating timed delays for PEI/DXE/SMM modules is
> using the Services in MdePkg/Include/Library/TimerLib.h:
>
> UINTN
> EFIAPI
> NanoSecondDelay (
> IN UINTN NanoSeconds
> );
>
> UINTN
> EFIAPI
> MicroSecondDelay (
> IN UINTN MicroSeconds
> );
>
> If we wanted macros helper to use these services to match UEFI ones,
> maybe add the following to TimerLib.h:
>
> #define DELAY_NANOSECONDS(Nanoseconds) NanoSecondDelay (Nanoseconds)
> #define DELAY_MICROSECONDS(Microseconds) MicroSecondDelay (Microseconds)
> #define DELAY_MILLISECONDS(Milliseconds) MicroSecondDelay ((Microseconds) * 1000)
> #define DELAY_SECONDS(Seconds) MicroSecondDelay ((Microseconds) * 1000000)

@tianocore-issues
Copy link
Author

Comment 597

Date: 2016-10-13 20:10:18 +0000
From: Yonghong Zhu <<yonghong.zhu>>

Bug scrub: Assign to module owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:mdepkg priority:low Little to no impact. No urgency to fix. type:feature-request A new feature proposal
Projects
None yet
Development

No branches or pull requests

1 participant