SingingCat 0
application
user_app_exe.h
1#ifndef USER_APP_EXE_H
2#define USER_APP_EXE_H
3
4/* these are functions that help the firmware to decide wether or not
5 * to execute user code and locate it if applicable
6 * these are not relevant for the user code itself
7 */
8
9#include "main-header.h"
10#include "user_app_info.h"
11
12struct userapp_info *get_user_app();
13// return >0 if a user_app is installed, compatible and should be executed
14int user_app_executable();
15void user_app_enable();
16void user_app_disable();
17int user_app_is_enabled();
18int user_app_is_valid();
19int user_app_checksum_valid();
20void user_app_reset_state();
21void user_app_control(struct command *com);
22int user_app_info(struct command *com);
23// send a packet to the server describing current status of userapp
24int send_user_app_status();
25
26// these are the actual user hooks.
27
28int invoke_on_command_received(struct command *com);
29void invoke_start(int MCULIBHANDLE);
30void invoke_stop();
31void invoke_on_new_node(struct hostroute *host);
32void invoke_user_loop();
33void user_app_exe_init();
34// check if the userapp at baseadr x is valid
35int userapp_checksum_valid(void *baseadr);
36
37// called by irq handlers and loop entry/exit, so faults can be allocated to userapp if they happen
38void set_in_app(uint8_t a);
39
40// callback for serialports (in case user wants to get IRQ for chars from serialport)
41// returns 0 if no callback handler set, otherwise >0
42int user_serial_callback(int portnum, int byte);
43#endif
this must be implemented by the userapp, stored in flash at the beginning of the file (offset 0)
user application interface