Blame wavefront/fw_writer.c

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