diff options
Diffstat (limited to 'memory_devmem2.c')
| -rw-r--r-- | memory_devmem2.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/memory_devmem2.c b/memory_devmem2.c new file mode 100644 index 0000000..ac25fc2 --- /dev/null +++ b/memory_devmem2.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/mman.h> +#include <sys/stat.h> + +#include "devmem2.h" +#include "memory.h" + +int init_memory_mapping(int debug, struct memory_mapping **memory_mapping_pp) +{ + return 0; +} + +int read_word(int debug, struct memory_mapping *memory_mapping, + off_t addr, unsigned long *result) +{ + int rc; + + rc = devmem2(debug, addr, 'w', result, NULL); + if (rc) + printf("%s: devmem2 failed with error %d\n", __func__, rc); + + return rc; +} |
