static int sb16midi_out (int dev, unsigned char midi_byte) { int timeout; unsigned long flags; /* * Test for input since pending input seems to block the output. */ DISABLE_INTR (flags); if (input_avail ()) sb16midi_input_loop (); RESTORE_INTR (flags); /* * Sometimes it takes about 13000 loops before the output becomes ready * (After reset). Normally it takes just about 10 loops. */ for (timeout = 30000; timeout > 0 && !output_ready (); timeout--); /* * Wait */ if (!output_ready ()) { printk ("MPU-401: Timeout\n"); return 0; } sb16midi_write (midi_byte); return 1; }
static int sb16midi_out(int dev, u_char midi_byte) { int timeout; u_long flags; /* * Test for input since pending input seems to block the output. */ flags = splhigh(); if (input_avail()) sb16midi_input_loop(); splx(flags); /* * Sometimes it takes about 13000 loops before the output becomes * ready (After reset). Normally it takes just about 10 loops. */ for (timeout = 30000; timeout > 0 && !output_ready(); timeout--); /* Wait */ if (!output_ready()) { printf("MPU-401: Timeout\n"); return 0; } sb16midi_write(midi_byte); return 1; }
static int uart6850_out(int dev, unsigned char midi_byte) { int timeout; unsigned long flags; /* * Test for input since pending input seems to block the output. */ spin_lock_irqsave(&lock,flags); if (input_avail()) uart6850_input_loop(); spin_unlock_irqrestore(&lock,flags); /* * Sometimes it takes about 13000 loops before the output becomes ready * (After reset). Normally it takes just about 10 loops. */ for (timeout = 30000; timeout > 0 && !output_ready(); timeout--); /* * Wait */ if (!output_ready()) { printk(KERN_WARNING "Midi6850: Timeout\n"); return 0; } uart6850_write(midi_byte); return 1; }
static void sb16midi_input_loop (void) { while (input_avail ()) { unsigned char c = sb16midi_read (); if (sb16midi_opened & OPEN_READ) midi_input_intr (my_dev, c); } }
static void sb16midi_input_loop(void) { while (input_avail()) { u_char c = sb16midi_read(); if (c == MPU_ACK) input_byte = c; else if (sb16midi_opened & OPEN_READ && midi_input_intr) midi_input_intr(my_dev, c); } }
void uart401intr(int irq, void *dev_id, struct pt_regs *dummy) { uart401_devc *devc = dev_id; if (devc == NULL) { printk(KERN_ERR "uart401: bad devc\n"); return; } if (input_avail(devc)) uart401_input_loop(devc); }
static void uart6850_input_loop(void) { int count = 10; while (count) { /* * Not timed out */ if (input_avail()) { unsigned char c = uart6850_read(); count = 100; if (uart6850_opened & OPEN_READ) midi_input_intr(my_dev, c); } else { while (!input_avail() && count) count--; } } }
irqreturn_t uart401intr(int irq, void *dev_id) { uart401_devc *devc = dev_id; if (devc == NULL) { printk(KERN_ERR "uart401: bad devc\n"); return IRQ_NONE; } if (input_avail(devc)) uart401_input_loop(devc); return IRQ_HANDLED; }
static int reset_uart401(uart401_devc * devc) { int ok, timeout, n; /* * Send the RESET command. Try again if no success at the first time. */ ok = 0; for (n = 0; n < 2 && !ok; n++) { for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); devc->input_byte = 0; uart401_cmd(devc, MPU_RESET); /* * Wait at least 25 msec. This method is not accurate so let's make the * loop bit longer. Cannot sleep since this is called during boot. */ for (timeout = 50000; timeout > 0 && !ok; timeout--) { if (devc->input_byte == MPU_ACK) /* Interrupt */ ok = 1; else if (input_avail(devc)) { if (uart401_read(devc) == MPU_ACK) ok = 1; } } } if (ok) { DEB(printk("Reset UART401 OK\n")); } else DDB(printk("Reset UART401 failed - No hardware detected.\n")); if (ok) uart401_input_loop(devc); /* * Flush input before enabling interrupts */ return ok; }
static void uart401_input_loop(uart401_devc * devc) { int work_limit=30000; while (input_avail(devc) && --work_limit) { unsigned char c = uart401_read(devc); if (c == MPU_ACK) devc->input_byte = c; else if (devc->opened & OPEN_READ && devc->midi_input_intr) devc->midi_input_intr(devc->my_dev, c); } if(work_limit==0) printk(KERN_WARNING "Too much work in interrupt on uart401 (0x%X). UART jabbering ??\n", devc->base); }
static int reset_sb16midi (void) { unsigned long flags; int ok, timeout, n; /* * Send the RESET command. Try again if no success at the first time. */ ok = 0; DISABLE_INTR (flags); for (n = 0; n < 2 && !ok; n++) { for (timeout = 30000; timeout < 0 && !output_ready (); timeout--); /* * Wait */ sb16midi_cmd (MPU_RESET); /* * Send MPU-401 RESET Command */ /* * Wait at least 25 msec. This method is not accurate so let's make the * loop bit longer. Cannot sleep since this is called during boot. */ for (timeout = 50000; timeout > 0 && !ok; timeout--) if (input_avail ()) if (sb16midi_read () == MPU_ACK) ok = 1; } sb16midi_opened = 0; if (ok) sb16midi_input_loop (); /* * Flush input before enabling interrupts */ RESTORE_INTR (flags); return ok; }
static int reset_sb16midi(void) { int ok, timeout, n; /* * Send the RESET command. Try again if no success at the first time. */ if (inb(STATPORT) == 0xff) return 0; ok = 0; /* flags = splhigh(); */ for (n = 0; n < 2 && !ok; n++) { for (timeout = 30000; timeout < 0 && !output_ready(); timeout--); /* Wait */ input_byte = 0; sb16midi_cmd(MPU_RESET); /* Send MPU-401 RESET Command */ /* * Wait at least 25 msec. This method is not accurate so * let's make the loop bit longer. Cannot sleep since this is * called during boot. */ for (timeout = 50000; timeout > 0 && !ok; timeout--) if (input_byte == MPU_ACK) /* Interrupt */ ok = 1; else if (input_avail()) if (sb16midi_read() == MPU_ACK) ok = 1; } sb16midi_opened = 0; if (ok) sb16midi_input_loop(); /* Flush input before enabling * interrupts */ /* splx(flags); */ return ok; }
static void poll_uart6850(unsigned long dummy) { unsigned long flags; if (!(uart6850_opened & OPEN_READ)) return; /* Device has been closed */ spin_lock_irqsave(&lock,flags); if (input_avail()) uart6850_input_loop(); uart6850_timer.expires = 1 + jiffies; add_timer(&uart6850_timer); /* * Come back later */ spin_unlock_irqrestore(&lock,flags); }
long attach_sb16midi (long mem_start, struct address_info *hw_config) { int ok, timeout; unsigned long flags; sb16midi_base = hw_config->io_base; if (!sb16midi_detected) return RET_ERROR (EIO); DISABLE_INTR (flags); for (timeout = 30000; timeout < 0 && !output_ready (); timeout--); /* * Wait */ sb16midi_cmd (UART_MODE_ON); ok = 0; for (timeout = 50000; timeout > 0 && !ok; timeout--) if (input_avail ()) if (sb16midi_read () == MPU_ACK) ok = 1; RESTORE_INTR (flags); if (num_midis >= MAX_MIDI_DEV) { printk ("Sound: Too many midi devices detected\n"); return mem_start; } #if defined(__FreeBSD__) printk ("sbmidi0: <SoundBlaster MPU-401>"); #else printk (" <SoundBlaster MPU-401>"); #endif std_midi_synth.midi_dev = my_dev = num_midis; midi_devs[num_midis++] = &sb16midi_operations; return mem_start; }
static void enter_uart_mode(uart401_devc * devc) { int ok, timeout; unsigned long flags; spin_lock_irqsave(&devc->lock,flags); for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); devc->input_byte = 0; uart401_cmd(devc, UART_MODE_ON); ok = 0; for (timeout = 50000; timeout > 0 && !ok; timeout--) if (devc->input_byte == MPU_ACK) ok = 1; else if (input_avail(devc)) if (uart401_read(devc) == MPU_ACK) ok = 1; spin_unlock_irqrestore(&devc->lock,flags); }
static int uart401_out(int dev, unsigned char midi_byte) { int timeout; unsigned long flags; uart401_devc *devc = (uart401_devc *) midi_devs[dev]->devc; if (devc->disabled) return 1; /* * Test for input since pending input seems to block the output. */ save_flags(flags); cli(); if (input_avail(devc)) uart401_input_loop(devc); restore_flags(flags); /* * Sometimes it takes about 13000 loops before the output becomes ready * (After reset). Normally it takes just about 10 loops. */ for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); if (!output_ready(devc)) { printk(KERN_WARNING "uart401: Timeout - Device not responding\n"); devc->disabled = 1; reset_uart401(devc); enter_uart_mode(devc); return 1; } uart401_write(devc, midi_byte); return 1; }
static int uart401_open(int dev, int mode, void (*input) (int dev, unsigned char data), void (*output) (int dev) ) { uart401_devc *devc = (uart401_devc *) midi_devs[dev]->devc; if (devc->opened) return -EBUSY; /* Flush the UART */ while (input_avail(devc)) uart401_read(devc); devc->midi_input_intr = input; devc->opened = mode; enter_uart_mode(devc); devc->disabled = 0; return 0; }
static void poll_uart6850 (unsigned long dummy) { unsigned long flags; DEFINE_TIMER (uart6850_timer, poll_uart6850); if (!(uart6850_opened & OPEN_READ)) return; /* * No longer required */ DISABLE_INTR (flags); if (input_avail ()) uart6850_input_loop (); ACTIVATE_TIMER (uart6850_timer, poll_uart6850, 1); /* * Come back later */ RESTORE_INTR (flags); }
void attach_sb16midi(struct address_info * hw_config) { int ok, timeout; u_long flags; sb16midi_base = hw_config->io_base; if (!sb16midi_detected) return; flags = splhigh(); for (timeout = 30000; timeout < 0 && !output_ready(); timeout--); /* Wait */ input_byte = 0; sb16midi_cmd(UART_MODE_ON); ok = 0; for (timeout = 50000; timeout > 0 && !ok; timeout--) if (input_byte == MPU_ACK) ok = 1; else if (input_avail()) if (sb16midi_read() == MPU_ACK) ok = 1; splx(flags); if (num_midis >= MAX_MIDI_DEV) { printf("Sound: Too many midi devices detected\n"); return; } conf_printf("SoundBlaster MPU-401", hw_config); std_midi_synth.midi_dev = my_dev = num_midis; midi_devs[num_midis++] = &sb16midi_operations; return; }
bool ResultLog::LoadResults(void) { wxFile file; wxString strPath, strDefaultCwd; strPath = wxStandardPaths::Get().GetUserDataDir(); if( !wxFileName::DirExists(strPath) ) { wxFileName::Mkdir( strPath, 0777, wxPATH_MKDIR_FULL ); } strDefaultCwd = wxGetCwd(); wxSetWorkingDirectory( strPath ); if( !file.Exists(wxT("standard.log")) ) { file.Create(wxT("standard.log")); file.Close(); } if( !file.Exists(wxT("rtt.log") )) { file.Create(wxT("rtt.log")); file.Close(); } if( !file.Exists(wxT("availability.log")) ) { file.Create(wxT("availability.log")); file.Close(); } if( !file.Exists(wxT("throughput.log")) ) { file.Create(wxT("throughput.log")); file.Close(); } // The standard results Result *r = (*m_Results)[wxT("standard")]; wxFileInputStream input( wxT("standard.log") ); if( input.Ok() ) { wxTextInputStream text( input ); do { wxString str = text.ReadLine(); // Just skip empty lines if( str.Trim().Trim(false).Length() == 0 ) continue; wxStringTokenizer tkz(str, wxT("\t"), wxTOKEN_RET_EMPTY ); StringValueList *row = new StringValueList(); wxString *Date = new wxString( tkz.GetNextToken() ); wxString *Bandwidth = new wxString( tkz.GetNextToken() ); row->Append( Date ); row->Append( Bandwidth ); r->AddRow( *row ); } while( input.IsOk() ); } // The availability results r = (*m_Results)[wxT("availability")]; wxFileInputStream input_avail( wxT("availability.log") ); if( input_avail.Ok() ) { wxTextInputStream text_avail( input_avail ); do { wxString str = text_avail.ReadLine(); // Just skip empty lines if( str.Trim().Trim(false).Length() == 0 ) continue; wxStringTokenizer tkz(str, wxT("\t"), wxTOKEN_RET_EMPTY ); StringValueList *row = new StringValueList(); wxString *Date = new wxString( tkz.GetNextToken() ); wxString *TCP_Connects = new wxString( tkz.GetNextToken() ); wxString *TCP_Count = new wxString( tkz.GetNextToken() ); wxString *ICMP_Sent = new wxString( tkz.GetNextToken() ); wxString *ICMP_Rec = new wxString( tkz.GetNextToken() ); wxString *ICMP_Count = new wxString( tkz.GetNextToken() ); wxString *ICMP_Values = new wxString( tkz.GetNextToken() ); wxString *TCP_Values = new wxString( tkz.GetNextToken() ); // TEMPORARY FIX FOR CHANGE OF FORMAT // FROM VERSION 5.0 -> 5.0.1 ICMP_Values->Replace( wxT(","), wxT("|") ); TCP_Values->Replace( wxT(","), wxT("|") ); row->Append( Date ); row->Append( TCP_Connects ); row->Append( TCP_Count ); row->Append( ICMP_Sent ); row->Append( ICMP_Rec ); row->Append( ICMP_Count ); row->Append( ICMP_Values ); row->Append( TCP_Values ); r->AddRow( *row ); } while( input_avail.IsOk() ); } // The rtt packeloss results r = (*m_Results)[wxT("rtt")]; wxFileInputStream input_rtt( wxT("rtt.log") ); if( input_rtt.Ok() ) { wxTextInputStream text_rtt( input_rtt ); do { wxString str = text_rtt.ReadLine(); // Just skip empty lines if( str.Trim().Trim(false).Length() == 0 ) continue; wxStringTokenizer tkz(str, wxT("\t"), wxTOKEN_RET_EMPTY ); StringValueList *row = new StringValueList(); wxString *Date = new wxString( tkz.GetNextToken() ); wxString *Responding = new wxString( tkz.GetNextToken() ); wxString *HostCount = new wxString( tkz.GetNextToken() ); wxString *Packets_Sent = new wxString( tkz.GetNextToken() ); wxString *Packets_Recieved = new wxString( tkz.GetNextToken() ); wxString *RTT_Max = new wxString( tkz.GetNextToken() ); wxString *RTT_Min = new wxString( tkz.GetNextToken() ); wxString *RTT_Average = new wxString( tkz.GetNextToken() ); wxString *Jitter = new wxString( tkz.GetNextToken() ); wxString *RTT_Values = new wxString( tkz.GetNextToken() ); // TEMPORARY FIX FOR CHANGE OF FORMAT // FROM VERSION 5.0 -> 5.0.1 RTT_Values->Replace(wxT(","), wxT("|")); row->Append( Date ); row->Append( Responding); row->Append( HostCount ); row->Append( Packets_Sent ); row->Append( Packets_Recieved ); row->Append( RTT_Max ); row->Append( RTT_Min ); row->Append( RTT_Average ); row->Append( Jitter ); row->Append( RTT_Values ); r->AddRow( *row ); } while( input_rtt.IsOk() ); } // The throughput packeloss results r = (*m_Results)[wxT("throughput")]; wxFileInputStream input_thr( wxT("throughput.log") ); if( input_thr.Ok() ) { wxTextInputStream text_thr( input_thr ); do { wxString str = text_thr.ReadLine(); // Just skip empty lines if( str.Trim().Trim(false).Length() == 0 ) continue; wxStringTokenizer tkz(str, wxT("\t"), wxTOKEN_RET_EMPTY ); StringValueList *row = new StringValueList(); wxString *Date = new wxString( tkz.GetNextToken() ); wxString *TPDown = new wxString( tkz.GetNextToken() ); wxString *TPUp = new wxString( tkz.GetNextToken() ); wxString *HTTP = new wxString( tkz.GetNextToken() ); wxString *FTP = new wxString( tkz.GetNextToken() ); wxString *D_TP_Values = new wxString( tkz.GetNextToken() ); wxString *U_TP_Values = new wxString( tkz.GetNextToken() ); wxString *HTTP_Values = new wxString( tkz.GetNextToken() ); wxString *FTP_Values = new wxString( tkz.GetNextToken() ); // TEMPORARY FIX FOR CHANGE OF FORMAT // FROM VERSION 5.0 -> 5.0.1 D_TP_Values->Replace(wxT(","), wxT("|")); U_TP_Values->Replace(wxT(","), wxT("|")); HTTP_Values->Replace(wxT(","), wxT("|")); FTP_Values->Replace(wxT(","), wxT("|")); row->Append( Date ); row->Append( TPDown ); row->Append( TPUp ); row->Append( HTTP ); row->Append( FTP ); row->Append( D_TP_Values ); row->Append( U_TP_Values ); row->Append( HTTP_Values ); row->Append( FTP_Values ); r->AddRow( *row ); } while( input_thr.IsOk() ); } wxSetWorkingDirectory( strDefaultCwd ); return true; }
void m6850intr (int unit) { if (input_avail ()) uart6850_input_loop (); }
void sb16midiintr (int unit) { if (input_avail ()) sb16midi_input_loop (); }
static irqreturn_t m6850intr(int irq, void *dev_id, struct pt_regs *dummy) { if (input_avail()) uart6850_input_loop(); return IRQ_HANDLED; }
static irqreturn_t m6850intr(int irq, void *dev_id) { if (input_avail()) uart6850_input_loop(); return IRQ_HANDLED; }