コード例 #1
0
ファイル: spi.c プロジェクト: canistation/coreboot
/* Checks device parameters for errors */
static int check_device_params(struct spim_device_parameters *pdev_param)
{
	if (pdev_param->spi_mode < SPIM_MODE_0 ||
		pdev_param->spi_mode > SPIM_MODE_3)
		return -SPIM_INVALID_SPI_MODE;
	if (check_bitrate(pdev_param->bitrate) != SPIM_OK)
		return -SPIM_INVALID_BIT_RATE;
	if (pdev_param->cs_idle_level > 1)
		return -SPIM_INVALID_CS_IDLE_LEVEL;
	if (pdev_param->data_idle_level > 1)
		return -SPIM_INVALID_DATA_IDLE_LEVEL;
	return SPIM_OK;
}
コード例 #2
0
ファイル: checks.c プロジェクト: blabber/oggfilter
bool
chk_check_file(char *path, struct chk_context *ctx)
{
	assert(path != NULL);
	assert(ctx != NULL);

	struct oggfile of;
	if (oggfile_open(&of, path) != 0) {
		warn("oggfile_open \"%s\"", path);
		return (0);
	}

	bool match = check_time(&of, ctx);
	match = match && check_bitrate(&of, ctx);
	match = match && check_comments(&of, ctx);

	if (oggfile_close(&of) != 0)
		warn("oggfile_close \"%s\"", path);

	return (match);
}