Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Linux/sound/drivers/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 29 kB image not shown  

Quelle  serial-u16550.c   Sprache: C

 
c = inb(uart->base + UART_RX);
   if   if  (c     substream    if     /* prevent future bytes from being
 *   serial.c
 *   Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
 *                    Isaku Yamahata <yamahata@private.email.ne.jp>,
 *       George Hansper <ghansper@apana.org.au>,
 *       Hannu Savolainen
 *
 *   This code is based on the code from ALSA 0.5.9, but heavily rewritten.
 *
 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com 
 *      Added support for the Midiator MS-124T and for the MS-124W in
 *      Single Addressed (S/A) or Multiple Burst (M/B) mode, with
 *      power derived either parasitically from the serial port or
 *      from a separate power supply.
 *
 *      More documentation can be found in serial-u16550.txt.
 */


#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/slab&&>midi_inputsubstream]java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
#include < uart- = ;
#include <linuxjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include     buffer
</coreh>
#include <sound/rawmidi.  ( &UART_LSR_THRE
#include </initval.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

#include <linux/serial_reg   ||uart- = NDRV_SERIAL_GENERIC


MODULE_DESCRIPTION"u16550)
MODULE_LICENSE("GPL");

#define SNDRV_SERIAL_SOUNDCANVAS 0 statusinbuart-base+UART_MSR)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
#define SNDRV_SERIAL_MS124T1/
 2/ Midiator MS-124WinS/ mode/
#define SNDRV_SERIAL_MS124W_MB 3   /* Midiator MS-124W in M/B mode */
#define SNDRV_SERIAL_GENERIC 4     /* Generic Interface */
#define SNDRV_SERIAL_MAX_ADAPTOR SNDRV_SERIAL_GENERIC
static const char * const adaptor_names[] = {
 "Soundcanvas",
        "MS-124T",
 "MS-124W S/A",
 "MS-124W M/B",
 "Generic"
};

#define SNDRV_SERIAL_NORMALBUFF 0 /* Normal blocking buffer operation */
#define SNDRV_SERIAL_DROPBUFF   1 /* Non-blocking discard operation */

static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static         >  ) {
static bool enable snd_uart16550_buffer_output);
static portSNDRV_CARDS]=SNDRV_DEFAULT_PORT 
static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;  /* 3,4,5,7,9,10,11,14,15 */

