コード例 #1
0
ファイル: sleepers.c プロジェクト: MIPS/external-valgrind
// set to 0 to have no finish msg (as order is non-deterministic)
static void *sleeper_or_burner(void *v)
{
   int i = 0;
   struct spec* s = (struct spec*)v;
   int ret;
   fprintf(stderr, "%s ready to sleep and/or burn\n", s->name);
   fflush (stderr);
   signal_ready();
   nr_sleeper_or_burner++;

   for (i = 0; i < loops; i++) {
      if (sleepms > 0 && s->sleep) {
         t[s->t].tv_sec = sleepms / 1000;
         t[s->t].tv_usec = (sleepms % 1000) * 1000;
         ret = select (0, NULL, NULL, NULL, &t[s->t]);
         /* We only expect a timeout result or EINTR from the above. */
         if (ret != 0 && errno != EINTR)
            perror("unexpected result from select");
      }
      if (burn > 0 && s->burn)
         do_burn();
   }
   if (report_finished) {
      fprintf(stderr, "%s finished to sleep and/or burn\n", s->name);
      fflush (stderr);
   }
   return NULL;
}
コード例 #2
0
/******************************************************************************
* 函 数 名: burn_efuse_nandc
* 功能描述: 将flash spec info烧写进efuse
* 输入参数: 无
* 输出参数: 无
* 返 回 值: 0 - 成功; 非0 - 失败
* 函数说明:
*******************************************************************************/
s32 burn_efuse_nandc(void)
{
	s32 ret = ERROR;
	u32 burn_flag = 0;  /* 1 - already burn; 0 - not burn */
	struct nand_spec *spec;

	/* check whether nand info already burn */
    /* coverity[no_effect_test] */
	ret = is_burn(&burn_flag);
	if(ret)
	{
		PRINT_MSG("Check efuse info error\n");
		goto erro;
	}
	if(burn_flag)
	{
		PRINT_MSG("Efuse nandc info already burn\n");
		return OK;
	}

	/* get flash info  */
	spec = (struct nand_spec *)alloc(sizeof(struct nand_spec));
	if(!spec)
	{
		PRINT_MSG("Malloc memory failed\n");
		goto erro;
	}

	ret = bsp_get_nand_info(spec);
	if(OK != ret)
	{
		PRINT_MSG("Get flash info failed\n");
		goto erro;
	}

	PRINT_MSG("After get spec\n");
	PRINT_MSG("spec->pagesize			: 0x%x\n", spec->pagesize);
	PRINT_MSG("spec->pagenumperblock	: 0x%x\n", spec->pagenumperblock);
	PRINT_MSG("spec->addrnum			: 0x%x\n", spec->addrnum);
	PRINT_MSG("spec->ecctype			: 0x%x\n", spec->ecctype);


	/* burn flash info into efuse */
	ret = do_burn(spec);
	if(OK != ret)
	{
		PRINT_MSG("Burn flash info failed\n");
		goto erro;
	}

	return OK;

erro:
	return ret;
}