#ifndef JMPKIT_MACHINE10_MAIN_H #define JMPKIT_MACHINE10_MAIN_H #include #include #define M10_ABI_MAGIC UINT64_C(0x000030314d504d4a) #define M10_ABI_VERSION_MAINBOARD UINT32_C(3) #define M10_EVENT_MAGIC UINT64_C(0x00544e455630314d) #define M10_EVENT_VERSION_PAYLOAD UINT32_C(2) #define M10_DOORBELL_PORT UINT16_C(0x4d10) #define M10_RETAINED_START UINT64_C(0x02000000) #define M10_RETAINED_END UINT64_C(0x04000000) enum machine10_operation { M10_OP_HTTP_CALL = 1, M10_OP_COMMIT_SLEEP = 4, M10_OP_COMMIT_STOP = 5, M10_OP_EXIT = 6 }; enum machine10_event_type { M10_EVENT_INIT = 1, M10_EVENT_TIMER = 2, M10_EVENT_TRIGGER = 3 }; enum machine10_method { M10_METHOD_GET = 1, M10_METHOD_POST = 2, M10_METHOD_PUT = 3, M10_METHOD_DELETE = 4 }; enum machine10_timer_action { M10_TIMER_KEEP = 0, M10_TIMER_CANCEL = 1, M10_TIMER_SET = 2 }; enum machine10_disposition { M10_DISPOSITION_SLEEP = 1, M10_DISPOSITION_STOP = 2 }; enum machine10_error { M10_ERROR_NONE = 0, M10_ERROR_BAD_ABI = 1, M10_ERROR_BAD_POINTER = 2, M10_ERROR_BAD_EVENT = 3, M10_ERROR_STATE_MISMATCH = 4, M10_ERROR_RESPONSE_TOO_LARGE = 5 }; struct machine10_event_v2 { uint64_t magic; uint32_t version; uint32_t type; uint64_t occurrence_id; uint64_t prior_generation; uint64_t payload_address; uint64_t payload_length; }; struct machine10_abi_v3 { uint64_t magic; uint32_t abi_version; uint32_t method; uint64_t request_id; uint64_t target_address; uint64_t target_length; uint64_t body_address; uint64_t body_length; uint64_t response_address; uint64_t response_capacity; uint64_t response_length; uint32_t http_status; uint32_t error; uint64_t completion_sequence; uint32_t event_type; uint32_t timer_action; uint64_t event_occurrence_id; uint64_t wake_after_ms; uint32_t disposition; uint32_t reserved; }; _Static_assert(sizeof(struct machine10_event_v2) == 48, "Machine10 event ABI changed"); _Static_assert(sizeof(struct machine10_abi_v3) == 128, "Machine10 shared ABI changed"); _Static_assert(offsetof(struct machine10_abi_v3, completion_sequence) == 88, "Machine10 completion offset changed"); _Static_assert(offsetof(struct machine10_abi_v3, event_type) == 96, "Machine10 event offset changed"); _Static_assert(offsetof(struct machine10_abi_v3, wake_after_ms) == 112, "Machine10 timer offset changed"); #endif