void * dma_alloc_coherent(void* none, u32 size, edma_addr_t *handle, u32 none2) { void * memory; memory = cacheDmaMalloc(size); *handle = (edma_addr_t)memory; return memory; }
void* osl_dma_alloc_consistent(void *dev, uint size, void **pap) { void *va; va = cacheDmaMalloc(size); *pap = (void *)CACHE_DMA_VIRT_TO_PHYS(va); return (va); }
void* osl_dma_alloc_consistent(osl_t *osh, unsigned int size, ulong *pap) { void *va; va = cacheDmaMalloc(size); *pap = (ulong)CACHE_DMA_VIRT_TO_PHYS(va); return (va); }
/* Netpool create */ LOCAL int roboTxRxNetpoolCreate() { memset(&robo_txrx_info, 0, sizeof(robo_txrx_info)); robo_txrx_info.roboNetPoolID = (NET_POOL_ID)calloc(1, sizeof(NET_POOL)); if (robo_txrx_info.roboNetPoolID == NULL) { return(0); } robo_txrx_info.m_cl_blks.mBlkNum = ROBO_TXRX_MBLKS; robo_txrx_info.m_cl_blks.clBlkNum = ROBO_TXRX_CLBLKS; robo_txrx_info.m_cl_blks.memSize = (robo_txrx_info.m_cl_blks.mBlkNum * (M_BLK_SZ + sizeof(long))) + (robo_txrx_info.m_cl_blks.clBlkNum * (CL_BLK_SZ + sizeof(long)));; robo_txrx_info.m_cl_blks.memArea = (char *)memalign (sizeof (long), robo_txrx_info.m_cl_blks.memSize); if (robo_txrx_info.m_cl_blks.memArea == NULL) { free(robo_txrx_info.roboNetPoolID); robo_txrx_info.roboNetPoolID = NULL; return(0); } robo_txrx_info.cluster.clNum = ROBO_TXRX_CLBUFS; robo_txrx_info.cluster.clSize = ROBO_TX_RX_PK_SZ; robo_txrx_info.cluster.memSize = robo_txrx_info.cluster.clNum * (robo_txrx_info.cluster.clSize + sizeof(long)) + sizeof(long); robo_txrx_info.cluster.memArea = cacheDmaMalloc( robo_txrx_info.cluster.memSize); if (robo_txrx_info.cluster.memArea == NULL) { free(robo_txrx_info.roboNetPoolID); robo_txrx_info.roboNetPoolID = NULL; free(robo_txrx_info.m_cl_blks.memArea); robo_txrx_info.m_cl_blks.memArea = NULL; return(0); } if (netPoolInit(robo_txrx_info.roboNetPoolID, &robo_txrx_info.m_cl_blks, &robo_txrx_info.cluster, 1, NULL) != OK) { free(robo_txrx_info.roboNetPoolID); robo_txrx_info.roboNetPoolID = NULL; free(robo_txrx_info.m_cl_blks.memArea); robo_txrx_info.m_cl_blks.memArea = NULL; free(robo_txrx_info.cluster.memArea); robo_txrx_info.cluster.memArea = NULL; return(0); } robo_txrx_info.clpool_id = netClPoolIdGet(robo_txrx_info.roboNetPoolID, robo_txrx_info.cluster.clSize, FALSE); return(1); }
/* Netpool create */ LOCAL int et_drvTxRxNetpoolCreate(int unit) { et_drv_txrx_info[unit].et_drvNetPoolID = (NET_POOL_ID)calloc(1, sizeof(NET_POOL)); if (et_drv_txrx_info[unit].et_drvNetPoolID == NULL) { return(0); } et_drv_txrx_info[unit].m_cl_blks.mBlkNum = ET_DRV_TXRX_MBLKS; et_drv_txrx_info[unit].m_cl_blks.clBlkNum = ET_DRV_TXRX_CLBLKS; et_drv_txrx_info[unit].m_cl_blks.memSize = (et_drv_txrx_info[unit].m_cl_blks.mBlkNum * (M_BLK_SZ + sizeof(long))) + (et_drv_txrx_info[unit].m_cl_blks.clBlkNum * (CL_BLK_SZ + sizeof(long))); et_drv_txrx_info[unit].m_cl_blks.memArea = (char *)memalign (sizeof (long), et_drv_txrx_info[unit].m_cl_blks.memSize); if (et_drv_txrx_info[unit].m_cl_blks.memArea == NULL) { free(et_drv_txrx_info[unit].et_drvNetPoolID); et_drv_txrx_info[unit].et_drvNetPoolID = NULL; return(0); } et_drv_txrx_info[unit].cluster.clNum = ET_DRV_TXRX_CLBUFS; et_drv_txrx_info[unit].cluster.clSize = ET_DRV_TX_RX_PK_SZ; et_drv_txrx_info[unit].cluster.memSize = et_drv_txrx_info[unit].cluster.clNum * (et_drv_txrx_info[unit].cluster.clSize + sizeof(long)) + sizeof(long); et_drv_txrx_info[unit].cluster.memArea = cacheDmaMalloc( et_drv_txrx_info[unit].cluster.memSize); if (et_drv_txrx_info[unit].cluster.memArea == NULL) { free(et_drv_txrx_info[unit].et_drvNetPoolID); et_drv_txrx_info[unit].et_drvNetPoolID = NULL; free(et_drv_txrx_info[unit].m_cl_blks.memArea); et_drv_txrx_info[unit].m_cl_blks.memArea = NULL; return(0); } if (netPoolInit(et_drv_txrx_info[unit].et_drvNetPoolID, &et_drv_txrx_info[unit].m_cl_blks, &et_drv_txrx_info[unit].cluster, 1, NULL) != OK) { free(et_drv_txrx_info[unit].et_drvNetPoolID); et_drv_txrx_info[unit].et_drvNetPoolID = NULL; free(et_drv_txrx_info[unit].m_cl_blks.memArea); et_drv_txrx_info[unit].m_cl_blks.memArea = NULL; free(et_drv_txrx_info[unit].cluster.memArea); et_drv_txrx_info[unit].cluster.memArea = NULL; return(0); } et_drv_txrx_info[unit].clpool_id = netClPoolIdGet(et_drv_txrx_info[unit].et_drvNetPoolID, et_drv_txrx_info[unit].cluster.clSize, FALSE); return(1); }
void* bsp_om_alloc(u32 size, u32 *phy_real_addr) { void *virt_addr = NULL; #ifdef __VXWORKS__ if(OM_MALLOC_MAX_SIZE < size ) { return NULL; } /*lint -save -e18 */ virt_addr = (void *)cacheDmaMalloc(size + 8); /*lint -restore +e18 */ if(virt_addr == NULL) { return NULL; } /*lint -save -e124 */ virt_addr = virt_addr - ((u32)virt_addr % 8)+8; *phy_real_addr = (u32)virt_addr; /*lint -restore +e124 */ #endif #ifdef __KERNEL__ u32 i = 0; int index =0; if(OM_MALLOC_MAX_SIZE < size ) { return NULL; } for(i=0;i<=OM_MALLOC_MAX_INDEX;i++) { if(size <= (u32)(MEMORY_PAGE_SIZE * (1<<i))) { index = i; break; } } virt_addr = (u8*)__get_free_pages(GFP_KERNEL,index); *phy_real_addr = virt_to_phys((u32)virt_addr); #endif return virt_addr; }
void * ssh_kernel_alloc(size_t size, SshUInt32 flag) { unsigned char *v; if (flag & SSH_KERNEL_ALLOC_DMA) { v = cacheDmaMalloc(size + SSH_MALLOC_OVERHEAD); ((SshUInt32 *) v)[0] = SSH_VX_KERNEL_ALLOC_DMA; } else { v = malloc(size + SSH_MALLOC_OVERHEAD); ((SshUInt32 *) v)[0] = 0; } return (v + SSH_MALLOC_OVERHEAD); }
void* bsp_om_alloc(u32 size, u32*phy_real_addr) { void *virt_addr = NULL; #ifdef __VXWORKS__ if(OM_MALLOC_MAX_SIZE < size ) { return NULL; } virt_addr = cacheDmaMalloc(size); *phy_real_addr = (u32)virt_addr; #endif #ifdef __KERNEL__ u32 i = 0; u32 index =0; if(OM_MALLOC_MAX_SIZE < size ) { return NULL; } for(i=0;i<=OM_MALLOC_MAX_INDEX;i++) { if(size <= (u32)(MEMORY_PAGE_SIZE * ((u32)1<<i))) { index = i; break; } } virt_addr = (u8*)__get_free_pages(GFP_KERNEL,index); if( virt_addr == NULL) { return NULL; } *(phy_real_addr) = (u32)virt_to_phys(virt_addr); #endif return virt_addr; }
void * ossPartMalloc ( UINT32 numBytes /* Size of buffer to allocate */ ) { void * pBfr; void * pMoreMemory; UINT32 growSize; /* Create the USB memory partition from cache safe memory */ if (ossPartInitFlag == TRUE) { /* on the first pass create 64k chunk of cache safe memory for usb */ pUsbMemSpace = (char *) cacheDmaMalloc (usbMemPartSize); if (pUsbMemSpace == NULL) { printf ("ossLib.c: unable to allocate USB memory space.\n"); return NULL; } /* make this chunk a partition */ usbMemPartId = memPartCreate (pUsbMemSpace, usbMemPartSize); if (usbMemPartId == NULL) { printf ("ossLib.c: unable to create USB memory partition.\n"); return NULL; } ossPartInitFlag = FALSE; } /* * If this call to ossMalloc is going to allocate more memory than is * available in the partition, then grow the partition by 8k, or if * numBytes is larger than 4k, then grow the partition by numBytes + 4k. */ if ((usbMemCount + numBytes) > (usbMemPartSize - 0x1000)) { growSize = 0x2000; if (numBytes > 0x1000) growSize += numBytes; pMoreMemory = cacheDmaMalloc (growSize); if (pMoreMemory == NULL) { printf ("ossLib.c: ossPartMalloc could not cacheDmaMalloc() new" \ " memory.\n"); return NULL; } if (memPartAddToPool (usbMemPartId, pMoreMemory, growSize) == ERROR) { printf ("ossLib.c: ossPartMalloc could not add new memory to" \ " pool.\n"); return NULL; } usbMemPartSize += growSize; } /* From now on, use this partition for all USB mallocs */ pBfr = memPartAlignedAlloc (usbMemPartId, ROUND_UP(numBytes, _CACHE_ALIGN_SIZE), _CACHE_ALIGN_SIZE); if (pBfr == NULL) { printf ("ossLib.c: unable to malloc USB memory.\n"); return NULL; } /* Update the amount of memory USB is currently using. */ usbMemCount += ROUND_UP(numBytes, _CACHE_ALIGN_SIZE); return pBfr; }
/***************************************************************************** * 函 数 名 : cshell_sio_init * * 功能描述 : cshell tty设备初始化,初始化缓冲区 * * 输入参数 : void * 输出参数 : 无 * * 返 回 值 : 无 * * 修改记录 : *****************************************************************************/ static int cshell_sio_init(SHELL_IO_CHAN *ptr_shell) { if (!ptr_shell) { cshell_print_error("NULL PTR!\n"); return CSHELL_ERROR; } //ptr_shell->cshell_recv_sem = semBCreate(SEM_Q_FIFO, SEM_EMPTY); osl_sem_init(0, &(ptr_shell->cshell_recv_sem)); if(!ptr_shell->cshell_recv_sem) { cshell_print_error("fail to cshell_recv_sem!\n"); goto malloc_send_buf_fail; } /* 申请Shell数据发送缓冲区 */ if (NULL == (ptr_shell->ptr_send_buf = (u8*) cacheDmaMalloc(IO_BUFFER_MAX*2))) { cshell_print_error("send buf malloc fail!\n"); goto malloc_send_buf_fail; } if (NULL == (ptr_shell->ptr_recv_buf = (u8*) cacheDmaMalloc(IO_BUFFER_MAX))) { cshell_print_error("recv buf malloc fail!\n"); goto malloc_recv_buf_fail; } /* 初始化tty设备,挂接回调函数指针 */ if (shell_io_sio_drv_funcs.ioctl == NULL) { shell_io_sio_drv_funcs.ioctl = (int (*)())cshell_io_ioctl; shell_io_sio_drv_funcs.txStartup = (int (*)())cshell_io_startup; shell_io_sio_drv_funcs.callbackInstall = (int (*)())cshell_io_cb_install; shell_io_sio_drv_funcs.pollInput = (int (*)())cshell_io_rx_char; shell_io_sio_drv_funcs.pollOutput = (int (*)(SIO_CHAN *, char))cshell_io_tx_char; } ptr_shell->ptr_drv_funcs = &shell_io_sio_drv_funcs; if(CSHELL_OK != osl_task_init("tCShell", CSHELL_TASK_PRI, CSHELL_TASK_STACK_SIZE, (void *)cshell_io_send, NULL, (u32 *)&ptr_shell->shell_send_tid)) { cshell_print_error("create task fail!\n"); goto create_task_fail; } selWakeupListInit (&ptr_shell->sel_wakeup_list); ttyDevCreate ("/tyCo/3", (SIO_CHAN *)ptr_shell, TTY_BUFFER_MAX, TTY_BUFFER_MAX); /*lint !e740 */ return OK; create_task_fail: cshell_safe_free(ptr_shell->ptr_recv_buf); malloc_recv_buf_fail: cshell_safe_free(ptr_shell->ptr_send_buf); malloc_send_buf_fail: cshell_io_uninit(ptr_shell); return CSHELL_ERROR; }
s32 edma_test(enum edma_req_id req_id, u32 size, u32 bst_width,u32 bst_len, s32 vec_flag) { s32 chan_id = -1; u32 index_size = 0; u32 addr_use1 = 0; u32 addr_use2 = 0; u32 * temp = 0; //bsp_edma_init(); if(0 == (addr1 = (u32*)cacheDmaMalloc(size+32))) { hiedmac_trace(BSP_LOG_LEVEL_DEBUG," malloc1 size=0x%x failed \n",size); return -1; } if(0 == (addr2 = (u32*)cacheDmaMalloc(size+32))) { free(addr1); hiedmac_trace(BSP_LOG_LEVEL_DEBUG," malloc2 size=0x%x failed \n",size); return -1; } printf("addr1=0x%x, addr2=0x%x \n",(u32)addr1,(u32)addr2); edma_build_data((u8*)addr1, size+32, 0x20); edma_build_data((u8*)addr2, size+32, 0x40); /*test: 让addr 1k 对齐 */ addr_use1 = (u32)addr1+4; addr_use2 = (u32)addr2+4; printf("addr_use1=0x%x, addr_use2=0x%x \n",addr_use1,addr_use2); temp = (u32*)addr_use1; for(index_size=0; index_size<(size/4);index_size++ ) { *temp++ = (u32)index_size; } chan_id = bsp_edma_channel_init(req_id,0,0,0); bsp_edma_channel_set_config(chan_id,3,bst_width,bst_len); if(1==vec_flag) { bsp_edma_channel_start(chan_id, addr_use1, addr_use2 , size ); } else { bsp_edma_channel_2vec_start(chan_id, addr_use1, addr_use2 , size,edma_align_size); } while( EDMA_CHN_BUSY == bsp_edma_channel_is_idle(chan_id) ) { printf("a"); chan_stop++; if (20==chan_stop) { bsp_edma_channel_stop( chan_id); printf("A"); } } printf("a\n"); bsp_edma_channel_free(chan_id); hiedmac_trace(BSP_LOG_LEVEL_DEBUG, "CMP after edma tranfer:%d \n",memcmp((void*)addr_use1,(void*)addr_use2,size)); hiedmac_trace(BSP_LOG_LEVEL_DEBUG, "CMP size+4 after edma :%d \n",memcmp((void*)addr_use1,(void*)addr_use2,size+4)); cacheDmaFree(addr1); cacheDmaFree(addr2); return 0; }
/* *************************************************************************** *Function: acquire *Description: This routine is the ACQUIRE example program. *************************************************************************** */ void acquire(void) { char sbTopName[20],sbBotName[20]; FILE *ptrTopFile=0,*ptrBotFile=0; unsigned int p6256RegBaseAddr[4]; /* For ALL 4 VIM sites */ P6256_BOARD_PARAMS p6256BoardParams[4]; P6256_REG_ADDR p6256Regs[4]; volatile int wdCount,wdCtrlWord; unsigned int clockRate; unsigned int numCyclesDelay,bifoClock; printf("[acquire]:\tstarting\n"); /* Turn all led's off */ sysLED_Off(0); sysLED_Off(1); sysLED_Off(2); sysLED_Off(3); top_outData=(int *)cacheDmaMalloc(BUFFER_SIZE*sizeof(int)); bot_outData=(int *)cacheDmaMalloc(BUFFER_SIZE*sizeof(int)); top_iData= (int *)cacheDmaMalloc(BUFFER_SIZE*sizeof(int)); bot_iData= (int *)cacheDmaMalloc(BUFFER_SIZE*sizeof(int)); if(top_outData==0||top_iData==0||bot_outData==0||bot_iData==0) { sysLED_On(0); fprintf(stderr,"[acquire] Unable to allocate data buffers\n"); return; } /* get module id; if module is not a 6256, exit */ if(sysVimGetModuleId(TOP_VIM_ID)!=P6256_MODULE_ID) { sysLED_On(0); fprintf(stderr,"[acquire] unable to id 6256\n"); return; } /* Reset and Release All VIM sites */ *P4205_RESET_REG=P4205_RESET_VIM_ALL; taskDelay(4); *P4205_RESET_REG=0; /* Assign the 6256 register base addresses For the selected Vim Site */ p6256RegBaseAddr[TOP_VIM_ID]=sysVimCtrlBase(TOP_VIM_ID); p6256RegBaseAddr[BOT_VIM_ID]=sysVimCtrlBase(BOT_VIM_ID); /* Initialize the 6256 using library routines ------------------ */ /* Initialize Table of 6256 Addresses for Top and Bottom VIMs */ P6256InitRegAddr(p6256RegBaseAddr[TOP_VIM_ID],&p6256Regs[TOP_VIM_ID]); P6256InitRegAddr(p6256RegBaseAddr[BOT_VIM_ID],&p6256Regs[BOT_VIM_ID]); /* Reset Board Registers for Top and Bottom VIMs */ P6256ResetRegs(&p6256Regs[TOP_VIM_ID]); P6256ResetRegs(&p6256Regs[BOT_VIM_ID]); /* Load board parameters with default values for Top and Bottom VIMs */ P6256SetBoardDefaults(&p6256BoardParams[TOP_VIM_ID]); P6256SetBoardDefaults(&p6256BoardParams[BOT_VIM_ID]); /* *Apply program parameters to board parameters Parameters for both will *be set in this local function */ P6256SetBoardParams(&p6256BoardParams[0]); /* * If the onboard clock is used, set clock rate for the default internal * clock rate. If not, use the locally defined external clock rate. * The external clock rate is also used when the clock is obtained from * the sync bus, even if the sync bus is driven from the onboard clock. * Note that the SAME Clock source will be used for BOTH Top and Bottom * VIM Sites. */ if((p6256BoardParams[TOP_VIM_ID].clockSourceSelect==P6256_CLK_SRC_SEL_BYPASS)&&(p6256BoardParams[TOP_VIM_ID].clockSelect==P6256_ONBOARD_CLOCK)) clockRate = P6256_INT_OSC_STANDARD; /* defined in 6256.h */ else clockRate = EXTERNAL_CLOCK_RATE; /* local define */ /* Initialize Board Registers */ P6256InitBoardRegs(&p6256BoardParams[TOP_VIM_ID],&p6256Regs[TOP_VIM_ID]); P6256InitBoardRegs(&p6256BoardParams[BOT_VIM_ID],&p6256Regs[BOT_VIM_ID]); /* ******************************************************************* * DATA COLLECTION AND PROCESSING STAGE * * the data is channeled into buffers based on the data routing mode * as set in the channel control register. ******************************************************************* */ /* Disable Fifo Writes */ P6256_DISABLE_FIFO_WRITE(p6256Regs[TOP_VIM_ID].syncGateGenerator); P6256_DISABLE_FIFO_WRITE(p6256Regs[BOT_VIM_ID].syncGateGenerator); wdCtrlWord=func_initialize_9656_dma_controller(); /* Calculate Slowest Bifo Clock */ bifoClock=25000000; numCyclesDelay=sysGetCpuRate()/(bifoClock>>2); /* Flush the Bifo */ sysVimFlushBifo(Delay,numCyclesDelay,512,16,512,16,TOP_VIM_ID); sysVimFlushBifo(Delay,numCyclesDelay,512,16,512,16,BOT_VIM_ID); /*fetch the data*/ /* Enable Fifo Writes */ P6256_ENABLE_FIFO_WRITE(p6256Regs[TOP_VIM_ID].syncGateGenerator); P6256_ENABLE_FIFO_WRITE(p6256Regs[BOT_VIM_ID].syncGateGenerator); /* Start both DMAs */ PLX9656_REG_WRITE(plx9656Base,PLX9656_PCI_DMACSR0_DMACSR1,wdCtrlWord); /* Wait until done */ if(TOP_VIM_ID==P4205_VIM_A) /* upper VIM location, sites A & B */ { while (!(GT_GPP_POLL_CAUSE(PLX_1_INT))) ; GT_GPP_CLEAR_CAUSE(PLX_1_INT); } else { while (!(GT_GPP_POLL_CAUSE(PLX_2_INT))) ; GT_GPP_CLEAR_CAUSE(PLX_2_INT); } /*sync with cache ... maybe unnecessary*/ cacheInvalidate(DATA_CACHE,(void *)top_outData,BUFFER_SIZE*sizeof(int)); cacheInvalidate(DATA_CACHE,(void *)bot_outData,BUFFER_SIZE*sizeof(int)); cacheInvalidate(DATA_CACHE,(void *)top_iData, BUFFER_SIZE*sizeof(int)); cacheInvalidate(DATA_CACHE,(void *)bot_iData, BUFFER_SIZE*sizeof(int)); /* strip out inphase/quadrature components*/ func_process_collected_data(); cacheFlush(DATA_CACHE,(void *)top_iData,BUFFER_SIZE*sizeof(int)); cacheFlush(DATA_CACHE,(void *)bot_iData,BUFFER_SIZE*sizeof(int)); /*create unique name for output files*/ sprintf(sbTopName,"./top%d.dat",TOP_VIM_ID); sprintf(sbBotName,"./bot%d.dat",BOT_VIM_ID); sbTopName[12]=0; sbBotName[12]=0; /*open/create file*/ ptrTopFile=fopen(sbTopName,"w"); ptrBotFile=fopen(sbBotName,"w"); if(ptrTopFile<=0||ptrBotFile<=0) fprintf(stdout,"unable to create/open output file(s)\n"); else { /*write to file*/ for(wdCount=0;wdCount<BUFFER_SIZE;wdCount++) { fprintf(ptrTopFile,"%d\n",top_iData[wdCount]); fprintf(ptrBotFile,"%d\n",bot_iData[wdCount]); } fclose(ptrTopFile); fclose(ptrBotFile); } sysLED_On(1); sysLED_On(2); sysLED_On(3); printf("[acquire]:\tconcluding\n"); /*free allocated resources and exit*/ cacheDmaFree((void *)top_outData); cacheDmaFree((void *)bot_outData); cacheDmaFree((void *)top_iData); cacheDmaFree((void *)bot_iData); }
s32 edma2_stress_test_start(s32 task_priority,s32 test_rate) { s32 ret = 0; u32 index = 0; s32 chann_id = 0;/*bsp_edma_channel_init(EDMA_MEMORY, 0, 0, 0);*/ for (index=0;index<EDMA_HANDLE_NUM;index++) { g_edma2_busstress_info.stDMATaskHandle[index].ulChIdx = chann_id; } logMsg("edma2_stress: use axi 0x%x \n", MEM_FOR_EDMAC2_BUSSTRESS,0,0,0,0,0); /* g_edma2_busstress_info.stDMATaskHandle[0] = {0, 0, EDMA_TEST_LEN, chann_id}; g_edma2_busstress_info.stDMATaskHandle[1] = {0, EDMA2_HANDLE_1_AXI_MEM_64_DST, EDMA_TEST_LEN, chann_id}; g_edma2_busstress_info.stDMATaskHandle[2] = {EDMA2_HANDLE_2_AXI_MEM_64_SRC, EDMA2_HANDLE_2_AXI_MEM_64_DST, EDMA_TEST_LEN, chann_id}; g_edma2_busstress_info.stDMATaskHandle[3] = {EDMA2_HANDLE_3_AXI_MEM_64_SRC, 0, EDMA_TEST_LEN, chann_id}; */ set_test_switch_stat(EDMAC, TEST_RUN); /*创建控制发送速率的信号量*/ /*sema_init(&(g_edma2_busstress_info.edma_send_sem) , SEM_EMPTY);*/ g_edma2_busstress_info.edma_send_sem = semBCreate(SEM_Q_FIFO, SEM_EMPTY); if (g_edma2_busstress_info.edma_send_sem == NULL) { printf("semBCreate gmac_send_sem fail.\n"); return ERROR; } g_edma2_busstress_info.edma_softtimer_list.func = ( softtimer_func )edma2_timer_event; g_edma2_busstress_info.edma_softtimer_list.para = 0; g_edma2_busstress_info.edma_softtimer_list.timeout = test_rate; g_edma2_busstress_info.edma_softtimer_list.wake_type =SOFTTIMER_NOWAKE; /*创建控制发送速率 的软timer*/ if( bsp_softtimer_create(&g_edma2_busstress_info.edma_softtimer_list)) { printf("SOFTTIMER_CREATE_TIMER fail.\n"); /*sema_delete(g_edma2_busstress_info.edma_send_sem);*/ semDelete(g_edma2_busstress_info.edma_send_sem); return ERROR; } g_edma2_busstress_info.stDMATaskHandle[0].u32SrcAddr = (u32)cacheDmaMalloc(EDMA_TEST_LEN); g_edma2_busstress_info.stDMATaskHandle[0].u32DstAddr = (u32)cacheDmaMalloc(EDMA_TEST_LEN); g_edma2_busstress_info.stDMATaskHandle[1].u32SrcAddr = (u32)cacheDmaMalloc(EDMA_TEST_LEN); g_edma2_busstress_info.stDMATaskHandle[3].u32DstAddr = (u32)cacheDmaMalloc(EDMA_TEST_LEN); /*创建发包测试任务,收包驱动会自行做处理*/ g_edma2_busstress_info.edma_stress_test_task_id \ = taskSpawn ("edmaBusTask", task_priority, 0, 20000, (FUNCPTR)edma2_stress_test_routine, 0, 0, 0, 0,0, 0, 0, 0, 0, 0); if(g_edma2_busstress_info.edma_stress_test_task_id == ERROR) { printf("taskSpawn edma2BusTask fail.\n"); /*sema_delete(g_edma2_busstress_info.edma_send_sem);*/ semDelete(g_edma2_busstress_info.edma_send_sem); ret = bsp_softtimer_free(&g_edma2_busstress_info.edma_softtimer_list); } else { bsp_softtimer_add( &g_edma2_busstress_info.edma_softtimer_list ); } return g_edma2_busstress_info.edma_stress_test_task_id; }