From 25fc6ed159aa6e3af141c32cb061866f74376567 Mon Sep 17 00:00:00 2001 From: Dino Tinitigan Date: Tue, 10 Jan 2017 09:55:59 -0800 Subject: [PATCH] shared memory structure changes for CODK-M -added struct for ipm using shared memory -added cdc-acm buffer space on shared memory which is used by the new firmware --- .../framework/include/platform.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/system/libarc32_arduino101/framework/include/platform.h b/system/libarc32_arduino101/framework/include/platform.h index 583fcf71..3fe25184 100644 --- a/system/libarc32_arduino101/framework/include/platform.h +++ b/system/libarc32_arduino101/framework/include/platform.h @@ -40,6 +40,7 @@ #define NUM_CPU 4 #define CDCACM_BUFFER_SIZE 256 +#define SHARED_BUFFER_SIZE 64 struct cdc_ring_buffer { @@ -62,6 +63,30 @@ struct cdc_acm_shared_data { int device_open; }; +struct shared_ring_buffer +{ + /** Ring buffer data */ + volatile uint8_t data[SHARED_BUFFER_SIZE]; + /** Ring buffer head index, modified by producer */ + volatile int head; + /** Ring buffer tail index, modified by consumer */ + volatile int tail; + + /** Buffer status + * 0 - locked by X86 core + * 1 - locked by arc core + * 2 - available to be taken by any core + **/ + volatile int flag; +}; + +struct ipm_shared_data +{ + struct shared_ring_buffer *quark_buffer; + struct shared_ring_buffer *arc_buffer; +}; + + /** * LMT / ARC global shared structure. This structure lies in the beginning of * the RAM. @@ -109,6 +134,18 @@ struct platform_shared_block_ { * The ARC core counts on QRK to find valid pointers in place. */ struct cdc_acm_shared_data * cdc_acm_buffers; + + struct cdc_acm_shared_data cdc_acm_buffers_obj; + + struct cdc_ring_buffer cdc_acm_shared_rx_buffer; + struct cdc_ring_buffer cdc_acm_shared_tx_buffer; + + struct ipm_shared_data *ipm_shared_data_ptr; + + struct ipm_shared_data ipm_shared_data_obj; + + struct shared_ring_buffer quark_to_ARC; + struct shared_ring_buffer ARC_to_quark; }; #define RAM_START 0xA8000000