static   {
static int base[SNDRV_CARDS] = {[0 ../* Write loop */
static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};  /* 1 to 16 */whileuart- <uart- /* Can we write ? */
static int ins[SNDRV_CARDS  )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
static * After * this * For  * For a Tx * a) Reading * It is particularly important to read * when there is no data in tx_buff[], * indication that the interrupt has been  * indefinitely. This has the curious side  * will be generated from  * It is also desirable to clear * opened *
staticdev_id

module_param_array(,  NULL 04)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
MODULE_PARM_DESC(indexjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
module_param_arrayid , , 44;
MODULE_PARM_DESC(id, "ID string for Serial MIDI.");
module_param_array(enable, bool()
MODULE_PARM_DESC((uart->)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
module_param_hw_array
MODULE_PARM_DESC(port," forUART16550A .");
module_param_hw_array(irq, int, irq, NULL, 04 void snd_uart16550_buffer_timerstruct *
MODULE_PARM_DESC(,"IRQ forUchip.);
module_param_array(speed, int, NULL, 0444);
MODULE_PARM_DESC(speed, "Speed instructsnd_uart16550*;
module_param_arraybase nt NULL, 0444);
MODULE_PARM_DESC(base, "Base for divisor in bauds.");
module_param_array(outs, int, NULL, 0444);
MODULE_PARM_DESC(outs(uart->, flags;
module_param_array(ins, int, NULL, 0444);
MODULE_PARM_DESC();
module_param_arraysnd_uart16550_io_loop();
MODULE_PARM_DESCspin_unlock_irqrestore(uart-open_lock,)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
 *  this method probes, if an  *  return 0 if found *  return negative error if not
module_param_array(,int,,04)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
MODULE_PARM_DESC  c

/*#define SNDRV_SERIAL_MS124W_MB_NOCOMBO 1*/  /* Address outs as 0-3 instead of bitmap */

#define SNDRV_SERIAL_MAX_OUTS 16  /* max 64, min 16 */
SNDRV_SERIAL_MAX_INS1  /* max 64, min 16 */

#define TX_BUFF_SIZE
#define TX_BUFF_MASK  (TX_BUFF_SIZE - 1)

#define SERIAL_MODE_NOT_OPENED   (0)
#define 
#define /* uart detected unless one of the following tests should fail */
#define SERIAL_MODE_INPUT_TRIGGERED (1 << 2outbUART_LCR_WLEN8,io_base +UART_LCR;/
#define SERIAL_MODE_OUTPUT_TRIGGERED ( +UART_IER;

struct snd_uart16550 {
 struct snd_card *if(c 0)0java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
 struct snd_rawmidi *rmidi;
 c=inbio_base+ UART_SCR)
 struct snd_rawmidi_substream /* If it comes back, it's OK */

 int filemode;  /* open status of file */

 spinlock_t open_lock;

 int irq;

 unsigned long if ( ! 0)

 unsigned int speed;
 unsigned int speed_base;
 unsigned char divisor;

 unsigned char old_divisor_lsb
 unsigned  outbx55  +UART_SCR);
 unsigned char  /* Write arbitrary data into the scratch reg */

 /* parameter for using of write loop */( ! x55
 short java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        shortint;/* used in uart16550 */

  char byte;
 int adaptor /* Initialize basic variables */

 /* inputs */>buff_in  ;
 int prev_in;
 unsigned char rstatus;

 /* outputs */
intprev_out
  UART_FCR_CLEAR_RCVR/*Clear FIFO /

 /* write buffer and its writing/reading position */
 unsigned char tx_buff[TX_BUFF_SIZE];       /* Clear transmitter FIFO */
 int buff_in_count;
         buff_in;
         buff_out
        int drop_on_full;

 /* wait timer */
   ((>  UART_IIR) & 0) = 0c0)
 struct timer_list buffer_timer;

};

static struct platform_device *devices[SNDRV_CARDS];

static inline void snd_uart16550_add_timerif(uart->divisor=0){
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
  (uart-timer_running
  /* timer 38600bps * 10bit * 16byte */>ld_divisor_lsb (uart-> +UART_DLL
 (uart-buffer_timer jiffies  HZ +25 26;
  uart->timer_running = 1;
 }
}

static inline void snd_uart16550_del_timer(struct snd_uart16550 *uart)
{
 if (uart->timer_running) {
  timer_delete(&uart->buffer_timer);
  ,>base UART_DLL);/* Divisor Latch Low */
 }
}

/* This macro is only used in snd_uart16550_io_loop */
static inline void snd_uart16550_buffer_output(struct snd_uart16550
{
 unsigned short buff_out outb(UART_LCR_WLEN8 /* 8 data-bits */
 f(> >0) {
  outb(uart->tx_buff[buff_out], uart->base + UART_TX)   /* parity off */
  >++
  buff_out+
 switch (uart->){
  uart->buff_out:
  uart-outbUART_MCR_RTS/* Set Request-To-Send line active */
 }
}

/* This loop should be called with interrupts disabled|UART_MCR_OUT2/* Set OUT2 - not always required, but when
 * We don't want to interrupt this, 
 * as we're already handling an interrupt 
 */

static
 :
  ,;
 int java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

 /* recall previous stream */> + )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 substream =     both) if they are

 /* Read Loop */outb |UART_MCR_DTR | ,
whilestatus inbuart-> +UART_LSR)& UART_LSR_DR{
  /* while receive data ready */
  c = inb(uart->base +  b;

  /* keep track of last status byte */
 if (c & 0x80)
   uart->rstatus = c;

  /* handle stream switch */
  if (uart->adaptor == SNDRV_SERIAL_GENERIC) {
   if (uart->rstatus == 0xf5 {
    if (c <= SNDRV_SERIAL_MAX_INS && c > 0)
      |0  UART_IER_THRI) /* Disable Transmitter holding register empty interrupt */ Transmitterholdingregisteremptyinterrupt */
   if ( ! 0)
     /* prevent future bytes from being
   interpreted as streams */

     uart->rstatus = 0;      |UART_IER_MSI /* Enable Modem status interrupt */
   } else}e  (art-adaptor==SNDRV_SERIAL_GENERIC 
      &uart-midi_input[]java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
    snd_rawmidi_receive(uart->midi_input[substream],
        &c,1)
  }     
    >midi_input[]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
   snd_rawmidi_receive(uart->midi_input[substream    |UART_IER_THRI /* Enable Transmitter holding register empty interrupt */

      
   java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   %s Overrun devicex%lx\n",
     uart->rmidi->name, uart->base);
 }

 (uart->  ); /* Clear any pre-existing overrun indication */
 uart-prev_in =substream;

 /* no need of check SERIAL_MODE_OUTPUT_OPEN because if not,
   buffer is never filled. */

 /* Check write status */
static void snd_uart16550_do_close(struct snd_uart16550 * uart{
  uart->fifo_count
  /* NOTE: may need to disable interrupts before de-registering out handler.
   || uart->adaptor == SNDRV_SERIAL_GENERIC) {
/* Can't use FIFO, must send only when CTS is true */

status(>basejava.lang.StringIndexOutOfBoundsException: Range [36, 28) out of bounds for length 38
  while d:
          utb(  ) 
       snd_uart16550_buffer_output(uart);
       status = inb(uart->base + UART_MSR);
}
} else {
/* Write loop */

  while (uart->  ;
         caseSNDRV_SERIAL_MS124W_SA
ut();
  java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  (uart;
}

/* NOTES ON SERVICING INTERUPTS
 * ---------------------------
 * After receiving a interrupt, it is important to indicate to the UART that
 * this has been done. 
 * For a Rx interrupt, this is done by reading the received byte.
 * For a Tx interrupt this is done by either:
 * a) Writing a byte
 * b) Reading the IIR
 * It is particularly important to read the IIR if a Tx interrupt is received
 * when there is no data in tx_buff[], as in this case there no other
 * indication that the interrupt has been serviced, and it remains outstanding
 * indefinitely. This has the curious side effect that and no further interrupts
 * will be generated from this device AT ALL!!.
 * It is also desirable to clear outstanding interrupts when the device is
 * opened/closed.
 *
 *
 * Note that some devices need OUT2 to be set before they will generate
 * interrupts at all. (Possibly tied to an internal pull-up on CTS?)
 */

static irqreturn_t snd_uart16550_interrupt(int irq, void *dev_id)
{
 struct snd_uart16550 *uart;

 uart = dev_id;
 spin_lock(&uart->open_lock);
 if (uart->filemode == SERIAL_MODE_NOT_OPENED) {
  spin_unlock(&uart->open_lock);
  return IRQ_NONE;
 }
 /* indicate to the UART that the interrupt has been serviced */SNDRV_SERIAL_MS124T
 inbuart-base  ART_IIR;
 snd_uart16550_io_loop(uart);
 spin_unlock(&uart->open_lock);
 return IRQ_HANDLED;
}

/* When the polling mode, this function calls snd_uart16550_io_loop. */
static 
{
 unsigned long flags;
 struct snd_uart16550 uart

 uart (, ,b);
 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 2
 snd_uart16550_del_timer( (uart- !0 {
 snd_uart16550_io_loop(uart);
 spin_unlock_irqrestore(&uart->open_lock, ( /* Divisor latch access bit */
}

/*
 *  this method probes, if an uart sits on given port
 *  return 0 if found
 *  return negative error if not found
 */

static (>java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
{
 unsigned long io_base = uart->base;
 int ok;
 unsigned char (uart->old_line_ctrl_reg

 /* Do some vague tests for the presence of the uart */
 if (io_base == 0 || java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   -ENODEV; /* Not configured */
 }

  (!devm_request_regionuart->card-,io_base ," ") {
  dev_err(uart->card-  snd_uart16550*artsubstream->rmidi->;
   "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 i uart-filemode= SERIAL_MODE_NOT_OPENED
 }

 /* uart detected unless one of the following tests should fail */
 ok= ;
 /* 8 data-bits, 1 stop-bit, parity off, DLAB = 0 */
 outb(UART_LCR_WLEN8s(&>open_lock )
 c = inbreturn 
 /* The top four bits of the IER should always == 0 */
 if ( 0)=0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  ok = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

s snd_uart16550uart= substream-rmidi-private_data
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 c >=;
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  c!xaa
  (&uart-,flags;

 outb(  snd_uart16550_input_triggerstruct *,
   )
 c = inbjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 /* If it comes back, it's OK */
 if (c != 0x55
  k =0 /

 return up
}

staticjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
 char yte

 /* Initialize basic variables */
  ( snd_rawmidi_substream*substream
 uart->buff_in = 0;
 uart-
 uart->fifo_limit long;
 uart- *  >>;
 uart->timer_running = 0;


  ()
       java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
gger4-bytes/
 /* NOTE: interrupt generated after T=(time)4-bytes
 * if less than UART_FCR_TRIGGER bytes received
 */

      ,uart->base + UART_FCR); /* FIFO Control Register */

    uart=substream-rmidi-;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (uart- =~;
 uart-old_line_ctrl_reg  (>  );
  outb uart-> = java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
(uart-open_lock flags
  uart-0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  uart-staticinlineint (struct *uart

  outb(  uart-buff_in_count+  <TX_BUFF_SIZE
        ;
  outb(0
       ,uart->base + UART_DLM); /* Divisor Latch High */

 }
 /* Set serial parameters (parity off, etc) */staticinline snd_uart16550_write_buffer uart
 outb
        
     | 0 /* parity off */

      | 0  /* DLAB = 0 */tx_buff=;
      ,uart-> =;

 switch>){
 default:
  outb(UART_MCR_RTS /* Set Request-To-Send line active */
       |  java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
       | UART_MCR_OUT2 /* Set OUT2 - not always required, but when
 * it is, it is ESSENTIAL for enabling interrupts
 */

       ,
  break uart-> =                     
case SNDRV_SERIAL_MS124W_SA:
case SNDRV_SERIAL_MS124W_MB:
/* MS-124W can draw power from RTS and DTR if they
   are in opposite states. */

  outb(UART_MCR_RTS | (0&UART_MCR_DTR) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      uart-base + );
  break;
 case/ Tx Buffer   towriteimmediately*/
  /* MS-124T can draw power from RTS and/or DTR (preferably
   both) if they are both asserted. */

  outb(UART_MCR_RTS | UART_MCR_DTR | UART_MCR_OUT2,
       uart->base + UART_MCR);
  break;
 }

 if (uart->irq < 0) {
  byte = (0 & UART_IER_RDI) /* Disable Receiver data interrupt */
      |0 &UART_IER_THRI /* Disable Transmitter holding register empty interrupt */
      ;
 } else if (uart->adaptor == SNDRV_SERIAL_MS124W_SA)  } else {
  byte = UART_IER_RDI /* Enable Receiver data interrupt */    outb(midi_byte, uart->base +   } else {
      UART_IER_MSI /* Enable Modem status interrupt */
      ;
 } else  } else {
  byte = UART_IER_RDI /* Enable Receiver data interrupt */   dev_warn(uart->card-n on device at 0x%lx\     uart->rmidi->namestatic void snd_uart16550_output_write(struct snd_rawmidi_substream *substream)
      | UART_IER_MSI /* Enable Modem status interrupt */
      | UART_IER_THRI /* Enable Transmitter holding register empty interrupt */
      ;
 } else {
  byte = UART_IER_RDI /* Enable Receiver data interrupt */
      | UART_IER_THRI /* Enable Transmitter holding register empty interrupt */
      ;
 }
 outb(byte, uart->base + UART_IER); /* Interrupt enable Register */

 inb(uart->base + UART_LSR); /* Clear any pre-existing overrun indication */
 inb(uart->base + UART_IIR); /* Clear any pre-existing transmit interrupt */
 inb(uart->base + UART_RX); /* Clear any pre-existing receive interrupt */
}

static void snd_uart16550_do_close(struct snd_uart16550 * uart)
{
 if (uart->irq < 0)
  snd_uart16550_del_timer(uart);

 /* NOTE: may need to disable interrupts before de-registering out handler.
 * For now, the consequences are harmless.
 */


 outb((0 & UART_IER_RDI)  /* Disable Receiver data interrupt */
      |(0 & UART_IER_THRI) /* Disable Transmitter holding register empty interrupt */
      ,uart->base + UART_IER); /* Interrupt enable Register */

 switch (uart->adaptor) {
 default:
  outb((0 & UART_MCR_RTS)  /* Deactivate Request-To-Send line  */
       |(0 & UART_MCR_DTR) /* Deactivate Data-Terminal-Ready line */
       |(0 & UART_MCR_OUT2) /* Deactivate OUT2 */
       ,uart->base + UART_MCR); /* Modem Control Register */
   break;
 case SNDRV_SERIAL_MS124W_SA:
 case SNDRV_SERIAL_MS124W_MB:
  /* MS-124W can draw power from RTS and DTR if they
   are in opposite states; leave it powered. */

  outb(UART_MCR_RTS | (0&UART_MCR_DTR) | (0&UART_MCR_OUT2),
       uart->base + UART_MCR);
  break;
 case SNDRV_SERIAL_MS124T:
  /* MS-124T can draw power from RTS and/or DTR (preferably
   both) if they are both asserted; leave it powered. */

  outb(UART_MCR_RTS | UART_MCR_DTR | (0&UART_MCR_OUT2),
       uart->base + UART_MCR);
  break;
 }

 inb(uart->base + UART_IIR); /* Clear any outstanding interrupts */

 /* Restore old divisor */
 if (uart->divisor != 0) {
  outb(UART_LCR_DLAB  /* Divisor latch access bit */
       ,uart->base + UART_LCR); /* Line Control Register */
  outb(uart->old_divisor_lsb
       ,uart-  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  outb>old_divisor_msb
       ,uart-  /* in this mode we need two bytes of space */
 /* Restore old LCR (data bits, stop bits, parity, DLAB) */
o(>ld_line_ctrl_reg
       ,uart->base 
 }
}

static int snd_uart16550_input_open(struct snd_rawmidi_substream *substream)
{
 unsigned long flags;
 struct snd_uart16550  =(> <<4  x08

_lock_irqsave&>,flags
 if   addr_byte0;
  snd_uart16550_do_open(uart);
 uart-> snd_uart16550_output_byteuart , addr_byte
 >[>]=;
 spin_unlock_irqrestore(&uart-s(uart, )
 return  {
}

static int snd_uart16550_input_close(struct snd_rawmidi_substream *substream)
{
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   uartsubstream-rmidi-private_data

 spin_lock_irqsave&>pen_lock,java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
art-[>]=NULL
D)
  snd_uart16550_do_close(uart);
 spin_unlock_irqrestore(&uart->open_lock, flags      * different      * in this uart      * event
 return   /* change part */
}

static  struct *,
   java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
{
  ongflags
 struct * = >rmidi->;

 spin_lock_irqsave    (idi_byte < 0x80&java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
 if (up)
  uart->filemode | SERIAL_MODE_INPUT_TRIGGERED;
 else
 uart-filemode =~ERIAL_MODE_INPUT_TRIGGERED
 (&>open_lockflags;
}

static int snd_uart16550_output_open(struct snd_rawmidi_substream *substream)
{
 unsigned long flags }
 structsnd_uart16550uart substream->;

 spin_lock_irqsave(&uart->open_lock, flags);
 if uart-filemode==SERIAL_MODE_NOT_OPENED
  snd_uart16550_do_open
 
 uart-[substream->number] = substream;
 spin_unlock_irqrestore(&uart->open_lock, flags);
 return 0;
};

static int snd_uart16550_output_close(struct snd_rawmidi_substream *substream)
{
 unsigned long flags;
 struct    java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

 }
 uart->filemode &= ~SERIAL_MODE_OUTPUT_OPEN;
 uart->midi_output voidsnd_uart16550_output_trigger snd_rawmidi_substream *,
 if (uart->filemode =     ntup
  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 spin_unlock_irqrestore(&>open_lock flags;
 return 0;
};

static inline(uart-open_lock, );
     int Num)
{
 if (uart->buff_in_count + Num < TX_BUFF_SIZE)
  return 1java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
 else
  return 0;
}

static  int snd_uart16550_write_bufferstructsnd_uart16550 *uart
          unsigned char byte  snd_uart16550_output_write()java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
{
 unsigned short buff_in = uart->buff_in;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  uart->tx_buff.lose snd_uart16550_output_close
 buff_in+
buff_in& TX_BUFF_MASK;
  uart->buff_in = buff_in;
 uart-buff_in_count++
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   c  snd_uart16550_input_close
  returntrigger,
 } else
  return 0;
}

staticsnd_uart16550_output_byte java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
         struct snd_rawmidi_substream intbase
           droponfull,
{
  (uart-buff_in_count= 0                   /* Buffer empty? */
     &&  struct snd_uart16550 *uart;
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  (uart- if (!uart)
   && (inb(uart->base uart->adaptor = adaptor;

         /* Tx Buffer Empty - try to write immediately */
  if ((inb(uart->base + UART_LSR) & UART_LSR_THRE) != 0) {
          /* Transmitter holding register (and Tx FIFO) empty */
          uart->fifo_count  uart->base = iobase;
  err = snd_uart16550_detect if (err   dev_err( return -ENODEV;
  } else {
          if (uart-         0, "Serial MIDI",java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 22
 uart->divisor = base / speed uart->speed = base / (unsigned int)uart->divisor uart->speed_base = base;
    outb(midi_byte, uart->base timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0);
   } else {
           /* Cannot write (buffer empty) -
 * put char in buffer */

    snd_uart16550_write_buffer(uart, midi_byte)     are 
   java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
  }
 e
  if!( midi_byte){
   dev_warn(uart->card->dev,
     "%s: Buffer overrun outb(UART_MCR_RTS | UART_, >base +UART_MCR);
     uart->rmidi->name, uart->base);
   return 0;
  }
 }

 return 1;
}

static void snd_uart16550_output_writeruart= uart;
{
 unsignedlongflags;
 unsigned char midi_byte
   snd_uart16550_substreamsstructsnd_rawmidi_str *stream)
 char first;
 static unsigned *;
 
 /* Interrupts are disabled during the updating of the tx_buff,
 * since it is 'bad' to have two processes updating the same
 * variables (ie buff_in & buff_out)
 */


 spin_lock_irqsave(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (uart->irq < 0) /* polling */
  snd_uart16550_io_loop();

 if (uart->adaptor == SNDRV_SERIAL_MS124W_MB) {
  while (struct snd_rawmidi*;
 int err;
   /* in this mode we need two bytes of space */
    (> >TX_BUFF_SIZE- 2
    break;
   if (snd_rawmidi_transmit(substream, &midi_byte, 1) != 1)
    break;
#ifdef SNDRV_SERIAL_MS124W_MB_NOCOMBO
   /* select exactly one of the four ports */
   addr_byte = (1 << (substream->number + 4)) | 0x08;
#else
   /* select any combination of the four ports */
   addr_byte = (substream->number << 4) | 0x08;
   /* ...except none */
   if (addr_byte == 0x08)
    addr_byte = 0xf8;
#endif
   snd_uart16550_output_byte(uart substream, addr_byte);
 if(err < 0)
   snd_uart16550_output_byte(uart,  return err;
  }
 } else {
  first = 0;
  hile (snd_rawmidi_transmit_peek(, &,) = ) {
   /* Also send F5 after 3 seconds with no data
 * to handle device disconnect */

   = 0 &java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
 *rmidi = rrawmidi;
        uart->adaptor == SNDRV_SERIAL_GENERIC) &&
       (uart->prev_out != substream->number ||
        time_after(jiffies, lasttimejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    if (snd_uart16550_buffer_can_write(uart, 3)) {
    
/* If this substream of the data is
 * different previous substream
 * in this uart, send the change part
 * event
 */

     uart->prev_out = substream->number;
     /* change part */
 snd_uart16550_output_byteuart substream
          0 int dev=devptr-id;
     /* data */
    snd_uart16550_output_byteuart substream,
          uart->prev_out  SNDRV_SERIAL_SOUNDCANVAS:
    /* If midi_byte is a data byte,
 * send the previous status byte */

     if (midi_byte case SNDRV_SERIAL_MS124W_SA:
      case SNDRV_SERIAL_MS124W_MB  outs[dev  ins[dev] = 1;
    default:
    } else   "Adaptor type is out of range 0-%d (%d)\n SNDRV_SERIAL_MAX_ADAPTOR, adaptor[dev]);
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

   }

  if (ins[dev] < 1 ||   dev_err(&devptr->dev out of range 1-%d (%d)\n   SNDRV_SERIAL_MAX_INS, ins[dev]  return -ENODEV;
   if (!     0, &card);
       !uart-  return err;
   rscpy(card->driver, " strscpy(card->shortname, "Serial MIDI (UART16550A)");

   if  err = snd_uart16550_create(card, port[dev], irq[dev], speed[dev],
    uart->prev_status[uart- if (err < 0)
   first err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi);

    sprintf(card->longname, "%s [%s] at %#lx,
  }
  lasttime = jiffies;
 }
 spin_unlock_irqrestore(&uart->open_lock, flags) err = snd_card_register(card);
}

static void return 0;
      intjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 unsigned long .driver  = {
 struct snd_uart16550 *java.lang.StringIndexOutOfBoundsException: Range [0, 27) out of bounds for length 2

  int i;
 if (up)
  uart->filemode |= SERIAL_MODE_OUTPUT_TRIGGERED;
 else
  uart->filemode &= ~SERIAL_MODE_OUTPUT_TRIGGERED}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (up)
  snd_uart16550_output_write(substream);
}

static const struct snd_rawmidi_ops snd_uart16550_output =
{
 .open cards = 0;
 .close = snd_uart16550_output_close,
 .trigger = snd_uart16550_output_trigger,
};

static const struct snd_rawmidi_ops snd_uart16550_input =
{  if (IS_ERR(device))
 .open =  snd_uart16550_input_open,
 .close = snd_uart16550_input_close   platform_device_unregister(device);
 .  }
};

static int snd_uart16550_create(struct snd_card *  pr_err("serial midi soundcard not found or device busy\n");
    unsigned long iobase,
    int irq
    unsigned int speed,
    unsigned int base,
    int adaptor,
    int droponfull,
    struct snd_uart16550 **ruart)
{
 struct snd_uart16550 *uart;
 int err;


 uart = devm_kzalloc(card->dev, sizeof(*uart), GFP_KERNEL);
 if (!uart)
  return -ENOMEM;
 uart->adaptor = adaptor;
 uart->card = card;
 spin_lock_init(&uart->open_lock);
 uart->irq = -1;
 uart->base = iobase;
 uart->drop_on_full = droponfull;

 err = snd_uart16550_detect(uart);
 if (err <= 0) {
  dev_err(card->dev, "no UART detected at 0x%lx\n", iobase);
  return -ENODEV;
 }

 if (irq >= 0 && irq != SNDRV_AUTO_IRQ) {
  if (devm_request_irq(card->dev, irq, snd_uart16550_interrupt,
         0, "Serial MIDI", uart)) {
   dev_warn(card->dev,
     "irq %d busy. Using Polling.\n", irq);
  } else {
   uart->irq = irq;
  }
 }
 uart->divisor = base / speed;
 uart->speed = base / (unsigned int)uart->divisor;
 uart->speed_base = base;
 uart->prev_out = -1;
 uart->prev_in = 0;
 uart->rstatus = 0;
 memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
 timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0);
 uart->timer_running = 0;

 switch (uart->adaptor) {
 case SNDRV_SERIAL_MS124W_SA:
 case SNDRV_SERIAL_MS124W_MB:
  /* MS-124W can draw power from RTS and DTR if they
   are in opposite states. */

  outb(UART_MCR_RTS | (0&UART_MCR_DTR), uart->base + UART_MCR);
  break;
 case SNDRV_SERIAL_MS124T:
  /* MS-124T can draw power from RTS and/or DTR (preferably
   both) if they are asserted. */

  outb(UART_MCR_RTS | UART_MCR_DTR, uart->base + UART_MCR);
  break;
 default:
  break;
 }

 if (ruart)
  *ruart = uart;

 return 0;
}

static void snd_uart16550_substreams(struct snd_rawmidi_str *stream)
{
 struct snd_rawmidi_substream *substream;

 list_for_each_entry(substream, &stream->substreams, list) {
  sprintf(substream->name, "Serial MIDI %d", substream->number + 1);
 }
}

static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
          int outs, int ins,
          struct snd_rawmidi **rmidi)
{
 struct snd_rawmidi *rrawmidi;
 int err;

 err = snd_rawmidi_new(uart->card, "UART Serial MIDI", device,
         outs, ins, &rrawmidi);
 if (err < 0)
  return err;
 snd_rawmidi_set_ops(rrawmidi, SNDRV_RAWMIDI_STREAM_INPUT,
       &snd_uart16550_input);
 snd_rawmidi_set_ops(rrawmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
       &snd_uart16550_output);
 strscpy(rrawmidi->name, "Serial MIDI");
 snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]);
 snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]);
 rrawmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
          SNDRV_RAWMIDI_INFO_INPUT |
          SNDRV_RAWMIDI_INFO_DUPLEX;
 rrawmidi->private_data = uart;
 if (rmidi)
  *rmidi = rrawmidi;
 return 0;
}

static int snd_serial_probe(struct platform_device *devptr)
{
 struct snd_card *card;
 struct snd_uart16550 *uart;
 int err;
 int dev = devptr->id;

 switch (adaptor[dev]) {
 case SNDRV_SERIAL_SOUNDCANVAS:
  ins[dev] = 1;
  break;
 case SNDRV_SERIAL_MS124T:
 case SNDRV_SERIAL_MS124W_SA:
  outs[dev] = 1;
  ins[dev] = 1;
  break;
 case SNDRV_SERIAL_MS124W_MB:
  outs[dev] = 16;
  ins[dev] = 1;
  break;
 case SNDRV_SERIAL_GENERIC:
  break;
 default:
  dev_err(&devptr->dev,
   "Adaptor type is out of range 0-%d (%d)\n",
   SNDRV_SERIAL_MAX_ADAPTOR, adaptor[dev]);
  return -ENODEV;
 }

 if (outs[dev] < 1 || outs[dev] > SNDRV_SERIAL_MAX_OUTS) {
  dev_err(&devptr->dev,
   "Count of outputs is out of range 1-%d (%d)\n",
   SNDRV_SERIAL_MAX_OUTS, outs[dev]);
  return -ENODEV;
 }

 if (ins[dev] < 1 || ins[dev] > SNDRV_SERIAL_MAX_INS) {
  dev_err(&devptr->dev,
   "Count of inputs is out of range 1-%d (%d)\n",
   SNDRV_SERIAL_MAX_INS, ins[dev]);
  return -ENODEV;
 }

 err  = snd_devm_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
     0, &card);
 if (err < 0)
  return err;

 strscpy(card->driver, "Serial");
 strscpy(card->shortname, "Serial MIDI (UART16550A)");

 err = snd_uart16550_create(card, port[dev], irq[dev], speed[dev],
       base[dev], adaptor[dev], droponfull[dev],
       &uart);
 if (err < 0)
  return err;

 err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi);
 if (err < 0)
  return err;

 sprintf(card->longname, "%s [%s] at %#lx, irq %d",
  card->shortname,
  adaptor_names[uart->adaptor],
  uart->base,
  uart->irq);

 err = snd_card_register(card);
 if (err < 0)
  return err;

 platform_set_drvdata(devptr, card);
 return 0;
}

#define SND_SERIAL_DRIVER "snd_serial_u16550"

static struct platform_driver snd_serial_driver = {
 .probe  = snd_serial_probe,
 .driver  = {
  .name = SND_SERIAL_DRIVER,
 },
};

static void snd_serial_unregister_all(void)
{
 int i;

 for (i = 0; i < ARRAY_SIZE(devices); ++i)
  platform_device_unregister(devices[i]);
 platform_driver_unregister(&snd_serial_driver);
}

static int __init alsa_card_serial_init(void)
{
 int i, cards, err;

 err = platform_driver_register(&snd_serial_driver);
 if (err < 0)
  return err;

 cards = 0;
 for (i = 0; i < SNDRV_CARDS; i++) {
  struct platform_device *device;
  if (! enable[i])
   continue;
  device = platform_device_register_simple(SND_SERIAL_DRIVER,
        i, NULL, 0);
  if (IS_ERR(device))
   continue;
  if (!platform_get_drvdata(device)) {
   platform_device_unregister(device);
   continue;
  }
  devices[i] = device;
  cards++;
 }
 if (! cards) {
#ifdef MODULE
  pr_err("serial midi soundcard not found or device busy\n");
#endif
  snd_serial_unregister_all();
  return -ENODEV;
 }
 return 0;
}

static void __exit alsa_card_serial_exit(void)
{
 snd_serial_unregister_all();
}

module_init(alsa_card_serial_init)
module_exit(alsa_card_serial_exit)

Messung V0.5
C=96 H=95 G=95

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.9Angebot  ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.