kevent: initialize kevents during boot
This commit is contained in:
parent
b053cc3279
commit
30404f60d4
1 changed files with 12 additions and 7 deletions
19
init/main.c
19
init/main.c
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <ardix/io.h>
|
#include <ardix/io.h>
|
||||||
#include <ardix/kent.h>
|
#include <ardix/kent.h>
|
||||||
|
#include <ardix/kevent.h>
|
||||||
#include <ardix/sched.h>
|
#include <ardix/sched.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -27,17 +28,15 @@
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint32_t count = 0;
|
volatile uint32_t count = 0;
|
||||||
unsigned int print_count = 0;
|
volatile unsigned int print_count = 0;
|
||||||
|
|
||||||
REG_PIOB_OER = 1 << 27;
|
|
||||||
REG_PIOB_PER = 1 << 27;
|
|
||||||
REG_PIOB_CODR = 1 << 27;
|
|
||||||
|
|
||||||
int err = kent_root_init();
|
int err = kent_root_init();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
kevents_init();
|
||||||
|
|
||||||
err = sched_init();
|
err = sched_init();
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
return err;
|
||||||
|
@ -50,11 +49,17 @@ int main(void)
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
/* we should have a serial console now */
|
||||||
|
|
||||||
|
REG_PIOB_OER = 1 << 27;
|
||||||
|
REG_PIOB_PER = 1 << 27;
|
||||||
|
REG_PIOB_CODR = 1 << 27;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (count++ != 1000000)
|
if (count++ != 1000000)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
printf("hello, world (%u)!\n", print_count);
|
printf("hello, world (%u)\n", print_count);
|
||||||
|
|
||||||
print_count++;
|
print_count++;
|
||||||
if (print_count % 2)
|
if (print_count % 2)
|
||||||
|
|
Loading…
Reference in a new issue