Re: [rft] s2ram wakeup moves to .c, could fix few machines

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pavel Machek
Date: Thursday, February 7, 2008 - 3:51 pm

On Thu 2008-02-07 14:46:25, H. Peter Anvin wrote:

No interrupts. BIOS calls work on some machines, but I'd like this to
work when bios does not.

Actually, matthieu's code is probably better to start from:

+/* one ISA cycle @8Mhz */
+#define PAUSE outb %al, $0x80
+#define WAIT_100MS \
+       movl $800000, %eax; \
+       2: \
+       PAUSE; \
+       dec %eax; \
+       jne 2b
+
+/* What's the PIT rate */
+#define COUNT 0xf89
 #define BEEP \
-       inb     $97, %al;       \
-       outb    %al, $0x80;     \
-       movb    $3, %al;        \
-       outb    %al, $97;       \
-       outb    %al, $0x80;     \
-       movb    $-74, %al;      \
-       outb    %al, $67;       \
-       outb    %al, $0x80;     \
-       movb    $-119, %al;     \
-       outb    %al, $66;       \
-       outb    %al, $0x80;     \
-       movb    $15, %al;       \
-       outb    %al, $66;
+       /* enable counter 2 */ \
+       inb             $0x61, %al;     \
+       PAUSE;  \
+       orb     $3, %al; \
+       outb    %al, $0x61;     \
+       PAUSE;  \
+       /* set command for counter 2, 2 byte write */ \
+       movb    $0xB6, %al;     \
+       outb    %al, $0x43;     \
+       PAUSE;  \
+       /* select desired HZ */ \
+       movb    $(COUNT & 0xff), %al; \
+       outb    %al, $0x42;     \
+       PAUSE;  \
+       movb    $(COUNT >> 8), %al;     \
+       outb    %al, $0x42; \
+       WAIT_100MS; \
+       /* disable counter 2 */ \
+       inb             $0x61, %al;     \
+       PAUSE;  \
+       andb    $0xFC, %al; \
+       outb    %al, $0x61; \
+       WAIT_100MS
+
+#define CBEEP \
+       testl   $4, realmode_flags - wakeup_code; \
+       jz      1f; \
+       BEEP; \
+1:

...because it allows user to compute number of beeps.
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[rft] s2ram wakeup moves to .c, could fix few machines, Pavel Machek, (Tue Feb 5, 12:06 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 6:27 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 6:42 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Tue Feb 5, 6:56 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Wed Feb 6, 4:37 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Wed Feb 6, 4:48 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 3:12 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 3:40 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Pavel Machek, (Thu Feb 7, 3:51 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 3:53 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 3:57 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 4:06 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 4:09 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Thu Feb 7, 4:36 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, H. Peter Anvin, (Fri Feb 8, 12:40 am)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 9:23 am)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 3:01 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Fri Feb 8, 5:18 pm)
Re: [rft] s2ram wakeup moves to .c, could fix few machines, Rafael J. Wysocki, (Sat Feb 9, 6:48 am)