/*-------------------------------------- return actual bytes read */ static esint8 ramdisk_read( int block, char *buf,int blkcnt) { #ifdef EN_DMA memcpy_dma(buf,(eunit8 *)(RAMDISK_ADDRESS_START + block * RAMDISK_SECTOR_SIZE),blkcnt * RAMDISK_SECTOR_SIZE); #else memcpy(buf,(euint8 *)(RAMDISK_ADDRESS_START + block * RAMDISK_SECTOR_SIZE),blkcnt * RAMDISK_SECTOR_SIZE); #endif return blkcnt*512; }
void mbed_eth_put_nbytes(const void *bytes, uint32_t n) { if (current_buffer.ptr == NULL) { MBED_DEBUG("Trying to add %d bytes while prepare_output has not been successfully called\r\n", n); return; } if (n >= DMA_THRESHOLD) memcpy_dma(current_buffer.ptr + current_buffer.size, bytes, n); else memcpy(current_buffer.ptr + current_buffer.size, bytes, n); current_buffer.size += n; }
void membench_run(membench_t *dest, const membench_t *src, membench_result_t *result) { time_measurement_t mem_tmu; size_t len; if (src->size < dest->size) len = src->size; else len = dest->size; /* memset */ chTMObjectInit(&mem_tmu); chTMStartMeasurementX(&mem_tmu); memset(dest->start, 0x55, dest->size); chTMStopMeasurementX(&mem_tmu); result->memset = speed_bps(&mem_tmu, dest->size); /* memcpy */ chTMObjectInit(&mem_tmu); chTMStartMeasurementX(&mem_tmu); memcpy(dest->start, src->start, len); chTMStopMeasurementX(&mem_tmu); result->memcpy = speed_bps(&mem_tmu, len); /* memcmp */ chTMObjectInit(&mem_tmu); chTMStartMeasurementX(&mem_tmu); warning_suppressor = memcmp(dest->start, src->start, len); chTMStopMeasurementX(&mem_tmu); result->memcmp = speed_bps(&mem_tmu, len); /* memcpy DMA */ memcpy_dma_start(); chTMObjectInit(&mem_tmu); chTMStartMeasurementX(&mem_tmu); memcpy_dma(dest->start, src->start, len); chTMStopMeasurementX(&mem_tmu); result->memcpy_dma = speed_bps(&mem_tmu, len); memcpy_dma_stop(); }