void SdioLocalCmd52Write1Byte(struct adapter *adapter, u32 addr, u8 v) { struct intf_hdl *intfhdl = &adapter->iopriv.intf; HalSdioGetCmdAddr8723BSdio(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); sd_cmd52_write(intfhdl, addr, 1, &v); }
void SdioLocalCmd52Write4Byte(PADAPTER padapter, u32 addr, u32 v) { struct intf_hdl * pintfhdl=&padapter->iopriv.intf; HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); v = cpu_to_le32(v); sd_cmd52_write(pintfhdl, addr, 4, (u8*)&v); }
void SdioLocalCmd52Write1Byte(PADAPTER padapter, u32 addr, u8 v) { struct intf_hdl * pintfhdl; pintfhdl=&padapter->iopriv.intf; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); sd_cmd52_write(pintfhdl, addr, 1, &v); }
s32 sdio_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8* pbuf) { PADAPTER padapter; struct dvobj_priv *psdiodev; PSDIO_DATA psdio; u8 bMacPwrCtrlOn; u8 deviceId; u16 offset; u32 ftaddr; u8 shift; s32 err; _func_enter_; padapter = pintfhdl->padapter; psdiodev = pintfhdl->pintf_dev; psdio = &psdiodev->intf_data; err = 0; ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == padapter->pwrctrlpriv.bFwCurrentInPSMode) #endif ) { err = sd_cmd52_write(psdio, ftaddr, cnt, pbuf); return err; } shift = ftaddr & 0x3; if (shift == 0) { err = sd_write(psdio, ftaddr, cnt, pbuf); } else { u8 *ptmpbuf; u32 n; ftaddr &= ~(u16)0x3; n = cnt + shift; ptmpbuf = rtw_malloc(n); if (NULL == ptmpbuf) return -1; err = sd_read(psdio, ftaddr, 4, ptmpbuf); if (err) { rtw_mfree(ptmpbuf, n); return err; } _rtw_memcpy(ptmpbuf+shift, pbuf, cnt); err = sd_write(psdio, ftaddr, n, ptmpbuf); rtw_mfree(ptmpbuf, n); } _func_exit_; return err; }
static s32 sdio_write16(struct intf_hdl *intfhdl, u32 addr, u16 val) { u32 ftaddr; __le16 le_tmp; ftaddr = _cvrt2ftaddr(addr, NULL, NULL); le_tmp = cpu_to_le16(val); return sd_cmd52_write(intfhdl, ftaddr, 2, (u8 *)&le_tmp); }
void SdioLocalCmd52Write1Byte(PADAPTER padapter, u32 addr, u8 v) { PSDIO_DATA psdio; psdio = &adapter_to_dvobj(padapter)->intf_data; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); sd_cmd52_write(psdio, addr, 1, &v); }
static void SdioLocalCmd52Write4Byte(struct adapter *adapter, u32 addr, u32 v) { struct intf_hdl *intfhdl = &adapter->iopriv.intf; __le32 le_tmp; HalSdioGetCmdAddr8723BSdio(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); le_tmp = cpu_to_le32(v); sd_cmd52_write(intfhdl, addr, 4, (u8 *)&le_tmp); }
void SdioLocalCmd52Write4Byte(PADAPTER padapter, u32 addr, u32 v) { PSDIO_DATA psdio; psdio = &padapter->dvobjpriv.intf_data; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); v = cpu_to_le32(v); sd_cmd52_write(psdio, addr, 4, (u8*)&v); }
void SdioLocalCmd52Write2Byte(PADAPTER padapter, u32 addr, u16 v) { PSDIO_DATA psdio; psdio = &adapter_to_dvobj(padapter)->intf_data; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); v = cpu_to_le16(v); sd_cmd52_write(psdio, addr, 2, (u8*)&v); }
static s32 sdio_write32(struct intf_hdl *intfhdl, u32 addr, u32 val) { struct adapter *adapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; s32 err; __le32 le_tmp; adapter = intfhdl->padapter; err = 0; ftaddr = _cvrt2ftaddr(addr, &device_id, &offset); rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); if ( ((device_id == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (!mac_pwr_ctrl_on) || (adapter_to_pwrctl(adapter)->bFwCurrentInPSMode) ) { le_tmp = cpu_to_le32(val); return sd_cmd52_write(intfhdl, ftaddr, 4, (u8 *)&le_tmp); } /* 4 bytes alignment */ shift = ftaddr & 0x3; if (shift == 0) { sd_write32(intfhdl, ftaddr, val, &err); } else { le_tmp = cpu_to_le32(val); err = sd_cmd52_write(intfhdl, ftaddr, 4, (u8 *)&le_tmp); } return err; }
s32 sdio_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) { u32 ftaddr; u8 shift; s32 err; _func_enter_; ftaddr = _cvrt2ftaddr(addr, NULL, NULL); val = cpu_to_le16(val); err = sd_cmd52_write(pintfhdl, ftaddr, 2, (u8*)&val); _func_exit_; return err; }
/* * Todo: align address to 4 bytes. */ s32 sdio_local_write( PADAPTER padapter, u32 addr, u32 cnt, u8 *pbuf) { PSDIO_DATA psdio; u8 bMacPwrCtrlOn; s32 err; u8 *ptmpbuf; #ifdef CONFIG_DEBUG_RTL819X if(addr & 0x3) DBG_8192C("%s, address must be 4 bytes alignment\n", __FUNCTION__); if(cnt & 0x3) DBG_8192C("%s, size must be the multiple of 4 \n", __FUNCTION__); #endif psdio = &padapter->dvobjpriv.intf_data; HalSdioGetCmdAddr8723ASdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); padapter->HalFunc.GetHwRegHandler(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if ((_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == padapter->pwrctrlpriv.bFwCurrentInPSMode) #endif ) { err = sd_cmd52_write(psdio, addr, cnt, pbuf); return err; } ptmpbuf = (u8*)rtw_malloc(cnt); if(!ptmpbuf) return (-1); _rtw_memcpy(ptmpbuf, pbuf, cnt); err = sd_write(psdio, addr, cnt, ptmpbuf); if (ptmpbuf) rtw_mfree(ptmpbuf, cnt); return err; }
static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf) { struct adapter *adapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; s32 err; adapter = intfhdl->padapter; err = 0; ftaddr = _cvrt2ftaddr(addr, &device_id, &offset); rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); if ( ((device_id == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (!mac_pwr_ctrl_on) || (adapter_to_pwrctl(adapter)->bFwCurrentInPSMode) ) return sd_cmd52_write(intfhdl, ftaddr, cnt, buf); shift = ftaddr & 0x3; if (shift == 0) { err = sd_write(intfhdl, ftaddr, cnt, buf); } else { u8 *tmpbuf; u32 n; ftaddr &= ~(u16)0x3; n = cnt + shift; tmpbuf = rtw_malloc(n); if (!tmpbuf) return -1; err = sd_read(intfhdl, ftaddr, 4, tmpbuf); if (err) { kfree(tmpbuf); return err; } memcpy(tmpbuf+shift, buf, cnt); err = sd_write(intfhdl, ftaddr, n, tmpbuf); kfree(tmpbuf); } return err; }
/* * Todo: align address to 4 bytes. */ s32 sdio_local_write( PADAPTER padapter, u32 addr, u32 cnt, u8 *pbuf) { struct intf_hdl * pintfhdl; u8 bMacPwrCtrlOn; s32 err; u8 *ptmpbuf; if(addr & 0x3) DBG_8192C("%s, address must be 4 bytes alignment\n", __FUNCTION__); if(cnt & 0x3) DBG_8192C("%s, size must be the multiple of 4 \n", __FUNCTION__); pintfhdl=&padapter->iopriv.intf; HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if ((_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) #endif ) { err = sd_cmd52_write(pintfhdl, addr, cnt, pbuf); return err; } ptmpbuf = (u8*)rtw_malloc(cnt); if (!ptmpbuf) return (-1); _rtw_memcpy(ptmpbuf, pbuf, cnt); err = sd_write(pintfhdl, addr, cnt, ptmpbuf); if (ptmpbuf) rtw_mfree(ptmpbuf, cnt); return err; }
/* * Todo: align address to 4 bytes. */ s32 sdio_local_write( struct adapter *adapter, u32 addr, u32 cnt, u8 *buf ) { struct intf_hdl *intfhdl; u8 mac_pwr_ctrl_on; s32 err; u8 *tmpbuf; if (addr & 0x3) DBG_8192C("%s, address must be 4 bytes alignment\n", __func__); if (cnt & 0x3) DBG_8192C("%s, size must be the multiple of 4\n", __func__); intfhdl = &adapter->iopriv.intf; HalSdioGetCmdAddr8723BSdio(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); if ( (!mac_pwr_ctrl_on) || (adapter_to_pwrctl(adapter)->bFwCurrentInPSMode) ) return sd_cmd52_write(intfhdl, addr, cnt, buf); tmpbuf = rtw_malloc(cnt); if (!tmpbuf) return (-1); memcpy(tmpbuf, buf, cnt); err = sd_write(intfhdl, addr, cnt, tmpbuf); kfree(tmpbuf); return err; }
s32 sdio_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) { struct dvobj_priv *psdiodev; PSDIO_DATA psdio; u32 ftaddr; u8 shift; s32 err; _func_enter_; psdiodev = pintfhdl->pintf_dev; psdio = &psdiodev->intf_data; ftaddr = _cvrt2ftaddr(addr, NULL, NULL); val = cpu_to_le16(val); err = sd_cmd52_write(psdio, ftaddr, 2, (u8*)&val); _func_exit_; return err; }
s32 sdio_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) { PADAPTER padapter; u8 bMacPwrCtrlOn; u8 deviceId; u16 offset; u32 ftaddr; u8 shift; s32 err; _func_enter_; padapter = pintfhdl->padapter; err = 0; ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) #endif ) { val = cpu_to_le32(val); err = sd_cmd52_write(pintfhdl, ftaddr, 4, (u8*)&val); return err; } // 4 bytes alignment shift = ftaddr & 0x3; #if 1 if (shift == 0) { sd_write32(pintfhdl, ftaddr, val, &err); } else { val = cpu_to_le32(val); err = sd_cmd52_write(pintfhdl, ftaddr, 4, (u8*)&val); } #else if (shift == 0) { sd_write32(pintfhdl, ftaddr, val, &err); } else { u8 *ptmpbuf; ptmpbuf = (u8*)rtw_malloc(8); if (NULL == ptmpbuf) return (-1); ftaddr &= ~(u16)0x3; err = sd_read(pintfhdl, ftaddr, 8, ptmpbuf); if (err) { rtw_mfree(ptmpbuf, 8); return err; } val = cpu_to_le32(val); _rtw_memcpy(ptmpbuf+shift, &val, 4); err = sd_write(pintfhdl, ftaddr, 8, ptmpbuf); rtw_mfree(ptmpbuf, 8); } #endif _func_exit_; return err; }
if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || (_FALSE == bMacPwrCtrlOn) #ifdef CONFIG_LPS_LCLK || (_TRUE == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) #endif ) { err = sd_cmd52_write(pintfhdl, ftaddr, cnt, pbuf); return err; }