static void nps_enet_send_frame(struct net_device *ndev, struct sk_buff *skb) { struct nps_enet_priv *priv = netdev_priv(ndev); u32 tx_ctrl_value = 0; short length = skb->len; u32 i, len = DIV_ROUND_UP(length, sizeof(u32)); u32 *src = (void *)skb->data; bool src_is_aligned = IS_ALIGNED((unsigned long)src, sizeof(u32)); /* In case src is not aligned we need an intermediate buffer */ if (src_is_aligned) iowrite32_rep(priv->regs_base + NPS_ENET_REG_TX_BUF, src, len); else /* !src_is_aligned */ for (i = 0; i < len; i++, src++) nps_enet_reg_set(priv, NPS_ENET_REG_TX_BUF, get_unaligned_be32(src)); /* Write the length of the Frame */ tx_ctrl_value |= length << TX_CTL_NT_SHIFT; tx_ctrl_value |= NPS_ENET_ENABLE << TX_CTL_CT_SHIFT; /* Send Frame */ nps_enet_reg_set(priv, NPS_ENET_REG_TX_CTL, tx_ctrl_value); }
/* write a block of 32bit words to the DSP HPI port using auto-inc mode */ static void hpi_write_block(struct dsp_obj *pdo, u32 address, u32 *pdata, u32 length) { u16 length16 = length - 1; if (length == 0) return; if (hpi_set_address(pdo, address)) return; iowrite32_rep(pdo->prHPI_data_auto_inc, pdata, length16); /* take care of errata in revB DSP (2.0.1) */ /* must end with non auto-inc */ iowrite32(*(pdata + length - 1), pdo->prHPI_data); }
/* write a block of 32bit words to the DSP HPI port using auto-inc mode */ static void HpiWriteBlock( struct dsp_obj *pdo, u32 dwAddress, u32 *pdwData, u32 dwLength ) { u16 wLength = dwLength - 1; if (dwLength == 0) return; if (HpiSetAddress(pdo, dwAddress)) return; iowrite32_rep(pdo->prHPIDataAutoInc, pdwData, wLength); /* take care of errata in revB DSP (2.0.1) */ /* must end with non auto-inc */ iowrite32(*(pdwData + dwLength - 1), pdo->prHPIData); }
void outsl(unsigned long port, const void *src, unsigned long count) { iowrite32_rep(ioport_map(port, 4), src, count); }