This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

如何对buf2 = Memory_alloc(otherHeap, 128, 0, &eb);获得的memory空间赋值?



我用下面这个方法对 buf2 = Memory_alloc(otherHeap, 128, 0, &eb);分配的空间进行赋值

 for(i=0;i<10;i++)    

 {      *(buf2+i)=i;     }

但是出现下面这个错误:

#906 expression must be a pointer to a complete object type

请问:如何对以分配的空间进行赋值,谢谢。

如果您也了解内存空间对齐,请您也给讲讲空间对齐的问题:

Ptr HeapBuf_alloc(HeapBuf_Handle handle, SizeT size, SizeT align, Error_Block *eb);

ARGUMENTS
handle— handle of a previously-created HeapBuf instance object
size— size (in MADUs) of the block
align— alignment (in MADUs)  of the block
eb— pointer to error block
 
我如何设置align— alignment (in MADUs)  of the block这个参数,谢谢
  • Zhijun

    请问你是针对C2000的RAM空间进行赋值吗?

    可以使用memcopy函数,将一个buf的内容copy到另外一个地址空间。

     

    void MemCopy(Uint16 *SourceAddr, Uint16* SourceEndAddr, Uint16* DestAddr)

     {     while(SourceAddr < SourceEndAddr)   

      {        *DestAddr++ = *SourceAddr++;    

    }     return;

     }

    Eric

  • 尊敬的 Eric

    我已经按着你说的做了,发现这个方法非常好,这两天一直忙,没有时间谢你,抱歉!

    lei