lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Feb 2008 22:35:56 +0100
From:	Pavel Machek <pavel@....cz>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>,
	kernel list <linux-kernel@...r.kernel.org>,
	Linux-pm mailing list <linux-pm@...ts.osdl.org>
Subject: Re: [rft] s2ram wakeup moves to .c, could fix few machines

Hi!

> Okay, this uses the iodelay as the timesource... here is the total 
> silliness (and totally untested, of course.)

Why untested? Testing suspend is easy ;-). s2ram from suspend.sf.net
tends to just work...
								Pavel

> static inline void io_delay(void)
> {
> 	outb(0, 0x80);
> }
> 
> static void udelay(int loops)
> {
> 	while (loops--)
> 		io_delay();	/* Approximately 1 us */
> }
> 
> static void beep(unsigned int hz)
> {
> 	u8 enable;
> 
> 	if (!hz) {
> 		enable = 0x00;		/* Turn off speaker */
> 	} else {
> 		u16 div = 1193181/hz;
> 
> 		outb(0xb6, 0x43);	/* Ctr 2, squarewave, load, binary */
> 		io_delay();
> 		outb(div, 0x42);	/* LSB of counter */
> 		io_delay();
> 		outb(div >> 8, 0x42);	/* MSB of counter */
> 		io_delay();
> 
> 		enable = 0x03;		/* Turn on speaker */
> 	}
> 	inb(0x61);		/* Dummy read of System Control Port B */
> 	io_delay();
> 	outb(enable, 0x61);	/* Enable timer 2 output to speaker */
> 	io_delay();
> }
> 
> #define DOT_HZ		880
> #define DASH_HZ		587
> #define US_PER_DOT	125000
> 
> /* Okay, this is totally silly, but it's kind of fun. */
> void send_morse(const char *pattern)
> {
> 	char s;
> 
> 	while ((s = *pattern++)) {
> 		switch (s) {
> 		case '.':
> 			beep(DOT_HZ);
> 			udelay(US_PER_DOT);
> 			beep(0);
> 			udelay(US_PER_DOT);
> 			break;
> 		case '-':
> 			beep(DASH_HZ);
> 			udelay(US_PER_DOT*3);
> 			beep(0);
> 			udelay(US_PER_DOT);
> 			break;
> 		default:	/* Assume it's a space */
> 			udelay(US_PER_DOT*3);
> 			break;
> 		}
> 	}
> }
> 
> 


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