Files
lk/app/include/app.h

49 lines
1.2 KiB
C
Raw Normal View History

2009-01-24 21:21:08 -08:00
/*
* Copyright (c) 2009-2012 Travis Geiselbrecht
2009-01-24 21:21:08 -08:00
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
2009-01-24 21:21:08 -08:00
*/
#pragma once
2009-01-24 21:21:08 -08:00
#include <stddef.h>
#include <lk/compiler.h>
#include <stdbool.h>
#include <sys/types.h>
__BEGIN_CDECLS
2009-01-24 21:21:08 -08:00
/* app support api */
void apps_init(void); /* one time setup */
/* start an app by name.
* optionally start detached or wait for it to complete.
*/
status_t app_start_by_name(const char *name, bool detached);
2009-01-24 21:21:08 -08:00
/* app entry point */
struct app_descriptor;
typedef void (*app_init)(const struct app_descriptor *);
typedef void (*app_entry)(const struct app_descriptor *, void *args);
2009-01-24 21:21:08 -08:00
/* app startup flags */
#define APP_FLAG_NO_AUTOSTART 0x1
#define APP_FLAG_CUSTOM_STACK_SIZE 0x2
2009-01-24 21:21:08 -08:00
/* each app needs to define one of these to define its startup conditions */
struct app_descriptor {
const char *name;
app_init init;
app_entry entry;
unsigned int flags;
size_t stack_size;
2009-01-24 21:21:08 -08:00
};
#define APP_START(appname) const struct app_descriptor _app_##appname __USED __ALIGNED(sizeof(void *)) __SECTION("apps") = { .name = #appname,
2009-01-24 21:21:08 -08:00
#define APP_END };
__END_CDECLS