Skip to content
Snippets Groups Projects
Select Git revision
  • f8c5454b6e4c4252f711ad4665c8cfd5e108b36c
  • master default protected
  • patch-1
  • rahix/simple_menu
  • koalo/bhi160
  • ch3/splashscreen
  • genofire/ble-rewrite
  • koalo/bhi160-works-but-dirty
  • ios-workarounds
  • koalo/wip/i2c-for-python
  • renze/safe_mode
  • renze/hatchery_apps
  • schneider/fundamental-test
  • koalo/factory-reset
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • rahix/bma
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
28 results

api_caller.c

Blame
  • Forked from card10 / firmware
    1807 commits behind the upstream repository.
    Rahix's avatar
    rahix authored
    Signed-off-by: default avatarRahix <rahix@rahix.de>
    f8c5454b
    History
    api_caller.c 650 B
    #include <stdlib.h>
    
    #include "api/api_caller.h"
    #include "tmr_utils.h"
    
    void* api_call_start (uint32_t id, void* args, uint32_t size)
    {
    	// aquire semaphore
    	while (E_BUSY == SEMA_GetSema (API_CALL_SEMA)) ;
    
    	ApiCallSpace->id = id;
    	ApiCallSpace->returning = 0;
    	return ApiCallSpace->buf;
    }
    
    void* api_call_bother_dispatcher (void* buf)
    {
    	SEMA_FreeSema (API_CALL_SEMA);
    	// TODO: set event
    
    	while(1) {
    		// aquire semaphore
    		while (E_BUSY == SEMA_GetSema (API_CALL_SEMA)) ;
    		if (ApiCallSpace->returning == 1) {
    			break;
    		}
    		SEMA_FreeSema(API_CALL_SEMA);
    		TMR_Delay(MXC_TMR2, MSEC(100), 0);
    	}
    	SEMA_FreeSema(API_CALL_SEMA);
    
    	return NULL;
    }