Commit graph

30 commits

Author SHA1 Message Date
Jeff Epler
555269dd05 Use unsigned for some values
.. this simplifies error checking, and fixes a diagnostic about
comparing signed and unsigned numbers.
2021-05-04 09:02:47 -05:00
Jeff Epler
48a8ca2ae6 Fix unused-parameter diagnostics
.. mostly by hinting to the compiler that they are intended to be
unused.
2021-05-04 09:02:47 -05:00
Peter Wallace
a61da59aa9 Fix internal pin names for FPGA cards with built in breakouts 2020-06-07 17:30:46 -07:00
Jeff Epler
66d5effcc8 various: fix -Wformat diagnostics
Mostly, this involves using the "z" length modifier where a sizeof() is involved
2020-05-15 08:40:59 -05:00
Peter Wallace
7e008541ed Add Inm and BISS pinout list support
fix a couple of compile warnings
2020-04-23 15:07:46 -06:00
Peter Wallace
7ae92326f8 Add --reload capability to SPI boards 2020-04-23 15:02:07 -06:00
Sebastian Kuzminsky
68b23a771b merge changes from JT's mesaflash version 2020-04-23 15:01:06 -06:00
Sebastian Kuzminsky
6c6d5a65d4 Merge remote-tracking branch 'origin/v3.3'
* origin/v3.3:
  read-hmid: report unknown pins better
  hm2_print_pin_file(): use find_module_name() instead of searching the list
  rename pin_find_module_name() to find_module_name()
  include gtag number of unknown gtags in pin list
  remove dead code
  7i96: fixup pins per connector
  don't segfault on unknown ethernet boards
  fix a typo in a comment
  fix SSR pin names
  fix sserial channel number in readhmid pin list
  rename the "Transformer" GTAG to "SSR", to match the linuxcnc hm2 driver
  7i96: make the connector list match the ioport list
  capitalize Ethernet consistently in --help message
  fix addr argument for ethernet boards in --help message
  consistent capitalization and punctuation in --help output
  fix formatting of --help output
  release 3.3.0~pre0+dfsg-0
  release mesaflash 3.2.1
  debian/changelog: new version
  pci_analog_write: include unistd.h, which declares usleep()
  sserial_module: declare sserial_write(), used by pci_analog_write
  pci_encoder_read: include unistd.h, for usleep()
  serial_boards: add some missing declarations
  spi_boards: include unistd.h
  spi_boards: include ctype.h
  add missing return value in spi_boards_init()
  spi_boards: include eeprom.h
  eeprom_local: include pci/pci.h
  hostmot2: add some missing function declarations
  pci_boards: move pci_read() and pci_write() to before the first use in the file
  pci_boards: include sys/time.h
  anyio: include missing serial_boards.h
  include bitfile.h in eeprom.c, for print_bitfile_header()
  function declarations shouldn't be marked inline
2020-04-23 12:40:29 -06:00
Sebastian Kuzminsky
1bded53776
Merge pull request #31 from dwrobel/7-stringop-truncation
Fix -Wstringop-truncation warnings
2020-04-23 12:32:10 -06:00
Sebastian Kuzminsky
650097f4ad
Merge pull request #30 from dwrobel/6-linking-errors
Fix linking errors
2020-04-23 08:41:25 -06:00
Damian Wrobel
63e8e8f64b Fix -Wstringop-truncation warnings
Fixes the following warnings:
In function 'strncpy',
    inlined from 'spi_boards_scan' at spi_boards.c:203:9:
/usr/include/bits/string_fortified.h:106:10: warning: '__builtin_strncpy'
output truncated before terminating nul copying 4 bytes
from a string of the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));

In file included from /usr/include/string.h:495,
                 from pci_boards.c:34:
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1281:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1240:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1205:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1177:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1144:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1117:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1089:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1056:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:1026:21:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:995:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:967:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:940:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:912:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:885:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘pci_boards_scan’ at pci_boards.c:851:17:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 14 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from /usr/include/string.h:495,
                 from usb_boards.c:21:
In function ‘strncpy’,
    inlined from ‘usb_boards_scan’ at usb_boards.c:188:9:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘usb_boards_scan’ at usb_boards.c:147:13:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’
