Skip to content
Snippets Groups Projects
Select Git revision
  • 860ffb0a4365bba62cbd692392375df9fd4a72e7
  • wip-bootstrap default
  • dualcore
  • ch3/leds
  • ch3/time
  • master
6 results

main.c

Blame
  • api_dispatcher.c 652 B
    #include "api_dispatcher.h"
    
    int api_init (sys_cfg_sema_t *sys_cfg)
    {
    	int ret;
    
    	ret = SEMA_Init (sys_cfg);
    	/* Set the status of the flag to a valid initial state (right before
    	 * api-calls are made) */
    	ApiCallSpace->returning = 1;
    
    	return ret;
    }
    
    /* Generated function */
    void __api_dispatch_call(uint32_t id, void*buffer);
    
    void api_dispatcher()
    {
    	while (SEMA_GetSema(API_CALL_SEMA) == E_BUSY) {}
    
    	if (ApiCallSpace->returning == 1) {
    		SEMA_FreeSema(API_CALL_SEMA);
    		return;
    	}
    
    	printf("core1: Catched API CALL!\n");
    	__api_dispatch_call(ApiCallSpace->id, ApiCallSpace->buf);
    
    	ApiCallSpace->returning = 1;
    
    	SEMA_FreeSema(API_CALL_SEMA);
    }