Using _RTCS_mem_pool for memory allocation

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using _RTCS_mem_pool for memory allocation

ソリューションへジャンプ
1,283件の閲覧回数
jschepler
Contributor III

Hi,

I have MRAM attached to the flexbus that I would like to use for RTCS.  I have been running the task successfully by using the following:

_RTCS_mem_pool = _mem_create_pool(RTCS_mem_location, MRAM_POOL_SIZE);

Now, in my cgi function I would like to allocate memory inside the _RTCS_mem_pool to avoid using the internal RAM of the processor, so I do the following:

/* Read back the data sent from the webpage */
  req_len = (param->content_length) + 1;

  req_buffer = _mem_alloc_system_from(_RTCS_mem_pool, sizeof(char)*req_len);

  if(req_buffer != NULL)
  {
    read_len = HTTPSRV_cgi_read(param->ses_handle, req_buffer, req_len);
  }

I successfully point to a location in the _RTCS_mem_pool, but the call to HTTPSRV_cgi_read never returns.  Am I allowed to use the _RTCS_mem_pool for my own allocations?

ラベル(1)
タグ(3)
1 解決策
1,157件の閲覧回数
jschepler
Contributor III

Hi all,

I was able to successfully use the RTCS pool to allocate memory.  The reason HTTPSRV_cgi_read was failing was because I had an incorrect value for the last parameter.  It was stuck in a while loop internally waiting to read the number of byte I passed in parameter 3.  The reason I allocated +1 for memory was to store the '\0'.  

It now reads:

if(req_buffer != NULL)
{
  read_len = HTTPSRV_cgi_read(param->ses_handle, req_buffer, req_len - 1);
}‍‍‍‍

元の投稿で解決策を見る

1 返信
1,158件の閲覧回数
jschepler
Contributor III

Hi all,

I was able to successfully use the RTCS pool to allocate memory.  The reason HTTPSRV_cgi_read was failing was because I had an incorrect value for the last parameter.  It was stuck in a while loop internally waiting to read the number of byte I passed in parameter 3.  The reason I allocated +1 for memory was to store the '\0'.  

It now reads:

if(req_buffer != NULL)
{
  read_len = HTTPSRV_cgi_read(param->ses_handle, req_buffer, req_len - 1);
}‍‍‍‍