bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH gnumach] pit: Fix shadowed hz variable && define modes correc


From: Samuel Thibault
Subject: Re: [PATCH gnumach] pit: Fix shadowed hz variable && define modes correctly
Date: Sun, 26 Feb 2023 10:00:57 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Applied, thanks!

Damien Zammit, le dim. 26 févr. 2023 01:31:00 +0000, a ecrit:
> ---
>  i386/i386/pit.c | 14 +++++++-------
>  i386/i386/pit.h |  3 ++-
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/i386/i386/pit.c b/i386/i386/pit.c
> index 7373a38e..6c006a98 100644
> --- a/i386/i386/pit.c
> +++ b/i386/i386/pit.c
> @@ -66,18 +66,18 @@ int pit0_mode = PIT_C0|PIT_SQUAREMODE|PIT_READMODE ;
>  unsigned int clknumb = CLKNUM;               /* interrupt interval for timer 
> 0 */
> 
>  void
> -pit_prepare_sleep(int hz)
> +pit_prepare_sleep(int persec)
>  {
> -    /* Prepare to sleep for 1/hz seconds */
> -    int val = 0;
> -    int lsb, msb;
> +    /* Prepare to sleep for 1/persec seconds */
> +    uint32_t val = 0;
> +    uint8_t lsb, msb;
> 
>      val = inb(PITAUX_PORT);
>      val &= ~PITAUX_OUT2;
>      val |= PITAUX_GATE2;
>      outb (PITAUX_PORT, val);
> -    outb (PITCTL_PORT, PIT_C2 | PIT_LOADMODE | PIT_RATEMODE);
> -    val = CLKNUM / hz;
> +    outb (PITCTL_PORT, PIT_C2 | PIT_LOADMODE | PIT_ONESHOTMODE);
> +    val = CLKNUM / persec;
>      lsb = val & 0xff;
>      msb = val >> 8;
>      outb (PITCTR2_PORT, lsb);
> @@ -88,7 +88,7 @@ pit_prepare_sleep(int hz)
>  void
>  pit_sleep(void)
>  {
> -    int val;
> +    uint8_t val;
> 
>      /* Start counting down */
>      val = inb(PITAUX_PORT);
> diff --git a/i386/i386/pit.h b/i386/i386/pit.h
> index 51c4111d..b14c4c84 100644
> --- a/i386/i386/pit.h
> +++ b/i386/i386/pit.h
> @@ -73,7 +73,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>                                        * followed by most significant byte */
> 
>  #define PIT_SQUAREMODE       0x06            /* square-wave mode */
> -#define PIT_RATEMODE 0x02            /* rate generator mode */
> +#define PIT_RATEMODE 0x04            /* rate generator mode */
> +#define PIT_ONESHOTMODE      0x02            /* one-shot mode */
> 
>  /* Used for Timer 2. */
>  #define PIT_C2               0x80            /* select counter 2 */
> --
> 2.39.0
> 
> 
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]