Clean up SharedMemory placement new.

This commit is contained in:
Jared Boone 2016-07-24 15:27:05 -07:00
parent 49d6cda731
commit b3f4ea8978
2 changed files with 7 additions and 14 deletions

View File

@ -322,14 +322,7 @@ void EventDispatcher::event_bubble_encoder(const ui::EncoderEvent event) {
}
void EventDispatcher::init_message_queues() {
shared_memory.baseband_message = nullptr;
new (&shared_memory.application_queue) MessageQueue(
shared_memory.application_queue_data, SharedMemory::application_queue_k
);
new (&shared_memory.app_local_queue) MessageQueue(
shared_memory.app_local_queue_data, SharedMemory::app_local_queue_k
);
shared_memory.m4_panic_msg[0] = 0;
new (&shared_memory) SharedMemory;
}
MessageHandlerRegistration::MessageHandlerRegistration(

View File

@ -36,17 +36,17 @@ struct SharedMemory {
static constexpr size_t application_queue_k = 11;
static constexpr size_t app_local_queue_k = 11;
uint8_t application_queue_data[1 << application_queue_k];
uint8_t app_local_queue_data[1 << app_local_queue_k];
const Message* volatile baseband_message;
MessageQueue application_queue;
MessageQueue app_local_queue;
// TODO: M0 should directly configure and control DMA channel that is
// acquiring ADC samples.
TouchADCFrame touch_adc_frame;
uint8_t application_queue_data[1 << application_queue_k] { 0 };
uint8_t app_local_queue_data[1 << app_local_queue_k] { 0 };
const Message* volatile baseband_message { nullptr };
MessageQueue application_queue { application_queue_data, application_queue_k };
MessageQueue app_local_queue { app_local_queue_data, app_local_queue_k };
char m4_panic_msg[32];
char m4_panic_msg[32] { 0 };
};
extern SharedMemory& shared_memory;