myxm@beta.UUCP (Mike Mitchell) (09/14/87)
Does anyone have any pertinent information on what port and values are needed to make a Turbo AT board toggle between high and low speeds? Specifically I am working with a board that says "Made in Tiawan" and it has the Phoenix BIOS on it. I can toggle between high and low with the CTRL-ALT-KEYPADMINUS combination. This is an unaceptable solution when the machine is running Xenix though... I am not real hot on the idea of moving the jumpers for the higher speed. Thanx for the info. Mike Mitchell myxm@lanl.gov ...!cmcl2!lanl!myxm
root@conexch.UUCP (Larry Dighera) (10/04/87)
myxm@beta.UUCP (Mike Mitchell) Writes: >Does anyone have any pertinent information on what port and values >are needed to make a Turbo AT board toggle between high and low >speeds? > >Specifically I am working with a board that says "Made in Tiawan" and >it has the Phoenix BIOS on it. I can toggle between high and low with >the CTRL-ALT-KEYPADMINUS combination. This is an unaceptable solution >when the machine is running Xenix though... I am not real hot on the >idea of moving the jumpers for the higher speed. > Here is the source to a program which will switch speeds on Atronics AT compatibles running SCO Xenix. It takes advantage of an undocumented device to communicate with the hardware. Although your article didn't indicate which Xenix you were refering to, this information should be useful. ========================== speed.c begins ============================== /* * Atronics speed switching program for Xenix * * Written by Sanford Zelkovitz * * Prior to running this program, you MUST have generated a dev called * /dev/inport * * You make this device by using the following command: * mknod /dev/inport c 4 3 * * The arguments to the program are as follows: * 1 Slow speed, 1 wait state * 2 Slow speed, 0 wait state * 3 High Speed, 1 wait state * 4 High Speed, 0 wait state * * Example: To switch to HIGH SPEED, 1 WAIT STATE, you would call the program * as follows: speed 3 * */ #include <stdio.h> #include <fcntl.h> #define hex_60 0x60 #define hex_64 0x64 #define hex_d2 0xd2 #define hex_d3 0xd3 #define hex_fc 0xfc #define hex_43 0x43 #define hex_42 0x42 #define hex_61 0x61 #define hex_b6 0xb6 #define hex_21 0x21 #define hex_ff 0xff int cx, dx, bl, bh, bx; int memfd, save; int save_ax; int old_int_mask; unsigned char inb(); unsigned char port_data; unsigned int port_address; unsigned int al, ah, ax; unsigned char alb, ahb; unsigned char byte; main(argc, argv) int argc; char *argv[]; { if( argc != 2 ) { fprintf(stderr,"Usage: speed number ( number = 1 to 4 )\n"); exit (1); } save = atoi(argv[1]); if ( save < 1 || save > 4) { fprintf(stderr, "Illegal frequency value, must be between 1-4\n"); exit (1); } save = 4 - save; port_data = hex_60; port_address = hex_64; outb(port_address, port_data); port_address = hex_60; port_data = 68; outb(port_address, port_data); port_data = hex_d2; port_address = hex_64; outb(port_address, port_data); for(bl = 0; bl < 4; bl++) { for(cx = 0; cx < 32767; cx++) { byte = inb(port_address); al = byte; if((al & 1) != 0)goto l3; } } port_data = hex_60; port_address = hex_64; outb(port_address, port_data); port_data = 69; port_address = hex_60; outb(port_address, port_data); exit(1); l3: port_address = hex_60; byte = inb(port_address); save_ax = byte; al = save; if((al & 2 ) == 0)goto l4; if((al & 1 ) == 0)goto l5; dx = 1; goto l6; l5: dx = 2; goto l6; l4: if((al & 1) == 0)goto l7; dx = 3; goto l6; l7: dx = 4; l6: subs(); al = save_ax; al &= hex_fc; ah = save; ah &= 3; al |= ah; save_ax = ah; ah = al; al = save_ax; port_data = hex_d3; port_address = hex_64; outb(port_address, port_data); l8: port_address = hex_64; byte = inb(port_address); if((byte & 2) != 0)goto l8; port_data = ah; port_address = hex_60; outb(port_address, port_data); port_data = hex_60; port_address = hex_64; outb(port_address, port_data); port_data = 69; port_address = hex_60; outb(port_address, port_data); exit(0); } subs() { if(dx == 0)return; subs2(); } subs2() { while(dx != 0) { subs3(); for (cx = 0; cx < 16384; cx++); dx--; } } subs3() { port_data = hex_b6; port_address = hex_43; outb(port_address, port_data); port_data = 51; port_address = hex_42; outb(port_address, port_data); port_data = 5; outb(port_address, port_data); port_address = hex_61; byte = inb(port_address); ah = byte; ahb = ah; al = 5; al |= 3; alb = al; outb(port_address, alb); for(cx = 0; cx < 16384; cx++); outb(port_address,ahb); } extern errno; unsigned char inb(portno) unsigned int portno; { int handle; int byte; long offset; handle = open("/dev/inport", O_RDONLY); if(handle == -1) { printf("\nDevice driver (read) error!\n"); exit(1); } offset = (long)portno; (void) lseek(handle, offset, 0); read(handle, &byte, 1); close ( handle ); return ( byte ); } outb(portno, data) unsigned int portno; unsigned char data; { int handle; long offset; handle = open("/dev/inport", O_RDWR); if(handle == -1) { printf("\nDevice driver (write) error!\n"); exit(1); } offset = (long)portno; (void) lseek(handle, offset, 0); write(handle, &data, 1); close ( handle ); } ================================== speed.c ends ==========================