Exemplo n.º 1
0
int release_qp(struct inode * inode, struct file * file)
{
  unsigned char status;
  int temp_1;

  //assert(lockStatus == 0);
  
  ////////////////////////////////////////////////////
  lock_kernel();
  ////////////////////////////////////////////////////

  fasync_qp(-1, file, 0);
  qp_count--;
  if (!qp_count) {
    temp_1 =  poll_qp_status();
    if (!temp_1)
      printk   ("Warning: Mouse device busy in release_qp()\n");
    status = inb_p(qp_status);
    outb_p(status & /* ~ */(0x80 | 0x10 ), qp_status);
    temp_1 =  poll_qp_status();
    if (!temp_1)
      printk   ("Warning: Mouse device busy in release_qp()\n");

    free_irq   (12 , ((void *)0) );

    // TRACER (atomic_dec(&( &__this_module )->uc.usecount), ( &__this_module )->flags |= 8 )  ;
  }
  // assert(lockStatus == 1);
  if (lockStatus != 1){ errorFn();}
  ////////////////////////////////////////////////////  
  unlock_kernel();
  ////////////////////////////////////////////////////  
  return 0;
}
Exemplo n.º 2
0
static void release_qp(struct inode * inode, struct file * file)
{
	unsigned char status;

	fasync_aux(inode, file, 0);
	if (--qp_count)
		return;
	if (!poll_qp_status())
		printk("Warning: Mouse device busy in release_qp()\n");
	status = inb_p(qp_status);
	outb_p(status & ~(QP_ENABLE|QP_INTS_ON), qp_status);
	if (!poll_qp_status())
		printk("Warning: Mouse device busy in release_qp()\n");
	free_irq(QP_IRQ, NULL);
	MOD_DEC_USE_COUNT;
}
Exemplo n.º 3
0
ssize_t write_qp(struct file * file, char * buffer,
			size_t count, loff_t *ppos)
{
  ssize_t i;
  char c;
  int temp_1,temp_2;

  i = count;
  
  while (i) {
    temp_1= poll_qp_status();
    if (! temp_1)
      return - 5 ;

    /*  TRACER ({ int __ret_gu,__val_gu; switch(sizeof (*( buffer++ ))) { case
       1: __asm__ __volatile__("call __get_user_" "1" :"=a" ( __ret_gu
       ),"=d" ( __val_gu ) :"0" ( buffer++ )) ; break; case 2: __asm__
       __volatile__("call __get_user_" "2" :"=a" ( __ret_gu ),"=d" (
       __val_gu ) :"0" ( buffer++ )) ; break; case 4: __asm__
       __volatile__("call __get_user_" "4" :"=a" ( __ret_gu ),"=d" (
       __val_gu ) :"0" ( buffer++ )) ; break; default: __asm__
       __volatile__("call __get_user_" "X" :"=a" ( __ret_gu ),"=d" (
       __val_gu ) :"0" ( buffer++ )) ; break; } ( c ) = (__typeof__(*(
       buffer++ )))__val_gu; __ret_gu; }) ; */

    outb_p(c, qp_data);
    i--;
  }
  // TRACER file->f_dentry->d_inode->i_mtime = xtime.tv_sec ;
  return count;
}
Exemplo n.º 4
0
static int release_qp(struct inode * inode, struct file * file)
{
	unsigned char status;

	lock_kernel();
	fasync_qp(-1, file, 0);
	if (!--qp_count) {
		if (!poll_qp_status())
			printk("Warning: Mouse device busy in release_qp()\n");
		status = inb_p(qp_status);
		outb_p(status & ~(QP_ENABLE|QP_INTS_ON), qp_status);
		if (!poll_qp_status())
			printk("Warning: Mouse device busy in release_qp()\n");
		free_irq(QP_IRQ, NULL);
	}
	unlock_kernel();
	return 0;
}
Exemplo n.º 5
0
static int write_qp(struct inode * inode, struct file * file, const char * buffer, int count)
{
	int i = count;

	while (i--) {
		if (!poll_qp_status())
			return -EIO;
		outb_p(get_user(buffer++), qp_data);
	}
	inode->i_mtime = CURRENT_TIME;
	return count;
}
Exemplo n.º 6
0
static ssize_t write_qp(struct file * file, const char * buffer,
			size_t count, loff_t *ppos)
{
	ssize_t i = count;

	while (i--) {
		char c;
		if (!poll_qp_status())
			return -EIO;
		get_user(c, buffer++);
		outb_p(c, qp_data);
	}
	file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
	return count;
}
Exemplo n.º 7
0
static int open_qp(struct inode * inode, struct file * file)
{
  unsigned char status;
  int temp_1, temp_2;

  if (!qp_present)
    return - 22 ;
  
  if (qp_count){
    qp_count++;
    return 0;
  }
  else qp_count++;
            
  temp_1 = request_irq(12 , qp_interrupt, 0, "PS/2 Mouse", ((void *)0) );

  if (temp_1) {
    qp_count--;
    return - 16 ;
  }

  status = inb_p(qp_status);
  status = status | (0x80 | 0x08 );
  outb_p(status, qp_status);
  status = status & /* ~ */(0x08 );
  outb_p(status, qp_status);

  queue->head = 0;           
  queue->tail = 0;           

  status = status | 0x10 ;
  outb_p(status, qp_status);               

  temp_2 = poll_qp_status();
  // TRACER while (!temp_2) {
  if (!temp_2){
    printk   ("Error: Mouse device busy in open_qp()\n");
    qp_count--;
    status = status & /* ~ */(0x80 | 0x10 );
    outb_p(status, qp_status);
    free_irq(12 , ((void *)0) );
    return - 16 ;
  }
  
  outb_p(0xF4 , qp_data);	 
  // TRACER (atomic_inc(&( &__this_module )->uc.usecount), ( &__this_module )->flags |= 8 | 16 )  ;
  return 0;
}
Exemplo n.º 8
0
static int open_qp(struct inode * inode, struct file * file)
{
	unsigned char status;

	if (!qp_present)
		return -EINVAL;

	if (qp_count++)
		return 0;

	if (request_irq(QP_IRQ, qp_interrupt, 0, "PS/2 Mouse", NULL)) {
		qp_count--;
		return -EBUSY;
	}

	status = inb_p(qp_status);
	status |= (QP_ENABLE|QP_RESET);
	outb_p(status, qp_status);
	status &= ~(QP_RESET);
	outb_p(status, qp_status);

	queue->head = queue->tail = 0;          /* Flush input queue */
	status |= QP_INTS_ON;
	outb_p(status, qp_status);              /* Enable interrupts */

	while (!poll_qp_status()) {
		printk("Error: Mouse device busy in open_qp()\n");
		qp_count--;
		status &= ~(QP_ENABLE|QP_INTS_ON);
		outb_p(status, qp_status);
		free_irq(QP_IRQ, NULL);
		return -EBUSY;
	}

	outb_p(AUX_ENABLE_DEV, qp_data);	/* Wake up mouse */
	MOD_INC_USE_COUNT;
	return 0;
}