Skip to content
Snippets Groups Projects
Select Git revision
  • f8c5454b6e4c4252f711ad4665c8cfd5e108b36c
  • master default protected
  • feature-ambient-sensor
  • feature-timed-vibrate
  • ch3/api-speed-eval2
  • rahix/bma
  • freertos-btle
  • schneider/mp-for-old-bl
  • ch3/leds-api
  • ch3/genapi-refactor
  • ch3/dual-core
  • dualcore
12 results

api_dispatcher.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    Rahix's avatar
    rahix authored
    Signed-off-by: default avatarRahix <rahix@rahix.de>
    f8c5454b
    History
    api_dispatcher.c 651 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;
    }
    
    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");
    	printf("%d: ",ApiCallSpace->id);
    	for (int i = 0; i < 16; i++) {
    		printf("0x%02x ", ((char*)ApiCallSpace->buf)[i]);
    	}
    	printf("\n");
    
    	ApiCallSpace->returning = 1;
    
    	SEMA_FreeSema(API_CALL_SEMA);
    }