Skip to content
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.

OS Interface + Static Buffer Allocation #120

Merged
merged 2 commits into from
Nov 10, 2018
Merged

Conversation

gokuldharan
Copy link
Contributor

to allow direct testing of class without duplicating code, and prevent dynamic heap allocation

…lass without duplicating code, and prevent dynamic heap allocation
@tygamvrelis tygamvrelis self-requested a review November 7, 2018 18:13
@tygamvrelis
Copy link
Member

Runtime verified by @gokuldharan yesterday

@@ -140,6 +141,7 @@ namespace{


buffer::BufferMaster BufferMaster;
os::OsInterfaceImpl osInterfaceImpl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that we should only need one osInterfaceImpl in all of our code. However, the memory footprint of an object with only functions is fairly small so it should be ok (relevant repl: https://repl.it/repls/InfamousMatureApplescript)

Copy link
Member

@tygamvrelis tygamvrelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try changing portMAX_DELAY to the cmsis equivalent. Looks good, should be able to pull in after

void set_lock(osMutexId lock)
{
m_lock = lock;
}
void write(const T &item)
{
xSemaphoreTake(m_lock, portMAX_DELAY);
*m_data_buf = item;
m_osInterfacePtr->OS_xSemaphoreTake(m_lock, portMAX_DELAY);
Copy link
Member

@tygamvrelis tygamvrelis Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a cmsis version of portMAX_DELAY called osWaitForever or something like that. Could you try to use the cmsis one instead? Robert mentioned it recently and I think it's a good idea since cmsis is generic

…r doc changes

Runtime verified + all tests passing
@tygamvrelis tygamvrelis merged commit 65845d3 into master Nov 10, 2018
@tygamvrelis tygamvrelis deleted the gdharan_buffer_writer branch November 10, 2018 19:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants