Blame wavefront/fw_writer.c

Packit e67170
/*
Packit e67170
 *  writer for register initialization values of the Yamaha YSS225 chip
Packit e67170
 *  Copyright (c) 2006 Clemens Ladisch <clemens@ladisch.de>
Packit e67170
 *
Packit e67170
 *
Packit e67170
 *  This program is free software; you can redistribute it and/or modify
Packit e67170
 *  it under the terms of the GNU General Public License as published by
Packit e67170
 *  the Free Software Foundation; either version 2 of the License, or
Packit e67170
 *  (at your option) any later version.
Packit e67170
 *
Packit e67170
 *  This program is distributed in the hope that it will be useful,
Packit e67170
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit e67170
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit e67170
 *  GNU General Public License for more details.
Packit e67170
 *
Packit e67170
 *  You should have received a copy of the GNU General Public License
Packit e67170
 *  along with this program; if not, write to the Free Software
Packit e67170
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
Packit e67170
 */
Packit e67170
Packit e67170
#include <stdio.h>
Packit e67170
#include <stdlib.h>
Packit e67170
Packit e67170
#define WAIT_IDLE 0xff, 0x00
Packit e67170
Packit e67170
#include "yss225.c"
Packit e67170
Packit e67170
#define FILENAME "yss225_registers.bin"
Packit e67170
Packit e67170
int main(void)
Packit e67170
{
Packit e67170
	FILE *f;
Packit e67170
Packit e67170
	fprintf(stderr, "writing %s ...\n", FILENAME);
Packit e67170
	f = fopen(FILENAME, "wb");
Packit e67170
	if (!f) {
Packit e67170
		perror("cannot create file");
Packit e67170
		exit(EXIT_FAILURE);
Packit e67170
	}
Packit e67170
	if (fwrite(data, 1, sizeof data, f) != sizeof data ||
Packit e67170
	    fclose(f) == EOF) {
Packit e67170
		perror("cannot write");
Packit e67170
		exit(EXIT_FAILURE);
Packit e67170
	}
Packit e67170
	return 0;
Packit e67170
}