I got mot of the MessageQ code figured out, but can someone explain to me why we need "calloc" in Image processing demo?...Also, "p_queue_msg" is defined as static?...I noticed it is saved in DDR3 but messageQ heap is in shared memory...
int mc_process_init (int number_of_cores)
{
int i;
p_queue_msg = (process_message_t **) calloc(number_of_cores, sizeof(process_message_t *));
if (!p_queue_msg) {
printf("alloc_queue_message: Can't allocate memory for queue message\n");
return -1;
}
for (i = 0; i < number_of_cores; i++) {
p_queue_msg[i] = (process_message_t *) MessageQ_alloc(IMAGE_PROCESSING_HEAPID, sizeof(process_message_t));
if (!p_queue_msg[i]) {
printf("alloc_queue_message: Can't allocate memory for queue message %d\n", i);
return -1;
}
memset(p_queue_msg[i]->info.scratch_buf_len, 0, NUMBER_OF_SCRATCH_BUF * sizeof(uint32_t));
memset(p_queue_msg[i]->info.scratch_buf, 0, NUMBER_OF_SCRATCH_BUF * sizeof(uint8_t *));
}
max_core = number_of_cores;
memset(slave_queue_name, 0, MAX_SLICES*16);
for (i = 0; i < MAX_SLICES; i++) {
GET_SLAVE_QUEUE_NAME(slave_queue_name[i], i);
}
return 0;
}