franta-hg@44: /** franta-hg@44: * LPT signal generator franta-hg@44: * Copyright © 2017 František Kučera (frantovo.cz) franta-hg@44: * franta-hg@44: * This program is free software: you can redistribute it and/or modify franta-hg@44: * it under the terms of the GNU General Public License as published by franta-hg@44: * the Free Software Foundation, either version 3 of the License, or franta-hg@44: * (at your option) any later version. franta-hg@44: * franta-hg@44: * This program is distributed in the hope that it will be useful, franta-hg@44: * but WITHOUT ANY WARRANTY; without even the implied warranty of franta-hg@44: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the franta-hg@44: * GNU General Public License for more details. franta-hg@44: * franta-hg@44: * You should have received a copy of the GNU General Public License franta-hg@44: * along with this program. If not, see . franta-hg@44: */ franta-hg@44: franta-hg@44: #include franta-hg@44: #include franta-hg@44: #include franta-hg@44: #include franta-hg@44: #include franta-hg@44: #include franta-hg@44: franta-hg@44: using namespace std; franta-hg@44: franta-hg@44: // g++ lpt.cpp && ./a.out franta-hg@44: franta-hg@44: int main() { franta-hg@44: cout << "LPT!" << endl; franta-hg@44: franta-hg@44: //int addr = 0x378; // parport0 franta-hg@44: franta-hg@44: int addr = 0xe400; // parport1 franta-hg@44: franta-hg@44: //int addr = 0x278; franta-hg@44: franta-hg@44: //int addr = 0xc800; franta-hg@44: franta-hg@44: franta-hg@44: if (ioperm(addr,1,1)) { fprintf(stderr, "Access denied to %x\n", addr), exit(1); } franta-hg@44: franta-hg@44: franta-hg@44: for (int i = 0; i < 30; i++) { franta-hg@44: cout << "cyklus" << endl; franta-hg@44: usleep(100*1000); franta-hg@44: outb(0b11111111, addr); franta-hg@44: usleep(10*1000); franta-hg@44: outb(0b00000000, addr); franta-hg@44: } franta-hg@44: franta-hg@44: franta-hg@44: cout << "hotovo" << endl; franta-hg@44: franta-hg@44: franta-hg@44: }