diff --git a/hw-tests/api-demo/api/api_caller.c b/hw-tests/api-demo/api/api_caller.c new file mode 100644 index 0000000000000000000000000000000000000000..ffac1a307ee278a85a854db30fac06ebacb209a8 --- /dev/null +++ b/hw-tests/api-demo/api/api_caller.c @@ -0,0 +1,10 @@ +void* api_call_start (uint32_t id, void* args, size_t size) +{ + // aquire semaphore + ret = SEMA_GetSema (API_CALL_SEMA); + + ApiCallSpace->id = id; + ApiCallSpace->returning = 0; + return ApiCallSpace; +} + diff --git a/hw-tests/api-demo/api/api_caller.h b/hw-tests/api-demo/api/api_caller.h new file mode 100644 index 0000000000000000000000000000000000000000..6bb899488687b949823a5ee4ca377f37b72af896 --- /dev/null +++ b/hw-tests/api-demo/api/api_caller.h @@ -0,0 +1,3 @@ +#include "api_common.h" + +int api_call (uint32_t id, void *args); diff --git a/hw-tests/api-demo/api/api_common.h b/hw-tests/api-demo/api/api_common.h new file mode 100644 index 0000000000000000000000000000000000000000..dbf7f0c43a21bd1cb6c9cacf25e11f6a91b4d402 --- /dev/null +++ b/hw-tests/api-demo/api/api_common.h @@ -0,0 +1,10 @@ +#define API_CALL_SEMA 0 + +struct api_call +{ + uint32_t id; + uint8_t returning; + unsigned char *buf; +}; + +static struct api_call **ApiCallSpace = (void*)0x20080001; diff --git a/hw-tests/api-demo/api/api_dispatcher.c b/hw-tests/api-demo/api/api_dispatcher.c new file mode 100644 index 0000000000000000000000000000000000000000..41d3a8745ce708580a5bd33dc42e15d2aefaac7d --- /dev/null +++ b/hw-tests/api-demo/api/api_dispatcher.c @@ -0,0 +1,11 @@ +#include "api_common.h" + +int +api_init (sys_cfg_sema_t *sys_cfg) +{ + int ret; + + ret = SEMA_Init (sys_cfg); + ApiCallSpace->returning = 1; +} + diff --git a/hw-tests/api-demo/api/api_dispatcher.h b/hw-tests/api-demo/api/api_dispatcher.h new file mode 100644 index 0000000000000000000000000000000000000000..69526574b31e6d5e4d6894c4174ca9e9efa028c1 --- /dev/null +++ b/hw-tests/api-demo/api/api_dispatcher.h @@ -0,0 +1,5 @@ +#include "api_common.h" + +int +api_init (sys_cfg_sema_t *sys_cfg); + diff --git a/hw-tests/api-demo/test-payload.c b/hw-tests/api-demo/test-payload.c index f0aa0fe095d07541bd4d88bfba7744606f7ab40a..2b4516d484593a28e05dfbdeacd1b95a9541322f 100644 --- a/hw-tests/api-demo/test-payload.c +++ b/hw-tests/api-demo/test-payload.c @@ -3,6 +3,8 @@ #include "mxc_delay.h" #include "api.h" +#include "api/api_dispatcher.h" + static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE}; void api_set_buzzer(uint8_t state) @@ -24,6 +26,7 @@ void api_set_led(uint8_t led, led_color_t color) int main(void) { + api_init(NULL); // Enable rxev on core1 MXC_GCR->evten |= 0x20; for (int i = 0; 1; i++) {