summaryrefslogtreecommitdiffstats
path: root/tools.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-03-09 16:55:27 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-03-09 16:55:27 +0100
commita008b10d8488ef905a43de00ee5c8efd03b03ed6 (patch)
tree1d4330f9cbb72f641b197a445863a9012581e405 /tools.c
parentb0596cb0f01f885153abffaecfa248920cb8658b (diff)
downloadpcitool-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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools.c b/tools.c
index 838172d..4609619 100644
--- a/tools.c
+++ b/tools.c
@@ -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));
}