论坛元老
- 积分
- 5246
- 金钱
- 5246
- 注册时间
- 2012-8-25
- 在线时间
- 1024 小时
|
10金钱
- static int _DrawBitLine1BPP_fast(GUI_DEVICE * pDevice, int x, int y, U8 const GUI_UNI_PTR * p_s, int Diff, int xsize, int ysize,int BytesPerLine ,const LCD_PIXELINDEX * pTrans) {
-
- int buffer_lenth = xsize *ysize * sizeof(LCD_PIXELINDEX) ;
- LCD_PIXELINDEX *buffer_p = pvPortMalloc( buffer_lenth);
- if(buffer_p == 0) return 0;
- LCD_PIXELINDEX Index0, Index1;
- LCD_PIXELINDEX *fill_p=buffer_p;
-
- Index0 = *(pTrans + 0);
- Index1 = *(pTrans + 1);
-
- int redata=0;
- switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
- case 0:
- {
- int i,j;
- for(j=0;j<ysize;j++)
- {
- int diffs= Diff;
- U8 const * p = p_s;
- for( i=0;i<xsize;i++)
- {
- *fill_p++ = (*p & (0x80 >> diffs)) ? Index1 : Index0;
- if (++diffs == 8) {
- diffs = 0;
- p++;
- }
- }
- p_s+= BytesPerLine;
-
- }
- RA8875_SetDispWin( x, y, ysize, xsize );
- RA8875_SetCursor( x, y );
- LCD_WR_REG( 0x02 );
-
- hdma_memtomem_dma2_stream1.Instance->CR |= DMA_PINC_ENABLE; //源
- hdma_memtomem_dma2_stream1.Instance->CR &= ~DMA_MINC_ENABLE;//目
- if(0==HAL_DMA_Start_IT(&hdma_memtomem_dma2_stream1, (uint32_t)buffer_p,0x60000000, buffer_lenth) )
- {
- while(HAL_DMA_GetState(&hdma_memtomem_dma2_stream1) !=HAL_DMA_STATE_READY )
- {
-
- }
-
- }
-
-
-
- redata=1;
- }
-
复制代码 如上面程序,用了pvPortMalloc申请内存,然后用dma写入显示中.程序死在while(HAL_DMA_GetState(&hdma_memtomem_dma2_stream1) !=HAL_DMA_STATE_READY ),原因是所有总断都不响应.systick中断也没有.如果不用pvPortMalloc就不会.freertos不精通,求高人指点
|
最佳答案
查看完整内容[请看2#楼]
任务正常调度就不会了,任务调度前用了pvPortMalloc的确会关受控的中断 可以自己强制开全部中断 调度后自动就好了
|