output truncated before terminating nul copying 4 bytes from a string of
the same length [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:329:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:306:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:283:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:259:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:235:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:211:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:186:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘strncpy’,
    inlined from ‘eth_scan_one_addr’ at eth_boards.c:161:13,
    inlined from ‘eth_scan_one_addr.isra.0’ at eth_boards.c:136:12:
/usr/include/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output
may be truncated copying 16 bytes from a string of length 19 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-04-20 16:35:34 +02:00
Damian Wrobel
889ab134af Fix linking errors
Fixes the following linking errors on gcc 10:
/usr/bin/ld: libanyio.a(spi_boards.o):spi_boards.c:41:
 multiple definition of `sd';
 libanyio.a(eth_boards.o):eth_boards.c:49: first defined here
/usr/bin/ld: libanyio.a(serial_boards.o):serial_boards.c:38:
 multiple definition of `sd';
 libanyio.a(eth_boards.o):eth_boards.c:49: first defined here
/usr/bin/ld: libanyio.a(lbp.o):mesaflash/lbp.c:31:
 multiple definition of `sd';
 libanyio.a(eth_boards.o):eth_boards.c:49: first defined here

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-04-20 16:33:41 +02:00
Damian Wrobel
260be11cc0 Fix -Wformat warning
Fixes:
 pi_boards.c:190:56: warning: format '%x' expects argument of type
 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
   190 |         fprintf(stderr, "Unexpected cookie at %04x..%04x:\n%08x %08x %08x\n",
       |                                                     ~~~^
       |                                                        |
       |                                                        unsigned int
       |                                                     %04lx

Signed-off-by: Damian Wrobel <dwrobel@ertelnet.rybnik.pl>
2020-04-20 16:31:18 +02:00
Sebastian Kuzminsky
9f2bb5e0fa Merge branch 'v3.2' into v3.3
Conflicts:
	debian/changelog
	eeprom_local.c
	pci_boards.c
2017-06-27 10:33:37 -06:00
Sebastian Kuzminsky
9cd36eb934 spi_boards: include unistd.h
This declares close(), which avoids an 'implicit declaration' warning
from GCC 6.3 in Debian Stretch.
2017-06-25 20:39:13 -06:00
Sebastian Kuzminsky
ca3fd5dae3 spi_boards: include ctype.h
This provides the declaration of isprint(), which is needed to avoid an
'implicit declaration' warning from GCC 6.3 in Debian Stretch.
2017-06-25 20:24:45 -06:00
Sebastian Kuzminsky
28e189e8a4 add missing return value in spi_boards_init()
mesaflash uses the standard return value -1 for indicating errors,
so use it here too.
2017-06-25 20:23:33 -06:00
Sebastian Kuzminsky
85f9328f58 spi_boards: include eeprom.h
This provides the declaration of eeprom_init(), avoiding an "implicit
declaration" warning on GCC 6.3 on Debian Stretch.
2017-06-25 20:21:24 -06:00
Joseph Heath
f598fc1472 fall back to 8-bit word if 32-bit per word set fails. Recognize fallback and reorder buffer to compensate for int to byte change. 2016-10-15 15:43:37 -07:00
Jeff Epler
b4137e08c5 spi: print accurate address where we looked for cookie
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2016-07-03 07:59:43 -05:00
joe
2e616010c3 fixup implicit function declaration warnings 2015-10-06 18:25:40 -07:00
joe
70d4e2e360 ‘return’ with no value, in function returning non-void 2015-10-06 17:40:49 -07:00
Michael Geszkiewicz
3106d0df2b anyio: refactor: unification of functions arguments in hostmot2 access interface
factor out common board structure initialisations to function

Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2015-03-09 01:01:03 +01:00
Michael Geszkiewicz
f0018a4d35 libanyio: remove spilbp as only spi_boards use it and it's too simple to be standalone
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2014-09-13 00:25:11 +02:00
Jeff Epler
c1e47dbdea SPI: support SPI boards on Linux
This properly programs and verifies the eeprom on my SPI 7i90

typical commandline:
    mesaflash --device 7I90 --addr /dev/spidev1.0 --spi \
	--verify 7i90_spi_svst4_8.bit
2014-09-11 19:00:44 -05:00
Michael Geszkiewicz
c431de4ff9 libanyio: introduce types.h to hold global types definitions
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2014-09-07 23:00:03 +02:00
Michael Geszkiewicz
bf2de2cc6d refactor: extract board definitions to boards.h to remove including main library header file in all submodules
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2014-05-09 13:35:23 +02:00
Michael Geszkiewicz
6dac0e0747 Add GPL licence in all source files
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2014-02-24 04:37:08 +01:00
Michael Geszkiewicz
fcffd8617f Add library cleanup at exit
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2014-01-30 03:40:58 +01:00
Michael Geszkiewicz
848e890685 Add skeleton files for support spi transport for connecting to mesanet boards
Signed-off-by: Michael Geszkiewicz <micges@wp.pl>
2013-11-21 04:57:31 +01:00