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

machine_mem.py.exp

Blame
    • Paul Sokolovsky's avatar
      354d1752
      modmachine: Implement physical memory access using /dev/mem (Linux, etc). · 354d1752
      Paul Sokolovsky authored
      This requires root access. And on recent Linux kernels, with
      CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in
      /proc/iomem can be accessed. The above compiled-time option can be
      however overriden with boot-time option "iomem=relaxed".
      
      This also removed separate read/write paths - there unlikely would
      be a case when they're different.
      354d1752
      History
      modmachine: Implement physical memory access using /dev/mem (Linux, etc).
      Paul Sokolovsky authored
      This requires root access. And on recent Linux kernels, with
      CONFIG_STRICT_DEVMEM option enabled, only address ranges listed in
      /proc/iomem can be accessed. The above compiled-time option can be
      however overriden with boot-time option "iomem=relaxed".
      
      This also removed separate read/write paths - there unlikely would
      be a case when they're different.
    dispatcher.c 732 B
    #include <stdlib.h>
    #include "sema.h"
    #include "api/dispatcher.h"
    
    int api_dispatcher_init()
    {
    	int ret;
    
    	ret = SEMA_Init(NULL);
    	API_CALL_MEM->call_flag = _API_FLAG_IDLE;
    
    	/*
    	 * Enable TX events for both cores.
    	 * TODO: Is this the right place?
    	 */
    	MXC_GCR->evten |= 0x24;
    
    	return ret;
    }
    
    api_id_t api_dispatcher_poll()
    {
    	api_id_t id = 0;
    	while (SEMA_GetSema(_API_SEMAPHORE) == E_BUSY) {}
    
    	if (API_CALL_MEM->call_flag != _API_FLAG_CALLING) {
    		SEMA_FreeSema(_API_SEMAPHORE);
    		return 0;
    	}
    
    	id = API_CALL_MEM->id;
    	__api_dispatch_call(id, API_CALL_MEM->buffer);
    	API_CALL_MEM->call_flag = _API_FLAG_RETURNED;
    
    	SEMA_FreeSema(_API_SEMAPHORE);
    
    	/* Notify the caller that we returned */
    	__SEV();
    	__WFE();
    
    	return id;
    }