diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-03-09 16:55:27 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-03-09 16:55:27 +0100 |
commit | a008b10d8488ef905a43de00ee5c8efd03b03ed6 (patch) | |
tree | 1d4330f9cbb72f641b197a445863a9012581e405 /tools.c | |
parent | b0596cb0f01f885153abffaecfa248920cb8658b (diff) | |
download | pcitool-a008b10d8488ef905a43de00ee5c8efd03b03ed6.tar.gz pcitool-a008b10d8488ef905a43de00ee5c8efd03b03ed6.tar.bz2 pcitool-a008b10d8488ef905a43de00ee5c8efd03b03ed6.tar.xz pcitool-a008b10d8488ef905a43de00ee5c8efd03b03ed6.zip |
Support for FPGA registers
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -3,10 +3,26 @@ #include <unistd.h> #include <stdint.h> #include <assert.h> +#include <ctype.h> #include <arpa/inet.h> #include "tools.h" +int pcilib_isnumber(const char *str) { + int i = 0; + for (i = 0; str[i]; i++) + if (!isdigit(str[i])) return 0; + return 1; +} + +int pcilib_isxnumber(const char *str) { + int i = 0; + for (i = 0; str[i]; i++) + if (!isxdigit(str[i])) return 0; + return 1; +} + + uint16_t pcilib_swap16(uint16_t x) { return (((x<<8)&0xFFFF) | ((x>>8)&0xFFFF)); } |