samples: shared_mem: rename domain structures

Names like dom0, dom1, part0, part1, etc., don't tell us
much of anything.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-10-23 13:29:51 -07:00 committed by Ioannis Glaropoulos
parent 495f1cffd5
commit 449278c779
2 changed files with 25 additions and 25 deletions

View file

@ -27,9 +27,9 @@
*/
/* prepare the memory partition structures */
FOR_EACH(K_APPMEM_PARTITION_DEFINE, (;), part0, part1, part2, part3, part4);
FOR_EACH(K_APPMEM_PARTITION_DEFINE, (;), user_part, red_part, enc_part, blk_part, ct_part);
/* prepare the memory domain structures */
struct k_mem_domain dom0, dom1, dom2;
struct k_mem_domain pt_domain, enc_domain, ct_domain;
/* each variable starts with a name defined in main.h
* the names are symbolic for the memory partitions
* purpose.
@ -98,9 +98,9 @@ _app_ct_d char ctMSG[] = "CT!\n";
void main(void)
{
struct k_mem_partition *dom1_parts[] = {&part2, &part1, &part3};
struct k_mem_partition *dom2_parts[] = {&part4, &part3};
struct k_mem_partition *dom0_parts[] = {&part0, &part1};
struct k_mem_partition *enc_parts[] = {&enc_part, &red_part, &blk_part};
struct k_mem_partition *ct_parts[] = {&ct_part, &blk_part};
struct k_mem_partition *pt_parts[] = {&user_part, &red_part};
k_tid_t tPT, tENC, tCT;
fBUFIN = 0; /* clear flags */
@ -125,10 +125,10 @@ void main(void)
k_thread_access_grant(tENC, &allforone);
/* use K_FOREVER followed by k_thread_start*/
printk("ENC Thread Created %p\n", tENC);
k_mem_domain_init(&dom1, 3, dom1_parts);
printk("Partitions added to dom1\n");
k_mem_domain_add_thread(&dom1, tENC);
printk("dom1 Created\n");
k_mem_domain_init(&enc_domain, 3, enc_parts);
printk("Partitions added to enc_domain\n");
k_mem_domain_add_thread(&enc_domain, tENC);
printk("enc_domain Created\n");
tPT = k_thread_create(&pt_thread, pt_stack, STACKSIZE,
@ -137,9 +137,9 @@ void main(void)
K_FOREVER);
k_thread_access_grant(tPT, &allforone);
printk("PT Thread Created %p\n", tPT);
k_mem_domain_init(&dom0, 2, dom0_parts);
k_mem_domain_add_thread(&dom0, tPT);
printk("dom0 Created\n");
k_mem_domain_init(&pt_domain, 2, pt_parts);
k_mem_domain_add_thread(&pt_domain, tPT);
printk("pt_domain Created\n");
tCT = k_thread_create(&ct_thread, ct_stack, STACKSIZE,
(k_thread_entry_t)ct, NULL, NULL, NULL,
@ -147,9 +147,9 @@ void main(void)
K_FOREVER);
k_thread_access_grant(tCT, &allforone);
printk("CT Thread Created %p\n", tCT);
k_mem_domain_init(&dom2, 2, dom2_parts);
k_mem_domain_add_thread(&dom2, tCT);
printk("dom2 Created\n");
k_mem_domain_init(&ct_domain, 2, ct_parts);
k_mem_domain_add_thread(&ct_domain, tCT);
printk("ct_domain Created\n");
k_thread_start(&enc_thread);
/* need to start all three threads. let enc go first to perform init step */

View file

@ -24,20 +24,20 @@ void enc(void);
void pt(void);
void ct(void);
#define _app_user_d K_APP_DMEM(part0)
#define _app_user_b K_APP_BMEM(part0)
#define _app_user_d K_APP_DMEM(user_part)
#define _app_user_b K_APP_BMEM(user_part)
#define _app_red_d K_APP_DMEM(part1)
#define _app_red_b K_APP_BMEM(part1)
#define _app_red_d K_APP_DMEM(red_part)
#define _app_red_b K_APP_BMEM(red_part)
#define _app_enc_d K_APP_DMEM(part2)
#define _app_enc_b K_APP_BMEM(part2)
#define _app_enc_d K_APP_DMEM(enc_part)
#define _app_enc_b K_APP_BMEM(enc_part)
#define _app_blk_d K_APP_DMEM(part3)
#define _app_blk_b K_APP_BMEM(part3)
#define _app_blk_d K_APP_DMEM(blk_part)
#define _app_blk_b K_APP_BMEM(blk_part)
#define _app_ct_d K_APP_DMEM(part4)
#define _app_ct_b K_APP_BMEM(part4)
#define _app_ct_d K_APP_DMEM(ct_part)
#define _app_ct_b K_APP_BMEM(ct_part)
/*
* Constant