static inline void ata_scc_out(char c) { do { MFPDELAY(); } while (!(atari_scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ MFPDELAY(); atari_scc.cha_b_data = c; }
int atari_scc_console_wait_key(struct console *co) { do { MFPDELAY(); } while (!(atari_scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */ MFPDELAY(); return atari_scc.cha_b_data; }
static inline unsigned long SCSI_DMA_GETADR(void) { unsigned long adr; adr = st_dma.dma_lo; MFPDELAY(); adr |= (st_dma.dma_md & 0xff) << 8; MFPDELAY(); adr |= (st_dma.dma_hi & 0xff) << 16; MFPDELAY(); return adr; }
static inline void SCSI_DMA_SETADR(unsigned long adr) { st_dma.dma_lo = (unsigned char)adr; MFPDELAY(); adr >>= 8; st_dma.dma_md = (unsigned char)adr; MFPDELAY(); adr >>= 8; st_dma.dma_hi = (unsigned char)adr; MFPDELAY(); }
static unsigned long get_dma_addr( void ) { unsigned long addr; addr = dma_wd.dma_lo & 0xff; MFPDELAY(); addr |= (dma_wd.dma_md & 0xff) << 8; MFPDELAY(); addr |= (dma_wd.dma_hi & 0xff) << 16; MFPDELAY(); return( addr ); }
static void start_print( int device ) { struct slm *sip = &slm_info[device]; unsigned char *cmd; unsigned long paddr; int i; stdma_lock( slm_interrupt, NULL ); CMDSET_TARG_LUN( slmprint_cmd, sip->target, sip->lun ); cmd = slmprint_cmd; paddr = virt_to_phys( SLMBuffer ); dma_cache_maintenance( paddr, virt_to_phys(BufferP)-paddr, 1 ); DISABLE_IRQ(); /* Low on A1 */ dma_wd.dma_mode_status = 0x88; MFPDELAY(); /* send the command bytes except the last */ for( i = 0; i < 5; ++i ) { DMA_LONG_WRITE( *cmd++, 0x8a ); udelay(20); if (!acsi_wait_for_IRQ( HZ/2 )) { SLMError = 1; return; /* timeout */ } } /* last command byte */ DMA_LONG_WRITE( *cmd++, 0x82 ); MFPDELAY(); /* set DMA address */ set_dma_addr( paddr ); /* program DMA for write and select sector counter reg */ dma_wd.dma_mode_status = 0x192; MFPDELAY(); /* program for 255*512 bytes and start DMA */ DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); #ifndef SLM_CONT_CNT_REPROG SLMCurAddr = paddr; SLMEndAddr = paddr + SLMSliceSize + SLM_DMA_INT_OFFSET; #endif START_TIMER( DMA_STARTUP_TIME + DMA_TIME_FOR( SLMSliceSize )); #if !defined(SLM_CONT_CNT_REPROG) && defined(DEBUG) printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); #endif ENABLE_IRQ(); }
static void set_dma_addr( unsigned long paddr ) { unsigned long flags; save_flags(flags); cli(); dma_wd.dma_lo = (unsigned char)paddr; paddr >>= 8; MFPDELAY(); dma_wd.dma_md = (unsigned char)paddr; paddr >>= 8; MFPDELAY(); if (ATARIHW_PRESENT( EXTD_DMA )) st_dma_ext_dmahi = (unsigned short)paddr; else dma_wd.dma_hi = (unsigned char)paddr; MFPDELAY(); restore_flags(flags); }
static int ata_par_out (char c) { unsigned char tmp; /* This a some-seconds timeout in case no printer is connected */ unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */ ; if (!i) return( 0 ); sound_ym.rd_data_reg_sel = 15; /* select port B */ sound_ym.wd_data = c; /* put char onto port */ sound_ym.rd_data_reg_sel = 14; /* select port A */ tmp = sound_ym.rd_data_reg_sel; sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ MFPDELAY(); /* wait a bit */ sound_ym.wd_data = tmp | 0x20; /* set strobe H */ return( 1 ); }
static void slm_interrupt(int irc, void *data, struct pt_regs *fp) { unsigned long addr; int stat; STOP_TIMER(); addr = get_dma_addr(); stat = acsi_getstatus(); SLMError = (stat < 0) ? SLMSTAT_ACSITO : (addr < virt_to_phys(BufferP)) ? SLMSTAT_NOTALL : stat; dma_wd.dma_mode_status = 0x80; MFPDELAY(); #ifdef DEBUG printk( "SLM: interrupt, addr=%#lx, error=%d\n", addr, SLMError ); #endif wake_up( &print_wait ); stdma_release(); ENABLE_IRQ(); }
static void slm_test_ready( unsigned long dummy ) { #ifdef SLM_CONT_CNT_REPROG /* program for 255*512 bytes again */ dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; START_TIMER( DMA_TIME_FOR(0) ); #ifdef DEBUG printk( "SLM: reprogramming timer for %d jiffies, addr=%#lx\n", DMA_TIME_FOR(0), get_dma_addr() ); #endif #else /* !SLM_CONT_CNT_REPROG */ unsigned long flags, addr; int d, ti; #ifdef DEBUG struct timeval start_tm, end_tm; int did_wait = 0; #endif save_flags(flags); cli(); addr = get_dma_addr(); if ((d = SLMEndAddr - addr) > 0) { restore_flags(flags); /* slice not yet finished, decide whether to start another timer or to * busy-wait */ ti = DMA_TIME_FOR( d ); if (ti > 0) { #ifdef DEBUG printk( "SLM: reprogramming timer for %d jiffies, rest %d bytes\n", ti, d ); #endif START_TIMER( ti ); return; } /* wait for desired end address to be reached */ #ifdef DEBUG do_gettimeofday( &start_tm ); did_wait = 1; #endif cli(); while( get_dma_addr() < SLMEndAddr ) barrier(); } /* slice finished, start next one */ SLMCurAddr += SLMSliceSize; #ifdef SLM_CONTINUOUS_DMA /* program for 255*512 bytes again */ dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; #else /* set DMA address; * add 2 bytes for the ones in the SLM controller FIFO! */ set_dma_addr( SLMCurAddr + 2 ); /* toggle DMA to write and select sector counter reg */ dma_wd.dma_mode_status = 0x92; MFPDELAY(); dma_wd.dma_mode_status = 0x192; MFPDELAY(); /* program for 255*512 bytes and start DMA */ DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); #endif restore_flags(flags); #ifdef DEBUG if (did_wait) { int ms; do_gettimeofday( &end_tm ); ms = (end_tm.tv_sec*1000000+end_tm.tv_usec) - (start_tm.tv_sec*1000000+start_tm.tv_usec); printk( "SLM: did %ld.%ld ms busy waiting for %d bytes\n", ms/1000, ms%1000, d ); } else printk( "SLM: didn't wait (!)\n" ); #endif if ((unsigned char *)PTOV( SLMCurAddr + SLMSliceSize ) >= BufferP) { /* will be last slice, no timer necessary */ #ifdef DEBUG printk( "SLM: CurAddr=%#lx EndAddr=%#lx last slice -> no timer\n", SLMCurAddr, SLMEndAddr ); #endif } else { /* not last slice */ SLMEndAddr = SLMCurAddr + SLMSliceSize + SLM_DMA_INT_OFFSET; START_TIMER( DMA_TIME_FOR( SLMSliceSize )); #ifdef DEBUG printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); #endif } #endif /* SLM_CONT_CNT_REPROG */ }
void atari_init_INTS(void) { int i; /* initialize the vector table */ for (i = 0; i < NUM_INT_SOURCES; ++i) { vectors[IRQ_SOURCE_TO_VECTOR(i)] = bad_interrupt; } /* Initialize the MFP(s) */ #ifdef ATARI_USE_SOFTWARE_EOI mfp.vec_adr = 0x48; /* Software EOI-Mode */ #else mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ #endif mfp.int_en_a = /* turn off MFP-Ints */ mfp.int_en_b = 0x00; mfp.int_mk_a = /* no Masking */ mfp.int_mk_b = 0xff; if (ATARIHW_PRESENT(TT_MFP)) { #ifdef ATARI_USE_SOFTWARE_EOI tt_mfp.vec_adr = 0x58; /* Software EOI-Mode */ #else tt_mfp.vec_adr = 0x50; /* Automatic EOI-Mode */ #endif tt_mfp.int_en_a = /* turn off MFP-Ints */ tt_mfp.int_en_b = 0x00; tt_mfp.int_mk_a = /* no Masking */ tt_mfp.int_mk_b = 0xff; } if (ATARIHW_PRESENT(SCC)) { scc.cha_a_ctrl = 9; MFPDELAY(); scc.cha_a_ctrl = (char) 0xc0; /* hardware reset */ } if (ATARIHW_PRESENT(SCU)) { /* init the SCU if present */ tt_scu.sys_mask = 0x10; /* enable VBL (for the cursor) and * disable HSYNC interrupts (who * needs them?) MFP and SCC are * enabled in VME mask */ tt_scu.vme_mask = 0x60; /* enable MFP and SCC ints */ } else { /* If no SCU, the HSYNC interrupt needs to be disabled this * way. (Else _inthandler in kernel/sys_call.S gets overruns) */ vectors[VEC_INT2] = falcon_hblhandler; } if (ATARIHW_PRESENT(PCM_8BIT) && ATARIHW_PRESENT(MICROWIRE)) { /* Initialize the LM1992 Sound Controller to enable the PSG sound. This is misplaced here, it should be in a atasound_init(), that doesn't exist yet. */ atari_microwire_cmd(MW_LM1992_PSG_HIGH); } stdma_init(); /* Initialize the PSG: all sounds off, both ports output */ sound_ym.rd_data_reg_sel = 7; sound_ym.wd_data = 0xff; }
void __init atari_init_IRQ(void) { m68k_setup_user_interrupt(VEC_USER, NUM_ATARI_SOURCES - IRQ_USER, NULL); m68k_setup_irq_controller(&atari_irq_controller, 1, NUM_ATARI_SOURCES - 1); /* Initialize the MFP(s) */ #ifdef ATARI_USE_SOFTWARE_EOI st_mfp.vec_adr = 0x48; /* Software EOI-Mode */ #else st_mfp.vec_adr = 0x40; /* Automatic EOI-Mode */ #endif st_mfp.int_en_a = 0x00; /* turn off MFP-Ints */ st_mfp.int_en_b = 0x00; st_mfp.int_mk_a = 0xff; /* no Masking */ st_mfp.int_mk_b = 0xff; if (ATARIHW_PRESENT(TT_MFP)) { #ifdef ATARI_USE_SOFTWARE_EOI tt_mfp.vec_adr = 0x58; /* Software EOI-Mode */ #else tt_mfp.vec_adr = 0x50; /* Automatic EOI-Mode */ #endif tt_mfp.int_en_a = 0x00; /* turn off MFP-Ints */ tt_mfp.int_en_b = 0x00; tt_mfp.int_mk_a = 0xff; /* no Masking */ tt_mfp.int_mk_b = 0xff; } if (ATARIHW_PRESENT(SCC) && !atari_SCC_reset_done) { scc.cha_a_ctrl = 9; MFPDELAY(); scc.cha_a_ctrl = (char) 0xc0; /* hardware reset */ } if (ATARIHW_PRESENT(SCU)) { /* init the SCU if present */ tt_scu.sys_mask = 0x10; /* enable VBL (for the cursor) and * disable HSYNC interrupts (who * needs them?) MFP and SCC are * enabled in VME mask */ tt_scu.vme_mask = 0x60; /* enable MFP and SCC ints */ } else { /* If no SCU and no Hades, the HSYNC interrupt needs to be * disabled this way. (Else _inthandler in kernel/sys_call.S * gets overruns) */ vectors[VEC_INT2] = falcon_hblhandler; vectors[VEC_INT4] = falcon_hblhandler; } if (ATARIHW_PRESENT(PCM_8BIT) && ATARIHW_PRESENT(MICROWIRE)) { /* Initialize the LM1992 Sound Controller to enable the PSG sound. This is misplaced here, it should be in an atasound_init(), that doesn't exist yet. */ atari_microwire_cmd(MW_LM1992_PSG_HIGH); } stdma_init(); /* Initialize the PSG: all sounds off, both ports output */ sound_ym.rd_data_reg_sel = 7; sound_ym.wd_data = 0xff; }