Beispiel #1
0
int main(int argc, char *argv[])
{			
	int choice = 1;

	choice = check_model();

	switch(choice) {
		//test the data size on kernel and application.
		case 1:
		{
			data_size(argc, argv);
			break;
		}

		//test the fasync signal handle method.
		case 2:
		{
			fasync_handle(argc, argv);
			break;
		}

		//test the input and output method by poll.
		case 3:
		{
			io_poll(argc, argv);
			break;
		}

		//test the concole which recv the kernel message.
		case 4:
		{
			concole_ctl(argc, argv);
			break;
		}

		//test the page difference by compared dev map addr.
		case 5:
		{
			mem_cmp(argc, argv);
			break;
		}

		//test the input and ouput on all dev ports.
		case 6:
		{
			port_io(argc, argv);
			break;
		}

		//default do nothing
		default:
		{
			break;
		}
	}
	
	return 0;
}
Beispiel #2
0
int
port_write (port_t *port, void *buf, int size)
{
  int ret;

  pthread_mutex_lock (&port->wlock);    /* 同時に書ける人は、ひとりのみ */
  ret = port_io (port, buf, size, WRITE);
  pthread_mutex_unlock (&port->wlock);
  return ret;
}
Beispiel #3
0
int
port_read (port_t *port, void *buf, int size)
{
  int ret;

  pthread_mutex_lock (&port->rlock);    /* 同時に読める人は、ひとりのみ */
  ret = port_io (port, buf, size, READ);
  pthread_mutex_unlock (&port->rlock);
  return ret;
}