1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __FIFO_MONITOR_PRIVATE_H_INCLUDED__
16#define __FIFO_MONITOR_PRIVATE_H_INCLUDED__
17
18#include "fifo_monitor_public.h"
19
20#define __INLINE_GP_DEVICE__
21#include "gp_device.h"
22
23#include "device_access.h"
24
25#include "assert_support.h"
26
27#ifdef __INLINE_FIFO_MONITOR__
28extern const unsigned int FIFO_SWITCH_ADDR[N_FIFO_SWITCH];
29#endif
30
31STORAGE_CLASS_FIFO_MONITOR_C void fifo_switch_set(
32 const fifo_monitor_ID_t ID,
33 const fifo_switch_t switch_id,
34 const hrt_data sel)
35{
36 assert(ID == FIFO_MONITOR0_ID);
37 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
38 assert(switch_id < N_FIFO_SWITCH);
39 (void)ID;
40
41 gp_device_reg_store(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id], sel);
42
43 return;
44}
45
46STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_switch_get(
47 const fifo_monitor_ID_t ID,
48 const fifo_switch_t switch_id)
49{
50 assert(ID == FIFO_MONITOR0_ID);
51 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
52 assert(switch_id < N_FIFO_SWITCH);
53 (void)ID;
54
55 return gp_device_reg_load(GP_DEVICE0_ID, FIFO_SWITCH_ADDR[switch_id]);
56}
57
58
59STORAGE_CLASS_FIFO_MONITOR_C void fifo_monitor_reg_store(
60 const fifo_monitor_ID_t ID,
61 const unsigned int reg,
62 const hrt_data value)
63{
64 assert(ID < N_FIFO_MONITOR_ID);
65 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
66 ia_css_device_store_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data), value);
67 return;
68}
69
70STORAGE_CLASS_FIFO_MONITOR_C hrt_data fifo_monitor_reg_load(
71 const fifo_monitor_ID_t ID,
72 const unsigned int reg)
73{
74 assert(ID < N_FIFO_MONITOR_ID);
75 assert(FIFO_MONITOR_BASE[ID] != (hrt_address)-1);
76 return ia_css_device_load_uint32(FIFO_MONITOR_BASE[ID] + reg*sizeof(hrt_data));
77}
78
79#endif
80