1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef __FIFO_MONITOR_PUBLIC_H_INCLUDED__
17#define __FIFO_MONITOR_PUBLIC_H_INCLUDED__
18
19#include "system_local.h"
20
21typedef struct fifo_channel_state_s		fifo_channel_state_t;
22typedef struct fifo_switch_state_s		fifo_switch_state_t;
23typedef struct fifo_monitor_state_s		fifo_monitor_state_t;
24
25/*! Set a fifo switch multiplex
26
27 \param	ID[in]				FIFO_MONITOR identifier
28 \param	switch_id[in]		fifo switch identifier
29 \param	sel[in]				fifo switch selector
30
31 \return none, fifo_switch[switch_id].sel = sel
32 */
33STORAGE_CLASS_FIFO_MONITOR_H void fifo_switch_set(
34    const fifo_monitor_ID_t		ID,
35    const fifo_switch_t			switch_id,
36    const hrt_data				sel);
37
38/*! Get a fifo switch multiplex
39
40 \param	ID[in]				FIFO_MONITOR identifier
41 \param	switch_id[in]		fifo switch identifier
42
43 \return fifo_switch[switch_id].sel
44 */
45STORAGE_CLASS_FIFO_MONITOR_H hrt_data fifo_switch_get(
46    const fifo_monitor_ID_t		ID,
47    const fifo_switch_t			switch_id);
48
49/*! Read the state of FIFO_MONITOR[ID]
50
51 \param	ID[in]				FIFO_MONITOR identifier
52 \param	state[out]			fifo monitor state structure
53
54 \return none, state = FIFO_MONITOR[ID].state
55 */
56void fifo_monitor_get_state(
57    const fifo_monitor_ID_t		ID,
58    fifo_monitor_state_t		*state);
59
60/*! Read the state of a fifo channel
61
62 \param	ID[in]				FIFO_MONITOR identifier
63 \param	channel_id[in]		fifo channel identifier
64 \param	state[out]			fifo channel state structure
65
66 \return none, state = fifo_channel[channel_id].state
67 */
68void fifo_channel_get_state(
69    const fifo_monitor_ID_t		ID,
70    const fifo_channel_t		channel_id,
71    fifo_channel_state_t		*state);
72
73/*! Read the state of a fifo switch
74
75 \param	ID[in]				FIFO_MONITOR identifier
76 \param	switch_id[in]		fifo switch identifier
77 \param	state[out]			fifo switch state structure
78
79 \return none, state = fifo_switch[switch_id].state
80 */
81void fifo_switch_get_state(
82    const fifo_monitor_ID_t		ID,
83    const fifo_switch_t			switch_id,
84    fifo_switch_state_t			*state);
85
86/*! Write to a control register of FIFO_MONITOR[ID]
87
88 \param	ID[in]				FIFO_MONITOR identifier
89 \param	reg[in]				register index
90 \param value[in]			The data to be written
91
92 \return none, FIFO_MONITOR[ID].ctrl[reg] = value
93 */
94STORAGE_CLASS_FIFO_MONITOR_H void fifo_monitor_reg_store(
95    const fifo_monitor_ID_t		ID,
96    const unsigned int			reg,
97    const hrt_data				value);
98
99/*! Read from a control register of FIFO_MONITOR[ID]
100
101 \param	ID[in]				FIFO_MONITOR identifier
102 \param	reg[in]				register index
103 \param value[in]			The data to be written
104
105 \return FIFO_MONITOR[ID].ctrl[reg]
106 */
107STORAGE_CLASS_FIFO_MONITOR_H hrt_data fifo_monitor_reg_load(
108    const fifo_monitor_ID_t		ID,
109    const unsigned int			reg);
110
111#endif /* __FIFO_MONITOR_PUBLIC_H_INCLUDED__ */
112