xref: /aosp_15_r20/external/flashrom/tests/wraps.h (revision 0d6140be3aa665ecc836e8907834fcd3e3b018fc)
1 /*
2  * This file is part of the flashrom project.
3  *
4  * Copyright 2022 Google LLC
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15 
16 #ifndef WRAPS_H
17 #define WRAPS_H
18 
19 #include <stdio.h>
20 #include "flash.h"
21 
22 struct programmer_cfg; /* defined in programmer.h */
23 
24 char *__wrap_strdup(const char *s);
25 void __wrap_physunmap(void *virt_addr, size_t len);
26 void *__wrap_physmap(const char *descr, uintptr_t phys_addr, size_t len);
27 struct pci_dev *__wrap_pcidev_init(const struct programmer_cfg *cfg, void *devs, int bar);
28 uintptr_t __wrap_pcidev_readbar(void *dev, int bar);
29 void __wrap_sio_write(uint16_t port, uint8_t reg, uint8_t data);
30 uint8_t __wrap_sio_read(uint16_t port, uint8_t reg);
31 int __wrap_open(const char *pathname, int flags, ...);
32 int __real_open(const char *pathname, int flags, ...);
33 int __wrap_open64(const char *pathname, int flags, ...);
34 int __wrap___open64_2(const char *pathname, int flags, ...);
35 int __wrap_ioctl(int fd, unsigned long int request, ...);
36 int __wrap_write(int fd, const void *buf, size_t sz);
37 int __wrap_read(int fd, void *buf, size_t sz);
38 FILE *__wrap_fopen(const char *pathname, const char *mode);
39 FILE *__real_fopen(const char *pathname, const char *mode);
40 FILE *__wrap_fopen64(const char *pathname, const char *mode);
41 FILE *__wrap_fdopen(int fd, const char *mode);
42 FILE *__real_fdopen(int fd, const char *mode);
43 int __wrap_stat(const char *path, void *buf);
44 int __wrap_stat64(const char *path, void *buf);
45 int __wrap___xstat(const char *path, void *buf);
46 int __wrap___xstat64(const char *path, void *buf);
47 int __wrap_fstat(int fd, void *buf);
48 int __wrap_fstat64(int fd, void *buf);
49 int __wrap___fstat50(int fd, void *buf);
50 int __wrap___fxstat(int fd, void *buf);
51 int __wrap___fxstat64(int fd, void *buf);
52 char *__wrap_fgets(char *buf, int len, FILE *fp);
53 char *__wrap___fgets_chk(char *buf, int len, FILE *fp);
54 size_t __wrap_fread(void *ptr, size_t size, size_t nmemb, FILE *fp);
55 size_t __wrap_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *fp);
56 size_t __real_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *fp);
57 int __wrap_fflush(FILE *fp);
58 int __wrap_fileno(FILE *fp);
59 int __wrap_fsync(int fd);
60 int __wrap_setvbuf(FILE *fp, char *buf, int type, size_t size);
61 int __wrap_fprintf(FILE *fp, const char *fmt, ...);
62 int __wrap___vfprintf_chk(FILE *fp, const char *fmt, va_list args);
63 int __wrap_fclose(FILE *fp);
64 int __real_fclose(FILE *fp);
65 int __wrap_feof(FILE *fp);
66 int __wrap_ferror(FILE *fp);
67 int __wrap_flock(int fd, int operation);
68 int __wrap_ftruncate(int fd, off_t length);
69 void __wrap_clearerr(FILE *fp);
70 int __wrap_rget_io_perms(void);
71 void __wrap_OUTB(unsigned char value, unsigned short port);
72 unsigned char __wrap_INB(unsigned short port);
73 void __wrap_OUTW(unsigned short value, unsigned short port);
74 unsigned short __wrap_INW(unsigned short port);
75 void __wrap_OUTL(unsigned int value, unsigned short port);
76 unsigned int __wrap_INL(unsigned short port);
77 int __wrap_spi_send_command(const struct flashctx *flash,
78 		unsigned int writecnt, unsigned int readcnt,
79 		const unsigned char *writearr, unsigned char *readarr);
80 
81 #endif /* WRAPS_H */
82