1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef __WL1251_IO_H__
22#define __WL1251_IO_H__
23
24#include "wl1251.h"
25
26#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
27
28#define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0
29#define HW_ACCESS_PART0_START_ADDR 0x1FFC4
30#define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8
31#define HW_ACCESS_PART1_START_ADDR 0x1FFCC
32
33#define HW_ACCESS_REGISTER_SIZE 4
34
35#define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
36
37static inline u32 wl1251_read32(struct wl1251 *wl, int addr)
38{
39 wl->if_ops->read(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
40
41 return le32_to_cpu(wl->buffer_32);
42}
43
44static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val)
45{
46 wl->buffer_32 = cpu_to_le32(val);
47 wl->if_ops->write(wl, addr, &wl->buffer_32, sizeof(wl->buffer_32));
48}
49
50static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr)
51{
52 u32 response;
53
54 if (wl->if_ops->read_elp)
55 wl->if_ops->read_elp(wl, addr, &response);
56 else
57 wl->if_ops->read(wl, addr, &response, sizeof(u32));
58
59 return response;
60}
61
62static inline void wl1251_write_elp(struct wl1251 *wl, int addr, u32 val)
63{
64 if (wl->if_ops->write_elp)
65 wl->if_ops->write_elp(wl, addr, val);
66 else
67 wl->if_ops->write(wl, addr, &val, sizeof(u32));
68}
69
70
71void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len);
72void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len);
73u32 wl1251_mem_read32(struct wl1251 *wl, int addr);
74void wl1251_mem_write32(struct wl1251 *wl, int addr, u32 val);
75
76u32 wl1251_reg_read32(struct wl1251 *wl, int addr);
77void wl1251_reg_write32(struct wl1251 *wl, int addr, u32 val);
78
79void wl1251_set_partition(struct wl1251 *wl,
80 u32 part_start, u32 part_size,
81 u32 reg_start, u32 reg_size);
82
83#endif
84