在学习
ti提供的SARdemo中,有以下代码。请教以下问题:
1. 这里的Host和DSP分别是指的什么?DSP指处理器还是core? Host是指什么?没有搞清楚。
2. 在SYS/BIOS的文档中没有找到关于mailBox的完整API函数说明,请教可以在哪个文档中可以找到?
3. 没有搞清楚mailBox到底有什么用,是否每一个CORE都有自己的mailBox?还是一个处理器只有一个?
/* Initialise Mail boxes for both Host -> DSP and DSP -> Host */
mailBox_config.mem_start_addr = (uint32_t )host2dspmailbox + (core_id * DEMO_PER_MAILBOX_MEM_SIZE);
mailBox_config.mem_size = DEMO_PER_MAILBOX_MEM_SIZE;
mailBox_config.max_payload_size = DEMO_MAILBOX_MAX_PAYLOAD_SIZE;
demo_loopback_test_assert( (mailBox_create(rxMailBoxHandle, MAILBOX_MAKE_HOST_NODE_ID(0),
MAILBOX_MEMORY_LOCATION_LOCAL, MAILBOX_DIRECTION_RECEIVE, &mailBox_config) == 0),
node_id, "ERROR: mailBox_init(host --> dsp) ");
printf("mailbox_create(host --> dsp %d) Done. n",node_id);
txMailBoxHandle = (void *)malloc(mailboxallocsize);
demo_loopback_test_assert( (txMailBoxHandle != NULL), node_id, "ERROR: malloc tx handle ");
mailBox_config.mem_start_addr = (uint32_t )dsp2hostmailbox + (core_id * DEMO_PER_MAILBOX_MEM_SIZE);
demo_loopback_test_assert( (mailBox_create(txMailBoxHandle, MAILBOX_MAKE_HOST_NODE_ID(0),
MAILBOX_MEMORY_LOCATION_LOCAL, MAILBOX_DIRECTION_SEND, &mailBox_config) == 0),
node_id, "ERROR: mailBox_init(dsp --> host) ");
printf("mailbox_create(host <-- dsp %d) Done. n",node_id);
/* Open Mail boxes for both Host -> DSP and DSP -> Host */
ret_val = mailBox_open(rxMailBoxHandle);
demo_loopback_test_assert( (ret_val != -1), node_id, "ERROR: mailBox_open(host --> dsp) ");
printf("mailbox_open(host --> dsp %d) Done. n",node_id);
ret_val = mailBox_open(txMailBoxHandle);
demo_loopback_test_assert( (ret_val != -1), node_id, "ERROR: mailBox_open(host --> dsp) ");
printf("mailbox_open(host <-- dsp %d) Done. n",node_id);
//function to read hardcoded configuration parameters
DefaultAPIparams(&config);
memcpy(&config_copy, &config, sizeof(configuration_t));
for(;;)
[
/* Check and wait for message from host */
do [
ret_val = mailBox_query(rxMailBoxHandle);
] while(!ret_val);
/* Read mailbox to see if any messages */
ret_val = mailBox_read(rxMailBoxHandle, (uint8_t *)&testMsg, &size, &trans_id);