Minor cleanup

master
Timothy Pearson 12 years ago
parent f0c477eef4
commit f1ead12600

@ -1,14 +1,14 @@
/*
* Lib(X)SVF - A library for implementing SVF and XSVF JTAG players
*
* Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
* Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> (Raspberry Pi)
* Copyright (C) 2009 RIEGL Research ForschungsGmbH
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
*
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@ -72,22 +72,22 @@ static void io_setup(void)
printf("can't open /dev/mem \n");
exit (-1);
}
/* mmap GPIO */
// Allocate MAP block
if ((gpio_mem = malloc(BLOCK_SIZE + (PAGE_SIZE-1))) == NULL) {
printf("allocation error \n");
exit (-1);
}
// Make sure pointer is on 4K boundary
if ((unsigned long)gpio_mem % PAGE_SIZE) {
gpio_mem += PAGE_SIZE - ((unsigned long)gpio_mem % PAGE_SIZE);
}
// Now map it
gpio_map = (unsigned char *)mmap(
gpio_map = (char *)mmap(
(caddr_t)gpio_mem,
BLOCK_SIZE,
PROT_READ|PROT_WRITE,
@ -95,12 +95,12 @@ static void io_setup(void)
mem_fd,
GPIO_BASE
);
if ((long)gpio_map < 0) {
printf("mmap error %d\n", (int)gpio_map);
exit (-1);
}
// Always use volatile pointer!
gpio = (volatile unsigned *)gpio_map;
@ -372,6 +372,7 @@ static void copyleft()
fprintf(stderr, "xsvftool-gpio, part of Lib(X)SVF (http://www.clifford.at/libxsvf/).\n");
fprintf(stderr, "Copyright (C) 2009 RIEGL Research ForschungsGmbH\n");
fprintf(stderr, "Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>\n");
fprintf(stderr, "Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> (Raspberry Pi)\n");
fprintf(stderr, "Lib(X)SVF is free software licensed under the ISC license.\n");
already_printed = 1;
}

Loading…
Cancel
Save