/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 pcilib/tools.h

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 04:47:04 UTC
  • Revision ID: csa@suren.me-20160302044704-wncsxtf6sx0r0tps
Documentation update

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
extern "C" {
15
15
#endif
16
16
 
 
17
/**
 
18
 * Check if provided string is a decimal integer
 
19
 * @param[in] str       - string to check
 
20
 * @return              - 1 if string is a number and 0 - otherwise
 
21
 */
17
22
int pcilib_isnumber(const char *str);
 
23
 
 
24
/**
 
25
 * Check if provided string is a hexdecimal integer, optionally prefexed with 0x
 
26
 * @param[in] str       - string to check
 
27
 * @return              - 1 if string is a number and 0 - otherwise
 
28
 */
18
29
int pcilib_isxnumber(const char *str);
 
30
 
 
31
/**
 
32
 * Check if first \p len bytes of the provided string is a decimal integer
 
33
 * @param[in] str       - string to check
 
34
 * @param[in] len       - size of the string
 
35
 * @return              - 1 if string is a number and 0 - otherwise
 
36
 */
19
37
int pcilib_isnumber_n(const char *str, size_t len);
 
38
 
 
39
/**
 
40
 * Check if first \p len bytes of the provided string is a hexdecimal integer, optionally prefexed with 0x
 
41
 * @param[in] str       - string to check
 
42
 * @param[in] len       - size of the string
 
43
 * @return              - 1 if string is a number and 0 - otherwise
 
44
 */
20
45
int pcilib_isxnumber_n(const char *str, size_t len);
21
46
 
 
47
/**
 
48
 * Change the endianess of the provided number (between big- and little-endian format)
 
49
 * @param[in] x         - number in little/big endian format
 
50
 * @return              - number in big/little endian format
 
51
 */
22
52
uint16_t pcilib_swap16(uint16_t x);
 
53
 
 
54
/**
 
55
 * Change the endianess of the provided number (between big- and little-endian format)
 
56
 * @param[in] x         - number in little/big endian format
 
57
 * @return              - number in big/little endian format
 
58
 */
23
59
uint32_t pcilib_swap32(uint32_t x);
 
60
 
 
61
/**
 
62
 * Change the endianess of the provided number (between big- and little-endian format)
 
63
 * @param[in] x         - number in little/big endian format
 
64
 * @return              - number in big/little endian format
 
65
 */
24
66
uint64_t pcilib_swap64(uint64_t x);
25
 
void pcilib_swap(void *dst, void *src, size_t size, size_t n);
 
67
 
 
68
/**
 
69
 * Change the endianess of the provided array
 
70
 * @param[out] dst      - the destination memory region, can be equal to \p src
 
71
 * @param[in] src       - the source memory region
 
72
 * @param[in] access    - the size of word in bytes (1, 2, 4, or 8)
 
73
 * @param[in] n         - the number of words to copy (\p n * \p access bytes are copied).
 
74
 */
 
75
void pcilib_swap(void *dst, void *src, size_t access, size_t n);
26
76
 
27
77
#ifdef __cplusplus
28
78
}