1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /****************************************************************************** 3 * 4 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 * 6 ******************************************************************************/ 7 8 #ifndef _RTW_IO_H_ 9 #define _RTW_IO_H_ 10 11 struct intf_hdl; 12 13 struct _io_ops { 14 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr); 15 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); 16 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); 17 18 int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); 19 int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val); 20 int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); 21 int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata); 22 23 int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val); 24 int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val); 25 int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val); 26 27 void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); 28 void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); 29 30 u32 (*_read_interrupt)(struct intf_hdl *pintfhdl, u32 addr); 31 32 u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); 33 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); 34 35 u32 (*_write_scsi)(struct intf_hdl *pintfhdl, u32 cnt, u8 *pmem); 36 37 void (*_read_port_cancel)(struct intf_hdl *pintfhdl); 38 void (*_write_port_cancel)(struct intf_hdl *pintfhdl); 39 }; 40 41 struct intf_hdl { 42 struct adapter *padapter; 43 struct dvobj_priv *pintf_dev;/* pointer to &(padapter->dvobjpriv); */ 44 45 struct _io_ops io_ops; 46 }; 47 48 #define SD_IO_TRY_CNT (8) 49 #define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT 50 51 int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj); 52 void rtw_reset_continual_io_error(struct dvobj_priv *dvobj); 53 54 struct io_priv { 55 56 struct adapter *padapter; 57 58 struct intf_hdl intf; 59 60 }; 61 62 extern u8 rtw_read8(struct adapter *adapter, u32 addr); 63 extern u16 rtw_read16(struct adapter *adapter, u32 addr); 64 extern u32 rtw_read32(struct adapter *adapter, u32 addr); 65 66 extern int rtw_write8(struct adapter *adapter, u32 addr, u8 val); 67 extern int rtw_write16(struct adapter *adapter, u32 addr, u16 val); 68 extern int rtw_write32(struct adapter *adapter, u32 addr, u32 val); 69 70 extern u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem); 71 72 int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapter *padapter, struct _io_ops *pops)); 73 74 #endif /* _RTL8711_IO_H_ */ 75