/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to tools.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-03-09 15:55:27 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: csa@dside.dyndns.org-20110309155527-7ui77xsz2f7ms0b8
Support for FPGA registers

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include <unistd.h>
4
4
#include <stdint.h>
5
5
#include <assert.h>
 
6
#include <ctype.h>
6
7
#include <arpa/inet.h>
7
8
 
8
9
#include "tools.h"
9
10
 
 
11
int pcilib_isnumber(const char *str) {
 
12
    int i = 0;
 
13
    for (i = 0; str[i]; i++) 
 
14
        if (!isdigit(str[i])) return 0;
 
15
    return 1;
 
16
}
 
17
 
 
18
int pcilib_isxnumber(const char *str) {
 
19
    int i = 0;
 
20
    for (i = 0; str[i]; i++) 
 
21
        if (!isxdigit(str[i])) return 0;
 
22
    return 1;
 
23
}
 
24
 
 
25
 
10
26
uint16_t pcilib_swap16(uint16_t x) {
11
27
    return (((x<<8)&0xFFFF) | ((x>>8)&0xFFFF));
12
28
}