/* Write a SDMA descriptor to memory */ static void mv64460_sdma_desc_write(struct mv64460_data *d,m_uint32_t addr, struct sdma_desc *desc) { struct sdma_desc tmp; /* byte-swapping */ tmp.cmd_stat = vmtoh32(desc->cmd_stat); tmp.buf_size = vmtoh32(desc->buf_size); tmp.next_ptr = vmtoh32(desc->next_ptr); tmp.buf_ptr = vmtoh32(desc->buf_ptr); physmem_copy_to_vm(d->vm,&tmp,addr,sizeof(struct sdma_desc)); }
/* Put a packet in buffer of a descriptor */ static void mv64460_sdma_rxdesc_put_pkt(struct mv64460_data *d, struct sdma_desc *rxd, u_char **pkt,ssize_t *pkt_len) { ssize_t len,cp_len; len = (rxd->buf_size & MV64460_RXDESC_BS_MASK) >> MV64460_RXDESC_BS_SHIFT; /* compute the data length to copy */ cp_len = m_min(len,*pkt_len); /* copy packet data to the VM physical RAM */ physmem_copy_to_vm(d->vm,*pkt,rxd->buf_ptr,cp_len); /* set the byte count in descriptor */ rxd->buf_size |= cp_len; *pkt += cp_len; *pkt_len -= cp_len; }
/* Put a packet in buffer of a descriptor */ static ssize_t rxdesc_put_pkt(struct pos_oc3_data *d,struct rx_desc *rxd, u_char **pkt,ssize_t *pkt_len) { ssize_t len,cp_len; len = rxd->rdes[0] & POS_OC3_RXDESC_LEN_MASK; /* compute the data length to copy */ cp_len = m_min(len,*pkt_len); #if DEBUG_RECEIVE POS_LOG(d,"copying %d bytes at 0x%x\n",cp_len,rxd->rdes[1]); #endif /* copy packet data to the VM physical RAM */ physmem_copy_to_vm(d->vm,*pkt,rxd->rdes[1],cp_len); *pkt += cp_len; *pkt_len -= cp_len; return(cp_len); }