summaryrefslogtreecommitdiffstats
path: root/tools.h
blob: 3454fc4bea9b20261a626e28963fc681a67ad574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef _PCITOOL_TOOLS_H
#define _PCITOOL_TOOLS_H

#include <stdio.h>
#include <stdint.h>

#include "pci.h"

#define min2(a, b) (((a)<(b))?(a):(b))

int pcilib_isnumber(const char *str);
int pcilib_isxnumber(const char *str);

uint16_t pcilib_swap16(uint16_t x);
uint32_t pcilib_swap32(uint32_t x);
uint64_t pcilib_swap64(uint64_t x);
void pcilib_swap(void *dst, void *src, size_t size, size_t n);

void * pcilib_memcpy8(void * dst, void const * src, size_t len);
void * pcilib_memcpy32(void * dst, void const * src, size_t len);
void * pcilib_memcpy64(void * dst, void const * src, size_t len);
void * pcilib_datacpy32(void * dst, void const * src, uint8_t size, size_t n, pcilib_endianess_t endianess);

int pcilib_get_page_mask();

#endif /* _PCITOOL_TOOS_H */