Fixed LPT low level code
Printing is now possible!
This commit is contained in:
parent
c9c5bb9314
commit
2ebd57fad4
|
@ -4,7 +4,7 @@
|
||||||
# and where the MCP will run (ram or flash)
|
# and where the MCP will run (ram or flash)
|
||||||
#
|
#
|
||||||
UNIT := a2560k
|
UNIT := a2560k
|
||||||
MEMORY := flash
|
MEMORY := ram
|
||||||
|
|
||||||
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
|
# CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */
|
||||||
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */
|
# CPU_M68000 0x20 /* CPU code for the Motorola 68000 */
|
||||||
|
|
|
@ -506,7 +506,7 @@ short cli_test_lpt(short screen, int argc, const char * argv[]) {
|
||||||
char message[80];
|
char message[80];
|
||||||
unsigned char scancode;
|
unsigned char scancode;
|
||||||
|
|
||||||
sprintf(message, "Test parallel port:\nF1: DATA=00 F2: DATA=FF F3: STRB=1 F4: STRB=0\n");
|
sprintf(message, "Test parallel port:\nF1: DATA='B' F2: DATA='A' F3: STRB=1 F4: STRB=0\n");
|
||||||
sys_chan_write(screen, message, strlen(message));
|
sys_chan_write(screen, message, strlen(message));
|
||||||
sprintf(message, "F5: INIT=1 F6: INIT=0 F7: SEL=1 F8: SEL=0\nESC: Quit\n");
|
sprintf(message, "F5: INIT=1 F6: INIT=0 F7: SEL=1 F8: SEL=0\nESC: Quit\n");
|
||||||
sys_chan_write(screen, message, strlen(message));
|
sys_chan_write(screen, message, strlen(message));
|
||||||
|
@ -518,8 +518,8 @@ short cli_test_lpt(short screen, int argc, const char * argv[]) {
|
||||||
scancode = sys_kbd_scancode();
|
scancode = sys_kbd_scancode();
|
||||||
switch (scancode) {
|
switch (scancode) {
|
||||||
case 0x3B: /* F1 */
|
case 0x3B: /* F1 */
|
||||||
print(0, "DATA = 0x00\n");
|
print(0, "DATA = 'B'\n");
|
||||||
*LPT_DATA_PORT = 0;
|
*LPT_DATA_PORT = 'B';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x3C: /* F2 */
|
case 0x3C: /* F2 */
|
||||||
|
@ -586,18 +586,16 @@ short cli_test_lpt(short screen, int argc, const char * argv[]) {
|
||||||
|
|
||||||
short cmd_test_print(short screen, int argc, const char * argv[]) {
|
short cmd_test_print(short screen, int argc, const char * argv[]) {
|
||||||
#if MODEL == MODEL_FOENIX_A2560K
|
#if MODEL == MODEL_FOENIX_A2560K
|
||||||
const char * test_pattern = "0123456789ABCDEFGHIJKLMNOPQRTSUVWZXYZ\n\r";
|
const char * test_pattern = "0123456789ABCDEFGHIJKLMNOPQRTSUVWZXYZ\r\n";
|
||||||
|
|
||||||
char message[80];
|
char message[80];
|
||||||
unsigned short scancode = 0;
|
unsigned short scancode = 0;
|
||||||
|
|
||||||
sprintf(message, "Initializing printer...\n");
|
print(screen, "Initializing printer...\n");
|
||||||
sys_chan_write(screen, message, strlen(message));
|
|
||||||
|
|
||||||
lpt_initialize();
|
lpt_initialize();
|
||||||
|
|
||||||
sprintf(message, "Sending test patterns to printer (ESC to quit)...\n");
|
print(screen, "Sending test patterns to printer (ESC to quit)...\n");
|
||||||
sys_chan_write(screen, message, strlen(message));
|
|
||||||
|
|
||||||
while (scancode != 0x01) {
|
while (scancode != 0x01) {
|
||||||
lpt_write(0, test_pattern, strlen(test_pattern));
|
lpt_write(0, test_pattern, strlen(test_pattern));
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
|
|
||||||
#if MODEL == MODEL_FOENIX_A2560K
|
#if MODEL == MODEL_FOENIX_A2560K
|
||||||
|
|
||||||
#define LPT_DATA_PORT ((volatile unsigned char *)0x00C02378)
|
#define LPT_DATA_PORT ((volatile unsigned char *)0xFEC02378)
|
||||||
|
|
||||||
#define LPT_STAT_PORT ((volatile unsigned char *)0x00C02379)
|
#define LPT_STAT_PORT ((volatile unsigned char *)0xFEC02379)
|
||||||
#define LPT_STAT_BUSY 0x80
|
#define LPT_STAT_BUSY 0x80
|
||||||
#define LPT_STAT_ACK 0x40
|
#define LPT_STAT_ACK 0x40
|
||||||
#define LPT_STAT_PO 0x20
|
#define LPT_STAT_PO 0x20
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
#define LPT_STAT_ERROR 0x08
|
#define LPT_STAT_ERROR 0x08
|
||||||
#define LPT_STAT_IRQ 0x04
|
#define LPT_STAT_IRQ 0x04
|
||||||
|
|
||||||
#define LPT_CTRL_PORT ((volatile unsigned char *)0x00C0237A)
|
#define LPT_CTRL_PORT ((volatile unsigned char *)0xFEC0237A)
|
||||||
#define LPT_CTRL_STROBE 0x01
|
#define LPT_CTRL_STROBE 0x01
|
||||||
#define LPT_CTRL_AL 0x02
|
#define LPT_CTRL_AL 0x02
|
||||||
#define LPT_CTRL_INIT 0x04
|
#define LPT_CTRL_INIT 0x04
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
#define LPT_CTRL_IRQE 0x10
|
#define LPT_CTRL_IRQE 0x10
|
||||||
#define LPT_CTRL_BI 0x20
|
#define LPT_CTRL_BI 0x20
|
||||||
|
|
||||||
#define LPT_INIT_ON 0x08 /* Start the printer initialization process */
|
#define LPT_INIT_ON 0x04 /* Start the printer initialization process */
|
||||||
#define LPT_INIT_OFF 0x0C /* Stop the printer initialization process */
|
#define LPT_INIT_OFF 0x0C /* Stop the printer initialization process */
|
||||||
#define LPT_STROBE_ON 0x0D /* Strobe the printer */
|
#define LPT_STROBE_ON 0x0D /* Strobe the printer */
|
||||||
#define LPT_STROBE_OFF 0x0C /* Drop the strobe to the printer */
|
#define LPT_STROBE_OFF 0x0C /* Drop the strobe to the printer */
|
||||||
|
@ -40,22 +40,15 @@ void lpt_delay() {
|
||||||
while (target_jiffies > sys_time_jiffies()) ;
|
while (target_jiffies > sys_time_jiffies()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Install the LPT driver
|
|
||||||
*/
|
|
||||||
short lpt_install() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lpt_initialize() {
|
void lpt_initialize() {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Set the outputs to start the initialization process */
|
/* Set the outputs to start the initialization process */
|
||||||
*LPT_CTRL_PORT = LPT_INIT_ON;
|
*LPT_CTRL_PORT = LPT_CTRL_SELECT;
|
||||||
lpt_delay();
|
lpt_delay();
|
||||||
|
|
||||||
/* Set the outputs to stop the initialization process */
|
/* Set the outputs to stop the initialization process */
|
||||||
*LPT_CTRL_PORT = LPT_INIT_OFF;
|
*LPT_CTRL_PORT = LPT_CTRL_INIT | LPT_CTRL_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -66,25 +59,18 @@ short lpt_write_b(p_channel chan, unsigned char b) {
|
||||||
/* TODO: convert it to interrupt driven */
|
/* TODO: convert it to interrupt driven */
|
||||||
|
|
||||||
/* Wait until the printer is not busy */
|
/* Wait until the printer is not busy */
|
||||||
while ((*LPT_STAT_PORT & LPT_STAT_BUSY) == 0) {
|
while ((*LPT_STAT_PORT & LPT_STAT_BUSY) == LPT_STAT_BUSY) {
|
||||||
lpt_delay();
|
lpt_delay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send the byte */
|
/* Send the byte */
|
||||||
if (b == 0x1b) { b = 'E'}
|
|
||||||
*LPT_DATA_PORT = b;
|
*LPT_DATA_PORT = b;
|
||||||
sys_chan_write_b(0, b);
|
|
||||||
|
|
||||||
/* Strobe the interface */
|
/* Strobe the interface */
|
||||||
//unsigned char ctrl = *LPT_CTRL_PORT;
|
//unsigned char ctrl = *LPT_CTRL_PORT;
|
||||||
*LPT_CTRL_PORT = LPT_STROBE_ON;
|
*LPT_CTRL_PORT = LPT_CTRL_INIT | LPT_CTRL_SELECT ;
|
||||||
lpt_delay();
|
lpt_delay();
|
||||||
*LPT_CTRL_PORT = LPT_STROBE_OFF;
|
*LPT_CTRL_PORT = LPT_CTRL_INIT | LPT_CTRL_SELECT | LPT_CTRL_STROBE;
|
||||||
|
|
||||||
/* Wait until the printer is not busy */
|
|
||||||
while ((*LPT_STAT_PORT & LPT_STAT_BUSY) == 0) {
|
|
||||||
lpt_delay();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* Return success */
|
return 0; /* Return success */
|
||||||
}
|
}
|
||||||
|
@ -106,4 +92,11 @@ short lpt_write(p_channel chan, unsigned char * buffer, short size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install the LPT driver
|
||||||
|
*/
|
||||||
|
short lpt_install() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
5100
src/foenixmcp.s68
Normal file
5100
src/foenixmcp.s68
Normal file
File diff suppressed because it is too large
Load diff
19802
src/mapfile
19802
src/mapfile
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue