Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid repetitive code in our C demos #146

Open
sy2002 opened this issue Sep 24, 2020 · 0 comments
Open

Avoid repetitive code in our C demos #146

sy2002 opened this issue Sep 24, 2020 · 0 comments
Assignees
Labels

Comments

@sy2002
Copy link
Owner

sy2002 commented Sep 24, 2020

We might want to add

// convenient mechanism to access QNICE's Memory Mapped IO registers
#define MMIO( __x ) *((unsigned int volatile *) __x )

to c/qnice/monitor-lib/include/qmon.h as this is something that we need "all the time". Of course - if we do that - we need to sift through demos and remove this definition there.

Also common things that we need in our demos like non-blocking waiting for a key, as Michael did it in world.c:

      if (MMIO(IO_UART_SRA) & 1)
      {
         unsigned int tmp = MMIO(IO_UART_RHRA);
         break;
      }
      if (MMIO(IO_KBD_STATE) & KBD_NEW_ANY)
      {
         unsigned int tmp = MMIO(IO_KBD_DATA);
         break;
      }

We might want to add this to the .h file mentioned above and the implementation to c/qnice/monitor-lib/src/qmon.c

I bet there are a handful more things that we would find which would overall make our C demo code less redundant.

As this is just a "cleanup before a release" task, the priority is rather low, I guess :-)

I assigned it to myself and @MJoergen .

Obviously also some "how to program MMIO" and "how to program realtime" best practices need to be written around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants