Ejemplo n.º 1
0
Archivo: timer.c Proyecto: PTJohe/LCOM
int timer_test_config(unsigned long timer) {
	unsigned char conf;
	timer_get_conf(timer, &conf);
	timer_display_conf(conf);
	if (conf = 0xB6)
		return EXIT_SUCCESS;
	else
		return EXIT_FAILURE;
}
Ejemplo n.º 2
0
int timer_test_config(unsigned long timer) {
	unsigned long *st;
	if ((st = malloc(sizeof(unsigned char))) != NULL)
	{
		if (timer_get_conf(timer, st))
		{
			free(st);
			return 1;
		}
		return timer_display_conf((unsigned char)*st);
	}
	free(st);
	return 1;
}
Ejemplo n.º 3
0
int timer_test_config(unsigned long timer)
{
	unsigned char tempo;
	int erro;
	if(timer<0 || timer >2)
	{
		return 1;
	}
	erro = timer_get_conf(timer,&tempo);

	if(erro == 1)
		return 1;


	erro = timer_display_conf(tempo);

	if(erro == 1)
		return 1;

	return 0;
}
Ejemplo n.º 4
0
static int proc_args(int argc, char *argv[]) {

  unsigned long freq, time;
  unsigned char conf;

  /* check the function to test: if the first characters match, accept it */
  if (strncmp(argv[1], "display_conf", strlen("display_conf")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_display_conf() \n");
		  return 1;
	  }
	  if( (conf = parse_ulong(argv[2], 0)) == ULONG_MAX )
	 		  return 1;
	  printf("timer:: timer_display_conf(%d)\n", conf);
	  timer_display_conf(conf);
	  return 0;
  } else if (strncmp(argv[1], "test_int", strlen("test_int")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_test_int() \n");
		  return 1;
	  }
	  if( (time = parse_ulong(argv[2], 16)) == ULONG_MAX )
		  return 1;
	  printf("timer:: timer_test_int(%d)\n", time);
	  timer_test_int(time);
	  return 0;
  } else if (strncmp(argv[1], "test_square", strlen("test_square")) == 0) {
	  if( argc != 3 ) {
		  printf("timer: wrong no of arguments for test of timer_test_square() \n");
		  return 1;
	  }
	  if( (freq = parse_ulong(argv[2], 16)) == ULONG_MAX )
		  return 1;
	  printf("timer:: timer_test_square(%d)\n", freq);
	  return timer_test_square(freq);
  } else {
	  printf("timer: non valid function \"%s\" to test\n", argv[1]);
	  return 1;
  }
}