root/dev/microcode/neomagic/build.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

    1 /*      $OpenBSD: build.c,v 1.2 2005/05/17 18:48:52 jason Exp $ */
    2 
    3 /*
    4  * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
    5  *
    6  * Permission to use, copy, modify, and distribute this software for any
    7  * purpose with or without fee is hereby granted, provided that the above
    8  * copyright notice and this permission notice appear in all copies.
    9  *
   10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   17  */
   18 #include <sys/types.h>
   19 #include <fcntl.h>
   20 #include <unistd.h>
   21 #include <string.h>
   22 #include <stdio.h>
   23 #include <err.h>
   24 #include <dev/pci/neoreg.h>
   25 
   26 #include "neo-coeff.h"
   27 
   28 #define FILENAME "neo-coefficients"
   29 
   30 int
   31 main(int argc, char *argv[])
   32 {
   33         ssize_t rlen;
   34         struct neo_firmware nf;
   35         int fd;
   36 
   37         fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0644);
   38         if (fd == -1)
   39                 err(1, FILENAME);
   40 
   41         bcopy(coefficientSizes, &nf.coefficientSizes,
   42             sizeof nf.coefficientSizes);
   43         bcopy(coefficients, &nf.coefficients,
   44             sizeof nf.coefficients);
   45 
   46         rlen = write(fd, &nf, sizeof nf);
   47         if (rlen == -1)
   48                 err(1, "%s", FILENAME);
   49         if (rlen != sizeof nf)
   50                 errx(1, "%s: short write", FILENAME);
   51         printf("created %s length %d\n", FILENAME, sizeof nf);
   52         close(fd);
   53         return (0);
   54 }

/* [<][>][^][v][top][bottom][index][help] */