blob: 5654153eb2146fb674a5e8db7206482dcc4ca47b [file] [log] [blame]
Nico Huber239dc802026-06-24 23:04:58 +02001/*
2 * This file is part of the flashprog project.
3 *
4 * Copyright (C) 2026 Nico Huber <nico.h@gmx.de>
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 __PROGRAMMER_PHYSMAP_H__
17#define __PROGRAMMER_PHYSMAP_H__
18
19#include <stdint.h>
20
21#include "flash.h" /* for chipaddr, *sigh* */
22#include "hwaccess_physmap.h"
23
24struct par_master;
25static inline void mmio_chip_writeb(const struct par_master *par, uint8_t val, chipaddr addr)
26{
27 mmio_writeb(val, (void *)addr);
28}
29static inline void mmio_chip_writew(const struct par_master *par, uint16_t val, chipaddr addr)
30{
31 mmio_writew(val, (void *)addr);
32}
33static inline void mmio_chip_writel(const struct par_master *par, uint32_t val, chipaddr addr)
34{
35 mmio_writel(val, (void *)addr);
36}
37static inline uint8_t mmio_chip_readb(const struct par_master *par, const chipaddr addr)
38{
39 return mmio_readb((void *)addr);
40}
41static inline uint16_t mmio_chip_readw(const struct par_master *par, const chipaddr addr)
42{
43 return mmio_readw((void *)addr);
44}
45static inline uint32_t mmio_chip_readl(const struct par_master *par, const chipaddr addr)
46{
47 return mmio_readl((void *)addr);
48}
49static inline void mmio_chip_readn(const struct par_master *par, uint8_t *buf, const chipaddr addr, size_t len)
50{
51 mmio_readn((void *)addr, buf, len);
52}
53
54#endif /* __PROGRAMMER_PHYSMAP_H__ */