/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool
6 by Suren A. Chilingaryan
Initial support for registers, infrastructure only
1
#ifndef _PCITOOL_TOOLS_H
2
#define _PCITOOL_TOOLS_H
1 by Suren A. Chilingaryan
Initial import
3
7.1.1 by Suren A. Chilingaryan
Initial support of IPECamera protocol
4
#include <stdio.h>
5
#include <stdint.h>
6
236 by Suren A. Chilingaryan
Big redign of model structures
7
#include <pcilib.h>
8
47 by Suren A. Chilingaryan
Support FIFO reading/writting, code restructurization, few fixes
9
#define BIT_MASK(bits) ((1ll << (bits)) - 1)
10
45 by root
North West Logick DMA implementation
11
#define min2(a, b) (((a)<(b))?(a):(b))
12
277 by Suren A. Chilingaryan
Keep C++ compilers happy
13
#ifdef __cplusplus
14
extern "C" {
15
#endif
16
361 by Suren A. Chilingaryan
Documentation update
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
 */
7.1.5 by Suren A. Chilingaryan
Support for FPGA registers
22
int pcilib_isnumber(const char *str);
361 by Suren A. Chilingaryan
Documentation update
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
 */
7.1.5 by Suren A. Chilingaryan
Support for FPGA registers
29
int pcilib_isxnumber(const char *str);
361 by Suren A. Chilingaryan
Documentation update
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
 */
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
37
int pcilib_isnumber_n(const char *str, size_t len);
361 by Suren A. Chilingaryan
Documentation update
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
 */
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
45
int pcilib_isxnumber_n(const char *str, size_t len);
7.1.5 by Suren A. Chilingaryan
Support for FPGA registers
46
361 by Suren A. Chilingaryan
Documentation update
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
 */
7.1.1 by Suren A. Chilingaryan
Initial support of IPECamera protocol
52
uint16_t pcilib_swap16(uint16_t x);
361 by Suren A. Chilingaryan
Documentation update
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
 */
7.1.1 by Suren A. Chilingaryan
Initial support of IPECamera protocol
59
uint32_t pcilib_swap32(uint32_t x);
361 by Suren A. Chilingaryan
Documentation update
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
 */
7.1.1 by Suren A. Chilingaryan
Initial support of IPECamera protocol
66
uint64_t pcilib_swap64(uint64_t x);
361 by Suren A. Chilingaryan
Documentation update
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);
7.1.1 by Suren A. Chilingaryan
Initial support of IPECamera protocol
76
277 by Suren A. Chilingaryan
Keep C++ compilers happy
77
#ifdef __cplusplus
78
}
79
#endif
80
6 by Suren A. Chilingaryan
Initial support for registers, infrastructure only
81
#endif /* _PCITOOL_TOOS_H */